@brightlocal/ui-components 3.2.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 +3 -1
- package/component-meta.json +1271 -428
- 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 +136 -176
- 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.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 +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +630 -608
- 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 +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.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 +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 -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 +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 +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 +46 -46
- package/src/blocks/empty-state.tsx +34 -18
- 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/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 +14 -2
- 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 +6 -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
package/dist/combobox.js
CHANGED
|
@@ -1,738 +1,539 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import * as e from "react";
|
|
3
|
-
import { Check as Y, ChevronsUpDown as
|
|
4
|
-
import { useVirtualizer as te } from "@tanstack/react-virtual";
|
|
5
|
-
import { cva as oe } from "class-variance-authority";
|
|
6
|
-
import { defaultFilter as K } from "cmdk";
|
|
3
|
+
import { Check as Y, ChevronsUpDown as Z } from "@brightlocal/icons";
|
|
7
4
|
import { cn as T } from "@brightlocal/ui-components/lib/utils";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Spinner as
|
|
12
|
-
|
|
5
|
+
import { Fragment as ee, jsx as c, jsxs as H } from "react/jsx-runtime";
|
|
6
|
+
import { cva as te } from "class-variance-authority";
|
|
7
|
+
import { useDevWarning as B } from "@brightlocal/ui-components/lib/use-dev-warning";
|
|
8
|
+
import { Spinner as oe } from "@brightlocal/ui-components/spinner";
|
|
9
|
+
import { useVirtualizer as re } from "@tanstack/react-virtual";
|
|
10
|
+
import { defaultFilter as K } from "cmdk";
|
|
11
|
+
import { Popover as ne, PopoverContent as ae, PopoverTrigger as se } from "@brightlocal/ui-components/popover";
|
|
12
|
+
import { Command as ie, CommandEmpty as le, CommandGroup as ce, CommandInput as ue, CommandItem as de, CommandList as fe, CommandSeparator as me } from "@brightlocal/ui-components/command";
|
|
13
|
+
var J = e.createContext(null), Q = e.createContext(null);
|
|
13
14
|
function _() {
|
|
14
15
|
const t = e.useContext(J);
|
|
15
|
-
if (!t)
|
|
16
|
-
throw new Error("Combobox components must be used within a <Combobox>");
|
|
16
|
+
if (!t) throw new Error("Combobox components must be used within a <Combobox>");
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
shouldFilter: f = !0,
|
|
26
|
-
disabled: l = !1,
|
|
27
|
-
itemToStringValue: u,
|
|
28
|
-
children: m
|
|
29
|
-
}) {
|
|
30
|
-
const [v, D] = e.useState(""), [h, b] = e.useState(!1), [S, E] = e.useState(
|
|
31
|
-
() => /* @__PURE__ */ new Map()
|
|
32
|
-
), [C, L] = e.useState(""), [V, w] = e.useState(void 0), y = t !== void 0, M = a !== void 0, R = y ? t : v, k = M ? a : h, N = e.useCallback(
|
|
33
|
-
(x) => {
|
|
34
|
-
x || L(""), M || b(x), o?.(x);
|
|
35
|
-
},
|
|
36
|
-
[M, o]
|
|
37
|
-
), p = e.useCallback(
|
|
38
|
-
(x) => {
|
|
39
|
-
y || D(x), r?.(x);
|
|
40
|
-
},
|
|
41
|
-
[y, r]
|
|
42
|
-
), I = e.useRef(s);
|
|
19
|
+
function Ae({ value: t, onValueChange: r, open: a, onOpenChange: o, onClose: s, shouldFilter: d = !0, disabled: i = !1, itemToStringValue: f, children: C }) {
|
|
20
|
+
const [b, N] = e.useState(""), [p, m] = e.useState(!1), [S, y] = e.useState(() => /* @__PURE__ */ new Map()), [v, k] = e.useState(""), [F, I] = e.useState(void 0), w = t !== void 0, D = a !== void 0, L = w ? t : b, R = D ? a : p, M = e.useCallback((x) => {
|
|
21
|
+
x || k(""), D || m(x), o?.(x);
|
|
22
|
+
}, [D, o]), h = e.useCallback((x) => {
|
|
23
|
+
w || N(x), r?.(x);
|
|
24
|
+
}, [w, r]), E = e.useRef(s);
|
|
43
25
|
e.useEffect(() => {
|
|
44
|
-
|
|
26
|
+
E.current = s;
|
|
45
27
|
}, [s]);
|
|
46
|
-
const A = e.useRef(
|
|
28
|
+
const A = e.useRef(R);
|
|
47
29
|
e.useEffect(() => {
|
|
48
|
-
A.current && !
|
|
49
|
-
}, [
|
|
50
|
-
A.current &&
|
|
30
|
+
A.current && !R && E.current?.(), A.current = R;
|
|
31
|
+
}, [R]), e.useEffect(() => () => {
|
|
32
|
+
A.current && E.current?.();
|
|
51
33
|
}, []);
|
|
52
|
-
const
|
|
34
|
+
const u = e.useRef(/* @__PURE__ */ new Map()), V = e.useRef(!1), O = e.useRef(!0);
|
|
53
35
|
e.useEffect(() => () => {
|
|
54
36
|
O.current = !1;
|
|
55
37
|
}, []);
|
|
56
38
|
const j = e.useCallback(() => {
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
V.current || (V.current = !0, queueMicrotask(() => {
|
|
40
|
+
V.current = !1, O.current && y(new Map(u.current));
|
|
59
41
|
}));
|
|
60
|
-
}, []), $ = e.useCallback(
|
|
61
|
-
(x, n)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
),
|
|
66
|
-
(x) => {
|
|
67
|
-
for (const [n, i] of x)
|
|
68
|
-
c.current.set(n, i);
|
|
69
|
-
E(new Map(c.current));
|
|
70
|
-
},
|
|
71
|
-
[]
|
|
72
|
-
), q = e.useRef(R);
|
|
42
|
+
}, []), $ = e.useCallback((x, n) => {
|
|
43
|
+
u.current.get(x) !== n && (u.current.set(x, n), j());
|
|
44
|
+
}, [j]), z = e.useCallback((x) => {
|
|
45
|
+
for (const [n, l] of x) u.current.set(n, l);
|
|
46
|
+
y(new Map(u.current));
|
|
47
|
+
}, []), q = e.useRef(L);
|
|
73
48
|
e.useLayoutEffect(() => {
|
|
74
|
-
q.current =
|
|
75
|
-
}, [
|
|
76
|
-
const U = e.useCallback(
|
|
77
|
-
(x)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
);
|
|
121
|
-
return /* @__PURE__ */ d(J.Provider, { value: W, children: /* @__PURE__ */ d(re, { open: k, onOpenChange: N, children: m }) });
|
|
49
|
+
q.current = L;
|
|
50
|
+
}, [L]);
|
|
51
|
+
const U = e.useCallback((x) => {
|
|
52
|
+
x !== q.current && u.current.has(x) && (u.current.delete(x), j());
|
|
53
|
+
}, [j]), G = e.useMemo(() => f ? (x, n, l) => K(f(x), n, l) : K, [f]), W = e.useMemo(() => ({
|
|
54
|
+
open: R,
|
|
55
|
+
setOpen: M,
|
|
56
|
+
value: L,
|
|
57
|
+
onValueChange: h,
|
|
58
|
+
shouldFilter: d,
|
|
59
|
+
disabled: i,
|
|
60
|
+
itemLabels: S,
|
|
61
|
+
registerItem: $,
|
|
62
|
+
registerItemsSync: z,
|
|
63
|
+
unregisterItem: U,
|
|
64
|
+
itemToStringValue: f,
|
|
65
|
+
filterFn: G,
|
|
66
|
+
searchValue: v,
|
|
67
|
+
setSearchValue: k,
|
|
68
|
+
activeDescendantId: F,
|
|
69
|
+
setActiveDescendantId: I
|
|
70
|
+
}), [
|
|
71
|
+
R,
|
|
72
|
+
M,
|
|
73
|
+
L,
|
|
74
|
+
h,
|
|
75
|
+
d,
|
|
76
|
+
i,
|
|
77
|
+
S,
|
|
78
|
+
$,
|
|
79
|
+
z,
|
|
80
|
+
U,
|
|
81
|
+
f,
|
|
82
|
+
G,
|
|
83
|
+
v,
|
|
84
|
+
F,
|
|
85
|
+
I
|
|
86
|
+
]);
|
|
87
|
+
return /* @__PURE__ */ c(J.Provider, {
|
|
88
|
+
value: W,
|
|
89
|
+
children: /* @__PURE__ */ c(ne, {
|
|
90
|
+
open: R,
|
|
91
|
+
onOpenChange: M,
|
|
92
|
+
children: C
|
|
93
|
+
})
|
|
94
|
+
});
|
|
122
95
|
}
|
|
123
|
-
|
|
124
|
-
// Base layout
|
|
96
|
+
var be = te([
|
|
125
97
|
"relative flex w-full items-center justify-between gap-2",
|
|
126
|
-
"px-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
"bg-neutral-50 shadow-xs",
|
|
98
|
+
"px-3 py-2 h-9",
|
|
99
|
+
"border border-border rounded-sm outline-none",
|
|
100
|
+
"bg-neutral-50 border-neutral-300",
|
|
130
101
|
"dark:bg-white/5 dark:border-white/15",
|
|
131
|
-
// Typography
|
|
132
102
|
"text-field text-foreground",
|
|
133
|
-
// Placeholder state
|
|
134
103
|
"data-[placeholder=true]:text-muted-foreground",
|
|
135
|
-
// Focus state
|
|
136
104
|
"focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background",
|
|
137
105
|
"focus-visible:shadow-default",
|
|
138
|
-
// Open dropdown state
|
|
139
106
|
"data-[state=open]:border-ring",
|
|
140
|
-
|
|
141
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
142
|
-
// Transitions
|
|
107
|
+
"cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",
|
|
143
108
|
"transition-[background-color,border-color,box-shadow] duration-fast ease-out",
|
|
144
|
-
// Icon styles
|
|
145
109
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
146
|
-
]), pe = e.forwardRef(
|
|
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
|
-
"aria-hidden": "true",
|
|
186
|
-
className: "text-muted-foreground ml-auto shrink-0"
|
|
187
|
-
}
|
|
188
|
-
)
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
) });
|
|
192
|
-
}
|
|
193
|
-
);
|
|
110
|
+
]), pe = e.forwardRef(({ className: t, dataHook: r, error: a, trackingEl: o, trackingLabel: s, reserveValues: d, children: i, ...f }, C) => {
|
|
111
|
+
const { open: b, disabled: N, value: p } = _(), m = e.useId(), S = !p, y = a || f["aria-invalid"] === !0 || f["aria-invalid"] === "true";
|
|
112
|
+
return /* @__PURE__ */ c(se, {
|
|
113
|
+
asChild: !0,
|
|
114
|
+
children: /* @__PURE__ */ H("button", {
|
|
115
|
+
ref: C,
|
|
116
|
+
"aria-controls": b ? m : void 0,
|
|
117
|
+
"aria-expanded": b,
|
|
118
|
+
"aria-haspopup": "listbox",
|
|
119
|
+
"aria-invalid": y ? "true" : void 0,
|
|
120
|
+
className: T(be(), y && "border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive", t),
|
|
121
|
+
"data-hook": r,
|
|
122
|
+
"data-placeholder": S,
|
|
123
|
+
"data-slot": "combobox-trigger",
|
|
124
|
+
"data-state": b ? "open" : "closed",
|
|
125
|
+
"data-tracking-el": o || "combobox-trigger",
|
|
126
|
+
"data-tracking-label": s,
|
|
127
|
+
disabled: N || f.disabled,
|
|
128
|
+
role: "combobox",
|
|
129
|
+
type: "button",
|
|
130
|
+
...f,
|
|
131
|
+
children: [d?.length ? /* @__PURE__ */ H("span", {
|
|
132
|
+
className: "grid min-w-0 text-left",
|
|
133
|
+
"data-slot": "combobox-reserve",
|
|
134
|
+
children: [d.map((v, k) => /* @__PURE__ */ c("span", {
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
className: "invisible col-start-1 row-start-1 truncate",
|
|
137
|
+
children: v
|
|
138
|
+
}, k)), /* @__PURE__ */ c("span", {
|
|
139
|
+
className: "col-start-1 row-start-1 truncate",
|
|
140
|
+
children: i
|
|
141
|
+
})]
|
|
142
|
+
}) : i, /* @__PURE__ */ c(Z, {
|
|
143
|
+
"aria-hidden": "true",
|
|
144
|
+
className: "text-muted-foreground ml-auto shrink-0"
|
|
145
|
+
})]
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
});
|
|
194
149
|
pe.displayName = "ComboboxTrigger";
|
|
195
|
-
function
|
|
150
|
+
function ve(t) {
|
|
196
151
|
return t != null && typeof t == "object" && "value" in t && typeof t.value == "string";
|
|
197
152
|
}
|
|
198
153
|
function X(t, r, a) {
|
|
199
|
-
if (r)
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
};
|
|
154
|
+
if (r) return {
|
|
155
|
+
getValue: r,
|
|
156
|
+
getLabel: a ?? r,
|
|
157
|
+
hasDistinctLabel: !!a
|
|
158
|
+
};
|
|
205
159
|
const o = t[0];
|
|
206
|
-
if (!
|
|
207
|
-
const s = (
|
|
160
|
+
if (!ve(o)) return null;
|
|
161
|
+
const s = (i) => i.value, d = "label" in o && typeof o.label == "string";
|
|
208
162
|
return {
|
|
209
163
|
getValue: s,
|
|
210
|
-
getLabel: a ?? (
|
|
211
|
-
hasDistinctLabel:
|
|
164
|
+
getLabel: a ?? (d ? (i) => String(i.label) : s),
|
|
165
|
+
hasDistinctLabel: d || !!a
|
|
212
166
|
};
|
|
213
167
|
}
|
|
214
|
-
function
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
() => !!o && o.length > 0 && !m,
|
|
228
|
-
"ComboboxValue: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",
|
|
229
|
-
[o, m]
|
|
230
|
-
);
|
|
231
|
-
const v = e.useMemo(() => !o || !m ? null : new Map(
|
|
232
|
-
o.map((h) => [m.getValue(h), m.getLabel(h)])
|
|
233
|
-
), [o, m]), D = l ? v?.get(l) || u.get(l) || a?.(l) || l : t;
|
|
234
|
-
return /* @__PURE__ */ d(
|
|
235
|
-
"span",
|
|
236
|
-
{
|
|
237
|
-
className: T(
|
|
238
|
-
"text-field overflow-hidden text-ellipsis whitespace-nowrap",
|
|
239
|
-
r
|
|
240
|
-
),
|
|
241
|
-
"data-slot": "combobox-value",
|
|
242
|
-
children: D
|
|
243
|
-
}
|
|
244
|
-
);
|
|
168
|
+
function Te({ placeholder: t, className: r, displayValue: a, items: o, getItemValue: s, getItemLabel: d }) {
|
|
169
|
+
const { value: i, itemLabels: f } = _(), C = e.useMemo(() => o ? X(o, s, d) : null, [
|
|
170
|
+
o,
|
|
171
|
+
s,
|
|
172
|
+
d
|
|
173
|
+
]);
|
|
174
|
+
B(() => !!o && o.length > 0 && !C, "ComboboxValue: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.", [o, C]);
|
|
175
|
+
const b = e.useMemo(() => !o || !C ? null : new Map(o.map((p) => [C.getValue(p), C.getLabel(p)])), [o, C]), N = i ? b?.get(i) || f.get(i) || a?.(i) || i : t;
|
|
176
|
+
return /* @__PURE__ */ c("span", {
|
|
177
|
+
className: T("text-field overflow-hidden text-ellipsis whitespace-nowrap", r),
|
|
178
|
+
"data-slot": "combobox-value",
|
|
179
|
+
children: N
|
|
180
|
+
});
|
|
245
181
|
}
|
|
246
|
-
function
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
hideList: u = !1,
|
|
255
|
-
ariaLabel: m
|
|
256
|
-
}) {
|
|
257
|
-
const { open: v, shouldFilter: D, filterFn: h, itemToStringValue: b } = _(), [S, E] = e.useState(
|
|
258
|
-
null
|
|
259
|
-
), C = e.useRef(null), L = e.useCallback((w) => {
|
|
260
|
-
if (C.current?.(), C.current = null, !w) return;
|
|
261
|
-
let y = !1;
|
|
262
|
-
const M = (p) => {
|
|
263
|
-
y || (p === "top" || p === "bottom") && (y = !0, R.disconnect(), E(p));
|
|
264
|
-
}, R = new MutationObserver(() => {
|
|
265
|
-
M(w.getAttribute("data-side"));
|
|
182
|
+
function $e({ dataHook: t, className: r, children: a, align: o = "start", side: s = "bottom", sideOffset: d, avoidCollisions: i, hideList: f = !1, ariaLabel: C }) {
|
|
183
|
+
const { open: b, shouldFilter: N, filterFn: p, itemToStringValue: m } = _(), [S, y] = e.useState(null), v = e.useRef(null), k = e.useCallback((I) => {
|
|
184
|
+
if (v.current?.(), v.current = null, !I) return;
|
|
185
|
+
let w = !1;
|
|
186
|
+
const D = (h) => {
|
|
187
|
+
w || (h === "top" || h === "bottom") && (w = !0, L.disconnect(), y(h));
|
|
188
|
+
}, L = new MutationObserver(() => {
|
|
189
|
+
D(I.getAttribute("data-side"));
|
|
266
190
|
});
|
|
267
|
-
|
|
191
|
+
L.observe(I, {
|
|
268
192
|
attributes: !0,
|
|
269
193
|
attributeFilter: ["data-side"]
|
|
270
194
|
});
|
|
271
|
-
let
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
195
|
+
let R = 0, M = 0;
|
|
196
|
+
R = requestAnimationFrame(() => {
|
|
197
|
+
M = requestAnimationFrame(() => {
|
|
198
|
+
D(I.getAttribute("data-side"));
|
|
275
199
|
});
|
|
276
|
-
}),
|
|
277
|
-
|
|
200
|
+
}), v.current = () => {
|
|
201
|
+
w = !0, L.disconnect(), cancelAnimationFrame(R), cancelAnimationFrame(M);
|
|
278
202
|
};
|
|
279
203
|
}, []);
|
|
280
204
|
e.useEffect(() => {
|
|
281
|
-
if (!
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
return () => clearTimeout(
|
|
205
|
+
if (!b) {
|
|
206
|
+
v.current?.(), v.current = null;
|
|
207
|
+
const I = setTimeout(() => y(null), 150);
|
|
208
|
+
return () => clearTimeout(I);
|
|
285
209
|
}
|
|
286
|
-
}, [
|
|
287
|
-
const
|
|
288
|
-
return /* @__PURE__ */
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
"data-slot": "combobox-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
"min-h-0 flex-1 border-0 shadow-none",
|
|
308
|
-
"[&_[data-slot='command-input-wrapper']]:shrink-0",
|
|
309
|
-
u && "[&_[data-slot='command-input-wrapper']]:border-b-0"
|
|
310
|
-
),
|
|
311
|
-
"data-slot": "combobox-command",
|
|
312
|
-
dataHook: t || "combobox-command",
|
|
313
|
-
filter: V,
|
|
314
|
-
shouldFilter: D,
|
|
315
|
-
children: a
|
|
316
|
-
}
|
|
317
|
-
)
|
|
318
|
-
}
|
|
319
|
-
);
|
|
210
|
+
}, [b]);
|
|
211
|
+
const F = m ? p : void 0;
|
|
212
|
+
return /* @__PURE__ */ c(ae, {
|
|
213
|
+
ref: k,
|
|
214
|
+
align: o,
|
|
215
|
+
"aria-label": C ?? "Options",
|
|
216
|
+
avoidCollisions: i,
|
|
217
|
+
className: T("flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0", r),
|
|
218
|
+
collisionPadding: 4,
|
|
219
|
+
"data-slot": "combobox-popover",
|
|
220
|
+
side: S ?? s,
|
|
221
|
+
sideOffset: d,
|
|
222
|
+
children: /* @__PURE__ */ c(ie, {
|
|
223
|
+
className: T("min-h-0 flex-1 border-0 shadow-none", "[&_[data-slot='command-input-wrapper']]:shrink-0", f && "[&_[data-slot='command-input-wrapper']]:border-b-0"),
|
|
224
|
+
"data-slot": "combobox-command",
|
|
225
|
+
dataHook: t || "combobox-command",
|
|
226
|
+
filter: F,
|
|
227
|
+
shouldFilter: N,
|
|
228
|
+
children: a
|
|
229
|
+
})
|
|
230
|
+
});
|
|
320
231
|
}
|
|
321
|
-
|
|
322
|
-
const { setSearchValue: s, shouldFilter:
|
|
323
|
-
|
|
324
|
-
);
|
|
325
|
-
H(
|
|
326
|
-
() => !!(t && t > 0 && f),
|
|
327
|
-
`debounceMs is set on <ComboboxInput> but shouldFilter is true (default).
|
|
232
|
+
var he = e.forwardRef(({ debounceMs: t, onValueChange: r, ...a }, o) => {
|
|
233
|
+
const { setSearchValue: s, shouldFilter: d, activeDescendantId: i } = _(), f = e.useRef(void 0);
|
|
234
|
+
B(() => !!(t && t > 0 && d), `debounceMs is set on <ComboboxInput> but shouldFilter is true (default).
|
|
328
235
|
Debounce is designed for async/server-driven search where the consumer controls the items list.
|
|
329
|
-
Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs for client-side filtering.`,
|
|
330
|
-
|
|
331
|
-
), H(
|
|
332
|
-
() => !!(t && t > 0 && a.value !== void 0),
|
|
333
|
-
"debounceMs is set on <ComboboxInput> together with a controlled `value` prop.\nThe debounced onValueChange callback cannot update the controlled value synchronously, so the input will appear to lag behind typing.\nRemove `value` to let the input manage its own display, or remove debounceMs if you need a controlled input.",
|
|
334
|
-
[t, a.value]
|
|
335
|
-
), e.useEffect(() => () => {
|
|
336
|
-
u.current && clearTimeout(u.current);
|
|
236
|
+
Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs for client-side filtering.`, [t, d]), B(() => !!(t && t > 0 && a.value !== void 0), "debounceMs is set on <ComboboxInput> together with a controlled `value` prop.\nThe debounced onValueChange callback cannot update the controlled value synchronously, so the input will appear to lag behind typing.\nRemove `value` to let the input manage its own display, or remove debounceMs if you need a controlled input.", [t, a.value]), e.useEffect(() => () => {
|
|
237
|
+
f.current && clearTimeout(f.current);
|
|
337
238
|
}, []);
|
|
338
|
-
const
|
|
339
|
-
(
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
);
|
|
239
|
+
const C = e.useCallback((b) => {
|
|
240
|
+
s(b), t && t > 0 ? (clearTimeout(f.current), f.current = setTimeout(() => {
|
|
241
|
+
r?.(b);
|
|
242
|
+
}, t)) : r?.(b);
|
|
243
|
+
}, [
|
|
244
|
+
t,
|
|
245
|
+
r,
|
|
246
|
+
s
|
|
247
|
+
]);
|
|
248
|
+
return /* @__PURE__ */ c(ue, {
|
|
249
|
+
ref: o,
|
|
250
|
+
"aria-activedescendant": i,
|
|
251
|
+
"data-slot": "combobox-input",
|
|
252
|
+
onValueChange: C,
|
|
253
|
+
...a
|
|
254
|
+
});
|
|
356
255
|
});
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
))
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const h = e.useMemo(
|
|
381
|
-
() => X(t, r, a),
|
|
382
|
-
[t, r, a]
|
|
383
|
-
), b = e.useMemo(
|
|
384
|
-
() => h?.getValue ?? ((n) => {
|
|
385
|
-
if (typeof n == "string" || typeof n == "number")
|
|
386
|
-
return String(n);
|
|
387
|
-
throw new Error(
|
|
388
|
-
"[BrightLocal DS] ComboboxVirtualList: `getItemValue` is required for non-primitive items without a `value` property."
|
|
389
|
-
);
|
|
390
|
-
}),
|
|
391
|
-
[h]
|
|
392
|
-
), S = e.useMemo(
|
|
393
|
-
() => h?.getLabel ?? b,
|
|
394
|
-
[h, b]
|
|
395
|
-
);
|
|
396
|
-
H(
|
|
397
|
-
() => !h && t.length > 0,
|
|
398
|
-
"ComboboxVirtualList: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",
|
|
399
|
-
[h, t.length]
|
|
400
|
-
);
|
|
401
|
-
const E = e.useRef(null), {
|
|
402
|
-
value: C,
|
|
403
|
-
onValueChange: L,
|
|
404
|
-
setOpen: V,
|
|
405
|
-
shouldFilter: w,
|
|
406
|
-
searchValue: y,
|
|
407
|
-
filterFn: M,
|
|
408
|
-
setActiveDescendantId: R,
|
|
409
|
-
registerItemsSync: k,
|
|
410
|
-
unregisterItem: N
|
|
411
|
-
} = _(), [p, I] = e.useState(0), A = e.useId();
|
|
412
|
-
e.useImperativeHandle(D, () => E.current, []), e.useLayoutEffect(() => {
|
|
413
|
-
const n = t.map((i) => [
|
|
414
|
-
b(i),
|
|
415
|
-
S(i)
|
|
416
|
-
]);
|
|
417
|
-
return k(n), () => {
|
|
418
|
-
for (const i of t)
|
|
419
|
-
N(b(i));
|
|
256
|
+
he.displayName = "ComboboxInput";
|
|
257
|
+
var xe = e.forwardRef(({ className: t, ...r }, a) => /* @__PURE__ */ c(fe, {
|
|
258
|
+
ref: a,
|
|
259
|
+
className: T("scrollbar min-h-0 flex-1", t),
|
|
260
|
+
"data-slot": "combobox-list",
|
|
261
|
+
...r
|
|
262
|
+
}));
|
|
263
|
+
xe.displayName = "ComboboxList";
|
|
264
|
+
function ge({ items: t, getItemValue: r, getItemLabel: a, getItemKeywords: o, estimateSize: s = 36, overscan: d = 5, children: i, renderEmpty: f, className: C, dataHook: b }, N) {
|
|
265
|
+
const p = e.useMemo(() => X(t, r, a), [
|
|
266
|
+
t,
|
|
267
|
+
r,
|
|
268
|
+
a
|
|
269
|
+
]), m = e.useMemo(() => p?.getValue ?? ((n) => {
|
|
270
|
+
if (typeof n == "string" || typeof n == "number") return String(n);
|
|
271
|
+
throw new Error("[BrightLocal DS] ComboboxVirtualList: `getItemValue` is required for non-primitive items without a `value` property.");
|
|
272
|
+
}), [p]), S = e.useMemo(() => p?.getLabel ?? m, [p, m]);
|
|
273
|
+
B(() => !p && t.length > 0, "ComboboxVirtualList: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.", [p, t.length]);
|
|
274
|
+
const y = e.useRef(null), { value: v, onValueChange: k, setOpen: F, shouldFilter: I, searchValue: w, filterFn: D, setActiveDescendantId: L, registerItemsSync: R, unregisterItem: M } = _(), [h, E] = e.useState(0), A = e.useId();
|
|
275
|
+
e.useImperativeHandle(N, () => y.current, []), e.useLayoutEffect(() => {
|
|
276
|
+
const n = t.map((l) => [m(l), S(l)]);
|
|
277
|
+
return R(n), () => {
|
|
278
|
+
for (const l of t) M(m(l));
|
|
420
279
|
};
|
|
421
|
-
}, [
|
|
422
|
-
|
|
423
|
-
|
|
280
|
+
}, [
|
|
281
|
+
t,
|
|
282
|
+
m,
|
|
283
|
+
S,
|
|
284
|
+
R,
|
|
285
|
+
M
|
|
286
|
+
]);
|
|
287
|
+
const u = e.useMemo(() => {
|
|
288
|
+
if (!I || !w.trim()) return t;
|
|
424
289
|
const n = [];
|
|
425
|
-
for (const
|
|
426
|
-
let g =
|
|
427
|
-
if (o)
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
290
|
+
for (const l of t) {
|
|
291
|
+
let g = p?.hasDistinctLabel ? K(S(l), w) : D(m(l), w);
|
|
292
|
+
if (o) for (const P of o(l)) g = Math.max(g, K(P, w));
|
|
293
|
+
g > 0 && n.push({
|
|
294
|
+
item: l,
|
|
295
|
+
score: g
|
|
296
|
+
});
|
|
431
297
|
}
|
|
432
|
-
return n.sort((
|
|
298
|
+
return n.sort((l, g) => g.score - l.score), n.map((l) => l.item);
|
|
433
299
|
}, [
|
|
434
300
|
t,
|
|
301
|
+
I,
|
|
435
302
|
w,
|
|
436
|
-
|
|
437
|
-
b,
|
|
303
|
+
m,
|
|
438
304
|
S,
|
|
439
305
|
o,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
]),
|
|
443
|
-
count:
|
|
444
|
-
getScrollElement: () =>
|
|
306
|
+
D,
|
|
307
|
+
p?.hasDistinctLabel
|
|
308
|
+
]), V = re({
|
|
309
|
+
count: u.length,
|
|
310
|
+
getScrollElement: () => y.current,
|
|
445
311
|
estimateSize: () => s,
|
|
446
|
-
overscan:
|
|
447
|
-
}), O =
|
|
312
|
+
overscan: d
|
|
313
|
+
}), O = h >= 0 && h < u.length ? m(u[h]) : null;
|
|
448
314
|
e.useEffect(() => {
|
|
449
|
-
|
|
450
|
-
}, [
|
|
315
|
+
E(0);
|
|
316
|
+
}, [w, u.length]);
|
|
451
317
|
const j = e.useRef(!1);
|
|
452
318
|
e.useEffect(() => {
|
|
453
|
-
if (j.current || !
|
|
454
|
-
const n =
|
|
455
|
-
n >= 0 && (
|
|
456
|
-
}, [
|
|
319
|
+
if (j.current || !v) return;
|
|
320
|
+
const n = u.findIndex((l) => m(l) === v);
|
|
321
|
+
n >= 0 && (E(n), V.scrollToIndex(n, { align: "center" }), j.current = !0);
|
|
322
|
+
}, [
|
|
323
|
+
v,
|
|
324
|
+
u,
|
|
325
|
+
m,
|
|
326
|
+
V
|
|
327
|
+
]);
|
|
457
328
|
const $ = e.useRef(!1);
|
|
458
329
|
e.useEffect(() => {
|
|
459
|
-
$.current &&
|
|
460
|
-
}, [
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
330
|
+
$.current && h >= 0 && h < u.length && V.scrollToIndex(h, { align: "auto" }), $.current = !1;
|
|
331
|
+
}, [
|
|
332
|
+
h,
|
|
333
|
+
u.length,
|
|
334
|
+
V
|
|
335
|
+
]), e.useEffect(() => {
|
|
336
|
+
const n = y.current?.closest('[data-slot="combobox-command"]');
|
|
464
337
|
if (!n) return;
|
|
465
|
-
const
|
|
338
|
+
const l = (g) => {
|
|
466
339
|
switch (g.key) {
|
|
467
340
|
case "ArrowDown":
|
|
468
|
-
g.preventDefault(), g.stopPropagation(), $.current = !0,
|
|
469
|
-
(P) => P < c.length - 1 ? P + 1 : P
|
|
470
|
-
);
|
|
341
|
+
g.preventDefault(), g.stopPropagation(), $.current = !0, E((P) => P < u.length - 1 ? P + 1 : P);
|
|
471
342
|
break;
|
|
472
343
|
case "ArrowUp":
|
|
473
|
-
g.preventDefault(), g.stopPropagation(), $.current = !0,
|
|
344
|
+
g.preventDefault(), g.stopPropagation(), $.current = !0, E((P) => P > 0 ? P - 1 : P);
|
|
474
345
|
break;
|
|
475
346
|
case "Enter":
|
|
476
|
-
if (g.preventDefault(), g.stopPropagation(),
|
|
477
|
-
const P =
|
|
478
|
-
|
|
347
|
+
if (g.preventDefault(), g.stopPropagation(), h >= 0 && h < u.length) {
|
|
348
|
+
const P = m(u[h]);
|
|
349
|
+
k(P === v ? "" : P), F(!1);
|
|
479
350
|
}
|
|
480
351
|
break;
|
|
481
352
|
case "Home":
|
|
482
|
-
g.preventDefault(), g.stopPropagation(), $.current = !0,
|
|
353
|
+
g.preventDefault(), g.stopPropagation(), $.current = !0, E(0);
|
|
483
354
|
break;
|
|
484
355
|
case "End":
|
|
485
|
-
g.preventDefault(), g.stopPropagation(), $.current = !0,
|
|
486
|
-
break;
|
|
356
|
+
g.preventDefault(), g.stopPropagation(), $.current = !0, E(u.length - 1);
|
|
487
357
|
}
|
|
488
358
|
};
|
|
489
|
-
return n.addEventListener("keydown",
|
|
490
|
-
}, [
|
|
359
|
+
return n.addEventListener("keydown", l, { capture: !0 }), () => n.removeEventListener("keydown", l, { capture: !0 });
|
|
360
|
+
}, [
|
|
361
|
+
u,
|
|
362
|
+
h,
|
|
363
|
+
v,
|
|
364
|
+
k,
|
|
365
|
+
F,
|
|
366
|
+
m
|
|
367
|
+
]);
|
|
491
368
|
const z = e.useMemo(() => {
|
|
492
369
|
const n = /* @__PURE__ */ new Map();
|
|
493
|
-
return
|
|
494
|
-
n.set(
|
|
370
|
+
return u.forEach((l, g) => {
|
|
371
|
+
n.set(m(l), g);
|
|
495
372
|
}), n;
|
|
496
|
-
}, [
|
|
497
|
-
(n)
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
),
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
"
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
"
|
|
524
|
-
"data-
|
|
525
|
-
role: "listbox",
|
|
526
|
-
children: u
|
|
527
|
-
}
|
|
528
|
-
) : /* @__PURE__ */ d(Q.Provider, { value: W, children: /* @__PURE__ */ d(
|
|
529
|
-
"div",
|
|
530
|
-
{
|
|
531
|
-
ref: E,
|
|
532
|
-
className: T(
|
|
533
|
-
"scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",
|
|
534
|
-
m
|
|
535
|
-
),
|
|
536
|
-
"data-hook": v,
|
|
373
|
+
}, [u, m]), q = e.useCallback((n) => {
|
|
374
|
+
const l = z.get(n);
|
|
375
|
+
l !== void 0 && E(l);
|
|
376
|
+
}, [z]), U = e.useCallback((n) => (z.get(n) ?? 0) + 1, [z]), G = u.length, W = e.useMemo(() => ({
|
|
377
|
+
activeValue: O,
|
|
378
|
+
onItemPointerMove: q,
|
|
379
|
+
idPrefix: A,
|
|
380
|
+
filteredCount: G,
|
|
381
|
+
getItemPosition: U
|
|
382
|
+
}), [
|
|
383
|
+
O,
|
|
384
|
+
q,
|
|
385
|
+
A,
|
|
386
|
+
G,
|
|
387
|
+
U
|
|
388
|
+
]), x = O != null ? `${A}item-${O}` : void 0;
|
|
389
|
+
return e.useEffect(() => (L(x), () => L(void 0)), [x, L]), u.length === 0 ? /* @__PURE__ */ c("div", {
|
|
390
|
+
ref: y,
|
|
391
|
+
className: T("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1", C),
|
|
392
|
+
"data-hook": b,
|
|
393
|
+
"data-slot": "combobox-virtual-list",
|
|
394
|
+
role: "listbox",
|
|
395
|
+
children: f
|
|
396
|
+
}) : /* @__PURE__ */ c(Q.Provider, {
|
|
397
|
+
value: W,
|
|
398
|
+
children: /* @__PURE__ */ c("div", {
|
|
399
|
+
ref: y,
|
|
400
|
+
className: T("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1", C),
|
|
401
|
+
"data-hook": b,
|
|
537
402
|
"data-slot": "combobox-virtual-list",
|
|
538
403
|
role: "listbox",
|
|
539
|
-
children: /* @__PURE__ */
|
|
540
|
-
"
|
|
541
|
-
{
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
},
|
|
553
|
-
children: l(
|
|
554
|
-
c[n.index],
|
|
555
|
-
n.index,
|
|
556
|
-
y
|
|
557
|
-
)
|
|
558
|
-
},
|
|
559
|
-
n.key
|
|
560
|
-
))
|
|
561
|
-
}
|
|
562
|
-
)
|
|
563
|
-
}
|
|
564
|
-
) });
|
|
404
|
+
children: /* @__PURE__ */ c("div", {
|
|
405
|
+
className: "relative w-full",
|
|
406
|
+
style: { height: `${V.getTotalSize()}px` },
|
|
407
|
+
children: V.getVirtualItems().map((n) => /* @__PURE__ */ c("div", {
|
|
408
|
+
ref: V.measureElement,
|
|
409
|
+
className: "absolute top-0 left-0 w-full px-2",
|
|
410
|
+
"data-index": n.index,
|
|
411
|
+
style: { transform: `translateY(${n.start}px)` },
|
|
412
|
+
children: i(u[n.index], n.index, w)
|
|
413
|
+
}, n.key))
|
|
414
|
+
})
|
|
415
|
+
})
|
|
416
|
+
});
|
|
565
417
|
}
|
|
566
|
-
|
|
418
|
+
var Oe = e.forwardRef(ge), Ce = e.forwardRef((t, r) => /* @__PURE__ */ c(le, {
|
|
419
|
+
ref: r,
|
|
420
|
+
"data-slot": "combobox-empty",
|
|
421
|
+
...t
|
|
422
|
+
}));
|
|
567
423
|
Ce.displayName = "ComboboxEmpty";
|
|
568
|
-
|
|
424
|
+
var ye = e.forwardRef(({ children: t, ...r }, a) => {
|
|
569
425
|
const o = e.useRef(null);
|
|
570
|
-
return
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
o.current = s, typeof a == "function" ? a(s) : a && (a.current = s);
|
|
580
|
-
},
|
|
581
|
-
"data-slot": "combobox-group",
|
|
582
|
-
...r,
|
|
583
|
-
children: t
|
|
584
|
-
}
|
|
585
|
-
);
|
|
426
|
+
return B(() => o.current ? o.current.querySelectorAll('[data-slot="combobox-item"]').length >= 100 : !1, `ComboboxGroup contains 100+ items. Use <ComboboxVirtualList> for large datasets to avoid DOM bloat and slow renders.
|
|
427
|
+
Import: import { ComboboxVirtualList } from "@brightlocal/ui-components/combobox"`, [t]), /* @__PURE__ */ c(ce, {
|
|
428
|
+
ref: (s) => {
|
|
429
|
+
o.current = s, typeof a == "function" ? a(s) : a && (a.current = s);
|
|
430
|
+
},
|
|
431
|
+
"data-slot": "combobox-group",
|
|
432
|
+
...r,
|
|
433
|
+
children: t
|
|
434
|
+
});
|
|
586
435
|
});
|
|
587
436
|
ye.displayName = "ComboboxGroup";
|
|
588
437
|
function we(t, r, a) {
|
|
589
|
-
if (!r || !r.trim())
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
),
|
|
595
|
-
return /* @__PURE__ */ d("span", { children: s.map(
|
|
596
|
-
(f, l) => l % 2 === 1 ? /* @__PURE__ */ d("span", { className: a, children: f }, l) : /* @__PURE__ */ d(e.Fragment, { children: f }, l)
|
|
597
|
-
) });
|
|
438
|
+
if (!r || !r.trim()) return t;
|
|
439
|
+
const o = new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`, "gi"), s = t.split(o);
|
|
440
|
+
return /* @__PURE__ */ c("span", { children: s.map((d, i) => i % 2 === 1 ? /* @__PURE__ */ c("span", {
|
|
441
|
+
className: a,
|
|
442
|
+
children: d
|
|
443
|
+
}, i) : /* @__PURE__ */ c(e.Fragment, { children: d }, i)) });
|
|
598
444
|
}
|
|
599
|
-
|
|
600
|
-
(
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
"data-hook": a,
|
|
646
|
-
"data-slot": "combobox-item",
|
|
647
|
-
id: `${L.idPrefix}item-${t}`,
|
|
648
|
-
role: "option",
|
|
649
|
-
tabIndex: -1,
|
|
650
|
-
onClick: I ? void 0 : k,
|
|
651
|
-
onKeyDown: I ? void 0 : (A) => {
|
|
652
|
-
(A.key === "Enter" || A.key === " ") && k();
|
|
653
|
-
},
|
|
654
|
-
onPointerMove: I ? void 0 : () => L.onItemPointerMove(t),
|
|
655
|
-
children: [
|
|
656
|
-
N(),
|
|
657
|
-
V && /* @__PURE__ */ d(
|
|
658
|
-
Y,
|
|
659
|
-
{
|
|
660
|
-
"aria-hidden": "true",
|
|
661
|
-
className: "text-muted-foreground shrink-0"
|
|
662
|
-
}
|
|
663
|
-
)
|
|
664
|
-
]
|
|
665
|
-
}
|
|
666
|
-
);
|
|
667
|
-
}
|
|
668
|
-
return /* @__PURE__ */ B(
|
|
669
|
-
ue,
|
|
670
|
-
{
|
|
671
|
-
ref: D,
|
|
672
|
-
className: T("justify-between", s),
|
|
673
|
-
"data-slot": "combobox-item",
|
|
674
|
-
dataHook: a,
|
|
675
|
-
keywords: u ? [w, ...u] : [w],
|
|
676
|
-
value: t,
|
|
677
|
-
onSelect: k,
|
|
678
|
-
...v,
|
|
679
|
-
children: [
|
|
680
|
-
N(),
|
|
681
|
-
V && /* @__PURE__ */ d(
|
|
682
|
-
Y,
|
|
683
|
-
{
|
|
684
|
-
"aria-hidden": "true",
|
|
685
|
-
className: "text-muted-foreground shrink-0"
|
|
686
|
-
}
|
|
687
|
-
)
|
|
688
|
-
]
|
|
689
|
-
}
|
|
690
|
-
);
|
|
445
|
+
var ke = e.forwardRef(({ value: t, label: r, dataHook: a, children: o, className: s, highlight: d, highlightClassName: i, keywords: f, onSelect: C, ...b }, N) => {
|
|
446
|
+
const { value: p, onValueChange: m, setOpen: S, registerItem: y, unregisterItem: v } = _(), k = e.useContext(Q), F = p === t, I = e.useMemo(() => r || (typeof o == "string" ? o : typeof o == "number" ? String(o) : t), [
|
|
447
|
+
r,
|
|
448
|
+
o,
|
|
449
|
+
t
|
|
450
|
+
]), w = e.useRef(y), D = e.useRef(v);
|
|
451
|
+
e.useEffect(() => {
|
|
452
|
+
w.current = y, D.current = v;
|
|
453
|
+
}, [y, v]);
|
|
454
|
+
const L = !!k;
|
|
455
|
+
e.useEffect(() => {
|
|
456
|
+
if (!L)
|
|
457
|
+
return w.current(t, I), () => D.current(t);
|
|
458
|
+
}, [
|
|
459
|
+
t,
|
|
460
|
+
I,
|
|
461
|
+
L
|
|
462
|
+
]);
|
|
463
|
+
const R = () => {
|
|
464
|
+
m(t === p ? "" : t), S(!1), C?.(t);
|
|
465
|
+
}, M = () => d && typeof o == "string" ? we(o, d, i || "text-label font-semibold") : o;
|
|
466
|
+
if (k) {
|
|
467
|
+
const h = k.activeValue === t, E = !!b.disabled;
|
|
468
|
+
return /* @__PURE__ */ H("div", {
|
|
469
|
+
ref: N,
|
|
470
|
+
"aria-disabled": E || void 0,
|
|
471
|
+
"aria-posinset": k.getItemPosition(t),
|
|
472
|
+
"aria-selected": F,
|
|
473
|
+
"aria-setsize": k.filteredCount,
|
|
474
|
+
className: T("data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground text-label relative flex cursor-pointer items-center justify-between gap-2 rounded-sm px-2 py-3 outline-hidden select-none", "[&_svg]:pointer-events-none [&_svg]:shrink-0", E && "pointer-events-none opacity-50", s),
|
|
475
|
+
"data-highlighted": h || void 0,
|
|
476
|
+
"data-hook": a,
|
|
477
|
+
"data-slot": "combobox-item",
|
|
478
|
+
id: `${k.idPrefix}item-${t}`,
|
|
479
|
+
role: "option",
|
|
480
|
+
tabIndex: -1,
|
|
481
|
+
onClick: E ? void 0 : R,
|
|
482
|
+
onKeyDown: E ? void 0 : (A) => {
|
|
483
|
+
(A.key === "Enter" || A.key === " ") && R();
|
|
484
|
+
},
|
|
485
|
+
onPointerMove: E ? void 0 : () => k.onItemPointerMove(t),
|
|
486
|
+
children: [M(), F && /* @__PURE__ */ c(Y, {
|
|
487
|
+
"aria-hidden": "true",
|
|
488
|
+
className: "text-muted-foreground shrink-0"
|
|
489
|
+
})]
|
|
490
|
+
});
|
|
691
491
|
}
|
|
692
|
-
|
|
492
|
+
return /* @__PURE__ */ H(de, {
|
|
493
|
+
ref: N,
|
|
494
|
+
className: T("justify-between", s),
|
|
495
|
+
"data-slot": "combobox-item",
|
|
496
|
+
dataHook: a,
|
|
497
|
+
keywords: f ? [I, ...f] : [I],
|
|
498
|
+
value: t,
|
|
499
|
+
onSelect: R,
|
|
500
|
+
...b,
|
|
501
|
+
children: [M(), F && /* @__PURE__ */ c(Y, {
|
|
502
|
+
"aria-hidden": "true",
|
|
503
|
+
className: "text-muted-foreground shrink-0"
|
|
504
|
+
})]
|
|
505
|
+
});
|
|
506
|
+
});
|
|
693
507
|
ke.displayName = "ComboboxItem";
|
|
694
|
-
|
|
508
|
+
var Ie = e.forwardRef((t, r) => /* @__PURE__ */ c(me, {
|
|
509
|
+
ref: r,
|
|
510
|
+
"data-slot": "combobox-separator",
|
|
511
|
+
...t
|
|
512
|
+
}));
|
|
695
513
|
Ie.displayName = "ComboboxSeparator";
|
|
696
|
-
function
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
"
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
// (`both` holds the hidden start): a fetch that resolves inside the
|
|
708
|
-
// flash zone never flashes a spinner, which would read slower than
|
|
709
|
-
// no indicator at all. flash-delay draws the delay from
|
|
710
|
-
// --ds-motion-flash-threshold — the same threshold useDelayedPending
|
|
711
|
-
// mirrors in JS.
|
|
712
|
-
"text-body-sm text-muted-foreground relative flex items-center justify-center gap-2 py-6",
|
|
713
|
-
"animate-entrance-fade flash-delay",
|
|
714
|
-
t
|
|
715
|
-
),
|
|
716
|
-
"data-slot": "combobox-loading",
|
|
717
|
-
role: "status",
|
|
718
|
-
children: r || /* @__PURE__ */ B(Z, { children: [
|
|
719
|
-
/* @__PURE__ */ d(be, { size: "md" }),
|
|
720
|
-
/* @__PURE__ */ d("span", { className: "sr-only", children: a ?? "Loading suggestions" })
|
|
721
|
-
] })
|
|
722
|
-
}
|
|
723
|
-
);
|
|
514
|
+
function je({ className: t, children: r, loadingText: a }) {
|
|
515
|
+
return /* @__PURE__ */ c("div", {
|
|
516
|
+
"aria-live": "polite",
|
|
517
|
+
className: T("text-body-sm text-muted-foreground relative flex items-center justify-center gap-2 py-6", "animate-entrance-fade flash-delay", t),
|
|
518
|
+
"data-slot": "combobox-loading",
|
|
519
|
+
role: "status",
|
|
520
|
+
children: r || /* @__PURE__ */ H(ee, { children: [/* @__PURE__ */ c(oe, { size: "md" }), /* @__PURE__ */ c("span", {
|
|
521
|
+
className: "sr-only",
|
|
522
|
+
children: a ?? "Loading suggestions"
|
|
523
|
+
})] })
|
|
524
|
+
});
|
|
724
525
|
}
|
|
725
526
|
export {
|
|
726
|
-
|
|
727
|
-
|
|
527
|
+
Ae as Combobox,
|
|
528
|
+
$e as ComboboxContent,
|
|
728
529
|
Ce as ComboboxEmpty,
|
|
729
530
|
ye as ComboboxGroup,
|
|
730
|
-
|
|
531
|
+
he as ComboboxInput,
|
|
731
532
|
ke as ComboboxItem,
|
|
732
|
-
|
|
733
|
-
|
|
533
|
+
xe as ComboboxList,
|
|
534
|
+
je as ComboboxLoading,
|
|
734
535
|
Ie as ComboboxSeparator,
|
|
735
536
|
pe as ComboboxTrigger,
|
|
736
|
-
|
|
737
|
-
|
|
537
|
+
Te as ComboboxValue,
|
|
538
|
+
Oe as ComboboxVirtualList
|
|
738
539
|
};
|