-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Update Rating api and stories #30092
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
393c4ba
Update Rating api and stories
tomi-msft 77a6ba5
Merge branch 'master' of https://github.com/microsoft/fluentui into r…
tomi-msft 6cb417b
api update
tomi-msft 9ce08a5
Update storis and type files with new values from figma
tomi-msft ae1f089
Merge branch 'master' into react-rating-api-update
tomi-msft a1b15b9
change file and api update
tomi-msft 90e5e78
update api: change appearance to color and precision to step
tomi-msft 53e0c4c
color story edit and change file edit
tomi-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-rating-preview-94bd847c-77c5-4f2e-8000-acbceb63aa7e.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "patch", | ||
| "comment": "chore: Updating doc stories and API.", | ||
| "packageName": "@fluentui/react-rating-preview", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "patch" | ||
| } |
111 changes: 76 additions & 35 deletions
111
packages/react-components/react-rating-preview/docs/Spec.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1,104 @@ | ||
| # @fluentui/react-rating-preview Spec | ||
| # @fluentui/react-rating Spec | ||
|
|
||
| ## Background | ||
|
|
||
| _Description and use cases of this component_ | ||
| A `Rating` component allows users to provide a rating for a particular item. | ||
|
|
||
| This component displays a set of stars or other symbols that represent the rating value. Users can interact with the component to select a rating by clicking on the stars or using touch gestures. | ||
|
|
||
| ## Prior Art | ||
|
|
||
| _Include background research done for this component_ | ||
| ### Open UI | ||
|
|
||
| ### Comparison of v8 and v0 | ||
|
|
||
| - _Link to Open UI research_ | ||
| - _Link to comparison of v7 and v0_ | ||
| - _Link to GitHub epic issue for the converged component_ | ||
| The existing components are: | ||
|
|
||
| - v8 | ||
| - `Rating` | ||
| - v0 | ||
|
|
||
| ## Sample Code | ||
|
|
||
| _Provide some representative example code that uses the proposed API for the component_ | ||
| Basic example: | ||
|
|
||
| ## Variants | ||
| ```jsx | ||
| import { Rating } from '@fluentui/react-rating'; | ||
|
|
||
| _Describe visual or functional variants of this control, if applicable. For example, a slider could have a 2D variant._ | ||
| function App() { | ||
| return <Rating />; | ||
| } | ||
| ``` | ||
|
|
||
| ## API | ||
|
|
||
| _List the **Props** and **Slots** proposed for the component. Ideally this would just be a link to the component's `.types.ts` file_ | ||
| ### Slots | ||
|
|
||
| #### Rating slots | ||
|
|
||
| - `root` - The root slot of the `Rating` is the container that will contain the slots that make up a `Rating`. The default html element is a `div`. | ||
| - `ratingLabel` - This slot will render the value of the `Rating`. The default html element is a `label`. | ||
| - `ratingCountLabel`- This slot will render the total number of ratings. The default html element is a `label`. | ||
|
|
||
| #### RatingItem slots | ||
|
|
||
| - `root` - The root slot of the `RatingItem`. The default element is `span`. | ||
| - `selectedIcon` - Icon displayed when `Rating` value is greater than or equal to the `RatingItem` value. | ||
| - `selectedFilledIcon` - Icon displayed when `Rating` value is less than the `RatingItem` value. Outline style gray | ||
| - `selectedUnfilledIcon` - Icon displayed when `Rating` value is less than the `RatingItem` value. Outline style white. | ||
| - `halfValueInput` - Input slot for when `precision` prop is active and need to render half values of `RatingItem`. | ||
| - `fullValueInput` - Default input slot to render selected `RatingItem` | ||
|
|
||
| ### Props | ||
|
|
||
| See API at [Rating.types.tsx](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-rating-preview/src/components/Rating/Rating.types.ts). | ||
|
|
||
| ## Structure | ||
|
|
||
| - _**Public**_ | ||
| - _**Internal**_ | ||
| - _**DOM** - how the component will be rendered as HTML elements_ | ||
| ```html | ||
| <!-- Container for Rating --> | ||
| <div class="fui-Rating"> | ||
| <input /> | ||
| <!-- Container for RatingItem --> | ||
| <span class="fui-RatingItem"> | ||
| <div class="fui-RatingItem"> | ||
| <input /> | ||
| <svg /> | ||
| </div> | ||
| </span> | ||
| </div> | ||
| ``` | ||
|
|
||
| ## Migration | ||
|
|
||
| _Describe what will need to be done to upgrade from the existing implementations:_ | ||
|
|
||
| - _Migration from v8_ | ||
| - _Migration from v0_ | ||
| See [MIGRATION.md](./MIGRATION.md). | ||
|
|
||
| ## Behaviors | ||
|
|
||
| _Explain how the component will behave in use, including:_ | ||
| ### States | ||
|
|
||
| - **Display** - The `Rating` will use the following priority: | ||
|
|
||
| - The `appearance` prop will dictate whether an unfilled `RatingItem` has a neutral white background or a gray background. Typically used for readOnly | ||
| - The `mode` prop will be used to set the type of `Rating`. | ||
| - The `max` prop sets how many `RatingItems` there are in the `Rating` | ||
| - Setting the `size` prop will allow the user to specify the size of the element. | ||
| - You can pass in filled and regular versions of icons to `iconFilled` and `iconOutline` slots to render custom `RatingItems`. | ||
|
|
||
| ### Interaction | ||
|
|
||
| The Rating can be interactive or non-iteractive depending on the use case | ||
|
|
||
| - **Keyboard** - Can use arrow keys. | ||
| - **Mouse** | ||
|
|
||
| - Click: Selects a `RatingItem` | ||
| - Hover: Fills up to the hovered `RatingItem` | ||
|
|
||
| - _Component States_ | ||
| - _Interaction_ | ||
| - _Keyboard_ | ||
| - _Cursor_ | ||
| - _Touch_ | ||
| - _Screen readers_ | ||
| - **Touch** | ||
| - Press: Selects a `RatingItem` | ||
| - Drag: No behavior | ||
|
|
||
| ## Accessibility | ||
|
|
||
| Base accessibility information is included in the design document. After the spec is filled and review, outcomes from it need to be communicated to design and incorporated in the design document. | ||
|
|
||
| - Decide whether to use **native element** or folow **ARIA** and provide reasons | ||
| - Identify the **[ARIA](https://www.w3.org/TR/wai-aria-practices-1.2/) pattern** and, if the component is listed there, follow its specification as possible. | ||
| - Identify accessibility **variants**, the `role` ([ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#role_definitions)) of the component, its `slots` and `aria-*` props. | ||
| - Describe the **keyboard navigation**: Tab Oder and Arrow Key Navigation. Describe any other keyboard **shortcuts** used | ||
| - Specify texts for **state change announcements** - [ARIA live regions | ||
| ](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) (number of available items in dropdown, error messages, confirmations, ...) | ||
| - Identify UI parts that appear on **hover or focus** and specify keyboard and screen reader interaction with them | ||
| - List cases when **focus** needs to be **trapped** in sections of the UI (for dialogs and popups or for hierarchical navigation) | ||
| - List cases when **focus** needs to be **moved programatically** (if parts of the UI are appearing/disappearing or other cases) | ||
| - Tbd. Needs some sort of labelling for the `RatingItem` when interactive and for the whole `Rating` component when readOnly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.