-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Progress scaffold & implementation #24023
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
tomi-msft
merged 50 commits into
microsoft:master
from
tomi-msft:react-progress-implementation
Sep 30, 2022
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
f84c2e4
Progress scaffold & implementation
tomi-msft 2edb969
Update state styling and stories
tomi-msft e15e870
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
tomi-msft 1f2237a
update dependencies
tomi-msft 96f8486
merge with master
tomi-msft b1be815
remove dup script from package.json
tomi-msft df8797e
Add appearance props and update styling
tomi-msft 3e173de
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
tomi-msft 9507802
api update
tomi-msft 622d491
add test to disabled conformance test array
tomi-msft 58e9050
Add testOptions
tomi-msft 771603d
Add size styling and stories
tomi-msft f58a3c7
Merge branch 'master' into react-progress-implementation
tomi-msft 2b11456
api update
tomi-msft a7f1cc7
Merge branch 'react-progress-implementation' of https://github.com/to…
tomi-msft 679f21e
Apply suggestions from code review
tomi-msft 4bff1c8
react-label version update
tomi-msft 96eb51c
merge with master
tomi-msft 202fa99
merge with master
tomi-msft 5ace35e
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
tomi-msft 52d74f3
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
tomi-msft d44ddee
Update styling and package.json
tomi-msft 858c591
change files
tomi-msft 66074d3
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
tomi-msft 7b606d3
api update
tomi-msft e3fda55
fix dependency mismatch
tomi-msft adfe14c
Apply suggestions from code review
tomi-msft 1655de0
Remove progressState file
tomi-msft f79f318
remove random spinbutton change
tomi-msft 33a0119
change files
tomi-msft a3e86e6
fix dependency mismatch
tomi-msft e37a4ab
Add slots and update styling
tomi-msft 96b480a
Update styling and add new slots
tomi-msft e3a9c72
add specificity to determinate style
tomi-msft 0771d69
fix positioning
tomi-msft 75243b1
remove unused file
tomi-msft d1bd42d
api update
tomi-msft c8a8e2f
Apply suggestions from code review
tomi-msft f7f3e98
Apply changes from code review
tomi-msft e6f3a9c
Clean up stories
tomi-msft 3b567f3
Update snapshot
tomi-msft 30b94ec
api update
tomi-msft 387d030
Apply suggestions from code review
tomi-msft 22d76d0
Remove animation from examples and cleanup
tomi-msft d81d803
cleanup
tomi-msft bf2697b
revert README.md
tomi-msft 7c7b56b
update snapshot
tomi-msft b8d4e77
revert README.md
tomi-msft a28d531
Fix stories
tomi-msft 884dd4a
api update
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
packages/react-components/react-progress/bundle-size/Progress.fixture.js
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 @@ | ||
| import { Progress } from '@fluentui/react-progress'; | ||
|
|
||
| console.log(Progress); | ||
|
|
||
| export default { | ||
| name: 'Progress', | ||
| }; | ||
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
48 changes: 43 additions & 5 deletions
48
packages/react-components/react-progress/src/components/Progress/Progress.types.ts
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,17 +1,55 @@ | ||
| import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; | ||
|
|
||
| export type ProgressSlots = { | ||
| root: Slot<'div'>; | ||
| /** | ||
| * The root of the Progress | ||
| * The root slot receives the `className` and `style` specified directly on the `<Progress>`. | ||
| */ | ||
| root: NonNullable<Slot<'div'>>; | ||
| /** | ||
| * The title of the Progress. | ||
| * The label slot receives the styling related to the title associated with the Progress. | ||
| */ | ||
| label?: Slot<'span'>; | ||
| /** | ||
| * The animated slot of the Progress | ||
| * The bar slot receives the styling related to the loading bar associated with the Progress | ||
| */ | ||
| bar?: NonNullable<Slot<'div'>>; | ||
| /** | ||
| * The track slot of the Progress | ||
| * The track slot receives the styling related to the loading bar track associated with the Progress | ||
| */ | ||
| track?: NonNullable<Slot<'div'>>; | ||
| /** | ||
| * The description slot of the Progress | ||
| * The description slot receives the styling related to the description associated with the Progress | ||
| */ | ||
| description?: Slot<'span'>; | ||
| }; | ||
|
|
||
| /** | ||
| * Progress Props | ||
| */ | ||
| export type ProgressProps = ComponentProps<ProgressSlots> & {}; | ||
| export type ProgressProps = Omit<ComponentProps<ProgressSlots>, 'size'> & { | ||
| /** | ||
| * Prop to set whether the Progress is determinate or indeterminate | ||
| * @default false | ||
| */ | ||
| indeterminate?: boolean; | ||
| /** | ||
| * Percentage of the operation's completeness, numerically between 0 and 100. | ||
| */ | ||
| percentComplete?: number; | ||
| /** | ||
| * The thickness of the Progress bar | ||
| * @default 'medium' | ||
| */ | ||
| thickness?: 'medium' | 'large'; | ||
| }; | ||
|
|
||
| /** | ||
| * State used in rendering Progress | ||
| */ | ||
| export type ProgressState = ComponentState<ProgressSlots>; | ||
| // TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from ProgressProps | ||
| // & Required<Pick<ProgressProps, 'propName'>> | ||
| export type ProgressState = ComponentState<ProgressSlots> & | ||
| Required<Pick<ProgressProps, 'indeterminate' | 'percentComplete' | 'thickness'>>; |
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
28 changes: 0 additions & 28 deletions
28
packages/react-components/react-progress/src/components/Progress/useProgress.ts
This file was deleted.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
packages/react-components/react-progress/src/components/Progress/useProgress.tsx
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,69 @@ | ||
| import * as React from 'react'; | ||
| import { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities'; | ||
| import type { ProgressProps, ProgressState } from './Progress.types'; | ||
|
|
||
| /** | ||
| * Create the state required to render Progress. | ||
| * | ||
| * The returned state can be modified with hooks such as useProgressStyles_unstable, | ||
| * before being passed to renderProgress_unstable. | ||
| * | ||
| * @param props - props from this instance of Progress | ||
| * @param ref - reference to root HTMLElement of Progress | ||
| */ | ||
| export const useProgress_unstable = (props: ProgressProps, ref: React.Ref<HTMLElement>): ProgressState => { | ||
| // Props | ||
| const { thickness = 'medium', indeterminate = false, percentComplete = 0 } = props; | ||
| const baseId = useId('progress-'); | ||
|
|
||
| const root = getNativeElementProps('div', { ref, role: 'progressbar', ...props }); | ||
|
|
||
| const label = resolveShorthand(props.label, { | ||
| defaultProps: { | ||
| id: baseId + '__label', | ||
| }, | ||
| }); | ||
|
|
||
| const description = resolveShorthand(props.description, { | ||
| defaultProps: { | ||
| id: baseId + '__description', | ||
| }, | ||
| }); | ||
|
|
||
| const bar = resolveShorthand(props.bar, { | ||
| required: true, | ||
khmakoto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| defaultProps: { | ||
| 'aria-valuemin': indeterminate ? undefined : 0, | ||
| 'aria-valuemax': indeterminate ? undefined : 100, | ||
| 'aria-valuenow': indeterminate ? undefined : Math.floor(percentComplete), | ||
| }, | ||
| }); | ||
|
|
||
| const track = resolveShorthand(props.track, { | ||
| required: true, | ||
| }); | ||
|
|
||
| if (label && !root['aria-label'] && !root['aria-labelledby']) { | ||
| root['aria-labelledby'] = label.id; | ||
| } | ||
|
|
||
| const state: ProgressState = { | ||
| indeterminate, | ||
| percentComplete, | ||
| thickness, | ||
| components: { | ||
| root: 'div', | ||
| bar: 'div', | ||
| track: 'div', | ||
| label: 'span', | ||
| description: 'span', | ||
| }, | ||
| root, | ||
| bar, | ||
| track, | ||
| label, | ||
| description, | ||
| }; | ||
|
|
||
| return state; | ||
| }; | ||
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.