-
Notifications
You must be signed in to change notification settings - Fork 5
feat: progressbar #325
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
feat: progressbar #325
Changes from 9 commits
ff7cc10
ac3284a
c21aea1
bbf2c49
093e872
3be98dd
3cf8724
7d2792f
bfe6194
ee824b0
af041b4
affd19f
68aed6e
035c669
ea10c60
89046b2
c5d9a7a
9669063
b934895
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| releases: | ||
| "@nimbus-ds/components": minor | ||
| "@nimbus-ds/progress-bar": major | ||
| "@nimbus-ds/styles": minor | ||
|
|
||
| declined: | ||
| - nimbus-design-system | ||
| - "@nimbus-ds/scroll-pane" | ||
| - "@nimbus-ds/segmented-control" | ||
| - "@nimbus-ds/stepper" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import * as styles from "./nimbus-progressBar.css"; | ||
|
|
||
| export const progressBar = { | ||
| classnames: { ...styles }, | ||
| }; | ||
|
joacotornello marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import { style, styleVariants } from "@vanilla-extract/css"; | ||
| import { varsThemeBase } from "../../../themes"; | ||
|
|
||
| const base = style({ | ||
| display: "flex", | ||
| alignItems: "center", | ||
| width: "100%", | ||
| height: "0.5rem", // 8px | ||
| borderRadius: varsThemeBase.shape.border.radius.full, | ||
| backgroundColor: varsThemeBase.colors.neutral.surfaceDisabled, | ||
| overflow: "hidden", | ||
| position: "relative", | ||
| }); | ||
|
|
||
| const fill = style({ | ||
| height: "100%", | ||
| borderRadius: varsThemeBase.shape.border.radius.full, | ||
| transition: `width ${varsThemeBase.motion.speed.slow} ease`, | ||
| minWidth: "0.5rem", | ||
| }); | ||
|
joacotornello marked this conversation as resolved.
|
||
|
|
||
| export const container = base; | ||
|
|
||
| export const appearance = styleVariants({ | ||
| primary: [ | ||
| fill, | ||
| { | ||
| backgroundColor: varsThemeBase.colors.primary.interactive, | ||
| }, | ||
| ], | ||
| success: [ | ||
| fill, | ||
| { | ||
| backgroundColor: varsThemeBase.colors.success.interactive, | ||
| }, | ||
| ], | ||
| warning: [ | ||
| fill, | ||
| { | ||
| backgroundColor: varsThemeBase.colors.warning.interactive, | ||
| }, | ||
| ], | ||
| danger: [ | ||
| fill, | ||
| { | ||
| backgroundColor: varsThemeBase.colors.danger.interactive, | ||
| }, | ||
| ], | ||
| neutral: [ | ||
| fill, | ||
| { | ||
| backgroundColor: varsThemeBase.colors.neutral.interactive, | ||
| }, | ||
| ], | ||
| }); | ||
|
joacotornello marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,12 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| Nimbus is an open-source Design System created by Tiendanube / Nuvemshop's team to empower and enhance more stories every day, with simplicity, accessibility, consistency and performance. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## 2025-07-31 `5.15.0` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #### π New features | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - Created new component ProgressBar. ([#323](https://github.com/TiendaNube/nimbus-design-system/pull/323) by [@joacotornello](https://github.com/joacotornello)) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Contributor
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. Fix PR reference and heading level in changelog entry
-## 2025-07-31 `5.15.0`
-
-#### π New features
-
-- Created new component ProgressBar. ([#323](https://github.com/TiendaNube/nimbus-design-system/pull/323) by [@joacotornello](https://github.com/joacotornello))
+## 2025-07-31 `5.15.0`
+
+### π New features
+
+- Created new component **ProgressBar**. ([#325](https://github.com/TiendaNube/nimbus-design-system/pull/325) by [@joacotornello](https://github.com/joacotornello))π Committable suggestion
Suggested change
π§° Toolsπͺ markdownlint-cli2 (0.17.2)7-7: Heading levels should only increment by one level at a time (MD001, heading-increment) π€ Prompt for AI Agents |
||||||||||||||||||||||
| ## 2025-07-28 `5.14.0` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #### π New features | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Changelog | ||
|
|
||
| The ProgressBar component allows us to display the progress of an operation or task in a visual format. | ||
|
|
||
| ## 2025-07-31 `1.0.0` | ||
|
|
||
| ### π New features | ||
|
|
||
| - Added ProgressBar component. ([#PR](https://github.com/TiendaNube/nimbus-design-system/pull/PR)) | ||
| - Added `value` prop to control progress from 0 to 100. | ||
| - Added `appearance` prop with variants: primary, success, warning, danger, neutral. | ||
| - Added ProgressBar skeleton component. | ||
| - Added accessibility support with ARIA attributes. | ||
| - Added proper TypeScript types and documentation. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||||||||||||||
| # `@nimbus-ds/progress-bar` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| [](https://www.npmjs.com/package/@nimbus-ds/progress-bar) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The ProgressBar component is used to display the progress of an operation or task in a visual format. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Installation | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ```sh | ||||||||||||||||||||||||
| $ yarn add @nimbus-ds/progress-bar | ||||||||||||||||||||||||
| # or | ||||||||||||||||||||||||
| $ npm install @nimbus-ds/progress-bar | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### Component Anatomy | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The component consists of a horizontal bar with a fill that represents the progress value as a percentage from 0 to 100. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Guidelines | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| We use the ProgressBar component to visually communicate the completion status of operations, tasks, or any measurable progress. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### Variants | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The component has 5 appearance variants that can be used according to the context: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - **Neutral** - Used for general progress indication without specific semantic meaning | ||||||||||||||||||||||||
| - **Primary** - Used to highlight important progress or main tasks | ||||||||||||||||||||||||
| - **Success** - Used to indicate positive progress or successful completion stages | ||||||||||||||||||||||||
| - **Warning** - Used to indicate caution or attention-required progress | ||||||||||||||||||||||||
| - **Danger** - Used to indicate critical or error-related progress | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### Usage recommendations | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - Use to show completion percentage of tasks, uploads, downloads, or any measurable operation | ||||||||||||||||||||||||
| - Ensure the progress value is meaningful and accurately represents the actual completion state | ||||||||||||||||||||||||
| - Consider adding text labels to provide additional context when necessary | ||||||||||||||||||||||||
| - Use appropriate appearance variants to convey the semantic meaning of the progress | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### Accessibility | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The component includes proper ARIA attributes: | ||||||||||||||||||||||||
| - `role="progressbar"` to identify the element as a progress indicator | ||||||||||||||||||||||||
| - `aria-valuenow` to indicate the current progress value | ||||||||||||||||||||||||
| - `aria-valuemin` and `aria-valuemax` to define the range (0-100) | ||||||||||||||||||||||||
|
Comment on lines
+42
to
+45
Contributor
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. π§Ή Nitpick (assertive) Address minor markdown formatting issues. Static analysis identified some formatting improvements that would enhance readability: -### Accessibility
-
-The component includes proper ARIA attributes:
+### Accessibility
+
+The component includes proper ARIA attributes:
+
- `role="progressbar"` to identify the element as a progress indicator
- `aria-valuenow` to indicate the current progress value
- `aria-valuemin` and `aria-valuemax` to define the range (0-100)π Committable suggestion
Suggested change
π§° Toolsπͺ markdownlint-cli2 (0.17.2)43-43: Lists should be surrounded by blank lines (MD032, blanks-around-lists) πͺ LanguageTool[grammar] ~42-~42: Use correct spacing (QB_NEW_EN_OTHER_ERROR_IDS_5) [grammar] ~43-~43: There might be a mistake here. (QB_NEW_EN_OTHER) [grammar] ~44-~44: There might be a mistake here. (QB_NEW_EN_OTHER) [grammar] ~45-~45: There might be a problem here. (QB_NEW_EN_MERGED_MATCH) π€ Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Usage | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| View docs [here](https://nimbus.nuvemshop.com.br/documentation/atomic-components/progress-bar). | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| <img alt="Nimbus" style="margin-bottom: 30px;" src="https://tiendanube.github.io/design-system-nimbus/static/media/nimbus-logo.ab60bd79.png" height="30" /> | ||||||||||||||||||||||||
|
Contributor
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. π§Ή Nitpick (assertive) Remove trailing space from image element. -<img alt="Nimbus" style="margin-bottom: 30px;" src="https://tiendanube.github.io/design-system-nimbus/static/media/nimbus-logo.ab60bd79.png" height="30" />
+<img alt="Nimbus" style="margin-bottom: 30px;" src="https://tiendanube.github.io/design-system-nimbus/static/media/nimbus-logo.ab60bd79.png" height="30" />π Committable suggestion
Suggested change
π§° Toolsπͺ markdownlint-cli2 (0.17.2)51-51: Trailing spaces (MD009, no-trailing-spaces) 51-51: Inline HTML (MD033, no-inline-html) π€ Prompt for AI Agents |
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| { | ||
| "name": "@nimbus-ds/progress-bar", | ||
| "version": "0.0.0", | ||
| "license": "MIT", | ||
| "main": "dist/index.js", | ||
| "files": [ | ||
| "dist", | ||
| "README.md" | ||
| ], | ||
| "sideEffects": false, | ||
| "scripts": { | ||
| "build": "yarn g:webpack", | ||
| "clean": "rm -rf dist", | ||
| "version": "yarn version" | ||
| }, | ||
| "dependencies": { | ||
| "@nimbus-ds/skeleton": "workspace:^" | ||
| }, | ||
| "peerDependencies": { | ||
| "@nimbus-ds/styles": "workspace:^", | ||
| "react": "^16.8 || ^17.0 || ^18.0", | ||
| "react-dom": "^16.8 || ^17.0 || ^18.0" | ||
| }, | ||
| "homepage": "https://nimbus.nuvemshop.com.br/documentation", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/TiendaNube/nimbus-design-system.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/TiendaNube/nimbus-design-system/issues" | ||
| }, | ||
| "devDependencies": { | ||
| "@nimbus-ds/box": "workspace:^", | ||
| "@nimbus-ds/skeleton": "workspace:^", | ||
| "@nimbus-ds/webpack": "workspace:^" | ||
| } | ||
| } | ||
|
joacotornello marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import React, { ComponentPropsWithRef, forwardRef, useMemo } from "react"; | ||
| import { progressBar } from "@nimbus-ds/styles"; | ||
|
|
||
| import { ProgressBarBaseProps, ProgressBarComponents } from "./progressBar.types"; | ||
| import { ProgressBarSkeleton } from "./components"; | ||
|
|
||
| /** | ||
| * ProgressBar component displays the progress of an operation or task in a visual format. | ||
| * It provides a horizontal bar that fills based on the completion percentage. | ||
| * | ||
| * @component | ||
| * @example | ||
| * <ProgressBar value={50} appearance="primary" /> | ||
| * | ||
| * @example | ||
| * // With skeleton loading state | ||
| * <ProgressBar.Skeleton width="200px" /> | ||
| */ | ||
| const ProgressBar = forwardRef<HTMLDivElement, ProgressBarBaseProps>( | ||
| ( | ||
| { | ||
| className: _className, | ||
| style: _style, | ||
| value, | ||
| appearance = "neutral", | ||
| ...rest | ||
| }, | ||
| ref | ||
| ) => { | ||
| // Ensure value is within 0-100 range | ||
| const clampedValue = useMemo(() => Math.min(100, Math.max(0, value)), [value]); | ||
| const percentage = `${clampedValue}%`; | ||
|
|
||
| return ( | ||
| <div | ||
| {...rest} | ||
| ref={ref} | ||
| className={[progressBar.classnames.container, _className].join(" ")} | ||
| style={_style} | ||
| role="progressbar" | ||
| aria-valuenow={clampedValue} | ||
| aria-valuemin={0} | ||
| aria-valuemax={100} | ||
| > | ||
| <div | ||
| className={progressBar.classnames.appearance[appearance]} | ||
| style={{ width: percentage }} | ||
| data-testid="progress-bar-fill" | ||
| /> | ||
| </div> | ||
| ); | ||
|
joacotornello marked this conversation as resolved.
|
||
| } | ||
|
joacotornello marked this conversation as resolved.
|
||
| ) as React.ForwardRefExoticComponent< | ||
| ProgressBarBaseProps & React.RefAttributes<HTMLDivElement> | ||
| > & | ||
| ProgressBarComponents; | ||
|
|
||
| ProgressBar.Skeleton = ProgressBarSkeleton; | ||
| ProgressBar.displayName = "ProgressBar"; | ||
| ProgressBar.Skeleton.displayName = "ProgressBar.Skeleton"; | ||
|
|
||
| export type ProgressBarProps = ComponentPropsWithRef<typeof ProgressBar>; | ||
| export { ProgressBar }; | ||
|
joacotornello marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||||||||||
| import type { Meta, StoryObj } from "@storybook/react"; | ||||||||||||||||||||||||||
| import { ProgressBar } from "../../ProgressBar"; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const meta: Meta<typeof ProgressBar.Skeleton> = { | ||||||||||||||||||||||||||
| title: "atomic/ProgressBar/ProgressBar.Skeleton", | ||||||||||||||||||||||||||
| component: ProgressBar.Skeleton, | ||||||||||||||||||||||||||
| tags: ["autodocs"], | ||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||
|
Comment on lines
+4
to
+8
Contributor
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. π§Ή Nitpick (assertive) Rename story to PascalCase for Storybook autogeneration Storybook treats lowercase identifiers as non-component docs. To keep consistency with other atomic stories, use -export const basic: Story = { args: {} };
+export const ProgressBarSkeleton: Story = { args: {} };π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export default meta; | ||||||||||||||||||||||||||
| type Story = StoryObj<typeof ProgressBar.Skeleton>; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export const basic: Story = { args: {} }; | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import React from "react"; | ||
| import { Skeleton } from "@nimbus-ds/skeleton"; | ||
| import { ProgressBarSkeletonProperties } from "./ProgressBarSkeleton.types"; | ||
|
|
||
| const ProgressBarSkeleton: React.FC<ProgressBarSkeletonProperties> = ({ | ||
| width = "100%", | ||
| ...rest | ||
| }) => <Skeleton width={width} height="0.5rem" borderRadius="0.5rem" {...rest} />; | ||
|
|
||
| export { ProgressBarSkeleton }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { SkeletonProps } from "@nimbus-ds/skeleton"; | ||
|
|
||
| export type ProgressBarSkeletonProperties = Partial< | ||
| Pick<SkeletonProps, "width" | "height" | "data-testid"> | ||
| >; | ||
|
|
||
| export type ProgressBarSkeletonProps = ProgressBarSkeletonProperties; | ||
|
joacotornello marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { ProgressBarSkeleton } from "./ProgressBarSkeleton"; |
Uh oh!
There was an error while loading. Please reload this page.