-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Users/procload/add progressbar as new component #26329
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
procload
merged 18 commits into
microsoft:web-components-v3
from
procload:users/procload/add-progressbar-as-new-component
Jan 18, 2023
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
59c84e6
Adds web component version of ProgressBar
procload 60c7f67
Generates change
procload 600337a
Renames progressbar to progress-bar
procload 607551a
Changes alphabetical ordering of imports
procload 96d4ff3
Enumerates null value; Adds ? to boolean in Story
procload 2480006
Adds typedocs to progress-bar class
procload 209fce1
Fixes class to attribute typo in CSS
procload 6dbaf03
Removes duped CSS
procload be61425
Adds export of progress-bar to package.json
procload ab8f173
Removes null in validation state object
procload f05ff02
Removes local CSS variables; Removes defaults on thickness and rounde…
procload 0988572
Removes unused CSS
procload d8ff717
Removes unused options, pause and min, that don't exist in Fluent
procload b682cd6
Merge branch 'web-components-v3' into users/procload/add-progressbar-…
procload 9532a32
Addresses remaining feedback on PR: Renames rect to square; Cleans up…
procload a6acfb8
Merge branch 'users/procload/add-progressbar-as-new-component' of htt…
procload 7de2f2e
Fixes Storybook type error
procload d55df45
Runs build to generate api-report to fix failing build
procload 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-web-components-d423d05a-1b1e-422f-ab9a-afc288197681.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": "prerelease", | ||
| "comment": "add progressbar as new component", | ||
| "packageName": "@fluentui/web-components", | ||
| "email": "ryan@ryanmerrill.net", | ||
| "dependentChangeType": "patch" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export * from './badge/index.js'; | ||
| export * from './counter-badge/index.js'; | ||
| export * from './progress-bar/index.js'; | ||
| export * from './text/index.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,4 @@ | ||
| import { FluentDesignSystem } from '../fluent-design-system.js'; | ||
| import { definition } from './progress-bar.definition.js'; | ||
|
|
||
| definition.define(FluentDesignSystem.registry); |
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,5 @@ | ||
| export * from './progress-bar.js'; | ||
| export * from './progress-bar.options.js'; | ||
| export { definition as ProgressBarDefinition } from './progress-bar.definition.js'; | ||
| export { styles as ProgressBarStyles } from './progress-bar.styles.js'; | ||
| export { template as ProgressBarTemplate } from './progress-bar.template.js'; |
18 changes: 18 additions & 0 deletions
18
packages/web-components/src/progress-bar/progress-bar.definition.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 |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { FluentDesignSystem } from '../fluent-design-system.js'; | ||
| import { ProgressBar } from './progress-bar.js'; | ||
| import { styles } from './progress-bar.styles.js'; | ||
| import { template } from './progress-bar.template.js'; | ||
|
|
||
| /** | ||
| * The Fluent ProgressBar Element. | ||
| * | ||
| * | ||
| * @public | ||
| * @remarks | ||
| * HTML Element: \<fluent-progress-bar\> | ||
| */ | ||
| export const definition = ProgressBar.compose({ | ||
| name: `${FluentDesignSystem.prefix}-progress-bar`, | ||
| template, | ||
| styles, | ||
| }); |
47 changes: 47 additions & 0 deletions
47
packages/web-components/src/progress-bar/progress-bar.options.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 |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { ValuesOf } from '@microsoft/fast-foundation'; | ||
|
|
||
| /** | ||
| * ProgressBarThickness Constants | ||
| * @public | ||
| */ | ||
| export const ProgressBarThickness = { | ||
| medium: 'medium', | ||
| large: 'large', | ||
| } as const; | ||
|
|
||
| /** | ||
| * Applies bar thickness to the content | ||
| * @public | ||
| */ | ||
| export type ProgressBarThickness = ValuesOf<typeof ProgressBarThickness>; | ||
|
|
||
| /** | ||
| * ProgressBarShape Constants | ||
| * @public | ||
| */ | ||
| export const ProgressBarShape = { | ||
| rounded: 'rounded', | ||
| square: 'square', | ||
| } as const; | ||
|
|
||
| /** | ||
| * Applies bar shape to the content | ||
| * @public | ||
| */ | ||
| export type ProgressBarShape = ValuesOf<typeof ProgressBarShape>; | ||
|
|
||
| /** | ||
| * ProgressBarValidationState Constants | ||
| * @public | ||
| */ | ||
| export const ProgressBarValidationState = { | ||
| success: 'success', | ||
| warning: 'warning', | ||
| error: 'error', | ||
| } as const; | ||
|
|
||
| /** | ||
| * Applies validation state to the content | ||
| * @public | ||
| */ | ||
| export type ProgressBarValidationState = ValuesOf<typeof ProgressBarValidationState>; |
69 changes: 69 additions & 0 deletions
69
packages/web-components/src/progress-bar/progress-bar.stories.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 |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import { html } from '@microsoft/fast-element'; | ||
| import type { Args, Meta } from '@storybook/html'; | ||
| import { renderComponent } from '../__test__/helpers.js'; | ||
| import type { ProgressBar as FluentProgressBar } from './progress-bar.js'; | ||
| import { ProgressBarShape, ProgressBarThickness, ProgressBarValidationState } from './progress-bar.options.js'; | ||
| import './define.js'; | ||
|
|
||
| type ProgressStoryArgs = Args & FluentProgressBar; | ||
| type ProgressStoryMeta = Meta<ProgressStoryArgs>; | ||
|
|
||
| const storyTemplate = html<ProgressStoryArgs>` | ||
| <fluent-progress-bar | ||
| thickness=${x => x.thickness} | ||
| shape=${x => x.shape} | ||
| max=${x => x.max} | ||
| aria-valuemax=${x => x.max} | ||
| aria-valuenow=${x => x.value} | ||
| value=${x => x.value} | ||
| validation-state=${x => x.validationState} | ||
| ></fluent-progress-bar> | ||
| `; | ||
|
|
||
| export default { | ||
| title: 'Components/ProgressBar', | ||
| args: { | ||
| max: 100, | ||
| value: 15, | ||
| thickness: 'medium', | ||
| shape: 'rounded', | ||
| validationState: null, | ||
| }, | ||
| argTypes: { | ||
| max: { | ||
| control: 'number', | ||
| defaultValue: 100, | ||
| }, | ||
| value: { | ||
| control: 'number', | ||
| defaultValue: 15, | ||
| }, | ||
| thickness: { | ||
| control: { | ||
| type: 'select', | ||
| }, | ||
| options: Object.values(ProgressBarThickness), | ||
| defaultValue: 'medium', | ||
| }, | ||
| shape: { | ||
| options: Object.values(ProgressBarShape), | ||
| control: { | ||
| type: 'select', | ||
| }, | ||
| defaultValue: 'rounded', | ||
| }, | ||
| validationState: { | ||
| options: Object.values(ProgressBarValidationState), | ||
| control: { | ||
| type: 'select', | ||
| }, | ||
| defaultValue: null, | ||
| }, | ||
| }, | ||
| } as ProgressStoryMeta; | ||
|
|
||
| export const Progress = renderComponent(storyTemplate).bind({}); | ||
|
|
||
| export const ProgressIndeterminate = renderComponent(html<ProgressStoryArgs>` | ||
| <fluent-progress-bar title="Indeterminate Bar" aria-label="Indeterminate progress bar"></fluent-progress-bar> | ||
| `); |
167 changes: 167 additions & 0 deletions
167
packages/web-components/src/progress-bar/progress-bar.styles.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 |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| import { css } from '@microsoft/fast-element'; | ||
| import { display } from '@microsoft/fast-foundation'; | ||
| import { | ||
| borderRadiusMedium, | ||
| colorBrandBackground2, | ||
| colorCompoundBrandBackground, | ||
| colorNeutralBackground6, | ||
| colorPaletteDarkOrangeBackground2, | ||
| colorPaletteDarkOrangeBackground3, | ||
| colorPaletteGreenBackground2, | ||
| colorPaletteGreenBackground3, | ||
| colorPaletteRedBackground2, | ||
| colorPaletteRedBackground3, | ||
| } from '../theme/design-tokens.js'; | ||
|
|
||
| /** Text styles | ||
| * @public | ||
| */ | ||
| export const styles = css` | ||
| ${display('flex')} | ||
|
|
||
| :host { | ||
| align-items: center; | ||
| height: 2px; | ||
| overflow-x: hidden; | ||
| border-radius: ${borderRadiusMedium}; | ||
| } | ||
|
|
||
| :host([thickness='large']), | ||
| :host([thickness='large']) .progress, | ||
| :host([thickness='large']) .determinate { | ||
| height: 4px; | ||
| } | ||
|
|
||
| :host([shape='square']), | ||
| :host([shape='square']) .progress, | ||
| :host([shape='square']) .determinate { | ||
| border-radius: 0; | ||
| } | ||
|
|
||
| :host([validation-state='error']) .determinate { | ||
| background-color: ${colorPaletteRedBackground3}; | ||
| } | ||
|
|
||
| :host([validation-state='error']) .indeterminate-indicator-1, | ||
| :host([validation-state='error']) .indeterminate-indicator-2 { | ||
| background: linear-gradient( | ||
| to right, | ||
| ${colorPaletteRedBackground2} 0%, | ||
| ${colorPaletteRedBackground3} 50%, | ||
| ${colorPaletteRedBackground2} | ||
| ); | ||
| } | ||
|
|
||
| :host([validation-state='warning']) .determinate { | ||
| background-color: ${colorPaletteDarkOrangeBackground3}; | ||
| } | ||
|
|
||
| :host([validation-state='warning']) .indeterminate-indicator-1, | ||
| :host([validation-state='warning']) .indeterminate-indicator-2 { | ||
| background: linear-gradient( | ||
| to right, | ||
| ${colorPaletteDarkOrangeBackground2} 0%, | ||
| ${colorPaletteDarkOrangeBackground3} 50%, | ||
| ${colorPaletteDarkOrangeBackground2} | ||
| ); | ||
| } | ||
|
|
||
| :host([validation-state='success']) .determinate { | ||
| background-color: ${colorPaletteGreenBackground3}; | ||
| } | ||
|
|
||
| :host([validation-state='success']) .indeterminate-indicator-1, | ||
| :host([validation-state='success']) .indeterminate-indicator-2 { | ||
| background: linear-gradient( | ||
| to right, | ||
| ${colorPaletteGreenBackground2} 0%, | ||
| ${colorPaletteGreenBackground3} 50%, | ||
| ${colorPaletteGreenBackground2} | ||
| ); | ||
| } | ||
|
|
||
| .progress { | ||
| background-color: ${colorNeutralBackground6}; | ||
| border-radius: ${borderRadiusMedium}; | ||
| width: 100%; | ||
| height: 2px; | ||
| display: flex; | ||
| align-items: center; | ||
| position: relative; | ||
| } | ||
|
|
||
| .determinate { | ||
| background-color: ${colorCompoundBrandBackground}; | ||
| border-radius: ${borderRadiusMedium}; | ||
| height: 2px; | ||
| transition: all 0.2s ease-in-out; | ||
| display: flex; | ||
| } | ||
|
|
||
| .indeterminate-indicator-1 { | ||
| position: absolute; | ||
| opacity: 0; | ||
| height: 100%; | ||
| background: linear-gradient( | ||
| to right, | ||
| ${colorBrandBackground2} 0%, | ||
| ${colorCompoundBrandBackground} 50%, | ||
| ${colorBrandBackground2} | ||
| ); | ||
| border-radius: ${borderRadiusMedium}; | ||
| animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect some |
||
| width: 40%; | ||
| animation: indeterminate-1 3s infinite; | ||
| } | ||
|
|
||
| .indeterminate-indicator-2 { | ||
| position: absolute; | ||
| opacity: 0; | ||
| height: 100%; | ||
| background: linear-gradient( | ||
| to right, | ||
| ${colorBrandBackground2} 0%, | ||
| ${colorCompoundBrandBackground} 50%, | ||
| ${colorBrandBackground2} | ||
| ); | ||
| border-radius: ${borderRadiusMedium}; | ||
| animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); | ||
| width: 60%; | ||
| animation: indeterminate-2 3s infinite; | ||
| } | ||
|
|
||
| @keyframes indeterminate-1 { | ||
| 0% { | ||
| opacity: 1; | ||
| transform: translateX(-100%); | ||
| } | ||
| 70% { | ||
| opacity: 1; | ||
| transform: translateX(300%); | ||
| } | ||
| 70.01% { | ||
| opacity: 0; | ||
| } | ||
| 100% { | ||
| opacity: 0; | ||
| transform: translateX(300%); | ||
| } | ||
| } | ||
| @keyframes indeterminate-2 { | ||
| 0% { | ||
| opacity: 0; | ||
| transform: translateX(-150%); | ||
| } | ||
| 29.99% { | ||
| opacity: 0; | ||
| } | ||
| 30% { | ||
| opacity: 1; | ||
| transform: translateX(-150%); | ||
| } | ||
| 100% { | ||
| transform: translateX(166.66%); | ||
| opacity: 1; | ||
| } | ||
| } | ||
| `; | ||
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.