@aircall/ds 0.37.3 → 0.38.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-DZ2FDkmw.js → data-table-fPncHG6B.js} +19 -4
- package/dist/data-table.js +1 -1
- package/dist/globals.css +1 -1
- package/dist/index.d.ts +285 -300
- package/dist/index.js +788 -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-fPncHG6B.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";
|
|
@@ -3227,8 +3227,12 @@ const InputGroupTextarea = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3227
3227
|
InputGroupTextarea.displayName = "InputGroupTextarea";
|
|
3228
3228
|
//#endregion
|
|
3229
3229
|
//#region src/components/combobox.tsx
|
|
3230
|
-
const _excluded$42 = [
|
|
3231
|
-
|
|
3230
|
+
const _excluded$42 = [
|
|
3231
|
+
"className",
|
|
3232
|
+
"children",
|
|
3233
|
+
"aria-label"
|
|
3234
|
+
];
|
|
3235
|
+
const _excluded2$29 = ["className", "aria-label"];
|
|
3232
3236
|
const _excluded3$22 = [
|
|
3233
3237
|
"className",
|
|
3234
3238
|
"children",
|
|
@@ -3250,7 +3254,11 @@ const _excluded7$6 = ["className"];
|
|
|
3250
3254
|
const _excluded8$6 = ["className"];
|
|
3251
3255
|
const _excluded9$5 = ["className"];
|
|
3252
3256
|
const _excluded10$5 = ["className"];
|
|
3253
|
-
const _excluded11$3 = [
|
|
3257
|
+
const _excluded11$3 = [
|
|
3258
|
+
"className",
|
|
3259
|
+
"children",
|
|
3260
|
+
"showTrigger"
|
|
3261
|
+
];
|
|
3254
3262
|
const _excluded12$3 = [
|
|
3255
3263
|
"className",
|
|
3256
3264
|
"children",
|
|
@@ -3290,9 +3298,12 @@ function ComboboxValue(componentProps) {
|
|
|
3290
3298
|
* trailing chevron icon.
|
|
3291
3299
|
*/
|
|
3292
3300
|
const ComboboxTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
3293
|
-
const { className, children } = componentProps, props = _objectWithoutProperties(componentProps, _excluded$42);
|
|
3301
|
+
const { className, children, "aria-label": ariaLabel } = componentProps, props = _objectWithoutProperties(componentProps, _excluded$42);
|
|
3302
|
+
const t = useDsTranslation("ds");
|
|
3303
|
+
const resolvedAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : children == null ? t("combobox.toggleOptions") : void 0;
|
|
3294
3304
|
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, _objectSpread2(_objectSpread2({
|
|
3295
3305
|
ref: forwardRef,
|
|
3306
|
+
"aria-label": resolvedAriaLabel,
|
|
3296
3307
|
"data-slot": "combobox-trigger",
|
|
3297
3308
|
className: cn("[&_svg:not([class*='size-'])]:size-4", className)
|
|
3298
3309
|
}, props), {}, { children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" })] }));
|
|
@@ -3303,9 +3314,11 @@ ComboboxTrigger.displayName = "ComboboxTrigger";
|
|
|
3303
3314
|
* `<button>` with an X icon.
|
|
3304
3315
|
*/
|
|
3305
3316
|
const ComboboxClear = React.forwardRef((componentProps, forwardRef) => {
|
|
3306
|
-
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$29);
|
|
3317
|
+
const { className, "aria-label": ariaLabel } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$29);
|
|
3318
|
+
const t = useDsTranslation("ds");
|
|
3307
3319
|
return /* @__PURE__ */ jsx(Combobox$1.Clear, _objectSpread2(_objectSpread2({
|
|
3308
3320
|
ref: forwardRef,
|
|
3321
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("combobox.clear"),
|
|
3309
3322
|
"data-slot": "combobox-clear",
|
|
3310
3323
|
render: /* @__PURE__ */ jsx(InputGroupButton, {
|
|
3311
3324
|
variant: "ghost",
|
|
@@ -3321,9 +3334,12 @@ ComboboxClear.displayName = "ComboboxClear";
|
|
|
3321
3334
|
*/
|
|
3322
3335
|
const ComboboxInput = React.forwardRef((componentProps, forwardRef) => {
|
|
3323
3336
|
const { className, children, disabled = false, showTrigger = true, showClear = false } = componentProps, props = _objectWithoutProperties(componentProps, _excluded3$22);
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3337
|
+
const t = useDsTranslation("ds");
|
|
3338
|
+
return /* @__PURE__ */ jsxs(Combobox$1.InputGroup, {
|
|
3339
|
+
render: /* @__PURE__ */ jsx(InputGroup, {
|
|
3340
|
+
ref: forwardRef,
|
|
3341
|
+
className: cn("w-auto", className)
|
|
3342
|
+
}),
|
|
3327
3343
|
children: [
|
|
3328
3344
|
/* @__PURE__ */ jsx(Combobox$1.Input, _objectSpread2({ render: /* @__PURE__ */ jsx(InputGroupInput, { disabled }) }, props)),
|
|
3329
3345
|
/* @__PURE__ */ jsxs(InputGroupAddon, {
|
|
@@ -3332,6 +3348,7 @@ const ComboboxInput = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3332
3348
|
size: "icon-sm",
|
|
3333
3349
|
variant: "ghost",
|
|
3334
3350
|
render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
|
|
3351
|
+
"aria-label": t("combobox.showOptions"),
|
|
3335
3352
|
"data-slot": "input-group-button",
|
|
3336
3353
|
className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",
|
|
3337
3354
|
disabled
|
|
@@ -3360,7 +3377,7 @@ const ComboboxContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3360
3377
|
ref: forwardRef,
|
|
3361
3378
|
"data-slot": "combobox-content",
|
|
3362
3379
|
"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-[
|
|
3380
|
+
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
3381
|
}, props))
|
|
3365
3382
|
}) });
|
|
3366
3383
|
});
|
|
@@ -3456,15 +3473,29 @@ const ComboboxSeparator = React.forwardRef((componentProps, forwardRef) => {
|
|
|
3456
3473
|
ComboboxSeparator.displayName = "ComboboxSeparator";
|
|
3457
3474
|
/**
|
|
3458
3475
|
* Container for the selected chips in a multi-select combobox, wrapping Base UI's
|
|
3459
|
-
* `Combobox.Chips`. Renders a bordered, wrapping `<div>` that
|
|
3476
|
+
* `Combobox.Chips`. Renders a bordered, wrapping `<div>` that holds the chips, the chip input
|
|
3477
|
+
* and a trailing chevron.
|
|
3478
|
+
*
|
|
3479
|
+
* The chevron is what makes a collapsed field read as a SELECT rather than as a text input that
|
|
3480
|
+
* happens to be empty. An empty chips field is otherwise a bare bordered box: nothing in it says
|
|
3481
|
+
* a list of options is one click away, which is exactly how a filter drawer full of untouched
|
|
3482
|
+
* multi-select fields looked. `ComboboxInput` has always drawn one; this is the same affordance
|
|
3483
|
+
* on the other field shape.
|
|
3484
|
+
*
|
|
3485
|
+
* Pass `showTrigger={false}` for a field that should not advertise a popup.
|
|
3460
3486
|
*/
|
|
3461
3487
|
const ComboboxChips = React.forwardRef((componentProps, forwardRef) => {
|
|
3462
|
-
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded11$3);
|
|
3463
|
-
|
|
3488
|
+
const { className, children, showTrigger = true } = componentProps, props = _objectWithoutProperties(componentProps, _excluded11$3);
|
|
3489
|
+
const t = useDsTranslation("ds");
|
|
3490
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chips, _objectSpread2(_objectSpread2({
|
|
3464
3491
|
ref: forwardRef,
|
|
3465
3492
|
"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)
|
|
3493
|
+
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-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)
|
|
3494
|
+
}, props), {}, { children: [children, showTrigger && /* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
3495
|
+
"data-slot": "combobox-chips-trigger",
|
|
3496
|
+
"aria-label": t("combobox.showOptions"),
|
|
3497
|
+
className: "ml-auto shrink-0 rounded-sm p-1 text-muted-foreground"
|
|
3498
|
+
})] }));
|
|
3468
3499
|
});
|
|
3469
3500
|
ComboboxChips.displayName = "ComboboxChips";
|
|
3470
3501
|
/**
|
|
@@ -3505,520 +3536,72 @@ function useComboboxAnchor() {
|
|
|
3505
3536
|
return React.useRef(null);
|
|
3506
3537
|
}
|
|
3507
3538
|
//#endregion
|
|
3508
|
-
//#region src/components/
|
|
3509
|
-
const
|
|
3510
|
-
const
|
|
3511
|
-
|
|
3539
|
+
//#region src/components/dialog.tsx
|
|
3540
|
+
const _excluded$41 = ["className"];
|
|
3541
|
+
const _excluded2$28 = [
|
|
3542
|
+
"className",
|
|
3543
|
+
"children",
|
|
3544
|
+
"showCloseButton"
|
|
3545
|
+
];
|
|
3546
|
+
const _excluded3$21 = ["className"];
|
|
3547
|
+
const _excluded4$18 = [
|
|
3548
|
+
"className",
|
|
3549
|
+
"showCloseButton",
|
|
3550
|
+
"children"
|
|
3551
|
+
];
|
|
3552
|
+
const _excluded5$13 = ["className"];
|
|
3553
|
+
const _excluded6$11 = ["className"];
|
|
3512
3554
|
/**
|
|
3513
|
-
*
|
|
3514
|
-
*
|
|
3515
|
-
* list path).
|
|
3555
|
+
* Root of the dialog, wrapping Base UI's `Dialog.Root`. Manages open/close state and renders no DOM
|
|
3556
|
+
* element — place `DialogTrigger` and `DialogContent` inside it.
|
|
3516
3557
|
*
|
|
3517
|
-
*
|
|
3518
|
-
*
|
|
3519
|
-
*
|
|
3520
|
-
*
|
|
3558
|
+
* @example
|
|
3559
|
+
* ```tsx
|
|
3560
|
+
* <Dialog>
|
|
3561
|
+
* <DialogTrigger render={<Button />}>Open</DialogTrigger>
|
|
3562
|
+
* <DialogContent>
|
|
3563
|
+
* <DialogHeader>
|
|
3564
|
+
* <DialogTitle>Title</DialogTitle>
|
|
3565
|
+
* <DialogDescription>Description</DialogDescription>
|
|
3566
|
+
* </DialogHeader>
|
|
3567
|
+
* </DialogContent>
|
|
3568
|
+
* </Dialog>
|
|
3569
|
+
* ```
|
|
3521
3570
|
*/
|
|
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
|
-
]);
|
|
3571
|
+
function Dialog(componentProps) {
|
|
3572
|
+
return /* @__PURE__ */ jsx(Dialog$1.Root, _objectSpread2({ "data-slot": "dialog" }, componentProps));
|
|
3542
3573
|
}
|
|
3543
3574
|
/**
|
|
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`.
|
|
3575
|
+
* Button that opens the dialog, wrapping Base UI's `Dialog.Trigger`. Renders a `<button>` by
|
|
3576
|
+
* default (override with `render`).
|
|
3552
3577
|
*/
|
|
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
|
-
}
|
|
3578
|
+
const DialogTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
3579
|
+
const props = _extends({}, (_objectDestructuringEmpty(componentProps), componentProps));
|
|
3580
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, _objectSpread2({
|
|
3581
|
+
ref: forwardRef,
|
|
3582
|
+
"data-slot": "dialog-trigger"
|
|
3583
|
+
}, props));
|
|
3584
|
+
});
|
|
3585
|
+
DialogTrigger.displayName = "DialogTrigger";
|
|
3619
3586
|
/**
|
|
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.
|
|
3587
|
+
* Portals dialog content into the document body, wrapping Base UI's `Dialog.Portal`. Renders no DOM
|
|
3588
|
+
* element of its own.
|
|
3630
3589
|
*/
|
|
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
|
-
});
|
|
3590
|
+
function DialogPortal(componentProps) {
|
|
3591
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, _objectSpread2({ "data-slot": "dialog-portal" }, componentProps));
|
|
3684
3592
|
}
|
|
3685
3593
|
/**
|
|
3686
|
-
*
|
|
3687
|
-
*
|
|
3688
|
-
* returned function once per group from the Root's grouped `items`.
|
|
3594
|
+
* Button that closes the dialog, wrapping Base UI's `Dialog.Close`. Renders a `<button>` by default
|
|
3595
|
+
* (override with `render`).
|
|
3689
3596
|
*/
|
|
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";
|
|
3597
|
+
const DialogClose = React.forwardRef((componentProps, forwardRef) => {
|
|
3598
|
+
const props = _extends({}, (_objectDestructuringEmpty(componentProps), componentProps));
|
|
3599
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, _objectSpread2({
|
|
3600
|
+
ref: forwardRef,
|
|
3601
|
+
"data-slot": "dialog-close"
|
|
3602
|
+
}, props));
|
|
3603
|
+
});
|
|
3604
|
+
DialogClose.displayName = "DialogClose";
|
|
4022
3605
|
/**
|
|
4023
3606
|
* Dimming backdrop rendered behind the dialog, wrapping Base UI's `Dialog.Backdrop`. Renders a
|
|
4024
3607
|
* fixed, full-viewport `<div>`. Included automatically by `DialogContent`.
|
|
@@ -4152,169 +3735,565 @@ const Command = React.forwardRef((componentProps, forwardRef) => {
|
|
|
4152
3735
|
});
|
|
4153
3736
|
Command.displayName = "Command";
|
|
4154
3737
|
/**
|
|
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.
|
|
3738
|
+
* A `Command` menu rendered inside a modal `Dialog` — the command-palette
|
|
3739
|
+
* pattern. Renders no DOM element of its own; the visually hidden title and
|
|
3740
|
+
* description keep it accessible.
|
|
3741
|
+
*
|
|
3742
|
+
* @prop title - Screen-reader-only dialog title. Default: `'Command Palette'`.
|
|
3743
|
+
* @prop description - Screen-reader-only dialog description.
|
|
3744
|
+
* Default: `'Search for a command to run...'`.
|
|
3745
|
+
*
|
|
3746
|
+
* @example
|
|
3747
|
+
* ```tsx
|
|
3748
|
+
* <CommandDialog open={open} onOpenChange={setOpen}>
|
|
3749
|
+
* <CommandInput placeholder="Type a command..." />
|
|
3750
|
+
* <CommandList>
|
|
3751
|
+
* <CommandItem>Profile</CommandItem>
|
|
3752
|
+
* </CommandList>
|
|
3753
|
+
* </CommandDialog>
|
|
3754
|
+
* ```
|
|
3755
|
+
*/
|
|
3756
|
+
function CommandDialog(componentProps) {
|
|
3757
|
+
const { title = "Command Palette", description = "Search for a command to run...", children } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$27);
|
|
3758
|
+
return /* @__PURE__ */ jsxs(Dialog, _objectSpread2(_objectSpread2({}, props), {}, { children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
3759
|
+
className: "sr-only",
|
|
3760
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
3761
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
3762
|
+
className: "overflow-hidden p-0",
|
|
3763
|
+
children: /* @__PURE__ */ jsx(Command, {
|
|
3764
|
+
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",
|
|
3765
|
+
children
|
|
3766
|
+
})
|
|
3767
|
+
})] }));
|
|
3768
|
+
}
|
|
3769
|
+
/**
|
|
3770
|
+
* The search field that filters the command list as the user types. Renders an
|
|
3771
|
+
* `<input>` inside a `<div>` wrapper with a leading search icon.
|
|
3772
|
+
*/
|
|
3773
|
+
const CommandInput = React.forwardRef((componentProps, forwardRef) => {
|
|
3774
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded3$20);
|
|
3775
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3776
|
+
"data-slot": "command-input-wrapper",
|
|
3777
|
+
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
3778
|
+
children: [/* @__PURE__ */ jsx(Search, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, _objectSpread2({
|
|
3779
|
+
ref: forwardRef,
|
|
3780
|
+
"data-slot": "command-input",
|
|
3781
|
+
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)
|
|
3782
|
+
}, props))]
|
|
3783
|
+
});
|
|
3784
|
+
});
|
|
3785
|
+
CommandInput.displayName = "CommandInput";
|
|
3786
|
+
/**
|
|
3787
|
+
* Scrollable container holding the command groups, items, and empty state.
|
|
3788
|
+
* Renders a `<div>` that scrolls vertically when content overflows.
|
|
3789
|
+
*/
|
|
3790
|
+
const CommandList = React.forwardRef((componentProps, forwardRef) => {
|
|
3791
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded4$17);
|
|
3792
|
+
return /* @__PURE__ */ jsx(Command$1.List, _objectSpread2({
|
|
3793
|
+
ref: forwardRef,
|
|
3794
|
+
"data-slot": "command-list",
|
|
3795
|
+
className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className)
|
|
3796
|
+
}, props));
|
|
3797
|
+
});
|
|
3798
|
+
CommandList.displayName = "CommandList";
|
|
3799
|
+
/**
|
|
3800
|
+
* Message shown when the current search matches no items. Renders a centered
|
|
3801
|
+
* `<div>` that is only visible when the list is empty.
|
|
3802
|
+
*/
|
|
3803
|
+
const CommandEmpty = React.forwardRef((componentProps, forwardRef) => {
|
|
3804
|
+
const props = _extends({}, (_objectDestructuringEmpty(componentProps), componentProps));
|
|
3805
|
+
return /* @__PURE__ */ jsx(Command$1.Empty, _objectSpread2({
|
|
3806
|
+
ref: forwardRef,
|
|
3807
|
+
"data-slot": "command-empty",
|
|
3808
|
+
className: "py-6 text-center text-sm"
|
|
3809
|
+
}, props));
|
|
3810
|
+
});
|
|
3811
|
+
CommandEmpty.displayName = "CommandEmpty";
|
|
3812
|
+
/**
|
|
3813
|
+
* Groups related command items under an optional `heading`. Renders a `<div>`
|
|
3814
|
+
* that hides itself when none of its items match the search.
|
|
3815
|
+
*/
|
|
3816
|
+
const CommandGroup = React.forwardRef((componentProps, forwardRef) => {
|
|
3817
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded5$12);
|
|
3818
|
+
return /* @__PURE__ */ jsx(Command$1.Group, _objectSpread2({
|
|
3819
|
+
ref: forwardRef,
|
|
3820
|
+
"data-slot": "command-group",
|
|
3821
|
+
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)
|
|
3822
|
+
}, props));
|
|
3823
|
+
});
|
|
3824
|
+
CommandGroup.displayName = "CommandGroup";
|
|
3825
|
+
/**
|
|
3826
|
+
* A thin horizontal divider between command groups or items. Renders a `<div>`
|
|
3827
|
+
* one pixel tall.
|
|
3828
|
+
*/
|
|
3829
|
+
const CommandSeparator = React.forwardRef((componentProps, forwardRef) => {
|
|
3830
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded6$10);
|
|
3831
|
+
return /* @__PURE__ */ jsx(Command$1.Separator, _objectSpread2({
|
|
3832
|
+
ref: forwardRef,
|
|
3833
|
+
"data-slot": "command-separator",
|
|
3834
|
+
className: cn("bg-border -mx-1 h-px", className)
|
|
3835
|
+
}, props));
|
|
3836
|
+
});
|
|
3837
|
+
CommandSeparator.displayName = "CommandSeparator";
|
|
3838
|
+
/**
|
|
3839
|
+
* A single selectable command in the list. Renders a `<div>` that highlights on
|
|
3840
|
+
* hover/keyboard selection and can be disabled.
|
|
3841
|
+
*/
|
|
3842
|
+
const CommandItem = React.forwardRef((componentProps, forwardRef) => {
|
|
3843
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded7$5);
|
|
3844
|
+
return /* @__PURE__ */ jsx(Command$1.Item, _objectSpread2({
|
|
3845
|
+
ref: forwardRef,
|
|
3846
|
+
"data-slot": "command-item",
|
|
3847
|
+
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)
|
|
3848
|
+
}, props));
|
|
3849
|
+
});
|
|
3850
|
+
CommandItem.displayName = "CommandItem";
|
|
3851
|
+
/**
|
|
3852
|
+
* Right-aligned hint displaying an item's keyboard shortcut. Renders a `<span>`
|
|
3853
|
+
* with muted, spaced-out text.
|
|
3854
|
+
*/
|
|
3855
|
+
const CommandShortcut = React.forwardRef((componentProps, forwardRef) => {
|
|
3856
|
+
const { className } = componentProps, props = _objectWithoutProperties(componentProps, _excluded8$5);
|
|
3857
|
+
return /* @__PURE__ */ jsx("span", _objectSpread2({
|
|
3858
|
+
ref: forwardRef,
|
|
3859
|
+
"data-slot": "command-shortcut",
|
|
3860
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className)
|
|
3861
|
+
}, props));
|
|
3862
|
+
});
|
|
3863
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
3864
|
+
//#endregion
|
|
3865
|
+
//#region src/components/country-flag.tsx
|
|
3866
|
+
const _excluded$39 = [
|
|
3867
|
+
"countryIsoCode",
|
|
3868
|
+
"size",
|
|
3869
|
+
"className"
|
|
3870
|
+
];
|
|
3871
|
+
const sizeMap = {
|
|
3872
|
+
sm: "size-3",
|
|
3873
|
+
md: "size-4",
|
|
3874
|
+
lg: "size-5",
|
|
3875
|
+
xl: "size-6"
|
|
3876
|
+
};
|
|
3877
|
+
/**
|
|
3878
|
+
* Renders the flag icon for a given country as an inline `<svg>`.
|
|
3879
|
+
* Falls back to the US flag when the ISO code has no matching flag.
|
|
3880
|
+
*
|
|
3881
|
+
* @prop countryIsoCode - ISO country code selecting the flag to render.
|
|
3882
|
+
* @prop size - Flag dimensions: `sm` (12px) | `md` (16px) | `lg` (20px) | `xl` (24px). Default: `'xl'`.
|
|
3883
|
+
*
|
|
3884
|
+
* @example
|
|
3885
|
+
* ```tsx
|
|
3886
|
+
* <CountryFlag countryIsoCode="FR" size="md" />
|
|
3887
|
+
* ```
|
|
3888
|
+
*/
|
|
3889
|
+
const CountryFlag = React.forwardRef((componentProps, forwardRef) => {
|
|
3890
|
+
var _FLAGS$countryIsoCode;
|
|
3891
|
+
const { countryIsoCode, size = "xl", className } = componentProps, otherProps = _objectWithoutProperties(componentProps, _excluded$39);
|
|
3892
|
+
const CurrentFlag = (_FLAGS$countryIsoCode = FLAGS[countryIsoCode.toLowerCase()]) !== null && _FLAGS$countryIsoCode !== void 0 ? _FLAGS$countryIsoCode : FlagUs;
|
|
3893
|
+
return /* @__PURE__ */ jsx(CurrentFlag, _objectSpread2({
|
|
3894
|
+
ref: forwardRef,
|
|
3895
|
+
className: cn("flex-none", sizeMap[size], className)
|
|
3896
|
+
}, otherProps));
|
|
3897
|
+
});
|
|
3898
|
+
CountryFlag.displayName = "CountryFlag";
|
|
3899
|
+
//#endregion
|
|
3900
|
+
//#region src/components/combobox-rows.tsx
|
|
3901
|
+
const DEFAULT_SKELETON_COUNT = 5;
|
|
3902
|
+
const DEFAULT_ROW_HEIGHT = 36;
|
|
3903
|
+
const VIRTUAL_ROW_OVERSCAN = 8;
|
|
3904
|
+
/**
|
|
3905
|
+
* Buckets a flat `items` array into groups for a combobox list, preserving
|
|
3906
|
+
* first-seen group order. Returns `null` when `getGroupKey` is omitted (the flat
|
|
3907
|
+
* list path).
|
|
3908
|
+
*
|
|
3909
|
+
* Lives above the Combobox root rather than inside `ComboboxRows` because the
|
|
3910
|
+
* root's `items` prop must receive the GROUPED shape — Base UI derives its
|
|
3911
|
+
* collection, `data-empty`, keyboard nav and client-side filtering from it.
|
|
3912
|
+
* Internal to the package: not exported from `src/index.ts`.
|
|
3913
|
+
*/
|
|
3914
|
+
function useComboboxItemGroups(items, getGroupKey, getGroupLabel) {
|
|
3915
|
+
return React.useMemo(() => {
|
|
3916
|
+
if (!getGroupKey) return null;
|
|
3917
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
3918
|
+
for (const item of items) {
|
|
3919
|
+
const gk = getGroupKey(item);
|
|
3920
|
+
const bucket = byKey.get(gk);
|
|
3921
|
+
if (bucket) bucket.push(item);
|
|
3922
|
+
else byKey.set(gk, [item]);
|
|
3923
|
+
}
|
|
3924
|
+
return Array.from(byKey, ([groupKey, groupItems]) => ({
|
|
3925
|
+
groupKey,
|
|
3926
|
+
label: getGroupLabel ? getGroupLabel(groupKey) : groupKey,
|
|
3927
|
+
items: groupItems
|
|
3928
|
+
}));
|
|
3929
|
+
}, [
|
|
3930
|
+
items,
|
|
3931
|
+
getGroupKey,
|
|
3932
|
+
getGroupLabel
|
|
3933
|
+
]);
|
|
3934
|
+
}
|
|
3935
|
+
/**
|
|
3936
|
+
* The scrollable rows region shared by every `DataCombobox` layout: the rows
|
|
3937
|
+
* (flat or grouped), the infinite-scroll sentinel, the
|
|
3938
|
+
* skeleton rows, the filtering dim-overlay, the empty state, and the load-more
|
|
3939
|
+
* spinner row. It stops at the rows: the search input and any popup chrome
|
|
3940
|
+
* belong to whichever root renders this.
|
|
3941
|
+
*
|
|
3942
|
+
* Must be rendered inside a `Combobox` root whose `items` is `groups ?? items`.
|
|
3943
|
+
* Internal to the package: not exported from `src/index.ts`.
|
|
3944
|
+
*/
|
|
3945
|
+
function ComboboxRows(componentProps) {
|
|
3946
|
+
var _groups$at$items, _groups$at;
|
|
3947
|
+
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;
|
|
3948
|
+
const isInitialLoading = loadingState === "loading";
|
|
3949
|
+
const isFiltering = loadingState === "filtering";
|
|
3950
|
+
const isLoadingMore = loadingState === "loadingMore";
|
|
3951
|
+
const sentinelRef = useFetchMoreSentinel(onFetchMore, (node) => node.closest("[data-slot=\"combobox-list\"]"), items.length);
|
|
3952
|
+
const showFetchSentinel = !!onFetchMore && hasMore;
|
|
3953
|
+
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);
|
|
3954
|
+
const lastItemKey = lastRenderedItem ? getItemValue(lastRenderedItem) : void 0;
|
|
3955
|
+
const renderRow = (item) => {
|
|
3956
|
+
var _disabledKeys$has;
|
|
3957
|
+
const key = getItemValue(item);
|
|
3958
|
+
const attachSentinel = showFetchSentinel && !virtualizeRows && key === lastItemKey;
|
|
3959
|
+
return /* @__PURE__ */ jsx(ComboboxItem, {
|
|
3960
|
+
value: item,
|
|
3961
|
+
disabled: (_disabledKeys$has = disabledKeys === null || disabledKeys === void 0 ? void 0 : disabledKeys.has(key)) !== null && _disabledKeys$has !== void 0 ? _disabledKeys$has : false,
|
|
3962
|
+
ref: attachSentinel ? sentinelRef : void 0,
|
|
3963
|
+
"data-test": attachSentinel ? "fetch-sentinel" : void 0,
|
|
3964
|
+
children: renderItem ? renderItem(item) : getItemLabel(item)
|
|
3965
|
+
}, key);
|
|
3966
|
+
};
|
|
3967
|
+
const hasRows = items.length > 0;
|
|
3968
|
+
const virtualRows = virtualizeRows ? /* @__PURE__ */ jsx(ComboboxVirtualRows, {
|
|
3969
|
+
getItemValue,
|
|
3970
|
+
getItemLabel,
|
|
3971
|
+
renderItem,
|
|
3972
|
+
disabledKeys,
|
|
3973
|
+
estimateRowHeight,
|
|
3974
|
+
sentinelRef,
|
|
3975
|
+
showFetchSentinel,
|
|
3976
|
+
scrollRowIntoViewRef
|
|
3977
|
+
}) : null;
|
|
3978
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3979
|
+
"data-slot": "combobox-rows",
|
|
3980
|
+
className: cn("relative", isFiltering && !hasRows && "min-h-24"),
|
|
3981
|
+
children: [/* @__PURE__ */ jsx(ComboboxLoadedRows, {
|
|
3982
|
+
isInitialLoading,
|
|
3983
|
+
skeletonCount,
|
|
3984
|
+
groups,
|
|
3985
|
+
renderRow,
|
|
3986
|
+
virtualRows,
|
|
3987
|
+
isFiltering,
|
|
3988
|
+
isLoadingMore,
|
|
3989
|
+
emptyState,
|
|
3990
|
+
listClassName,
|
|
3991
|
+
listTabIndex,
|
|
3992
|
+
"aria-label": ariaLabel
|
|
3993
|
+
}), isFiltering ? /* @__PURE__ */ jsx(ComboboxFilteringOverlay, {}) : null]
|
|
3994
|
+
});
|
|
3995
|
+
}
|
|
3996
|
+
/** The loaded rows region: the list itself, the empty state, and the load-more spinner row. */
|
|
3997
|
+
function ComboboxLoadedRows(componentProps) {
|
|
3998
|
+
const { isInitialLoading, skeletonCount, groups, renderRow, virtualRows, isFiltering, isLoadingMore, emptyState, listClassName, listTabIndex, "aria-label": ariaLabel } = componentProps;
|
|
3999
|
+
const t = useDsTranslation("ds");
|
|
4000
|
+
const listChildren = isInitialLoading ? /* @__PURE__ */ jsx(ComboboxSkeletonRows, { count: skeletonCount }) : virtualRows !== null && virtualRows !== void 0 ? virtualRows : groups === null ? renderRow : renderGroupSection(renderRow);
|
|
4001
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4002
|
+
/* @__PURE__ */ jsx(ComboboxList, _objectSpread2(_objectSpread2({
|
|
4003
|
+
"aria-label": ariaLabel,
|
|
4004
|
+
className: listClassName
|
|
4005
|
+
}, listTabIndex === void 0 ? {} : { tabIndex: listTabIndex }), {}, { children: listChildren })),
|
|
4006
|
+
/* @__PURE__ */ jsx(ComboboxEmpty, {
|
|
4007
|
+
className: "flex empty:hidden",
|
|
4008
|
+
children: isFiltering || isInitialLoading ? null : emptyState !== null && emptyState !== void 0 ? emptyState : t("dataCombobox.noResults")
|
|
4009
|
+
}),
|
|
4010
|
+
isLoadingMore ? /* @__PURE__ */ jsx(SpinnerRow, {}) : null
|
|
4011
|
+
] });
|
|
4012
|
+
}
|
|
4013
|
+
/**
|
|
4014
|
+
* Renders only the rows inside the scrolled window of a FLAT combobox list, at
|
|
4015
|
+
* absolute offsets inside a full-height spacer, so a 244-item list keeps roughly
|
|
4016
|
+
* twenty rows in the DOM.
|
|
4017
|
+
*
|
|
4018
|
+
* Reads the rows from Base UI's `useFilteredItems` rather than from the `items`
|
|
4019
|
+
* prop: with client-side filtering on, the window must slide over the FILTERED
|
|
4020
|
+
* rows, and the flat index of a filtered row is exactly what Base UI's keyboard
|
|
4021
|
+
* navigation, `aria-activedescendant` and Enter-to-select are indexed by. That
|
|
4022
|
+
* index is passed to every row explicitly — the automatic DOM-order index is
|
|
4023
|
+
* meaningless when only a window is mounted.
|
|
4024
|
+
*/
|
|
4025
|
+
function ComboboxVirtualRows(componentProps) {
|
|
4026
|
+
"use no memo";
|
|
4027
|
+
var _spacerElement$closes;
|
|
4028
|
+
const { getItemValue, getItemLabel, renderItem, disabledKeys, estimateRowHeight, sentinelRef, showFetchSentinel, scrollRowIntoViewRef } = componentProps;
|
|
4029
|
+
const filteredItems = Combobox$1.useFilteredItems();
|
|
4030
|
+
const [spacerElement, setSpacerElement] = React.useState(null);
|
|
4031
|
+
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;
|
|
4032
|
+
const rowVirtualizer = useVirtualizer({
|
|
4033
|
+
count: filteredItems.length,
|
|
4034
|
+
getScrollElement: () => scrollElement,
|
|
4035
|
+
estimateSize: () => estimateRowHeight,
|
|
4036
|
+
overscan: VIRTUAL_ROW_OVERSCAN
|
|
4037
|
+
});
|
|
4038
|
+
React.useEffect(() => {
|
|
4039
|
+
if (!scrollRowIntoViewRef) return void 0;
|
|
4040
|
+
scrollRowIntoViewRef.current = (index) => rowVirtualizer.scrollToIndex(index, { align: "auto" });
|
|
4041
|
+
return () => {
|
|
4042
|
+
scrollRowIntoViewRef.current = null;
|
|
4043
|
+
};
|
|
4044
|
+
}, [rowVirtualizer, scrollRowIntoViewRef]);
|
|
4045
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4046
|
+
ref: setSpacerElement,
|
|
4047
|
+
"data-slot": "combobox-virtual-rows",
|
|
4048
|
+
className: "relative w-full",
|
|
4049
|
+
style: { height: rowVirtualizer.getTotalSize() },
|
|
4050
|
+
children: [rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
4051
|
+
var _disabledKeys$has2;
|
|
4052
|
+
const item = filteredItems[virtualRow.index];
|
|
4053
|
+
if (item === void 0) return null;
|
|
4054
|
+
const key = getItemValue(item);
|
|
4055
|
+
return /* @__PURE__ */ jsx(ComboboxItem, {
|
|
4056
|
+
index: virtualRow.index,
|
|
4057
|
+
value: item,
|
|
4058
|
+
disabled: (_disabledKeys$has2 = disabledKeys === null || disabledKeys === void 0 ? void 0 : disabledKeys.has(key)) !== null && _disabledKeys$has2 !== void 0 ? _disabledKeys$has2 : false,
|
|
4059
|
+
ref: rowVirtualizer.measureElement,
|
|
4060
|
+
"data-index": virtualRow.index,
|
|
4061
|
+
style: {
|
|
4062
|
+
position: "absolute",
|
|
4063
|
+
top: 0,
|
|
4064
|
+
left: 0,
|
|
4065
|
+
width: "100%",
|
|
4066
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
4067
|
+
},
|
|
4068
|
+
children: renderItem ? renderItem(item) : getItemLabel(item)
|
|
4069
|
+
}, key);
|
|
4070
|
+
}), showFetchSentinel && filteredItems.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
4071
|
+
ref: sentinelRef,
|
|
4072
|
+
"aria-hidden": true,
|
|
4073
|
+
"data-test": "fetch-sentinel",
|
|
4074
|
+
"data-slot": "combobox-fetch-sentinel",
|
|
4075
|
+
className: "absolute bottom-0 h-px w-full"
|
|
4076
|
+
}) : null]
|
|
4077
|
+
});
|
|
4078
|
+
}
|
|
4079
|
+
/**
|
|
4080
|
+
* Builds `ComboboxList`'s render-prop for a GROUPED list: one `ComboboxGroup`
|
|
4081
|
+
* per section, each header plus a collection of leaf rows. Base UI calls the
|
|
4082
|
+
* returned function once per group from the Root's grouped `items`.
|
|
4083
|
+
*/
|
|
4084
|
+
function renderGroupSection(renderRow) {
|
|
4085
|
+
return (group) => /* @__PURE__ */ jsxs(ComboboxGroup, {
|
|
4086
|
+
items: group.items,
|
|
4087
|
+
children: [/* @__PURE__ */ jsx(ComboboxLabel, { children: group.label }), /* @__PURE__ */ jsx(ComboboxCollection, { children: renderRow })]
|
|
4088
|
+
}, group.groupKey);
|
|
4089
|
+
}
|
|
4090
|
+
/** The dimmed spinner overlay covering the list while a re-query is in flight. */
|
|
4091
|
+
function ComboboxFilteringOverlay() {
|
|
4092
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4093
|
+
"data-slot": "combobox-loading-overlay",
|
|
4094
|
+
className: "bg-popover/60 absolute inset-0 z-10 flex items-center justify-center",
|
|
4095
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
4096
|
+
});
|
|
4097
|
+
}
|
|
4098
|
+
/**
|
|
4099
|
+
* A centered spinner row for the filtering and load-more states. Not
|
|
4100
|
+
* `aria-hidden` — the `Spinner`'s `role="status"` announces loading to screen
|
|
4101
|
+
* readers (that's the point of a loading indicator).
|
|
4102
|
+
*/
|
|
4103
|
+
function SpinnerRow() {
|
|
4104
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4105
|
+
"data-slot": "combobox-spinner-row",
|
|
4106
|
+
className: "flex justify-center py-2 text-muted-foreground",
|
|
4107
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
4108
|
+
});
|
|
4109
|
+
}
|
|
4110
|
+
/** Skeleton rows, padded like the list, shown while the initial page loads. */
|
|
4111
|
+
function ComboboxSkeletonRows({ count }) {
|
|
4112
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4113
|
+
"data-slot": "combobox-skeleton-rows",
|
|
4114
|
+
className: "p-1",
|
|
4115
|
+
children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx("div", {
|
|
4116
|
+
"aria-hidden": true,
|
|
4117
|
+
"data-test": "loading-item",
|
|
4118
|
+
"data-slot": "combobox-skeleton-row",
|
|
4119
|
+
className: "flex items-center gap-2 rounded-md p-2",
|
|
4120
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" })
|
|
4121
|
+
}, `skeleton-${i}`))
|
|
4122
|
+
});
|
|
4123
|
+
}
|
|
4124
|
+
//#endregion
|
|
4125
|
+
//#region src/lib/use-combobox-item-selection.ts
|
|
4126
|
+
const EMPTY_KEYS = /* @__PURE__ */ new Set();
|
|
4127
|
+
/**
|
|
4128
|
+
* The `onInputValueChange` reasons that forward the new query to `onSearch`:
|
|
4129
|
+
* - `input-change` — real typing/paste.
|
|
4130
|
+
* - `input-clear` — Base UI clears the field itself after a selection.
|
|
4131
|
+
* - `clear-press` — the input's clear (x) button.
|
|
4132
|
+
*
|
|
4133
|
+
* `escape-key` is deliberately absent. Every combobox that uses this hook owns a
|
|
4134
|
+
* popup, so Escape CLOSES that popup rather than clearing the query, and
|
|
4135
|
+
* forwarding it would refetch on every dismissal.
|
|
4136
|
+
*
|
|
4137
|
+
* There used to be a second, INLINE set that added `escape-key`, for a list
|
|
4138
|
+
* rendered with no popup of its own — where Escape was the list's reset rather
|
|
4139
|
+
* than a dismissal. Nothing renders that way any more, so the layout-dependent
|
|
4140
|
+
* choice and the option that selected between the two are both gone.
|
|
4141
|
+
*/
|
|
4142
|
+
const SEARCH_TRIGGER_REASONS = /* @__PURE__ */ new Set([
|
|
4143
|
+
"input-change",
|
|
4144
|
+
"input-clear",
|
|
4145
|
+
"clear-press"
|
|
4146
|
+
]);
|
|
4147
|
+
/**
|
|
4148
|
+
* Bridges a `Set<string>` of selected keys to the item objects Base UI's
|
|
4149
|
+
* Combobox root wants for `value` / `onValueChange`, and gates the input's
|
|
4150
|
+
* value changes down to real search queries.
|
|
4158
4151
|
*
|
|
4159
|
-
*
|
|
4160
|
-
*
|
|
4161
|
-
*
|
|
4152
|
+
* Used by `DataCombobox`, whose three layouts all own a Combobox root and need
|
|
4153
|
+
* the identical selection semantics. Internal to the package: not exported
|
|
4154
|
+
* from `src/index.ts`.
|
|
4162
4155
|
*
|
|
4163
4156
|
* @example
|
|
4164
4157
|
* ```tsx
|
|
4165
|
-
*
|
|
4166
|
-
*
|
|
4167
|
-
* <CommandList>
|
|
4168
|
-
* <CommandItem>Profile</CommandItem>
|
|
4169
|
-
* </CommandList>
|
|
4170
|
-
* </CommandDialog>
|
|
4158
|
+
* const { keys, selectedObjects, commit, handleInputValueChange } =
|
|
4159
|
+
* useComboboxItemSelection({ items, getItemValue, selectedKeys, onSelectionChange });
|
|
4171
4160
|
* ```
|
|
4172
4161
|
*/
|
|
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))]
|
|
4162
|
+
function useComboboxItemSelection(options) {
|
|
4163
|
+
const { items, getItemValue, selectedItems, selectedKeys, defaultSelectedKeys, onSelectionChange, onSearch } = options;
|
|
4164
|
+
const itemCacheRef = React.useRef(/* @__PURE__ */ new Map());
|
|
4165
|
+
if (selectedItems) for (const item of selectedItems) itemCacheRef.current.set(getItemValue(item), item);
|
|
4166
|
+
for (const item of items) itemCacheRef.current.set(getItemValue(item), item);
|
|
4167
|
+
const itemCache = itemCacheRef.current;
|
|
4168
|
+
const [selectionSet, setSelectionSet] = useControllableState({
|
|
4169
|
+
prop: selectedKeys,
|
|
4170
|
+
defaultProp: defaultSelectedKeys
|
|
4200
4171
|
});
|
|
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
|
-
|
|
4172
|
+
const keys = selectionSet !== null && selectionSet !== void 0 ? selectionSet : EMPTY_KEYS;
|
|
4173
|
+
const selectedObjects = [];
|
|
4174
|
+
for (const key of keys) {
|
|
4175
|
+
const item = itemCache.get(key);
|
|
4176
|
+
if (item) selectedObjects.push(item);
|
|
4177
|
+
}
|
|
4178
|
+
const commit = React.useCallback((objs, details) => {
|
|
4179
|
+
const next = new Set(objs.map(getItemValue));
|
|
4180
|
+
setSelectionSet(next);
|
|
4181
|
+
onSelectionChange === null || onSelectionChange === void 0 || onSelectionChange(next, details);
|
|
4182
|
+
}, [
|
|
4183
|
+
setSelectionSet,
|
|
4184
|
+
getItemValue,
|
|
4185
|
+
onSelectionChange
|
|
4186
|
+
]);
|
|
4187
|
+
const lastQueryRef = React.useRef("");
|
|
4188
|
+
return {
|
|
4189
|
+
keys,
|
|
4190
|
+
selectedObjects,
|
|
4191
|
+
commit,
|
|
4192
|
+
handleInputValueChange: onSearch ? (value, details) => {
|
|
4193
|
+
if (SEARCH_TRIGGER_REASONS.has(details.reason)) {
|
|
4194
|
+
lastQueryRef.current = value;
|
|
4195
|
+
onSearch(value);
|
|
4196
|
+
}
|
|
4197
|
+
} : void 0,
|
|
4198
|
+
resetSearch: React.useCallback(() => {
|
|
4199
|
+
if (!onSearch || lastQueryRef.current === "") return;
|
|
4200
|
+
lastQueryRef.current = "";
|
|
4201
|
+
onSearch("");
|
|
4202
|
+
}, [onSearch])
|
|
4203
|
+
};
|
|
4204
|
+
}
|
|
4205
|
+
//#endregion
|
|
4206
|
+
//#region src/components/data-combobox.tsx
|
|
4229
4207
|
/**
|
|
4230
|
-
*
|
|
4231
|
-
*
|
|
4208
|
+
* Row count at which `DataCombobox` virtualises its rows on its own, when `virtualizeRows` was not
|
|
4209
|
+
* passed either way. Exported so it can be asserted against and tuned in ONE place.
|
|
4210
|
+
*
|
|
4211
|
+
* Crossing it LATCHES virtualisation on for the life of the component - see the `virtualizeRows`
|
|
4212
|
+
* prop doc. A list that declares `onFetchMore` can grow without bound, so it starts out virtualised
|
|
4213
|
+
* regardless of this number rather than waiting to cross it.
|
|
4214
|
+
*
|
|
4215
|
+
* A STARTING POINT, not a measured optimum. The two real data points behind it: 244 countries with
|
|
4216
|
+
* a flag per row was visibly laggy unvirtualised, and the user lists are server-capped at 10 rows
|
|
4217
|
+
* today, so both known cases sit far from this line and the exact value is not load-bearing yet.
|
|
4218
|
+
* Measure before tuning it - the honest cost driver is how expensive `renderItem` is, not the row
|
|
4219
|
+
* count alone, and a threshold cannot see that.
|
|
4232
4220
|
*/
|
|
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";
|
|
4221
|
+
const COMBOBOX_AUTO_VIRTUALIZE_THRESHOLD = 100;
|
|
4242
4222
|
/**
|
|
4243
|
-
*
|
|
4244
|
-
*
|
|
4223
|
+
* Row count at which `searchable="auto"` decides a list is long enough to need a search input.
|
|
4224
|
+
*
|
|
4225
|
+
* Exported so a consumer can reason about the boundary rather than re-deriving it, and so the
|
|
4226
|
+
* number lives in ONE place. Comes from the dashboard filter design (Figma node 7959:10798), which
|
|
4227
|
+
* annotates every drawer field as "Combobox - with search if 15+ items".
|
|
4228
|
+
*
|
|
4229
|
+
* Only consulted for `searchable="auto"`. An explicit `true` or `false` always wins, and the
|
|
4230
|
+
* default is still `true`, so no list changes behaviour without asking.
|
|
4245
4231
|
*/
|
|
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";
|
|
4232
|
+
const COMBOBOX_AUTO_SEARCH_THRESHOLD = 15;
|
|
4255
4233
|
/**
|
|
4256
|
-
*
|
|
4257
|
-
*
|
|
4234
|
+
* Resolves the tri-state `searchable` prop to the single boolean every layout below reads.
|
|
4235
|
+
*
|
|
4236
|
+
* The `hasServerSearch` disjunct is not a nicety: a server-driven list's `items` is one page, so
|
|
4237
|
+
* its length says nothing about how much data exists. Counting it alone would strip the search box
|
|
4238
|
+
* off a 10-row first page of thousands - the one list that cannot function without one.
|
|
4239
|
+
*
|
|
4240
|
+
* Internal to the package (not exported from `src/index.ts`); exported from this module only so
|
|
4241
|
+
* `data-combobox.test.ts` can assert the predicate without a browser.
|
|
4242
|
+
*
|
|
4243
|
+
* @param searchable The `searchable` prop as passed - `true`, `false`, or `'auto'`.
|
|
4244
|
+
* @param hasServerSearch Whether an `onSearch` handler was provided.
|
|
4245
|
+
* @param itemCount `items.length` for this render.
|
|
4258
4246
|
*/
|
|
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";
|
|
4247
|
+
function resolveSearchable(searchable, hasServerSearch, itemCount) {
|
|
4248
|
+
return searchable === "auto" ? hasServerSearch || itemCount >= 15 : searchable;
|
|
4249
|
+
}
|
|
4268
4250
|
/**
|
|
4269
|
-
*
|
|
4270
|
-
*
|
|
4251
|
+
* Whether the auto-virtualisation LATCH should be raised on this render.
|
|
4252
|
+
*
|
|
4253
|
+
* Only ever consulted while the latch is still down - raising it is one-way, so this answering
|
|
4254
|
+
* `false` later never lowers it. A list that can grow without bound (one declaring `onFetchMore`)
|
|
4255
|
+
* says `true` on its very first render rather than waiting to cross the threshold, because it WILL
|
|
4256
|
+
* cross it and the crossing is the expensive part.
|
|
4257
|
+
*
|
|
4258
|
+
* Internal to the package (not exported from `src/index.ts`); exported from this module only so
|
|
4259
|
+
* `data-combobox.test.ts` can assert the predicate without a browser.
|
|
4260
|
+
*
|
|
4261
|
+
* @param hasFetchMore Whether an `onFetchMore` handler was provided.
|
|
4262
|
+
* @param itemCount `items.length` for this render.
|
|
4271
4263
|
*/
|
|
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
|
-
};
|
|
4264
|
+
function shouldAutoVirtualize(hasFetchMore, itemCount) {
|
|
4265
|
+
return hasFetchMore || itemCount >= 100;
|
|
4266
|
+
}
|
|
4294
4267
|
/**
|
|
4295
|
-
*
|
|
4296
|
-
* Falls back to the US flag when the ISO code has no matching flag.
|
|
4268
|
+
* Resolves the tri-state `virtualizeRows` prop plus the latch into the boolean handed to Base UI.
|
|
4297
4269
|
*
|
|
4298
|
-
*
|
|
4299
|
-
*
|
|
4270
|
+
* Explicit wins over the heuristic, both ways: `true` forces it on below the threshold, `false`
|
|
4271
|
+
* forces it off above one. `'auto'` and omitted resolve the same way, so only an explicit boolean
|
|
4272
|
+
* overrides the latch. A GROUPED list opts out either way - group headers would need a second,
|
|
4273
|
+
* variable-height index space on top of the row one, so grouping means the prerequisite is missing
|
|
4274
|
+
* rather than that virtualisation is merely unwanted.
|
|
4300
4275
|
*
|
|
4301
|
-
*
|
|
4302
|
-
*
|
|
4303
|
-
*
|
|
4304
|
-
*
|
|
4276
|
+
* Internal to the package (not exported from `src/index.ts`); exported from this module only so
|
|
4277
|
+
* `data-combobox.test.ts` can assert the precedence without a browser.
|
|
4278
|
+
*
|
|
4279
|
+
* @param requested The `virtualizeRows` prop as passed - `true`, `false`, `'auto'`, or omitted.
|
|
4280
|
+
* @param latched Whether the auto-virtualisation latch is up (see {@link shouldAutoVirtualize}).
|
|
4281
|
+
* @param isGrouped Whether a `getGroupKey` was provided.
|
|
4305
4282
|
*/
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4283
|
+
function resolveVirtualizeRows(requested, latched, isGrouped) {
|
|
4284
|
+
return (typeof requested === "boolean" ? requested : latched) && !isGrouped;
|
|
4285
|
+
}
|
|
4286
|
+
/**
|
|
4287
|
+
* Scrolls a keyboard-highlighted row into view while rows are virtualised.
|
|
4288
|
+
* A no-op without virtualisation (nothing fills the ref), for a pointer-driven
|
|
4289
|
+
* highlight (the row is already under the cursor, so already mounted), and when
|
|
4290
|
+
* the highlight was cleared (index `-1`).
|
|
4291
|
+
*/
|
|
4292
|
+
function scrollHighlightedRowIntoView(scrollRowIntoViewRef, index, reason) {
|
|
4293
|
+
var _scrollRowIntoViewRef;
|
|
4294
|
+
if (reason === "pointer" || index < 0) return;
|
|
4295
|
+
(_scrollRowIntoViewRef = scrollRowIntoViewRef.current) === null || _scrollRowIntoViewRef === void 0 || _scrollRowIntoViewRef.call(scrollRowIntoViewRef, index);
|
|
4296
|
+
}
|
|
4318
4297
|
/**
|
|
4319
4298
|
* Searchable dropdown built on the DS Combobox primitives, driven by an `items`
|
|
4320
4299
|
* array plus `getItemValue`/`getItemLabel`. Renders an inline input (single) or
|
|
@@ -4334,9 +4313,14 @@ CountryFlag.displayName = "CountryFlag";
|
|
|
4334
4313
|
*/
|
|
4335
4314
|
function DataCombobox(componentProps) {
|
|
4336
4315
|
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;
|
|
4316
|
+
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
4317
|
const multiple = selectionMode === "multiple";
|
|
4339
|
-
const
|
|
4318
|
+
const isSearchable = resolveSearchable(searchable, !!onSearch, items.length);
|
|
4319
|
+
const autoVirtualizeLatch = React.useRef(false);
|
|
4320
|
+
if (!autoVirtualizeLatch.current) autoVirtualizeLatch.current = shouldAutoVirtualize(!!onFetchMore, items.length);
|
|
4321
|
+
const virtualizeRows = resolveVirtualizeRows(componentProps.virtualizeRows, autoVirtualizeLatch.current, !!getGroupKey);
|
|
4322
|
+
const scrollRowIntoViewRef = React.useRef(null);
|
|
4323
|
+
const { keys, selectedObjects, commit, handleInputValueChange, resetSearch } = useComboboxItemSelection({
|
|
4340
4324
|
items,
|
|
4341
4325
|
getItemValue,
|
|
4342
4326
|
selectedItems,
|
|
@@ -4345,6 +4329,10 @@ function DataCombobox(componentProps) {
|
|
|
4345
4329
|
onSelectionChange,
|
|
4346
4330
|
onSearch
|
|
4347
4331
|
});
|
|
4332
|
+
const handleOpenChange = (nextOpen, details) => {
|
|
4333
|
+
if (!nextOpen) resetSearch();
|
|
4334
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(nextOpen, details);
|
|
4335
|
+
};
|
|
4348
4336
|
const groups = useComboboxItemGroups(items, getGroupKey, getGroupLabel);
|
|
4349
4337
|
const popupRows = /* @__PURE__ */ jsx(ComboboxRows, {
|
|
4350
4338
|
items,
|
|
@@ -4358,12 +4346,20 @@ function DataCombobox(componentProps) {
|
|
|
4358
4346
|
onFetchMore,
|
|
4359
4347
|
hasMore,
|
|
4360
4348
|
emptyState,
|
|
4361
|
-
|
|
4349
|
+
virtualizeRows,
|
|
4350
|
+
estimateRowHeight,
|
|
4351
|
+
scrollRowIntoViewRef,
|
|
4352
|
+
"aria-label": listAriaLabel !== null && listAriaLabel !== void 0 ? listAriaLabel : ariaLabel
|
|
4362
4353
|
});
|
|
4363
4354
|
const chipsAnchor = useComboboxAnchor();
|
|
4364
|
-
const overlayLayout = trigger ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Combobox$1.Trigger, {
|
|
4355
|
+
const overlayLayout = trigger ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Combobox$1.Trigger, {
|
|
4356
|
+
render: trigger,
|
|
4357
|
+
children: trigger.props.children
|
|
4358
|
+
}), /* @__PURE__ */ jsxs(ComboboxContent, {
|
|
4359
|
+
"aria-label": ariaLabel,
|
|
4360
|
+
anchor,
|
|
4365
4361
|
className: cn("min-w-50", contentClassName),
|
|
4366
|
-
children: [
|
|
4362
|
+
children: [isSearchable ? /* @__PURE__ */ jsx(ComboboxInput, {
|
|
4367
4363
|
showTrigger: false,
|
|
4368
4364
|
placeholder
|
|
4369
4365
|
}) : null, popupRows]
|
|
@@ -4371,6 +4367,8 @@ function DataCombobox(componentProps) {
|
|
|
4371
4367
|
if (multiple) return /* @__PURE__ */ jsx(Combobox, {
|
|
4372
4368
|
multiple: true,
|
|
4373
4369
|
autoHighlight: true,
|
|
4370
|
+
virtualized: virtualizeRows,
|
|
4371
|
+
onItemHighlighted: (_item, details) => scrollHighlightedRowIntoView(scrollRowIntoViewRef, details.index, details.reason),
|
|
4374
4372
|
items: groups !== null && groups !== void 0 ? groups : items,
|
|
4375
4373
|
disabled,
|
|
4376
4374
|
filter: onSearch || onFetchMore && hasMore ? null : void 0,
|
|
@@ -4380,19 +4378,26 @@ function DataCombobox(componentProps) {
|
|
|
4380
4378
|
itemToStringLabel: getItemLabel,
|
|
4381
4379
|
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
4382
4380
|
onInputValueChange: handleInputValueChange,
|
|
4383
|
-
|
|
4381
|
+
open,
|
|
4382
|
+
onOpenChange: handleOpenChange,
|
|
4384
4383
|
children: trigger ? overlayLayout : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComboboxChips, {
|
|
4385
4384
|
ref: chipsAnchor,
|
|
4386
4385
|
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, {
|
|
4386
|
+
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, {
|
|
4387
|
+
"aria-label": ariaLabel,
|
|
4388
|
+
placeholder: keys.size === 0 ? placeholder : "",
|
|
4389
|
+
readOnly: !isSearchable
|
|
4390
|
+
})] }) })
|
|
4388
4391
|
}), /* @__PURE__ */ jsx(ComboboxContent, {
|
|
4389
|
-
anchor: chipsAnchor,
|
|
4392
|
+
anchor: anchor !== null && anchor !== void 0 ? anchor : chipsAnchor,
|
|
4390
4393
|
className: cn("min-w-50", contentClassName),
|
|
4391
4394
|
children: popupRows
|
|
4392
4395
|
})] })
|
|
4393
4396
|
}, selectionMode);
|
|
4394
4397
|
return /* @__PURE__ */ jsx(Combobox, {
|
|
4395
4398
|
autoHighlight: true,
|
|
4399
|
+
virtualized: virtualizeRows,
|
|
4400
|
+
onItemHighlighted: (_item, details) => scrollHighlightedRowIntoView(scrollRowIntoViewRef, details.index, details.reason),
|
|
4396
4401
|
items: groups !== null && groups !== void 0 ? groups : items,
|
|
4397
4402
|
disabled,
|
|
4398
4403
|
filter: onSearch || onFetchMore && hasMore ? null : void 0,
|
|
@@ -4402,13 +4407,17 @@ function DataCombobox(componentProps) {
|
|
|
4402
4407
|
itemToStringLabel: getItemLabel,
|
|
4403
4408
|
isItemEqualToValue: (a, b) => getItemValue(a) === getItemValue(b),
|
|
4404
4409
|
onInputValueChange: handleInputValueChange,
|
|
4405
|
-
|
|
4410
|
+
open,
|
|
4411
|
+
onOpenChange: handleOpenChange,
|
|
4406
4412
|
children: trigger ? overlayLayout : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComboboxInput, {
|
|
4407
4413
|
className,
|
|
4414
|
+
"aria-label": ariaLabel,
|
|
4408
4415
|
placeholder,
|
|
4409
4416
|
disabled,
|
|
4410
|
-
showClear
|
|
4417
|
+
showClear,
|
|
4418
|
+
readOnly: !isSearchable
|
|
4411
4419
|
}), /* @__PURE__ */ jsx(ComboboxContent, {
|
|
4420
|
+
anchor,
|
|
4412
4421
|
className: cn("min-w-50", contentClassName),
|
|
4413
4422
|
children: popupRows
|
|
4414
4423
|
})] })
|
|
@@ -6593,6 +6602,14 @@ function DatePickerFooter({ footer }) {
|
|
|
6593
6602
|
children: footer
|
|
6594
6603
|
});
|
|
6595
6604
|
}
|
|
6605
|
+
/**
|
|
6606
|
+
* @internal
|
|
6607
|
+
* Coerces an unknown prop value into a `Date`, or `undefined` when it cannot
|
|
6608
|
+
* represent one. Storybook's `control: 'date'` hands back a millisecond number
|
|
6609
|
+
* rather than a `Date`, so `minDate`/`maxDate` must tolerate that shape.
|
|
6610
|
+
*
|
|
6611
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6612
|
+
*/
|
|
6596
6613
|
const toDateOrUndefined = (v) => {
|
|
6597
6614
|
if (v == null) return void 0;
|
|
6598
6615
|
if (v instanceof Date) return isNaN(v.getTime()) ? void 0 : v;
|
|
@@ -6601,11 +6618,28 @@ const toDateOrUndefined = (v) => {
|
|
|
6601
6618
|
return isNaN(d.getTime()) ? void 0 : d;
|
|
6602
6619
|
}
|
|
6603
6620
|
};
|
|
6621
|
+
/**
|
|
6622
|
+
* @internal
|
|
6623
|
+
* Builds the react-day-picker `Matcher[]` that blocks a date. The two bound
|
|
6624
|
+
* matchers are day-exact on purpose: `startOfDay(minDate)` / `endOfDay(maxDate)`
|
|
6625
|
+
* so a `minDate` carrying a time component (`new Date()` mid-afternoon) does not
|
|
6626
|
+
* reject a same-day selection, whose committed value is always local midnight.
|
|
6627
|
+
*
|
|
6628
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6629
|
+
*/
|
|
6604
6630
|
function buildConstraintMatchers(minDate, maxDate, disabledDates) {
|
|
6605
6631
|
const base = [{ before: startOfDay(minDate) }, { after: endOfDay(maxDate) }];
|
|
6606
6632
|
if (!disabledDates) return base;
|
|
6607
6633
|
return base.concat(Array.isArray(disabledDates) ? disabledDates : [disabledDates]);
|
|
6608
6634
|
}
|
|
6635
|
+
/**
|
|
6636
|
+
* @internal
|
|
6637
|
+
* Normalises two loose endpoints into a `DateRange` whose `from` is never after
|
|
6638
|
+
* its `to`. A lone `to` is promoted to `from` because react-day-picker cannot
|
|
6639
|
+
* render a range that has no start.
|
|
6640
|
+
*
|
|
6641
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6642
|
+
*/
|
|
6609
6643
|
function sortRange(a, b) {
|
|
6610
6644
|
if (!a && !b) return void 0;
|
|
6611
6645
|
if (!a) return { from: b };
|
|
@@ -6629,6 +6663,14 @@ function formatDateForAnnouncement(date, locale) {
|
|
|
6629
6663
|
return date.toDateString();
|
|
6630
6664
|
}
|
|
6631
6665
|
}
|
|
6666
|
+
/**
|
|
6667
|
+
* @internal
|
|
6668
|
+
* Formats the min/max bound interpolated into the out-of-bounds hint, in the
|
|
6669
|
+
* picker's own locale. Falls back to `toDateString()` when the locale tag is
|
|
6670
|
+
* not one `Intl.DateTimeFormat` accepts.
|
|
6671
|
+
*
|
|
6672
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6673
|
+
*/
|
|
6632
6674
|
function formatBoundDate(date, locale) {
|
|
6633
6675
|
try {
|
|
6634
6676
|
return getCachedDateTimeFormat(locale, {
|
|
@@ -6641,8 +6683,11 @@ function formatBoundDate(date, locale) {
|
|
|
6641
6683
|
}
|
|
6642
6684
|
}
|
|
6643
6685
|
/**
|
|
6686
|
+
* @internal
|
|
6644
6687
|
* Formats a `Date` as a `yyyy-MM-dd` string using local time (not UTC).
|
|
6645
6688
|
* Used for hidden form inputs so the submitted value matches the displayed date.
|
|
6689
|
+
*
|
|
6690
|
+
* Exported for `date-picker.test.ts` only. NOT re-exported from `src/index.ts`.
|
|
6646
6691
|
*/
|
|
6647
6692
|
function formatDateForInput(date) {
|
|
6648
6693
|
return format(date, "yyyy-MM-dd");
|
|
@@ -8978,7 +9023,7 @@ const InlineEditInput = React.forwardRef((componentProps, forwardRef) => {
|
|
|
8978
9023
|
});
|
|
8979
9024
|
InlineEditInput.displayName = "InlineEditInput";
|
|
8980
9025
|
//#endregion
|
|
8981
|
-
//#region src/components/inline-edit-
|
|
9026
|
+
//#region src/components/inline-edit-multi-combobox.tsx
|
|
8982
9027
|
const _excluded$22 = [
|
|
8983
9028
|
"className",
|
|
8984
9029
|
"children",
|
|
@@ -8993,8 +9038,8 @@ const _excluded2$15 = [
|
|
|
8993
9038
|
"emptyMessage",
|
|
8994
9039
|
"children"
|
|
8995
9040
|
];
|
|
8996
|
-
/** Context shared between the `
|
|
8997
|
-
const
|
|
9041
|
+
/** Context shared between the `InlineEditMultiCombobox` root and its compound sub-parts. */
|
|
9042
|
+
const InlineEditMultiComboboxContext = React.createContext({});
|
|
8998
9043
|
/**
|
|
8999
9044
|
* Wires a commit-on-blur callback that fires once when focus truly leaves the
|
|
9000
9045
|
* component - the chips row **and** the portaled popup/listbox. Returns handlers to
|
|
@@ -9041,24 +9086,24 @@ function useCommitOnBlur(rootRef, getValues, onBlur) {
|
|
|
9041
9086
|
};
|
|
9042
9087
|
}
|
|
9043
9088
|
/**
|
|
9044
|
-
* The chips row of an `
|
|
9089
|
+
* The chips row of an `InlineEditMultiCombobox`. Wraps the inline-edit chrome (hover/focus
|
|
9045
9090
|
* affordance) around a Base UI `Combobox.Chips` container that lays out the selected
|
|
9046
|
-
* chips and the trailing `
|
|
9091
|
+
* chips and the trailing `InlineEditMultiComboboxTrigger` in a wrapping flex row.
|
|
9047
9092
|
*
|
|
9048
9093
|
* @example
|
|
9049
9094
|
* ```tsx
|
|
9050
|
-
* <
|
|
9051
|
-
* <
|
|
9052
|
-
* <
|
|
9053
|
-
* </
|
|
9095
|
+
* <InlineEditMultiComboboxChips>
|
|
9096
|
+
* <InlineEditMultiComboboxValue>{…}</InlineEditMultiComboboxValue>
|
|
9097
|
+
* <InlineEditMultiComboboxTrigger />
|
|
9098
|
+
* </InlineEditMultiComboboxChips>
|
|
9054
9099
|
* ```
|
|
9055
9100
|
*/
|
|
9056
|
-
const
|
|
9101
|
+
const InlineEditMultiComboboxChips = React.forwardRef((componentProps, forwardRef) => {
|
|
9057
9102
|
const { "aria-invalid": ariaInvalid, className, id, children } = componentProps;
|
|
9058
|
-
const { readOnly } = React.useContext(
|
|
9103
|
+
const { readOnly } = React.useContext(InlineEditMultiComboboxContext);
|
|
9059
9104
|
const handleEmptyAreaClick = (e) => {
|
|
9060
9105
|
if (readOnly || e.target !== e.currentTarget) return;
|
|
9061
|
-
const trigger = e.currentTarget.querySelector("[data-slot=\"inline-edit-
|
|
9106
|
+
const trigger = e.currentTarget.querySelector("[data-slot=\"inline-edit-multi-combobox-trigger\"]");
|
|
9062
9107
|
if (trigger && trigger.getAttribute("aria-expanded") !== "true") trigger.click();
|
|
9063
9108
|
};
|
|
9064
9109
|
return /* @__PURE__ */ jsx(InlineEditChrome, {
|
|
@@ -9068,7 +9113,7 @@ const InlineEditMultiselectChips = React.forwardRef((componentProps, forwardRef)
|
|
|
9068
9113
|
className: cn("items-start", readOnly && "cursor-default", className),
|
|
9069
9114
|
children: /* @__PURE__ */ jsx(Combobox$1.Chips, {
|
|
9070
9115
|
ref: forwardRef,
|
|
9071
|
-
"data-slot": "inline-edit-
|
|
9116
|
+
"data-slot": "inline-edit-multi-combobox-chips",
|
|
9072
9117
|
id,
|
|
9073
9118
|
onClick: handleEmptyAreaClick,
|
|
9074
9119
|
className: cn("relative flex flex-1 min-w-0 flex-wrap items-center gap-1", !readOnly && "cursor-pointer"),
|
|
@@ -9076,24 +9121,24 @@ const InlineEditMultiselectChips = React.forwardRef((componentProps, forwardRef)
|
|
|
9076
9121
|
})
|
|
9077
9122
|
});
|
|
9078
9123
|
});
|
|
9079
|
-
|
|
9124
|
+
InlineEditMultiComboboxChips.displayName = "InlineEditMultiComboboxChips";
|
|
9080
9125
|
/**
|
|
9081
|
-
* Renders the selected values of an `
|
|
9082
|
-
* that maps the array of selected keys to `
|
|
9126
|
+
* Renders the selected values of an `InlineEditMultiCombobox`. Pass a render function
|
|
9127
|
+
* that maps the array of selected keys to `InlineEditMultiComboboxChip`s.
|
|
9083
9128
|
*
|
|
9084
9129
|
* @example
|
|
9085
9130
|
* ```tsx
|
|
9086
|
-
* <
|
|
9131
|
+
* <InlineEditMultiComboboxValue>
|
|
9087
9132
|
* {(keys: string[]) =>
|
|
9088
|
-
* keys.map(key => <
|
|
9089
|
-
* </
|
|
9133
|
+
* keys.map(key => <InlineEditMultiComboboxChip key={key}>{labelOf(key)}</InlineEditMultiComboboxChip>)}
|
|
9134
|
+
* </InlineEditMultiComboboxValue>
|
|
9090
9135
|
* ```
|
|
9091
9136
|
*/
|
|
9092
|
-
function
|
|
9093
|
-
return /* @__PURE__ */ jsx(ComboboxValue, _objectSpread2({ "data-slot": "inline-edit-
|
|
9137
|
+
function InlineEditMultiComboboxValue(componentProps) {
|
|
9138
|
+
return /* @__PURE__ */ jsx(ComboboxValue, _objectSpread2({ "data-slot": "inline-edit-multi-combobox-value" }, componentProps));
|
|
9094
9139
|
}
|
|
9095
9140
|
/**
|
|
9096
|
-
* A single selected-value chip inside `
|
|
9141
|
+
* A single selected-value chip inside `InlineEditMultiComboboxValue`. Composes the DS
|
|
9097
9142
|
* `Chip` with a trailing remove (X) button that unselects the value via Base UI. The
|
|
9098
9143
|
* remove button is hidden in `readOnly` mode.
|
|
9099
9144
|
*
|
|
@@ -9102,17 +9147,17 @@ function InlineEditMultiselectValue(componentProps) {
|
|
|
9102
9147
|
*
|
|
9103
9148
|
* @example
|
|
9104
9149
|
* ```tsx
|
|
9105
|
-
* <
|
|
9106
|
-
* <
|
|
9150
|
+
* <InlineEditMultiComboboxChip color="blue" tone="medium-light">Urgent</InlineEditMultiComboboxChip>
|
|
9151
|
+
* <InlineEditMultiComboboxChip legacyColor="#0761B5">Sales</InlineEditMultiComboboxChip>
|
|
9107
9152
|
* ```
|
|
9108
9153
|
*/
|
|
9109
|
-
const
|
|
9154
|
+
const InlineEditMultiComboboxChip = React.forwardRef((componentProps, forwardRef) => {
|
|
9110
9155
|
const { className, children, color, tone, legacyColor, glow } = componentProps, props = _objectWithoutProperties(componentProps, _excluded$22);
|
|
9111
|
-
const { readOnly } = React.useContext(
|
|
9156
|
+
const { readOnly } = React.useContext(InlineEditMultiComboboxContext);
|
|
9112
9157
|
const t = useDsTranslation("ds");
|
|
9113
9158
|
return /* @__PURE__ */ jsxs(Combobox$1.Chip, _objectSpread2(_objectSpread2({
|
|
9114
9159
|
ref: forwardRef,
|
|
9115
|
-
"data-slot": "inline-edit-
|
|
9160
|
+
"data-slot": "inline-edit-multi-combobox-chip",
|
|
9116
9161
|
render: /* @__PURE__ */ jsx(Chip, {
|
|
9117
9162
|
color,
|
|
9118
9163
|
tone,
|
|
@@ -9125,27 +9170,27 @@ const InlineEditMultiselectChip = React.forwardRef((componentProps, forwardRef)
|
|
|
9125
9170
|
children
|
|
9126
9171
|
}), !readOnly && /* @__PURE__ */ jsx(Combobox$1.ChipRemove, { render: /* @__PURE__ */ jsx(ChipRemove, { "aria-label": t("multiselect.remove") }) })] }));
|
|
9127
9172
|
});
|
|
9128
|
-
|
|
9173
|
+
InlineEditMultiComboboxChip.displayName = "InlineEditMultiComboboxChip";
|
|
9129
9174
|
/**
|
|
9130
|
-
* The "Add item" trigger of an `
|
|
9175
|
+
* The "Add item" trigger of an `InlineEditMultiCombobox`. Renders an outline `Button`
|
|
9131
9176
|
* with a leading plus icon that opens the searchable dropdown. Renders nothing in
|
|
9132
9177
|
* `readOnly` mode.
|
|
9133
9178
|
*
|
|
9134
9179
|
* @example
|
|
9135
9180
|
* ```tsx
|
|
9136
|
-
* <
|
|
9181
|
+
* <InlineEditMultiComboboxTrigger>Add label</InlineEditMultiComboboxTrigger>
|
|
9137
9182
|
* ```
|
|
9138
9183
|
*/
|
|
9139
|
-
const
|
|
9184
|
+
const InlineEditMultiComboboxTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
9140
9185
|
const { children, "aria-label": ariaLabel, id, className } = componentProps;
|
|
9141
|
-
const { readOnly } = React.useContext(
|
|
9186
|
+
const { readOnly } = React.useContext(InlineEditMultiComboboxContext);
|
|
9142
9187
|
const t = useDsTranslation("ds");
|
|
9143
9188
|
if (readOnly) return null;
|
|
9144
9189
|
const label = children !== null && children !== void 0 ? children : t("multiselect.addItem");
|
|
9145
9190
|
const accessibleLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : typeof label === "string" ? label : void 0;
|
|
9146
9191
|
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
|
|
9147
9192
|
ref: forwardRef,
|
|
9148
|
-
"data-slot": "inline-edit-
|
|
9193
|
+
"data-slot": "inline-edit-multi-combobox-trigger",
|
|
9149
9194
|
id,
|
|
9150
9195
|
"aria-label": accessibleLabel,
|
|
9151
9196
|
render: /* @__PURE__ */ jsx(Button, {
|
|
@@ -9156,28 +9201,28 @@ const InlineEditMultiselectTrigger = React.forwardRef((componentProps, forwardRe
|
|
|
9156
9201
|
children: [/* @__PURE__ */ jsx(PlusIcon, {}), label]
|
|
9157
9202
|
});
|
|
9158
9203
|
});
|
|
9159
|
-
|
|
9204
|
+
InlineEditMultiComboboxTrigger.displayName = "InlineEditMultiComboboxTrigger";
|
|
9160
9205
|
/**
|
|
9161
|
-
* The floating dropdown of an `
|
|
9206
|
+
* The floating dropdown of an `InlineEditMultiCombobox`: a search input, an empty-state
|
|
9162
9207
|
* message, and the scrollable option list. Portal-rendered and anchored to the
|
|
9163
|
-
* `
|
|
9208
|
+
* `InlineEditMultiComboboxTrigger`.
|
|
9164
9209
|
*
|
|
9165
9210
|
* Pass a render function as `children` so the built-in search filters the options (a
|
|
9166
9211
|
* static list is rendered unfiltered — see the `children` prop note).
|
|
9167
9212
|
*
|
|
9168
9213
|
* @example
|
|
9169
9214
|
* ```tsx
|
|
9170
|
-
* <
|
|
9171
|
-
* {(key: string) => <
|
|
9172
|
-
* </
|
|
9215
|
+
* <InlineEditMultiComboboxContent>
|
|
9216
|
+
* {(key: string) => <InlineEditMultiComboboxItem key={key} value={key}>{labelOf(key)}</InlineEditMultiComboboxItem>}
|
|
9217
|
+
* </InlineEditMultiComboboxContent>
|
|
9173
9218
|
* ```
|
|
9174
9219
|
*/
|
|
9175
|
-
const
|
|
9220
|
+
const InlineEditMultiComboboxContent = React.forwardRef((componentProps, forwardRef) => {
|
|
9176
9221
|
const { className, searchPlaceholder, emptyMessage, children } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$15);
|
|
9177
9222
|
const t = useDsTranslation("ds");
|
|
9178
9223
|
return /* @__PURE__ */ jsxs(ComboboxContent, _objectSpread2(_objectSpread2({
|
|
9179
9224
|
ref: forwardRef,
|
|
9180
|
-
"data-slot": "inline-edit-
|
|
9225
|
+
"data-slot": "inline-edit-multi-combobox-content",
|
|
9181
9226
|
className: cn("w-80", className)
|
|
9182
9227
|
}, props), {}, { children: [
|
|
9183
9228
|
/* @__PURE__ */ jsx(ComboboxInput, {
|
|
@@ -9188,24 +9233,24 @@ const InlineEditMultiselectContent = React.forwardRef((componentProps, forwardRe
|
|
|
9188
9233
|
/* @__PURE__ */ jsx(ComboboxList, { children })
|
|
9189
9234
|
] }));
|
|
9190
9235
|
});
|
|
9191
|
-
|
|
9236
|
+
InlineEditMultiComboboxContent.displayName = "InlineEditMultiComboboxContent";
|
|
9192
9237
|
/**
|
|
9193
|
-
* A single option row inside `
|
|
9238
|
+
* A single option row inside `InlineEditMultiComboboxContent`. Shows a checkmark when
|
|
9194
9239
|
* selected and toggles selection on click (the dropdown stays open for multi-picking).
|
|
9195
9240
|
*
|
|
9196
9241
|
* @example
|
|
9197
9242
|
* ```tsx
|
|
9198
|
-
* <
|
|
9243
|
+
* <InlineEditMultiComboboxItem value="urgent">Urgent</InlineEditMultiComboboxItem>
|
|
9199
9244
|
* ```
|
|
9200
9245
|
*/
|
|
9201
|
-
const
|
|
9246
|
+
const InlineEditMultiComboboxItem = React.forwardRef((componentProps, forwardRef) => {
|
|
9202
9247
|
return /* @__PURE__ */ jsx(ComboboxItem, _objectSpread2({
|
|
9203
9248
|
ref: forwardRef,
|
|
9204
|
-
"data-slot": "inline-edit-
|
|
9249
|
+
"data-slot": "inline-edit-multi-combobox-item"
|
|
9205
9250
|
}, componentProps));
|
|
9206
9251
|
});
|
|
9207
|
-
|
|
9208
|
-
function
|
|
9252
|
+
InlineEditMultiComboboxItem.displayName = "InlineEditMultiComboboxItem";
|
|
9253
|
+
function InlineEditMultiComboboxDataDriven(props) {
|
|
9209
9254
|
var _ref;
|
|
9210
9255
|
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
9256
|
const contextValue = React.useMemo(() => ({ readOnly }), [readOnly]);
|
|
@@ -9224,7 +9269,7 @@ function InlineEditMultiselectDataDriven(props) {
|
|
|
9224
9269
|
const item = itemByKey.get(key);
|
|
9225
9270
|
return item ? getItemLabel(item) : key;
|
|
9226
9271
|
}, [itemByKey, getItemLabel]);
|
|
9227
|
-
return /* @__PURE__ */ jsx(
|
|
9272
|
+
return /* @__PURE__ */ jsx(InlineEditMultiComboboxContext.Provider, {
|
|
9228
9273
|
value: contextValue,
|
|
9229
9274
|
children: /* @__PURE__ */ jsx("div", {
|
|
9230
9275
|
ref: rootRef,
|
|
@@ -9241,22 +9286,22 @@ function InlineEditMultiselectDataDriven(props) {
|
|
|
9241
9286
|
itemToStringLabel: labelOf,
|
|
9242
9287
|
readOnly,
|
|
9243
9288
|
defaultOpen,
|
|
9244
|
-
children: [/* @__PURE__ */ jsxs(
|
|
9289
|
+
children: [/* @__PURE__ */ jsxs(InlineEditMultiComboboxChips, {
|
|
9245
9290
|
"aria-invalid": ariaInvalid,
|
|
9246
9291
|
className,
|
|
9247
9292
|
id: readOnly ? id : void 0,
|
|
9248
|
-
children: [/* @__PURE__ */ jsx(
|
|
9293
|
+
children: [/* @__PURE__ */ jsx(InlineEditMultiComboboxValue, { children: (selectedKeys) => selectedKeys.map((key) => {
|
|
9249
9294
|
const item = itemByKey.get(key);
|
|
9250
|
-
return renderChip && item ? /* @__PURE__ */ jsx(React.Fragment, { children: renderChip(item) }, key) : /* @__PURE__ */ jsx(
|
|
9251
|
-
}) }), /* @__PURE__ */ jsx(
|
|
9295
|
+
return renderChip && item ? /* @__PURE__ */ jsx(React.Fragment, { children: renderChip(item) }, key) : /* @__PURE__ */ jsx(InlineEditMultiComboboxChip, { children: labelOf(key) }, key);
|
|
9296
|
+
}) }), /* @__PURE__ */ jsx(InlineEditMultiComboboxTrigger, {
|
|
9252
9297
|
"aria-label": ariaLabel,
|
|
9253
9298
|
id,
|
|
9254
9299
|
children: addLabel
|
|
9255
9300
|
})]
|
|
9256
|
-
}), /* @__PURE__ */ jsx(
|
|
9301
|
+
}), /* @__PURE__ */ jsx(InlineEditMultiComboboxContent, {
|
|
9257
9302
|
searchPlaceholder: placeholder,
|
|
9258
9303
|
emptyMessage,
|
|
9259
|
-
children: (key) => /* @__PURE__ */ jsx(
|
|
9304
|
+
children: (key) => /* @__PURE__ */ jsx(InlineEditMultiComboboxItem, {
|
|
9260
9305
|
value: key,
|
|
9261
9306
|
disabled: disabledKeys === null || disabledKeys === void 0 ? void 0 : disabledKeys.has(key),
|
|
9262
9307
|
children: renderItem ? renderItem(itemByKey.get(key)) : labelOf(key)
|
|
@@ -9266,7 +9311,7 @@ function InlineEditMultiselectDataDriven(props) {
|
|
|
9266
9311
|
})
|
|
9267
9312
|
});
|
|
9268
9313
|
}
|
|
9269
|
-
function
|
|
9314
|
+
function InlineEditMultiComboboxCompound(props) {
|
|
9270
9315
|
var _ref2;
|
|
9271
9316
|
const { value, defaultValue, onValueChange, onBlur, readOnly, defaultOpen, children, items, itemToStringLabel } = props;
|
|
9272
9317
|
const contextValue = React.useMemo(() => ({ readOnly }), [readOnly]);
|
|
@@ -9279,7 +9324,7 @@ function InlineEditMultiselectCompound(props) {
|
|
|
9279
9324
|
onValueChange === null || onValueChange === void 0 || onValueChange(next);
|
|
9280
9325
|
}, [onValueChange]);
|
|
9281
9326
|
const blurHandlers = useCommitOnBlur(rootRef, getValues, onBlur);
|
|
9282
|
-
return /* @__PURE__ */ jsx(
|
|
9327
|
+
return /* @__PURE__ */ jsx(InlineEditMultiComboboxContext.Provider, {
|
|
9283
9328
|
value: contextValue,
|
|
9284
9329
|
children: /* @__PURE__ */ jsx("div", {
|
|
9285
9330
|
ref: rootRef,
|
|
@@ -9301,9 +9346,9 @@ function InlineEditMultiselectCompound(props) {
|
|
|
9301
9346
|
})
|
|
9302
9347
|
});
|
|
9303
9348
|
}
|
|
9304
|
-
function
|
|
9305
|
-
if ("getItemValue" in componentProps && componentProps.getItemValue !== void 0) return /* @__PURE__ */ jsx(
|
|
9306
|
-
return /* @__PURE__ */ jsx(
|
|
9349
|
+
function InlineEditMultiCombobox(componentProps) {
|
|
9350
|
+
if ("getItemValue" in componentProps && componentProps.getItemValue !== void 0) return /* @__PURE__ */ jsx(InlineEditMultiComboboxDataDriven, _objectSpread2({}, componentProps));
|
|
9351
|
+
return /* @__PURE__ */ jsx(InlineEditMultiComboboxCompound, _objectSpread2({}, componentProps));
|
|
9307
9352
|
}
|
|
9308
9353
|
//#endregion
|
|
9309
9354
|
//#region src/components/inline-edit-select.tsx
|
|
@@ -11112,6 +11157,10 @@ function normalizeOptionList(prop) {
|
|
|
11112
11157
|
* Mirrors what buildPayload emits (`#value` / `@value`), so a persisted `plainText` note
|
|
11113
11158
|
* reloads with its pills intact. Text and pills are interleaved so inline void nodes always
|
|
11114
11159
|
* have text siblings (valid Slate structure).
|
|
11160
|
+
*
|
|
11161
|
+
* @internal Exported for `rich-textarea.test.ts` only - deliberately absent from `src/index.ts`.
|
|
11162
|
+
* It is still reachable as `@aircall/ds/components/rich-textarea` via the `./components/*`
|
|
11163
|
+
* subpath, so treat it as private and do not rely on it from a consumer.
|
|
11115
11164
|
*/
|
|
11116
11165
|
function parseInlineTokens(line, mentions, tags) {
|
|
11117
11166
|
const byTrigger = {
|
|
@@ -11152,6 +11201,8 @@ function parseInlineTokens(line, mentions, tags) {
|
|
|
11152
11201
|
* Builds the initial editor `Value` from the `value` prop. A plain-text string is split on
|
|
11153
11202
|
* newlines into paragraph blocks, with `#tag`/`@mention` tokens reparsed into pills (see
|
|
11154
11203
|
* parseInlineTokens); a JSON AST is used as-is.
|
|
11204
|
+
*
|
|
11205
|
+
* @internal Exported for `rich-textarea.test.ts` only - deliberately absent from `src/index.ts`.
|
|
11155
11206
|
*/
|
|
11156
11207
|
function toInitialValue(value, mentions, tags) {
|
|
11157
11208
|
if (value === void 0) return [{
|
|
@@ -11545,6 +11596,8 @@ const SAFE_LINK_SCHEME = /^(https?|mailto|tel):/i;
|
|
|
11545
11596
|
* has - including dangerous ones like `javascript:` - and prepend `http://`. This makes
|
|
11546
11597
|
* the form forgiving (`google.com`, `example` and typo'd schemes all become links) while
|
|
11547
11598
|
* never emitting an unsafe href. Empty input stays empty.
|
|
11599
|
+
*
|
|
11600
|
+
* @internal Exported for `rich-textarea.test.ts` only - deliberately absent from `src/index.ts`.
|
|
11548
11601
|
*/
|
|
11549
11602
|
function normalizeLinkInput(url) {
|
|
11550
11603
|
const trimmed = (url !== null && url !== void 0 ? url : "").trim();
|
|
@@ -13253,4 +13306,4 @@ function useAudioGauge(options = {}) {
|
|
|
13253
13306
|
};
|
|
13254
13307
|
}
|
|
13255
13308
|
//#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,
|
|
13309
|
+
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 };
|