@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
package/dist/progress.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";const q=require("./_virtual/_rolldown/runtime.cjs"),O=require("./lib/motion.cjs");let u=require("react");u=q.__toESM(u,1);let t=require("@brightlocal/ui-components/lib/utils"),e=require("react/jsx-runtime"),Y=require("framer-motion"),F=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion"),g=require("@radix-ui/react-progress");g=q.__toESM(g,1);var y={sm:{text:"text-body-sm",bar:"h-2"},md:{text:"text-body",bar:"h-3"}},N={green:{track:"bg-score-strong/20",indicator:"bg-score-strong"},red:{track:"bg-score-poor/20",indicator:"bg-score-poor"},orange:{track:"bg-score-weak/20",indicator:"bg-score-weak"},yellow:{track:"bg-score-moderate/20",indicator:"bg-score-moderate"}},U="40%";function V(s,a,r){if(s==null)return"–";if(r==="%")return`${a>0?Math.min(100,Math.max(0,Math.round(s/a*100))):0}%`;const c=r?` ${r}`:"";return a>0?`${s} / ${a}${c}`:`${s}${c}`}var S=u.forwardRef(({className:s,value:a,max:r=100,dataHook:c,trackingEl:E,trackingLabel:L,ariaLabel:M="Progress",label:o,labelWidth:_=U,color:T="green",size:$="sm",labelPlacement:v="inline",showValue:n=!1,unit:I="%",valueFormatter:R,indicatorClassName:P,disabled:m,...z},B)=>{const p=u.useId(),i=o!=null&&o!=="",d=typeof o=="string"||typeof o=="number",w=i&&d,f=R??((D,G)=>V(D,G,I)),x=f(a,r),H=(0,F.usePrefersReducedMotion)(),j=N[T]??N.green,l=y[$]??y.sm,b=_==="auto",A=(i||n)&&v==="inline",k=Math.min(r,Math.max(0,a??0)),C=r>0?k/r*100:0,h=(0,e.jsx)(g.Root,{ref:B,"aria-label":w?void 0:M,"aria-labelledby":w?p:void 0,className:(0,t.cn)("relative w-full overflow-hidden rounded-full",A&&"min-w-0 flex-1",l.bar,j.track,!i&&!n&&m&&"opacity-50",s),"data-hook":c,"data-slot":"progress","data-tracking-el":E,"data-tracking-label":L,getValueLabel:()=>x,max:r,value:k,...z,children:(0,e.jsx)(g.Indicator,{asChild:!0,children:(0,e.jsx)(Y.motion.div,{animate:{transform:`translateX(-${100-C}%)`},className:(0,t.cn)("h-full w-full flex-1",j.indicator,P),"data-slot":"progress-indicator",initial:!1,transition:H?{duration:0}:O.SPRING_GENTLE})})});return!i&&!n?h:v==="above"?(0,e.jsxs)("div",{className:(0,t.cn)("flex w-full flex-col gap-1.5",m&&"opacity-50"),"data-label-placement":"above","data-slot":"progress-wrapper",children:[(0,e.jsxs)("div",{className:(0,t.cn)("flex justify-between gap-3",i&&!d?"items-center":"items-baseline"),children:[i&&(0,e.jsx)("span",{className:(0,t.cn)("text-foreground min-w-0",!d&&"flex items-center",l.text),"data-slot":"progress-label",id:p,children:o}),n&&(0,e.jsx)("span",{className:(0,t.cn)("text-muted-foreground ml-auto shrink-0 tabular-nums",l.text),"data-slot":"progress-value",children:(0,e.jsx)("span",{"data-slot":"progress-value-text",children:x})})]}),h]}):(0,e.jsxs)("div",{className:(0,t.cn)("flex w-full items-center gap-2",m&&"opacity-50"),"data-slot":"progress-wrapper",children:[i&&(0,e.jsx)("div",{className:(0,t.cn)("text-foreground shrink-0 break-words",b&&"max-w-2/5",!d&&"flex items-center",l.text),"data-label-width":b?"auto":void 0,"data-slot":"progress-label",id:p,style:b?void 0:{width:_},children:o}),h,n&&(0,e.jsxs)("span",{className:(0,t.cn)("text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums",l.text),"data-slot":"progress-value",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:"invisible col-start-1 row-start-1","data-slot":"progress-value-sizer",children:f(r,r)}),(0,e.jsx)("span",{"aria-hidden":"true",className:"invisible col-start-1 row-start-1","data-slot":"progress-value-sizer-min",children:f(0,r)}),(0,e.jsx)("span",{className:"col-start-1 row-start-1","data-slot":"progress-value-text",children:x})]})]})});S.displayName="Progress";exports.Progress=S;
|
package/dist/progress.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Color for the progress indicator, drawn from the score scale (`score-*`).
|
|
5
5
|
* - `green` — strong / healthy / complete
|
|
6
6
|
* - `yellow` — moderate / acceptable
|
|
7
7
|
* - `orange` — weak / needs attention
|
|
@@ -14,38 +14,64 @@ type ProgressColor = "green" | "red" | "orange" | "yellow";
|
|
|
14
14
|
* - `md` — 16px (`text-body`) for roomier layouts
|
|
15
15
|
*/
|
|
16
16
|
type ProgressSize = "sm" | "md";
|
|
17
|
+
/**
|
|
18
|
+
* Controls where the label and value sit relative to the bar.
|
|
19
|
+
* - `inline` — label | bar | value in a single row (the default)
|
|
20
|
+
* - `above` — label and value on one line, bar full width beneath
|
|
21
|
+
*/
|
|
22
|
+
type ProgressLabelPlacement = "inline" | "above";
|
|
17
23
|
/**
|
|
18
24
|
* Width of the label column as a share of the row, or `auto` to hug the text.
|
|
19
25
|
* Mirrors the Figma `Progress / Label` Width options.
|
|
20
26
|
*/
|
|
21
27
|
type ProgressLabelWidth = "auto" | "20%" | "30%" | "40%" | "50%";
|
|
22
28
|
/**
|
|
23
|
-
*
|
|
29
|
+
* Formats the value shown beside the bar — and, through Radix's
|
|
30
|
+
* `getValueLabel`, the `aria-valuetext` screen readers announce — from the raw
|
|
31
|
+
* `value` and `max`. Receives `null` / `undefined` when the row has no value
|
|
32
|
+
* yet, so it picks its own placeholder (the built-in forms use `–`).
|
|
33
|
+
* @param value - Current value, or none.
|
|
34
|
+
* @param max - Maximum value (denominator).
|
|
35
|
+
* @example (value) => value?.toLocaleString() ?? "–"
|
|
36
|
+
*/
|
|
37
|
+
type ProgressValueFormatter = (value: number | null | undefined, max: number) => string;
|
|
38
|
+
/**
|
|
39
|
+
* A `label` that is rendered but cannot name the bar — an element such as a
|
|
40
|
+
* `Rating` or an icon (wrap several in a fragment). Always paired with
|
|
41
|
+
* `ariaLabel`. Text and numbers are not node labels: they name the bar
|
|
42
|
+
* themselves.
|
|
24
43
|
*/
|
|
25
|
-
|
|
44
|
+
type ProgressNodeLabel = React.ReactElement;
|
|
45
|
+
/**
|
|
46
|
+
* Props shared by every Progress, whatever its label is.
|
|
47
|
+
*/
|
|
48
|
+
interface ProgressBaseProps extends React.ComponentProps<typeof ProgressPrimitive.Root> {
|
|
26
49
|
/**
|
|
27
50
|
* Required data-hook attribute for testing and component identification
|
|
28
51
|
*/
|
|
29
52
|
dataHook: string;
|
|
30
53
|
/**
|
|
31
|
-
*
|
|
54
|
+
* Current value, measured against `max`. Drives the fill, the value column
|
|
55
|
+
* and `aria-valuenow`; out-of-range values are clamped to `0–max` for the
|
|
56
|
+
* bar while the column prints the raw figure. Omit it (or pass `null`) for a
|
|
57
|
+
* placeholder row — the bar stays empty and the column shows `–`.
|
|
32
58
|
*/
|
|
33
|
-
|
|
59
|
+
value?: number | null;
|
|
34
60
|
/**
|
|
35
|
-
*
|
|
61
|
+
* Maximum value — the denominator for the fill and the displayed value. For
|
|
62
|
+
* a set of rows that share one scale (a review breakdown), pass the same
|
|
63
|
+
* `max` to every row.
|
|
64
|
+
* @default 100
|
|
36
65
|
*/
|
|
37
|
-
|
|
66
|
+
max?: number;
|
|
38
67
|
/**
|
|
39
|
-
*
|
|
40
|
-
* @default "Progress"
|
|
68
|
+
* Optional tracking element identifier for analytics
|
|
41
69
|
*/
|
|
42
|
-
|
|
70
|
+
trackingEl?: string;
|
|
43
71
|
/**
|
|
44
|
-
* Optional
|
|
45
|
-
* Rendered inside a fixed-width column (see `labelWidth`); longer labels
|
|
46
|
-
* wrap onto further lines while the bar and value stay in their columns.
|
|
72
|
+
* Optional tracking label for analytics
|
|
47
73
|
*/
|
|
48
|
-
|
|
74
|
+
trackingLabel?: string;
|
|
49
75
|
/**
|
|
50
76
|
* Width of the label column: `"20%"` … `"50%"` of the row in 10% steps, or
|
|
51
77
|
* `"auto"`. Every row that uses the same percentage starts its bar at the
|
|
@@ -66,6 +92,15 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
66
92
|
* @default "sm"
|
|
67
93
|
*/
|
|
68
94
|
size?: ProgressSize;
|
|
95
|
+
/**
|
|
96
|
+
* Controls where the label and value sit relative to the bar.
|
|
97
|
+
* `"inline"` places label | bar | value in a single row (the default).
|
|
98
|
+
* `"above"` stacks the label and value on one line above a full-width bar —
|
|
99
|
+
* use this in narrow columns where the inline row would squeeze the bar.
|
|
100
|
+
* `labelWidth` is ignored when `"above"`.
|
|
101
|
+
* @default "inline"
|
|
102
|
+
*/
|
|
103
|
+
labelPlacement?: ProgressLabelPlacement;
|
|
69
104
|
/**
|
|
70
105
|
* Whether to render the numeric value to the right of the progress bar.
|
|
71
106
|
* Falls back to `–` when no value is provided so the layout stays consistent.
|
|
@@ -79,6 +114,21 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
79
114
|
* @default "%"
|
|
80
115
|
*/
|
|
81
116
|
unit?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Replaces the built-in `unit` forms with your own text for the value column,
|
|
119
|
+
* e.g. a raw count (`1,234`) or a remaining amount (`15 min left`). The same
|
|
120
|
+
* text is announced as the bar's `aria-valuetext` (unless you pass Radix's
|
|
121
|
+
* own `getValueLabel`). The column is sized to the wider of
|
|
122
|
+
* `valueFormatter(0, max)` and `valueFormatter(max, max)` so rows still end
|
|
123
|
+
* at the same x-position — the formatter's widest output must be at one of
|
|
124
|
+
* the two extremes, which holds for counts, percentages and remaining
|
|
125
|
+
* amounts. Pair
|
|
126
|
+
* it with a `value` / `max` that describe the real measurement — a count out
|
|
127
|
+
* of the largest count — rather than a precomputed percentage, so
|
|
128
|
+
* `aria-valuenow` stays honest.
|
|
129
|
+
* @example (value) => value?.toLocaleString() ?? "–"
|
|
130
|
+
*/
|
|
131
|
+
valueFormatter?: ProgressValueFormatter;
|
|
82
132
|
/**
|
|
83
133
|
* Custom class name for the indicator (progress fill)
|
|
84
134
|
* Use this to customize the color, e.g., "bg-chart-red"
|
|
@@ -90,6 +140,76 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
90
140
|
*/
|
|
91
141
|
disabled?: boolean;
|
|
92
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* The label column and the bar's accessible name, as a pair.
|
|
145
|
+
*
|
|
146
|
+
* A text `label` names the bar by itself (`aria-labelledby` points at it). Any
|
|
147
|
+
* other node — a Rating, an icon — is visible but cannot name anything, so it
|
|
148
|
+
* must come with an explicit `ariaLabel`; the union makes TypeScript insist on
|
|
149
|
+
* that pairing instead of letting a bar ship with an empty accessible name.
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* Text label: names the bar on its own, so `ariaLabel` is optional.
|
|
153
|
+
*/
|
|
154
|
+
interface ProgressTextLabelProps {
|
|
155
|
+
/**
|
|
156
|
+
* Optional visible label text displayed to the left of the progress bar.
|
|
157
|
+
* Rendered inside a fixed-width column (see `labelWidth`); longer labels
|
|
158
|
+
* wrap onto further lines while the bar and value stay in their columns.
|
|
159
|
+
*/
|
|
160
|
+
label?: string | number;
|
|
161
|
+
/**
|
|
162
|
+
* Accessible label for the progress bar for screen readers. Only used when
|
|
163
|
+
* there is no visible text `label`.
|
|
164
|
+
* @default "Progress"
|
|
165
|
+
*/
|
|
166
|
+
ariaLabel?: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Element label: cannot name the bar, so `ariaLabel` is required.
|
|
170
|
+
*/
|
|
171
|
+
interface ProgressNodeLabelProps {
|
|
172
|
+
/**
|
|
173
|
+
* Visible label rendered as an element — a `Rating`, an icon — in the same
|
|
174
|
+
* fixed-width column a text label uses (see `labelWidth`), vertically
|
|
175
|
+
* centred against the bar. Mark decorative icons `aria-hidden`.
|
|
176
|
+
*/
|
|
177
|
+
label: ProgressNodeLabel;
|
|
178
|
+
/**
|
|
179
|
+
* Accessible name for the bar — required with a node label, because the
|
|
180
|
+
* node cannot name it: `aria-labelledby` would resolve to nothing.
|
|
181
|
+
* @example "4 star reviews"
|
|
182
|
+
*/
|
|
183
|
+
ariaLabel: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* What the component's JSX signature accepts: the label pair is a union, so an
|
|
187
|
+
* element `label` cannot be passed without its `ariaLabel`. Use this type when
|
|
188
|
+
* a wrapper should carry the same guarantee; `Omit`/`Pick` over the union would
|
|
189
|
+
* collapse it.
|
|
190
|
+
*/
|
|
191
|
+
type ProgressStrictProps = ProgressBaseProps & (ProgressTextLabelProps | ProgressNodeLabelProps);
|
|
192
|
+
/**
|
|
193
|
+
* Props for the Progress component — the extendable, loose form (`interface X
|
|
194
|
+
* extends ProgressProps` keeps working). `label` is text, a number or an
|
|
195
|
+
* element; the element ⇒ `ariaLabel` pairing is enforced where it matters, on
|
|
196
|
+
* the component's own signature (`ProgressStrictProps`), so a value typed as
|
|
197
|
+
* `ProgressProps` with an element label must be narrowed before it is spread
|
|
198
|
+
* into `<Progress>`.
|
|
199
|
+
*/
|
|
200
|
+
interface ProgressProps extends ProgressBaseProps {
|
|
201
|
+
/**
|
|
202
|
+
* Visible label: text (wraps inside the label column), a number, or an
|
|
203
|
+
* element such as a `Rating` or an icon — an element requires `ariaLabel`.
|
|
204
|
+
*/
|
|
205
|
+
label?: string | number | ProgressNodeLabel;
|
|
206
|
+
/**
|
|
207
|
+
* Accessible label for the progress bar. Optional with a text label (the
|
|
208
|
+
* text names the bar); required with an element label.
|
|
209
|
+
* @default "Progress"
|
|
210
|
+
*/
|
|
211
|
+
ariaLabel?: string;
|
|
212
|
+
}
|
|
93
213
|
/**
|
|
94
214
|
* Progress component for displaying loading states and task completion.
|
|
95
215
|
* Built on Radix UI Progress primitive with Framer Motion animation.
|
|
@@ -98,9 +218,11 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
|
|
|
98
218
|
* a fixed-width label column, the bar filling the remaining space, and a
|
|
99
219
|
* right-aligned value column sized to the widest value it can show — so rows
|
|
100
220
|
* stacked in a card share the same bar start position and width, even when
|
|
101
|
-
* a label wraps onto two lines.
|
|
221
|
+
* a label wraps onto two lines. The label may be text or any node (a Rating,
|
|
222
|
+
* an icon — then `ariaLabel` is required), and `valueFormatter` replaces the
|
|
223
|
+
* built-in percentage / fraction forms with any text.
|
|
102
224
|
*/
|
|
103
|
-
declare const Progress: React.ForwardRefExoticComponent<Omit<
|
|
225
|
+
declare const Progress: React.ForwardRefExoticComponent<(Omit<ProgressBaseProps & ProgressTextLabelProps, "ref"> | Omit<ProgressBaseProps & ProgressNodeLabelProps, "ref">) & React.RefAttributes<HTMLDivElement>>;
|
|
104
226
|
export { Progress };
|
|
105
|
-
export type { ProgressProps, ProgressColor, ProgressSize, ProgressLabelWidth };
|
|
227
|
+
export type { ProgressProps, ProgressStrictProps, ProgressBaseProps, ProgressColor, ProgressSize, ProgressLabelPlacement, ProgressLabelWidth, ProgressValueFormatter, ProgressNodeLabel, };
|
|
106
228
|
//# sourceMappingURL=progress.d.ts.map
|
package/dist/progress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAO9D;;;;;;GAMG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D;;;;GAIG;AACH,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAO9D;;;;;;GAMG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D;;;;GAIG;AACH,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhC;;;;GAIG;AACH,KAAK,sBAAsB,GAAG,QAAQ,GAAG,OAAO,CAAC;AA4CjD;;;GAGG;AACH,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAkCjE;;;;;;;;GAQG;AACH,KAAK,sBAAsB,GAAG,CAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,GAAG,EAAE,MAAM,KACR,MAAM,CAAC;AAEZ;;;;;GAKG;AACH,KAAK,iBAAiB,GAAG,KAAK,CAAC,YAAY,CAAC;AAE5C;;GAEG;AACH,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CACtD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH;;GAEG;AACH,UAAU,sBAAsB;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,sBAAsB;IAC9B;;;;OAIG;IACH,KAAK,EAAE,iBAAiB,CAAC;IACzB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,KAAK,mBAAmB,GAAG,iBAAiB,GAC1C,CAAC,sBAAsB,GAAG,sBAAsB,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,UAAU,aAAc,SAAQ,iBAAiB;IAC/C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAC;IAC5C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,QAAQ,4LAgPb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,GAClB,CAAC"}
|
package/dist/progress.js
CHANGED
|
@@ -1,161 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { SPRING_GENTLE as O } from "./lib/motion.js";
|
|
3
|
+
import * as k from "react";
|
|
4
|
+
import { cn as t } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
6
|
+
import { motion as Y } from "framer-motion";
|
|
7
|
+
import { usePrefersReducedMotion as F } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
|
|
8
|
+
import * as L from "@radix-ui/react-progress";
|
|
9
|
+
var R = {
|
|
10
|
+
sm: {
|
|
11
|
+
text: "text-body-sm",
|
|
12
|
+
bar: "h-2"
|
|
13
|
+
},
|
|
14
|
+
md: {
|
|
15
|
+
text: "text-body",
|
|
16
|
+
bar: "h-3"
|
|
17
|
+
}
|
|
18
|
+
}, S = {
|
|
12
19
|
green: {
|
|
13
|
-
track: "bg-
|
|
14
|
-
indicator: "bg-
|
|
20
|
+
track: "bg-score-strong/20",
|
|
21
|
+
indicator: "bg-score-strong"
|
|
15
22
|
},
|
|
16
23
|
red: {
|
|
17
|
-
track: "bg-
|
|
18
|
-
indicator: "bg-
|
|
24
|
+
track: "bg-score-poor/20",
|
|
25
|
+
indicator: "bg-score-poor"
|
|
19
26
|
},
|
|
20
27
|
orange: {
|
|
21
|
-
track: "bg-
|
|
22
|
-
indicator: "bg-
|
|
28
|
+
track: "bg-score-weak/20",
|
|
29
|
+
indicator: "bg-score-weak"
|
|
23
30
|
},
|
|
24
31
|
yellow: {
|
|
25
|
-
track: "bg-
|
|
26
|
-
indicator: "bg-
|
|
32
|
+
track: "bg-score-moderate/20",
|
|
33
|
+
indicator: "bg-score-moderate"
|
|
27
34
|
}
|
|
28
|
-
},
|
|
29
|
-
function
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const n = r ? ` ${r}` : "";
|
|
35
|
-
return t > 0 ? `${e} / ${t}${n}` : `${e}${n}`;
|
|
35
|
+
}, U = "40%";
|
|
36
|
+
function V(a, s, e) {
|
|
37
|
+
if (a == null) return "–";
|
|
38
|
+
if (e === "%") return `${s > 0 ? Math.min(100, Math.max(0, Math.round(a / s * 100))) : 0}%`;
|
|
39
|
+
const d = e ? ` ${e}` : "";
|
|
40
|
+
return s > 0 ? `${a} / ${s}${d}` : `${a}${d}`;
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
label:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"data-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"div",
|
|
99
|
-
{
|
|
100
|
-
className: s(
|
|
101
|
-
"flex w-full items-center gap-2",
|
|
102
|
-
p && "opacity-50"
|
|
103
|
-
),
|
|
104
|
-
"data-slot": "progress-wrapper",
|
|
42
|
+
var X = k.forwardRef(({ className: a, value: s, max: e = 100, dataHook: d, trackingEl: T, trackingLabel: $, ariaLabel: E = "Progress", label: o, labelWidth: v = U, color: I = "green", size: M = "sm", labelPlacement: x = "inline", showValue: n = !1, unit: P = "%", valueFormatter: _, indicatorClassName: z, disabled: g, ...j }, B) => {
|
|
43
|
+
const p = k.useId(), i = o != null && o !== "", c = typeof o == "string" || typeof o == "number", w = i && c, f = _ ?? ((D, G) => V(D, G, P)), u = f(s, e), H = F(), y = S[I] ?? S.green, l = R[M] ?? R.sm, b = v === "auto", A = (i || n) && x === "inline", N = Math.min(e, Math.max(0, s ?? 0)), C = e > 0 ? N / e * 100 : 0, h = /* @__PURE__ */ r(L.Root, {
|
|
44
|
+
ref: B,
|
|
45
|
+
"aria-label": w ? void 0 : E,
|
|
46
|
+
"aria-labelledby": w ? p : void 0,
|
|
47
|
+
className: t("relative w-full overflow-hidden rounded-full", A && "min-w-0 flex-1", l.bar, y.track, !i && !n && g && "opacity-50", a),
|
|
48
|
+
"data-hook": d,
|
|
49
|
+
"data-slot": "progress",
|
|
50
|
+
"data-tracking-el": T,
|
|
51
|
+
"data-tracking-label": $,
|
|
52
|
+
getValueLabel: () => u,
|
|
53
|
+
max: e,
|
|
54
|
+
value: N,
|
|
55
|
+
...j,
|
|
56
|
+
children: /* @__PURE__ */ r(L.Indicator, {
|
|
57
|
+
asChild: !0,
|
|
58
|
+
children: /* @__PURE__ */ r(Y.div, {
|
|
59
|
+
animate: { transform: `translateX(-${100 - C}%)` },
|
|
60
|
+
className: t("h-full w-full flex-1", y.indicator, z),
|
|
61
|
+
"data-slot": "progress-indicator",
|
|
62
|
+
initial: !1,
|
|
63
|
+
transition: H ? { duration: 0 } : O
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
return !i && !n ? h : x === "above" ? /* @__PURE__ */ m("div", {
|
|
68
|
+
className: t("flex w-full flex-col gap-1.5", g && "opacity-50"),
|
|
69
|
+
"data-label-placement": "above",
|
|
70
|
+
"data-slot": "progress-wrapper",
|
|
71
|
+
children: [/* @__PURE__ */ m("div", {
|
|
72
|
+
className: t("flex justify-between gap-3", i && !c ? "items-center" : "items-baseline"),
|
|
73
|
+
children: [i && /* @__PURE__ */ r("span", {
|
|
74
|
+
className: t("text-foreground min-w-0", !c && "flex items-center", l.text),
|
|
75
|
+
"data-slot": "progress-label",
|
|
76
|
+
id: p,
|
|
77
|
+
children: o
|
|
78
|
+
}), n && /* @__PURE__ */ r("span", {
|
|
79
|
+
className: t("text-muted-foreground ml-auto shrink-0 tabular-nums", l.text),
|
|
80
|
+
"data-slot": "progress-value",
|
|
81
|
+
children: /* @__PURE__ */ r("span", {
|
|
82
|
+
"data-slot": "progress-value-text",
|
|
83
|
+
children: u
|
|
84
|
+
})
|
|
85
|
+
})]
|
|
86
|
+
}), h]
|
|
87
|
+
}) : /* @__PURE__ */ m("div", {
|
|
88
|
+
className: t("flex w-full items-center gap-2", g && "opacity-50"),
|
|
89
|
+
"data-slot": "progress-wrapper",
|
|
90
|
+
children: [
|
|
91
|
+
i && /* @__PURE__ */ r("div", {
|
|
92
|
+
className: t("text-foreground shrink-0 break-words", b && "max-w-2/5", !c && "flex items-center", l.text),
|
|
93
|
+
"data-label-width": b ? "auto" : void 0,
|
|
94
|
+
"data-slot": "progress-label",
|
|
95
|
+
id: p,
|
|
96
|
+
style: b ? void 0 : { width: v },
|
|
97
|
+
children: o
|
|
98
|
+
}),
|
|
99
|
+
h,
|
|
100
|
+
n && /* @__PURE__ */ m("span", {
|
|
101
|
+
className: t("text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums", l.text),
|
|
102
|
+
"data-slot": "progress-value",
|
|
105
103
|
children: [
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
)
|
|
123
|
-
h,
|
|
124
|
-
i && /* @__PURE__ */ w(
|
|
125
|
-
"span",
|
|
126
|
-
{
|
|
127
|
-
className: s(
|
|
128
|
-
"text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums",
|
|
129
|
-
d.text
|
|
130
|
-
),
|
|
131
|
-
"data-slot": "progress-value",
|
|
132
|
-
children: [
|
|
133
|
-
/* @__PURE__ */ o(
|
|
134
|
-
"span",
|
|
135
|
-
{
|
|
136
|
-
"aria-hidden": "true",
|
|
137
|
-
className: "invisible col-start-1 row-start-1",
|
|
138
|
-
"data-slot": "progress-value-sizer",
|
|
139
|
-
children: R(r, r, f)
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
/* @__PURE__ */ o(
|
|
143
|
-
"span",
|
|
144
|
-
{
|
|
145
|
-
className: "col-start-1 row-start-1",
|
|
146
|
-
"data-slot": "progress-value-text",
|
|
147
|
-
children: R(t, r, f)
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
)
|
|
104
|
+
/* @__PURE__ */ r("span", {
|
|
105
|
+
"aria-hidden": "true",
|
|
106
|
+
className: "invisible col-start-1 row-start-1",
|
|
107
|
+
"data-slot": "progress-value-sizer",
|
|
108
|
+
children: f(e, e)
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ r("span", {
|
|
111
|
+
"aria-hidden": "true",
|
|
112
|
+
className: "invisible col-start-1 row-start-1",
|
|
113
|
+
"data-slot": "progress-value-sizer-min",
|
|
114
|
+
children: f(0, e)
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ r("span", {
|
|
117
|
+
className: "col-start-1 row-start-1",
|
|
118
|
+
"data-slot": "progress-value-text",
|
|
119
|
+
children: u
|
|
120
|
+
})
|
|
153
121
|
]
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
X.displayName = "Progress";
|
|
159
127
|
export {
|
|
160
|
-
|
|
128
|
+
X as Progress
|
|
161
129
|
};
|
package/dist/radio-group.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";const g=require("./_virtual/_rolldown/runtime.cjs");let t=require("react");t=g.__toESM(t,1);let y=require("@brightlocal/icons"),s=require("@brightlocal/ui-components/lib/utils"),o=require("react/jsx-runtime"),b=require("class-variance-authority"),a=require("@radix-ui/react-radio-group");a=g.__toESM(a,1);var _=(0,b.cva)("grid",{variants:{variant:{simple:["gap-3"],box:["gap-3"],boxIconVertical:["grid-flow-col auto-cols-fr gap-3"],boxIconHorizontal:["gap-3"]}},defaultVariants:{variant:"simple"}}),w=(0,b.cva)("group relative flex cursor-pointer outline-none disabled:cursor-not-allowed disabled:opacity-50 after:absolute after:inset-0",{variants:{variant:{simple:["items-center"],box:["items-center"],boxIconVertical:["items-center justify-center"],boxIconHorizontal:["items-center justify-center"]}},defaultVariants:{variant:"simple"}}),I=(0,b.cva)("relative aspect-square size-4 shrink-0 rounded-full border transition-[border-color,border-width,box-shadow,background-color] duration-fast ease-out",{variants:{variant:{simple:["border-ring bg-background shadow-xs","group-focus-visible:outline-none group-focus-visible:border-ring group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"],box:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-4 group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5 dark:group-data-[state=checked]:border-primary"],boxIconVertical:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"],boxIconHorizontal:["border-ring bg-background shadow-xs","group-data-[state=checked]:border-primary group-data-[state=checked]:bg-primary","group-focus-visible:outline-none group-focus-visible:shadow-default","group-data-[disabled]:opacity-50","dark:bg-white/5"]}},defaultVariants:{variant:"simple"}}),v=t.createContext({variant:"simple"}),m=t.forwardRef(({className:d,variant:e="simple",dataHook:n,trackingEl:c,trackingLabel:l,error:u,orientation:r,...i},x)=>{const h=e||"simple",p=u||i["aria-invalid"]===!0||i["aria-invalid"]==="true",k=e==="boxIconVertical"?"horizontal":r;return(0,o.jsx)(v.Provider,{value:{variant:h,error:p},children:(0,o.jsx)(a.Root,{ref:x,"aria-invalid":p?"true":void 0,className:(0,s.cn)(_({variant:e}),d),"data-hook":n,"data-slot":"radio-group","data-tracking-el":c,"data-tracking-label":l,"data-variant":e,orientation:k,...i})})});m.displayName=a.Root.displayName;var f=t.forwardRef(({className:d,children:e,...n},c)=>{const{variant:l,error:u}=t.useContext(v),r=l??"simple",i=r==="boxIconVertical"||r==="boxIconHorizontal";return(0,o.jsxs)(a.Item,{ref:c,className:(0,s.cn)(w({variant:r}),d),"data-slot":"radio-group-item",...n,children:[!i&&(0,o.jsx)("div",{className:(0,s.cn)(I({variant:r}),u&&["border-destructive-40","group-focus-visible:border-destructive-40 group-focus-visible:shadow-destructive"]),children:(0,o.jsx)(a.Indicator,{className:"absolute inset-0 flex items-center justify-center","data-slot":"radio-group-indicator",children:(0,o.jsx)(y.Circle,{className:(0,s.cn)(r==="simple"?"fill-primary text-primary":"fill-background text-background"),size:8})})}),e]})});f.displayName=a.Item.displayName;exports.RadioGroup=m;exports.RadioGroupItem=f;
|