@aircall/ds 0.37.3 → 0.39.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/dist/{data-table-DdK-5YI9.d.ts → data-table-AHgs5bxe.d.ts} +57 -25
- package/dist/{data-table-DZ2FDkmw.js → data-table-DD7m3puW.js} +326 -18
- package/dist/data-table.d.ts +1 -1
- package/dist/data-table.js +1 -1
- package/dist/globals.css +1 -1
- package/dist/index.d.ts +288 -303
- package/dist/index.js +795 -735
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Button, D as _objectWithoutProperties, E as _objectSpread2, O as cn, S as registerI18nNamespace, T as linkStyle, _ as ActionBarHeight, a as TableFooter, b as detectInitialLanguage, c as TableRow, d as Checkbox, f as Spinner, g as ActionBarContext, h as ActionBarButton, i as TableCell, l as useFetchMoreSentinel, m as ActionBar, n as Table, o as TableHead, p as spinnerVariants, r as TableBody, s as TableHeader, t as DataTable, u as Skeleton, v as useDsTranslation, w as buttonVariants, x as dsI18n, y as SUPPORTED_LANGUAGES } from "./data-table-
|
|
1
|
+
import { C as Button, D as _objectWithoutProperties, E as _objectSpread2, O as cn, S as registerI18nNamespace, T as linkStyle, _ as ActionBarHeight, a as TableFooter, b as detectInitialLanguage, c as TableRow, d as Checkbox, f as Spinner, g as ActionBarContext, h as ActionBarButton, i as TableCell, l as useFetchMoreSentinel, m as ActionBar, n as Table, o as TableHead, p as spinnerVariants, r as TableBody, s as TableHeader, t as DataTable, u as Skeleton, v as useDsTranslation, w as buttonVariants, x as dsI18n, y as SUPPORTED_LANGUAGES } from "./data-table-DD7m3puW.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { createContext, useContext, useSyncExternalStore } from "react";
|
|
4
4
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
@@ -18,10 +18,10 @@ import useEmblaCarousel from "embla-carousel-react";
|
|
|
18
18
|
import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
|
|
19
19
|
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
20
20
|
import { Combobox as Combobox$1 } from "@base-ui/react";
|
|
21
|
-
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
22
|
-
import { useControllableState } from "@aircall/hooks";
|
|
23
21
|
import { Command as Command$1 } from "cmdk";
|
|
24
22
|
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
23
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
24
|
+
import { useControllableState } from "@aircall/hooks";
|
|
25
25
|
import { checkboxesFeature, hotkeysCoreFeature, selectionFeature, syncDataLoaderFeature } from "@headless-tree/core";
|
|
26
26
|
import { useTree } from "@headless-tree/react";
|
|
27
27
|
import { endOfDay, format, getDaysInMonth, startOfDay } from "date-fns";
|
|
@@ -2283,6 +2283,7 @@ SelectTrigger.displayName = "SelectTrigger";
|
|
|
2283
2283
|
const SelectContent = React.forwardRef((componentProps, forwardRef) => {
|
|
2284
2284
|
const { className, children, side = "bottom", sideOffset = 4, align = "start", alignOffset = 0, alignItemWithTrigger = false } = componentProps, props = _objectWithoutProperties(componentProps, _excluded4$24);
|
|
2285
2285
|
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
2286
|
+
positionMethod: "fixed",
|
|
2286
2287
|
side,
|
|
2287
2288
|
sideOffset,
|
|
2288
2289
|
align,
|
|
@@ -3227,8 +3228,12 @@ const InputGroupTextarea = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3227
3228
|
InputGroupTextarea.displayName = "InputGroupTextarea";
|
|
3228
3229
|
//#endregion
|
|
3229
3230
|
//#region src/components/combobox.tsx
|
|
3230
|
-
const _excluded$42 = [
|
|
3231
|
-
|
|
3231
|
+
const _excluded$42 = [
|
|
3232
|
+
"className",
|
|
3233
|
+
"children",
|
|
3234
|
+
"aria-label"
|
|
3235
|
+
];
|
|
3236
|
+
const _excluded2$29 = ["className", "aria-label"];
|
|
3232
3237
|
const _excluded3$22 = [
|
|
3233
3238
|
"className",
|
|
3234
3239
|
"children",
|
|
@@ -3250,7 +3255,11 @@ const _excluded7$6 = ["className"];
|
|
|
3250
3255
|
const _excluded8$6 = ["className"];
|
|
3251
3256
|
const _excluded9$5 = ["className"];
|
|
3252
3257
|
const _excluded10$5 = ["className"];
|
|
3253
|
-
const _excluded11$3 = [
|
|
3258
|
+
const _excluded11$3 = [
|
|
3259
|
+
"className",
|
|
3260
|
+
"children",
|
|
3261
|
+
"showTrigger"
|
|
3262
|
+
];
|
|
3254
3263
|
const _excluded12$3 = [
|
|
3255
3264
|
"className",
|
|
3256
3265
|
"children",
|
|
@@ -3290,9 +3299,12 @@ function ComboboxValue(componentProps) {
|
|
|
3290
3299
|
* trailing chevron icon.
|
|
3291
3300
|
*/
|
|
3292
3301
|
const ComboboxTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
3293
|
-
const { className, children } = componentProps, props = _objectWithoutProperties(componentProps, _excluded$42);
|
|
3302
|
+
const { className, children, "aria-label": ariaLabel } = componentProps, props = _objectWithoutProperties(componentProps, _excluded$42);
|
|
3303
|
+
const t = useDsTranslation("ds");
|
|
3304
|
+
const resolvedAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : children == null ? t("combobox.toggleOptions") : void 0;
|
|
3294
3305
|
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, _objectSpread2(_objectSpread2({
|
|
3295
3306
|
ref: forwardRef,
|
|
3307
|
+
"aria-label": resolvedAriaLabel,
|
|
3296
3308
|
"data-slot": "combobox-trigger",
|
|
3297
3309
|
className: cn("[&_svg:not([class*='size-'])]:size-4", className)
|
|
3298
3310
|
}, props), {}, { children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" })] }));
|
|
@@ -3303,9 +3315,11 @@ ComboboxTrigger.displayName = "ComboboxTrigger";
|
|
|
3303
3315
|
* `<button>` with an X icon.
|
|
3304
3316
|
*/
|
|
3305
3317
|
const ComboboxClear = React.forwardRef((componentProps, forwardRef) => {
|
|
3306
|
-
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$29);
|
|
3318
|
+
const { className, "aria-label": ariaLabel } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$29);
|
|
3319
|
+
const t = useDsTranslation("ds");
|
|
3307
3320
|
return /* @__PURE__ */ jsx(Combobox$1.Clear, _objectSpread2(_objectSpread2({
|
|
3308
3321
|
ref: forwardRef,
|
|
3322
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("combobox.clear"),
|
|
3309
3323
|
"data-slot": "combobox-clear",
|
|
3310
3324
|
render: /* @__PURE__ */ jsx(InputGroupButton, {
|
|
3311
3325
|
variant: "ghost",
|
|
@@ -3321,9 +3335,12 @@ ComboboxClear.displayName = "ComboboxClear";
|
|
|
3321
3335
|
*/
|
|
3322
3336
|
const ComboboxInput = React.forwardRef((componentProps, forwardRef) => {
|
|
3323
3337
|
const { className, children, disabled = false, showTrigger = true, showClear = false } = componentProps, props = _objectWithoutProperties(componentProps, _excluded3$22);
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3338
|
+
const t = useDsTranslation("ds");
|
|
3339
|
+
return /* @__PURE__ */ jsxs(Combobox$1.InputGroup, {
|
|
3340
|
+
render: /* @__PURE__ */ jsx(InputGroup, {
|
|
3341
|
+
ref: forwardRef,
|
|
3342
|
+
className: cn("w-auto", className)
|
|
3343
|
+
}),
|
|
3327
3344
|
children: [
|
|
3328
3345
|
/* @__PURE__ */ jsx(Combobox$1.Input, _objectSpread2({ render: /* @__PURE__ */ jsx(InputGroupInput, { disabled }) }, props)),
|
|
3329
3346
|
/* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
@@ -3332,6 +3349,7 @@ const ComboboxInput = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3332
3349
|
size: "icon-sm",
|
|
3333
3350
|
variant: "ghost",
|
|
3334
3351
|
render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
|
|
3352
|
+
"aria-label": t("combobox.showOptions"),
|
|
3335
3353
|
"data-slot": "input-group-button",
|
|
3336
3354
|
className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",
|
|
3337
3355
|
disabled
|
|
@@ -3354,13 +3372,14 @@ const ComboboxContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3354
3372
|
align,
|
|
3355
3373
|
alignOffset,
|
|
3356
3374
|
anchor,
|
|
3375
|
+
positionMethod: "fixed",
|
|
3357
3376
|
"data-slot": "combobox-positioner",
|
|
3358
3377
|
className: "isolate z-popup",
|
|
3359
3378
|
children: /* @__PURE__ */ jsx(Combobox$1.Popup, _objectSpread2({
|
|
3360
3379
|
ref: forwardRef,
|
|
3361
3380
|
"data-slot": "combobox-content",
|
|
3362
3381
|
"data-chips": !!anchor,
|
|
3363
|
-
className: cn("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[
|
|
3382
|
+
className: cn("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", anchor && "min-w-(--anchor-width)", className)
|
|
3364
3383
|
}, props))
|
|
3365
3384
|
}) });
|
|
3366
3385
|
});
|
|
@@ -3456,15 +3475,29 @@ const ComboboxSeparator = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3456
3475
|
ComboboxSeparator.displayName = "ComboboxSeparator";
|
|
3457
3476
|
/**
|
|
3458
3477
|
* Container for the selected chips in a multi-select combobox, wrapping Base UI's
|
|
3459
|
-
* `Combobox.Chips`. Renders a bordered, wrapping `<div>` that
|
|
3478
|
+
* `Combobox.Chips`. Renders a bordered, wrapping `<div>` that holds the chips, the chip input
|
|
3479
|
+
* and a trailing chevron.
|
|
3480
|
+
*
|
|
3481
|
+
* The chevron is what makes a collapsed field read as a SELECT rather than as a text input that
|
|
3482
|
+
* happens to be empty. An empty chips field is otherwise a bare bordered box: nothing in it says
|
|
3483
|
+
* a list of options is one click away, which is exactly how a filter drawer full of untouched
|
|
3484
|
+
* multi-select fields looked. `ComboboxInput` has always drawn one; this is the same affordance
|
|
3485
|
+
* on the other field shape.
|
|
3486
|
+
*
|
|
3487
|
+
* Pass `showTrigger={false}` for a field that should not advertise a popup.
|
|
3460
3488
|
*/
|
|
3461
3489
|
const ComboboxChips = React.forwardRef((componentProps, forwardRef) => {
|
|
3462
|
-
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded11$3);
|
|
3463
|
-
|
|
3490
|
+
const { className, children, showTrigger = true } = componentProps, props = _objectWithoutProperties(componentProps, _excluded11$3);
|
|
3491
|
+
const t = useDsTranslation("ds");
|
|
3492
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chips, _objectSpread2(_objectSpread2({
|
|
3464
3493
|
ref: forwardRef,
|
|
3465
3494
|
"data-slot": "combobox-chips",
|
|
3466
|
-
className: cn("flex min-h-10 flex-wrap items-center gap-1 rounded-md border border-input bg-background bg-clip-padding py-2 pl-3 pr-
|
|
3467
|
-
}, props)
|
|
3495
|
+
className: cn("relative flex min-h-10 flex-wrap items-center gap-1 rounded-md border border-input bg-background bg-clip-padding py-2 pl-3 pr-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40", className)
|
|
3496
|
+
}, props), {}, { children: [children, showTrigger && /* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
3497
|
+
"data-slot": "combobox-chips-trigger",
|
|
3498
|
+
"aria-label": t("combobox.showOptions"),
|
|
3499
|
+
className: "ml-auto shrink-0 rounded-sm p-1 text-muted-foreground"
|
|
3500
|
+
})] }));
|
|
3468
3501
|
});
|
|
3469
3502
|
ComboboxChips.displayName = "ComboboxChips";
|
|
3470
3503
|
/**
|
|
@@ -3505,520 +3538,72 @@ function useComboboxAnchor() {
|
|
|
3505
3538
|
return React.useRef(null);
|
|
3506
3539
|
}
|
|
3507
3540
|
//#endregion
|
|
3508
|
-
//#region src/components/
|
|
3509
|
-
const
|
|
3510
|
-
const
|
|
3511
|
-
|
|
3541
|
+
//#region src/components/dialog.tsx
|
|
3542
|
+
const _excluded$41 = ["className"];
|
|
3543
|
+
const _excluded2$28 = [
|
|
3544
|
+
"className",
|
|
3545
|
+
"children",
|
|
3546
|
+
"showCloseButton"
|
|
3547
|
+
];
|
|
3548
|
+
const _excluded3$21 = ["className"];
|
|
3549
|
+
const _excluded4$18 = [
|
|
3550
|
+
"className",
|
|
3551
|
+
"showCloseButton",
|
|
3552
|
+
"children"
|
|
3553
|
+
];
|
|
3554
|
+
const _excluded5$13 = ["className"];
|
|
3555
|
+
const _excluded6$11 = ["className"];
|
|
3512
3556
|
/**
|
|
3513
|
-
*
|
|
3514
|
-
*
|
|
3515
|
-
* list path).
|
|
3557
|
+
* Root of the dialog, wrapping Base UI's `Dialog.Root`. Manages open/close state and renders no DOM
|
|
3558
|
+
* element — place `DialogTrigger` and `DialogContent` inside it.
|
|
3516
3559
|
*
|
|
3517
|
-
*
|
|
3518
|
-
*
|
|
3519
|
-
*
|
|
3520
|
-
*
|
|
3560
|
+
* @example
|
|
3561
|
+
* ```tsx
|
|
3562
|
+
* <Dialog>
|
|
3563
|
+
* <DialogTrigger render={<Button />}>Open</DialogTrigger>
|
|
3564
|
+
* <DialogContent>
|
|
3565
|
+
* <DialogHeader>
|
|
3566
|
+
* <DialogTitle>Title</DialogTitle>
|
|
3567
|
+
* <DialogDescription>Description</DialogDescription>
|
|
3568
|
+
* </DialogHeader>
|
|
3569
|
+
* </DialogContent>
|
|
3570
|
+
* </Dialog>
|
|
3571
|
+
* ```
|
|
3521
3572
|
*/
|
|
3522
|
-
function
|
|
3523
|
-
return
|
|
3524
|
-
if (!getGroupKey) return null;
|
|
3525
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
3526
|
-
for (const item of items) {
|
|
3527
|
-
const gk = getGroupKey(item);
|
|
3528
|
-
const bucket = byKey.get(gk);
|
|
3529
|
-
if (bucket) bucket.push(item);
|
|
3530
|
-
else byKey.set(gk, [item]);
|
|
3531
|
-
}
|
|
3532
|
-
return Array.from(byKey, ([groupKey, groupItems]) => ({
|
|
3533
|
-
groupKey,
|
|
3534
|
-
label: getGroupLabel ? getGroupLabel(groupKey) : groupKey,
|
|
3535
|
-
items: groupItems
|
|
3536
|
-
}));
|
|
3537
|
-
}, [
|
|
3538
|
-
items,
|
|
3539
|
-
getGroupKey,
|
|
3540
|
-
getGroupLabel
|
|
3541
|
-
]);
|
|
3573
|
+
function Dialog(componentProps) {
|
|
3574
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, _objectSpread2({ "data-slot": "dialog" }, componentProps));
|
|
3542
3575
|
}
|
|
3543
3576
|
/**
|
|
3544
|
-
*
|
|
3545
|
-
*
|
|
3546
|
-
* skeleton rows, the filtering dim-overlay, the empty state, and the load-more
|
|
3547
|
-
* spinner row. It stops at the rows: the search input and any popup chrome
|
|
3548
|
-
* belong to whichever root renders this.
|
|
3549
|
-
*
|
|
3550
|
-
* Must be rendered inside a `Combobox` root whose `items` is `groups ?? items`.
|
|
3551
|
-
* Internal to the package: not exported from `src/index.ts`.
|
|
3577
|
+
* Button that opens the dialog, wrapping Base UI's `Dialog.Trigger`. Renders a `<button>` by
|
|
3578
|
+
* default (override with `render`).
|
|
3552
3579
|
*/
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
const lastRenderedItem = ((_groups$at$items = groups === null || groups === void 0 || (_groups$at = groups.at(-1)) === null || _groups$at === void 0 ? void 0 : _groups$at.items) !== null && _groups$at$items !== void 0 ? _groups$at$items : items).at(-1);
|
|
3562
|
-
const lastItemKey = lastRenderedItem ? getItemValue(lastRenderedItem) : void 0;
|
|
3563
|
-
const renderRow = (item) => {
|
|
3564
|
-
var _disabledKeys$has;
|
|
3565
|
-
const key = getItemValue(item);
|
|
3566
|
-
const attachSentinel = showFetchSentinel && !virtualizeRows && key === lastItemKey;
|
|
3567
|
-
return /* @__PURE__ */ jsx(ComboboxItem, {
|
|
3568
|
-
value: item,
|
|
3569
|
-
disabled: (_disabledKeys$has = disabledKeys === null || disabledKeys === void 0 ? void 0 : disabledKeys.has(key)) !== null && _disabledKeys$has !== void 0 ? _disabledKeys$has : false,
|
|
3570
|
-
ref: attachSentinel ? sentinelRef : void 0,
|
|
3571
|
-
"data-test": attachSentinel ? "fetch-sentinel" : void 0,
|
|
3572
|
-
children: renderItem ? renderItem(item) : getItemLabel(item)
|
|
3573
|
-
}, key);
|
|
3574
|
-
};
|
|
3575
|
-
const hasRows = items.length > 0;
|
|
3576
|
-
const virtualRows = virtualizeRows ? /* @__PURE__ */ jsx(ComboboxVirtualRows, {
|
|
3577
|
-
getItemValue,
|
|
3578
|
-
getItemLabel,
|
|
3579
|
-
renderItem,
|
|
3580
|
-
disabledKeys,
|
|
3581
|
-
estimateRowHeight,
|
|
3582
|
-
sentinelRef,
|
|
3583
|
-
showFetchSentinel,
|
|
3584
|
-
scrollRowIntoViewRef
|
|
3585
|
-
}) : null;
|
|
3586
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
3587
|
-
"data-slot": "combobox-rows",
|
|
3588
|
-
className: cn("relative", isFiltering && !hasRows && "min-h-24"),
|
|
3589
|
-
children: [isInitialLoading ? /* @__PURE__ */ jsx(ComboboxSkeletonRows, { count: skeletonCount }) : /* @__PURE__ */ jsx(ComboboxLoadedRows, {
|
|
3590
|
-
groups,
|
|
3591
|
-
renderRow,
|
|
3592
|
-
virtualRows,
|
|
3593
|
-
isFiltering,
|
|
3594
|
-
isLoadingMore,
|
|
3595
|
-
emptyState,
|
|
3596
|
-
listClassName,
|
|
3597
|
-
listTabIndex,
|
|
3598
|
-
"aria-label": ariaLabel
|
|
3599
|
-
}), isFiltering ? /* @__PURE__ */ jsx(ComboboxFilteringOverlay, {}) : null]
|
|
3600
|
-
});
|
|
3601
|
-
}
|
|
3602
|
-
/** The loaded rows region: the list itself, the empty state, and the load-more spinner row. */
|
|
3603
|
-
function ComboboxLoadedRows(componentProps) {
|
|
3604
|
-
const { groups, renderRow, virtualRows, isFiltering, isLoadingMore, emptyState, listClassName, listTabIndex, "aria-label": ariaLabel } = componentProps;
|
|
3605
|
-
const t = useDsTranslation("ds");
|
|
3606
|
-
const listChildren = virtualRows !== null && virtualRows !== void 0 ? virtualRows : groups === null ? renderRow : renderGroupSection(renderRow);
|
|
3607
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3608
|
-
/* @__PURE__ */ jsx(ComboboxList, _objectSpread2(_objectSpread2({
|
|
3609
|
-
"aria-label": ariaLabel,
|
|
3610
|
-
className: listClassName
|
|
3611
|
-
}, listTabIndex === void 0 ? {} : { tabIndex: listTabIndex }), {}, { children: listChildren })),
|
|
3612
|
-
isFiltering ? null : /* @__PURE__ */ jsx(ComboboxEmpty, {
|
|
3613
|
-
className: "flex empty:hidden",
|
|
3614
|
-
children: emptyState !== null && emptyState !== void 0 ? emptyState : t("dataCombobox.noResults")
|
|
3615
|
-
}),
|
|
3616
|
-
isLoadingMore ? /* @__PURE__ */ jsx(SpinnerRow, {}) : null
|
|
3617
|
-
] });
|
|
3618
|
-
}
|
|
3580
|
+
const DialogTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
3581
|
+
const props = _extends({}, (_objectDestructuringEmpty(componentProps), componentProps));
|
|
3582
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, _objectSpread2({
|
|
3583
|
+
ref: forwardRef,
|
|
3584
|
+
"data-slot": "dialog-trigger"
|
|
3585
|
+
}, props));
|
|
3586
|
+
});
|
|
3587
|
+
DialogTrigger.displayName = "DialogTrigger";
|
|
3619
3588
|
/**
|
|
3620
|
-
*
|
|
3621
|
-
*
|
|
3622
|
-
* twenty rows in the DOM.
|
|
3623
|
-
*
|
|
3624
|
-
* Reads the rows from Base UI's `useFilteredItems` rather than from the `items`
|
|
3625
|
-
* prop: with client-side filtering on, the window must slide over the FILTERED
|
|
3626
|
-
* rows, and the flat index of a filtered row is exactly what Base UI's keyboard
|
|
3627
|
-
* navigation, `aria-activedescendant` and Enter-to-select are indexed by. That
|
|
3628
|
-
* index is passed to every row explicitly — the automatic DOM-order index is
|
|
3629
|
-
* meaningless when only a window is mounted.
|
|
3589
|
+
* Portals dialog content into the document body, wrapping Base UI's `Dialog.Portal`. Renders no DOM
|
|
3590
|
+
* element of its own.
|
|
3630
3591
|
*/
|
|
3631
|
-
function
|
|
3632
|
-
"
|
|
3633
|
-
var _spacerElement$closes;
|
|
3634
|
-
const { getItemValue, getItemLabel, renderItem, disabledKeys, estimateRowHeight, sentinelRef, showFetchSentinel, scrollRowIntoViewRef } = componentProps;
|
|
3635
|
-
const filteredItems = Combobox$1.useFilteredItems();
|
|
3636
|
-
const [spacerElement, setSpacerElement] = React.useState(null);
|
|
3637
|
-
const scrollElement = (_spacerElement$closes = spacerElement === null || spacerElement === void 0 ? void 0 : spacerElement.closest("[data-slot=\"combobox-list\"]")) !== null && _spacerElement$closes !== void 0 ? _spacerElement$closes : null;
|
|
3638
|
-
const rowVirtualizer = useVirtualizer({
|
|
3639
|
-
count: filteredItems.length,
|
|
3640
|
-
getScrollElement: () => scrollElement,
|
|
3641
|
-
estimateSize: () => estimateRowHeight,
|
|
3642
|
-
overscan: VIRTUAL_ROW_OVERSCAN
|
|
3643
|
-
});
|
|
3644
|
-
React.useEffect(() => {
|
|
3645
|
-
if (!scrollRowIntoViewRef) return void 0;
|
|
3646
|
-
scrollRowIntoViewRef.current = (index) => rowVirtualizer.scrollToIndex(index, { align: "auto" });
|
|
3647
|
-
return () => {
|
|
3648
|
-
scrollRowIntoViewRef.current = null;
|
|
3649
|
-
};
|
|
3650
|
-
}, [rowVirtualizer, scrollRowIntoViewRef]);
|
|
3651
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
3652
|
-
ref: setSpacerElement,
|
|
3653
|
-
"data-slot": "combobox-virtual-rows",
|
|
3654
|
-
className: "relative w-full",
|
|
3655
|
-
style: { height: rowVirtualizer.getTotalSize() },
|
|
3656
|
-
children: [rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
3657
|
-
var _disabledKeys$has2;
|
|
3658
|
-
const item = filteredItems[virtualRow.index];
|
|
3659
|
-
if (item === void 0) return null;
|
|
3660
|
-
const key = getItemValue(item);
|
|
3661
|
-
return /* @__PURE__ */ jsx(ComboboxItem, {
|
|
3662
|
-
index: virtualRow.index,
|
|
3663
|
-
value: item,
|
|
3664
|
-
disabled: (_disabledKeys$has2 = disabledKeys === null || disabledKeys === void 0 ? void 0 : disabledKeys.has(key)) !== null && _disabledKeys$has2 !== void 0 ? _disabledKeys$has2 : false,
|
|
3665
|
-
ref: rowVirtualizer.measureElement,
|
|
3666
|
-
"data-index": virtualRow.index,
|
|
3667
|
-
style: {
|
|
3668
|
-
position: "absolute",
|
|
3669
|
-
top: 0,
|
|
3670
|
-
left: 0,
|
|
3671
|
-
width: "100%",
|
|
3672
|
-
transform: `translateY(${virtualRow.start}px)`
|
|
3673
|
-
},
|
|
3674
|
-
children: renderItem ? renderItem(item) : getItemLabel(item)
|
|
3675
|
-
}, key);
|
|
3676
|
-
}), showFetchSentinel && filteredItems.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
3677
|
-
ref: sentinelRef,
|
|
3678
|
-
"aria-hidden": true,
|
|
3679
|
-
"data-test": "fetch-sentinel",
|
|
3680
|
-
"data-slot": "combobox-fetch-sentinel",
|
|
3681
|
-
className: "absolute bottom-0 h-px w-full"
|
|
3682
|
-
}) : null]
|
|
3683
|
-
});
|
|
3592
|
+
function DialogPortal(componentProps) {
|
|
3593
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, _objectSpread2({ "data-slot": "dialog-portal" }, componentProps));
|
|
3684
3594
|
}
|
|
3685
3595
|
/**
|
|
3686
|
-
*
|
|
3687
|
-
*
|
|
3688
|
-
* returned function once per group from the Root's grouped `items`.
|
|
3596
|
+
* Button that closes the dialog, wrapping Base UI's `Dialog.Close`. Renders a `<button>` by default
|
|
3597
|
+
* (override with `render`).
|
|
3689
3598
|
*/
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
}
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
return /* @__PURE__ */ jsx("div", {
|
|
3699
|
-
"data-slot": "combobox-loading-overlay",
|
|
3700
|
-
className: "bg-popover/60 absolute inset-0 z-10 flex items-center justify-center",
|
|
3701
|
-
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
3702
|
-
});
|
|
3703
|
-
}
|
|
3704
|
-
/**
|
|
3705
|
-
* A centered spinner row for the filtering and load-more states. Not
|
|
3706
|
-
* `aria-hidden` — the `Spinner`'s `role="status"` announces loading to screen
|
|
3707
|
-
* readers (that's the point of a loading indicator).
|
|
3708
|
-
*/
|
|
3709
|
-
function SpinnerRow() {
|
|
3710
|
-
return /* @__PURE__ */ jsx("div", {
|
|
3711
|
-
"data-slot": "combobox-spinner-row",
|
|
3712
|
-
className: "flex justify-center py-2 text-muted-foreground",
|
|
3713
|
-
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
3714
|
-
});
|
|
3715
|
-
}
|
|
3716
|
-
/** Skeleton rows, padded like the list, shown while the initial page loads. */
|
|
3717
|
-
function ComboboxSkeletonRows({ count }) {
|
|
3718
|
-
return /* @__PURE__ */ jsx("div", {
|
|
3719
|
-
"data-slot": "combobox-skeleton-rows",
|
|
3720
|
-
className: "p-1",
|
|
3721
|
-
children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx("div", {
|
|
3722
|
-
"aria-hidden": true,
|
|
3723
|
-
"data-test": "loading-item",
|
|
3724
|
-
"data-slot": "combobox-skeleton-row",
|
|
3725
|
-
className: "flex items-center gap-2 rounded-md p-2",
|
|
3726
|
-
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" })
|
|
3727
|
-
}, `skeleton-${i}`))
|
|
3728
|
-
});
|
|
3729
|
-
}
|
|
3730
|
-
//#endregion
|
|
3731
|
-
//#region src/lib/use-combobox-item-selection.ts
|
|
3732
|
-
const EMPTY_KEYS = /* @__PURE__ */ new Set();
|
|
3733
|
-
/**
|
|
3734
|
-
* The `onInputValueChange` reasons a POPUP combobox forwards to `onSearch`
|
|
3735
|
-
* (`DataCombobox`'s three layouts):
|
|
3736
|
-
* - `input-change` — real typing/paste.
|
|
3737
|
-
* - `input-clear` — Base UI clears the field itself after a selection.
|
|
3738
|
-
* - `clear-press` — the input's clear (x) button.
|
|
3739
|
-
*
|
|
3740
|
-
* `escape-key` is deliberately absent: with a popup, Escape CLOSES it rather
|
|
3741
|
-
* than clearing the query, so forwarding it would refetch on every dismissal.
|
|
3742
|
-
*/
|
|
3743
|
-
const POPUP_SEARCH_TRIGGER_REASONS = /* @__PURE__ */ new Set([
|
|
3744
|
-
"input-change",
|
|
3745
|
-
"input-clear",
|
|
3746
|
-
"clear-press"
|
|
3747
|
-
]);
|
|
3748
|
-
/**
|
|
3749
|
-
* The `onInputValueChange` reasons an INLINE combobox forwards to `onSearch`
|
|
3750
|
-
* (`ComboboxBody`). Same as the popup set plus `escape-key`.
|
|
3751
|
-
*
|
|
3752
|
-
* With no popup, Escape is the inline list's RESET: Base UI empties the query and
|
|
3753
|
-
* clears the selection under that reason. Forwarding it keeps the consumer's data
|
|
3754
|
-
* in step with the reset it just performed — otherwise the component presents
|
|
3755
|
-
* itself as reset while the caller keeps serving the previous query's page.
|
|
3756
|
-
*/
|
|
3757
|
-
const INLINE_SEARCH_TRIGGER_REASONS = /* @__PURE__ */ new Set([
|
|
3758
|
-
"input-change",
|
|
3759
|
-
"input-clear",
|
|
3760
|
-
"clear-press",
|
|
3761
|
-
"escape-key"
|
|
3762
|
-
]);
|
|
3763
|
-
/**
|
|
3764
|
-
* Bridges a `Set<string>` of selected keys to the item objects Base UI's
|
|
3765
|
-
* Combobox root wants for `value` / `onValueChange`, and gates the input's
|
|
3766
|
-
* value changes down to real search queries.
|
|
3767
|
-
*
|
|
3768
|
-
* Shared by `DataCombobox` and `ComboboxBody` — both own a Combobox root and
|
|
3769
|
-
* need the identical selection semantics. Internal to the package: not exported
|
|
3770
|
-
* from `src/index.ts`.
|
|
3771
|
-
*
|
|
3772
|
-
* @example
|
|
3773
|
-
* ```tsx
|
|
3774
|
-
* const { keys, selectedObjects, commit, handleInputValueChange } =
|
|
3775
|
-
* useComboboxItemSelection({ items, getItemValue, selectedKeys, onSelectionChange });
|
|
3776
|
-
* ```
|
|
3777
|
-
*/
|
|
3778
|
-
function useComboboxItemSelection(options) {
|
|
3779
|
-
const { items, getItemValue, selectedItems, selectedKeys, defaultSelectedKeys, onSelectionChange, onSearch, searchTriggerReasons = POPUP_SEARCH_TRIGGER_REASONS } = options;
|
|
3780
|
-
const itemCacheRef = React.useRef(/* @__PURE__ */ new Map());
|
|
3781
|
-
if (selectedItems) for (const item of selectedItems) itemCacheRef.current.set(getItemValue(item), item);
|
|
3782
|
-
for (const item of items) itemCacheRef.current.set(getItemValue(item), item);
|
|
3783
|
-
const itemCache = itemCacheRef.current;
|
|
3784
|
-
const [selectionSet, setSelectionSet] = useControllableState({
|
|
3785
|
-
prop: selectedKeys,
|
|
3786
|
-
defaultProp: defaultSelectedKeys
|
|
3787
|
-
});
|
|
3788
|
-
const keys = selectionSet !== null && selectionSet !== void 0 ? selectionSet : EMPTY_KEYS;
|
|
3789
|
-
const selectedObjects = [];
|
|
3790
|
-
for (const key of keys) {
|
|
3791
|
-
const item = itemCache.get(key);
|
|
3792
|
-
if (item) selectedObjects.push(item);
|
|
3793
|
-
}
|
|
3794
|
-
return {
|
|
3795
|
-
keys,
|
|
3796
|
-
selectedObjects,
|
|
3797
|
-
commit: React.useCallback((objs, details) => {
|
|
3798
|
-
const next = new Set(objs.map(getItemValue));
|
|
3799
|
-
setSelectionSet(next);
|
|
3800
|
-
onSelectionChange === null || onSelectionChange === void 0 || onSelectionChange(next, details);
|
|
3801
|
-
}, [
|
|
3802
|
-
setSelectionSet,
|
|
3803
|
-
getItemValue,
|
|
3804
|
-
onSelectionChange
|
|
3805
|
-
]),
|
|
3806
|
-
handleInputValueChange: onSearch ? (value, details) => {
|
|
3807
|
-
if (searchTriggerReasons.has(details.reason)) onSearch(value);
|
|
3808
|
-
} : void 0
|
|
3809
|
-
};
|
|
3810
|
-
}
|
|
3811
|
-
//#endregion
|
|
3812
|
-
//#region src/components/combobox-body.tsx
|
|
3813
|
-
const LIST_MAX_HEIGHT = "max-h-63";
|
|
3814
|
-
const INPUT_IN_LIST_CLASSES = "m-1 mb-0 border-input/30 bg-input/30 shadow-none";
|
|
3815
|
-
const FOCUSABLE_LIST_CLASSES = "focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset";
|
|
3816
|
-
/**
|
|
3817
|
-
* Row count at which `ComboboxBody` virtualises its rows on its own, when `virtualizeRows` was not
|
|
3818
|
-
* passed either way. Exported so it can be asserted against and tuned in ONE place.
|
|
3819
|
-
*
|
|
3820
|
-
* Crossing it LATCHES virtualisation on for the life of the component - see the `virtualizeRows`
|
|
3821
|
-
* prop doc. A list that declares `onFetchMore` can grow without bound, so it starts out virtualised
|
|
3822
|
-
* regardless of this number rather than waiting to cross it.
|
|
3823
|
-
*
|
|
3824
|
-
* A STARTING POINT, not a measured optimum. The two real data points behind it: 244 countries with
|
|
3825
|
-
* a flag per row was visibly laggy unvirtualised, and the user lists are server-capped at 10 rows
|
|
3826
|
-
* today, so both known cases sit far from this line and the exact value is not load-bearing yet.
|
|
3827
|
-
* Measure before tuning it - the honest cost driver is how expensive `renderItem` is, not the row
|
|
3828
|
-
* count alone, and a threshold cannot see that.
|
|
3829
|
-
*/
|
|
3830
|
-
const COMBOBOX_AUTO_VIRTUALIZE_THRESHOLD = 100;
|
|
3831
|
-
/**
|
|
3832
|
-
* Scrolls a keyboard-highlighted row into view while rows are virtualised.
|
|
3833
|
-
* A no-op without virtualisation (nothing fills the ref), for a pointer-driven
|
|
3834
|
-
* highlight (the row is already under the cursor, so already mounted), and when
|
|
3835
|
-
* the highlight was cleared (index `-1`).
|
|
3836
|
-
*/
|
|
3837
|
-
function scrollHighlightedRowIntoView(scrollRowIntoViewRef, index, reason) {
|
|
3838
|
-
var _scrollRowIntoViewRef;
|
|
3839
|
-
if (reason === "pointer" || index < 0) return;
|
|
3840
|
-
(_scrollRowIntoViewRef = scrollRowIntoViewRef.current) === null || _scrollRowIntoViewRef === void 0 || _scrollRowIntoViewRef.call(scrollRowIntoViewRef, index);
|
|
3841
|
-
}
|
|
3842
|
-
/**
|
|
3843
|
-
* A data-driven combobox list with NO trigger and NO popup of its own: an
|
|
3844
|
-
* optional search input above a selectable list, ready to be dropped into a
|
|
3845
|
-
* surface the caller owns (a `Filter` popover, a panel, a dialog). Driven by an
|
|
3846
|
-
* `items` array plus `getItemValue`/`getItemLabel`, with opt-in server-side
|
|
3847
|
-
* search, grouping, infinite scroll, and loading/empty states.
|
|
3848
|
-
*
|
|
3849
|
-
* Use `DataCombobox` instead when you want the field-plus-popup combobox. This
|
|
3850
|
-
* is the same rows region plus an optional search input, without the field or the
|
|
3851
|
-
* popup around them, so the host controls open state, dismissal and positioning.
|
|
3852
|
-
* The name pairs with `ComboboxContent`, which is the popup this deliberately
|
|
3853
|
-
* does not have.
|
|
3854
|
-
*
|
|
3855
|
-
* Dismissal note: with no popup of its own, this holds no dismiss layer, so an
|
|
3856
|
-
* outside press or Escape always reaches the host. Escape ALSO resets the list —
|
|
3857
|
-
* clearing the query and the selection, the combobox convention for a list with
|
|
3858
|
-
* nothing open — but only while the search box is untouched; once the user has
|
|
3859
|
-
* clicked or typed in it, Base UI treats the list as open and Escape just
|
|
3860
|
-
* dismisses. The reset is forwarded to `onSearch('')` so a server-driven list
|
|
3861
|
-
* comes back unfiltered instead of stranding the previous query's page. Dismiss
|
|
3862
|
-
* via an outside press (or the host's own close affordance) when the selection
|
|
3863
|
-
* must survive.
|
|
3864
|
-
*
|
|
3865
|
-
* @example
|
|
3866
|
-
* ```tsx
|
|
3867
|
-
* <ComboboxBody
|
|
3868
|
-
* items={statuses}
|
|
3869
|
-
* getItemValue={status => status.id}
|
|
3870
|
-
* getItemLabel={status => status.label}
|
|
3871
|
-
* selectionMode="multiple"
|
|
3872
|
-
* selectedKeys={selectedKeys}
|
|
3873
|
-
* onSelectionChange={setSelectedKeys}
|
|
3874
|
-
* />
|
|
3875
|
-
* ```
|
|
3876
|
-
*/
|
|
3877
|
-
function ComboboxBody(componentProps) {
|
|
3878
|
-
var _componentProps$virtu, _selectedObjects$;
|
|
3879
|
-
const { items, getItemValue, getItemLabel, renderItem, getGroupKey, getGroupLabel, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, selectedItems, disabledKeys, loadingState = "idle", skeletonCount, onSearch, onFetchMore, hasMore = false, emptyState, estimateRowHeight, searchable = true, placeholder, className, "aria-label": ariaLabel } = componentProps;
|
|
3880
|
-
const multiple = selectionMode === "multiple";
|
|
3881
|
-
const autoVirtualizeLatch = React.useRef(false);
|
|
3882
|
-
if (!autoVirtualizeLatch.current) autoVirtualizeLatch.current = !!onFetchMore || items.length >= 100;
|
|
3883
|
-
const virtualizeRows = ((_componentProps$virtu = componentProps.virtualizeRows) !== null && _componentProps$virtu !== void 0 ? _componentProps$virtu : autoVirtualizeLatch.current) && !getGroupKey;
|
|
3884
|
-
const scrollRowIntoViewRef = React.useRef(null);
|
|
3885
|
-
const { selectedObjects, commit, handleInputValueChange } = useComboboxItemSelection({
|
|
3886
|
-
items,
|
|
3887
|
-
getItemValue,
|
|
3888
|
-
selectedItems,
|
|
3889
|
-
selectedKeys,
|
|
3890
|
-
defaultSelectedKeys,
|
|
3891
|
-
onSelectionChange,
|
|
3892
|
-
onSearch,
|
|
3893
|
-
searchTriggerReasons: INLINE_SEARCH_TRIGGER_REASONS
|
|
3894
|
-
});
|
|
3895
|
-
const groups = useComboboxItemGroups(items, getGroupKey, getGroupLabel);
|
|
3896
|
-
const body = /* @__PURE__ */ jsxs("div", {
|
|
3897
|
-
"data-slot": "combobox-body",
|
|
3898
|
-
className: cn("flex w-full flex-col", className),
|
|
3899
|
-
children: [searchable ? /* @__PURE__ */ jsx(ComboboxInput, {
|
|
3900
|
-
showTrigger: false,
|
|
3901
|
-
placeholder,
|
|
3902
|
-
className: INPUT_IN_LIST_CLASSES
|
|
3903
|
-
}) : null, /* @__PURE__ */ jsx(ComboboxRows, {
|
|
3904
|
-
items,
|
|
3905
|
-
groups,
|
|
3906
|
-
getItemValue,
|
|
3907
|
-
getItemLabel,
|
|
3908
|
-
renderItem,
|
|
3909
|
-
disabledKeys,
|
|
3910
|
-
loadingState,
|
|
3911
|
-
skeletonCount,
|
|
3912
|
-
onFetchMore,
|
|
3913
|
-
hasMore,
|
|
3914
|
-
emptyState,
|
|
3915
|
-
listClassName: cn(LIST_MAX_HEIGHT, !searchable && FOCUSABLE_LIST_CLASSES),
|
|
3916
|
-
listTabIndex: searchable ? void 0 : 0,
|
|
3917
|
-
virtualizeRows,
|
|
3918
|
-
estimateRowHeight,
|
|
3919
|
-
scrollRowIntoViewRef,
|
|
3920
|
-
"aria-label": ariaLabel
|
|
3921
|
-
})]
|
|
3922
|
-
});
|
|
3923
|
-
if (multiple) return /* @__PURE__ */ jsx(Combobox, {
|
|
3924
|
-
multiple: true,
|
|
3925
|
-
inline: true,
|
|
3926
|
-
autoHighlight: true,
|
|
3927
|
-
virtualized: virtualizeRows,
|
|
3928
|
-
onItemHighlighted: (_item, details) => scrollHighlightedRowIntoView(scrollRowIntoViewRef, details.index, details.reason),
|
|
3929
|
-
items: groups !== null && groups !== void 0 ? groups : items,
|
|
3930
|
-
filter: onSearch || onFetchMore && hasMore ? null : void 0,
|
|
3931
|
-
value: selectedObjects,
|
|
3932
|
-
onValueChange: commit,
|
|
3933
|
-
itemToStringValue: getItemValue,
|
|
3934
|
-
itemToStringLabel: getItemLabel,
|
|
3935
|
-
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
3936
|
-
onInputValueChange: handleInputValueChange,
|
|
3937
|
-
children: body
|
|
3938
|
-
}, selectionMode);
|
|
3939
|
-
return /* @__PURE__ */ jsx(Combobox, {
|
|
3940
|
-
inline: true,
|
|
3941
|
-
autoHighlight: true,
|
|
3942
|
-
virtualized: virtualizeRows,
|
|
3943
|
-
onItemHighlighted: (_item, details) => scrollHighlightedRowIntoView(scrollRowIntoViewRef, details.index, details.reason),
|
|
3944
|
-
items: groups !== null && groups !== void 0 ? groups : items,
|
|
3945
|
-
filter: onSearch || onFetchMore && hasMore ? null : void 0,
|
|
3946
|
-
value: (_selectedObjects$ = selectedObjects[0]) !== null && _selectedObjects$ !== void 0 ? _selectedObjects$ : null,
|
|
3947
|
-
onValueChange: (next, details) => commit(next == null ? [] : [next], details),
|
|
3948
|
-
itemToStringValue: getItemValue,
|
|
3949
|
-
itemToStringLabel: getItemLabel,
|
|
3950
|
-
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
3951
|
-
onInputValueChange: handleInputValueChange,
|
|
3952
|
-
children: body
|
|
3953
|
-
}, selectionMode);
|
|
3954
|
-
}
|
|
3955
|
-
//#endregion
|
|
3956
|
-
//#region src/components/dialog.tsx
|
|
3957
|
-
const _excluded$41 = ["className"];
|
|
3958
|
-
const _excluded2$28 = [
|
|
3959
|
-
"className",
|
|
3960
|
-
"children",
|
|
3961
|
-
"showCloseButton"
|
|
3962
|
-
];
|
|
3963
|
-
const _excluded3$21 = ["className"];
|
|
3964
|
-
const _excluded4$18 = [
|
|
3965
|
-
"className",
|
|
3966
|
-
"showCloseButton",
|
|
3967
|
-
"children"
|
|
3968
|
-
];
|
|
3969
|
-
const _excluded5$13 = ["className"];
|
|
3970
|
-
const _excluded6$11 = ["className"];
|
|
3971
|
-
/**
|
|
3972
|
-
* Root of the dialog, wrapping Base UI's `Dialog.Root`. Manages open/close state and renders no DOM
|
|
3973
|
-
* element — place `DialogTrigger` and `DialogContent` inside it.
|
|
3974
|
-
*
|
|
3975
|
-
* @example
|
|
3976
|
-
* ```tsx
|
|
3977
|
-
* <Dialog>
|
|
3978
|
-
* <DialogTrigger render={<Button />}>Open</DialogTrigger>
|
|
3979
|
-
* <DialogContent>
|
|
3980
|
-
* <DialogHeader>
|
|
3981
|
-
* <DialogTitle>Title</DialogTitle>
|
|
3982
|
-
* <DialogDescription>Description</DialogDescription>
|
|
3983
|
-
* </DialogHeader>
|
|
3984
|
-
* </DialogContent>
|
|
3985
|
-
* </Dialog>
|
|
3986
|
-
* ```
|
|
3987
|
-
*/
|
|
3988
|
-
function Dialog(componentProps) {
|
|
3989
|
-
return /* @__PURE__ */ jsx(Dialog$1.Root, _objectSpread2({ "data-slot": "dialog" }, componentProps));
|
|
3990
|
-
}
|
|
3991
|
-
/**
|
|
3992
|
-
* Button that opens the dialog, wrapping Base UI's `Dialog.Trigger`. Renders a `<button>` by
|
|
3993
|
-
* default (override with `render`).
|
|
3994
|
-
*/
|
|
3995
|
-
const DialogTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
3996
|
-
const props = _extends({}, (_objectDestructuringEmpty(componentProps), componentProps));
|
|
3997
|
-
return /* @__PURE__ */ jsx(Dialog$1.Trigger, _objectSpread2({
|
|
3998
|
-
ref: forwardRef,
|
|
3999
|
-
"data-slot": "dialog-trigger"
|
|
4000
|
-
}, props));
|
|
4001
|
-
});
|
|
4002
|
-
DialogTrigger.displayName = "DialogTrigger";
|
|
4003
|
-
/**
|
|
4004
|
-
* Portals dialog content into the document body, wrapping Base UI's `Dialog.Portal`. Renders no DOM
|
|
4005
|
-
* element of its own.
|
|
4006
|
-
*/
|
|
4007
|
-
function DialogPortal(componentProps) {
|
|
4008
|
-
return /* @__PURE__ */ jsx(Dialog$1.Portal, _objectSpread2({ "data-slot": "dialog-portal" }, componentProps));
|
|
4009
|
-
}
|
|
4010
|
-
/**
|
|
4011
|
-
* Button that closes the dialog, wrapping Base UI's `Dialog.Close`. Renders a `<button>` by default
|
|
4012
|
-
* (override with `render`).
|
|
4013
|
-
*/
|
|
4014
|
-
const DialogClose = React.forwardRef((componentProps, forwardRef) => {
|
|
4015
|
-
const props = _extends({}, (_objectDestructuringEmpty(componentProps), componentProps));
|
|
4016
|
-
return /* @__PURE__ */ jsx(Dialog$1.Close, _objectSpread2({
|
|
4017
|
-
ref: forwardRef,
|
|
4018
|
-
"data-slot": "dialog-close"
|
|
4019
|
-
}, props));
|
|
4020
|
-
});
|
|
4021
|
-
DialogClose.displayName = "DialogClose";
|
|
3599
|
+
const DialogClose = React.forwardRef((componentProps, forwardRef) => {
|
|
3600
|
+
const props = _extends({}, (_objectDestructuringEmpty(componentProps), componentProps));
|
|
3601
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, _objectSpread2({
|
|
3602
|
+
ref: forwardRef,
|
|
3603
|
+
"data-slot": "dialog-close"
|
|
3604
|
+
}, props));
|
|
3605
|
+
});
|
|
3606
|
+
DialogClose.displayName = "DialogClose";
|
|
4022
3607
|
/**
|
|
4023
3608
|
* Dimming backdrop rendered behind the dialog, wrapping Base UI's `Dialog.Backdrop`. Renders a
|
|
4024
3609
|
* fixed, full-viewport `<div>`. Included automatically by `DialogContent`.
|
|
@@ -4152,169 +3737,565 @@ const Command = React.forwardRef((componentProps, forwardRef) => {
|
|
|
4152
3737
|
});
|
|
4153
3738
|
Command.displayName = "Command";
|
|
4154
3739
|
/**
|
|
4155
|
-
* A `Command` menu rendered inside a modal `Dialog` — the command-palette
|
|
4156
|
-
* pattern. Renders no DOM element of its own; the visually hidden title and
|
|
4157
|
-
* description keep it accessible.
|
|
3740
|
+
* A `Command` menu rendered inside a modal `Dialog` — the command-palette
|
|
3741
|
+
* pattern. Renders no DOM element of its own; the visually hidden title and
|
|
3742
|
+
* description keep it accessible.
|
|
3743
|
+
*
|
|
3744
|
+
* @prop title - Screen-reader-only dialog title. Default: `'Command Palette'`.
|
|
3745
|
+
* @prop description - Screen-reader-only dialog description.
|
|
3746
|
+
* Default: `'Search for a command to run...'`.
|
|
3747
|
+
*
|
|
3748
|
+
* @example
|
|
3749
|
+
* ```tsx
|
|
3750
|
+
* <CommandDialog open={open} onOpenChange={setOpen}>
|
|
3751
|
+
* <CommandInput placeholder="Type a command..." />
|
|
3752
|
+
* <CommandList>
|
|
3753
|
+
* <CommandItem>Profile</CommandItem>
|
|
3754
|
+
* </CommandList>
|
|
3755
|
+
* </CommandDialog>
|
|
3756
|
+
* ```
|
|
3757
|
+
*/
|
|
3758
|
+
function CommandDialog(componentProps) {
|
|
3759
|
+
const { title = "Command Palette", description = "Search for a command to run...", children } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$27);
|
|
3760
|
+
return /* @__PURE__ */ jsxs(Dialog, _objectSpread2(_objectSpread2({}, props), {}, { children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
3761
|
+
className: "sr-only",
|
|
3762
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
3763
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
3764
|
+
className: "overflow-hidden p-0",
|
|
3765
|
+
children: /* @__PURE__ */ jsx(Command, {
|
|
3766
|
+
className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
|
|
3767
|
+
children
|
|
3768
|
+
})
|
|
3769
|
+
})] }));
|
|
3770
|
+
}
|
|
3771
|
+
/**
|
|
3772
|
+
* The search field that filters the command list as the user types. Renders an
|
|
3773
|
+
* `<input>` inside a `<div>` wrapper with a leading search icon.
|
|
3774
|
+
*/
|
|
3775
|
+
const CommandInput = React.forwardRef((componentProps, forwardRef) => {
|
|
3776
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded3$20);
|
|
3777
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3778
|
+
"data-slot": "command-input-wrapper",
|
|
3779
|
+
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
3780
|
+
children: [/* @__PURE__ */ jsx(Search, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, _objectSpread2({
|
|
3781
|
+
ref: forwardRef,
|
|
3782
|
+
"data-slot": "command-input",
|
|
3783
|
+
className: cn("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className)
|
|
3784
|
+
}, props))]
|
|
3785
|
+
});
|
|
3786
|
+
});
|
|
3787
|
+
CommandInput.displayName = "CommandInput";
|
|
3788
|
+
/**
|
|
3789
|
+
* Scrollable container holding the command groups, items, and empty state.
|
|
3790
|
+
* Renders a `<div>` that scrolls vertically when content overflows.
|
|
3791
|
+
*/
|
|
3792
|
+
const CommandList = React.forwardRef((componentProps, forwardRef) => {
|
|
3793
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded4$17);
|
|
3794
|
+
return /* @__PURE__ */ jsx(Command$1.List, _objectSpread2({
|
|
3795
|
+
ref: forwardRef,
|
|
3796
|
+
"data-slot": "command-list",
|
|
3797
|
+
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className)
|
|
3798
|
+
}, props));
|
|
3799
|
+
});
|
|
3800
|
+
CommandList.displayName = "CommandList";
|
|
3801
|
+
/**
|
|
3802
|
+
* Message shown when the current search matches no items. Renders a centered
|
|
3803
|
+
* `<div>` that is only visible when the list is empty.
|
|
3804
|
+
*/
|
|
3805
|
+
const CommandEmpty = React.forwardRef((componentProps, forwardRef) => {
|
|
3806
|
+
const props = _extends({}, (_objectDestructuringEmpty(componentProps), componentProps));
|
|
3807
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, _objectSpread2({
|
|
3808
|
+
ref: forwardRef,
|
|
3809
|
+
"data-slot": "command-empty",
|
|
3810
|
+
className: "py-6 text-center text-sm"
|
|
3811
|
+
}, props));
|
|
3812
|
+
});
|
|
3813
|
+
CommandEmpty.displayName = "CommandEmpty";
|
|
3814
|
+
/**
|
|
3815
|
+
* Groups related command items under an optional `heading`. Renders a `<div>`
|
|
3816
|
+
* that hides itself when none of its items match the search.
|
|
3817
|
+
*/
|
|
3818
|
+
const CommandGroup = React.forwardRef((componentProps, forwardRef) => {
|
|
3819
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded5$12);
|
|
3820
|
+
return /* @__PURE__ */ jsx(Command$1.Group, _objectSpread2({
|
|
3821
|
+
ref: forwardRef,
|
|
3822
|
+
"data-slot": "command-group",
|
|
3823
|
+
className: cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", className)
|
|
3824
|
+
}, props));
|
|
3825
|
+
});
|
|
3826
|
+
CommandGroup.displayName = "CommandGroup";
|
|
3827
|
+
/**
|
|
3828
|
+
* A thin horizontal divider between command groups or items. Renders a `<div>`
|
|
3829
|
+
* one pixel tall.
|
|
3830
|
+
*/
|
|
3831
|
+
const CommandSeparator = React.forwardRef((componentProps, forwardRef) => {
|
|
3832
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded6$10);
|
|
3833
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, _objectSpread2({
|
|
3834
|
+
ref: forwardRef,
|
|
3835
|
+
"data-slot": "command-separator",
|
|
3836
|
+
className: cn("bg-border -mx-1 h-px", className)
|
|
3837
|
+
}, props));
|
|
3838
|
+
});
|
|
3839
|
+
CommandSeparator.displayName = "CommandSeparator";
|
|
3840
|
+
/**
|
|
3841
|
+
* A single selectable command in the list. Renders a `<div>` that highlights on
|
|
3842
|
+
* hover/keyboard selection and can be disabled.
|
|
3843
|
+
*/
|
|
3844
|
+
const CommandItem = React.forwardRef((componentProps, forwardRef) => {
|
|
3845
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded7$5);
|
|
3846
|
+
return /* @__PURE__ */ jsx(Command$1.Item, _objectSpread2({
|
|
3847
|
+
ref: forwardRef,
|
|
3848
|
+
"data-slot": "command-item",
|
|
3849
|
+
className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className)
|
|
3850
|
+
}, props));
|
|
3851
|
+
});
|
|
3852
|
+
CommandItem.displayName = "CommandItem";
|
|
3853
|
+
/**
|
|
3854
|
+
* Right-aligned hint displaying an item's keyboard shortcut. Renders a `<span>`
|
|
3855
|
+
* with muted, spaced-out text.
|
|
3856
|
+
*/
|
|
3857
|
+
const CommandShortcut = React.forwardRef((componentProps, forwardRef) => {
|
|
3858
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded8$5);
|
|
3859
|
+
return /* @__PURE__ */ jsx("span", _objectSpread2({
|
|
3860
|
+
ref: forwardRef,
|
|
3861
|
+
"data-slot": "command-shortcut",
|
|
3862
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className)
|
|
3863
|
+
}, props));
|
|
3864
|
+
});
|
|
3865
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
3866
|
+
//#endregion
|
|
3867
|
+
//#region src/components/country-flag.tsx
|
|
3868
|
+
const _excluded$39 = [
|
|
3869
|
+
"countryIsoCode",
|
|
3870
|
+
"size",
|
|
3871
|
+
"className"
|
|
3872
|
+
];
|
|
3873
|
+
const sizeMap = {
|
|
3874
|
+
sm: "size-3",
|
|
3875
|
+
md: "size-4",
|
|
3876
|
+
lg: "size-5",
|
|
3877
|
+
xl: "size-6"
|
|
3878
|
+
};
|
|
3879
|
+
/**
|
|
3880
|
+
* Renders the flag icon for a given country as an inline `<svg>`.
|
|
3881
|
+
* Falls back to the US flag when the ISO code has no matching flag.
|
|
3882
|
+
*
|
|
3883
|
+
* @prop countryIsoCode - ISO country code selecting the flag to render.
|
|
3884
|
+
* @prop size - Flag dimensions: `sm` (12px) | `md` (16px) | `lg` (20px) | `xl` (24px). Default: `'xl'`.
|
|
3885
|
+
*
|
|
3886
|
+
* @example
|
|
3887
|
+
* ```tsx
|
|
3888
|
+
* <CountryFlag countryIsoCode="FR" size="md" />
|
|
3889
|
+
* ```
|
|
3890
|
+
*/
|
|
3891
|
+
const CountryFlag = React.forwardRef((componentProps, forwardRef) => {
|
|
3892
|
+
var _FLAGS$countryIsoCode;
|
|
3893
|
+
const { countryIsoCode, size = "xl", className } = componentProps, otherProps = _objectWithoutProperties(componentProps, _excluded$39);
|
|
3894
|
+
const CurrentFlag = (_FLAGS$countryIsoCode = FLAGS[countryIsoCode.toLowerCase()]) !== null && _FLAGS$countryIsoCode !== void 0 ? _FLAGS$countryIsoCode : FlagUs;
|
|
3895
|
+
return /* @__PURE__ */ jsx(CurrentFlag, _objectSpread2({
|
|
3896
|
+
ref: forwardRef,
|
|
3897
|
+
className: cn("flex-none", sizeMap[size], className)
|
|
3898
|
+
}, otherProps));
|
|
3899
|
+
});
|
|
3900
|
+
CountryFlag.displayName = "CountryFlag";
|
|
3901
|
+
//#endregion
|
|
3902
|
+
//#region src/components/combobox-rows.tsx
|
|
3903
|
+
const DEFAULT_SKELETON_COUNT = 5;
|
|
3904
|
+
const DEFAULT_ROW_HEIGHT = 36;
|
|
3905
|
+
const VIRTUAL_ROW_OVERSCAN = 8;
|
|
3906
|
+
/**
|
|
3907
|
+
* Buckets a flat `items` array into groups for a combobox list, preserving
|
|
3908
|
+
* first-seen group order. Returns `null` when `getGroupKey` is omitted (the flat
|
|
3909
|
+
* list path).
|
|
3910
|
+
*
|
|
3911
|
+
* Lives above the Combobox root rather than inside `ComboboxRows` because the
|
|
3912
|
+
* root's `items` prop must receive the GROUPED shape — Base UI derives its
|
|
3913
|
+
* collection, `data-empty`, keyboard nav and client-side filtering from it.
|
|
3914
|
+
* Internal to the package: not exported from `src/index.ts`.
|
|
3915
|
+
*/
|
|
3916
|
+
function useComboboxItemGroups(items, getGroupKey, getGroupLabel) {
|
|
3917
|
+
return React.useMemo(() => {
|
|
3918
|
+
if (!getGroupKey) return null;
|
|
3919
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
3920
|
+
for (const item of items) {
|
|
3921
|
+
const gk = getGroupKey(item);
|
|
3922
|
+
const bucket = byKey.get(gk);
|
|
3923
|
+
if (bucket) bucket.push(item);
|
|
3924
|
+
else byKey.set(gk, [item]);
|
|
3925
|
+
}
|
|
3926
|
+
return Array.from(byKey, ([groupKey, groupItems]) => ({
|
|
3927
|
+
groupKey,
|
|
3928
|
+
label: getGroupLabel ? getGroupLabel(groupKey) : groupKey,
|
|
3929
|
+
items: groupItems
|
|
3930
|
+
}));
|
|
3931
|
+
}, [
|
|
3932
|
+
items,
|
|
3933
|
+
getGroupKey,
|
|
3934
|
+
getGroupLabel
|
|
3935
|
+
]);
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* The scrollable rows region shared by every `DataCombobox` layout: the rows
|
|
3939
|
+
* (flat or grouped), the infinite-scroll sentinel, the
|
|
3940
|
+
* skeleton rows, the filtering dim-overlay, the empty state, and the load-more
|
|
3941
|
+
* spinner row. It stops at the rows: the search input and any popup chrome
|
|
3942
|
+
* belong to whichever root renders this.
|
|
3943
|
+
*
|
|
3944
|
+
* Must be rendered inside a `Combobox` root whose `items` is `groups ?? items`.
|
|
3945
|
+
* Internal to the package: not exported from `src/index.ts`.
|
|
3946
|
+
*/
|
|
3947
|
+
function ComboboxRows(componentProps) {
|
|
3948
|
+
var _groups$at$items, _groups$at;
|
|
3949
|
+
const { items, groups, getItemValue, getItemLabel, renderItem, disabledKeys, loadingState = "idle", skeletonCount = DEFAULT_SKELETON_COUNT, onFetchMore, hasMore = false, emptyState, listClassName, listTabIndex, virtualizeRows = false, estimateRowHeight = DEFAULT_ROW_HEIGHT, scrollRowIntoViewRef, "aria-label": ariaLabel } = componentProps;
|
|
3950
|
+
const isInitialLoading = loadingState === "loading";
|
|
3951
|
+
const isFiltering = loadingState === "filtering";
|
|
3952
|
+
const isLoadingMore = loadingState === "loadingMore";
|
|
3953
|
+
const sentinelRef = useFetchMoreSentinel(onFetchMore, (node) => node.closest("[data-slot=\"combobox-list\"]"), items.length);
|
|
3954
|
+
const showFetchSentinel = !!onFetchMore && hasMore;
|
|
3955
|
+
const lastRenderedItem = ((_groups$at$items = groups === null || groups === void 0 || (_groups$at = groups.at(-1)) === null || _groups$at === void 0 ? void 0 : _groups$at.items) !== null && _groups$at$items !== void 0 ? _groups$at$items : items).at(-1);
|
|
3956
|
+
const lastItemKey = lastRenderedItem ? getItemValue(lastRenderedItem) : void 0;
|
|
3957
|
+
const renderRow = (item) => {
|
|
3958
|
+
var _disabledKeys$has;
|
|
3959
|
+
const key = getItemValue(item);
|
|
3960
|
+
const attachSentinel = showFetchSentinel && !virtualizeRows && key === lastItemKey;
|
|
3961
|
+
return /* @__PURE__ */ jsx(ComboboxItem, {
|
|
3962
|
+
value: item,
|
|
3963
|
+
disabled: (_disabledKeys$has = disabledKeys === null || disabledKeys === void 0 ? void 0 : disabledKeys.has(key)) !== null && _disabledKeys$has !== void 0 ? _disabledKeys$has : false,
|
|
3964
|
+
ref: attachSentinel ? sentinelRef : void 0,
|
|
3965
|
+
"data-test": attachSentinel ? "fetch-sentinel" : void 0,
|
|
3966
|
+
children: renderItem ? renderItem(item) : getItemLabel(item)
|
|
3967
|
+
}, key);
|
|
3968
|
+
};
|
|
3969
|
+
const hasRows = items.length > 0;
|
|
3970
|
+
const virtualRows = virtualizeRows ? /* @__PURE__ */ jsx(ComboboxVirtualRows, {
|
|
3971
|
+
getItemValue,
|
|
3972
|
+
getItemLabel,
|
|
3973
|
+
renderItem,
|
|
3974
|
+
disabledKeys,
|
|
3975
|
+
estimateRowHeight,
|
|
3976
|
+
sentinelRef,
|
|
3977
|
+
showFetchSentinel,
|
|
3978
|
+
scrollRowIntoViewRef
|
|
3979
|
+
}) : null;
|
|
3980
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3981
|
+
"data-slot": "combobox-rows",
|
|
3982
|
+
className: cn("relative", isFiltering && !hasRows && "min-h-24"),
|
|
3983
|
+
children: [/* @__PURE__ */ jsx(ComboboxLoadedRows, {
|
|
3984
|
+
isInitialLoading,
|
|
3985
|
+
skeletonCount,
|
|
3986
|
+
groups,
|
|
3987
|
+
renderRow,
|
|
3988
|
+
virtualRows,
|
|
3989
|
+
isFiltering,
|
|
3990
|
+
isLoadingMore,
|
|
3991
|
+
emptyState,
|
|
3992
|
+
listClassName,
|
|
3993
|
+
listTabIndex,
|
|
3994
|
+
"aria-label": ariaLabel
|
|
3995
|
+
}), isFiltering ? /* @__PURE__ */ jsx(ComboboxFilteringOverlay, {}) : null]
|
|
3996
|
+
});
|
|
3997
|
+
}
|
|
3998
|
+
/** The loaded rows region: the list itself, the empty state, and the load-more spinner row. */
|
|
3999
|
+
function ComboboxLoadedRows(componentProps) {
|
|
4000
|
+
const { isInitialLoading, skeletonCount, groups, renderRow, virtualRows, isFiltering, isLoadingMore, emptyState, listClassName, listTabIndex, "aria-label": ariaLabel } = componentProps;
|
|
4001
|
+
const t = useDsTranslation("ds");
|
|
4002
|
+
const listChildren = isInitialLoading ? /* @__PURE__ */ jsx(ComboboxSkeletonRows, { count: skeletonCount }) : virtualRows !== null && virtualRows !== void 0 ? virtualRows : groups === null ? renderRow : renderGroupSection(renderRow);
|
|
4003
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4004
|
+
/* @__PURE__ */ jsx(ComboboxList, _objectSpread2(_objectSpread2({
|
|
4005
|
+
"aria-label": ariaLabel,
|
|
4006
|
+
className: listClassName
|
|
4007
|
+
}, listTabIndex === void 0 ? {} : { tabIndex: listTabIndex }), {}, { children: listChildren })),
|
|
4008
|
+
/* @__PURE__ */ jsx(ComboboxEmpty, {
|
|
4009
|
+
className: "flex empty:hidden",
|
|
4010
|
+
children: isFiltering || isInitialLoading ? null : emptyState !== null && emptyState !== void 0 ? emptyState : t("dataCombobox.noResults")
|
|
4011
|
+
}),
|
|
4012
|
+
isLoadingMore ? /* @__PURE__ */ jsx(SpinnerRow, {}) : null
|
|
4013
|
+
] });
|
|
4014
|
+
}
|
|
4015
|
+
/**
|
|
4016
|
+
* Renders only the rows inside the scrolled window of a FLAT combobox list, at
|
|
4017
|
+
* absolute offsets inside a full-height spacer, so a 244-item list keeps roughly
|
|
4018
|
+
* twenty rows in the DOM.
|
|
4019
|
+
*
|
|
4020
|
+
* Reads the rows from Base UI's `useFilteredItems` rather than from the `items`
|
|
4021
|
+
* prop: with client-side filtering on, the window must slide over the FILTERED
|
|
4022
|
+
* rows, and the flat index of a filtered row is exactly what Base UI's keyboard
|
|
4023
|
+
* navigation, `aria-activedescendant` and Enter-to-select are indexed by. That
|
|
4024
|
+
* index is passed to every row explicitly — the automatic DOM-order index is
|
|
4025
|
+
* meaningless when only a window is mounted.
|
|
4026
|
+
*/
|
|
4027
|
+
function ComboboxVirtualRows(componentProps) {
|
|
4028
|
+
"use no memo";
|
|
4029
|
+
var _spacerElement$closes;
|
|
4030
|
+
const { getItemValue, getItemLabel, renderItem, disabledKeys, estimateRowHeight, sentinelRef, showFetchSentinel, scrollRowIntoViewRef } = componentProps;
|
|
4031
|
+
const filteredItems = Combobox$1.useFilteredItems();
|
|
4032
|
+
const [spacerElement, setSpacerElement] = React.useState(null);
|
|
4033
|
+
const scrollElement = (_spacerElement$closes = spacerElement === null || spacerElement === void 0 ? void 0 : spacerElement.closest("[data-slot=\"combobox-list\"]")) !== null && _spacerElement$closes !== void 0 ? _spacerElement$closes : null;
|
|
4034
|
+
const rowVirtualizer = useVirtualizer({
|
|
4035
|
+
count: filteredItems.length,
|
|
4036
|
+
getScrollElement: () => scrollElement,
|
|
4037
|
+
estimateSize: () => estimateRowHeight,
|
|
4038
|
+
overscan: VIRTUAL_ROW_OVERSCAN
|
|
4039
|
+
});
|
|
4040
|
+
React.useEffect(() => {
|
|
4041
|
+
if (!scrollRowIntoViewRef) return void 0;
|
|
4042
|
+
scrollRowIntoViewRef.current = (index) => rowVirtualizer.scrollToIndex(index, { align: "auto" });
|
|
4043
|
+
return () => {
|
|
4044
|
+
scrollRowIntoViewRef.current = null;
|
|
4045
|
+
};
|
|
4046
|
+
}, [rowVirtualizer, scrollRowIntoViewRef]);
|
|
4047
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4048
|
+
ref: setSpacerElement,
|
|
4049
|
+
"data-slot": "combobox-virtual-rows",
|
|
4050
|
+
className: "relative w-full",
|
|
4051
|
+
style: { height: rowVirtualizer.getTotalSize() },
|
|
4052
|
+
children: [rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
4053
|
+
var _disabledKeys$has2;
|
|
4054
|
+
const item = filteredItems[virtualRow.index];
|
|
4055
|
+
if (item === void 0) return null;
|
|
4056
|
+
const key = getItemValue(item);
|
|
4057
|
+
return /* @__PURE__ */ jsx(ComboboxItem, {
|
|
4058
|
+
index: virtualRow.index,
|
|
4059
|
+
value: item,
|
|
4060
|
+
disabled: (_disabledKeys$has2 = disabledKeys === null || disabledKeys === void 0 ? void 0 : disabledKeys.has(key)) !== null && _disabledKeys$has2 !== void 0 ? _disabledKeys$has2 : false,
|
|
4061
|
+
ref: rowVirtualizer.measureElement,
|
|
4062
|
+
"data-index": virtualRow.index,
|
|
4063
|
+
style: {
|
|
4064
|
+
position: "absolute",
|
|
4065
|
+
top: 0,
|
|
4066
|
+
left: 0,
|
|
4067
|
+
width: "100%",
|
|
4068
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
4069
|
+
},
|
|
4070
|
+
children: renderItem ? renderItem(item) : getItemLabel(item)
|
|
4071
|
+
}, key);
|
|
4072
|
+
}), showFetchSentinel && filteredItems.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
4073
|
+
ref: sentinelRef,
|
|
4074
|
+
"aria-hidden": true,
|
|
4075
|
+
"data-test": "fetch-sentinel",
|
|
4076
|
+
"data-slot": "combobox-fetch-sentinel",
|
|
4077
|
+
className: "absolute bottom-0 h-px w-full"
|
|
4078
|
+
}) : null]
|
|
4079
|
+
});
|
|
4080
|
+
}
|
|
4081
|
+
/**
|
|
4082
|
+
* Builds `ComboboxList`'s render-prop for a GROUPED list: one `ComboboxGroup`
|
|
4083
|
+
* per section, each header plus a collection of leaf rows. Base UI calls the
|
|
4084
|
+
* returned function once per group from the Root's grouped `items`.
|
|
4085
|
+
*/
|
|
4086
|
+
function renderGroupSection(renderRow) {
|
|
4087
|
+
return (group) => /* @__PURE__ */ jsxs(ComboboxGroup, {
|
|
4088
|
+
items: group.items,
|
|
4089
|
+
children: [/* @__PURE__ */ jsx(ComboboxLabel, { children: group.label }), /* @__PURE__ */ jsx(ComboboxCollection, { children: renderRow })]
|
|
4090
|
+
}, group.groupKey);
|
|
4091
|
+
}
|
|
4092
|
+
/** The dimmed spinner overlay covering the list while a re-query is in flight. */
|
|
4093
|
+
function ComboboxFilteringOverlay() {
|
|
4094
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4095
|
+
"data-slot": "combobox-loading-overlay",
|
|
4096
|
+
className: "bg-popover/60 absolute inset-0 z-10 flex items-center justify-center",
|
|
4097
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
4098
|
+
});
|
|
4099
|
+
}
|
|
4100
|
+
/**
|
|
4101
|
+
* A centered spinner row for the filtering and load-more states. Not
|
|
4102
|
+
* `aria-hidden` — the `Spinner`'s `role="status"` announces loading to screen
|
|
4103
|
+
* readers (that's the point of a loading indicator).
|
|
4104
|
+
*/
|
|
4105
|
+
function SpinnerRow() {
|
|
4106
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4107
|
+
"data-slot": "combobox-spinner-row",
|
|
4108
|
+
className: "flex justify-center py-2 text-muted-foreground",
|
|
4109
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
4110
|
+
});
|
|
4111
|
+
}
|
|
4112
|
+
/** Skeleton rows, padded like the list, shown while the initial page loads. */
|
|
4113
|
+
function ComboboxSkeletonRows({ count }) {
|
|
4114
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4115
|
+
"data-slot": "combobox-skeleton-rows",
|
|
4116
|
+
className: "p-1",
|
|
4117
|
+
children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx("div", {
|
|
4118
|
+
"aria-hidden": true,
|
|
4119
|
+
"data-test": "loading-item",
|
|
4120
|
+
"data-slot": "combobox-skeleton-row",
|
|
4121
|
+
className: "flex items-center gap-2 rounded-md p-2",
|
|
4122
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" })
|
|
4123
|
+
}, `skeleton-${i}`))
|
|
4124
|
+
});
|
|
4125
|
+
}
|
|
4126
|
+
//#endregion
|
|
4127
|
+
//#region src/lib/use-combobox-item-selection.ts
|
|
4128
|
+
const EMPTY_KEYS = /* @__PURE__ */ new Set();
|
|
4129
|
+
/**
|
|
4130
|
+
* The `onInputValueChange` reasons that forward the new query to `onSearch`:
|
|
4131
|
+
* - `input-change` — real typing/paste.
|
|
4132
|
+
* - `input-clear` — Base UI clears the field itself after a selection.
|
|
4133
|
+
* - `clear-press` — the input's clear (x) button.
|
|
4134
|
+
*
|
|
4135
|
+
* `escape-key` is deliberately absent. Every combobox that uses this hook owns a
|
|
4136
|
+
* popup, so Escape CLOSES that popup rather than clearing the query, and
|
|
4137
|
+
* forwarding it would refetch on every dismissal.
|
|
4138
|
+
*
|
|
4139
|
+
* There used to be a second, INLINE set that added `escape-key`, for a list
|
|
4140
|
+
* rendered with no popup of its own — where Escape was the list's reset rather
|
|
4141
|
+
* than a dismissal. Nothing renders that way any more, so the layout-dependent
|
|
4142
|
+
* choice and the option that selected between the two are both gone.
|
|
4143
|
+
*/
|
|
4144
|
+
const SEARCH_TRIGGER_REASONS = /* @__PURE__ */ new Set([
|
|
4145
|
+
"input-change",
|
|
4146
|
+
"input-clear",
|
|
4147
|
+
"clear-press"
|
|
4148
|
+
]);
|
|
4149
|
+
/**
|
|
4150
|
+
* Bridges a `Set<string>` of selected keys to the item objects Base UI's
|
|
4151
|
+
* Combobox root wants for `value` / `onValueChange`, and gates the input's
|
|
4152
|
+
* value changes down to real search queries.
|
|
4158
4153
|
*
|
|
4159
|
-
*
|
|
4160
|
-
*
|
|
4161
|
-
*
|
|
4154
|
+
* Used by `DataCombobox`, whose three layouts all own a Combobox root and need
|
|
4155
|
+
* the identical selection semantics. Internal to the package: not exported
|
|
4156
|
+
* from `src/index.ts`.
|
|
4162
4157
|
*
|
|
4163
4158
|
* @example
|
|
4164
4159
|
* ```tsx
|
|
4165
|
-
*
|
|
4166
|
-
*
|
|
4167
|
-
* <CommandList>
|
|
4168
|
-
* <CommandItem>Profile</CommandItem>
|
|
4169
|
-
* </CommandList>
|
|
4170
|
-
* </CommandDialog>
|
|
4160
|
+
* const { keys, selectedObjects, commit, handleInputValueChange } =
|
|
4161
|
+
* useComboboxItemSelection({ items, getItemValue, selectedKeys, onSelectionChange });
|
|
4171
4162
|
* ```
|
|
4172
4163
|
*/
|
|
4173
|
-
function
|
|
4174
|
-
const {
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
children
|
|
4183
|
-
})
|
|
4184
|
-
})] }));
|
|
4185
|
-
}
|
|
4186
|
-
/**
|
|
4187
|
-
* The search field that filters the command list as the user types. Renders an
|
|
4188
|
-
* `<input>` inside a `<div>` wrapper with a leading search icon.
|
|
4189
|
-
*/
|
|
4190
|
-
const CommandInput = React.forwardRef((componentProps, forwardRef) => {
|
|
4191
|
-
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded3$20);
|
|
4192
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
4193
|
-
"data-slot": "command-input-wrapper",
|
|
4194
|
-
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
4195
|
-
children: [/* @__PURE__ */ jsx(Search, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, _objectSpread2({
|
|
4196
|
-
ref: forwardRef,
|
|
4197
|
-
"data-slot": "command-input",
|
|
4198
|
-
className: cn("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className)
|
|
4199
|
-
}, props))]
|
|
4164
|
+
function useComboboxItemSelection(options) {
|
|
4165
|
+
const { items, getItemValue, selectedItems, selectedKeys, defaultSelectedKeys, onSelectionChange, onSearch } = options;
|
|
4166
|
+
const itemCacheRef = React.useRef(/* @__PURE__ */ new Map());
|
|
4167
|
+
if (selectedItems) for (const item of selectedItems) itemCacheRef.current.set(getItemValue(item), item);
|
|
4168
|
+
for (const item of items) itemCacheRef.current.set(getItemValue(item), item);
|
|
4169
|
+
const itemCache = itemCacheRef.current;
|
|
4170
|
+
const [selectionSet, setSelectionSet] = useControllableState({
|
|
4171
|
+
prop: selectedKeys,
|
|
4172
|
+
defaultProp: defaultSelectedKeys
|
|
4200
4173
|
});
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
const
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4174
|
+
const keys = selectionSet !== null && selectionSet !== void 0 ? selectionSet : EMPTY_KEYS;
|
|
4175
|
+
const selectedObjects = [];
|
|
4176
|
+
for (const key of keys) {
|
|
4177
|
+
const item = itemCache.get(key);
|
|
4178
|
+
if (item) selectedObjects.push(item);
|
|
4179
|
+
}
|
|
4180
|
+
const commit = React.useCallback((objs, details) => {
|
|
4181
|
+
const next = new Set(objs.map(getItemValue));
|
|
4182
|
+
setSelectionSet(next);
|
|
4183
|
+
onSelectionChange === null || onSelectionChange === void 0 || onSelectionChange(next, details);
|
|
4184
|
+
}, [
|
|
4185
|
+
setSelectionSet,
|
|
4186
|
+
getItemValue,
|
|
4187
|
+
onSelectionChange
|
|
4188
|
+
]);
|
|
4189
|
+
const lastQueryRef = React.useRef("");
|
|
4190
|
+
return {
|
|
4191
|
+
keys,
|
|
4192
|
+
selectedObjects,
|
|
4193
|
+
commit,
|
|
4194
|
+
handleInputValueChange: onSearch ? (value, details) => {
|
|
4195
|
+
if (SEARCH_TRIGGER_REASONS.has(details.reason)) {
|
|
4196
|
+
lastQueryRef.current = value;
|
|
4197
|
+
onSearch(value);
|
|
4198
|
+
}
|
|
4199
|
+
} : void 0,
|
|
4200
|
+
resetSearch: React.useCallback(() => {
|
|
4201
|
+
if (!onSearch || lastQueryRef.current === "") return;
|
|
4202
|
+
lastQueryRef.current = "";
|
|
4203
|
+
onSearch("");
|
|
4204
|
+
}, [onSearch])
|
|
4205
|
+
};
|
|
4206
|
+
}
|
|
4207
|
+
//#endregion
|
|
4208
|
+
//#region src/components/data-combobox.tsx
|
|
4229
4209
|
/**
|
|
4230
|
-
*
|
|
4231
|
-
*
|
|
4210
|
+
* Row count at which `DataCombobox` virtualises its rows on its own, when `virtualizeRows` was not
|
|
4211
|
+
* passed either way. Exported so it can be asserted against and tuned in ONE place.
|
|
4212
|
+
*
|
|
4213
|
+
* Crossing it LATCHES virtualisation on for the life of the component - see the `virtualizeRows`
|
|
4214
|
+
* prop doc. A list that declares `onFetchMore` can grow without bound, so it starts out virtualised
|
|
4215
|
+
* regardless of this number rather than waiting to cross it.
|
|
4216
|
+
*
|
|
4217
|
+
* A STARTING POINT, not a measured optimum. The two real data points behind it: 244 countries with
|
|
4218
|
+
* a flag per row was visibly laggy unvirtualised, and the user lists are server-capped at 10 rows
|
|
4219
|
+
* today, so both known cases sit far from this line and the exact value is not load-bearing yet.
|
|
4220
|
+
* Measure before tuning it - the honest cost driver is how expensive `renderItem` is, not the row
|
|
4221
|
+
* count alone, and a threshold cannot see that.
|
|
4232
4222
|
*/
|
|
4233
|
-
const
|
|
4234
|
-
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded5$12);
|
|
4235
|
-
return /* @__PURE__ */ jsx(Command$1.Group, _objectSpread2({
|
|
4236
|
-
ref: forwardRef,
|
|
4237
|
-
"data-slot": "command-group",
|
|
4238
|
-
className: cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", className)
|
|
4239
|
-
}, props));
|
|
4240
|
-
});
|
|
4241
|
-
CommandGroup.displayName = "CommandGroup";
|
|
4223
|
+
const COMBOBOX_AUTO_VIRTUALIZE_THRESHOLD = 100;
|
|
4242
4224
|
/**
|
|
4243
|
-
*
|
|
4244
|
-
*
|
|
4225
|
+
* Row count at which `searchable="auto"` decides a list is long enough to need a search input.
|
|
4226
|
+
*
|
|
4227
|
+
* Exported so a consumer can reason about the boundary rather than re-deriving it, and so the
|
|
4228
|
+
* number lives in ONE place. Comes from the dashboard filter design (Figma node 7959:10798), which
|
|
4229
|
+
* annotates every drawer field as "Combobox - with search if 15+ items".
|
|
4230
|
+
*
|
|
4231
|
+
* Only consulted for `searchable="auto"`. An explicit `true` or `false` always wins, and the
|
|
4232
|
+
* default is still `true`, so no list changes behaviour without asking.
|
|
4245
4233
|
*/
|
|
4246
|
-
const
|
|
4247
|
-
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded6$10);
|
|
4248
|
-
return /* @__PURE__ */ jsx(Command$1.Separator, _objectSpread2({
|
|
4249
|
-
ref: forwardRef,
|
|
4250
|
-
"data-slot": "command-separator",
|
|
4251
|
-
className: cn("bg-border -mx-1 h-px", className)
|
|
4252
|
-
}, props));
|
|
4253
|
-
});
|
|
4254
|
-
CommandSeparator.displayName = "CommandSeparator";
|
|
4234
|
+
const COMBOBOX_AUTO_SEARCH_THRESHOLD = 15;
|
|
4255
4235
|
/**
|
|
4256
|
-
*
|
|
4257
|
-
*
|
|
4236
|
+
* Resolves the tri-state `searchable` prop to the single boolean every layout below reads.
|
|
4237
|
+
*
|
|
4238
|
+
* The `hasServerSearch` disjunct is not a nicety: a server-driven list's `items` is one page, so
|
|
4239
|
+
* its length says nothing about how much data exists. Counting it alone would strip the search box
|
|
4240
|
+
* off a 10-row first page of thousands - the one list that cannot function without one.
|
|
4241
|
+
*
|
|
4242
|
+
* Internal to the package (not exported from `src/index.ts`); exported from this module only so
|
|
4243
|
+
* `data-combobox.test.ts` can assert the predicate without a browser.
|
|
4244
|
+
*
|
|
4245
|
+
* @param searchable The `searchable` prop as passed - `true`, `false`, or `'auto'`.
|
|
4246
|
+
* @param hasServerSearch Whether an `onSearch` handler was provided.
|
|
4247
|
+
* @param itemCount `items.length` for this render.
|
|
4258
4248
|
*/
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
ref: forwardRef,
|
|
4263
|
-
"data-slot": "command-item",
|
|
4264
|
-
className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className)
|
|
4265
|
-
}, props));
|
|
4266
|
-
});
|
|
4267
|
-
CommandItem.displayName = "CommandItem";
|
|
4249
|
+
function resolveSearchable(searchable, hasServerSearch, itemCount) {
|
|
4250
|
+
return searchable === "auto" ? hasServerSearch || itemCount >= 15 : searchable;
|
|
4251
|
+
}
|
|
4268
4252
|
/**
|
|
4269
|
-
*
|
|
4270
|
-
*
|
|
4253
|
+
* Whether the auto-virtualisation LATCH should be raised on this render.
|
|
4254
|
+
*
|
|
4255
|
+
* Only ever consulted while the latch is still down - raising it is one-way, so this answering
|
|
4256
|
+
* `false` later never lowers it. A list that can grow without bound (one declaring `onFetchMore`)
|
|
4257
|
+
* says `true` on its very first render rather than waiting to cross the threshold, because it WILL
|
|
4258
|
+
* cross it and the crossing is the expensive part.
|
|
4259
|
+
*
|
|
4260
|
+
* Internal to the package (not exported from `src/index.ts`); exported from this module only so
|
|
4261
|
+
* `data-combobox.test.ts` can assert the predicate without a browser.
|
|
4262
|
+
*
|
|
4263
|
+
* @param hasFetchMore Whether an `onFetchMore` handler was provided.
|
|
4264
|
+
* @param itemCount `items.length` for this render.
|
|
4271
4265
|
*/
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
ref: forwardRef,
|
|
4276
|
-
"data-slot": "command-shortcut",
|
|
4277
|
-
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className)
|
|
4278
|
-
}, props));
|
|
4279
|
-
});
|
|
4280
|
-
CommandShortcut.displayName = "CommandShortcut";
|
|
4281
|
-
//#endregion
|
|
4282
|
-
//#region src/components/country-flag.tsx
|
|
4283
|
-
const _excluded$39 = [
|
|
4284
|
-
"countryIsoCode",
|
|
4285
|
-
"size",
|
|
4286
|
-
"className"
|
|
4287
|
-
];
|
|
4288
|
-
const sizeMap = {
|
|
4289
|
-
sm: "size-3",
|
|
4290
|
-
md: "size-4",
|
|
4291
|
-
lg: "size-5",
|
|
4292
|
-
xl: "size-6"
|
|
4293
|
-
};
|
|
4266
|
+
function shouldAutoVirtualize(hasFetchMore, itemCount) {
|
|
4267
|
+
return hasFetchMore || itemCount >= 100;
|
|
4268
|
+
}
|
|
4294
4269
|
/**
|
|
4295
|
-
*
|
|
4296
|
-
* Falls back to the US flag when the ISO code has no matching flag.
|
|
4270
|
+
* Resolves the tri-state `virtualizeRows` prop plus the latch into the boolean handed to Base UI.
|
|
4297
4271
|
*
|
|
4298
|
-
*
|
|
4299
|
-
*
|
|
4272
|
+
* Explicit wins over the heuristic, both ways: `true` forces it on below the threshold, `false`
|
|
4273
|
+
* forces it off above one. `'auto'` and omitted resolve the same way, so only an explicit boolean
|
|
4274
|
+
* overrides the latch. A GROUPED list opts out either way - group headers would need a second,
|
|
4275
|
+
* variable-height index space on top of the row one, so grouping means the prerequisite is missing
|
|
4276
|
+
* rather than that virtualisation is merely unwanted.
|
|
4300
4277
|
*
|
|
4301
|
-
*
|
|
4302
|
-
*
|
|
4303
|
-
*
|
|
4304
|
-
*
|
|
4278
|
+
* Internal to the package (not exported from `src/index.ts`); exported from this module only so
|
|
4279
|
+
* `data-combobox.test.ts` can assert the precedence without a browser.
|
|
4280
|
+
*
|
|
4281
|
+
* @param requested The `virtualizeRows` prop as passed - `true`, `false`, `'auto'`, or omitted.
|
|
4282
|
+
* @param latched Whether the auto-virtualisation latch is up (see {@link shouldAutoVirtualize}).
|
|
4283
|
+
* @param isGrouped Whether a `getGroupKey` was provided.
|
|
4305
4284
|
*/
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4285
|
+
function resolveVirtualizeRows(requested, latched, isGrouped) {
|
|
4286
|
+
return (typeof requested === "boolean" ? requested : latched) && !isGrouped;
|
|
4287
|
+
}
|
|
4288
|
+
/**
|
|
4289
|
+
* Scrolls a keyboard-highlighted row into view while rows are virtualised.
|
|
4290
|
+
* A no-op without virtualisation (nothing fills the ref), for a pointer-driven
|
|
4291
|
+
* highlight (the row is already under the cursor, so already mounted), and when
|
|
4292
|
+
* the highlight was cleared (index `-1`).
|
|
4293
|
+
*/
|
|
4294
|
+
function scrollHighlightedRowIntoView(scrollRowIntoViewRef, index, reason) {
|
|
4295
|
+
var _scrollRowIntoViewRef;
|
|
4296
|
+
if (reason === "pointer" || index < 0) return;
|
|
4297
|
+
(_scrollRowIntoViewRef = scrollRowIntoViewRef.current) === null || _scrollRowIntoViewRef === void 0 || _scrollRowIntoViewRef.call(scrollRowIntoViewRef, index);
|
|
4298
|
+
}
|
|
4318
4299
|
/**
|
|
4319
4300
|
* Searchable dropdown built on the DS Combobox primitives, driven by an `items`
|
|
4320
4301
|
* array plus `getItemValue`/`getItemLabel`. Renders an inline input (single) or
|
|
@@ -4334,9 +4315,14 @@ CountryFlag.displayName = "CountryFlag";
|
|
|
4334
4315
|
*/
|
|
4335
4316
|
function DataCombobox(componentProps) {
|
|
4336
4317
|
var _selectedObjects$;
|
|
4337
|
-
const { items, getItemValue, getItemLabel, renderItem, renderChip, getGroupKey, getGroupLabel, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, onOpenChange, selectedItems, disabledKeys, loadingState, skeletonCount, onSearch, onFetchMore, hasMore = false, emptyState, trigger, searchable = true, placeholder, disabled = false, className, contentClassName, "aria-label": ariaLabel, showClear = true } = componentProps;
|
|
4318
|
+
const { items, getItemValue, getItemLabel, renderItem, renderChip, getGroupKey, getGroupLabel, selectionMode = "single", selectedKeys, defaultSelectedKeys, onSelectionChange, onOpenChange, open, selectedItems, disabledKeys, loadingState, skeletonCount, onSearch, onFetchMore, hasMore = false, emptyState, trigger, searchable = true, placeholder, disabled = false, className, contentClassName, anchor, "aria-label": ariaLabel, listAriaLabel, showClear = true, estimateRowHeight } = componentProps;
|
|
4338
4319
|
const multiple = selectionMode === "multiple";
|
|
4339
|
-
const
|
|
4320
|
+
const isSearchable = resolveSearchable(searchable, !!onSearch, items.length);
|
|
4321
|
+
const autoVirtualizeLatch = React.useRef(false);
|
|
4322
|
+
if (!autoVirtualizeLatch.current) autoVirtualizeLatch.current = shouldAutoVirtualize(!!onFetchMore, items.length);
|
|
4323
|
+
const virtualizeRows = resolveVirtualizeRows(componentProps.virtualizeRows, autoVirtualizeLatch.current, !!getGroupKey);
|
|
4324
|
+
const scrollRowIntoViewRef = React.useRef(null);
|
|
4325
|
+
const { keys, selectedObjects, commit, handleInputValueChange, resetSearch } = useComboboxItemSelection({
|
|
4340
4326
|
items,
|
|
4341
4327
|
getItemValue,
|
|
4342
4328
|
selectedItems,
|
|
@@ -4345,6 +4331,10 @@ function DataCombobox(componentProps) {
|
|
|
4345
4331
|
onSelectionChange,
|
|
4346
4332
|
onSearch
|
|
4347
4333
|
});
|
|
4334
|
+
const handleOpenChange = (nextOpen, details) => {
|
|
4335
|
+
if (!nextOpen) resetSearch();
|
|
4336
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(nextOpen, details);
|
|
4337
|
+
};
|
|
4348
4338
|
const groups = useComboboxItemGroups(items, getGroupKey, getGroupLabel);
|
|
4349
4339
|
const popupRows = /* @__PURE__ */ jsx(ComboboxRows, {
|
|
4350
4340
|
items,
|
|
@@ -4358,12 +4348,20 @@ function DataCombobox(componentProps) {
|
|
|
4358
4348
|
onFetchMore,
|
|
4359
4349
|
hasMore,
|
|
4360
4350
|
emptyState,
|
|
4361
|
-
|
|
4351
|
+
virtualizeRows,
|
|
4352
|
+
estimateRowHeight,
|
|
4353
|
+
scrollRowIntoViewRef,
|
|
4354
|
+
"aria-label": listAriaLabel !== null && listAriaLabel !== void 0 ? listAriaLabel : ariaLabel
|
|
4362
4355
|
});
|
|
4363
4356
|
const chipsAnchor = useComboboxAnchor();
|
|
4364
|
-
const overlayLayout = trigger ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Combobox$1.Trigger, {
|
|
4357
|
+
const overlayLayout = trigger ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Combobox$1.Trigger, {
|
|
4358
|
+
render: trigger,
|
|
4359
|
+
children: trigger.props.children
|
|
4360
|
+
}), /* @__PURE__ */ jsxs(ComboboxContent, {
|
|
4361
|
+
"aria-label": ariaLabel,
|
|
4362
|
+
anchor,
|
|
4365
4363
|
className: cn("min-w-50", contentClassName),
|
|
4366
|
-
children: [
|
|
4364
|
+
children: [isSearchable ? /* @__PURE__ */ jsx(ComboboxInput, {
|
|
4367
4365
|
showTrigger: false,
|
|
4368
4366
|
placeholder
|
|
4369
4367
|
}) : null, popupRows]
|
|
@@ -4371,6 +4369,8 @@ function DataCombobox(componentProps) {
|
|
|
4371
4369
|
if (multiple) return /* @__PURE__ */ jsx(Combobox, {
|
|
4372
4370
|
multiple: true,
|
|
4373
4371
|
autoHighlight: true,
|
|
4372
|
+
virtualized: virtualizeRows,
|
|
4373
|
+
onItemHighlighted: (_item, details) => scrollHighlightedRowIntoView(scrollRowIntoViewRef, details.index, details.reason),
|
|
4374
4374
|
items: groups !== null && groups !== void 0 ? groups : items,
|
|
4375
4375
|
disabled,
|
|
4376
4376
|
filter: onSearch || onFetchMore && hasMore ? null : void 0,
|
|
@@ -4380,19 +4380,26 @@ function DataCombobox(componentProps) {
|
|
|
4380
4380
|
itemToStringLabel: getItemLabel,
|
|
4381
4381
|
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
4382
4382
|
onInputValueChange: handleInputValueChange,
|
|
4383
|
-
|
|
4383
|
+
open,
|
|
4384
|
+
onOpenChange: handleOpenChange,
|
|
4384
4385
|
children: trigger ? overlayLayout : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComboboxChips, {
|
|
4385
4386
|
ref: chipsAnchor,
|
|
4386
4387
|
className,
|
|
4387
|
-
children: /* @__PURE__ */ jsx(ComboboxValue, { children: (values) => /* @__PURE__ */ jsxs(Fragment, { children: [values.map((item) => renderChip ? /* @__PURE__ */ jsx(React.Fragment, { children: renderChip(item) }, getItemValue(item)) : /* @__PURE__ */ jsx(ComboboxChip, { children: getItemLabel(item) }, getItemValue(item))), /* @__PURE__ */ jsx(ComboboxChipsInput, {
|
|
4388
|
+
children: /* @__PURE__ */ jsx(ComboboxValue, { children: (values) => /* @__PURE__ */ jsxs(Fragment, { children: [values.map((item) => renderChip ? /* @__PURE__ */ jsx(React.Fragment, { children: renderChip(item) }, getItemValue(item)) : /* @__PURE__ */ jsx(ComboboxChip, { children: getItemLabel(item) }, getItemValue(item))), /* @__PURE__ */ jsx(ComboboxChipsInput, {
|
|
4389
|
+
"aria-label": ariaLabel,
|
|
4390
|
+
placeholder: keys.size === 0 ? placeholder : "",
|
|
4391
|
+
readOnly: !isSearchable
|
|
4392
|
+
})] }) })
|
|
4388
4393
|
}), /* @__PURE__ */ jsx(ComboboxContent, {
|
|
4389
|
-
anchor: chipsAnchor,
|
|
4394
|
+
anchor: anchor !== null && anchor !== void 0 ? anchor : chipsAnchor,
|
|
4390
4395
|
className: cn("min-w-50", contentClassName),
|
|
4391
4396
|
children: popupRows
|
|
4392
4397
|
})] })
|
|
4393
4398
|
}, selectionMode);
|
|
4394
4399
|
return /* @__PURE__ */ jsx(Combobox, {
|
|
4395
4400
|
autoHighlight: true,
|
|
4401
|
+
virtualized: virtualizeRows,
|
|
4402
|
+
onItemHighlighted: (_item, details) => scrollHighlightedRowIntoView(scrollRowIntoViewRef, details.index, details.reason),
|
|
4396
4403
|
items: groups !== null && groups !== void 0 ? groups : items,
|
|
4397
4404
|
disabled,
|
|
4398
4405
|
filter: onSearch || onFetchMore && hasMore ? null : void 0,
|
|
@@ -4402,13 +4409,17 @@ function DataCombobox(componentProps) {
|
|
|
4402
4409
|
itemToStringLabel: getItemLabel,
|
|
4403
4410
|
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
4404
4411
|
onInputValueChange: handleInputValueChange,
|
|
4405
|
-
|
|
4412
|
+
open,
|
|
4413
|
+
onOpenChange: handleOpenChange,
|
|
4406
4414
|
children: trigger ? overlayLayout : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComboboxInput, {
|
|
4407
4415
|
className,
|
|
4416
|
+
"aria-label": ariaLabel,
|
|
4408
4417
|
placeholder,
|
|
4409
4418
|
disabled,
|
|
4410
|
-
showClear
|
|
4419
|
+
showClear,
|
|
4420
|
+
readOnly: !isSearchable
|
|
4411
4421
|
}), /* @__PURE__ */ jsx(ComboboxContent, {
|
|
4422
|
+
anchor,
|
|
4412
4423
|
className: cn("min-w-50", contentClassName),
|
|
4413
4424
|
children: popupRows
|
|
4414
4425
|
})] })
|
|
@@ -4829,6 +4840,7 @@ PopoverClose.displayName = "PopoverClose";
|
|
|
4829
4840
|
const PopoverContent = React.forwardRef((componentProps, forwardRef) => {
|
|
4830
4841
|
const { className, align = "center", alignOffset = 0, side = "bottom", sideOffset = 4, anchor } = componentProps, props = _objectWithoutProperties(componentProps, _excluded$36);
|
|
4831
4842
|
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
4843
|
+
positionMethod: "fixed",
|
|
4832
4844
|
align,
|
|
4833
4845
|
alignOffset,
|
|
4834
4846
|
side,
|
|
@@ -6593,6 +6605,14 @@ function DatePickerFooter({ footer }) {
|
|
|
6593
6605
|
children: footer
|
|
6594
6606
|
});
|
|
6595
6607
|
}
|
|
6608
|
+
/**
|
|
6609
|
+
* @internal
|
|
6610
|
+
* Coerces an unknown prop value into a `Date`, or `undefined` when it cannot
|
|
6611
|
+
* represent one. Storybook's `control: 'date'` hands back a millisecond number
|
|
6612
|
+
* rather than a `Date`, so `minDate`/`maxDate` must tolerate that shape.
|
|
6613
|
+
*
|
|
6614
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6615
|
+
*/
|
|
6596
6616
|
const toDateOrUndefined = (v) => {
|
|
6597
6617
|
if (v == null) return void 0;
|
|
6598
6618
|
if (v instanceof Date) return isNaN(v.getTime()) ? void 0 : v;
|
|
@@ -6601,11 +6621,28 @@ const toDateOrUndefined = (v) => {
|
|
|
6601
6621
|
return isNaN(d.getTime()) ? void 0 : d;
|
|
6602
6622
|
}
|
|
6603
6623
|
};
|
|
6624
|
+
/**
|
|
6625
|
+
* @internal
|
|
6626
|
+
* Builds the react-day-picker `Matcher[]` that blocks a date. The two bound
|
|
6627
|
+
* matchers are day-exact on purpose: `startOfDay(minDate)` / `endOfDay(maxDate)`
|
|
6628
|
+
* so a `minDate` carrying a time component (`new Date()` mid-afternoon) does not
|
|
6629
|
+
* reject a same-day selection, whose committed value is always local midnight.
|
|
6630
|
+
*
|
|
6631
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6632
|
+
*/
|
|
6604
6633
|
function buildConstraintMatchers(minDate, maxDate, disabledDates) {
|
|
6605
6634
|
const base = [{ before: startOfDay(minDate) }, { after: endOfDay(maxDate) }];
|
|
6606
6635
|
if (!disabledDates) return base;
|
|
6607
6636
|
return base.concat(Array.isArray(disabledDates) ? disabledDates : [disabledDates]);
|
|
6608
6637
|
}
|
|
6638
|
+
/**
|
|
6639
|
+
* @internal
|
|
6640
|
+
* Normalises two loose endpoints into a `DateRange` whose `from` is never after
|
|
6641
|
+
* its `to`. A lone `to` is promoted to `from` because react-day-picker cannot
|
|
6642
|
+
* render a range that has no start.
|
|
6643
|
+
*
|
|
6644
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6645
|
+
*/
|
|
6609
6646
|
function sortRange(a, b) {
|
|
6610
6647
|
if (!a && !b) return void 0;
|
|
6611
6648
|
if (!a) return { from: b };
|
|
@@ -6629,6 +6666,14 @@ function formatDateForAnnouncement(date, locale) {
|
|
|
6629
6666
|
return date.toDateString();
|
|
6630
6667
|
}
|
|
6631
6668
|
}
|
|
6669
|
+
/**
|
|
6670
|
+
* @internal
|
|
6671
|
+
* Formats the min/max bound interpolated into the out-of-bounds hint, in the
|
|
6672
|
+
* picker's own locale. Falls back to `toDateString()` when the locale tag is
|
|
6673
|
+
* not one `Intl.DateTimeFormat` accepts.
|
|
6674
|
+
*
|
|
6675
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6676
|
+
*/
|
|
6632
6677
|
function formatBoundDate(date, locale) {
|
|
6633
6678
|
try {
|
|
6634
6679
|
return getCachedDateTimeFormat(locale, {
|
|
@@ -6641,8 +6686,11 @@ function formatBoundDate(date, locale) {
|
|
|
6641
6686
|
}
|
|
6642
6687
|
}
|
|
6643
6688
|
/**
|
|
6689
|
+
* @internal
|
|
6644
6690
|
* Formats a `Date` as a `yyyy-MM-dd` string using local time (not UTC).
|
|
6645
6691
|
* Used for hidden form inputs so the submitted value matches the displayed date.
|
|
6692
|
+
*
|
|
6693
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6646
6694
|
*/
|
|
6647
6695
|
function formatDateForInput(date) {
|
|
6648
6696
|
return format(date, "yyyy-MM-dd");
|
|
@@ -7843,6 +7891,7 @@ const DropdownMenuContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
7843
7891
|
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
7844
7892
|
container,
|
|
7845
7893
|
children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
7894
|
+
positionMethod: "fixed",
|
|
7846
7895
|
"data-slot": "dropdown-menu-positioner",
|
|
7847
7896
|
className: "isolate z-popup outline-none",
|
|
7848
7897
|
align,
|
|
@@ -8791,6 +8840,7 @@ HoverCardTrigger.displayName = "HoverCardTrigger";
|
|
|
8791
8840
|
const HoverCardContent = React.forwardRef((componentProps, forwardRef) => {
|
|
8792
8841
|
const { className, side = "bottom", sideOffset = 8, align = "center", alignOffset = 0 } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$16);
|
|
8793
8842
|
return /* @__PURE__ */ jsx(PreviewCard.Portal, { children: /* @__PURE__ */ jsx(PreviewCard.Positioner, {
|
|
8843
|
+
positionMethod: "fixed",
|
|
8794
8844
|
side,
|
|
8795
8845
|
sideOffset,
|
|
8796
8846
|
align,
|
|
@@ -8978,7 +9028,7 @@ const InlineEditInput = React.forwardRef((componentProps, forwardRef) => {
|
|
|
8978
9028
|
});
|
|
8979
9029
|
InlineEditInput.displayName = "InlineEditInput";
|
|
8980
9030
|
//#endregion
|
|
8981
|
-
//#region src/components/inline-edit-
|
|
9031
|
+
//#region src/components/inline-edit-multi-combobox.tsx
|
|
8982
9032
|
const _excluded$22 = [
|
|
8983
9033
|
"className",
|
|
8984
9034
|
"children",
|
|
@@ -8993,8 +9043,8 @@ const _excluded2$15 = [
|
|
|
8993
9043
|
"emptyMessage",
|
|
8994
9044
|
"children"
|
|
8995
9045
|
];
|
|
8996
|
-
/** Context shared between the `
|
|
8997
|
-
const
|
|
9046
|
+
/** Context shared between the `InlineEditMultiCombobox` root and its compound sub-parts. */
|
|
9047
|
+
const InlineEditMultiComboboxContext = React.createContext({});
|
|
8998
9048
|
/**
|
|
8999
9049
|
* Wires a commit-on-blur callback that fires once when focus truly leaves the
|
|
9000
9050
|
* component - the chips row **and** the portaled popup/listbox. Returns handlers to
|
|
@@ -9041,24 +9091,24 @@ function useCommitOnBlur(rootRef, getValues, onBlur) {
|
|
|
9041
9091
|
};
|
|
9042
9092
|
}
|
|
9043
9093
|
/**
|
|
9044
|
-
* The chips row of an `
|
|
9094
|
+
* The chips row of an `InlineEditMultiCombobox`. Wraps the inline-edit chrome (hover/focus
|
|
9045
9095
|
* affordance) around a Base UI `Combobox.Chips` container that lays out the selected
|
|
9046
|
-
* chips and the trailing `
|
|
9096
|
+
* chips and the trailing `InlineEditMultiComboboxTrigger` in a wrapping flex row.
|
|
9047
9097
|
*
|
|
9048
9098
|
* @example
|
|
9049
9099
|
* ```tsx
|
|
9050
|
-
* <
|
|
9051
|
-
* <
|
|
9052
|
-
* <
|
|
9053
|
-
* </
|
|
9100
|
+
* <InlineEditMultiComboboxChips>
|
|
9101
|
+
* <InlineEditMultiComboboxValue>{…}</InlineEditMultiComboboxValue>
|
|
9102
|
+
* <InlineEditMultiComboboxTrigger />
|
|
9103
|
+
* </InlineEditMultiComboboxChips>
|
|
9054
9104
|
* ```
|
|
9055
9105
|
*/
|
|
9056
|
-
const
|
|
9106
|
+
const InlineEditMultiComboboxChips = React.forwardRef((componentProps, forwardRef) => {
|
|
9057
9107
|
const { "aria-invalid": ariaInvalid, className, id, children } = componentProps;
|
|
9058
|
-
const { readOnly } = React.useContext(
|
|
9108
|
+
const { readOnly } = React.useContext(InlineEditMultiComboboxContext);
|
|
9059
9109
|
const handleEmptyAreaClick = (e) => {
|
|
9060
9110
|
if (readOnly || e.target !== e.currentTarget) return;
|
|
9061
|
-
const trigger = e.currentTarget.querySelector("[data-slot=\"inline-edit-
|
|
9111
|
+
const trigger = e.currentTarget.querySelector("[data-slot=\"inline-edit-multi-combobox-trigger\"]");
|
|
9062
9112
|
if (trigger && trigger.getAttribute("aria-expanded") !== "true") trigger.click();
|
|
9063
9113
|
};
|
|
9064
9114
|
return /* @__PURE__ */ jsx(InlineEditChrome, {
|
|
@@ -9068,7 +9118,7 @@ const InlineEditMultiselectChips = React.forwardRef((componentProps, forwardRef)
|
|
|
9068
9118
|
className: cn("items-start", readOnly && "cursor-default", className),
|
|
9069
9119
|
children: /* @__PURE__ */ jsx(Combobox$1.Chips, {
|
|
9070
9120
|
ref: forwardRef,
|
|
9071
|
-
"data-slot": "inline-edit-
|
|
9121
|
+
"data-slot": "inline-edit-multi-combobox-chips",
|
|
9072
9122
|
id,
|
|
9073
9123
|
onClick: handleEmptyAreaClick,
|
|
9074
9124
|
className: cn("relative flex flex-1 min-w-0 flex-wrap items-center gap-1", !readOnly && "cursor-pointer"),
|
|
@@ -9076,24 +9126,24 @@ const InlineEditMultiselectChips = React.forwardRef((componentProps, forwardRef)
|
|
|
9076
9126
|
})
|
|
9077
9127
|
});
|
|
9078
9128
|
});
|
|
9079
|
-
|
|
9129
|
+
InlineEditMultiComboboxChips.displayName = "InlineEditMultiComboboxChips";
|
|
9080
9130
|
/**
|
|
9081
|
-
* Renders the selected values of an `
|
|
9082
|
-
* that maps the array of selected keys to `
|
|
9131
|
+
* Renders the selected values of an `InlineEditMultiCombobox`. Pass a render function
|
|
9132
|
+
* that maps the array of selected keys to `InlineEditMultiComboboxChip`s.
|
|
9083
9133
|
*
|
|
9084
9134
|
* @example
|
|
9085
9135
|
* ```tsx
|
|
9086
|
-
* <
|
|
9136
|
+
* <InlineEditMultiComboboxValue>
|
|
9087
9137
|
* {(keys: string[]) =>
|
|
9088
|
-
* keys.map(key => <
|
|
9089
|
-
* </
|
|
9138
|
+
* keys.map(key => <InlineEditMultiComboboxChip key={key}>{labelOf(key)}</InlineEditMultiComboboxChip>)}
|
|
9139
|
+
* </InlineEditMultiComboboxValue>
|
|
9090
9140
|
* ```
|
|
9091
9141
|
*/
|
|
9092
|
-
function
|
|
9093
|
-
return /* @__PURE__ */ jsx(ComboboxValue, _objectSpread2({ "data-slot": "inline-edit-
|
|
9142
|
+
function InlineEditMultiComboboxValue(componentProps) {
|
|
9143
|
+
return /* @__PURE__ */ jsx(ComboboxValue, _objectSpread2({ "data-slot": "inline-edit-multi-combobox-value" }, componentProps));
|
|
9094
9144
|
}
|
|
9095
9145
|
/**
|
|
9096
|
-
* A single selected-value chip inside `
|
|
9146
|
+
* A single selected-value chip inside `InlineEditMultiComboboxValue`. Composes the DS
|
|
9097
9147
|
* `Chip` with a trailing remove (X) button that unselects the value via Base UI. The
|
|
9098
9148
|
* remove button is hidden in `readOnly` mode.
|
|
9099
9149
|
*
|
|
@@ -9102,17 +9152,17 @@ function InlineEditMultiselectValue(componentProps) {
|
|
|
9102
9152
|
*
|
|
9103
9153
|
* @example
|
|
9104
9154
|
* ```tsx
|
|
9105
|
-
* <
|
|
9106
|
-
* <
|
|
9155
|
+
* <InlineEditMultiComboboxChip color="blue" tone="medium-light">Urgent</InlineEditMultiComboboxChip>
|
|
9156
|
+
* <InlineEditMultiComboboxChip legacyColor="#0761B5">Sales</InlineEditMultiComboboxChip>
|
|
9107
9157
|
* ```
|
|
9108
9158
|
*/
|
|
9109
|
-
const
|
|
9159
|
+
const InlineEditMultiComboboxChip = React.forwardRef((componentProps, forwardRef) => {
|
|
9110
9160
|
const { className, children, color, tone, legacyColor, glow } = componentProps, props = _objectWithoutProperties(componentProps, _excluded$22);
|
|
9111
|
-
const { readOnly } = React.useContext(
|
|
9161
|
+
const { readOnly } = React.useContext(InlineEditMultiComboboxContext);
|
|
9112
9162
|
const t = useDsTranslation("ds");
|
|
9113
9163
|
return /* @__PURE__ */ jsxs(Combobox$1.Chip, _objectSpread2(_objectSpread2({
|
|
9114
9164
|
ref: forwardRef,
|
|
9115
|
-
"data-slot": "inline-edit-
|
|
9165
|
+
"data-slot": "inline-edit-multi-combobox-chip",
|
|
9116
9166
|
render: /* @__PURE__ */ jsx(Chip, {
|
|
9117
9167
|
color,
|
|
9118
9168
|
tone,
|
|
@@ -9125,27 +9175,27 @@ const InlineEditMultiselectChip = React.forwardRef((componentProps, forwardRef)
|
|
|
9125
9175
|
children
|
|
9126
9176
|
}), !readOnly && /* @__PURE__ */ jsx(Combobox$1.ChipRemove, { render: /* @__PURE__ */ jsx(ChipRemove, { "aria-label": t("multiselect.remove") }) })] }));
|
|
9127
9177
|
});
|
|
9128
|
-
|
|
9178
|
+
InlineEditMultiComboboxChip.displayName = "InlineEditMultiComboboxChip";
|
|
9129
9179
|
/**
|
|
9130
|
-
* The "Add item" trigger of an `
|
|
9180
|
+
* The "Add item" trigger of an `InlineEditMultiCombobox`. Renders an outline `Button`
|
|
9131
9181
|
* with a leading plus icon that opens the searchable dropdown. Renders nothing in
|
|
9132
9182
|
* `readOnly` mode.
|
|
9133
9183
|
*
|
|
9134
9184
|
* @example
|
|
9135
9185
|
* ```tsx
|
|
9136
|
-
* <
|
|
9186
|
+
* <InlineEditMultiComboboxTrigger>Add label</InlineEditMultiComboboxTrigger>
|
|
9137
9187
|
* ```
|
|
9138
9188
|
*/
|
|
9139
|
-
const
|
|
9189
|
+
const InlineEditMultiComboboxTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
9140
9190
|
const { children, "aria-label": ariaLabel, id, className } = componentProps;
|
|
9141
|
-
const { readOnly } = React.useContext(
|
|
9191
|
+
const { readOnly } = React.useContext(InlineEditMultiComboboxContext);
|
|
9142
9192
|
const t = useDsTranslation("ds");
|
|
9143
9193
|
if (readOnly) return null;
|
|
9144
9194
|
const label = children !== null && children !== void 0 ? children : t("multiselect.addItem");
|
|
9145
9195
|
const accessibleLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : typeof label === "string" ? label : void 0;
|
|
9146
9196
|
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
|
|
9147
9197
|
ref: forwardRef,
|
|
9148
|
-
"data-slot": "inline-edit-
|
|
9198
|
+
"data-slot": "inline-edit-multi-combobox-trigger",
|
|
9149
9199
|
id,
|
|
9150
9200
|
"aria-label": accessibleLabel,
|
|
9151
9201
|
render: /* @__PURE__ */ jsx(Button, {
|
|
@@ -9156,28 +9206,28 @@ const InlineEditMultiselectTrigger = React.forwardRef((componentProps, forwardRe
|
|
|
9156
9206
|
children: [/* @__PURE__ */ jsx(PlusIcon, {}), label]
|
|
9157
9207
|
});
|
|
9158
9208
|
});
|
|
9159
|
-
|
|
9209
|
+
InlineEditMultiComboboxTrigger.displayName = "InlineEditMultiComboboxTrigger";
|
|
9160
9210
|
/**
|
|
9161
|
-
* The floating dropdown of an `
|
|
9211
|
+
* The floating dropdown of an `InlineEditMultiCombobox`: a search input, an empty-state
|
|
9162
9212
|
* message, and the scrollable option list. Portal-rendered and anchored to the
|
|
9163
|
-
* `
|
|
9213
|
+
* `InlineEditMultiComboboxTrigger`.
|
|
9164
9214
|
*
|
|
9165
9215
|
* Pass a render function as `children` so the built-in search filters the options (a
|
|
9166
9216
|
* static list is rendered unfiltered — see the `children` prop note).
|
|
9167
9217
|
*
|
|
9168
9218
|
* @example
|
|
9169
9219
|
* ```tsx
|
|
9170
|
-
* <
|
|
9171
|
-
* {(key: string) => <
|
|
9172
|
-
* </
|
|
9220
|
+
* <InlineEditMultiComboboxContent>
|
|
9221
|
+
* {(key: string) => <InlineEditMultiComboboxItem key={key} value={key}>{labelOf(key)}</InlineEditMultiComboboxItem>}
|
|
9222
|
+
* </InlineEditMultiComboboxContent>
|
|
9173
9223
|
* ```
|
|
9174
9224
|
*/
|
|
9175
|
-
const
|
|
9225
|
+
const InlineEditMultiComboboxContent = React.forwardRef((componentProps, forwardRef) => {
|
|
9176
9226
|
const { className, searchPlaceholder, emptyMessage, children } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$15);
|
|
9177
9227
|
const t = useDsTranslation("ds");
|
|
9178
9228
|
return /* @__PURE__ */ jsxs(ComboboxContent, _objectSpread2(_objectSpread2({
|
|
9179
9229
|
ref: forwardRef,
|
|
9180
|
-
"data-slot": "inline-edit-
|
|
9230
|
+
"data-slot": "inline-edit-multi-combobox-content",
|
|
9181
9231
|
className: cn("w-80", className)
|
|
9182
9232
|
}, props), {}, { children: [
|
|
9183
9233
|
/* @__PURE__ */ jsx(ComboboxInput, {
|
|
@@ -9188,24 +9238,24 @@ const InlineEditMultiselectContent = React.forwardRef((componentProps, forwardRe
|
|
|
9188
9238
|
/* @__PURE__ */ jsx(ComboboxList, { children })
|
|
9189
9239
|
] }));
|
|
9190
9240
|
});
|
|
9191
|
-
|
|
9241
|
+
InlineEditMultiComboboxContent.displayName = "InlineEditMultiComboboxContent";
|
|
9192
9242
|
/**
|
|
9193
|
-
* A single option row inside `
|
|
9243
|
+
* A single option row inside `InlineEditMultiComboboxContent`. Shows a checkmark when
|
|
9194
9244
|
* selected and toggles selection on click (the dropdown stays open for multi-picking).
|
|
9195
9245
|
*
|
|
9196
9246
|
* @example
|
|
9197
9247
|
* ```tsx
|
|
9198
|
-
* <
|
|
9248
|
+
* <InlineEditMultiComboboxItem value="urgent">Urgent</InlineEditMultiComboboxItem>
|
|
9199
9249
|
* ```
|
|
9200
9250
|
*/
|
|
9201
|
-
const
|
|
9251
|
+
const InlineEditMultiComboboxItem = React.forwardRef((componentProps, forwardRef) => {
|
|
9202
9252
|
return /* @__PURE__ */ jsx(ComboboxItem, _objectSpread2({
|
|
9203
9253
|
ref: forwardRef,
|
|
9204
|
-
"data-slot": "inline-edit-
|
|
9254
|
+
"data-slot": "inline-edit-multi-combobox-item"
|
|
9205
9255
|
}, componentProps));
|
|
9206
9256
|
});
|
|
9207
|
-
|
|
9208
|
-
function
|
|
9257
|
+
InlineEditMultiComboboxItem.displayName = "InlineEditMultiComboboxItem";
|
|
9258
|
+
function InlineEditMultiComboboxDataDriven(props) {
|
|
9209
9259
|
var _ref;
|
|
9210
9260
|
const { value, defaultValue, onValueChange, onBlur, readOnly, items, getItemValue, getItemLabel, renderItem, renderChip, disabledKeys, placeholder, emptyMessage, addLabel, defaultOpen, "aria-invalid": ariaInvalid, "aria-label": ariaLabel, id, className } = props;
|
|
9211
9261
|
const contextValue = React.useMemo(() => ({ readOnly }), [readOnly]);
|
|
@@ -9224,7 +9274,7 @@ function InlineEditMultiselectDataDriven(props) {
|
|
|
9224
9274
|
const item = itemByKey.get(key);
|
|
9225
9275
|
return item ? getItemLabel(item) : key;
|
|
9226
9276
|
}, [itemByKey, getItemLabel]);
|
|
9227
|
-
return /* @__PURE__ */ jsx(
|
|
9277
|
+
return /* @__PURE__ */ jsx(InlineEditMultiComboboxContext.Provider, {
|
|
9228
9278
|
value: contextValue,
|
|
9229
9279
|
children: /* @__PURE__ */ jsx("div", {
|
|
9230
9280
|
ref: rootRef,
|
|
@@ -9241,22 +9291,22 @@ function InlineEditMultiselectDataDriven(props) {
|
|
|
9241
9291
|
itemToStringLabel: labelOf,
|
|
9242
9292
|
readOnly,
|
|
9243
9293
|
defaultOpen,
|
|
9244
|
-
children: [/* @__PURE__ */ jsxs(
|
|
9294
|
+
children: [/* @__PURE__ */ jsxs(InlineEditMultiComboboxChips, {
|
|
9245
9295
|
"aria-invalid": ariaInvalid,
|
|
9246
9296
|
className,
|
|
9247
9297
|
id: readOnly ? id : void 0,
|
|
9248
|
-
children: [/* @__PURE__ */ jsx(
|
|
9298
|
+
children: [/* @__PURE__ */ jsx(InlineEditMultiComboboxValue, { children: (selectedKeys) => selectedKeys.map((key) => {
|
|
9249
9299
|
const item = itemByKey.get(key);
|
|
9250
|
-
return renderChip && item ? /* @__PURE__ */ jsx(React.Fragment, { children: renderChip(item) }, key) : /* @__PURE__ */ jsx(
|
|
9251
|
-
}) }), /* @__PURE__ */ jsx(
|
|
9300
|
+
return renderChip && item ? /* @__PURE__ */ jsx(React.Fragment, { children: renderChip(item) }, key) : /* @__PURE__ */ jsx(InlineEditMultiComboboxChip, { children: labelOf(key) }, key);
|
|
9301
|
+
}) }), /* @__PURE__ */ jsx(InlineEditMultiComboboxTrigger, {
|
|
9252
9302
|
"aria-label": ariaLabel,
|
|
9253
9303
|
id,
|
|
9254
9304
|
children: addLabel
|
|
9255
9305
|
})]
|
|
9256
|
-
}), /* @__PURE__ */ jsx(
|
|
9306
|
+
}), /* @__PURE__ */ jsx(InlineEditMultiComboboxContent, {
|
|
9257
9307
|
searchPlaceholder: placeholder,
|
|
9258
9308
|
emptyMessage,
|
|
9259
|
-
children: (key) => /* @__PURE__ */ jsx(
|
|
9309
|
+
children: (key) => /* @__PURE__ */ jsx(InlineEditMultiComboboxItem, {
|
|
9260
9310
|
value: key,
|
|
9261
9311
|
disabled: disabledKeys === null || disabledKeys === void 0 ? void 0 : disabledKeys.has(key),
|
|
9262
9312
|
children: renderItem ? renderItem(itemByKey.get(key)) : labelOf(key)
|
|
@@ -9266,7 +9316,7 @@ function InlineEditMultiselectDataDriven(props) {
|
|
|
9266
9316
|
})
|
|
9267
9317
|
});
|
|
9268
9318
|
}
|
|
9269
|
-
function
|
|
9319
|
+
function InlineEditMultiComboboxCompound(props) {
|
|
9270
9320
|
var _ref2;
|
|
9271
9321
|
const { value, defaultValue, onValueChange, onBlur, readOnly, defaultOpen, children, items, itemToStringLabel } = props;
|
|
9272
9322
|
const contextValue = React.useMemo(() => ({ readOnly }), [readOnly]);
|
|
@@ -9279,7 +9329,7 @@ function InlineEditMultiselectCompound(props) {
|
|
|
9279
9329
|
onValueChange === null || onValueChange === void 0 || onValueChange(next);
|
|
9280
9330
|
}, [onValueChange]);
|
|
9281
9331
|
const blurHandlers = useCommitOnBlur(rootRef, getValues, onBlur);
|
|
9282
|
-
return /* @__PURE__ */ jsx(
|
|
9332
|
+
return /* @__PURE__ */ jsx(InlineEditMultiComboboxContext.Provider, {
|
|
9283
9333
|
value: contextValue,
|
|
9284
9334
|
children: /* @__PURE__ */ jsx("div", {
|
|
9285
9335
|
ref: rootRef,
|
|
@@ -9301,9 +9351,9 @@ function InlineEditMultiselectCompound(props) {
|
|
|
9301
9351
|
})
|
|
9302
9352
|
});
|
|
9303
9353
|
}
|
|
9304
|
-
function
|
|
9305
|
-
if ("getItemValue" in componentProps && componentProps.getItemValue !== void 0) return /* @__PURE__ */ jsx(
|
|
9306
|
-
return /* @__PURE__ */ jsx(
|
|
9354
|
+
function InlineEditMultiCombobox(componentProps) {
|
|
9355
|
+
if ("getItemValue" in componentProps && componentProps.getItemValue !== void 0) return /* @__PURE__ */ jsx(InlineEditMultiComboboxDataDriven, _objectSpread2({}, componentProps));
|
|
9356
|
+
return /* @__PURE__ */ jsx(InlineEditMultiComboboxCompound, _objectSpread2({}, componentProps));
|
|
9307
9357
|
}
|
|
9308
9358
|
//#endregion
|
|
9309
9359
|
//#region src/components/inline-edit-select.tsx
|
|
@@ -9390,6 +9440,7 @@ function InlineEditSelectValue(componentProps) {
|
|
|
9390
9440
|
const InlineEditSelectContent = React.forwardRef((componentProps, forwardRef) => {
|
|
9391
9441
|
const { className, children, side = "bottom", sideOffset = 12, align = "start", alignOffset = 0, alignItemWithTrigger = false } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$14);
|
|
9392
9442
|
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
9443
|
+
positionMethod: "fixed",
|
|
9393
9444
|
side,
|
|
9394
9445
|
sideOffset,
|
|
9395
9446
|
align,
|
|
@@ -11112,6 +11163,10 @@ function normalizeOptionList(prop) {
|
|
|
11112
11163
|
* Mirrors what buildPayload emits (`#value` / `@value`), so a persisted `plainText` note
|
|
11113
11164
|
* reloads with its pills intact. Text and pills are interleaved so inline void nodes always
|
|
11114
11165
|
* have text siblings (valid Slate structure).
|
|
11166
|
+
*
|
|
11167
|
+
* @internal Exported for `rich-textarea.test.ts` only - deliberately absent from `src/index.ts`.
|
|
11168
|
+
* It is still reachable as `@aircall/ds/components/rich-textarea` via the `./components/*`
|
|
11169
|
+
* subpath, so treat it as private and do not rely on it from a consumer.
|
|
11115
11170
|
*/
|
|
11116
11171
|
function parseInlineTokens(line, mentions, tags) {
|
|
11117
11172
|
const byTrigger = {
|
|
@@ -11152,6 +11207,8 @@ function parseInlineTokens(line, mentions, tags) {
|
|
|
11152
11207
|
* Builds the initial editor `Value` from the `value` prop. A plain-text string is split on
|
|
11153
11208
|
* newlines into paragraph blocks, with `#tag`/`@mention` tokens reparsed into pills (see
|
|
11154
11209
|
* parseInlineTokens); a JSON AST is used as-is.
|
|
11210
|
+
*
|
|
11211
|
+
* @internal Exported for `rich-textarea.test.ts` only - deliberately absent from `src/index.ts`.
|
|
11155
11212
|
*/
|
|
11156
11213
|
function toInitialValue(value, mentions, tags) {
|
|
11157
11214
|
if (value === void 0) return [{
|
|
@@ -11545,6 +11602,8 @@ const SAFE_LINK_SCHEME = /^(https?|mailto|tel):/i;
|
|
|
11545
11602
|
* has - including dangerous ones like `javascript:` - and prepend `http://`. This makes
|
|
11546
11603
|
* the form forgiving (`google.com`, `example` and typo'd schemes all become links) while
|
|
11547
11604
|
* never emitting an unsafe href. Empty input stays empty.
|
|
11605
|
+
*
|
|
11606
|
+
* @internal Exported for `rich-textarea.test.ts` only - deliberately absent from `src/index.ts`.
|
|
11548
11607
|
*/
|
|
11549
11608
|
function normalizeLinkInput(url) {
|
|
11550
11609
|
const trimmed = (url !== null && url !== void 0 ? url : "").trim();
|
|
@@ -12068,6 +12127,7 @@ const TooltipContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
12068
12127
|
return /* @__PURE__ */ jsx(Tooltip$1.Portal, {
|
|
12069
12128
|
container,
|
|
12070
12129
|
children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
12130
|
+
positionMethod: "fixed",
|
|
12071
12131
|
align,
|
|
12072
12132
|
alignOffset,
|
|
12073
12133
|
side,
|
|
@@ -13253,4 +13313,4 @@ function useAudioGauge(options = {}) {
|
|
|
13253
13313
|
};
|
|
13254
13314
|
}
|
|
13255
13315
|
//#endregion
|
|
13256
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionBar, ActionBarButton, ActionBarContext, ActionBarHeight, Alert, AlertAction, AlertAction as BannerAction, AlertDescription, AlertDescription as BannerDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AlertTitle as BannerTitle, Anchor, Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger, Audio, AudioPlayerBar, AudioPlayerButton, AudioPlayerCurrentTime, AudioPlayerDuration, AudioPlayerManager, AudioPlayerRow, AudioPlayerSkip, AudioPlayerSpeed, AudioPlayerTime, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BadgeGroup, BadgeGroupCount, Banner, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, COMBOBOX_AUTO_VIRTUALIZE_THRESHOLD, Calendar, CalendarDayButton, CalendarDropdown, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Chip, ChipRemove, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox,
|
|
13316
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionBar, ActionBarButton, ActionBarContext, ActionBarHeight, Alert, AlertAction, AlertAction as BannerAction, AlertDescription, AlertDescription as BannerDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AlertTitle as BannerTitle, Anchor, Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger, Audio, AudioPlayerBar, AudioPlayerButton, AudioPlayerCurrentTime, AudioPlayerDuration, AudioPlayerManager, AudioPlayerRow, AudioPlayerSkip, AudioPlayerSpeed, AudioPlayerTime, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BadgeGroup, BadgeGroupCount, Banner, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, COMBOBOX_AUTO_SEARCH_THRESHOLD, COMBOBOX_AUTO_VIRTUALIZE_THRESHOLD, Calendar, CalendarDayButton, CalendarDropdown, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Chip, ChipRemove, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CounterBadge, CountryFlag, DataCombobox, DataTable, DataTree, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBackdrop, DrawerBar, DrawerClose, DrawerContent, DrawerCreateHandle, DrawerDescription, DrawerFooter, DrawerHeader, DrawerMenu, DrawerMenuCheckboxItem, DrawerMenuGroup, DrawerMenuGroupLabel, DrawerMenuItem, DrawerMenuRadioGroup, DrawerMenuRadioItem, DrawerMenuSeparator, DrawerMenuTrigger, DrawerPanel, DrawerPopup, DrawerPortal, DrawerPrimitive, DrawerSwipeArea, DrawerTitle, DrawerTrigger, DrawerViewport, DropdownMenu, DropdownMenuAddon, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, DropzoneActions, DropzoneContent, DropzoneDescription, DropzoneIcon, DropzoneTitle, DropzoneTrigger, DsI18nProvider, EmojiPicker, EmojiPickerCategories, EmojiPickerContent, EmojiPickerTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FAB, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLabelAside, FieldLabelInfo, FieldLabelRow, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Gauge, HoverCard, HoverCardContent, HoverCardTrigger, InlineEditInput, InlineEditMultiCombobox, InlineEditMultiComboboxChip, InlineEditMultiComboboxChips, InlineEditMultiComboboxContent, InlineEditMultiComboboxItem, InlineEditMultiComboboxTrigger, InlineEditMultiComboboxValue, InlineEditSelect, InlineEditSelectContent, InlineEditSelectItem, InlineEditSelectTrigger, InlineEditSelectValue, InlineEditTextarea, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupRichTextarea, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Label, List, ListCol, ListRow, NotificationQueueProvider, NotificationSlot, NumericInput, NumericInputControl, NumericInputDecrement, NumericInputIncrement, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, RichTextarea, RichTextareaContent, RichTextareaRoot, RichTextareaToolbar, SUPPORTED_LANGUAGES, ScrollArea, ScrollAreaPrimitive, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Stepper, StepperContent, StepperCounter, StepperPanel, StepperProgress, Switch, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tree, TreeDragLine, TreeItem, TreeItemLabel, alertVariants, anchorVariants, bannerVariants, buttonGroupVariants, buttonVariants, cn, counterBadgeVariants, detectInitialLanguage, fabVariants, isInsideCalendarDropdown, registerI18nNamespace, selectTriggerVariants, spinnerVariants, syncDsLanguage, toast, toggleVariants, useAudioGauge, useAudioPlayer, useAudioPlayerTime, useComboboxAnchor, useDsLocale, useDsTranslation, useNotification, useNotificationQueue, useSidebar, useStepper, useTheme };
|