@aircall/ds 0.26.0 → 0.27.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/globals.css +1 -1
- package/dist/index.d.ts +280 -23
- package/dist/index.js +339 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createContext, useCallback, useContext, useSyncExternalStore } from "re
|
|
|
3
3
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
4
4
|
import { clsx } from "clsx";
|
|
5
5
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
6
|
-
import { ArrowDownToLine, ArrowLeft, ArrowRight, Backward10, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleAlert, CircleAlertIcon, CircleCheck, FLAGS, FastForward, FlagUs, Forward10, Info, Loader2Icon, Minus, MinusIcon, MoreHorizontalIcon, PanelLeftIcon, Pause, Play, Plus, Rewind, RotateCcw, Search, Smile, TriangleAlertIcon, XIcon } from "@aircall/react-icons";
|
|
6
|
+
import { ArrowDownToLine, ArrowLeft, ArrowRight, Backward10, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleAlert, CircleAlertIcon, CircleCheck, FLAGS, FastForward, FlagUs, Forward10, Info, Loader2Icon, Minus, MinusIcon, MoreHorizontalIcon, PanelLeftIcon, Pause, Play, Plus, PlusIcon, Rewind, RotateCcw, Search, Smile, TriangleAlertIcon, XIcon } from "@aircall/react-icons";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
9
9
|
import { cva } from "class-variance-authority";
|
|
@@ -228,6 +228,8 @@ const de = {
|
|
|
228
228
|
"tree.expand": "Erweitern",
|
|
229
229
|
"multiselect.remove": "Entfernen",
|
|
230
230
|
"multiselect.clearAll": "Alles löschen",
|
|
231
|
+
"multiselect.addItem": "Hinzufügen",
|
|
232
|
+
"multiselect.search": "Suchen",
|
|
231
233
|
"sidebar.toggle": "Seitenleiste umschalten",
|
|
232
234
|
"drawer.close": "Schließen",
|
|
233
235
|
"emojiPicker.emoji": "Emoji",
|
|
@@ -257,6 +259,8 @@ const en = {
|
|
|
257
259
|
"tree.expand": "Expand",
|
|
258
260
|
"multiselect.remove": "Remove",
|
|
259
261
|
"multiselect.clearAll": "Clear all",
|
|
262
|
+
"multiselect.addItem": "Add item",
|
|
263
|
+
"multiselect.search": "Search",
|
|
260
264
|
"sidebar.toggle": "Toggle Sidebar",
|
|
261
265
|
"drawer.close": "Close",
|
|
262
266
|
"emojiPicker.emoji": "Emoji",
|
|
@@ -286,6 +290,8 @@ const es = {
|
|
|
286
290
|
"tree.expand": "Ampliar",
|
|
287
291
|
"multiselect.remove": "Eliminar",
|
|
288
292
|
"multiselect.clearAll": "Borrar todo",
|
|
293
|
+
"multiselect.addItem": "Añadir",
|
|
294
|
+
"multiselect.search": "Buscar",
|
|
289
295
|
"sidebar.toggle": "Alternar barra lateral",
|
|
290
296
|
"drawer.close": "Cerrar",
|
|
291
297
|
"emojiPicker.emoji": "Emoji",
|
|
@@ -315,6 +321,8 @@ const fr = {
|
|
|
315
321
|
"tree.expand": "Développer",
|
|
316
322
|
"multiselect.remove": "Supprimer",
|
|
317
323
|
"multiselect.clearAll": "Tout effacer",
|
|
324
|
+
"multiselect.addItem": "Ajouter",
|
|
325
|
+
"multiselect.search": "Rechercher",
|
|
318
326
|
"sidebar.toggle": "Basculer la barre latérale",
|
|
319
327
|
"drawer.close": "Fermer",
|
|
320
328
|
"emojiPicker.emoji": "Émoji",
|
|
@@ -344,6 +352,8 @@ const it = {
|
|
|
344
352
|
"tree.expand": "Espandi",
|
|
345
353
|
"multiselect.remove": "Rimuovi",
|
|
346
354
|
"multiselect.clearAll": "Cancella tutto",
|
|
355
|
+
"multiselect.addItem": "Aggiungi",
|
|
356
|
+
"multiselect.search": "Cerca",
|
|
347
357
|
"sidebar.toggle": "Attiva/disattiva barra laterale",
|
|
348
358
|
"drawer.close": "Chiudi",
|
|
349
359
|
"emojiPicker.emoji": "Emoji",
|
|
@@ -5520,7 +5530,7 @@ const InlineEditSelectContext = React.createContext({});
|
|
|
5520
5530
|
* Renders the relative container, the absolute bg layer (bleeds 4 px sideways
|
|
5521
5531
|
* for a wider affordance), and the optional prefix icon slot. Not exported.
|
|
5522
5532
|
*/
|
|
5523
|
-
function InlineEditChrome({ readOnly, "aria-invalid": ariaInvalid, className, prefix, children }) {
|
|
5533
|
+
function InlineEditChrome({ readOnly, "aria-invalid": ariaInvalid, className, prefix, children, showFocusRing = true }) {
|
|
5524
5534
|
return /* @__PURE__ */ jsxs("div", {
|
|
5525
5535
|
"data-slot": "inline-edit",
|
|
5526
5536
|
"data-readonly": readOnly || void 0,
|
|
@@ -5530,7 +5540,12 @@ function InlineEditChrome({ readOnly, "aria-invalid": ariaInvalid, className, pr
|
|
|
5530
5540
|
!readOnly && /* @__PURE__ */ jsx("div", {
|
|
5531
5541
|
"aria-hidden": true,
|
|
5532
5542
|
"data-slot": "inline-edit-bg",
|
|
5533
|
-
className: cn("pointer-events-none absolute inset-[0_-4px] rounded-md transition-colors", "group-hover/inline-edit:bg-accent/50",
|
|
5543
|
+
className: cn("pointer-events-none absolute inset-[0_-4px] rounded-md transition-colors", "group-hover/inline-edit:bg-accent/50", showFocusRing && [
|
|
5544
|
+
"group-focus-within/inline-edit:bg-background",
|
|
5545
|
+
"group-focus-within/inline-edit:border group-focus-within/inline-edit:border-ring",
|
|
5546
|
+
"group-focus-within/inline-edit:ring-3 group-focus-within/inline-edit:ring-ring/50",
|
|
5547
|
+
"group-data-[invalid]/inline-edit:group-focus-within/inline-edit:ring-destructive/20"
|
|
5548
|
+
], "group-data-[invalid]/inline-edit:border group-data-[invalid]/inline-edit:border-destructive", "group-data-[invalid]/inline-edit:group-hover/inline-edit:bg-destructive/10")
|
|
5534
5549
|
}),
|
|
5535
5550
|
prefix && /* @__PURE__ */ jsx("span", {
|
|
5536
5551
|
"data-slot": "inline-edit-prefix",
|
|
@@ -5666,6 +5681,326 @@ const InlineEditInput = React.forwardRef((componentProps, forwardRef) => {
|
|
|
5666
5681
|
});
|
|
5667
5682
|
InlineEditInput.displayName = "InlineEditInput";
|
|
5668
5683
|
|
|
5684
|
+
//#endregion
|
|
5685
|
+
//#region src/components/inline-edit-multiselect.tsx
|
|
5686
|
+
/** Context shared between the `InlineEditMultiselect` root and its compound sub-parts. */
|
|
5687
|
+
const InlineEditMultiselectContext = React.createContext({});
|
|
5688
|
+
/**
|
|
5689
|
+
* Wires a commit-on-blur callback that fires once when focus truly leaves the
|
|
5690
|
+
* component - the chips row **and** the portaled popup/listbox. Returns handlers to
|
|
5691
|
+
* spread on a wrapper around the `Combobox`.
|
|
5692
|
+
*
|
|
5693
|
+
* Base UI portals the popup out of the DOM subtree, but React synthetic focus events
|
|
5694
|
+
* bubble through the *React* tree, so a focus move into the popup still bubbles back
|
|
5695
|
+
* to the wrapper's `onFocus` - which lets us treat "focus re-entered the component"
|
|
5696
|
+
* (including Base UI's own trigger→popup focus move on open) as staying within, and
|
|
5697
|
+
* cancel the pending commit. Only a genuine leave, with no re-focus in the same frame,
|
|
5698
|
+
* commits.
|
|
5699
|
+
*/
|
|
5700
|
+
function useCommitOnBlur(rootRef, getValues, onBlur) {
|
|
5701
|
+
const focusWithin = React.useRef(false);
|
|
5702
|
+
const rafId = React.useRef(null);
|
|
5703
|
+
const cancelPending = React.useCallback(() => {
|
|
5704
|
+
if (rafId.current !== null) {
|
|
5705
|
+
cancelAnimationFrame(rafId.current);
|
|
5706
|
+
rafId.current = null;
|
|
5707
|
+
}
|
|
5708
|
+
}, []);
|
|
5709
|
+
React.useEffect(() => cancelPending, [cancelPending]);
|
|
5710
|
+
return {
|
|
5711
|
+
onFocus: React.useCallback(() => {
|
|
5712
|
+
cancelPending();
|
|
5713
|
+
focusWithin.current = true;
|
|
5714
|
+
}, [cancelPending]),
|
|
5715
|
+
onBlur: React.useCallback((event) => {
|
|
5716
|
+
if (!focusWithin.current) return;
|
|
5717
|
+
if (event.relatedTarget && rootRef.current?.contains(event.relatedTarget)) return;
|
|
5718
|
+
cancelPending();
|
|
5719
|
+
rafId.current = requestAnimationFrame(() => {
|
|
5720
|
+
rafId.current = null;
|
|
5721
|
+
focusWithin.current = false;
|
|
5722
|
+
onBlur?.(getValues());
|
|
5723
|
+
});
|
|
5724
|
+
}, [
|
|
5725
|
+
rootRef,
|
|
5726
|
+
getValues,
|
|
5727
|
+
onBlur,
|
|
5728
|
+
cancelPending
|
|
5729
|
+
])
|
|
5730
|
+
};
|
|
5731
|
+
}
|
|
5732
|
+
/**
|
|
5733
|
+
* The chips row of an `InlineEditMultiselect`. Wraps the inline-edit chrome (hover/focus
|
|
5734
|
+
* affordance) around a Base UI `Combobox.Chips` container that lays out the selected
|
|
5735
|
+
* chips and the trailing `InlineEditMultiselectTrigger` in a wrapping flex row.
|
|
5736
|
+
*
|
|
5737
|
+
* @example
|
|
5738
|
+
* ```tsx
|
|
5739
|
+
* <InlineEditMultiselectChips>
|
|
5740
|
+
* <InlineEditMultiselectValue>{…}</InlineEditMultiselectValue>
|
|
5741
|
+
* <InlineEditMultiselectTrigger />
|
|
5742
|
+
* </InlineEditMultiselectChips>
|
|
5743
|
+
* ```
|
|
5744
|
+
*/
|
|
5745
|
+
const InlineEditMultiselectChips = React.forwardRef((componentProps, forwardRef) => {
|
|
5746
|
+
const { "aria-invalid": ariaInvalid, className, id, children } = componentProps;
|
|
5747
|
+
const { readOnly } = React.useContext(InlineEditMultiselectContext);
|
|
5748
|
+
const handleEmptyAreaClick = (e) => {
|
|
5749
|
+
if (readOnly || e.target !== e.currentTarget) return;
|
|
5750
|
+
const trigger = e.currentTarget.querySelector("[data-slot=\"inline-edit-multiselect-trigger\"]");
|
|
5751
|
+
if (trigger && trigger.getAttribute("aria-expanded") !== "true") trigger.click();
|
|
5752
|
+
};
|
|
5753
|
+
return /* @__PURE__ */ jsx(InlineEditChrome, {
|
|
5754
|
+
readOnly,
|
|
5755
|
+
"aria-invalid": ariaInvalid,
|
|
5756
|
+
showFocusRing: false,
|
|
5757
|
+
className: cn("items-start", readOnly && "cursor-default", className),
|
|
5758
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Chips, {
|
|
5759
|
+
ref: forwardRef,
|
|
5760
|
+
"data-slot": "inline-edit-multiselect-chips",
|
|
5761
|
+
id,
|
|
5762
|
+
onClick: handleEmptyAreaClick,
|
|
5763
|
+
className: cn("relative flex flex-1 min-w-0 flex-wrap items-center gap-1", !readOnly && "cursor-pointer"),
|
|
5764
|
+
children
|
|
5765
|
+
})
|
|
5766
|
+
});
|
|
5767
|
+
});
|
|
5768
|
+
InlineEditMultiselectChips.displayName = "InlineEditMultiselectChips";
|
|
5769
|
+
/**
|
|
5770
|
+
* Renders the selected values of an `InlineEditMultiselect`. Pass a render function
|
|
5771
|
+
* that maps the array of selected keys to `InlineEditMultiselectChip`s.
|
|
5772
|
+
*
|
|
5773
|
+
* @example
|
|
5774
|
+
* ```tsx
|
|
5775
|
+
* <InlineEditMultiselectValue>
|
|
5776
|
+
* {(keys: string[]) =>
|
|
5777
|
+
* keys.map(key => <InlineEditMultiselectChip key={key}>{labelOf(key)}</InlineEditMultiselectChip>)}
|
|
5778
|
+
* </InlineEditMultiselectValue>
|
|
5779
|
+
* ```
|
|
5780
|
+
*/
|
|
5781
|
+
function InlineEditMultiselectValue(componentProps) {
|
|
5782
|
+
return /* @__PURE__ */ jsx(ComboboxValue, {
|
|
5783
|
+
"data-slot": "inline-edit-multiselect-value",
|
|
5784
|
+
...componentProps
|
|
5785
|
+
});
|
|
5786
|
+
}
|
|
5787
|
+
/**
|
|
5788
|
+
* A single selected-value chip inside `InlineEditMultiselectValue`. Composes the DS
|
|
5789
|
+
* `Chip` with a trailing remove (X) button that unselects the value via Base UI. The
|
|
5790
|
+
* remove button is hidden in `readOnly` mode.
|
|
5791
|
+
*
|
|
5792
|
+
* Color-aware: `color` + `tone`, `glow`, or a stored `legacyColor` hex forward straight
|
|
5793
|
+
* to the inner `Chip`, so backend tag colors render without a custom chip.
|
|
5794
|
+
*
|
|
5795
|
+
* @example
|
|
5796
|
+
* ```tsx
|
|
5797
|
+
* <InlineEditMultiselectChip color="blue" tone="medium-light">Urgent</InlineEditMultiselectChip>
|
|
5798
|
+
* <InlineEditMultiselectChip legacyColor="#0761B5">Sales</InlineEditMultiselectChip>
|
|
5799
|
+
* ```
|
|
5800
|
+
*/
|
|
5801
|
+
const InlineEditMultiselectChip = React.forwardRef((componentProps, forwardRef) => {
|
|
5802
|
+
const { className, children, color, tone, legacyColor, glow, ...props } = componentProps;
|
|
5803
|
+
const { readOnly } = React.useContext(InlineEditMultiselectContext);
|
|
5804
|
+
const t = useDsTranslation("ds");
|
|
5805
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chip, {
|
|
5806
|
+
ref: forwardRef,
|
|
5807
|
+
"data-slot": "inline-edit-multiselect-chip",
|
|
5808
|
+
render: /* @__PURE__ */ jsx(Chip, {
|
|
5809
|
+
color,
|
|
5810
|
+
tone,
|
|
5811
|
+
legacyColor,
|
|
5812
|
+
glow
|
|
5813
|
+
}),
|
|
5814
|
+
className,
|
|
5815
|
+
...props,
|
|
5816
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
5817
|
+
className: "truncate max-w-[150px]",
|
|
5818
|
+
children
|
|
5819
|
+
}), !readOnly && /* @__PURE__ */ jsx(Combobox$1.ChipRemove, { render: /* @__PURE__ */ jsx(ChipRemove, { "aria-label": t("multiselect.remove") }) })]
|
|
5820
|
+
});
|
|
5821
|
+
});
|
|
5822
|
+
InlineEditMultiselectChip.displayName = "InlineEditMultiselectChip";
|
|
5823
|
+
/**
|
|
5824
|
+
* The "Add item" trigger of an `InlineEditMultiselect`. Renders an outline `Button`
|
|
5825
|
+
* with a leading plus icon that opens the searchable dropdown. Renders nothing in
|
|
5826
|
+
* `readOnly` mode.
|
|
5827
|
+
*
|
|
5828
|
+
* @example
|
|
5829
|
+
* ```tsx
|
|
5830
|
+
* <InlineEditMultiselectTrigger>Add label</InlineEditMultiselectTrigger>
|
|
5831
|
+
* ```
|
|
5832
|
+
*/
|
|
5833
|
+
const InlineEditMultiselectTrigger = React.forwardRef((componentProps, forwardRef) => {
|
|
5834
|
+
const { children, "aria-label": ariaLabel, id, className } = componentProps;
|
|
5835
|
+
const { readOnly } = React.useContext(InlineEditMultiselectContext);
|
|
5836
|
+
const t = useDsTranslation("ds");
|
|
5837
|
+
if (readOnly) return null;
|
|
5838
|
+
const label = children ?? t("multiselect.addItem");
|
|
5839
|
+
const accessibleLabel = ariaLabel ?? (typeof label === "string" ? label : void 0);
|
|
5840
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
|
|
5841
|
+
ref: forwardRef,
|
|
5842
|
+
"data-slot": "inline-edit-multiselect-trigger",
|
|
5843
|
+
id,
|
|
5844
|
+
"aria-label": accessibleLabel,
|
|
5845
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
5846
|
+
variant: "outline",
|
|
5847
|
+
size: "sm",
|
|
5848
|
+
className: cn("shrink-0 font-semibold bg-background dark:bg-input", className)
|
|
5849
|
+
}),
|
|
5850
|
+
children: [/* @__PURE__ */ jsx(PlusIcon, {}), label]
|
|
5851
|
+
});
|
|
5852
|
+
});
|
|
5853
|
+
InlineEditMultiselectTrigger.displayName = "InlineEditMultiselectTrigger";
|
|
5854
|
+
/**
|
|
5855
|
+
* The floating dropdown of an `InlineEditMultiselect`: a search input, an empty-state
|
|
5856
|
+
* message, and the scrollable option list. Portal-rendered and anchored to the
|
|
5857
|
+
* `InlineEditMultiselectTrigger`.
|
|
5858
|
+
*
|
|
5859
|
+
* Pass a render function as `children` so the built-in search filters the options (a
|
|
5860
|
+
* static list is rendered unfiltered — see the `children` prop note).
|
|
5861
|
+
*
|
|
5862
|
+
* @example
|
|
5863
|
+
* ```tsx
|
|
5864
|
+
* <InlineEditMultiselectContent>
|
|
5865
|
+
* {(key: string) => <InlineEditMultiselectItem key={key} value={key}>{labelOf(key)}</InlineEditMultiselectItem>}
|
|
5866
|
+
* </InlineEditMultiselectContent>
|
|
5867
|
+
* ```
|
|
5868
|
+
*/
|
|
5869
|
+
const InlineEditMultiselectContent = React.forwardRef((componentProps, forwardRef) => {
|
|
5870
|
+
const { className, searchPlaceholder, emptyMessage, children, ...props } = componentProps;
|
|
5871
|
+
const t = useDsTranslation("ds");
|
|
5872
|
+
return /* @__PURE__ */ jsxs(ComboboxContent, {
|
|
5873
|
+
ref: forwardRef,
|
|
5874
|
+
"data-slot": "inline-edit-multiselect-content",
|
|
5875
|
+
className: cn("w-80", className),
|
|
5876
|
+
...props,
|
|
5877
|
+
children: [
|
|
5878
|
+
/* @__PURE__ */ jsx(ComboboxInput, {
|
|
5879
|
+
showTrigger: false,
|
|
5880
|
+
placeholder: searchPlaceholder ?? t("multiselect.search")
|
|
5881
|
+
}),
|
|
5882
|
+
/* @__PURE__ */ jsx(ComboboxEmpty, { children: emptyMessage ?? t("dataCombobox.noResults") }),
|
|
5883
|
+
/* @__PURE__ */ jsx(ComboboxList, { children })
|
|
5884
|
+
]
|
|
5885
|
+
});
|
|
5886
|
+
});
|
|
5887
|
+
InlineEditMultiselectContent.displayName = "InlineEditMultiselectContent";
|
|
5888
|
+
/**
|
|
5889
|
+
* A single option row inside `InlineEditMultiselectContent`. Shows a checkmark when
|
|
5890
|
+
* selected and toggles selection on click (the dropdown stays open for multi-picking).
|
|
5891
|
+
*
|
|
5892
|
+
* @example
|
|
5893
|
+
* ```tsx
|
|
5894
|
+
* <InlineEditMultiselectItem value="urgent">Urgent</InlineEditMultiselectItem>
|
|
5895
|
+
* ```
|
|
5896
|
+
*/
|
|
5897
|
+
const InlineEditMultiselectItem = React.forwardRef((componentProps, forwardRef) => {
|
|
5898
|
+
return /* @__PURE__ */ jsx(ComboboxItem, {
|
|
5899
|
+
ref: forwardRef,
|
|
5900
|
+
"data-slot": "inline-edit-multiselect-item",
|
|
5901
|
+
...componentProps
|
|
5902
|
+
});
|
|
5903
|
+
});
|
|
5904
|
+
InlineEditMultiselectItem.displayName = "InlineEditMultiselectItem";
|
|
5905
|
+
function InlineEditMultiselectDataDriven(props) {
|
|
5906
|
+
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;
|
|
5907
|
+
const contextValue = React.useMemo(() => ({ readOnly }), [readOnly]);
|
|
5908
|
+
const rootRef = React.useRef(null);
|
|
5909
|
+
const latestValues = React.useRef(value ?? defaultValue ?? []);
|
|
5910
|
+
if (value !== void 0) latestValues.current = value;
|
|
5911
|
+
const getValues = React.useCallback(() => latestValues.current, []);
|
|
5912
|
+
const handleValueChange = React.useCallback((next) => {
|
|
5913
|
+
latestValues.current = next;
|
|
5914
|
+
onValueChange?.(next);
|
|
5915
|
+
}, [onValueChange]);
|
|
5916
|
+
const blurHandlers = useCommitOnBlur(rootRef, getValues, onBlur);
|
|
5917
|
+
const keys = React.useMemo(() => items.map(getItemValue), [items, getItemValue]);
|
|
5918
|
+
const itemByKey = React.useMemo(() => new Map(items.map((item) => [getItemValue(item), item])), [items, getItemValue]);
|
|
5919
|
+
const labelOf = React.useCallback((key) => {
|
|
5920
|
+
const item = itemByKey.get(key);
|
|
5921
|
+
return item ? getItemLabel(item) : key;
|
|
5922
|
+
}, [itemByKey, getItemLabel]);
|
|
5923
|
+
return /* @__PURE__ */ jsx(InlineEditMultiselectContext.Provider, {
|
|
5924
|
+
value: contextValue,
|
|
5925
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
5926
|
+
ref: rootRef,
|
|
5927
|
+
className: "contents",
|
|
5928
|
+
onFocus: blurHandlers.onFocus,
|
|
5929
|
+
onBlur: blurHandlers.onBlur,
|
|
5930
|
+
children: /* @__PURE__ */ jsxs(Combobox, {
|
|
5931
|
+
multiple: true,
|
|
5932
|
+
items: keys,
|
|
5933
|
+
value,
|
|
5934
|
+
defaultValue,
|
|
5935
|
+
onValueChange: handleValueChange,
|
|
5936
|
+
itemToStringValue: (key) => key,
|
|
5937
|
+
itemToStringLabel: labelOf,
|
|
5938
|
+
readOnly,
|
|
5939
|
+
defaultOpen,
|
|
5940
|
+
children: [/* @__PURE__ */ jsxs(InlineEditMultiselectChips, {
|
|
5941
|
+
"aria-invalid": ariaInvalid,
|
|
5942
|
+
className,
|
|
5943
|
+
id: readOnly ? id : void 0,
|
|
5944
|
+
children: [/* @__PURE__ */ jsx(InlineEditMultiselectValue, { children: (selectedKeys) => selectedKeys.map((key) => {
|
|
5945
|
+
const item = itemByKey.get(key);
|
|
5946
|
+
return renderChip && item ? /* @__PURE__ */ jsx(React.Fragment, { children: renderChip(item) }, key) : /* @__PURE__ */ jsx(InlineEditMultiselectChip, { children: labelOf(key) }, key);
|
|
5947
|
+
}) }), /* @__PURE__ */ jsx(InlineEditMultiselectTrigger, {
|
|
5948
|
+
"aria-label": ariaLabel,
|
|
5949
|
+
id,
|
|
5950
|
+
children: addLabel
|
|
5951
|
+
})]
|
|
5952
|
+
}), /* @__PURE__ */ jsx(InlineEditMultiselectContent, {
|
|
5953
|
+
searchPlaceholder: placeholder,
|
|
5954
|
+
emptyMessage,
|
|
5955
|
+
children: (key) => /* @__PURE__ */ jsx(InlineEditMultiselectItem, {
|
|
5956
|
+
value: key,
|
|
5957
|
+
disabled: disabledKeys?.has(key),
|
|
5958
|
+
children: renderItem ? renderItem(itemByKey.get(key)) : labelOf(key)
|
|
5959
|
+
}, key)
|
|
5960
|
+
})]
|
|
5961
|
+
})
|
|
5962
|
+
})
|
|
5963
|
+
});
|
|
5964
|
+
}
|
|
5965
|
+
function InlineEditMultiselectCompound(props) {
|
|
5966
|
+
const { value, defaultValue, onValueChange, onBlur, readOnly, defaultOpen, children, items, itemToStringLabel } = props;
|
|
5967
|
+
const contextValue = React.useMemo(() => ({ readOnly }), [readOnly]);
|
|
5968
|
+
const rootRef = React.useRef(null);
|
|
5969
|
+
const latestValues = React.useRef(value ?? defaultValue ?? []);
|
|
5970
|
+
if (value !== void 0) latestValues.current = value;
|
|
5971
|
+
const getValues = React.useCallback(() => latestValues.current, []);
|
|
5972
|
+
const handleValueChange = React.useCallback((next) => {
|
|
5973
|
+
latestValues.current = next;
|
|
5974
|
+
onValueChange?.(next);
|
|
5975
|
+
}, [onValueChange]);
|
|
5976
|
+
const blurHandlers = useCommitOnBlur(rootRef, getValues, onBlur);
|
|
5977
|
+
return /* @__PURE__ */ jsx(InlineEditMultiselectContext.Provider, {
|
|
5978
|
+
value: contextValue,
|
|
5979
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
5980
|
+
ref: rootRef,
|
|
5981
|
+
className: "contents",
|
|
5982
|
+
onFocus: blurHandlers.onFocus,
|
|
5983
|
+
onBlur: blurHandlers.onBlur,
|
|
5984
|
+
children: /* @__PURE__ */ jsx(Combobox, {
|
|
5985
|
+
multiple: true,
|
|
5986
|
+
items,
|
|
5987
|
+
value,
|
|
5988
|
+
defaultValue,
|
|
5989
|
+
onValueChange: handleValueChange,
|
|
5990
|
+
itemToStringValue: (key) => key,
|
|
5991
|
+
itemToStringLabel,
|
|
5992
|
+
readOnly,
|
|
5993
|
+
defaultOpen,
|
|
5994
|
+
children
|
|
5995
|
+
})
|
|
5996
|
+
})
|
|
5997
|
+
});
|
|
5998
|
+
}
|
|
5999
|
+
function InlineEditMultiselect(componentProps) {
|
|
6000
|
+
if ("getItemValue" in componentProps && componentProps.getItemValue !== void 0) return /* @__PURE__ */ jsx(InlineEditMultiselectDataDriven, { ...componentProps });
|
|
6001
|
+
return /* @__PURE__ */ jsx(InlineEditMultiselectCompound, { ...componentProps });
|
|
6002
|
+
}
|
|
6003
|
+
|
|
5669
6004
|
//#endregion
|
|
5670
6005
|
//#region src/components/inline-edit-select.tsx
|
|
5671
6006
|
/**
|
|
@@ -7813,4 +8148,4 @@ function useAudioGauge(options = {}) {
|
|
|
7813
8148
|
}
|
|
7814
8149
|
|
|
7815
8150
|
//#endregion
|
|
7816
|
-
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, Calendar, CalendarDayButton, 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, 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, Filter, FilterClearAllButton, FilterGroup, Gauge, HoverCard, HoverCardContent, HoverCardTrigger, InlineEditInput, InlineEditSelect, InlineEditSelectContent, InlineEditSelectItem, InlineEditSelectTrigger, InlineEditSelectValue, InlineEditTextarea, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, 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, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, 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, registerI18nNamespace, selectTriggerVariants, spinnerVariants, syncDsLanguage, toast, toggleVariants, useAudioGauge, useAudioPlayer, useAudioPlayerTime, useComboboxAnchor, useDsLocale, useDsTranslation, useNotification, useNotificationQueue, useSidebar, useStepper, useTheme };
|
|
8151
|
+
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, Calendar, CalendarDayButton, 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, 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, Filter, FilterClearAllButton, FilterGroup, Gauge, HoverCard, HoverCardContent, HoverCardTrigger, InlineEditInput, InlineEditMultiselect, InlineEditMultiselectChip, InlineEditMultiselectChips, InlineEditMultiselectContent, InlineEditMultiselectItem, InlineEditMultiselectTrigger, InlineEditMultiselectValue, InlineEditSelect, InlineEditSelectContent, InlineEditSelectItem, InlineEditSelectTrigger, InlineEditSelectValue, InlineEditTextarea, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, 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, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, 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, registerI18nNamespace, selectTriggerVariants, spinnerVariants, syncDsLanguage, toast, toggleVariants, useAudioGauge, useAudioPlayer, useAudioPlayerTime, useComboboxAnchor, useDsLocale, useDsTranslation, useNotification, useNotificationQueue, useSidebar, useStepper, useTheme };
|