@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
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const multiSelectFilterTriggerVariants: (props?: ({
|
|
4
|
+
size?: "default" | "sm" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
/** One selectable option of a multi-select filter. */
|
|
7
|
+
interface MultiSelectFilterOption {
|
|
8
|
+
/** Unique value of the option. */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Visible label of the option. */
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* Result count for this option, shown beside the label in the menu (the
|
|
14
|
+
* drawer's two-column rows carry only the All total). A count of 0
|
|
15
|
+
* disables the option in both — disabled, never hidden, so the dimension
|
|
16
|
+
* keeps its full shape.
|
|
17
|
+
*/
|
|
18
|
+
count?: number;
|
|
19
|
+
/** Disables the option explicitly. */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The option's own glyph (a search-engine logo, a rating star), 16px.
|
|
23
|
+
* Shown before the label in the menu and the drawer; the trigger shows the
|
|
24
|
+
* first pick's glyph when no `icon` is set.
|
|
25
|
+
*/
|
|
26
|
+
icon?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Heading this option is listed under, e.g. "Facebook". Options sharing a
|
|
29
|
+
* `group` render together under it, in the order the group first appears
|
|
30
|
+
* in `options`; options without one lead the list with no heading. Only
|
|
31
|
+
* the menu and the drawer show it — the trigger, counts, the All row and
|
|
32
|
+
* the full-set collapse treat every option alike.
|
|
33
|
+
*/
|
|
34
|
+
group?: string;
|
|
35
|
+
}
|
|
36
|
+
interface MultiSelectFilterProps extends Omit<React.ComponentPropsWithoutRef<"button">, "value" | "defaultValue" | "onChange" | "children">, VariantProps<typeof multiSelectFilterTriggerVariants> {
|
|
37
|
+
/**
|
|
38
|
+
* Data hook for automated testing (REQUIRED). Every part of the menu
|
|
39
|
+
* derives its own hook from it (`-popover`, `-search`, `-option-all`,
|
|
40
|
+
* `-option-<value>`, `-group-<heading>`, `-clear`, `-summary`, `-icon`).
|
|
41
|
+
* @example "locations-status-filter"
|
|
42
|
+
*/
|
|
43
|
+
dataHook: string;
|
|
44
|
+
/**
|
|
45
|
+
* The dimension's name — use the product's words ("Status", "Source"),
|
|
46
|
+
* never an internal field name. Always the start of the accessible name;
|
|
47
|
+
* also the trigger's muted placeholder at zero when there is no `allLabel`.
|
|
48
|
+
*/
|
|
49
|
+
label: string;
|
|
50
|
+
/** The selectable options, in the dimension's own order. */
|
|
51
|
+
options: readonly MultiSelectFilterOption[];
|
|
52
|
+
/** Controlled selected values. Values combine as OR. */
|
|
53
|
+
value?: readonly string[];
|
|
54
|
+
/**
|
|
55
|
+
* Initial selection for uncontrolled mode.
|
|
56
|
+
* @default []
|
|
57
|
+
*/
|
|
58
|
+
defaultValue?: readonly string[];
|
|
59
|
+
/**
|
|
60
|
+
* Callback on every pick (the per-filter commit model: reflect
|
|
61
|
+
* immediately on client data; defer expensive refetches to
|
|
62
|
+
* `onOpenChange(false)`).
|
|
63
|
+
* @param value - The full selection after the pick
|
|
64
|
+
*/
|
|
65
|
+
onValueChange?: (value: string[]) => void;
|
|
66
|
+
/** Controlled open state of the menu. */
|
|
67
|
+
open?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Callback when the menu opens or closes — `false` is the moment to run
|
|
70
|
+
* an expensive refetch for everything picked while it was open.
|
|
71
|
+
*/
|
|
72
|
+
onOpenChange?: (open: boolean) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Fixed glyph leading the trigger — the dimension's own icon (a funnel, a
|
|
75
|
+
* calendar), 16px. Without it the trigger follows the selection: `allIcon`
|
|
76
|
+
* at zero, then the first pick's `option.icon`. Hidden from assistive
|
|
77
|
+
* tech; the accessible name comes from `label` and the picks.
|
|
78
|
+
*/
|
|
79
|
+
icon?: React.ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* How many picked labels to spell out before collapsing into
|
|
82
|
+
* `summaryLabel` ("Google +2" at 1, "London, Brighton +1" at 2). Values
|
|
83
|
+
* below 1 are treated as 1.
|
|
84
|
+
* @default 1
|
|
85
|
+
*/
|
|
86
|
+
maxVisibleLabels?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Label of the leading reset row, e.g. "All sources". Omit to hide the
|
|
89
|
+
* row. Checked when nothing is picked; picking it clears the selection.
|
|
90
|
+
* Also the trigger's text at zero.
|
|
91
|
+
*/
|
|
92
|
+
allLabel?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Glyph of the All row, and of the trigger while nothing is picked (when
|
|
95
|
+
* no `icon` is set) — the dimension's "everything" mark, e.g. a globe.
|
|
96
|
+
*/
|
|
97
|
+
allIcon?: React.ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* Total beside the All row. Defaults to the sum of the options' counts
|
|
100
|
+
* when every option has one — per-option counts leave out their own
|
|
101
|
+
* filter, so together they are the unfiltered total.
|
|
102
|
+
*/
|
|
103
|
+
allCount?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Show a search input inside the menu once the option list grows past
|
|
106
|
+
* this many options. Scanning stops working past ~10–15.
|
|
107
|
+
* @default 10
|
|
108
|
+
*/
|
|
109
|
+
searchThreshold?: number;
|
|
110
|
+
/** Force the search input on or off, overriding `searchThreshold`. */
|
|
111
|
+
searchable?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* When a pick completes the set — every option that can be picked (not
|
|
114
|
+
* disabled, count not 0) is ticked — the selection collapses to `[]`,
|
|
115
|
+
* i.e. "All": the same records, read as no filter instead of "Google +3".
|
|
116
|
+
* @default true
|
|
117
|
+
*/
|
|
118
|
+
collapseFullSelection?: boolean;
|
|
119
|
+
/** Disables the trigger. */
|
|
120
|
+
disabled?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Label of the clear action inside the menu.
|
|
123
|
+
* @default "Clear filters"
|
|
124
|
+
*/
|
|
125
|
+
clearLabel?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Trigger summary once more values are picked than `maxVisibleLabels`.
|
|
128
|
+
* Placeholders: `{labels}` — the first `maxVisibleLabels` labels,
|
|
129
|
+
* `{rest}` — the picks beyond them, `{count}` — every pick.
|
|
130
|
+
* `"{count} selected"` reads "3 selected" instead.
|
|
131
|
+
* @default "{labels} +{rest}"
|
|
132
|
+
*/
|
|
133
|
+
summaryLabel?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Placeholder of the search input inside the menu.
|
|
136
|
+
* @default "Search options..."
|
|
137
|
+
*/
|
|
138
|
+
searchPlaceholder?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Message when the search matches no options.
|
|
141
|
+
* @default "No options found."
|
|
142
|
+
*/
|
|
143
|
+
emptyLabel?: string;
|
|
144
|
+
/**
|
|
145
|
+
* The quiet hint under the no-match message.
|
|
146
|
+
* @default "Try another search."
|
|
147
|
+
*/
|
|
148
|
+
emptyDescription?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Accessible label of the menu search input's clear button (the drawer's
|
|
151
|
+
* search field is a plain Input without one).
|
|
152
|
+
* @default "Clear search"
|
|
153
|
+
*/
|
|
154
|
+
clearSearchAriaLabel?: string;
|
|
155
|
+
/**
|
|
156
|
+
* How the options open: the Popover + Command `menu`, a bottom `drawer`
|
|
157
|
+
* (the phone form: Checkbox rows in two columns, Clear, Done), or `auto`
|
|
158
|
+
* — the menu from the `md` breakpoint up and the drawer below it.
|
|
159
|
+
* @default "menu"
|
|
160
|
+
*/
|
|
161
|
+
presentation?: "menu" | "drawer" | "auto";
|
|
162
|
+
/**
|
|
163
|
+
* Label of the drawer's Done button — it only closes; picks apply at once.
|
|
164
|
+
* @default "Done"
|
|
165
|
+
*/
|
|
166
|
+
doneLabel?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Screen-reader description of the drawer (the Drawer contract needs a
|
|
169
|
+
* title and a description; the title is `label`).
|
|
170
|
+
* @default "Picks apply as you make them."
|
|
171
|
+
*/
|
|
172
|
+
drawerDescription?: string;
|
|
173
|
+
/** Analytics element identifier. @default "multi-select-filter" */
|
|
174
|
+
trackingEl?: string;
|
|
175
|
+
/** Analytics label */
|
|
176
|
+
trackingLabel?: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Multi-select filter for one dimension: a field-look trigger that reads its
|
|
180
|
+
* picks, over a Popover + Command menu that stays open across picks. Values
|
|
181
|
+
* combine as OR.
|
|
182
|
+
*/
|
|
183
|
+
declare const MultiSelectFilter: React.ForwardRefExoticComponent<MultiSelectFilterProps & React.RefAttributes<HTMLButtonElement>>;
|
|
184
|
+
export { MultiSelectFilter, multiSelectFilterTriggerVariants };
|
|
185
|
+
export type { MultiSelectFilterOption, MultiSelectFilterProps };
|
|
186
|
+
//# sourceMappingURL=multi-select-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select-filter.d.ts","sourceRoot":"","sources":["../../src/components/multi-select-filter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AA6GlE,QAAA,MAAM,gCAAgC;;8EA2CrC,CAAC;AAMF,sDAAsD;AACtD,UAAU,uBAAuB;IAC/B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,sBACR,SACE,IAAI,CACF,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EACxC,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,CACnD,EACD,YAAY,CAAC,OAAO,gCAAgC,CAAC;IACvD;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,OAAO,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC5C,wDAAwD;IACxD,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,yCAAyC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAiLD;;;;GAIG;AACH,QAAA,MAAM,iBAAiB,kGAugBtB,CAAC;AAIF,OAAO,EAAE,iBAAiB,EAAE,gCAAgC,EAAE,CAAC;AAC/D,YAAY,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,374 @@
|
|
|
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));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
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([]);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
v(S);
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
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
|
|
65
|
+
};
|
|
66
|
+
}
|
|
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
|
+
});
|
|
74
|
+
}
|
|
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
|
+
});
|
|
80
|
+
}
|
|
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`,
|
|
164
|
+
children: [
|
|
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
|
+
}) })
|
|
275
|
+
]
|
|
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),
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ e(be, { checked: $ }),
|
|
342
|
+
i.icon ? /* @__PURE__ */ e("span", {
|
|
343
|
+
"aria-hidden": "true",
|
|
344
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
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";
|
|
371
|
+
export {
|
|
372
|
+
ur as MultiSelectFilter,
|
|
373
|
+
or as multiSelectFilterTriggerVariants
|
|
374
|
+
};
|
package/dist/navigation-menu.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";const f=require("./_virtual/_rolldown/runtime.cjs");let i=require("react");i=f.__toESM(i,1);let y=require("@brightlocal/icons"),s=require("@brightlocal/ui-components/lib/utils"),n=require("react/jsx-runtime"),r=require("@radix-ui/react-navigation-menu");r=f.__toESM(r,1);var v=i.forwardRef(({className:e,children:t,dataHook:a,delayDuration:d=50,...u},l)=>(0,n.jsxs)(r.Root,{ref:l,className:(0,s.cn)("relative z-10 flex max-w-max flex-1 items-center justify-center",e),"data-hook":a,"data-slot":"navigation-menu",delayDuration:d,...u,children:[t,(0,n.jsx)(c,{})]}));v.displayName="NavigationMenu";var p=i.forwardRef(({className:e,...t},a)=>(0,n.jsx)(r.List,{ref:a,className:(0,s.cn)("group flex flex-1 list-none items-center justify-center gap-1",e),"data-slot":"navigation-menu-list",...t}));p.displayName="NavigationMenuList";var N=i.forwardRef((e,t)=>(0,n.jsx)(r.Item,{ref:t,"data-slot":"navigation-menu-item",...e}));N.displayName="NavigationMenuItem";var R=400,b=i.forwardRef(({className:e,children:t,onClick:a,onPointerDown:d,onPointerEnter:u,...l},_)=>{const m=i.useRef(""),g=i.useRef(0);return(0,n.jsxs)(r.Trigger,{ref:_,className:(0,s.cn)(["group inline-flex h-9 w-max cursor-pointer items-center justify-center gap-1","rounded-md px-4 py-2","text-label","text-foreground","duration-fast transition-colors ease-out","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground","focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-50","data-[state=open]:bg-accent/50"],e),"data-slot":"navigation-menu-trigger",onClick:o=>{const M=o.currentTarget.getAttribute("data-state")==="open",j=o.timeStamp-g.current<R;m.current==="mouse"&&o.detail>0&&M&&j&&o.preventDefault(),a?.(o)},onPointerDown:o=>{m.current=o.pointerType,d?.(o)},onPointerEnter:o=>{g.current=o.timeStamp,u?.(o)},...l,children:[t,(0,n.jsx)(y.ChevronDown,{"aria-hidden":"true",className:"duration-base relative top-[1px] ml-1 transition-transform ease-in-out group-data-[state=open]:rotate-180",size:12})]})});b.displayName="NavigationMenuTrigger";var x=i.forwardRef(({className:e,...t},a)=>(0,n.jsx)(r.Content,{ref:a,className:(0,s.cn)(["data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out top-0 left-0 w-full","data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out","data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52","data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52","duration-base ease-emphasized","md:absolute md:w-auto"],e),"data-slot":"navigation-menu-content",role:"group",...t}));x.displayName="NavigationMenuContent";var h=i.forwardRef(({className:e,...t},a)=>(0,n.jsx)(r.Link,{ref:a,className:(0,s.cn)(["block cursor-pointer rounded-md p-3 leading-none no-underline select-none","duration-fast transition-colors ease-out outline-none","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground","focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none"],e),"data-slot":"navigation-menu-link",...t}));h.displayName="NavigationMenuLink";var c=i.forwardRef(({className:e,...t},a)=>(0,n.jsx)("div",{className:(0,s.cn)("absolute top-full left-0 z-50 flex justify-center"),children:(0,n.jsx)(r.Viewport,{ref:a,className:(0,s.cn)(["origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)]","bg-popover text-popover-foreground w-full overflow-hidden rounded-md border shadow-sm","duration-base ease-emphasized transition-[width,height]","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:duration-fast data-[state=closed]:ease-in","md:w-[var(--radix-navigation-menu-viewport-width)]"],e),"data-slot":"navigation-menu-viewport",...t})}));c.displayName="NavigationMenuViewport";var w=i.forwardRef(({className:e,...t},a)=>(0,n.jsx)(r.Indicator,{ref:a,className:(0,s.cn)(["top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden","data-[state=visible]:animate-in data-[state=hidden]:animate-out","data-[state=hidden]:fade-out data-[state=visible]:fade-in"],e),"data-slot":"navigation-menu-indicator",...t,children:(0,n.jsx)("div",{className:"bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md"})}));w.displayName="NavigationMenuIndicator";exports.NavigationMenu=v;exports.NavigationMenuContent=x;exports.NavigationMenuIndicator=w;exports.NavigationMenuItem=N;exports.NavigationMenuLink=h;exports.NavigationMenuList=p;exports.NavigationMenuTrigger=b;exports.NavigationMenuViewport=c;
|