@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
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
BLOCK_ILLUSTRATION_SIZE,
|
|
11
11
|
BlockIllustration,
|
|
12
12
|
} from "../lib/block-illustration";
|
|
13
|
-
import {
|
|
13
|
+
import { type LogoMarkVariant } from "../components/logo-mark";
|
|
14
|
+
import { EmptyChip } from "../lib/empty-chip";
|
|
14
15
|
|
|
15
16
|
/* -------------------------------------------------------------------------------------------------
|
|
16
17
|
* EmptyState
|
|
@@ -26,7 +27,8 @@ import { emptyChipStyles } from "../lib/empty-chip";
|
|
|
26
27
|
* for a section):
|
|
27
28
|
*
|
|
28
29
|
* md (default) — for the box a working page gives it: a card, a panel, a
|
|
29
|
-
* zero-row table. An icon in a
|
|
30
|
+
* zero-row table. An icon in a LogoMark chip, and a 16/24
|
|
31
|
+
* title.
|
|
30
32
|
* lg — for the moment the whole page has nothing to show: a full
|
|
31
33
|
* illustration at 130 and a 20/28 title. Sits at the page
|
|
32
34
|
* body's optical centre via `<Grid variant="centered">`.
|
|
@@ -68,6 +70,16 @@ type EmptyStateSize = "md" | "lg";
|
|
|
68
70
|
*/
|
|
69
71
|
type EmptyStateAlign = "center" | "left";
|
|
70
72
|
|
|
73
|
+
/**
|
|
74
|
+
* The chip's container — LogoMark's variant, picked for the surface the block
|
|
75
|
+
* sits on (DS-1208).
|
|
76
|
+
* - `filled` — the muted fill. For a white surface: a card, a page body.
|
|
77
|
+
* - `border` — a hairline ring. For a `bg-muted` panel, where the fill would
|
|
78
|
+
* vanish into the surface.
|
|
79
|
+
* - `transparent` — the bare glyph, no container.
|
|
80
|
+
*/
|
|
81
|
+
type EmptyStateIconVariant = LogoMarkVariant;
|
|
82
|
+
|
|
71
83
|
/** The title's type role per size — Inter 16/24, or Inter 20/28. One step
|
|
72
84
|
* under the heading of the page or card the block sits inside, so the empty
|
|
73
85
|
* message never competes with it (DS-997). */
|
|
@@ -99,7 +111,8 @@ interface EmptyStateBaseProps extends Omit<
|
|
|
99
111
|
dataHook: string;
|
|
100
112
|
/**
|
|
101
113
|
* What is missing, as a real heading. Name the thing, not the condition:
|
|
102
|
-
* "No locations yet", never "Empty".
|
|
114
|
+
* "No locations yet", never "Empty". Keep it short — at size lg it wraps
|
|
115
|
+
* at 32rem; the explanation belongs in `description`.
|
|
103
116
|
*/
|
|
104
117
|
title: React.ReactNode;
|
|
105
118
|
/**
|
|
@@ -123,6 +136,13 @@ interface EmptyStateBaseProps extends Omit<
|
|
|
123
136
|
* @default 3 at size md, 2 at size lg
|
|
124
137
|
*/
|
|
125
138
|
titleLevel?: TypographyHeadingLevel;
|
|
139
|
+
/**
|
|
140
|
+
* The icon chip's container, for the surface the block sits on: `filled`
|
|
141
|
+
* on white, `border` (or `transparent`) on a `bg-muted` panel, where the
|
|
142
|
+
* fill would disappear. Applies only when the chip renders.
|
|
143
|
+
* @default "filled"
|
|
144
|
+
*/
|
|
145
|
+
iconVariant?: EmptyStateIconVariant;
|
|
126
146
|
/**
|
|
127
147
|
* Tracking element identifier for analytics.
|
|
128
148
|
*/
|
|
@@ -147,7 +167,7 @@ interface EmptyStateMdProps extends EmptyStateBaseProps {
|
|
|
147
167
|
*/
|
|
148
168
|
align?: EmptyStateAlign;
|
|
149
169
|
/**
|
|
150
|
-
* The glyph in the
|
|
170
|
+
* The glyph in the chip — a LogoMark at lg, sized by the mark. Decorative: the wrapper
|
|
151
171
|
* is `aria-hidden`, so pass the glyph and nothing else.
|
|
152
172
|
* @example <MapPin />
|
|
153
173
|
*/
|
|
@@ -171,11 +191,11 @@ interface EmptyStateLgProps extends EmptyStateBaseProps {
|
|
|
171
191
|
* Pass the illustration itself and do NOT set a size: the block renders it at
|
|
172
192
|
* the size the design specifies, whatever the element carries, so there is no
|
|
173
193
|
* number to get wrong per call site.
|
|
174
|
-
* @example <
|
|
194
|
+
* @example <SmallBusiness aria-hidden />
|
|
175
195
|
*/
|
|
176
196
|
illustration?: React.ReactNode;
|
|
177
197
|
/**
|
|
178
|
-
* A glyph in the
|
|
198
|
+
* A glyph in the chip, for a page with no illustration of its own.
|
|
179
199
|
* Ignored when `illustration` is set — a screen gets one visual, not two.
|
|
180
200
|
*/
|
|
181
201
|
icon?: React.ReactNode;
|
|
@@ -230,7 +250,7 @@ export type EmptyStateProps = EmptyStateMdProps | EmptyStateLgProps;
|
|
|
230
250
|
* <EmptyState
|
|
231
251
|
* dataHook="locations-empty-page"
|
|
232
252
|
* description={t("locations.empty.description")}
|
|
233
|
-
* illustration={<
|
|
253
|
+
* illustration={<SmallBusiness aria-hidden />}
|
|
234
254
|
* size="lg"
|
|
235
255
|
* title={t("locations.empty.title")}
|
|
236
256
|
* >
|
|
@@ -251,6 +271,7 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
251
271
|
description,
|
|
252
272
|
children,
|
|
253
273
|
titleLevel,
|
|
274
|
+
iconVariant = "filled",
|
|
254
275
|
trackingEl,
|
|
255
276
|
trackingLabel,
|
|
256
277
|
size = "md",
|
|
@@ -298,19 +319,15 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
298
319
|
{illustration}
|
|
299
320
|
</BlockIllustration>
|
|
300
321
|
) : icon ? (
|
|
301
|
-
<
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
data-slot="empty-state-icon"
|
|
311
|
-
>
|
|
312
|
-
{icon}
|
|
313
|
-
</span>
|
|
322
|
+
<EmptyChip
|
|
323
|
+
/* The chip's 4px of extra breathing room belongs to the title
|
|
324
|
+
under it — the lg column sets its own 16px rhythm instead. */
|
|
325
|
+
className={size === "md" && align === "center" ? "mb-1" : undefined}
|
|
326
|
+
dataHook={`${dataHook}-icon`}
|
|
327
|
+
icon={icon}
|
|
328
|
+
slot="empty-state-icon"
|
|
329
|
+
variant={iconVariant}
|
|
330
|
+
/>
|
|
314
331
|
) : null;
|
|
315
332
|
|
|
316
333
|
/* One column for every size and alignment, so the parts and their spacing
|
|
@@ -325,6 +342,10 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
325
342
|
>
|
|
326
343
|
<TypographyHeading
|
|
327
344
|
align={align === "center" ? "center" : "left"}
|
|
345
|
+
/* lg caps the title at 32rem, one step wider than the description
|
|
346
|
+
below it, so a long title wraps into the column instead of running
|
|
347
|
+
the full width of the page body. md is bounded by its frame. */
|
|
348
|
+
className={size === "lg" ? "max-w-lg" : undefined}
|
|
328
349
|
data-slot="empty-state-title"
|
|
329
350
|
dataHook={`${dataHook}-title`}
|
|
330
351
|
level={titleLevel ?? SIZE_TITLE_LEVEL[size]}
|
|
@@ -409,4 +430,4 @@ EmptyState.displayName = "EmptyState";
|
|
|
409
430
|
|
|
410
431
|
export { EmptyState };
|
|
411
432
|
|
|
412
|
-
export type { EmptyStateAlign, EmptyStateSize };
|
|
433
|
+
export type { EmptyStateAlign, EmptyStateIconVariant, EmptyStateSize };
|
|
@@ -313,7 +313,7 @@ export interface ProgressStateProps extends Omit<
|
|
|
313
313
|
* title's companion, not the subject of the screen: much larger and it
|
|
314
314
|
* outweighs the 24px heading under it, and the eye lands on the artwork
|
|
315
315
|
* instead of the words that say what is happening.
|
|
316
|
-
* @example <
|
|
316
|
+
* @example <MapMagnifyingGlass aria-hidden />
|
|
317
317
|
*/
|
|
318
318
|
illustration?: React.ReactNode;
|
|
319
319
|
/**
|
|
@@ -378,7 +378,7 @@ export interface ProgressStateProps extends Omit<
|
|
|
378
378
|
* // The backend reports real progress.
|
|
379
379
|
* <ProgressState
|
|
380
380
|
* dataHook="lsg-generating"
|
|
381
|
-
* illustration={<
|
|
381
|
+
* illustration={<MapMagnifyingGlass aria-hidden />}
|
|
382
382
|
* title={t("reports.building.title")}
|
|
383
383
|
* description={t("reports.building.description")}
|
|
384
384
|
* value={run.percent}
|
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -1022,7 +1022,7 @@ const SidebarGroupAction = React.forwardRef<
|
|
|
1022
1022
|
<Comp
|
|
1023
1023
|
ref={ref}
|
|
1024
1024
|
className={cn(
|
|
1025
|
-
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground duration-base absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform ease-in-out outline-none [&>svg]:shrink-0",
|
|
1025
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground duration-base absolute top-3.5 right-3 flex aspect-square w-5 cursor-pointer items-center justify-center rounded-md p-0 transition-transform ease-in-out outline-none [&>svg]:shrink-0",
|
|
1026
1026
|
SIDEBAR_FOCUS_RING,
|
|
1027
1027
|
// Increases the hit area of the button on mobile.
|
|
1028
1028
|
"after:absolute after:-inset-2 after:md:hidden",
|
|
@@ -1082,18 +1082,44 @@ SidebarMenu.displayName = "SidebarMenu";
|
|
|
1082
1082
|
/**
|
|
1083
1083
|
* Props for the SidebarMenuItem component
|
|
1084
1084
|
*/
|
|
1085
|
+
// A strip over the gap above the item (gap-1 between rows, py-1 at the top of
|
|
1086
|
+
// a sub-list), so the pointer is always over exactly one item and the hover
|
|
1087
|
+
// fill never blinks off between rows. The <li> is hovered while none of its
|
|
1088
|
+
// children are, which the buttons' `in-[…:hover]` classes light up.
|
|
1089
|
+
const SIDEBAR_ITEM_GAP_STRIP =
|
|
1090
|
+
"relative before:absolute before:inset-x-0 before:-top-1 before:h-1 before:cursor-pointer before:content-['']";
|
|
1091
|
+
|
|
1092
|
+
// A click on the strip goes to the item's button. The first control is the
|
|
1093
|
+
// button (actions/badges come after it); matched by element, as asChild
|
|
1094
|
+
// triggers replace its data-slot.
|
|
1095
|
+
function clickItemFromGapStrip(event: React.MouseEvent<HTMLLIElement>) {
|
|
1096
|
+
if (event.target === event.currentTarget) {
|
|
1097
|
+
event.currentTarget.querySelector<HTMLElement>("a[href], button")?.click();
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1085
1101
|
interface SidebarMenuItemProps extends React.ComponentProps<"li"> {
|
|
1086
1102
|
/** Data hook for automated testing */
|
|
1087
1103
|
dataHook?: string;
|
|
1088
1104
|
}
|
|
1089
1105
|
|
|
1090
1106
|
const SidebarMenuItem = React.forwardRef<HTMLLIElement, SidebarMenuItemProps>(
|
|
1091
|
-
({ className, dataHook, ...props }, ref) => (
|
|
1107
|
+
({ className, dataHook, onClick, ...props }, ref) => (
|
|
1108
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- pointer-only hit-area extension; the button stays the keyboard target
|
|
1092
1109
|
<li
|
|
1093
1110
|
ref={ref}
|
|
1094
|
-
className={cn(
|
|
1111
|
+
className={cn(
|
|
1112
|
+
"group/menu-item",
|
|
1113
|
+
SIDEBAR_ITEM_GAP_STRIP,
|
|
1114
|
+
"first:before:hidden",
|
|
1115
|
+
className
|
|
1116
|
+
)}
|
|
1095
1117
|
data-hook={dataHook}
|
|
1096
1118
|
data-slot="sidebar-menu-item"
|
|
1119
|
+
onClick={(event) => {
|
|
1120
|
+
onClick?.(event);
|
|
1121
|
+
clickItemFromGapStrip(event);
|
|
1122
|
+
}}
|
|
1097
1123
|
{...props}
|
|
1098
1124
|
/>
|
|
1099
1125
|
)
|
|
@@ -1160,7 +1186,9 @@ SidebarCollapseIcon.displayName = "SidebarCollapseIcon";
|
|
|
1160
1186
|
|
|
1161
1187
|
const sidebarMenuButtonVariants = cva(
|
|
1162
1188
|
[
|
|
1163
|
-
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-4 py-2 text-left text-label outline-none transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-base ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:not([data-slot])]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",
|
|
1189
|
+
"peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden rounded-full px-4 py-2 text-left text-label outline-none transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-base ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:not([data-slot])]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",
|
|
1190
|
+
// Hovering the gap strip above the item (SIDEBAR_ITEM_GAP_STRIP) lights it.
|
|
1191
|
+
"in-[[data-slot=sidebar-menu-item]:hover:not(:has(:hover))]:bg-sidebar-accent in-[[data-slot=sidebar-menu-item]:hover:not(:has(:hover))]:text-sidebar-accent-foreground",
|
|
1164
1192
|
SIDEBAR_FOCUS_RING,
|
|
1165
1193
|
],
|
|
1166
1194
|
{
|
|
@@ -1247,6 +1275,11 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
1247
1275
|
) => {
|
|
1248
1276
|
const Comp = asChild ? Slot : "button";
|
|
1249
1277
|
const { isMobile, state } = useSidebar();
|
|
1278
|
+
const canShowTooltip = state === "collapsed" && !isMobile;
|
|
1279
|
+
const [tooltipOpen, setTooltipOpen] = React.useState(false);
|
|
1280
|
+
// Drop a tooltip left open when the sidebar expands, so it doesn't
|
|
1281
|
+
// reappear on the next collapse.
|
|
1282
|
+
if (!canShowTooltip && tooltipOpen) setTooltipOpen(false);
|
|
1250
1283
|
|
|
1251
1284
|
const button = (
|
|
1252
1285
|
<Comp
|
|
@@ -1272,8 +1305,14 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
1272
1305
|
};
|
|
1273
1306
|
}
|
|
1274
1307
|
|
|
1308
|
+
// Held closed while expanded or on mobile: hover then changes no state, sets
|
|
1309
|
+
// no aria-describedby and mounts no portal. The wrapper itself stays, so the
|
|
1310
|
+
// button isn't remounted (losing focus and its size morph) on collapse.
|
|
1275
1311
|
return (
|
|
1276
|
-
<Tooltip
|
|
1312
|
+
<Tooltip
|
|
1313
|
+
open={canShowTooltip && tooltipOpen}
|
|
1314
|
+
onOpenChange={canShowTooltip ? setTooltipOpen : undefined}
|
|
1315
|
+
>
|
|
1277
1316
|
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
1278
1317
|
<TooltipContent
|
|
1279
1318
|
hideArrow
|
|
@@ -1283,7 +1322,6 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
1283
1322
|
"bg-foreground text-background border-none",
|
|
1284
1323
|
tooltip.className
|
|
1285
1324
|
)}
|
|
1286
|
-
hidden={state !== "collapsed" || isMobile}
|
|
1287
1325
|
side="right"
|
|
1288
1326
|
sideOffset={8}
|
|
1289
1327
|
/>
|
|
@@ -1317,7 +1355,7 @@ const SidebarMenuAction = React.forwardRef<
|
|
|
1317
1355
|
<Comp
|
|
1318
1356
|
ref={ref}
|
|
1319
1357
|
className={cn(
|
|
1320
|
-
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground duration-base absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform ease-in-out outline-none [&>svg]:shrink-0",
|
|
1358
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground duration-base absolute top-1.5 right-1 flex aspect-square w-5 cursor-pointer items-center justify-center rounded-md p-0 transition-transform ease-in-out outline-none [&>svg]:shrink-0",
|
|
1321
1359
|
SIDEBAR_FOCUS_RING,
|
|
1322
1360
|
// Increases the hit area of the button on mobile.
|
|
1323
1361
|
"after:absolute after:-inset-2 after:md:hidden",
|
|
@@ -1419,7 +1457,14 @@ const sidebarMenuSubVariants = cva(
|
|
|
1419
1457
|
variants: {
|
|
1420
1458
|
variant: {
|
|
1421
1459
|
default: "px-10",
|
|
1422
|
-
|
|
1460
|
+
// Figma SidebarMenuSub / Type=Border (DS-1029): rule 24px in, items
|
|
1461
|
+
// 20px right of it, 8px right inset — labels keep ≥190px at the
|
|
1462
|
+
// 288px sidebar width. The rule is a pseudo-element so it stops at
|
|
1463
|
+
// the list's vertical padding (Figma draws it 4px short at both
|
|
1464
|
+
// ends); the transparent border keeps its 1px in the box so `pl-5`
|
|
1465
|
+
// still lands items 21px from the rule's left edge.
|
|
1466
|
+
border:
|
|
1467
|
+
"relative ml-6 border-l border-transparent pl-5 pr-2 before:absolute before:inset-y-1 before:-left-px before:w-px before:bg-sidebar-border",
|
|
1423
1468
|
indent: "px-10",
|
|
1424
1469
|
},
|
|
1425
1470
|
},
|
|
@@ -1472,11 +1517,22 @@ interface SidebarMenuSubItemProps extends React.ComponentProps<"li"> {
|
|
|
1472
1517
|
const SidebarMenuSubItem = React.forwardRef<
|
|
1473
1518
|
HTMLLIElement,
|
|
1474
1519
|
SidebarMenuSubItemProps
|
|
1475
|
-
>(({ dataHook, ...props }, ref) => (
|
|
1520
|
+
>(({ className, dataHook, onClick, ...props }, ref) => (
|
|
1521
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions -- pointer-only hit-area extension; the button stays the keyboard target
|
|
1476
1522
|
<li
|
|
1477
1523
|
ref={ref}
|
|
1524
|
+
className={cn(
|
|
1525
|
+
SIDEBAR_ITEM_GAP_STRIP,
|
|
1526
|
+
// The last item also covers the list's bottom py-1, down to the next row.
|
|
1527
|
+
"last:after:absolute last:after:inset-x-0 last:after:-bottom-1 last:after:h-1 last:after:cursor-pointer last:after:content-['']",
|
|
1528
|
+
className
|
|
1529
|
+
)}
|
|
1478
1530
|
data-hook={dataHook}
|
|
1479
1531
|
data-slot="sidebar-menu-sub-item"
|
|
1532
|
+
onClick={(event) => {
|
|
1533
|
+
onClick?.(event);
|
|
1534
|
+
clickItemFromGapStrip(event);
|
|
1535
|
+
}}
|
|
1480
1536
|
{...props}
|
|
1481
1537
|
/>
|
|
1482
1538
|
));
|
|
@@ -1524,9 +1580,10 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1524
1580
|
<Comp
|
|
1525
1581
|
ref={ref}
|
|
1526
1582
|
className={cn(
|
|
1527
|
-
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground text-label duration-fast flex h-
|
|
1583
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground text-label duration-fast flex h-8 min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-md px-3 transition-[color,background-color,box-shadow,opacity] ease-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:not([data-slot])]:truncate [&>svg]:shrink-0",
|
|
1528
1584
|
SIDEBAR_FOCUS_RING,
|
|
1529
1585
|
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
1586
|
+
"in-[[data-slot=sidebar-menu-sub-item]:hover:not(:has(:hover))]:bg-sidebar-accent in-[[data-slot=sidebar-menu-sub-item]:hover:not(:has(:hover))]:text-sidebar-accent-foreground",
|
|
1530
1587
|
size === SidebarMenuSubButtonSize.SM && "text-label-sm",
|
|
1531
1588
|
"group-data-[collapsible=icon]:hidden",
|
|
1532
1589
|
className
|
|
@@ -1638,6 +1695,23 @@ SidebarMenuCollapsibleTrigger.displayName = "SidebarMenuCollapsibleTrigger";
|
|
|
1638
1695
|
*/
|
|
1639
1696
|
type SidebarMenuCollapsibleContentProps = SidebarMenuSubProps;
|
|
1640
1697
|
|
|
1698
|
+
/**
|
|
1699
|
+
* Expandable body of a `SidebarMenuCollapsible`. It **is** the sub-menu list:
|
|
1700
|
+
* it renders a `SidebarMenuSub` (so it takes `variant` and the other
|
|
1701
|
+
* `SidebarMenuSub` props), so place `SidebarMenuSubItem`s directly inside it.
|
|
1702
|
+
* Do not nest another `SidebarMenuSub` in here — the two indents stack and
|
|
1703
|
+
* leave ~100px for labels at the default sidebar width (DS-1029).
|
|
1704
|
+
*
|
|
1705
|
+
* @example
|
|
1706
|
+
* <SidebarMenuCollapsible>
|
|
1707
|
+
* <SidebarMenuCollapsibleTrigger>Reviews</SidebarMenuCollapsibleTrigger>
|
|
1708
|
+
* <SidebarMenuCollapsibleContent>
|
|
1709
|
+
* <SidebarMenuSubItem>
|
|
1710
|
+
* <SidebarMenuSubButton>Review Tracker</SidebarMenuSubButton>
|
|
1711
|
+
* </SidebarMenuSubItem>
|
|
1712
|
+
* </SidebarMenuCollapsibleContent>
|
|
1713
|
+
* </SidebarMenuCollapsible>
|
|
1714
|
+
*/
|
|
1641
1715
|
const SidebarMenuCollapsibleContent = React.forwardRef<
|
|
1642
1716
|
HTMLUListElement,
|
|
1643
1717
|
SidebarMenuCollapsibleContentProps
|
|
@@ -2096,6 +2170,7 @@ interface SidebarAccountDropdownProps {
|
|
|
2096
2170
|
avatar?: React.ReactNode;
|
|
2097
2171
|
/**
|
|
2098
2172
|
* Menu items to render. Each group is separated by a divider.
|
|
2173
|
+
* Ignored when `children` is provided.
|
|
2099
2174
|
*/
|
|
2100
2175
|
menuGroups?: Array<
|
|
2101
2176
|
Array<{
|
|
@@ -2119,6 +2194,13 @@ interface SidebarAccountDropdownProps {
|
|
|
2119
2194
|
* @default "top"
|
|
2120
2195
|
*/
|
|
2121
2196
|
side?: "top" | "right" | "bottom" | "left";
|
|
2197
|
+
/**
|
|
2198
|
+
* Custom menu content rendered after the name/email header.
|
|
2199
|
+
* Use DropdownMenuItem, DropdownMenuSeparator etc. for full
|
|
2200
|
+
* control over items (links via `asChild`, `disabled`, `dataHook`).
|
|
2201
|
+
* The name/email header is always rendered; `children` replaces only
|
|
2202
|
+
* the items area that `menuGroups` would populate.
|
|
2203
|
+
*/
|
|
2122
2204
|
children?: React.ReactNode;
|
|
2123
2205
|
}
|
|
2124
2206
|
|
|
@@ -2158,28 +2240,25 @@ function SidebarAccountDropdown({
|
|
|
2158
2240
|
side={side}
|
|
2159
2241
|
sideOffset={4}
|
|
2160
2242
|
>
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
{
|
|
2171
|
-
<
|
|
2172
|
-
|
|
2173
|
-
{
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
))}
|
|
2181
|
-
</>
|
|
2182
|
-
)}
|
|
2243
|
+
<DropdownMenuLabel className="flex items-center gap-2 px-1 py-1.5">
|
|
2244
|
+
{avatar}
|
|
2245
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
2246
|
+
<span className="text-heading-compact truncate">{name}</span>
|
|
2247
|
+
<span className="text-body-xs truncate">{email}</span>
|
|
2248
|
+
</div>
|
|
2249
|
+
</DropdownMenuLabel>
|
|
2250
|
+
{children ??
|
|
2251
|
+
menuGroups?.map((group, groupIndex) => (
|
|
2252
|
+
<React.Fragment key={groupIndex}>
|
|
2253
|
+
<DropdownMenuSeparator />
|
|
2254
|
+
{group.map((item, itemIndex) => (
|
|
2255
|
+
<DropdownMenuItem key={itemIndex} onClick={item.onClick}>
|
|
2256
|
+
{item.icon}
|
|
2257
|
+
{item.label}
|
|
2258
|
+
</DropdownMenuItem>
|
|
2259
|
+
))}
|
|
2260
|
+
</React.Fragment>
|
|
2261
|
+
))}
|
|
2183
2262
|
</DropdownMenuContent>
|
|
2184
2263
|
</DropdownMenu>
|
|
2185
2264
|
);
|
|
@@ -209,7 +209,7 @@ const AccordionTrigger = React.forwardRef<
|
|
|
209
209
|
<AccordionPrimitive.Trigger
|
|
210
210
|
ref={ref}
|
|
211
211
|
className={cn(
|
|
212
|
-
"focus-visible:border-ring focus-visible:shadow-default duration-fast text-label flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left transition-shadow ease-out outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
212
|
+
"focus-visible:border-ring focus-visible:shadow-default duration-fast text-label flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left transition-shadow ease-out outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
213
213
|
className
|
|
214
214
|
)}
|
|
215
215
|
data-hook={dataHook}
|
|
@@ -6,6 +6,7 @@ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
import { useOverlayPointerLock } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
|
|
8
8
|
import { ButtonVariants } from "@brightlocal/ui-components/button";
|
|
9
|
+
import type { ButtonVariant } from "@brightlocal/ui-components/button";
|
|
9
10
|
|
|
10
11
|
interface AlertDialogProps extends React.ComponentProps<
|
|
11
12
|
typeof AlertDialogPrimitive.Root
|
|
@@ -193,27 +194,70 @@ const AlertDialogDescription = React.forwardRef<
|
|
|
193
194
|
|
|
194
195
|
AlertDialogDescription.displayName = "AlertDialogDescription";
|
|
195
196
|
|
|
197
|
+
/** Visual style variants for the AlertDialogAction confirm button. */
|
|
198
|
+
type AlertDialogActionVariant = Extract<
|
|
199
|
+
ButtonVariant,
|
|
200
|
+
"primary" | "secondary" | "destructive"
|
|
201
|
+
>;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Props for the AlertDialogAction component
|
|
205
|
+
*/
|
|
206
|
+
interface AlertDialogActionProps extends React.ComponentProps<
|
|
207
|
+
typeof AlertDialogPrimitive.Action
|
|
208
|
+
> {
|
|
209
|
+
/**
|
|
210
|
+
* Visual style of the confirm button. Use `"destructive"` when confirming
|
|
211
|
+
* an irreversible action such as a delete. Use `"secondary"` when confirming
|
|
212
|
+
* a risky action that leaves saved data untouched, such as discarding
|
|
213
|
+
* unsaved changes.
|
|
214
|
+
* @default "primary"
|
|
215
|
+
*/
|
|
216
|
+
variant?: AlertDialogActionVariant;
|
|
217
|
+
/**
|
|
218
|
+
* Data hook for automated testing
|
|
219
|
+
* @example "delete-location-confirm"
|
|
220
|
+
*/
|
|
221
|
+
dataHook?: string;
|
|
222
|
+
}
|
|
223
|
+
|
|
196
224
|
const AlertDialogAction = React.forwardRef<
|
|
197
225
|
React.ComponentRef<typeof AlertDialogPrimitive.Action>,
|
|
198
|
-
|
|
199
|
-
>(({ className, ...props }, ref) => (
|
|
226
|
+
AlertDialogActionProps
|
|
227
|
+
>(({ className, variant = "primary", dataHook, ...props }, ref) => (
|
|
200
228
|
<AlertDialogPrimitive.Action
|
|
201
229
|
ref={ref}
|
|
202
|
-
className={cn(ButtonVariants(), className)}
|
|
230
|
+
className={cn(ButtonVariants({ variant }), className)}
|
|
231
|
+
data-hook={dataHook}
|
|
203
232
|
data-slot="alert-dialog-action"
|
|
233
|
+
data-variant={variant}
|
|
204
234
|
{...props}
|
|
205
235
|
/>
|
|
206
236
|
));
|
|
207
237
|
|
|
208
238
|
AlertDialogAction.displayName = "AlertDialogAction";
|
|
209
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Props for the AlertDialogCancel component
|
|
242
|
+
*/
|
|
243
|
+
interface AlertDialogCancelProps extends React.ComponentProps<
|
|
244
|
+
typeof AlertDialogPrimitive.Cancel
|
|
245
|
+
> {
|
|
246
|
+
/**
|
|
247
|
+
* Data hook for automated testing
|
|
248
|
+
* @example "delete-location-cancel"
|
|
249
|
+
*/
|
|
250
|
+
dataHook?: string;
|
|
251
|
+
}
|
|
252
|
+
|
|
210
253
|
const AlertDialogCancel = React.forwardRef<
|
|
211
254
|
React.ComponentRef<typeof AlertDialogPrimitive.Cancel>,
|
|
212
|
-
|
|
213
|
-
>(({ className, ...props }, ref) => (
|
|
255
|
+
AlertDialogCancelProps
|
|
256
|
+
>(({ className, dataHook, ...props }, ref) => (
|
|
214
257
|
<AlertDialogPrimitive.Cancel
|
|
215
258
|
ref={ref}
|
|
216
259
|
className={cn(ButtonVariants({ variant: "outline" }), className)}
|
|
260
|
+
data-hook={dataHook}
|
|
217
261
|
data-slot="alert-dialog-cancel"
|
|
218
262
|
{...props}
|
|
219
263
|
/>
|
|
@@ -236,6 +280,9 @@ export {
|
|
|
236
280
|
};
|
|
237
281
|
|
|
238
282
|
export type {
|
|
283
|
+
AlertDialogActionProps,
|
|
284
|
+
AlertDialogActionVariant,
|
|
285
|
+
AlertDialogCancelProps,
|
|
239
286
|
AlertDialogDescriptionProps,
|
|
240
287
|
AlertDialogProps,
|
|
241
288
|
AlertDialogTitleProps,
|
package/src/components/alert.tsx
CHANGED
|
@@ -126,6 +126,14 @@ type AlertContentProps = AlertContentBaseProps &
|
|
|
126
126
|
}
|
|
127
127
|
);
|
|
128
128
|
|
|
129
|
+
// DS-1031: below `md` the action drops under the text, left-aligned with
|
|
130
|
+
// it (pl-7 = 16px icon + 12px gap), so the copy keeps the full width on
|
|
131
|
+
// phones. From `md` up the action sits beside the text, vertically centered.
|
|
132
|
+
const ALERT_CONTENT_LAYOUT =
|
|
133
|
+
"max-md:flex-col max-md:items-stretch items-center";
|
|
134
|
+
const ALERT_ACTION_LAYOUT =
|
|
135
|
+
"shrink-0 self-center max-md:self-start max-md:pl-7";
|
|
136
|
+
|
|
129
137
|
function AlertSuccess({
|
|
130
138
|
title,
|
|
131
139
|
description,
|
|
@@ -137,7 +145,7 @@ function AlertSuccess({
|
|
|
137
145
|
}: AlertContentProps) {
|
|
138
146
|
return (
|
|
139
147
|
<Alert
|
|
140
|
-
className={cn(
|
|
148
|
+
className={cn(ALERT_CONTENT_LAYOUT, className)}
|
|
141
149
|
data-hook={dataHook}
|
|
142
150
|
data-tracking-el={trackingEl}
|
|
143
151
|
data-tracking-label={trackingLabel}
|
|
@@ -152,7 +160,7 @@ function AlertSuccess({
|
|
|
152
160
|
)}
|
|
153
161
|
</div>
|
|
154
162
|
</div>
|
|
155
|
-
{action && <div className=
|
|
163
|
+
{action && <div className={ALERT_ACTION_LAYOUT}>{action}</div>}
|
|
156
164
|
</Alert>
|
|
157
165
|
);
|
|
158
166
|
}
|
|
@@ -168,7 +176,7 @@ function AlertInfo({
|
|
|
168
176
|
}: AlertContentProps) {
|
|
169
177
|
return (
|
|
170
178
|
<Alert
|
|
171
|
-
className={cn(
|
|
179
|
+
className={cn(ALERT_CONTENT_LAYOUT, className)}
|
|
172
180
|
data-hook={dataHook}
|
|
173
181
|
data-tracking-el={trackingEl}
|
|
174
182
|
data-tracking-label={trackingLabel}
|
|
@@ -183,7 +191,7 @@ function AlertInfo({
|
|
|
183
191
|
)}
|
|
184
192
|
</div>
|
|
185
193
|
</div>
|
|
186
|
-
{action && <div className=
|
|
194
|
+
{action && <div className={ALERT_ACTION_LAYOUT}>{action}</div>}
|
|
187
195
|
</Alert>
|
|
188
196
|
);
|
|
189
197
|
}
|
|
@@ -199,7 +207,7 @@ function AlertDestructive({
|
|
|
199
207
|
}: AlertContentProps) {
|
|
200
208
|
return (
|
|
201
209
|
<Alert
|
|
202
|
-
className={cn(
|
|
210
|
+
className={cn(ALERT_CONTENT_LAYOUT, className)}
|
|
203
211
|
data-hook={dataHook}
|
|
204
212
|
data-tracking-el={trackingEl}
|
|
205
213
|
data-tracking-label={trackingLabel}
|
|
@@ -214,7 +222,7 @@ function AlertDestructive({
|
|
|
214
222
|
)}
|
|
215
223
|
</div>
|
|
216
224
|
</div>
|
|
217
|
-
{action && <div className=
|
|
225
|
+
{action && <div className={ALERT_ACTION_LAYOUT}>{action}</div>}
|
|
218
226
|
</Alert>
|
|
219
227
|
);
|
|
220
228
|
}
|
|
@@ -230,7 +238,7 @@ function AlertWarning({
|
|
|
230
238
|
}: AlertContentProps) {
|
|
231
239
|
return (
|
|
232
240
|
<Alert
|
|
233
|
-
className={cn(
|
|
241
|
+
className={cn(ALERT_CONTENT_LAYOUT, className)}
|
|
234
242
|
data-hook={dataHook}
|
|
235
243
|
data-tracking-el={trackingEl}
|
|
236
244
|
data-tracking-label={trackingLabel}
|
|
@@ -245,7 +253,7 @@ function AlertWarning({
|
|
|
245
253
|
)}
|
|
246
254
|
</div>
|
|
247
255
|
</div>
|
|
248
|
-
{action && <div className=
|
|
256
|
+
{action && <div className={ALERT_ACTION_LAYOUT}>{action}</div>}
|
|
249
257
|
</Alert>
|
|
250
258
|
);
|
|
251
259
|
}
|