Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props use types over interfaces #19850

Merged
merged 13 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-accordion",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-avatar",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-badge",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-button",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Updated getCallbackArguments for complex types",
"packageName": "@fluentui/react-conformance",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-divider",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-image",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-label",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-link",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-menu",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-popover",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-portal",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-slider",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updating to types over interfaces",
"packageName": "@fluentui/react-tooltip",
"email": "[email protected]",
"dependentChangeType": "patch"
}
171 changes: 87 additions & 84 deletions packages/react-accordion/Spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,104 +34,107 @@ Sample usages will be given in the following section of this document [Sample co
The root level component serves context and common API between all children.

```ts
export interface AccordionProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
/**
* Indicates if keyboard navigation is available
*/
navigable?: boolean;
/**
* Indicates if Accordion support multiple Panels opened at the same time
*/
multiple?: boolean;
/**
* Indicates if Accordion support multiple Panels closed at the same time
*/
collapsible?: boolean;
/**
* value indicating the items that are opened
* If used, the component will be in controlled mode
*/
openItems?: AccordionItemValue | AccordionItemValue[];
/**
* Index indicating the panels that are opened
*/
defaultOpenItems?: AccordionItemValue | AccordionItemValue[];
/**
* Size of spacing in the heading
*/
size?: 'small' | 'medium' | 'large' | 'extra-large';
/**
* The component to be used as button in the heading
*/
button?: ShorthandProps<React.HTMLAttributes<HTMLElement>>;
/**
* Expand icon slot rendered before (or after) children content in heading
*/
expandIcon?: ShorthandProps<AccordionHeaderExpandIconProps>;
/**
* The position of the expand icon slot in heading
*/
expandIconPosition?: 'start' | 'end';
/**
* Extra icon slot rendered before children content in heading
*/
icon?: ShorthandProps<AccordionHeaderIconProps>;
/**
* Indicates if the AccordionHeader should be inline-block
*/
inline?: boolean;
onToggle?(event: AccordionToggleEvent, data: AccordionToggleData): void;
}
export type AccordionProps = ComponentProps &
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than continue to keep this in sync with the actual props, should we just update this to point to the react-*.api.md or the actual types file (tho given the actual typoes are a little harder to read)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, after implementation is done I don't think there's much sense to having the types fully duplicated in the spec

React.HTMLAttributes<HTMLElement> & {
/**
* Indicates if keyboard navigation is available
*/
navigable?: boolean;
/**
* Indicates if Accordion support multiple Panels opened at the same time
*/
multiple?: boolean;
/**
* Indicates if Accordion support multiple Panels closed at the same time
*/
collapsible?: boolean;
/**
* value indicating the items that are opened
* If used, the component will be in controlled mode
*/
openItems?: AccordionItemValue | AccordionItemValue[];
/**
* Index indicating the panels that are opened
*/
defaultOpenItems?: AccordionItemValue | AccordionItemValue[];
/**
* Size of spacing in the heading
*/
size?: 'small' | 'medium' | 'large' | 'extra-large';
/**
* The component to be used as button in the heading
*/
button?: ShorthandProps<React.HTMLAttributes<HTMLElement>>;
/**
* Expand icon slot rendered before (or after) children content in heading
*/
expandIcon?: ShorthandProps<AccordionHeaderExpandIconProps>;
/**
* The position of the expand icon slot in heading
*/
expandIconPosition?: 'start' | 'end';
/**
* Extra icon slot rendered before children content in heading
*/
icon?: ShorthandProps<AccordionHeaderIconProps>;
/**
* Indicates if the AccordionHeader should be inline-block
*/
inline?: boolean;
onToggle?(event: AccordionToggleEvent, data: AccordionToggleData): void;
};
```

### AccordionItem

Each Combination of `AccordionHeader` and `AccordionPanel` should be inside an `AccordionItem`, and The `Accordion` component should contain one or more `AccordionItem`.

```ts
export interface AccordionItemProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
/**
* Disables opening/closing of panel inside the item
*/
disabled?: boolean;
/**
* required value that identifies this item inside an Accordion component
*/
value: AccordionItemValue;
}
export type AccordionItemProps = ComponentProps &
React.HTMLAttributes<HTMLElement> & {
/**
* Disables opening/closing of panel inside the item
*/
disabled?: boolean;
/**
* required value that identifies this item inside an Accordion component
*/
value: AccordionItemValue;
};
```

### AccordionHeader

Label for or thumbnail representing a section of content that also serves as a control for showing, and in some implementations, hiding the section of content

```ts
export interface AccordionHeaderProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {
/**
* Size of spacing in the heading
*/
size?: 'small' | 'medium' | 'large' | 'extra-large';
/**
* The component to be used as button in heading
*/
button?: ShorthandProps<React.HTMLAttributes<HTMLElement>>;
/**
* Expand icon slot rendered before (or after) children content in heading
*/
expandIcon?: ShorthandProps<AccordionHeaderExpandIconProps>;
/**
* The position of the expand icon slot in heading
*/
expandIconPosition?: 'start' | 'end';
/**
* Extra icon slot rendered before children content in heading
*/
icon?: ShorthandProps<AccordionHeaderIconProps>;
/**
* Indicates if the AccordionHeader should be inline-block
*/
inline?: boolean;
}
export type AccordionHeaderProps = ComponentProps &
React.HTMLAttributes<HTMLElement> & {
/**
* Size of spacing in the heading
*/
size?: 'small' | 'medium' | 'large' | 'extra-large';
/**
* The component to be used as button in heading
*/
button?: ShorthandProps<React.HTMLAttributes<HTMLElement>>;
/**
* Expand icon slot rendered before (or after) children content in heading
*/
expandIcon?: ShorthandProps<AccordionHeaderExpandIconProps>;
/**
* The position of the expand icon slot in heading
*/
expandIconPosition?: 'start' | 'end';
/**
* Extra icon slot rendered before children content in heading
*/
icon?: ShorthandProps<AccordionHeaderIconProps>;
/**
* Indicates if the AccordionHeader should be inline-block
*/
inline?: boolean;
};
```

### AccordionPanel
Expand Down
Loading