@brightlocal/ui-components 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI_USAGE.md +10 -0
- package/README.md +8 -1
- package/component-meta.json +1591 -123
- package/deprecations.json +45 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +73 -102
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +36 -5
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +83 -128
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +4 -4
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +116 -177
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.js +13 -16
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +30 -45
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +32 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +90 -71
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +130 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +24 -6
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +74 -140
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +136 -176
- package/dist/blocks/progress-state.cjs +1 -1
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/progress-state.js +223 -347
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +28 -6
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +763 -1086
- package/dist/brand-illustration-motif.cjs +1 -1
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/brand-illustration-motif.js +40 -61
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +62 -102
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.js +23 -31
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts +4 -2
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +149 -189
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts +87 -3
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +116 -173
- package/dist/callout.cjs +1 -1
- package/dist/callout.js +73 -96
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +92 -6
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +240 -234
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +3 -3
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +174 -268
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.js +27 -48
- package/dist/chart-empty.cjs +1 -1
- package/dist/chart-empty.js +18 -27
- package/dist/chart.cjs +7 -7
- package/dist/chart.d.ts +253 -25
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +465 -511
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +37 -69
- package/dist/chip.cjs +1 -1
- package/dist/chip.js +116 -173
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +35 -41
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +14 -4
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +440 -639
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +273 -420
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts +5 -5
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +121 -191
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +442 -144
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +708 -835
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +15 -4
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +156 -231
- package/dist/delta.cjs +1 -0
- package/dist/delta.d.ts +79 -0
- package/dist/delta.d.ts.map +1 -0
- package/dist/delta.js +62 -0
- package/dist/description.cjs +1 -1
- package/dist/description.js +11 -20
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +76 -116
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +11 -11
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +76 -134
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +6 -6
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +179 -300
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +9 -9
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +166 -286
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.js +203 -342
- package/dist/grid.cjs +1 -1
- package/dist/grid.d.ts +24 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +16 -29
- package/dist/header.cjs +1 -1
- package/dist/header.js +21 -38
- package/dist/height-transition.cjs +1 -1
- package/dist/height-transition.js +38 -55
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +10 -9
- package/dist/hooks/use-debounce.cjs +1 -1
- package/dist/hooks/use-debounce.js +12 -11
- package/dist/hooks/use-delayed-pending.cjs +1 -1
- package/dist/hooks/use-delayed-pending.js +8 -9
- package/dist/hooks/use-filter-search-params.cjs +1 -0
- package/dist/hooks/use-filter-search-params.d.ts +93 -0
- package/dist/hooks/use-filter-search-params.d.ts.map +1 -0
- package/dist/hooks/use-filter-search-params.js +122 -0
- package/dist/hooks/use-mobile.cjs +1 -1
- package/dist/hooks/use-mobile.js +6 -6
- package/dist/hooks/use-overlay-pointer-lock.cjs +1 -1
- package/dist/hooks/use-overlay-pointer-lock.js +8 -9
- package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
- package/dist/hooks/use-prefers-reduced-motion.js +5 -8
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +1 -1
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +30 -62
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +636 -582
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +27 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +32 -3
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +182 -231
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +188 -122
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts +3 -3
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +102 -146
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +26 -8
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +139 -171
- package/dist/input.cjs +1 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +51 -73
- package/dist/label.cjs +1 -1
- package/dist/label.js +20 -38
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +5 -2
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +16 -17
- package/dist/lib/compose-event-handlers.cjs +1 -0
- package/dist/lib/compose-event-handlers.d.ts +9 -0
- package/dist/lib/compose-event-handlers.d.ts.map +1 -0
- package/dist/lib/compose-event-handlers.js +8 -0
- package/dist/lib/download-file.cjs +1 -0
- package/dist/lib/download-file.d.ts +14 -0
- package/dist/lib/download-file.d.ts.map +1 -0
- package/dist/lib/download-file.js +40 -0
- package/dist/lib/empty-canvas.cjs +1 -1
- package/dist/lib/empty-canvas.js +28 -56
- package/dist/lib/empty-chip.cjs +1 -1
- package/dist/lib/empty-chip.d.ts +14 -3
- package/dist/lib/empty-chip.d.ts.map +1 -1
- package/dist/lib/empty-chip.js +15 -11
- package/dist/lib/field-aria.cjs +1 -0
- package/dist/lib/field-aria.d.ts +34 -0
- package/dist/lib/field-aria.d.ts.map +1 -0
- package/dist/lib/field-aria.js +52 -0
- package/dist/lib/image-file-info.cjs +1 -0
- package/dist/lib/image-file-info.d.ts +25 -0
- package/dist/lib/image-file-info.d.ts.map +1 -0
- package/dist/lib/image-file-info.js +67 -0
- package/dist/lib/media-viewer-content.cjs +1 -0
- package/dist/lib/media-viewer-content.d.ts +102 -0
- package/dist/lib/media-viewer-content.d.ts.map +1 -0
- package/dist/lib/media-viewer-content.js +650 -0
- package/dist/lib/media-viewer-internal.cjs +1 -0
- package/dist/lib/media-viewer-internal.d.ts +98 -0
- package/dist/lib/media-viewer-internal.d.ts.map +1 -0
- package/dist/lib/media-viewer-internal.js +61 -0
- package/dist/lib/media-viewer-motion.cjs +1 -0
- package/dist/lib/media-viewer-motion.d.ts +40 -0
- package/dist/lib/media-viewer-motion.d.ts.map +1 -0
- package/dist/lib/media-viewer-motion.js +37 -0
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.d.ts +8 -0
- package/dist/lib/motion.d.ts.map +1 -1
- package/dist/lib/motion.js +11 -10
- package/dist/lib/optical-center.cjs +1 -1
- package/dist/lib/optical-center.d.ts +1 -1
- package/dist/lib/optical-center.d.ts.map +1 -1
- package/dist/lib/optical-center.js +12 -5
- package/dist/lib/spring-settle.cjs +1 -1
- package/dist/lib/spring-settle.js +1 -1
- package/dist/lib/table-internal.cjs +1 -0
- package/dist/lib/table-internal.d.ts +62 -0
- package/dist/lib/table-internal.d.ts.map +1 -0
- package/dist/lib/table-internal.js +18 -0
- package/dist/lib/use-controllable.cjs +1 -0
- package/dist/lib/use-controllable.d.ts +12 -0
- package/dist/lib/use-controllable.d.ts.map +1 -0
- package/dist/lib/use-controllable.js +15 -0
- package/dist/lib/use-dev-warning.cjs +1 -1
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +29 -35
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.js +78 -124
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +8 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +94 -156
- package/dist/loading.cjs +1 -1
- package/dist/loading.js +124 -151
- package/dist/logo-mark.cjs +1 -0
- package/dist/logo-mark.d.ts +79 -0
- package/dist/logo-mark.d.ts.map +1 -0
- package/dist/logo-mark.js +219 -0
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +51 -87
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +390 -586
- package/dist/media-empty.cjs +1 -1
- package/dist/media-empty.js +27 -42
- package/dist/media-viewer.cjs +1 -0
- package/dist/media-viewer.d.ts +224 -0
- package/dist/media-viewer.d.ts.map +1 -0
- package/dist/media-viewer.js +295 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +14 -14
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +130 -267
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +186 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +374 -0
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +108 -172
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +36 -12
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +208 -281
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +34 -45
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +139 -17
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +116 -148
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +90 -146
- package/dist/rating.cjs +1 -1
- package/dist/rating.d.ts +80 -13
- package/dist/rating.d.ts.map +1 -1
- package/dist/rating.js +70 -65
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +112 -0
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.d.ts +39 -23
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +42 -44
- package/dist/result-count.cjs +1 -0
- package/dist/result-count.d.ts +110 -0
- package/dist/result-count.d.ts.map +1 -0
- package/dist/result-count.js +49 -0
- package/dist/route-progress.cjs +1 -1
- package/dist/route-progress.js +58 -102
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +9 -1
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +44 -79
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +20 -10
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +132 -236
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +90 -78
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +86 -7
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +275 -235
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +113 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +224 -0
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +24 -38
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +51 -81
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +113 -137
- package/dist/spinner.cjs +1 -1
- package/dist/spinner.js +22 -31
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +53 -102
- package/dist/status.cjs +1 -0
- package/dist/status.d.ts +51 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +60 -0
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +184 -316
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +17 -32
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +127 -13
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +170 -192
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +123 -146
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.js +307 -363
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.d.ts.map +1 -1
- package/dist/textarea.js +23 -36
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.js +43 -62
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +34 -46
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +175 -78
- package/dist/typography-heading.cjs +1 -1
- package/dist/typography-heading.js +25 -61
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +1 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +27 -57
- package/dist/typography.cjs +1 -1
- package/dist/typography.d.ts +1 -1
- package/dist/typography.js +132 -340
- package/package.json +45 -46
- package/src/blocks/empty-state.tsx +42 -21
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +111 -32
- package/src/components/accordion.tsx +1 -1
- package/src/components/alert-dialog.tsx +52 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +152 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button.tsx +8 -6
- package/src/components/calendar.tsx +155 -9
- package/src/components/card.tsx +266 -26
- package/src/components/carousel.tsx +4 -1
- package/src/components/chart.tsx +664 -42
- package/src/components/checkbox.tsx +2 -2
- package/src/components/collapsible.tsx +4 -1
- package/src/components/combobox.tsx +42 -9
- package/src/components/command.tsx +10 -11
- package/src/components/context-menu.tsx +4 -4
- package/src/components/data-table.tsx +1363 -398
- package/src/components/date-picker.tsx +31 -4
- package/src/components/delta.tsx +217 -0
- package/src/components/drawer.tsx +5 -5
- package/src/components/dropdown-menu.tsx +4 -4
- package/src/components/field.tsx +36 -15
- package/src/components/global-layout.tsx +1 -1
- package/src/components/grid.tsx +32 -1
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +52 -8
- package/src/components/input-group.tsx +247 -12
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +29 -11
- package/src/components/input.tsx +11 -2
- package/src/components/list.tsx +15 -3
- package/src/components/logo-mark.tsx +345 -0
- package/src/components/map.tsx +18 -20
- package/src/components/media-viewer.tsx +908 -0
- package/src/components/multi-select-filter.tsx +1046 -0
- package/src/components/navigation-menu.tsx +2 -2
- package/src/components/pagination.tsx +86 -26
- package/src/components/progress.tsx +281 -54
- package/src/components/rating.tsx +200 -74
- package/src/components/relative-date.tsx +238 -0
- package/src/components/resizable.tsx +86 -33
- package/src/components/result-count.tsx +253 -0
- package/src/components/scroll-area.tsx +31 -5
- package/src/components/select.tsx +37 -7
- package/src/components/sheet.tsx +252 -6
- package/src/components/single-select-filter.tsx +538 -0
- package/src/components/slider.tsx +2 -2
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/status.tsx +162 -0
- package/src/components/switch.tsx +1 -1
- package/src/components/table.tsx +305 -73
- package/src/components/tabs.tsx +94 -46
- package/src/components/textarea.tsx +21 -3
- package/src/components/toggle.tsx +2 -2
- package/src/components/tooltip.tsx +431 -68
- package/src/components/typography-text.tsx +1 -2
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/hooks/use-filter-search-params.ts +302 -0
- package/src/index.ts +11 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/compose-event-handlers.ts +14 -0
- package/src/lib/download-file.ts +61 -0
- package/src/lib/empty-chip.tsx +52 -0
- package/src/lib/field-aria.tsx +97 -0
- package/src/lib/image-file-info.ts +102 -0
- package/src/lib/media-viewer-content.tsx +1587 -0
- package/src/lib/media-viewer-internal.tsx +191 -0
- package/src/lib/media-viewer-motion.ts +120 -0
- package/src/lib/motion.ts +9 -0
- package/src/lib/table-internal.ts +74 -0
- package/src/lib/use-controllable.ts +43 -0
- package/src/lib/utils.ts +1 -0
- package/src/lib/empty-chip.ts +0 -24
|
@@ -9,7 +9,7 @@ import { usePrefersReducedMotion } from "@brightlocal/ui-components/hooks/use-pr
|
|
|
9
9
|
import { SPRING_GENTLE } from "../lib/motion";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Color for the progress indicator, drawn from the score scale (`score-*`).
|
|
13
13
|
* - `green` — strong / healthy / complete
|
|
14
14
|
* - `yellow` — moderate / acceptable
|
|
15
15
|
* - `orange` — weak / needs attention
|
|
@@ -24,6 +24,13 @@ type ProgressColor = "green" | "red" | "orange" | "yellow";
|
|
|
24
24
|
*/
|
|
25
25
|
type ProgressSize = "sm" | "md";
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Controls where the label and value sit relative to the bar.
|
|
29
|
+
* - `inline` — label | bar | value in a single row (the default)
|
|
30
|
+
* - `above` — label and value on one line, bar full width beneath
|
|
31
|
+
*/
|
|
32
|
+
type ProgressLabelPlacement = "inline" | "above";
|
|
33
|
+
|
|
27
34
|
/**
|
|
28
35
|
* Per-size classes: text for the label and value, height for the bar — the row
|
|
29
36
|
* scales as one unit (`sm` 14px text / 8px bar, `md` 16px text / 12px bar).
|
|
@@ -35,35 +42,34 @@ const SIZE_STYLES: Record<ProgressSize, { text: string; bar: string }> = {
|
|
|
35
42
|
};
|
|
36
43
|
|
|
37
44
|
/**
|
|
38
|
-
* Track and indicator color classes for each
|
|
45
|
+
* Track and indicator color classes for each color.
|
|
39
46
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* `
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* do not "fix" it back to `chart-*` without a design decision.
|
|
47
|
+
* The bar answers "how good is this value", so it paints with the score scale
|
|
48
|
+
* (DS-774): green → `score-strong`, yellow → `score-moderate`, orange →
|
|
49
|
+
* `score-weak`, red → `score-poor`. The track is the same colour at 20% over
|
|
50
|
+
* the surface. This replaces the off-palette `brand-*` hexes and the separate
|
|
51
|
+
* `green-400` fill (DS-773) — one scale for Progress, Map pins and Delta. The
|
|
52
|
+
* Figma component binds the same `base/score-*` variables.
|
|
47
53
|
*/
|
|
48
54
|
const COLOR_STYLES: Record<
|
|
49
55
|
ProgressColor,
|
|
50
56
|
{ track: string; indicator: string }
|
|
51
57
|
> = {
|
|
52
58
|
green: {
|
|
53
|
-
track: "bg-
|
|
54
|
-
indicator: "bg-
|
|
59
|
+
track: "bg-score-strong/20",
|
|
60
|
+
indicator: "bg-score-strong",
|
|
55
61
|
},
|
|
56
62
|
red: {
|
|
57
|
-
track: "bg-
|
|
58
|
-
indicator: "bg-
|
|
63
|
+
track: "bg-score-poor/20",
|
|
64
|
+
indicator: "bg-score-poor",
|
|
59
65
|
},
|
|
60
66
|
orange: {
|
|
61
|
-
track: "bg-
|
|
62
|
-
indicator: "bg-
|
|
67
|
+
track: "bg-score-weak/20",
|
|
68
|
+
indicator: "bg-score-weak",
|
|
63
69
|
},
|
|
64
70
|
yellow: {
|
|
65
|
-
track: "bg-
|
|
66
|
-
indicator: "bg-
|
|
71
|
+
track: "bg-score-moderate/20",
|
|
72
|
+
indicator: "bg-score-moderate",
|
|
67
73
|
},
|
|
68
74
|
};
|
|
69
75
|
|
|
@@ -106,9 +112,31 @@ function formatProgressValue(
|
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
/**
|
|
109
|
-
*
|
|
115
|
+
* Formats the value shown beside the bar — and, through Radix's
|
|
116
|
+
* `getValueLabel`, the `aria-valuetext` screen readers announce — from the raw
|
|
117
|
+
* `value` and `max`. Receives `null` / `undefined` when the row has no value
|
|
118
|
+
* yet, so it picks its own placeholder (the built-in forms use `–`).
|
|
119
|
+
* @param value - Current value, or none.
|
|
120
|
+
* @param max - Maximum value (denominator).
|
|
121
|
+
* @example (value) => value?.toLocaleString() ?? "–"
|
|
110
122
|
*/
|
|
111
|
-
|
|
123
|
+
type ProgressValueFormatter = (
|
|
124
|
+
value: number | null | undefined,
|
|
125
|
+
max: number
|
|
126
|
+
) => string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A `label` that is rendered but cannot name the bar — an element such as a
|
|
130
|
+
* `Rating` or an icon (wrap several in a fragment). Always paired with
|
|
131
|
+
* `ariaLabel`. Text and numbers are not node labels: they name the bar
|
|
132
|
+
* themselves.
|
|
133
|
+
*/
|
|
134
|
+
type ProgressNodeLabel = React.ReactElement;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Props shared by every Progress, whatever its label is.
|
|
138
|
+
*/
|
|
139
|
+
interface ProgressBaseProps extends React.ComponentProps<
|
|
112
140
|
typeof ProgressPrimitive.Root
|
|
113
141
|
> {
|
|
114
142
|
/**
|
|
@@ -116,24 +144,27 @@ interface ProgressProps extends React.ComponentProps<
|
|
|
116
144
|
*/
|
|
117
145
|
dataHook: string;
|
|
118
146
|
/**
|
|
119
|
-
*
|
|
147
|
+
* Current value, measured against `max`. Drives the fill, the value column
|
|
148
|
+
* and `aria-valuenow`; out-of-range values are clamped to `0–max` for the
|
|
149
|
+
* bar while the column prints the raw figure. Omit it (or pass `null`) for a
|
|
150
|
+
* placeholder row — the bar stays empty and the column shows `–`.
|
|
120
151
|
*/
|
|
121
|
-
|
|
152
|
+
value?: number | null;
|
|
122
153
|
/**
|
|
123
|
-
*
|
|
154
|
+
* Maximum value — the denominator for the fill and the displayed value. For
|
|
155
|
+
* a set of rows that share one scale (a review breakdown), pass the same
|
|
156
|
+
* `max` to every row.
|
|
157
|
+
* @default 100
|
|
124
158
|
*/
|
|
125
|
-
|
|
159
|
+
max?: number;
|
|
126
160
|
/**
|
|
127
|
-
*
|
|
128
|
-
* @default "Progress"
|
|
161
|
+
* Optional tracking element identifier for analytics
|
|
129
162
|
*/
|
|
130
|
-
|
|
163
|
+
trackingEl?: string;
|
|
131
164
|
/**
|
|
132
|
-
* Optional
|
|
133
|
-
* Rendered inside a fixed-width column (see `labelWidth`); longer labels
|
|
134
|
-
* wrap onto further lines while the bar and value stay in their columns.
|
|
165
|
+
* Optional tracking label for analytics
|
|
135
166
|
*/
|
|
136
|
-
|
|
167
|
+
trackingLabel?: string;
|
|
137
168
|
/**
|
|
138
169
|
* Width of the label column: `"20%"` … `"50%"` of the row in 10% steps, or
|
|
139
170
|
* `"auto"`. Every row that uses the same percentage starts its bar at the
|
|
@@ -154,6 +185,15 @@ interface ProgressProps extends React.ComponentProps<
|
|
|
154
185
|
* @default "sm"
|
|
155
186
|
*/
|
|
156
187
|
size?: ProgressSize;
|
|
188
|
+
/**
|
|
189
|
+
* Controls where the label and value sit relative to the bar.
|
|
190
|
+
* `"inline"` places label | bar | value in a single row (the default).
|
|
191
|
+
* `"above"` stacks the label and value on one line above a full-width bar —
|
|
192
|
+
* use this in narrow columns where the inline row would squeeze the bar.
|
|
193
|
+
* `labelWidth` is ignored when `"above"`.
|
|
194
|
+
* @default "inline"
|
|
195
|
+
*/
|
|
196
|
+
labelPlacement?: ProgressLabelPlacement;
|
|
157
197
|
/**
|
|
158
198
|
* Whether to render the numeric value to the right of the progress bar.
|
|
159
199
|
* Falls back to `–` when no value is provided so the layout stays consistent.
|
|
@@ -167,6 +207,21 @@ interface ProgressProps extends React.ComponentProps<
|
|
|
167
207
|
* @default "%"
|
|
168
208
|
*/
|
|
169
209
|
unit?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Replaces the built-in `unit` forms with your own text for the value column,
|
|
212
|
+
* e.g. a raw count (`1,234`) or a remaining amount (`15 min left`). The same
|
|
213
|
+
* text is announced as the bar's `aria-valuetext` (unless you pass Radix's
|
|
214
|
+
* own `getValueLabel`). The column is sized to the wider of
|
|
215
|
+
* `valueFormatter(0, max)` and `valueFormatter(max, max)` so rows still end
|
|
216
|
+
* at the same x-position — the formatter's widest output must be at one of
|
|
217
|
+
* the two extremes, which holds for counts, percentages and remaining
|
|
218
|
+
* amounts. Pair
|
|
219
|
+
* it with a `value` / `max` that describe the real measurement — a count out
|
|
220
|
+
* of the largest count — rather than a precomputed percentage, so
|
|
221
|
+
* `aria-valuenow` stays honest.
|
|
222
|
+
* @example (value) => value?.toLocaleString() ?? "–"
|
|
223
|
+
*/
|
|
224
|
+
valueFormatter?: ProgressValueFormatter;
|
|
170
225
|
/**
|
|
171
226
|
* Custom class name for the indicator (progress fill)
|
|
172
227
|
* Use this to customize the color, e.g., "bg-chart-red"
|
|
@@ -179,6 +234,81 @@ interface ProgressProps extends React.ComponentProps<
|
|
|
179
234
|
disabled?: boolean;
|
|
180
235
|
}
|
|
181
236
|
|
|
237
|
+
/**
|
|
238
|
+
* The label column and the bar's accessible name, as a pair.
|
|
239
|
+
*
|
|
240
|
+
* A text `label` names the bar by itself (`aria-labelledby` points at it). Any
|
|
241
|
+
* other node — a Rating, an icon — is visible but cannot name anything, so it
|
|
242
|
+
* must come with an explicit `ariaLabel`; the union makes TypeScript insist on
|
|
243
|
+
* that pairing instead of letting a bar ship with an empty accessible name.
|
|
244
|
+
*/
|
|
245
|
+
/**
|
|
246
|
+
* Text label: names the bar on its own, so `ariaLabel` is optional.
|
|
247
|
+
*/
|
|
248
|
+
interface ProgressTextLabelProps {
|
|
249
|
+
/**
|
|
250
|
+
* Optional visible label text displayed to the left of the progress bar.
|
|
251
|
+
* Rendered inside a fixed-width column (see `labelWidth`); longer labels
|
|
252
|
+
* wrap onto further lines while the bar and value stay in their columns.
|
|
253
|
+
*/
|
|
254
|
+
label?: string | number;
|
|
255
|
+
/**
|
|
256
|
+
* Accessible label for the progress bar for screen readers. Only used when
|
|
257
|
+
* there is no visible text `label`.
|
|
258
|
+
* @default "Progress"
|
|
259
|
+
*/
|
|
260
|
+
ariaLabel?: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Element label: cannot name the bar, so `ariaLabel` is required.
|
|
265
|
+
*/
|
|
266
|
+
interface ProgressNodeLabelProps {
|
|
267
|
+
/**
|
|
268
|
+
* Visible label rendered as an element — a `Rating`, an icon — in the same
|
|
269
|
+
* fixed-width column a text label uses (see `labelWidth`), vertically
|
|
270
|
+
* centred against the bar. Mark decorative icons `aria-hidden`.
|
|
271
|
+
*/
|
|
272
|
+
label: ProgressNodeLabel;
|
|
273
|
+
/**
|
|
274
|
+
* Accessible name for the bar — required with a node label, because the
|
|
275
|
+
* node cannot name it: `aria-labelledby` would resolve to nothing.
|
|
276
|
+
* @example "4 star reviews"
|
|
277
|
+
*/
|
|
278
|
+
ariaLabel: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* What the component's JSX signature accepts: the label pair is a union, so an
|
|
283
|
+
* element `label` cannot be passed without its `ariaLabel`. Use this type when
|
|
284
|
+
* a wrapper should carry the same guarantee; `Omit`/`Pick` over the union would
|
|
285
|
+
* collapse it.
|
|
286
|
+
*/
|
|
287
|
+
type ProgressStrictProps = ProgressBaseProps &
|
|
288
|
+
(ProgressTextLabelProps | ProgressNodeLabelProps);
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Props for the Progress component — the extendable, loose form (`interface X
|
|
292
|
+
* extends ProgressProps` keeps working). `label` is text, a number or an
|
|
293
|
+
* element; the element ⇒ `ariaLabel` pairing is enforced where it matters, on
|
|
294
|
+
* the component's own signature (`ProgressStrictProps`), so a value typed as
|
|
295
|
+
* `ProgressProps` with an element label must be narrowed before it is spread
|
|
296
|
+
* into `<Progress>`.
|
|
297
|
+
*/
|
|
298
|
+
interface ProgressProps extends ProgressBaseProps {
|
|
299
|
+
/**
|
|
300
|
+
* Visible label: text (wraps inside the label column), a number, or an
|
|
301
|
+
* element such as a `Rating` or an icon — an element requires `ariaLabel`.
|
|
302
|
+
*/
|
|
303
|
+
label?: string | number | ProgressNodeLabel;
|
|
304
|
+
/**
|
|
305
|
+
* Accessible label for the progress bar. Optional with a text label (the
|
|
306
|
+
* text names the bar); required with an element label.
|
|
307
|
+
* @default "Progress"
|
|
308
|
+
*/
|
|
309
|
+
ariaLabel?: string;
|
|
310
|
+
}
|
|
311
|
+
|
|
182
312
|
/**
|
|
183
313
|
* Progress component for displaying loading states and task completion.
|
|
184
314
|
* Built on Radix UI Progress primitive with Framer Motion animation.
|
|
@@ -187,11 +317,13 @@ interface ProgressProps extends React.ComponentProps<
|
|
|
187
317
|
* a fixed-width label column, the bar filling the remaining space, and a
|
|
188
318
|
* right-aligned value column sized to the widest value it can show — so rows
|
|
189
319
|
* stacked in a card share the same bar start position and width, even when
|
|
190
|
-
* a label wraps onto two lines.
|
|
320
|
+
* a label wraps onto two lines. The label may be text or any node (a Rating,
|
|
321
|
+
* an icon — then `ariaLabel` is required), and `valueFormatter` replaces the
|
|
322
|
+
* built-in percentage / fraction forms with any text.
|
|
191
323
|
*/
|
|
192
324
|
const Progress = React.forwardRef<
|
|
193
325
|
React.ComponentRef<typeof ProgressPrimitive.Root>,
|
|
194
|
-
|
|
326
|
+
ProgressStrictProps
|
|
195
327
|
>(
|
|
196
328
|
(
|
|
197
329
|
{
|
|
@@ -206,8 +338,10 @@ const Progress = React.forwardRef<
|
|
|
206
338
|
labelWidth = DEFAULT_LABEL_WIDTH,
|
|
207
339
|
color = "green",
|
|
208
340
|
size = "sm",
|
|
341
|
+
labelPlacement = "inline",
|
|
209
342
|
showValue = false,
|
|
210
343
|
unit = "%",
|
|
344
|
+
valueFormatter,
|
|
211
345
|
indicatorClassName,
|
|
212
346
|
disabled,
|
|
213
347
|
...props
|
|
@@ -215,30 +349,48 @@ const Progress = React.forwardRef<
|
|
|
215
349
|
ref
|
|
216
350
|
) => {
|
|
217
351
|
const labelId = React.useId();
|
|
218
|
-
const hasVisibleLabel =
|
|
352
|
+
const hasVisibleLabel =
|
|
353
|
+
label !== undefined && label !== null && label !== "";
|
|
354
|
+
/* Only text can name the bar: `aria-labelledby` reads the label's text
|
|
355
|
+
content, and a Rating or an aria-hidden icon has none. Node labels fall
|
|
356
|
+
back to the (type-required) `ariaLabel`. */
|
|
357
|
+
const labelIsText = typeof label === "string" || typeof label === "number";
|
|
358
|
+
const labelledByText = hasVisibleLabel && labelIsText;
|
|
359
|
+
const formatValue: ProgressValueFormatter =
|
|
360
|
+
valueFormatter ?? ((v, m) => formatProgressValue(v, m, unit));
|
|
361
|
+
/* What the value column shows is also what assistive tech is told: Radix
|
|
362
|
+
would otherwise announce a percentage over a "3 / 5 steps" or "1,234"
|
|
363
|
+
column, and "0%" over a value-less row's "–". Closes over the raw value
|
|
364
|
+
because Radix only hands the callback its validated (never null) one. */
|
|
365
|
+
const valueText = formatValue(value, max);
|
|
219
366
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
220
367
|
|
|
221
368
|
const colorStyles = COLOR_STYLES[color] ?? COLOR_STYLES.green;
|
|
222
369
|
const sizeStyles = SIZE_STYLES[size] ?? SIZE_STYLES.sm;
|
|
223
370
|
const labelHugs = labelWidth === "auto";
|
|
224
|
-
/* The bar only gets flex sizing when
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
371
|
+
/* The bar only gets flex sizing when it sits inside the inline (horizontal)
|
|
372
|
+
row wrapper. In the stacked ("above") layout the bar is in a column and
|
|
373
|
+
must keep its fixed height, so `flex-1` must not apply. Standalone — no
|
|
374
|
+
label and no value — it must not apply either. */
|
|
375
|
+
const inHorizontalRow =
|
|
376
|
+
(hasVisibleLabel || showValue) && labelPlacement === "inline";
|
|
377
|
+
/* Radix rejects a value outside 0–max outright — it logs an error, nulls
|
|
378
|
+
the value and announces the bar as indeterminate — so the bar gets the
|
|
379
|
+
same clamped measurement its fill is drawn from. The value column still
|
|
380
|
+
prints the raw figure. */
|
|
381
|
+
const clampedValue = Math.min(max, Math.max(0, value ?? 0));
|
|
382
|
+
const percentage = max > 0 ? (clampedValue / max) * 100 : 0;
|
|
231
383
|
|
|
232
384
|
const progressBar = (
|
|
233
385
|
<ProgressPrimitive.Root
|
|
234
386
|
ref={ref}
|
|
235
|
-
aria-label={
|
|
236
|
-
aria-labelledby={
|
|
387
|
+
aria-label={labelledByText ? undefined : ariaLabel}
|
|
388
|
+
aria-labelledby={labelledByText ? labelId : undefined}
|
|
237
389
|
className={cn(
|
|
238
390
|
"relative w-full overflow-hidden rounded-full",
|
|
239
391
|
// Inside the row wrapper the bar fills whatever the fixed label and
|
|
240
392
|
// value columns leave over; standalone it must not flex at all.
|
|
241
|
-
|
|
393
|
+
inHorizontalRow && "min-w-0 flex-1",
|
|
242
394
|
sizeStyles.bar,
|
|
243
395
|
colorStyles.track,
|
|
244
396
|
!hasVisibleLabel && !showValue && disabled && "opacity-50",
|
|
@@ -248,13 +400,16 @@ const Progress = React.forwardRef<
|
|
|
248
400
|
data-slot="progress"
|
|
249
401
|
data-tracking-el={trackingEl}
|
|
250
402
|
data-tracking-label={trackingLabel}
|
|
403
|
+
/* Default announcement = what the column shows. A consumer's own
|
|
404
|
+
Radix `getValueLabel` (in `...props`) still wins. */
|
|
405
|
+
getValueLabel={() => valueText}
|
|
251
406
|
max={max}
|
|
252
407
|
/* Always a number, never null: null is how Radix marks a bar
|
|
253
408
|
indeterminate and drops aria-valuenow, and this bar is always
|
|
254
409
|
measuring something. A value-less bar is a placeholder row — it
|
|
255
410
|
keeps the layout and shows "–" — so it stays determinate rather
|
|
256
411
|
than being announced as indeterminate over an empty track. */
|
|
257
|
-
value={
|
|
412
|
+
value={clampedValue}
|
|
258
413
|
{...props}
|
|
259
414
|
>
|
|
260
415
|
<ProgressPrimitive.Indicator asChild>
|
|
@@ -279,6 +434,56 @@ const Progress = React.forwardRef<
|
|
|
279
434
|
return progressBar;
|
|
280
435
|
}
|
|
281
436
|
|
|
437
|
+
/* Stacked layout: label + value on one line, bar full width beneath.
|
|
438
|
+
Used in narrow columns where the inline row squeezes the bar. */
|
|
439
|
+
if (labelPlacement === "above") {
|
|
440
|
+
return (
|
|
441
|
+
<div
|
|
442
|
+
className={cn(
|
|
443
|
+
"flex w-full flex-col gap-1.5",
|
|
444
|
+
disabled && "opacity-50"
|
|
445
|
+
)}
|
|
446
|
+
data-label-placement="above"
|
|
447
|
+
data-slot="progress-wrapper"
|
|
448
|
+
>
|
|
449
|
+
<div
|
|
450
|
+
className={cn(
|
|
451
|
+
"flex justify-between gap-3",
|
|
452
|
+
hasVisibleLabel && !labelIsText
|
|
453
|
+
? "items-center"
|
|
454
|
+
: "items-baseline"
|
|
455
|
+
)}
|
|
456
|
+
>
|
|
457
|
+
{hasVisibleLabel && (
|
|
458
|
+
<span
|
|
459
|
+
className={cn(
|
|
460
|
+
"text-foreground min-w-0",
|
|
461
|
+
!labelIsText && "flex items-center",
|
|
462
|
+
sizeStyles.text
|
|
463
|
+
)}
|
|
464
|
+
data-slot="progress-label"
|
|
465
|
+
id={labelId}
|
|
466
|
+
>
|
|
467
|
+
{label}
|
|
468
|
+
</span>
|
|
469
|
+
)}
|
|
470
|
+
{showValue && (
|
|
471
|
+
<span
|
|
472
|
+
className={cn(
|
|
473
|
+
"text-muted-foreground ml-auto shrink-0 tabular-nums",
|
|
474
|
+
sizeStyles.text
|
|
475
|
+
)}
|
|
476
|
+
data-slot="progress-value"
|
|
477
|
+
>
|
|
478
|
+
<span data-slot="progress-value-text">{valueText}</span>
|
|
479
|
+
</span>
|
|
480
|
+
)}
|
|
481
|
+
</div>
|
|
482
|
+
{progressBar}
|
|
483
|
+
</div>
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
|
|
282
487
|
/* The bar's row: label on the left, bar in the middle, value on the right. */
|
|
283
488
|
const inlineRow = (
|
|
284
489
|
<div
|
|
@@ -289,7 +494,7 @@ const Progress = React.forwardRef<
|
|
|
289
494
|
data-slot="progress-wrapper"
|
|
290
495
|
>
|
|
291
496
|
{hasVisibleLabel && (
|
|
292
|
-
<
|
|
497
|
+
<div
|
|
293
498
|
// Fixed column: `shrink-0` + explicit width. Long labels wrap
|
|
294
499
|
// (`break-words` also splits a single overlong word) instead of
|
|
295
500
|
// pushing the bar around.
|
|
@@ -298,6 +503,9 @@ const Progress = React.forwardRef<
|
|
|
298
503
|
// `auto`: hug the text but never take more than 40% of the row,
|
|
299
504
|
// so an overlong label still wraps instead of squeezing the bar.
|
|
300
505
|
labelHugs && "max-w-2/5",
|
|
506
|
+
// A node label (Rating, icon) sits on the row's centre line like
|
|
507
|
+
// text would; text keeps inline flow so it can wrap.
|
|
508
|
+
!labelIsText && "flex items-center",
|
|
301
509
|
sizeStyles.text
|
|
302
510
|
)}
|
|
303
511
|
data-label-width={labelHugs ? "auto" : undefined}
|
|
@@ -306,7 +514,7 @@ const Progress = React.forwardRef<
|
|
|
306
514
|
style={labelHugs ? undefined : { width: labelWidth }}
|
|
307
515
|
>
|
|
308
516
|
{label}
|
|
309
|
-
</
|
|
517
|
+
</div>
|
|
310
518
|
)}
|
|
311
519
|
{progressBar}
|
|
312
520
|
{showValue && (
|
|
@@ -318,24 +526,33 @@ const Progress = React.forwardRef<
|
|
|
318
526
|
data-slot="progress-value"
|
|
319
527
|
>
|
|
320
528
|
{/*
|
|
321
|
-
Invisible
|
|
322
|
-
(`100%`, `
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
the
|
|
529
|
+
Invisible sizers holding the value text at both extremes of the
|
|
530
|
+
scale (`0%` / `100%`, `0 / 100 steps` / `100 / 100 steps`,
|
|
531
|
+
`60 min left` / `0 min left`), stacked under the real value in
|
|
532
|
+
the same grid cell, so the cell takes the wider one. Every row
|
|
533
|
+
with the same `max`/`unit`/formatter gets the same value-column
|
|
534
|
+
width — never below the 40px `min-w-10` floor that the Figma
|
|
535
|
+
component also uses — so bars end at the same x-position.
|
|
326
536
|
*/}
|
|
327
537
|
<span
|
|
328
538
|
aria-hidden="true"
|
|
329
539
|
className="invisible col-start-1 row-start-1"
|
|
330
540
|
data-slot="progress-value-sizer"
|
|
331
541
|
>
|
|
332
|
-
{
|
|
542
|
+
{formatValue(max, max)}
|
|
543
|
+
</span>
|
|
544
|
+
<span
|
|
545
|
+
aria-hidden="true"
|
|
546
|
+
className="invisible col-start-1 row-start-1"
|
|
547
|
+
data-slot="progress-value-sizer-min"
|
|
548
|
+
>
|
|
549
|
+
{formatValue(0, max)}
|
|
333
550
|
</span>
|
|
334
551
|
<span
|
|
335
552
|
className="col-start-1 row-start-1"
|
|
336
553
|
data-slot="progress-value-text"
|
|
337
554
|
>
|
|
338
|
-
{
|
|
555
|
+
{valueText}
|
|
339
556
|
</span>
|
|
340
557
|
</span>
|
|
341
558
|
)}
|
|
@@ -349,4 +566,14 @@ const Progress = React.forwardRef<
|
|
|
349
566
|
Progress.displayName = "Progress";
|
|
350
567
|
|
|
351
568
|
export { Progress };
|
|
352
|
-
export type {
|
|
569
|
+
export type {
|
|
570
|
+
ProgressProps,
|
|
571
|
+
ProgressStrictProps,
|
|
572
|
+
ProgressBaseProps,
|
|
573
|
+
ProgressColor,
|
|
574
|
+
ProgressSize,
|
|
575
|
+
ProgressLabelPlacement,
|
|
576
|
+
ProgressLabelWidth,
|
|
577
|
+
ProgressValueFormatter,
|
|
578
|
+
ProgressNodeLabel,
|
|
579
|
+
};
|