@brightlocal/ui-components 3.2.0 → 3.4.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 +3 -1
- package/component-meta.json +1458 -380
- package/deprecations.json +44 -0
- 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 +6 -4
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +85 -133
- 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 +106 -168
- 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 +23 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +90 -91
- package/dist/banner.cjs +1 -1
- package/dist/banner.js +102 -148
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +20 -3
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +73 -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 +138 -178
- package/dist/blocks/progress-state.cjs +1 -1
- package/dist/blocks/progress-state.js +223 -347
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +11 -6
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +763 -1092
- package/dist/brand-illustration-motif.cjs +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 +10 -4
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +233 -316
- 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 +23 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +445 -651
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +36 -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 +439 -638
- 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 +280 -129
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +687 -948
- 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-list.cjs +1 -0
- package/dist/description-list.d.ts +142 -0
- package/dist/description-list.d.ts.map +1 -0
- package/dist/description-list.js +173 -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.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.js +9 -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 +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +658 -614
- package/dist/info-tooltip.cjs +1 -1
- package/dist/info-tooltip.js +22 -36
- 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 +181 -230
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +174 -221
- 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 +12 -16
- 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 +1 -1
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +16 -18
- 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 +14 -8
- 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.js +26 -33
- 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 +224 -39
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +323 -171
- 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 -1
- package/dist/multi-select-filter.d.ts +9 -1
- package/dist/multi-select-filter.d.ts.map +1 -1
- package/dist/multi-select-filter.js +357 -446
- 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 +17 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +116 -162
- 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 -1
- package/dist/relative-date.d.ts.map +1 -1
- package/dist/relative-date.js +73 -89
- 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 +59 -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 +10 -10
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +118 -238
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +90 -78
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +8 -5
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +250 -317
- package/dist/single-select-filter.cjs +1 -1
- package/dist/single-select-filter.d.ts +32 -0
- package/dist/single-select-filter.d.ts.map +1 -1
- package/dist/single-select-filter.js +201 -203
- 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 +101 -125
- package/dist/spinner.cjs +1 -1
- package/dist/spinner.js +22 -31
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.js +52 -101
- 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 +103 -30
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +170 -209
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +102 -147
- 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 +22 -35
- 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 +2 -2
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +157 -249
- 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.js +27 -57
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +132 -340
- package/package.json +47 -47
- package/src/blocks/empty-state.tsx +34 -18
- package/src/blocks/input-list.tsx +14 -9
- package/src/blocks/sidebar.tsx +86 -31
- package/src/components/accordion.tsx +1 -1
- package/src/components/alert-dialog.tsx +4 -2
- package/src/components/badge.tsx +127 -15
- 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 +63 -10
- package/src/components/carousel.tsx +4 -1
- package/src/components/chart.tsx +151 -17
- package/src/components/checkbox.tsx +1 -1
- package/src/components/collapsible.tsx +4 -1
- package/src/components/combobox.tsx +40 -7
- package/src/components/command.tsx +9 -10
- package/src/components/context-menu.tsx +4 -4
- package/src/components/data-table.tsx +619 -237
- package/src/components/date-picker.tsx +31 -4
- package/src/components/delta.tsx +217 -0
- package/src/components/description-list.tsx +445 -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/input-chip.tsx +51 -7
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-password.tsx +15 -19
- package/src/components/input.tsx +10 -1
- package/src/components/list.tsx +695 -72
- 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 +255 -121
- package/src/components/navigation-menu.tsx +2 -2
- package/src/components/pagination.tsx +86 -26
- package/src/components/progress.tsx +91 -23
- package/src/components/rating.tsx +200 -74
- package/src/components/relative-date.tsx +19 -11
- 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 +2 -2
- package/src/components/sheet.tsx +14 -4
- package/src/components/single-select-filter.tsx +136 -41
- package/src/components/slider.tsx +2 -2
- package/src/components/status.tsx +162 -0
- package/src/components/switch.tsx +1 -1
- package/src/components/table.tsx +278 -106
- package/src/components/tabs.tsx +1 -0
- package/src/components/textarea.tsx +20 -2
- package/src/components/toggle.tsx +2 -2
- package/src/components/tooltip.tsx +11 -20
- package/src/hooks/use-filter-search-params.ts +302 -0
- package/src/index.ts +7 -0
- 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/empty-chip.ts +0 -24
|
@@ -1,463 +1,374 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
so the same trigger sits in a phone card header without the desktop
|
|
44
|
-
height or the touch bump crowding the row. Icons stay 16px unless
|
|
45
|
-
the consumer's glyph sizes itself. */
|
|
46
|
-
sm: "h-8 px-2.5 text-label [&_svg:not([class*='size-'])]:size-4"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
defaultVariants: {
|
|
50
|
-
size: "default"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
function qe({
|
|
55
|
-
value: d,
|
|
56
|
-
defaultValue: r,
|
|
57
|
-
onValueChange: h,
|
|
58
|
-
open: c,
|
|
59
|
-
onOpenChange: j,
|
|
60
|
-
options: g,
|
|
61
|
-
collapseFullSelection: A
|
|
62
|
-
}) {
|
|
63
|
-
const [R, T] = i.useState(r), S = d !== void 0, u = S ? d : R, N = i.useMemo(() => new Set(u), [u]), [o, m] = i.useState(!1), $ = c !== void 0, f = $ ? c : o, [k, V] = i.useState(/* @__PURE__ */ new Set()), y = i.useRef(f);
|
|
64
|
-
i.useEffect(() => {
|
|
65
|
-
f && !y.current && V(new Set(u)), y.current = f;
|
|
66
|
-
}, [f, u]);
|
|
67
|
-
const p = (s) => {
|
|
68
|
-
S || T(s), h?.(s);
|
|
69
|
-
}, L = (s) => {
|
|
70
|
-
if (N.has(s)) {
|
|
71
|
-
p(u.filter((v) => v !== s));
|
|
1
|
+
"use client";
|
|
2
|
+
import { EmptyChip as Me } from "./lib/empty-chip.js";
|
|
3
|
+
import * as u from "react";
|
|
4
|
+
import { Check as Ae, ChevronDown as Te, SearchX as me } from "@brightlocal/icons";
|
|
5
|
+
import { cn as re } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { Fragment as Be, jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
import { cva as Le } from "class-variance-authority";
|
|
8
|
+
import { Button as pe } from "@brightlocal/ui-components/button";
|
|
9
|
+
import { Popover as Ve, PopoverContent as Ee, PopoverTrigger as Pe } from "@brightlocal/ui-components/popover";
|
|
10
|
+
import { Command as Ge, CommandEmpty as Ue, CommandGroup as Z, CommandInput as Qe, CommandItem as H, CommandList as We } from "@brightlocal/ui-components/command";
|
|
11
|
+
import { useIsBelowBreakpoint as qe } from "@brightlocal/ui-components/hooks/use-breakpoint";
|
|
12
|
+
import { Label as fe } from "@brightlocal/ui-components/label";
|
|
13
|
+
import { Checkbox as ge, checkboxVariants as Xe } from "@brightlocal/ui-components/checkbox";
|
|
14
|
+
import { Drawer as Je, DrawerBody as ve, DrawerClose as Ke, DrawerContent as Ye, DrawerDescription as Ze, DrawerFooter as He, DrawerHeader as er, DrawerTitle as rr, DrawerTrigger as nr } from "@brightlocal/ui-components/drawer";
|
|
15
|
+
import { InputGroup as tr, InputGroupClear as lr, InputGroupInput as ar } from "@brightlocal/ui-components/input-group";
|
|
16
|
+
var or = Le([
|
|
17
|
+
"relative inline-flex cursor-pointer items-center justify-between gap-2 py-2",
|
|
18
|
+
"border border-input rounded-sm outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
|
|
19
|
+
"bg-background dark:bg-input/30",
|
|
20
|
+
"text-foreground",
|
|
21
|
+
"focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background",
|
|
22
|
+
"focus-visible:shadow-default",
|
|
23
|
+
"data-[state=open]:border-ring",
|
|
24
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
25
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
26
|
+
], {
|
|
27
|
+
variants: { size: {
|
|
28
|
+
default: "h-9 px-3 text-field",
|
|
29
|
+
sm: "h-8 px-2.5 text-label [&_svg:not([class*='size-'])]:size-4"
|
|
30
|
+
} },
|
|
31
|
+
defaultVariants: { size: "default" }
|
|
32
|
+
});
|
|
33
|
+
function sr({ value: c, defaultValue: n, onValueChange: d, open: t, onOpenChange: y, options: C, collapseFullSelection: E }) {
|
|
34
|
+
const [P, G] = u.useState(n), O = c !== void 0, p = O ? c : P, D = u.useMemo(() => new Set(p), [p]), [m, f] = u.useState(!1), F = t !== void 0, g = F ? t : m, [N, U] = u.useState(/* @__PURE__ */ new Set()), I = u.useRef(g);
|
|
35
|
+
u.useEffect(() => {
|
|
36
|
+
g && !I.current && U(new Set(p)), I.current = g;
|
|
37
|
+
}, [g, p]);
|
|
38
|
+
const v = (s) => {
|
|
39
|
+
O || G(s), d?.(s);
|
|
40
|
+
}, Q = (s) => {
|
|
41
|
+
if (D.has(s)) {
|
|
42
|
+
v(p.filter((b) => b !== s));
|
|
72
43
|
return;
|
|
73
44
|
}
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (v.length > 0 && v.every((b) => B.has(b.value))) {
|
|
80
|
-
p([]);
|
|
45
|
+
const S = [...p, s];
|
|
46
|
+
if (E) {
|
|
47
|
+
const b = C.filter((w) => !w.disabled && w.count !== 0), j = new Set(S);
|
|
48
|
+
if (b.length > 0 && b.every((w) => j.has(w.value))) {
|
|
49
|
+
v([]);
|
|
81
50
|
return;
|
|
82
51
|
}
|
|
83
52
|
}
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
$ || m(s), j?.(s);
|
|
87
|
-
}, O = i.useMemo(
|
|
88
|
-
() => [
|
|
89
|
-
...g.filter((s) => k.has(s.value)),
|
|
90
|
-
...g.filter((s) => !k.has(s.value))
|
|
91
|
-
],
|
|
92
|
-
[g, k]
|
|
93
|
-
);
|
|
53
|
+
v(S);
|
|
54
|
+
};
|
|
94
55
|
return {
|
|
95
|
-
clear: () =>
|
|
96
|
-
onOpenChange:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
56
|
+
clear: () => v([]),
|
|
57
|
+
onOpenChange: (s) => {
|
|
58
|
+
F || f(s), y?.(s);
|
|
59
|
+
},
|
|
60
|
+
open: g,
|
|
61
|
+
orderedOptions: u.useMemo(() => [...C.filter((s) => N.has(s.value)), ...C.filter((s) => !N.has(s.value))], [C, N]),
|
|
62
|
+
selectedSet: D,
|
|
63
|
+
toggleOption: Q,
|
|
64
|
+
value: p
|
|
102
65
|
};
|
|
103
66
|
}
|
|
104
|
-
function
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"mt-0 flex items-center justify-center self-center"
|
|
112
|
-
),
|
|
113
|
-
"data-state": d ? "checked" : "unchecked",
|
|
114
|
-
children: d ? /* @__PURE__ */ t($e, {}) : null
|
|
115
|
-
}
|
|
116
|
-
);
|
|
67
|
+
function be({ checked: c }) {
|
|
68
|
+
return /* @__PURE__ */ e("span", {
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
className: re(Xe(), "mt-0 flex items-center justify-center self-center"),
|
|
71
|
+
"data-state": c ? "checked" : "unchecked",
|
|
72
|
+
children: c ? /* @__PURE__ */ e(Ae, {}) : null
|
|
73
|
+
});
|
|
117
74
|
}
|
|
118
|
-
function
|
|
119
|
-
return /* @__PURE__ */
|
|
75
|
+
function ee({ count: c }) {
|
|
76
|
+
return /* @__PURE__ */ e("span", {
|
|
77
|
+
className: "text-muted-foreground text-label-sm ml-auto tabular-nums",
|
|
78
|
+
children: c
|
|
79
|
+
});
|
|
120
80
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
options:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
"
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
81
|
+
function ir(c, n) {
|
|
82
|
+
const d = [void 0];
|
|
83
|
+
for (const t of c) d.includes(t.group) || d.push(t.group);
|
|
84
|
+
return d.map((t) => ({
|
|
85
|
+
group: t,
|
|
86
|
+
options: n.filter((y) => y.group === t)
|
|
87
|
+
})).filter((t) => t.options.length > 0);
|
|
88
|
+
}
|
|
89
|
+
function xe(c, n) {
|
|
90
|
+
return `${c}-group-${n.trim().toLowerCase().replace(/\s+/g, "-")}`;
|
|
91
|
+
}
|
|
92
|
+
var cr = "__all__", dr = "__clear__", ur = u.forwardRef(({ className: c, dataHook: n, label: d, options: t, value: y, defaultValue: C = [], onValueChange: E, open: P, onOpenChange: G, size: O = "default", icon: p, maxVisibleLabels: D = 1, allLabel: m, allIcon: f, allCount: F, searchThreshold: g = 10, searchable: N, collapseFullSelection: U = !0, disabled: I = !1, clearLabel: v, summaryLabel: Q, searchPlaceholder: R, emptyLabel: s, emptyDescription: S, clearSearchAriaLabel: b, presentation: j = "menu", doneLabel: w, drawerDescription: Ce, trackingEl: we, trackingLabel: ke, "aria-label": $e, "aria-describedby": ye, ...Ne }, Se) => {
|
|
93
|
+
const o = sr({
|
|
94
|
+
collapseFullSelection: U,
|
|
95
|
+
defaultValue: C,
|
|
96
|
+
onOpenChange: G,
|
|
97
|
+
onValueChange: E,
|
|
98
|
+
open: P,
|
|
99
|
+
options: t,
|
|
100
|
+
value: y
|
|
101
|
+
}), _e = qe("md"), Oe = j === "drawer" || j === "auto" && _e, z = u.useId(), [ne, W] = u.useState(""), q = ne.trim().toLowerCase(), te = u.useRef(null), M = N ?? t.length > g, k = M && q.length > 0, X = k ? o.orderedOptions.filter((r) => r.label.toLowerCase().includes(q) || r.value.toLowerCase().includes(q)) : o.orderedOptions, A = ir(t, X), De = new Map(t.map((r) => [r.value, r.label])), T = o.value.flatMap((r) => {
|
|
102
|
+
const l = De.get(r);
|
|
103
|
+
return l === void 0 ? [] : [l];
|
|
104
|
+
}), x = T.length, J = o.value.length === 0, B = F ?? (t.length > 0 && t.every((r) => r.count !== void 0) ? t.reduce((r, l) => r + (l.count ?? 0), 0) : void 0), L = Math.max(1, D);
|
|
105
|
+
let _, le = !1;
|
|
106
|
+
if (x === 0)
|
|
107
|
+
_ = m ?? d, le = m === void 0;
|
|
108
|
+
else if (x <= L) _ = T.join(", ");
|
|
109
|
+
else {
|
|
110
|
+
const r = {
|
|
111
|
+
"{count}": String(x),
|
|
112
|
+
"{labels}": T.slice(0, L).join(", "),
|
|
113
|
+
"{rest}": String(x - L)
|
|
114
|
+
};
|
|
115
|
+
_ = (Q ?? "{labels} +{rest}").replace(/\{(count|labels|rest)\}/g, (l) => r[l] ?? l);
|
|
116
|
+
}
|
|
117
|
+
const Fe = x > 0 ? `${d}: ${_}` : m !== void 0 ? `${d}: ${m}` : d, K = x > L ? T.join(", ") : void 0, ae = `${z}-picks`, Ie = [ye, K ? ae : void 0].filter(Boolean).join(" ") || void 0, Re = o.value.map((r) => t.find((l) => l.value === r)).find((r) => r !== void 0), oe = p ?? (x > 0 ? Re?.icon : f) ?? void 0, se = (r) => {
|
|
118
|
+
r && W(""), o.onOpenChange(r);
|
|
119
|
+
}, ie = /* @__PURE__ */ a("button", {
|
|
120
|
+
ref: Se,
|
|
121
|
+
"aria-describedby": Ie,
|
|
122
|
+
"aria-label": $e ?? Fe,
|
|
123
|
+
className: re(or({ size: O }), c),
|
|
124
|
+
"data-hook": n,
|
|
125
|
+
"data-slot": "multi-select-filter",
|
|
126
|
+
"data-tracking-el": we ?? "multi-select-filter",
|
|
127
|
+
"data-tracking-label": ke,
|
|
128
|
+
disabled: I,
|
|
129
|
+
type: "button",
|
|
130
|
+
...Ne,
|
|
131
|
+
children: [
|
|
132
|
+
oe ? /* @__PURE__ */ e("span", {
|
|
133
|
+
"aria-hidden": "true",
|
|
134
|
+
className: "flex shrink-0 items-center",
|
|
135
|
+
"data-hook": `${n}-icon`,
|
|
136
|
+
children: oe
|
|
137
|
+
}) : null,
|
|
138
|
+
/* @__PURE__ */ e("span", {
|
|
139
|
+
className: re(le && "text-muted-foreground"),
|
|
140
|
+
"data-hook": `${n}-summary`,
|
|
141
|
+
children: _
|
|
142
|
+
}),
|
|
143
|
+
K ? /* @__PURE__ */ e("span", {
|
|
144
|
+
hidden: !0,
|
|
145
|
+
id: ae,
|
|
146
|
+
children: K
|
|
147
|
+
}) : null,
|
|
148
|
+
/* @__PURE__ */ e(Te, {
|
|
149
|
+
"aria-hidden": "true",
|
|
150
|
+
className: "text-muted-foreground"
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
});
|
|
154
|
+
if (Oe) {
|
|
155
|
+
const r = `${z}-all`;
|
|
156
|
+
return /* @__PURE__ */ a(Je, {
|
|
157
|
+
open: o.open,
|
|
158
|
+
onOpenChange: se,
|
|
159
|
+
children: [/* @__PURE__ */ e(nr, {
|
|
160
|
+
asChild: !0,
|
|
161
|
+
children: ie
|
|
162
|
+
}), /* @__PURE__ */ a(Ye, {
|
|
163
|
+
dataHook: `${n}-drawer`,
|
|
203
164
|
children: [
|
|
204
|
-
|
|
205
|
-
"
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
165
|
+
/* @__PURE__ */ a(er, { children: [/* @__PURE__ */ e(rr, { children: d }), /* @__PURE__ */ e(Ze, {
|
|
166
|
+
className: "sr-only",
|
|
167
|
+
children: Ce ?? "Picks apply as you make them."
|
|
168
|
+
})] }),
|
|
169
|
+
M ? /* @__PURE__ */ e(ve, {
|
|
170
|
+
className: "shrink-0 pb-4",
|
|
171
|
+
children: /* @__PURE__ */ a(tr, {
|
|
172
|
+
dataHook: `${n}-search`,
|
|
173
|
+
children: [/* @__PURE__ */ e(ar, {
|
|
174
|
+
"aria-label": R ?? "Search options...",
|
|
175
|
+
placeholder: R ?? "Search options...",
|
|
176
|
+
value: ne,
|
|
177
|
+
onChange: (l) => W(l.target.value)
|
|
178
|
+
}), /* @__PURE__ */ e(lr, {
|
|
179
|
+
clearSearchAriaLabel: b,
|
|
180
|
+
dataHook: `${n}-search-clear`
|
|
181
|
+
})]
|
|
182
|
+
})
|
|
183
|
+
}) : null,
|
|
184
|
+
/* @__PURE__ */ a(ve, {
|
|
185
|
+
className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pt-1 pb-2",
|
|
186
|
+
children: [k && X.length === 0 ? /* @__PURE__ */ a("div", {
|
|
187
|
+
className: "text-body-sm flex flex-col items-center gap-1 py-6 text-center",
|
|
188
|
+
"data-hook": `${n}-empty`,
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ e(Me, {
|
|
191
|
+
className: "mb-1",
|
|
192
|
+
dataHook: `${n}-empty-icon`,
|
|
193
|
+
icon: /* @__PURE__ */ e(me, {}),
|
|
194
|
+
slot: "multi-select-filter-empty-icon"
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ e("p", { children: s ?? "No options found." }),
|
|
197
|
+
/* @__PURE__ */ e("p", {
|
|
198
|
+
className: "text-muted-foreground",
|
|
199
|
+
children: S ?? "Try another search."
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
}) : /* @__PURE__ */ a(Be, { children: [m !== void 0 && !k ? /* @__PURE__ */ a("div", {
|
|
203
|
+
className: "flex items-center gap-2",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ e(ge, {
|
|
206
|
+
checked: J,
|
|
207
|
+
dataHook: `${n}-option-all`,
|
|
208
|
+
id: r,
|
|
209
|
+
onCheckedChange: o.clear
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ a(fe, {
|
|
212
|
+
className: "flex-1 gap-2",
|
|
213
|
+
htmlFor: r,
|
|
214
|
+
children: [f ? /* @__PURE__ */ e("span", {
|
|
215
|
+
"aria-hidden": "true",
|
|
216
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
217
|
+
children: f
|
|
218
|
+
}) : null, m]
|
|
219
|
+
}),
|
|
220
|
+
B !== void 0 ? /* @__PURE__ */ e(ee, { count: B }) : null
|
|
221
|
+
]
|
|
222
|
+
}) : null, A.map((l, i) => {
|
|
223
|
+
const $ = /* @__PURE__ */ e("div", {
|
|
224
|
+
className: "grid grid-cols-2 gap-x-4 gap-y-3",
|
|
225
|
+
children: l.options.map((h) => {
|
|
226
|
+
const je = X.indexOf(h), ue = o.selectedSet.has(h.value), ze = h.disabled || h.count === 0 && !ue, he = `${z}-${je}`;
|
|
227
|
+
return /* @__PURE__ */ a("div", {
|
|
228
|
+
className: "flex items-center gap-2",
|
|
229
|
+
children: [/* @__PURE__ */ e(ge, {
|
|
230
|
+
checked: ue,
|
|
231
|
+
dataHook: `${n}-option-${h.value}`,
|
|
232
|
+
disabled: ze,
|
|
233
|
+
id: he,
|
|
234
|
+
onCheckedChange: () => o.toggleOption(h.value)
|
|
235
|
+
}), /* @__PURE__ */ a(fe, {
|
|
236
|
+
className: "flex-1 gap-2",
|
|
237
|
+
htmlFor: he,
|
|
238
|
+
children: [h.icon ? /* @__PURE__ */ e("span", {
|
|
239
|
+
"aria-hidden": "true",
|
|
240
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
241
|
+
"data-hook": `${n}-option-${h.value}-icon`,
|
|
242
|
+
children: h.icon
|
|
243
|
+
}) : null, h.label]
|
|
244
|
+
})]
|
|
245
|
+
}, h.value);
|
|
246
|
+
})
|
|
247
|
+
});
|
|
248
|
+
if (!l.group) return /* @__PURE__ */ e(u.Fragment, { children: $ }, "__ungrouped__");
|
|
249
|
+
const V = `${z}-group-${i}`;
|
|
250
|
+
return /* @__PURE__ */ a("div", {
|
|
251
|
+
"aria-labelledby": V,
|
|
252
|
+
className: "flex flex-col gap-3",
|
|
253
|
+
"data-hook": xe(n, l.group),
|
|
254
|
+
role: "group",
|
|
255
|
+
children: [/* @__PURE__ */ e("p", {
|
|
256
|
+
className: "text-muted-foreground text-label-sm",
|
|
257
|
+
id: V,
|
|
258
|
+
children: l.group
|
|
259
|
+
}), $]
|
|
260
|
+
}, l.group);
|
|
261
|
+
})] }), o.value.length > 0 && !k ? /* @__PURE__ */ e(pe, {
|
|
262
|
+
dataHook: `${n}-clear`,
|
|
263
|
+
variant: "ghost",
|
|
264
|
+
onClick: o.clear,
|
|
265
|
+
children: v ?? "Clear filters"
|
|
266
|
+
}) : null]
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ e(He, { children: /* @__PURE__ */ e(Ke, {
|
|
269
|
+
asChild: !0,
|
|
270
|
+
children: /* @__PURE__ */ e(pe, {
|
|
271
|
+
dataHook: `${n}-done`,
|
|
272
|
+
children: w ?? "Done"
|
|
273
|
+
})
|
|
274
|
+
}) })
|
|
222
275
|
]
|
|
223
|
-
}
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
276
|
+
})]
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
const Y = m !== void 0 && !k, ce = Y && A[0]?.group === void 0 && A.length > 0, de = Y ? /* @__PURE__ */ a(H, {
|
|
280
|
+
"aria-checked": J,
|
|
281
|
+
dataHook: `${n}-option-all`,
|
|
282
|
+
value: cr,
|
|
283
|
+
onSelect: o.clear,
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ e(be, { checked: J }),
|
|
286
|
+
f ? /* @__PURE__ */ e("span", {
|
|
287
|
+
"aria-hidden": "true",
|
|
288
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
289
|
+
children: f
|
|
290
|
+
}) : null,
|
|
291
|
+
m,
|
|
292
|
+
B !== void 0 ? /* @__PURE__ */ e(ee, { count: B }) : null
|
|
293
|
+
]
|
|
294
|
+
}) : null;
|
|
295
|
+
return /* @__PURE__ */ a(Ve, {
|
|
296
|
+
open: o.open,
|
|
297
|
+
onOpenChange: se,
|
|
298
|
+
children: [/* @__PURE__ */ e(Pe, {
|
|
299
|
+
asChild: !0,
|
|
300
|
+
children: ie
|
|
301
|
+
}), /* @__PURE__ */ e(Ee, {
|
|
302
|
+
align: "start",
|
|
303
|
+
"aria-label": d,
|
|
304
|
+
className: "w-max max-w-80 min-w-60 p-0",
|
|
305
|
+
dataHook: `${n}-popover`,
|
|
306
|
+
onOpenAutoFocus: (r) => {
|
|
307
|
+
M || (r.preventDefault(), te.current?.focus());
|
|
308
|
+
},
|
|
309
|
+
children: /* @__PURE__ */ a(Ge, {
|
|
310
|
+
ref: te,
|
|
311
|
+
className: "border-0 shadow-none",
|
|
312
|
+
dataHook: `${n}-command`,
|
|
313
|
+
shouldFilter: !1,
|
|
314
|
+
children: [M ? /* @__PURE__ */ e(Qe, {
|
|
315
|
+
autoFocus: !0,
|
|
316
|
+
clearSearchAriaLabel: b ?? "Clear search",
|
|
317
|
+
dataHook: `${n}-search`,
|
|
318
|
+
placeholder: R ?? "Search options...",
|
|
319
|
+
onValueChange: W
|
|
320
|
+
}) : null, /* @__PURE__ */ a(We, {
|
|
321
|
+
"aria-multiselectable": "true",
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ e(Ue, {
|
|
324
|
+
description: S ?? "Try another search.",
|
|
325
|
+
icon: /* @__PURE__ */ e(me, {}),
|
|
326
|
+
children: s ?? "No options found."
|
|
327
|
+
}),
|
|
328
|
+
Y && !ce ? /* @__PURE__ */ e(Z, { children: de }) : null,
|
|
329
|
+
A.map((r, l) => /* @__PURE__ */ a(Z, {
|
|
330
|
+
dataHook: r.group ? xe(n, r.group) : void 0,
|
|
331
|
+
heading: r.group,
|
|
332
|
+
children: [l === 0 && ce ? de : null, r.options.map((i) => {
|
|
333
|
+
const $ = o.selectedSet.has(i.value), V = i.disabled || i.count === 0 && !$;
|
|
334
|
+
return /* @__PURE__ */ a(H, {
|
|
335
|
+
"aria-checked": $,
|
|
336
|
+
dataHook: `${n}-option-${i.value}`,
|
|
337
|
+
disabled: V,
|
|
338
|
+
value: i.value,
|
|
339
|
+
onSelect: () => o.toggleOption(i.value),
|
|
255
340
|
children: [
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
|
|
258
|
-
{
|
|
259
|
-
"aria-hidden": "true",
|
|
260
|
-
className: M(Qe(), "mb-1"),
|
|
261
|
-
children: /* @__PURE__ */ t(ae, {})
|
|
262
|
-
}
|
|
263
|
-
),
|
|
264
|
-
/* @__PURE__ */ t("p", { children: O ?? "No options found." }),
|
|
265
|
-
/* @__PURE__ */ t("p", { className: "text-muted-foreground", children: s ?? "Try another search." })
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
)
|
|
269
|
-
) : /* @__PURE__ */ l(we, { children: [
|
|
270
|
-
o !== void 0 && !C ? /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
271
|
-
/* @__PURE__ */ t(
|
|
272
|
-
se,
|
|
273
|
-
{
|
|
274
|
-
checked: Q,
|
|
275
|
-
dataHook: `${r}-option-all`,
|
|
276
|
-
id: e,
|
|
277
|
-
onCheckedChange: a.clear
|
|
278
|
-
}
|
|
279
|
-
),
|
|
280
|
-
/* @__PURE__ */ l(oe, { className: "flex-1 gap-2", htmlFor: e, children: [
|
|
281
|
-
m ? /* @__PURE__ */ t(
|
|
282
|
-
"span",
|
|
283
|
-
{
|
|
341
|
+
/* @__PURE__ */ e(be, { checked: $ }),
|
|
342
|
+
i.icon ? /* @__PURE__ */ e("span", {
|
|
284
343
|
"aria-hidden": "true",
|
|
285
344
|
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
"span",
|
|
313
|
-
{
|
|
314
|
-
"aria-hidden": "true",
|
|
315
|
-
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
316
|
-
"data-hook": `${r}-option-${n.value}-icon`,
|
|
317
|
-
children: n.icon
|
|
318
|
-
}
|
|
319
|
-
) : null,
|
|
320
|
-
n.label
|
|
321
|
-
] })
|
|
322
|
-
]
|
|
323
|
-
},
|
|
324
|
-
n.value
|
|
325
|
-
);
|
|
326
|
-
}) })
|
|
327
|
-
] }),
|
|
328
|
-
a.value.length > 0 && !C ? /* @__PURE__ */ t(
|
|
329
|
-
le,
|
|
330
|
-
{
|
|
331
|
-
dataHook: `${r}-clear`,
|
|
332
|
-
variant: "ghost",
|
|
333
|
-
onClick: a.clear,
|
|
334
|
-
children: p ?? "Clear filters"
|
|
335
|
-
}
|
|
336
|
-
) : null
|
|
337
|
-
] }),
|
|
338
|
-
/* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ t(Le, { asChild: !0, children: /* @__PURE__ */ t(le, { dataHook: `${r}-done`, children: B ?? "Done" }) }) })
|
|
339
|
-
] })
|
|
340
|
-
] });
|
|
341
|
-
}
|
|
342
|
-
return /* @__PURE__ */ l(Pe, { open: a.open, onOpenChange: ee, children: [
|
|
343
|
-
/* @__PURE__ */ t(Ie, { asChild: !0, children: te }),
|
|
344
|
-
/* @__PURE__ */ t(
|
|
345
|
-
Ue,
|
|
346
|
-
{
|
|
347
|
-
align: "start",
|
|
348
|
-
"aria-label": h,
|
|
349
|
-
className: "w-max max-w-80 min-w-60 p-0",
|
|
350
|
-
dataHook: `${r}-popover`,
|
|
351
|
-
onOpenAutoFocus: (e) => {
|
|
352
|
-
U || (e.preventDefault(), Y.current?.focus());
|
|
353
|
-
},
|
|
354
|
-
children: /* @__PURE__ */ l(
|
|
355
|
-
Oe,
|
|
356
|
-
{
|
|
357
|
-
ref: Y,
|
|
358
|
-
dataHook: `${r}-command`,
|
|
359
|
-
shouldFilter: !1,
|
|
360
|
-
children: [
|
|
361
|
-
U ? (
|
|
362
|
-
/* Autofocused on open — the person came to type, not scroll;
|
|
363
|
-
focus moves into a menu they deliberately opened. */
|
|
364
|
-
/* @__PURE__ */ t(
|
|
365
|
-
_e,
|
|
366
|
-
{
|
|
367
|
-
autoFocus: !0,
|
|
368
|
-
clearSearchAriaLabel: _ ?? "Clear search",
|
|
369
|
-
dataHook: `${r}-search`,
|
|
370
|
-
placeholder: w ?? "Search options...",
|
|
371
|
-
onValueChange: E
|
|
372
|
-
}
|
|
373
|
-
)
|
|
374
|
-
) : null,
|
|
375
|
-
/* @__PURE__ */ l(De, { "aria-multiselectable": "true", children: [
|
|
376
|
-
/* @__PURE__ */ t(
|
|
377
|
-
Fe,
|
|
378
|
-
{
|
|
379
|
-
description: s ?? "Try another search.",
|
|
380
|
-
icon: /* @__PURE__ */ t(ae, {}),
|
|
381
|
-
children: O ?? "No options found."
|
|
382
|
-
}
|
|
383
|
-
),
|
|
384
|
-
/* @__PURE__ */ l(ie, { children: [
|
|
385
|
-
o !== void 0 && !C ? /* @__PURE__ */ l(
|
|
386
|
-
G,
|
|
387
|
-
{
|
|
388
|
-
"aria-checked": Q,
|
|
389
|
-
dataHook: `${r}-option-all`,
|
|
390
|
-
value: Ge,
|
|
391
|
-
onSelect: a.clear,
|
|
392
|
-
children: [
|
|
393
|
-
/* @__PURE__ */ t(de, { checked: Q }),
|
|
394
|
-
m ? /* @__PURE__ */ t(
|
|
395
|
-
"span",
|
|
396
|
-
{
|
|
397
|
-
"aria-hidden": "true",
|
|
398
|
-
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
399
|
-
children: m
|
|
400
|
-
}
|
|
401
|
-
) : null,
|
|
402
|
-
o,
|
|
403
|
-
F !== void 0 ? /* @__PURE__ */ t(X, { count: F }) : null
|
|
404
|
-
]
|
|
405
|
-
}
|
|
406
|
-
) : null,
|
|
407
|
-
I.map((e) => {
|
|
408
|
-
const n = a.selectedSet.has(e.value), q = e.disabled || e.count === 0 && !n;
|
|
409
|
-
return /* @__PURE__ */ l(
|
|
410
|
-
G,
|
|
411
|
-
{
|
|
412
|
-
"aria-checked": n,
|
|
413
|
-
dataHook: `${r}-option-${e.value}`,
|
|
414
|
-
disabled: q,
|
|
415
|
-
value: e.value,
|
|
416
|
-
onSelect: () => a.toggleOption(e.value),
|
|
417
|
-
children: [
|
|
418
|
-
/* @__PURE__ */ t(de, { checked: n }),
|
|
419
|
-
e.icon ? /* @__PURE__ */ t(
|
|
420
|
-
"span",
|
|
421
|
-
{
|
|
422
|
-
"aria-hidden": "true",
|
|
423
|
-
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
424
|
-
"data-hook": `${r}-option-${e.value}-icon`,
|
|
425
|
-
children: e.icon
|
|
426
|
-
}
|
|
427
|
-
) : null,
|
|
428
|
-
e.label,
|
|
429
|
-
e.count !== void 0 ? /* @__PURE__ */ t(X, { count: e.count }) : null
|
|
430
|
-
]
|
|
431
|
-
},
|
|
432
|
-
e.value
|
|
433
|
-
);
|
|
434
|
-
})
|
|
435
|
-
] }),
|
|
436
|
-
a.value.length > 0 && !C ? (
|
|
437
|
-
/* A bordered group, not CommandSeparator — role="separator"
|
|
438
|
-
is not a permitted child of the cmdk listbox. */
|
|
439
|
-
/* @__PURE__ */ t(ie, { className: "border-border border-t", children: /* @__PURE__ */ t(
|
|
440
|
-
G,
|
|
441
|
-
{
|
|
442
|
-
className: "justify-center",
|
|
443
|
-
dataHook: `${r}-clear`,
|
|
444
|
-
value: Xe,
|
|
445
|
-
onSelect: a.clear,
|
|
446
|
-
children: p ?? "Clear filters"
|
|
447
|
-
}
|
|
448
|
-
) })
|
|
449
|
-
) : null
|
|
450
|
-
] })
|
|
451
|
-
]
|
|
452
|
-
}
|
|
453
|
-
)
|
|
454
|
-
}
|
|
455
|
-
)
|
|
456
|
-
] });
|
|
457
|
-
}
|
|
458
|
-
);
|
|
459
|
-
Je.displayName = "MultiSelectFilter";
|
|
345
|
+
"data-hook": `${n}-option-${i.value}-icon`,
|
|
346
|
+
children: i.icon
|
|
347
|
+
}) : null,
|
|
348
|
+
i.label,
|
|
349
|
+
i.count !== void 0 ? /* @__PURE__ */ e(ee, { count: i.count }) : null
|
|
350
|
+
]
|
|
351
|
+
}, i.value);
|
|
352
|
+
})]
|
|
353
|
+
}, r.group ?? "__ungrouped__")),
|
|
354
|
+
o.value.length > 0 && !k ? /* @__PURE__ */ e(Z, {
|
|
355
|
+
className: "border-border border-t",
|
|
356
|
+
children: /* @__PURE__ */ e(H, {
|
|
357
|
+
className: "justify-center",
|
|
358
|
+
dataHook: `${n}-clear`,
|
|
359
|
+
value: dr,
|
|
360
|
+
onSelect: o.clear,
|
|
361
|
+
children: v ?? "Clear filters"
|
|
362
|
+
})
|
|
363
|
+
}) : null
|
|
364
|
+
]
|
|
365
|
+
})]
|
|
366
|
+
})
|
|
367
|
+
})]
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
ur.displayName = "MultiSelectFilter";
|
|
460
371
|
export {
|
|
461
|
-
|
|
462
|
-
|
|
372
|
+
ur as MultiSelectFilter,
|
|
373
|
+
or as multiSelectFilterTriggerVariants
|
|
463
374
|
};
|