@ostack.tech/ui 0.9.0 → 0.9.2
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/chunks/{en-Dem8nwZz.js → en-GEeEwItR.js} +9 -2
- package/dist/chunks/en-GEeEwItR.js.map +1 -0
- package/dist/locales/en-GB.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/fr-FR.js +8 -1
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +8 -1
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +46 -40
- package/dist/ostack-ui.css.map +1 -1
- package/dist/ostack-ui.js +1083 -151
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +17 -0
- package/dist/types/components/Alert/AlertContext.d.ts +8 -0
- package/dist/types/components/CommandMenu/CommandMenu.d.ts +1 -1
- package/dist/types/components/CommandMenu/CommandMenuGroup.d.ts +1 -1
- package/dist/types/components/CommandMenu/CommandMenuItem.d.ts +1 -1
- package/dist/types/components/CommandMenu/cmdk/command-score.d.ts +1 -0
- package/dist/types/components/CommandMenu/cmdk/index.d.ts +320 -0
- package/dist/types/components/Input/Input.d.ts +9 -0
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +5 -0
- package/dist/types/components/Select/Select.d.ts +6 -2
- package/dist/types/components/Select/SelectContext.d.ts +3 -1
- package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +3 -1
- package/package.json +3 -4
- package/scss/components/CommandMenu/_CommandMenu.scss +1 -7
- package/scss/components/DropdownMenu/_DropdownMenu.scss +3 -3
- package/scss/components/Link/_Link-variables.scss +7 -0
- package/scss/components/Link/_Link.scss +7 -0
- package/scss/components/MenuList/_MenuList.scss +3 -3
- package/scss/components/Select/_Select-variables.scss +4 -0
- package/scss/components/Select/_Select.scss +6 -0
- package/scss/components/Tag/_Tag-variables.scss +1 -1
- package/scss/scss/helpers/_visually-hidden.scss +8 -5
- package/scss/scss/placeholders/menu/_menu-variables.scss +24 -15
- package/scss/scss/placeholders/menu/_menu.scss +1 -3
- package/scss/scss/placeholders/notification/_notification-variables.scss +2 -2
- package/scss/scss/placeholders/notification/_notification.scss +1 -0
- package/dist/chunks/en-Dem8nwZz.js.map +0 -1
package/dist/ostack-ui.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { forwardRef, createContext, useContext, useCallback, useRef, useEffect, useId, useMemo, useState, memo, Fragment as Fragment$1, isValidElement, cloneElement, Children, useImperativeHandle, startTransition, useLayoutEffect as useLayoutEffect$2, useDeferredValue, useSyncExternalStore } from "react";
|
|
2
3
|
import { tinykeys, parseKeybinding } from "tinykeys";
|
|
3
4
|
import fromExponential from "from-exponential";
|
|
4
5
|
import { isValid, isDate, addMonths, isAfter, isBefore, startOfMonth, setMonth, getYear, setYear, startOfYear, format, isSameYear, getMonth, max, min, lastDayOfMonth, parseISO, parse, isWithinInterval, isEqual } from "date-fns";
|
|
5
|
-
import { createStore, useStore, create } from "zustand";
|
|
6
|
+
import { createStore, useStore as useStore$1, create } from "zustand";
|
|
6
7
|
import { shallow } from "zustand/shallow";
|
|
7
8
|
import { removeNumericFormat, numericFormatter, NumericFormat } from "react-number-format";
|
|
8
9
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
9
10
|
import { faArrowRight, faArrowLeft, faArrowDown, faArrowUp, faClose, faTriangleExclamation, faCircleExclamation, faCircleCheck, faCircleInfo, faChevronUp, faChevronDown, faRedo, faCircleQuestion, faSortDown, faSortUp, faAsterisk, faMinus, faCheck, faFilter, faSearch, faChevronLeft, faChevronRight, faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
|
|
10
11
|
import { ErrorBoundary as ErrorBoundary$1 } from "react-error-boundary";
|
|
11
12
|
import { useErrorBoundary } from "react-error-boundary";
|
|
12
|
-
import { AlertDialog as AlertDialog$1, Dialog as Dialog$1, Slot as Slot$1, Portal as Portal$1, Tooltip as Tooltip$1, Toast as Toast$1, Collapsible as Collapsible$1, Popover as Popover$1, Label as Label$1, Checkbox as Checkbox$1, DropdownMenu as DropdownMenu$1, RadioGroup as RadioGroup$1, Separator as Separator$
|
|
13
|
+
import { AlertDialog as AlertDialog$1, Dialog as Dialog$1, Slot as Slot$1, Portal as Portal$1, Tooltip as Tooltip$1, Toast as Toast$1, Collapsible as Collapsible$1, Popover as Popover$1, Label as Label$1, Checkbox as Checkbox$1, DropdownMenu as DropdownMenu$1, RadioGroup as RadioGroup$1, Separator as Separator$2, Tabs as Tabs$1 } from "radix-ui";
|
|
13
14
|
import { subscribeWithSelector } from "zustand/middleware";
|
|
14
15
|
import { I as IS_APPLE } from "./chunks/platformUtils-C3IHCr90.js";
|
|
15
16
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
@@ -18,7 +19,6 @@ import { locale as locale2 } from "./locales/en-US.js";
|
|
|
18
19
|
import { locale as locale3, locale as locale4 } from "./locales/fr-FR.js";
|
|
19
20
|
import { locale as locale5, locale as locale6 } from "./locales/pt-PT.js";
|
|
20
21
|
import { useDayPicker, DayPicker } from "react-day-picker";
|
|
21
|
-
import { Command } from "cmdk";
|
|
22
22
|
import { useShallow } from "zustand/react/shallow";
|
|
23
23
|
import { useVirtualizer, observeElementRect } from "@tanstack/react-virtual";
|
|
24
24
|
import { faCalendar } from "@fortawesome/free-regular-svg-icons";
|
|
@@ -41,7 +41,7 @@ function PrefixProvider({ prefix, children }) {
|
|
|
41
41
|
return prefix === void 0 ? children : /* @__PURE__ */ jsx(PrefixContext.Provider, { value: prefix, children });
|
|
42
42
|
}
|
|
43
43
|
function usePrefix() {
|
|
44
|
-
const defaultPrefix = useStore(
|
|
44
|
+
const defaultPrefix = useStore$1(
|
|
45
45
|
defaultPrefixStore,
|
|
46
46
|
({ defaultPrefix: defaultPrefix2 }) => defaultPrefix2
|
|
47
47
|
);
|
|
@@ -421,7 +421,7 @@ function useCreateDataTableContext({
|
|
|
421
421
|
defaultLimit,
|
|
422
422
|
limit,
|
|
423
423
|
onLimitChange,
|
|
424
|
-
defaultFilter,
|
|
424
|
+
defaultFilter: defaultFilter2,
|
|
425
425
|
filter,
|
|
426
426
|
onFilterChange,
|
|
427
427
|
defaultSortBy,
|
|
@@ -470,7 +470,7 @@ function useCreateDataTableContext({
|
|
|
470
470
|
() => [get().pageOffset(), get().limit, get().totalCount()],
|
|
471
471
|
(pageOffset, limit2, totalCount) => totalCount == null ? void 0 : Math.min(totalCount - pageOffset, limit2)
|
|
472
472
|
),
|
|
473
|
-
filter: filter ??
|
|
473
|
+
filter: filter ?? defaultFilter2,
|
|
474
474
|
sortBy: initialSortBy,
|
|
475
475
|
sortDirection: sortDirection ?? defaultSortDirection ?? (initialSortBy !== null && columns[initialSortBy].defaultSortDirection || "asc"),
|
|
476
476
|
selectedRows: [
|
|
@@ -851,7 +851,7 @@ function useFieldContext() {
|
|
|
851
851
|
return useContext(FieldContext);
|
|
852
852
|
}
|
|
853
853
|
function useFieldStore(selector) {
|
|
854
|
-
return useStore(useFieldContext() ?? EMPTY_STORE, selector);
|
|
854
|
+
return useStore$1(useFieldContext() ?? EMPTY_STORE, selector);
|
|
855
855
|
}
|
|
856
856
|
function useFieldControlId() {
|
|
857
857
|
return useFieldStore((state) => state.controlId);
|
|
@@ -1021,7 +1021,7 @@ function useTableContext() {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
function useTableNumberOfColumns() {
|
|
1023
1023
|
const { store } = useTableContext();
|
|
1024
|
-
return useStore(store, (state) => state.numberOfColumns);
|
|
1024
|
+
return useStore$1(store, (state) => state.numberOfColumns);
|
|
1025
1025
|
}
|
|
1026
1026
|
const TableHeadContext = createContext(false);
|
|
1027
1027
|
function useIsInTableHead() {
|
|
@@ -1413,7 +1413,6 @@ const VisuallyHidden = forwardRef(function VisuallyHidden2({
|
|
|
1413
1413
|
focusable && prefix("visually-hidden-focusable"),
|
|
1414
1414
|
className
|
|
1415
1415
|
),
|
|
1416
|
-
tabIndex: focusable ? 0 : void 0,
|
|
1417
1416
|
...otherProps,
|
|
1418
1417
|
ref: forwardedRef
|
|
1419
1418
|
}
|
|
@@ -1802,10 +1801,12 @@ const IconButton = forwardRef(function IconButton2({
|
|
|
1802
1801
|
) : button;
|
|
1803
1802
|
});
|
|
1804
1803
|
const CloseButton = forwardRef(
|
|
1805
|
-
function CloseIconButton({ icon, label,
|
|
1804
|
+
function CloseIconButton({ icon, label, className, ...otherProps }, forwardedRef) {
|
|
1806
1805
|
const prefix = usePrefix();
|
|
1807
1806
|
const [locale7] = useLocale();
|
|
1808
|
-
label
|
|
1807
|
+
if (label === void 0) {
|
|
1808
|
+
label = locale7.CloseButton.label;
|
|
1809
|
+
}
|
|
1809
1810
|
return /* @__PURE__ */ jsx(
|
|
1810
1811
|
IconButton,
|
|
1811
1812
|
{
|
|
@@ -1814,7 +1815,6 @@ const CloseButton = forwardRef(
|
|
|
1814
1815
|
circle: true,
|
|
1815
1816
|
icon: icon ?? faClose,
|
|
1816
1817
|
label,
|
|
1817
|
-
tooltipContent,
|
|
1818
1818
|
...otherProps,
|
|
1819
1819
|
ref: forwardedRef
|
|
1820
1820
|
}
|
|
@@ -2302,7 +2302,7 @@ function useCreateDocumentTitleStore(breadcrumbs) {
|
|
|
2302
2302
|
return store;
|
|
2303
2303
|
}
|
|
2304
2304
|
function useDocumentTitleStore(selector) {
|
|
2305
|
-
return useStore(useContext(DocumentTitleContext) ?? EMPTY_STORE, selector);
|
|
2305
|
+
return useStore$1(useContext(DocumentTitleContext) ?? EMPTY_STORE, selector);
|
|
2306
2306
|
}
|
|
2307
2307
|
function DocumentTitle({ title, children }) {
|
|
2308
2308
|
const context = useContext(DocumentTitleProviderContext);
|
|
@@ -2718,11 +2718,11 @@ const CollapsibleContext = createContext(
|
|
|
2718
2718
|
null
|
|
2719
2719
|
);
|
|
2720
2720
|
function useCollapsibleContext() {
|
|
2721
|
-
const
|
|
2722
|
-
if (!
|
|
2721
|
+
const collapsibleContent = useContext(CollapsibleContext);
|
|
2722
|
+
if (!collapsibleContent) {
|
|
2723
2723
|
throw new Error("Collapsible context not in scope.");
|
|
2724
2724
|
}
|
|
2725
|
-
return
|
|
2725
|
+
return collapsibleContent;
|
|
2726
2726
|
}
|
|
2727
2727
|
const Collapsible = forwardRef(function Collapsible2({
|
|
2728
2728
|
defaultOpen,
|
|
@@ -2775,6 +2775,14 @@ const CollapsibleTrigger = forwardRef(function CollapsibleTrigger2({ children, .
|
|
|
2775
2775
|
);
|
|
2776
2776
|
return /* @__PURE__ */ jsx(Collapsible$1.Trigger, { ...props, asChild: true, ref: forwardedRef, children: typeof children === "function" ? children(open) : children });
|
|
2777
2777
|
});
|
|
2778
|
+
const AlertContext = createContext(null);
|
|
2779
|
+
function useAlertContext() {
|
|
2780
|
+
const alertContext = useContext(AlertContext);
|
|
2781
|
+
if (!alertContext) {
|
|
2782
|
+
throw new Error("Alert context not in scope.");
|
|
2783
|
+
}
|
|
2784
|
+
return alertContext;
|
|
2785
|
+
}
|
|
2778
2786
|
const SEVERITY_ICON = {
|
|
2779
2787
|
neutral: null,
|
|
2780
2788
|
info: faCircleInfo,
|
|
@@ -2785,6 +2793,7 @@ const SEVERITY_ICON = {
|
|
|
2785
2793
|
const Alert = forwardRef(function Alert2({
|
|
2786
2794
|
variant = "subtle",
|
|
2787
2795
|
severity = "info",
|
|
2796
|
+
announce = "off",
|
|
2788
2797
|
defaultOpen = true,
|
|
2789
2798
|
open,
|
|
2790
2799
|
onOpenChange,
|
|
@@ -2799,11 +2808,16 @@ const Alert = forwardRef(function Alert2({
|
|
|
2799
2808
|
closeButtonProps,
|
|
2800
2809
|
children,
|
|
2801
2810
|
className,
|
|
2811
|
+
role,
|
|
2812
|
+
"aria-label": ariaLabel,
|
|
2813
|
+
"aria-labelledby": ariaLabelledBy,
|
|
2802
2814
|
...otherProps
|
|
2803
2815
|
}, forwardedRef) {
|
|
2804
2816
|
const prefix = usePrefix();
|
|
2817
|
+
const [titleId, setTitleId] = useState();
|
|
2805
2818
|
const accent = severity === "info" ? "primary" : severity;
|
|
2806
|
-
|
|
2819
|
+
const actualRole = role ?? (announce === "assertive" ? "alert" : announce === "polite" ? "status" : void 0);
|
|
2820
|
+
return /* @__PURE__ */ jsx(AlertContext, { value: { setTitleId }, children: /* @__PURE__ */ jsx(
|
|
2807
2821
|
Collapsible,
|
|
2808
2822
|
{
|
|
2809
2823
|
defaultOpen,
|
|
@@ -2828,7 +2842,9 @@ const Alert = forwardRef(function Alert2({
|
|
|
2828
2842
|
className
|
|
2829
2843
|
),
|
|
2830
2844
|
"data-accent": accent,
|
|
2831
|
-
role:
|
|
2845
|
+
role: actualRole,
|
|
2846
|
+
"aria-label": ariaLabel,
|
|
2847
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 && (actualRole === "alert" || actualRole === "status") ? titleId : void 0),
|
|
2832
2848
|
...otherProps,
|
|
2833
2849
|
ref: forwardedRef,
|
|
2834
2850
|
children: [
|
|
@@ -2845,7 +2861,10 @@ const Alert = forwardRef(function Alert2({
|
|
|
2845
2861
|
"div",
|
|
2846
2862
|
{
|
|
2847
2863
|
...contentProps,
|
|
2848
|
-
className: cx(
|
|
2864
|
+
className: cx(
|
|
2865
|
+
prefix("alert__content"),
|
|
2866
|
+
contentProps?.className
|
|
2867
|
+
),
|
|
2849
2868
|
children
|
|
2850
2869
|
}
|
|
2851
2870
|
),
|
|
@@ -2881,22 +2900,33 @@ const Alert = forwardRef(function Alert2({
|
|
|
2881
2900
|
}
|
|
2882
2901
|
)
|
|
2883
2902
|
}
|
|
2884
|
-
);
|
|
2903
|
+
) });
|
|
2885
2904
|
});
|
|
2886
2905
|
const AlertTitle = forwardRef(function AlertTitle2({
|
|
2887
2906
|
as = "div",
|
|
2888
2907
|
asChild,
|
|
2908
|
+
id,
|
|
2889
2909
|
className,
|
|
2890
2910
|
...otherProps
|
|
2891
2911
|
}, forwardedRef) {
|
|
2892
2912
|
const prefix = usePrefix();
|
|
2913
|
+
const generatedId = useId();
|
|
2914
|
+
const actualId = id ?? prefix(`alert-title-${generatedId}`);
|
|
2915
|
+
const { setTitleId } = useAlertContext();
|
|
2916
|
+
const ref = useCallback(
|
|
2917
|
+
(el) => {
|
|
2918
|
+
setTitleId(el ? actualId : void 0);
|
|
2919
|
+
},
|
|
2920
|
+
[actualId, setTitleId]
|
|
2921
|
+
);
|
|
2893
2922
|
const As = asChild ? Slot : as;
|
|
2894
2923
|
return /* @__PURE__ */ jsx(
|
|
2895
2924
|
As,
|
|
2896
2925
|
{
|
|
2926
|
+
id: actualId,
|
|
2897
2927
|
className: cx(prefix("alert__title"), className),
|
|
2898
2928
|
...otherProps,
|
|
2899
|
-
ref: forwardedRef
|
|
2929
|
+
ref: combineEventHandlers(ref, forwardedRef)
|
|
2900
2930
|
}
|
|
2901
2931
|
);
|
|
2902
2932
|
});
|
|
@@ -3813,7 +3843,7 @@ const Table = forwardRef(
|
|
|
3813
3843
|
);
|
|
3814
3844
|
function ColumnWidths() {
|
|
3815
3845
|
const { store } = useTableContext();
|
|
3816
|
-
const columnWidths2 = useStore(store, (state) => state.columnWidths);
|
|
3846
|
+
const columnWidths2 = useStore$1(store, (state) => state.columnWidths);
|
|
3817
3847
|
return columnWidths2 && /* @__PURE__ */ jsx("colgroup", { children: columnWidths2.map((width, i) => /* @__PURE__ */ jsx("col", { style: width != null ? { width } : void 0 }, i)) });
|
|
3818
3848
|
}
|
|
3819
3849
|
const TableBody = forwardRef(
|
|
@@ -4413,7 +4443,7 @@ const DataTable = forwardRef(
|
|
|
4413
4443
|
defaultLimit = 10,
|
|
4414
4444
|
limit,
|
|
4415
4445
|
onLimitChange,
|
|
4416
|
-
defaultFilter = "",
|
|
4446
|
+
defaultFilter: defaultFilter2 = "",
|
|
4417
4447
|
filter,
|
|
4418
4448
|
onFilterChange,
|
|
4419
4449
|
defaultSortBy = null,
|
|
@@ -4464,7 +4494,7 @@ const DataTable = forwardRef(
|
|
|
4464
4494
|
defaultLimit,
|
|
4465
4495
|
limit,
|
|
4466
4496
|
onLimitChange,
|
|
4467
|
-
defaultFilter,
|
|
4497
|
+
defaultFilter: defaultFilter2,
|
|
4468
4498
|
filter,
|
|
4469
4499
|
onFilterChange,
|
|
4470
4500
|
defaultSortBy,
|
|
@@ -4660,12 +4690,12 @@ function useCheckboxGroupContext() {
|
|
|
4660
4690
|
}
|
|
4661
4691
|
function useIsCheckedInGroup(checkboxValue) {
|
|
4662
4692
|
const store = useCheckboxGroupContext()?.store ?? EMPTY_STORE;
|
|
4663
|
-
const handleCheckedChange = useStore(
|
|
4693
|
+
const handleCheckedChange = useStore$1(
|
|
4664
4694
|
store,
|
|
4665
4695
|
(state) => state.actions?.handleCheckedChange
|
|
4666
4696
|
);
|
|
4667
4697
|
return [
|
|
4668
|
-
useStore(store, (state) => state.value?.includes(checkboxValue)),
|
|
4698
|
+
useStore$1(store, (state) => state.value?.includes(checkboxValue)),
|
|
4669
4699
|
useMemo(
|
|
4670
4700
|
() => handleCheckedChange && ((checked) => handleCheckedChange(checkboxValue, checked)),
|
|
4671
4701
|
[checkboxValue, handleCheckedChange]
|
|
@@ -4676,13 +4706,13 @@ function useIsRequiredInGroup() {
|
|
|
4676
4706
|
const context = useCheckboxGroupContext();
|
|
4677
4707
|
const store = context?.store ?? EMPTY_STORE;
|
|
4678
4708
|
const required = context?.required;
|
|
4679
|
-
return useStore(store, (state) => required && state.value.length === 0);
|
|
4709
|
+
return useStore$1(store, (state) => required && state.value.length === 0);
|
|
4680
4710
|
}
|
|
4681
4711
|
function useCheckboxGroupDescriptionIds(checkboxId) {
|
|
4682
4712
|
const context = useCheckboxGroupContext();
|
|
4683
4713
|
const store = context?.store ?? EMPTY_STORE;
|
|
4684
4714
|
const descriptionIds = context?.descriptionIds;
|
|
4685
|
-
const isFirstCheckbox = useStore(
|
|
4715
|
+
const isFirstCheckbox = useStore$1(
|
|
4686
4716
|
store,
|
|
4687
4717
|
(state) => state.firstCheckboxId === checkboxId
|
|
4688
4718
|
);
|
|
@@ -5072,16 +5102,16 @@ const DATA_TABLE_SELECTION_COLUMN_WIDTH = 42;
|
|
|
5072
5102
|
function useDataTableSelectionColumn() {
|
|
5073
5103
|
const prefix = usePrefix();
|
|
5074
5104
|
const { displayMode, rowKey, showSelectionColumn, store } = useDataTableContext();
|
|
5075
|
-
const [selectedRows] = useStore(store, (state) => state.selectedRows);
|
|
5076
|
-
const disabledSelections = useStore(
|
|
5105
|
+
const [selectedRows] = useStore$1(store, (state) => state.selectedRows);
|
|
5106
|
+
const disabledSelections = useStore$1(
|
|
5077
5107
|
store,
|
|
5078
5108
|
(state) => state.disabledSelections
|
|
5079
5109
|
);
|
|
5080
|
-
const { selectRows, unselectRows } = useStore(
|
|
5110
|
+
const { selectRows, unselectRows } = useStore$1(
|
|
5081
5111
|
store,
|
|
5082
5112
|
(state) => state.actions
|
|
5083
5113
|
);
|
|
5084
|
-
const allCheckedStatus = useStore(
|
|
5114
|
+
const allCheckedStatus = useStore$1(
|
|
5085
5115
|
store,
|
|
5086
5116
|
useShallow((state) => {
|
|
5087
5117
|
if (state.loading || !showSelectionColumn) {
|
|
@@ -5175,7 +5205,7 @@ const DataTableRow = memo(
|
|
|
5175
5205
|
const { rowKey, renderCell, generatedId, estimatedRowHeight, store } = useDataTableContext();
|
|
5176
5206
|
const selectionColumn = useDataTableSelectionColumn();
|
|
5177
5207
|
const dataTableSelectionColumnId = useDataTableSelectionColumnId();
|
|
5178
|
-
const leafColumns2 = useStore(
|
|
5208
|
+
const leafColumns2 = useStore$1(
|
|
5179
5209
|
store,
|
|
5180
5210
|
useShallow(
|
|
5181
5211
|
(state) => selectionColumn ? {
|
|
@@ -5184,9 +5214,9 @@ const DataTableRow = memo(
|
|
|
5184
5214
|
} : state.leafColumns
|
|
5185
5215
|
)
|
|
5186
5216
|
);
|
|
5187
|
-
const headCount = useStore(store, (state) => state.headCount);
|
|
5188
|
-
const filter = useStore(store, (state) => state.filter);
|
|
5189
|
-
const selected = useStore(
|
|
5217
|
+
const headCount = useStore$1(store, (state) => state.headCount);
|
|
5218
|
+
const filter = useStore$1(store, (state) => state.filter);
|
|
5219
|
+
const selected = useStore$1(
|
|
5190
5220
|
store,
|
|
5191
5221
|
(state) => row && state.selectedRows[0].has(getRowKey(row, rowKey))
|
|
5192
5222
|
);
|
|
@@ -5275,8 +5305,8 @@ function DataTableEmptyOrLoadingRows({
|
|
|
5275
5305
|
}) {
|
|
5276
5306
|
const prefix = usePrefix();
|
|
5277
5307
|
const { showSelectionColumn, renderRow, store, apiRef } = useDataTableContext();
|
|
5278
|
-
const loading = useStore(store, (state) => state.loading);
|
|
5279
|
-
const loadingCount = useStore(store, (state) => state.loadingCount);
|
|
5308
|
+
const loading = useStore$1(store, (state) => state.loading);
|
|
5309
|
+
const loadingCount = useStore$1(store, (state) => state.loadingCount);
|
|
5280
5310
|
const numberOfColumns2 = (useTableNumberOfColumns() ?? 1) + (showSelectionColumn ? 1 : 0);
|
|
5281
5311
|
useImperativeHandle(
|
|
5282
5312
|
apiRef,
|
|
@@ -5340,11 +5370,11 @@ function PagedDataTableRows() {
|
|
|
5340
5370
|
),
|
|
5341
5371
|
[goTo, store]
|
|
5342
5372
|
);
|
|
5343
|
-
const pageOffset = useStore(
|
|
5373
|
+
const pageOffset = useStore$1(
|
|
5344
5374
|
store,
|
|
5345
5375
|
(state) => showAllRows ? 0 : state.pageOffset()
|
|
5346
5376
|
);
|
|
5347
|
-
const rowsWindow = useStore(
|
|
5377
|
+
const rowsWindow = useStore$1(
|
|
5348
5378
|
store,
|
|
5349
5379
|
useShallow(
|
|
5350
5380
|
(state) => state.rowsWindow(
|
|
@@ -5371,8 +5401,8 @@ function ScrolledDataTableRows({
|
|
|
5371
5401
|
apiRef,
|
|
5372
5402
|
store
|
|
5373
5403
|
} = useDataTableContext();
|
|
5374
|
-
const tableHeadHeight = useStore(store, (state) => state.tableHeadHeight);
|
|
5375
|
-
const bodyCount = useStore(store, (state) => state.bodyCount());
|
|
5404
|
+
const tableHeadHeight = useStore$1(store, (state) => state.tableHeadHeight);
|
|
5405
|
+
const bodyCount = useStore$1(store, (state) => state.bodyCount());
|
|
5376
5406
|
const virtualizer = useVirtualizer({
|
|
5377
5407
|
count: bodyCount,
|
|
5378
5408
|
getScrollElement: useCallback(() => scrollableRef.current, [scrollableRef]),
|
|
@@ -5463,7 +5493,7 @@ function ScrolledDataTableRows({
|
|
|
5463
5493
|
const virtualItems = virtualizer.getVirtualItems();
|
|
5464
5494
|
const firstVirtualItem = virtualItems[0];
|
|
5465
5495
|
const lastVirtualItem = virtualItems[virtualItems.length - 1];
|
|
5466
|
-
const rowsWindow = useStore(
|
|
5496
|
+
const rowsWindow = useStore$1(
|
|
5467
5497
|
store,
|
|
5468
5498
|
useShallow(
|
|
5469
5499
|
(state) => state.rowsWindow(firstVirtualItem?.index ?? 0, virtualItems.length)
|
|
@@ -5525,7 +5555,7 @@ function ScrolledDataTableRows({
|
|
|
5525
5555
|
}
|
|
5526
5556
|
const DataTableBody = forwardRef(function DataTableBody2({ emptyMessage, emptyMessageProps, scrollableRef, ...otherProps }, forwardedRef) {
|
|
5527
5557
|
const { displayMode, store } = useDataTableContext();
|
|
5528
|
-
const isEmptyOrLoading = useStore(
|
|
5558
|
+
const isEmptyOrLoading = useStore$1(
|
|
5529
5559
|
store,
|
|
5530
5560
|
(state) => state.loading || state.totalCount() === 0
|
|
5531
5561
|
);
|
|
@@ -5540,10 +5570,10 @@ const DataTableBody = forwardRef(function DataTableBody2({ emptyMessage, emptyMe
|
|
|
5540
5570
|
!isEmptyOrLoading && (displayMode === "paged" ? /* @__PURE__ */ jsx(PagedDataTableRows, {}) : /* @__PURE__ */ jsx(ScrolledDataTableRows, { scrollableRef }))
|
|
5541
5571
|
] });
|
|
5542
5572
|
});
|
|
5543
|
-
const useLayoutEffect = typeof document !== "undefined" ? useLayoutEffect$
|
|
5573
|
+
const useLayoutEffect$1 = typeof document !== "undefined" ? useLayoutEffect$2 : () => {
|
|
5544
5574
|
};
|
|
5545
5575
|
function useMeasure(element, setMeasurement) {
|
|
5546
|
-
useLayoutEffect(() => {
|
|
5576
|
+
useLayoutEffect$1(() => {
|
|
5547
5577
|
if (!element) {
|
|
5548
5578
|
setMeasurement(void 0);
|
|
5549
5579
|
return;
|
|
@@ -5561,7 +5591,7 @@ function useMeasure(element, setMeasurement) {
|
|
|
5561
5591
|
}
|
|
5562
5592
|
const DataTableFoot = forwardRef(function DataTableFoot2({ showWhenEmpty, ...otherProps }, forwardedRef) {
|
|
5563
5593
|
const { store } = useDataTableContext();
|
|
5564
|
-
const shouldShow = useStore(
|
|
5594
|
+
const shouldShow = useStore$1(
|
|
5565
5595
|
store,
|
|
5566
5596
|
(state) => showWhenEmpty || !state.loading && (state.totalCount() ?? 0) > 0
|
|
5567
5597
|
);
|
|
@@ -5580,7 +5610,7 @@ const DataTableHead = forwardRef(function DataTableHead2({ rowProps, ...otherPro
|
|
|
5580
5610
|
const { generatedId, store } = useDataTableContext();
|
|
5581
5611
|
const selectionColumn = useDataTableSelectionColumn();
|
|
5582
5612
|
const dataTableSelectionColumnId = useDataTableSelectionColumnId();
|
|
5583
|
-
const columns = useStore(
|
|
5613
|
+
const columns = useStore$1(
|
|
5584
5614
|
store,
|
|
5585
5615
|
useShallow(
|
|
5586
5616
|
(state) => selectionColumn ? {
|
|
@@ -5589,9 +5619,9 @@ const DataTableHead = forwardRef(function DataTableHead2({ rowProps, ...otherPro
|
|
|
5589
5619
|
} : state.columns
|
|
5590
5620
|
)
|
|
5591
5621
|
);
|
|
5592
|
-
const sortBy = useStore(store, (state) => state.sortBy);
|
|
5593
|
-
const sortDirection = useStore(store, (state) => state.sortDirection);
|
|
5594
|
-
const { setSort } = useStore(store, (state) => state.actions);
|
|
5622
|
+
const sortBy = useStore$1(store, (state) => state.sortBy);
|
|
5623
|
+
const sortDirection = useStore$1(store, (state) => state.sortDirection);
|
|
5624
|
+
const { setSort } = useStore$1(store, (state) => state.actions);
|
|
5595
5625
|
const [tableHeadEl, setTableHeadEl] = useState(null);
|
|
5596
5626
|
useMeasure(
|
|
5597
5627
|
tableHeadEl,
|
|
@@ -5679,7 +5709,7 @@ const DataTableContent = forwardRef(function DataTable2({
|
|
|
5679
5709
|
const scrollableRef = useRef(null);
|
|
5680
5710
|
const { height: scrollbarHeight } = useScrollbarSize();
|
|
5681
5711
|
const rowHeight = typeof estimatedRowHeight === "number" ? estimatedRowHeight : estimatedRowHeight(0);
|
|
5682
|
-
const maxHeight = useStore(
|
|
5712
|
+
const maxHeight = useStore$1(
|
|
5683
5713
|
store,
|
|
5684
5714
|
(state) => displayMode === "scrolled" && !state.loading && (state.totalCount() ?? 0) > state.limit ? (state.tableHeadHeight ?? rowHeight) + (state.tableFootHeight ?? 0) + rowHeight * state.limit + // TODO: Only add this if the container overflows horizontally
|
|
5685
5715
|
scrollbarHeight : void 0
|
|
@@ -5756,12 +5786,12 @@ const DataTableFilter = forwardRef(function DataTableFilter2({
|
|
|
5756
5786
|
ariaLabel ??= locale7.DataTableFilter["aria-label"];
|
|
5757
5787
|
placeholder ??= locale7.DataTableFilter.placeholder;
|
|
5758
5788
|
const { store } = useDataTableContext();
|
|
5759
|
-
const filter = useStore(store, (state) => state.filter);
|
|
5789
|
+
const filter = useStore$1(store, (state) => state.filter);
|
|
5760
5790
|
const handleFilterChange = (value) => {
|
|
5761
5791
|
startTransition(() => store.getState().actions.setFilter(value));
|
|
5762
5792
|
};
|
|
5763
5793
|
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(
|
|
5764
|
-
Input,
|
|
5794
|
+
Input$1,
|
|
5765
5795
|
{
|
|
5766
5796
|
placeholder,
|
|
5767
5797
|
showClearButton: "auto",
|
|
@@ -5795,11 +5825,11 @@ const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
|
5795
5825
|
}, forwardedRef) {
|
|
5796
5826
|
const prefix = usePrefix();
|
|
5797
5827
|
const { store } = useDataTableContext();
|
|
5798
|
-
const totalCount = useStore(store, (state) => state.totalCount());
|
|
5799
|
-
const limit = useStore(store, (state) => state.limit);
|
|
5800
|
-
const { setOffset } = useStore(store, (state) => state.actions);
|
|
5828
|
+
const totalCount = useStore$1(store, (state) => state.totalCount());
|
|
5829
|
+
const limit = useStore$1(store, (state) => state.limit);
|
|
5830
|
+
const { setOffset } = useStore$1(store, (state) => state.actions);
|
|
5801
5831
|
const setOffsetWithTransition = (offset) => startTransition(() => setOffset(offset));
|
|
5802
|
-
const currentPage = useStore(store, (state) => state.currentPage());
|
|
5832
|
+
const currentPage = useStore$1(store, (state) => state.currentPage());
|
|
5803
5833
|
const numberOfPages = Math.ceil((totalCount ?? 0) / limit);
|
|
5804
5834
|
const lastPage = Math.max(0, numberOfPages - 1);
|
|
5805
5835
|
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsxs(
|
|
@@ -5873,12 +5903,12 @@ const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
|
5873
5903
|
const ScrolledDataTablePagination = forwardRef(function ScrolledDataTablePagination2({ rowsRange, preferRightAlignment, className, ...otherProps }, forwardedRef) {
|
|
5874
5904
|
const prefix = usePrefix();
|
|
5875
5905
|
const { store } = useDataTableContext();
|
|
5876
|
-
const totalCount = useStore(store, (state) => state.totalCount());
|
|
5877
|
-
const scrolledRangeStart = useStore(
|
|
5906
|
+
const totalCount = useStore$1(store, (state) => state.totalCount());
|
|
5907
|
+
const scrolledRangeStart = useStore$1(
|
|
5878
5908
|
store,
|
|
5879
5909
|
(state) => state.scrolledRangeStart
|
|
5880
5910
|
);
|
|
5881
|
-
const scrolledRangeEnd = useStore(store, (state) => state.scrolledRangeEnd);
|
|
5911
|
+
const scrolledRangeEnd = useStore$1(store, (state) => state.scrolledRangeEnd);
|
|
5882
5912
|
return /* @__PURE__ */ jsxs(
|
|
5883
5913
|
"div",
|
|
5884
5914
|
{
|
|
@@ -5948,8 +5978,8 @@ const DataTableRowsPerPage = forwardRef(function DataTableRowsPerPage2({
|
|
|
5948
5978
|
const [locale7] = useLocale();
|
|
5949
5979
|
label ??= locale7.DataTableRowsPerPage.label;
|
|
5950
5980
|
const { store } = useDataTableContext();
|
|
5951
|
-
const limit = useStore(store, (state) => state.limit);
|
|
5952
|
-
const { setLimit } = useStore(store, (state) => state.actions);
|
|
5981
|
+
const limit = useStore$1(store, (state) => state.limit);
|
|
5982
|
+
const { setLimit } = useStore$1(store, (state) => state.actions);
|
|
5953
5983
|
const optionsIncludingLimit = limitOptions.includes(limit) ? [...limitOptions] : [...limitOptions, limit];
|
|
5954
5984
|
optionsIncludingLimit.sort((v1, v2) => v1 - v2);
|
|
5955
5985
|
const selectId = prefix(`data-table-rows-per-page-${useId()}`);
|
|
@@ -6000,7 +6030,7 @@ const DataTableSelectionTrigger = forwardRef(function DataTableSelectionTrigger2
|
|
|
6000
6030
|
}, forwardedRef) {
|
|
6001
6031
|
const prefix = usePrefix();
|
|
6002
6032
|
const { store } = useDataTableContext();
|
|
6003
|
-
const hasSelected = useStore(store, (state) => state.selectedRows.length > 0);
|
|
6033
|
+
const hasSelected = useStore$1(store, (state) => state.selectedRows.length > 0);
|
|
6004
6034
|
const handleClick = useCallback(
|
|
6005
6035
|
(event) => {
|
|
6006
6036
|
onClick(Array.from(store.getState().selectedRows[0]).sort(), event);
|
|
@@ -6024,7 +6054,7 @@ const DataTableSelectionTrigger = forwardRef(function DataTableSelectionTrigger2
|
|
|
6024
6054
|
const REQUIRED_TAGS = ["INPUT", "SELECT", "TEXTAREA"];
|
|
6025
6055
|
const READ_ONLY_TAGS = ["INPUT", "TEXTAREA"];
|
|
6026
6056
|
const NON_READONLY_INPUT_TYPES = ["file", "color"];
|
|
6027
|
-
const Input = forwardRef(
|
|
6057
|
+
const Input$1 = forwardRef(
|
|
6028
6058
|
function Input2({
|
|
6029
6059
|
asChild,
|
|
6030
6060
|
type,
|
|
@@ -6040,6 +6070,7 @@ const Input = forwardRef(
|
|
|
6040
6070
|
startAdornment,
|
|
6041
6071
|
endAdornment,
|
|
6042
6072
|
showClearButton,
|
|
6073
|
+
clearDescription,
|
|
6043
6074
|
clearButtonLabel,
|
|
6044
6075
|
onValueChange,
|
|
6045
6076
|
onBlurToOutside,
|
|
@@ -6164,6 +6195,7 @@ const Input = forwardRef(
|
|
|
6164
6195
|
}
|
|
6165
6196
|
}, [inputEl]);
|
|
6166
6197
|
const hasClearButton = !disabled && !loading && !readOnly && (showClearButton === true || showClearButton === "auto" && (isControlled ? (value?.toString() ?? "")?.length > 0 : shouldShowClearButton));
|
|
6198
|
+
const clearDescriptionId = hasClearButton && clearDescription && prefix(`control-clear-${generatedId}`);
|
|
6167
6199
|
const { cssVars, dataAttrs } = responsiveValuesToCssVarsAndDataAttrs(
|
|
6168
6200
|
"control",
|
|
6169
6201
|
{ align }
|
|
@@ -6264,7 +6296,8 @@ const Input = forwardRef(
|
|
|
6264
6296
|
loadingDescriptionId,
|
|
6265
6297
|
errorMessageIds,
|
|
6266
6298
|
ariaDescribedBy,
|
|
6267
|
-
descriptionIds
|
|
6299
|
+
descriptionIds,
|
|
6300
|
+
clearDescriptionId
|
|
6268
6301
|
),
|
|
6269
6302
|
...otherProps,
|
|
6270
6303
|
ref: combinedInputRef
|
|
@@ -6319,13 +6352,14 @@ const Input = forwardRef(
|
|
|
6319
6352
|
)
|
|
6320
6353
|
}
|
|
6321
6354
|
),
|
|
6322
|
-
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription })
|
|
6355
|
+
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription }),
|
|
6356
|
+
clearDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: clearDescriptionId, children: clearDescription })
|
|
6323
6357
|
] });
|
|
6324
6358
|
}
|
|
6325
6359
|
);
|
|
6326
6360
|
const InputWithContainerRef = forwardRef(function InputWithContainerRef2({ inputRef, containerProps, ...otherProps }, forwardedRef) {
|
|
6327
6361
|
return /* @__PURE__ */ jsx(
|
|
6328
|
-
Input,
|
|
6362
|
+
Input$1,
|
|
6329
6363
|
{
|
|
6330
6364
|
containerProps: {
|
|
6331
6365
|
...containerProps,
|
|
@@ -6550,6 +6584,852 @@ const MenuListItem = forwardRef(
|
|
|
6550
6584
|
);
|
|
6551
6585
|
}
|
|
6552
6586
|
);
|
|
6587
|
+
var SCORE_CONTINUE_MATCH = 1, SCORE_SPACE_WORD_JUMP = 0.9, SCORE_NON_SPACE_WORD_JUMP = 0.8, SCORE_CHARACTER_JUMP = 0.17, SCORE_TRANSPOSITION = 0.1, PENALTY_SKIPPED = 0.999, PENALTY_CASE_MISMATCH = 0.9999, PENALTY_NOT_COMPLETE = 0.99;
|
|
6588
|
+
var IS_GAP_REGEXP = /[\\\/_+.#"@\[\(\{&]/, COUNT_GAPS_REGEXP = /[\\\/_+.#"@\[\(\{&]/g, IS_SPACE_REGEXP = /[\s-]/, COUNT_SPACE_REGEXP = /[\s-]/g;
|
|
6589
|
+
function commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, stringIndex, abbreviationIndex, memoizedResults) {
|
|
6590
|
+
if (abbreviationIndex === abbreviation.length) {
|
|
6591
|
+
if (stringIndex === string.length) {
|
|
6592
|
+
return SCORE_CONTINUE_MATCH;
|
|
6593
|
+
}
|
|
6594
|
+
return PENALTY_NOT_COMPLETE;
|
|
6595
|
+
}
|
|
6596
|
+
var memoizeKey = `${stringIndex},${abbreviationIndex}`;
|
|
6597
|
+
if (memoizedResults[memoizeKey] !== void 0) {
|
|
6598
|
+
return memoizedResults[memoizeKey];
|
|
6599
|
+
}
|
|
6600
|
+
var abbreviationChar = lowerAbbreviation.charAt(abbreviationIndex);
|
|
6601
|
+
var index = lowerString.indexOf(abbreviationChar, stringIndex);
|
|
6602
|
+
var highScore = 0;
|
|
6603
|
+
var score, transposedScore, wordBreaks, spaceBreaks;
|
|
6604
|
+
while (index >= 0) {
|
|
6605
|
+
score = commandScoreInner(
|
|
6606
|
+
string,
|
|
6607
|
+
abbreviation,
|
|
6608
|
+
lowerString,
|
|
6609
|
+
lowerAbbreviation,
|
|
6610
|
+
index + 1,
|
|
6611
|
+
abbreviationIndex + 1,
|
|
6612
|
+
memoizedResults
|
|
6613
|
+
);
|
|
6614
|
+
if (score > highScore) {
|
|
6615
|
+
if (index === stringIndex) {
|
|
6616
|
+
score *= SCORE_CONTINUE_MATCH;
|
|
6617
|
+
} else if (IS_GAP_REGEXP.test(string.charAt(index - 1))) {
|
|
6618
|
+
score *= SCORE_NON_SPACE_WORD_JUMP;
|
|
6619
|
+
wordBreaks = string.slice(stringIndex, index - 1).match(COUNT_GAPS_REGEXP);
|
|
6620
|
+
if (wordBreaks && stringIndex > 0) {
|
|
6621
|
+
score *= Math.pow(PENALTY_SKIPPED, wordBreaks.length);
|
|
6622
|
+
}
|
|
6623
|
+
} else if (IS_SPACE_REGEXP.test(string.charAt(index - 1))) {
|
|
6624
|
+
score *= SCORE_SPACE_WORD_JUMP;
|
|
6625
|
+
spaceBreaks = string.slice(stringIndex, index - 1).match(COUNT_SPACE_REGEXP);
|
|
6626
|
+
if (spaceBreaks && stringIndex > 0) {
|
|
6627
|
+
score *= Math.pow(PENALTY_SKIPPED, spaceBreaks.length);
|
|
6628
|
+
}
|
|
6629
|
+
} else {
|
|
6630
|
+
score *= SCORE_CHARACTER_JUMP;
|
|
6631
|
+
if (stringIndex > 0) {
|
|
6632
|
+
score *= Math.pow(PENALTY_SKIPPED, index - stringIndex);
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
if (string.charAt(index) !== abbreviation.charAt(abbreviationIndex)) {
|
|
6636
|
+
score *= PENALTY_CASE_MISMATCH;
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
if (score < SCORE_TRANSPOSITION && lowerString.charAt(index - 1) === lowerAbbreviation.charAt(abbreviationIndex + 1) || lowerAbbreviation.charAt(abbreviationIndex + 1) === lowerAbbreviation.charAt(abbreviationIndex) && // allow duplicate letters. Ref #7428
|
|
6640
|
+
lowerString.charAt(index - 1) !== lowerAbbreviation.charAt(abbreviationIndex)) {
|
|
6641
|
+
transposedScore = commandScoreInner(
|
|
6642
|
+
string,
|
|
6643
|
+
abbreviation,
|
|
6644
|
+
lowerString,
|
|
6645
|
+
lowerAbbreviation,
|
|
6646
|
+
index + 1,
|
|
6647
|
+
abbreviationIndex + 2,
|
|
6648
|
+
memoizedResults
|
|
6649
|
+
);
|
|
6650
|
+
if (transposedScore * SCORE_TRANSPOSITION > score) {
|
|
6651
|
+
score = transposedScore * SCORE_TRANSPOSITION;
|
|
6652
|
+
}
|
|
6653
|
+
}
|
|
6654
|
+
if (score > highScore) {
|
|
6655
|
+
highScore = score;
|
|
6656
|
+
}
|
|
6657
|
+
index = lowerString.indexOf(abbreviationChar, index + 1);
|
|
6658
|
+
}
|
|
6659
|
+
memoizedResults[memoizeKey] = highScore;
|
|
6660
|
+
return highScore;
|
|
6661
|
+
}
|
|
6662
|
+
function formatInput(string) {
|
|
6663
|
+
return string.toLowerCase().replace(COUNT_SPACE_REGEXP, " ");
|
|
6664
|
+
}
|
|
6665
|
+
function commandScore(string, abbreviation, aliases) {
|
|
6666
|
+
string = aliases && aliases.length > 0 ? `${string + " " + aliases.join(" ")}` : string;
|
|
6667
|
+
return commandScoreInner(
|
|
6668
|
+
string,
|
|
6669
|
+
abbreviation,
|
|
6670
|
+
formatInput(string),
|
|
6671
|
+
formatInput(abbreviation),
|
|
6672
|
+
0,
|
|
6673
|
+
0,
|
|
6674
|
+
{}
|
|
6675
|
+
);
|
|
6676
|
+
}
|
|
6677
|
+
const GROUP_SELECTOR = `[cmdk-group=""]`;
|
|
6678
|
+
const GROUP_ITEMS_SELECTOR = `[cmdk-group-items=""]`;
|
|
6679
|
+
const GROUP_HEADING_SELECTOR = `[cmdk-group-heading=""]`;
|
|
6680
|
+
const ITEM_SELECTOR = `[cmdk-item=""]`;
|
|
6681
|
+
const VALID_ITEM_SELECTOR = `${ITEM_SELECTOR}:not([aria-disabled="true"])`;
|
|
6682
|
+
const SELECT_EVENT = `cmdk-item-select`;
|
|
6683
|
+
const VALUE_ATTR = `data-value`;
|
|
6684
|
+
const defaultFilter = (value, search, keywords) => commandScore(value, search, keywords);
|
|
6685
|
+
const CommandContext = React.createContext(void 0);
|
|
6686
|
+
const useCommand = () => React.useContext(CommandContext);
|
|
6687
|
+
const StoreContext = React.createContext(void 0);
|
|
6688
|
+
const useStore = () => React.useContext(StoreContext);
|
|
6689
|
+
const GroupContext = React.createContext(void 0);
|
|
6690
|
+
const Command = React.forwardRef(
|
|
6691
|
+
(props, forwardedRef) => {
|
|
6692
|
+
const state = useLazyRef(() => ({
|
|
6693
|
+
/** Value of the search query. */
|
|
6694
|
+
search: "",
|
|
6695
|
+
/** Currently selected item value. */
|
|
6696
|
+
value: props.value ?? props.defaultValue ?? "",
|
|
6697
|
+
/** Currently selected item id. */
|
|
6698
|
+
selectedItemId: void 0,
|
|
6699
|
+
filtered: {
|
|
6700
|
+
/** The count of all visible items. */
|
|
6701
|
+
count: 0,
|
|
6702
|
+
/** Map from visible item id to its search score. */
|
|
6703
|
+
items: /* @__PURE__ */ new Map(),
|
|
6704
|
+
/** Set of groups with at least one visible item. */
|
|
6705
|
+
groups: /* @__PURE__ */ new Set()
|
|
6706
|
+
}
|
|
6707
|
+
}));
|
|
6708
|
+
const allItems = useLazyRef(() => /* @__PURE__ */ new Set());
|
|
6709
|
+
const allGroups = useLazyRef(() => /* @__PURE__ */ new Map());
|
|
6710
|
+
const ids = useLazyRef(
|
|
6711
|
+
() => /* @__PURE__ */ new Map()
|
|
6712
|
+
);
|
|
6713
|
+
const listeners = useLazyRef(() => /* @__PURE__ */ new Set());
|
|
6714
|
+
const propsRef = useAsRef(props);
|
|
6715
|
+
const {
|
|
6716
|
+
asChild,
|
|
6717
|
+
label,
|
|
6718
|
+
children,
|
|
6719
|
+
value,
|
|
6720
|
+
onValueChange,
|
|
6721
|
+
filter,
|
|
6722
|
+
shouldFilter,
|
|
6723
|
+
loop,
|
|
6724
|
+
disablePointerSelection = false,
|
|
6725
|
+
...etc
|
|
6726
|
+
} = props;
|
|
6727
|
+
const listId = React.useId();
|
|
6728
|
+
const labelId = React.useId();
|
|
6729
|
+
const inputId = React.useId();
|
|
6730
|
+
const listInnerRef = React.useRef(null);
|
|
6731
|
+
const schedule = useScheduleLayoutEffect();
|
|
6732
|
+
useLayoutEffect(() => {
|
|
6733
|
+
if (value !== void 0) {
|
|
6734
|
+
const v = value.trim();
|
|
6735
|
+
state.current.value = v;
|
|
6736
|
+
store.emit();
|
|
6737
|
+
}
|
|
6738
|
+
}, [value]);
|
|
6739
|
+
useLayoutEffect(() => {
|
|
6740
|
+
setTimeout(() => {
|
|
6741
|
+
schedule(6, scrollSelectedIntoView);
|
|
6742
|
+
});
|
|
6743
|
+
}, []);
|
|
6744
|
+
const store = React.useMemo(() => {
|
|
6745
|
+
return {
|
|
6746
|
+
subscribe: (cb) => {
|
|
6747
|
+
listeners.current.add(cb);
|
|
6748
|
+
return () => listeners.current.delete(cb);
|
|
6749
|
+
},
|
|
6750
|
+
snapshot: () => {
|
|
6751
|
+
return state.current;
|
|
6752
|
+
},
|
|
6753
|
+
setState: (key, value2, opts) => {
|
|
6754
|
+
if (Object.is(state.current[key], value2)) return;
|
|
6755
|
+
state.current[key] = value2;
|
|
6756
|
+
if (key === "search") {
|
|
6757
|
+
filterItems();
|
|
6758
|
+
sort();
|
|
6759
|
+
schedule(1, selectFirstItem);
|
|
6760
|
+
} else if (key === "value") {
|
|
6761
|
+
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
6762
|
+
const input = document.getElementById(inputId);
|
|
6763
|
+
if (input) input.focus();
|
|
6764
|
+
else document.getElementById(listId)?.focus();
|
|
6765
|
+
}
|
|
6766
|
+
schedule(7, () => {
|
|
6767
|
+
state.current.selectedItemId = opts.id;
|
|
6768
|
+
store.emit();
|
|
6769
|
+
});
|
|
6770
|
+
if (!opts.disableScrollIntoView) {
|
|
6771
|
+
schedule(5, () => scrollSelectedIntoView(opts.id));
|
|
6772
|
+
}
|
|
6773
|
+
if (propsRef.current?.value !== void 0) {
|
|
6774
|
+
const newValue = value2 ?? "";
|
|
6775
|
+
propsRef.current.onValueChange?.(newValue);
|
|
6776
|
+
return;
|
|
6777
|
+
}
|
|
6778
|
+
}
|
|
6779
|
+
store.emit();
|
|
6780
|
+
},
|
|
6781
|
+
emit: () => {
|
|
6782
|
+
listeners.current.forEach((l) => l());
|
|
6783
|
+
}
|
|
6784
|
+
};
|
|
6785
|
+
}, []);
|
|
6786
|
+
const context = React.useMemo(
|
|
6787
|
+
() => ({
|
|
6788
|
+
// Keep id → {value, keywords} mapping up-to-date
|
|
6789
|
+
value: (id, value2, keywords) => {
|
|
6790
|
+
if (value2 !== ids.current.get(id)?.value) {
|
|
6791
|
+
ids.current.set(id, { value: value2, keywords });
|
|
6792
|
+
state.current.filtered.items.set(id, score(value2, keywords));
|
|
6793
|
+
schedule(2, () => {
|
|
6794
|
+
sort();
|
|
6795
|
+
store.emit();
|
|
6796
|
+
});
|
|
6797
|
+
}
|
|
6798
|
+
},
|
|
6799
|
+
// Track item lifecycle (mount, unmount)
|
|
6800
|
+
item: (id, groupId) => {
|
|
6801
|
+
allItems.current.add(id);
|
|
6802
|
+
if (groupId) {
|
|
6803
|
+
if (!allGroups.current.has(groupId)) {
|
|
6804
|
+
allGroups.current.set(groupId, /* @__PURE__ */ new Set([id]));
|
|
6805
|
+
} else {
|
|
6806
|
+
allGroups.current.get(groupId).add(id);
|
|
6807
|
+
}
|
|
6808
|
+
}
|
|
6809
|
+
schedule(3, () => {
|
|
6810
|
+
filterItems();
|
|
6811
|
+
sort();
|
|
6812
|
+
if (!state.current.value) {
|
|
6813
|
+
selectFirstItem();
|
|
6814
|
+
}
|
|
6815
|
+
store.emit();
|
|
6816
|
+
});
|
|
6817
|
+
return () => {
|
|
6818
|
+
ids.current.delete(id);
|
|
6819
|
+
allItems.current.delete(id);
|
|
6820
|
+
state.current.filtered.items.delete(id);
|
|
6821
|
+
const selectedItem = getSelectedItem();
|
|
6822
|
+
schedule(4, () => {
|
|
6823
|
+
filterItems();
|
|
6824
|
+
if (selectedItem?.getAttribute("id") === id) selectFirstItem();
|
|
6825
|
+
store.emit();
|
|
6826
|
+
});
|
|
6827
|
+
};
|
|
6828
|
+
},
|
|
6829
|
+
// Track group lifecycle (mount, unmount)
|
|
6830
|
+
group: (id) => {
|
|
6831
|
+
if (!allGroups.current.has(id)) {
|
|
6832
|
+
allGroups.current.set(id, /* @__PURE__ */ new Set());
|
|
6833
|
+
}
|
|
6834
|
+
return () => {
|
|
6835
|
+
ids.current.delete(id);
|
|
6836
|
+
allGroups.current.delete(id);
|
|
6837
|
+
};
|
|
6838
|
+
},
|
|
6839
|
+
filter: () => {
|
|
6840
|
+
return propsRef.current.shouldFilter;
|
|
6841
|
+
},
|
|
6842
|
+
label: label || props["aria-label"],
|
|
6843
|
+
getDisablePointerSelection: () => {
|
|
6844
|
+
return propsRef.current.disablePointerSelection;
|
|
6845
|
+
},
|
|
6846
|
+
listId,
|
|
6847
|
+
inputId,
|
|
6848
|
+
labelId,
|
|
6849
|
+
listInnerRef
|
|
6850
|
+
}),
|
|
6851
|
+
[]
|
|
6852
|
+
);
|
|
6853
|
+
function score(value2, keywords) {
|
|
6854
|
+
const filter2 = propsRef.current?.filter ?? defaultFilter;
|
|
6855
|
+
return value2 ? filter2(value2, state.current.search, keywords) : 0;
|
|
6856
|
+
}
|
|
6857
|
+
function sort() {
|
|
6858
|
+
if (!state.current.search || // Explicitly false, because true | undefined is the default
|
|
6859
|
+
propsRef.current.shouldFilter === false) {
|
|
6860
|
+
return;
|
|
6861
|
+
}
|
|
6862
|
+
const scores = state.current.filtered.items;
|
|
6863
|
+
const groups = [];
|
|
6864
|
+
state.current.filtered.groups.forEach((value2) => {
|
|
6865
|
+
const items = allGroups.current.get(value2);
|
|
6866
|
+
let max2 = 0;
|
|
6867
|
+
items.forEach((item) => {
|
|
6868
|
+
const score2 = scores.get(item);
|
|
6869
|
+
max2 = Math.max(score2, max2);
|
|
6870
|
+
});
|
|
6871
|
+
groups.push([value2, max2]);
|
|
6872
|
+
});
|
|
6873
|
+
const listInsertionElement = listInnerRef.current;
|
|
6874
|
+
getValidItems().sort((a, b) => {
|
|
6875
|
+
const valueA = a.getAttribute("id");
|
|
6876
|
+
const valueB = b.getAttribute("id");
|
|
6877
|
+
return (scores.get(valueB) ?? 0) - (scores.get(valueA) ?? 0);
|
|
6878
|
+
}).forEach((item) => {
|
|
6879
|
+
const group = item.closest(GROUP_ITEMS_SELECTOR);
|
|
6880
|
+
if (group) {
|
|
6881
|
+
group.appendChild(
|
|
6882
|
+
item.parentElement === group ? item : item.closest(`${GROUP_ITEMS_SELECTOR} > *`)
|
|
6883
|
+
);
|
|
6884
|
+
} else {
|
|
6885
|
+
listInsertionElement.appendChild(
|
|
6886
|
+
item.parentElement === listInsertionElement ? item : item.closest(`${GROUP_ITEMS_SELECTOR} > *`)
|
|
6887
|
+
);
|
|
6888
|
+
}
|
|
6889
|
+
});
|
|
6890
|
+
groups.sort((a, b) => b[1] - a[1]).forEach((group) => {
|
|
6891
|
+
const element = listInnerRef.current?.querySelector(
|
|
6892
|
+
`${GROUP_SELECTOR}[${VALUE_ATTR}="${encodeURIComponent(group[0])}"]`
|
|
6893
|
+
);
|
|
6894
|
+
element?.parentElement.appendChild(element);
|
|
6895
|
+
});
|
|
6896
|
+
}
|
|
6897
|
+
function selectFirstItem() {
|
|
6898
|
+
const item = getValidItems().find(
|
|
6899
|
+
(item2) => item2.getAttribute("aria-disabled") !== "true"
|
|
6900
|
+
);
|
|
6901
|
+
const value2 = item?.getAttribute(VALUE_ATTR);
|
|
6902
|
+
store.setState("value", value2 || void 0, {
|
|
6903
|
+
id: item?.getAttribute("id")
|
|
6904
|
+
});
|
|
6905
|
+
}
|
|
6906
|
+
function filterItems() {
|
|
6907
|
+
if (!state.current.search || // Explicitly false, because true | undefined is the default
|
|
6908
|
+
propsRef.current.shouldFilter === false) {
|
|
6909
|
+
state.current.filtered.count = allItems.current.size;
|
|
6910
|
+
return;
|
|
6911
|
+
}
|
|
6912
|
+
state.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
6913
|
+
let itemCount = 0;
|
|
6914
|
+
for (const id of allItems.current) {
|
|
6915
|
+
const value2 = ids.current.get(id)?.value ?? "";
|
|
6916
|
+
const keywords = ids.current.get(id)?.keywords ?? [];
|
|
6917
|
+
const rank = score(value2, keywords);
|
|
6918
|
+
state.current.filtered.items.set(id, rank);
|
|
6919
|
+
if (rank > 0) itemCount++;
|
|
6920
|
+
}
|
|
6921
|
+
for (const [groupId, group] of allGroups.current) {
|
|
6922
|
+
for (const itemId of group) {
|
|
6923
|
+
if (state.current.filtered.items.get(itemId) > 0) {
|
|
6924
|
+
state.current.filtered.groups.add(groupId);
|
|
6925
|
+
break;
|
|
6926
|
+
}
|
|
6927
|
+
}
|
|
6928
|
+
}
|
|
6929
|
+
state.current.filtered.count = itemCount;
|
|
6930
|
+
}
|
|
6931
|
+
function scrollSelectedIntoView(itemId) {
|
|
6932
|
+
const item = itemId ? document.getElementById(itemId) : getSelectedItem();
|
|
6933
|
+
if (item) {
|
|
6934
|
+
if (item.parentElement?.firstChild === item) {
|
|
6935
|
+
item.closest(GROUP_SELECTOR)?.querySelector(GROUP_HEADING_SELECTOR)?.scrollIntoView({ block: "nearest" });
|
|
6936
|
+
}
|
|
6937
|
+
item.scrollIntoView({ block: "nearest" });
|
|
6938
|
+
}
|
|
6939
|
+
}
|
|
6940
|
+
function getSelectedItem() {
|
|
6941
|
+
return listInnerRef.current?.querySelector(
|
|
6942
|
+
`${ITEM_SELECTOR}[data-selected]`
|
|
6943
|
+
);
|
|
6944
|
+
}
|
|
6945
|
+
function getValidItems() {
|
|
6946
|
+
return Array.from(
|
|
6947
|
+
listInnerRef.current?.querySelectorAll(VALID_ITEM_SELECTOR) || []
|
|
6948
|
+
);
|
|
6949
|
+
}
|
|
6950
|
+
function updateSelectedToIndex(index) {
|
|
6951
|
+
const items = getValidItems();
|
|
6952
|
+
const item = items[index];
|
|
6953
|
+
if (item)
|
|
6954
|
+
store.setState("value", item.getAttribute(VALUE_ATTR), {
|
|
6955
|
+
id: item.getAttribute("id")
|
|
6956
|
+
});
|
|
6957
|
+
}
|
|
6958
|
+
function updateSelectedByItem(change) {
|
|
6959
|
+
const selected = getSelectedItem();
|
|
6960
|
+
const items = getValidItems();
|
|
6961
|
+
const index = selected ? items.findIndex((item) => item === selected) : -1;
|
|
6962
|
+
let newIndex = index === -1 ? change > 0 ? 0 : items.length - 1 : index + change;
|
|
6963
|
+
if (propsRef.current?.loop) {
|
|
6964
|
+
newIndex = newIndex < 0 ? items.length - 1 : newIndex >= items.length ? 0 : newIndex;
|
|
6965
|
+
} else {
|
|
6966
|
+
newIndex = Math.max(0, Math.min(newIndex, items.length - 1));
|
|
6967
|
+
}
|
|
6968
|
+
let newSelected = items[newIndex];
|
|
6969
|
+
if (newSelected)
|
|
6970
|
+
store.setState("value", newSelected.getAttribute(VALUE_ATTR), {
|
|
6971
|
+
id: newSelected.getAttribute("id")
|
|
6972
|
+
});
|
|
6973
|
+
}
|
|
6974
|
+
function updateSelectedByGroup(change) {
|
|
6975
|
+
const selected = getSelectedItem();
|
|
6976
|
+
let group = selected?.closest(GROUP_SELECTOR);
|
|
6977
|
+
let item;
|
|
6978
|
+
while (group && !item) {
|
|
6979
|
+
group = change > 0 ? findNextSibling(group, GROUP_SELECTOR) : findPreviousSibling(group, GROUP_SELECTOR);
|
|
6980
|
+
item = group?.querySelector(VALID_ITEM_SELECTOR);
|
|
6981
|
+
}
|
|
6982
|
+
if (item) {
|
|
6983
|
+
store.setState("value", item.getAttribute(VALUE_ATTR), {
|
|
6984
|
+
id: item.getAttribute("id")
|
|
6985
|
+
});
|
|
6986
|
+
} else {
|
|
6987
|
+
updateSelectedByItem(change);
|
|
6988
|
+
}
|
|
6989
|
+
}
|
|
6990
|
+
const last = () => updateSelectedToIndex(getValidItems().length - 1);
|
|
6991
|
+
const next = (e) => {
|
|
6992
|
+
e.preventDefault();
|
|
6993
|
+
if (e.metaKey) {
|
|
6994
|
+
last();
|
|
6995
|
+
} else if (e.altKey) {
|
|
6996
|
+
updateSelectedByGroup(1);
|
|
6997
|
+
} else {
|
|
6998
|
+
updateSelectedByItem(1);
|
|
6999
|
+
}
|
|
7000
|
+
};
|
|
7001
|
+
const prev = (e) => {
|
|
7002
|
+
e.preventDefault();
|
|
7003
|
+
if (e.metaKey) {
|
|
7004
|
+
updateSelectedToIndex(0);
|
|
7005
|
+
} else if (e.altKey) {
|
|
7006
|
+
updateSelectedByGroup(-1);
|
|
7007
|
+
} else {
|
|
7008
|
+
updateSelectedByItem(-1);
|
|
7009
|
+
}
|
|
7010
|
+
};
|
|
7011
|
+
const As = asChild ? Slot : "div";
|
|
7012
|
+
return /* @__PURE__ */ jsxs(
|
|
7013
|
+
As,
|
|
7014
|
+
{
|
|
7015
|
+
ref: forwardedRef,
|
|
7016
|
+
tabIndex: -1,
|
|
7017
|
+
...etc,
|
|
7018
|
+
"cmdk-root": "",
|
|
7019
|
+
onKeyDown: (e) => {
|
|
7020
|
+
etc.onKeyDown?.(e);
|
|
7021
|
+
const isComposing = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
7022
|
+
if (e.defaultPrevented || isComposing) {
|
|
7023
|
+
return;
|
|
7024
|
+
}
|
|
7025
|
+
switch (e.key) {
|
|
7026
|
+
case "ArrowDown": {
|
|
7027
|
+
next(e);
|
|
7028
|
+
break;
|
|
7029
|
+
}
|
|
7030
|
+
case "ArrowUp": {
|
|
7031
|
+
prev(e);
|
|
7032
|
+
break;
|
|
7033
|
+
}
|
|
7034
|
+
case "Home": {
|
|
7035
|
+
e.preventDefault();
|
|
7036
|
+
updateSelectedToIndex(0);
|
|
7037
|
+
break;
|
|
7038
|
+
}
|
|
7039
|
+
case "End": {
|
|
7040
|
+
e.preventDefault();
|
|
7041
|
+
last();
|
|
7042
|
+
break;
|
|
7043
|
+
}
|
|
7044
|
+
case "Enter": {
|
|
7045
|
+
e.preventDefault();
|
|
7046
|
+
const item = getSelectedItem();
|
|
7047
|
+
if (item) {
|
|
7048
|
+
const event = new Event(SELECT_EVENT);
|
|
7049
|
+
item.dispatchEvent(event);
|
|
7050
|
+
}
|
|
7051
|
+
}
|
|
7052
|
+
}
|
|
7053
|
+
},
|
|
7054
|
+
children: [
|
|
7055
|
+
/* @__PURE__ */ jsx(
|
|
7056
|
+
"label",
|
|
7057
|
+
{
|
|
7058
|
+
"cmdk-label": "",
|
|
7059
|
+
htmlFor: context.inputId,
|
|
7060
|
+
id: context.labelId,
|
|
7061
|
+
style: srOnlyStyles,
|
|
7062
|
+
children: label
|
|
7063
|
+
}
|
|
7064
|
+
),
|
|
7065
|
+
SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx(StoreContext.Provider, { value: store, children: /* @__PURE__ */ jsx(CommandContext.Provider, { value: context, children: child }) }))
|
|
7066
|
+
]
|
|
7067
|
+
}
|
|
7068
|
+
);
|
|
7069
|
+
}
|
|
7070
|
+
);
|
|
7071
|
+
const Item = React.forwardRef(
|
|
7072
|
+
(props, forwardedRef) => {
|
|
7073
|
+
const id = React.useId();
|
|
7074
|
+
const ref = React.useRef(null);
|
|
7075
|
+
const groupContext = React.useContext(GroupContext);
|
|
7076
|
+
const context = useCommand();
|
|
7077
|
+
const propsRef = useAsRef(props);
|
|
7078
|
+
const forceMount = propsRef.current?.forceMount ?? groupContext?.forceMount;
|
|
7079
|
+
useLayoutEffect(() => {
|
|
7080
|
+
if (!forceMount) {
|
|
7081
|
+
return context.item(id, groupContext?.id);
|
|
7082
|
+
}
|
|
7083
|
+
}, [forceMount]);
|
|
7084
|
+
const value = useValue(
|
|
7085
|
+
id,
|
|
7086
|
+
ref,
|
|
7087
|
+
[props.value, props.children, ref],
|
|
7088
|
+
props.keywords
|
|
7089
|
+
);
|
|
7090
|
+
const store = useStore();
|
|
7091
|
+
const selected = useCmdk(
|
|
7092
|
+
(state) => state.value && state.value === value.current
|
|
7093
|
+
);
|
|
7094
|
+
const render = useCmdk(
|
|
7095
|
+
(state) => forceMount ? true : context.filter() === false ? true : !state.search ? true : state.filtered.items.get(id) > 0
|
|
7096
|
+
);
|
|
7097
|
+
React.useEffect(() => {
|
|
7098
|
+
const element = ref.current;
|
|
7099
|
+
if (!element || props.disabled) return;
|
|
7100
|
+
element.addEventListener(SELECT_EVENT, onSelect);
|
|
7101
|
+
return () => element.removeEventListener(SELECT_EVENT, onSelect);
|
|
7102
|
+
}, [render, props.onSelect, props.disabled]);
|
|
7103
|
+
function onSelect() {
|
|
7104
|
+
select();
|
|
7105
|
+
propsRef.current.onSelect?.(value.current);
|
|
7106
|
+
}
|
|
7107
|
+
function select() {
|
|
7108
|
+
store.setState("value", value.current, {
|
|
7109
|
+
id,
|
|
7110
|
+
disableScrollIntoView: true
|
|
7111
|
+
});
|
|
7112
|
+
}
|
|
7113
|
+
const combinedRef = useCombinedRef(ref, forwardedRef);
|
|
7114
|
+
if (!render) return null;
|
|
7115
|
+
const {
|
|
7116
|
+
asChild,
|
|
7117
|
+
disabled,
|
|
7118
|
+
value: _,
|
|
7119
|
+
onSelect: __,
|
|
7120
|
+
forceMount: ___,
|
|
7121
|
+
keywords: ____,
|
|
7122
|
+
...etc
|
|
7123
|
+
} = props;
|
|
7124
|
+
const As = asChild ? Slot : "div";
|
|
7125
|
+
return /* @__PURE__ */ jsx(
|
|
7126
|
+
As,
|
|
7127
|
+
{
|
|
7128
|
+
ref: combinedRef,
|
|
7129
|
+
id,
|
|
7130
|
+
"cmdk-item": "",
|
|
7131
|
+
role: "option",
|
|
7132
|
+
"aria-disabled": Boolean(disabled) || void 0,
|
|
7133
|
+
"aria-selected": Boolean(selected) || void 0,
|
|
7134
|
+
"data-disabled": boolDataAttr(disabled),
|
|
7135
|
+
"data-selected": boolDataAttr(selected),
|
|
7136
|
+
...etc,
|
|
7137
|
+
onPointerMove: disabled || context.getDisablePointerSelection() ? void 0 : select,
|
|
7138
|
+
onClick: disabled ? void 0 : onSelect,
|
|
7139
|
+
children: props.children
|
|
7140
|
+
}
|
|
7141
|
+
);
|
|
7142
|
+
}
|
|
7143
|
+
);
|
|
7144
|
+
const Group = React.forwardRef(
|
|
7145
|
+
(props, forwardedRef) => {
|
|
7146
|
+
const { asChild, heading, children, forceMount, ...etc } = props;
|
|
7147
|
+
const id = React.useId();
|
|
7148
|
+
const ref = React.useRef(null);
|
|
7149
|
+
const headingRef = React.useRef(null);
|
|
7150
|
+
const headingId = React.useId();
|
|
7151
|
+
const context = useCommand();
|
|
7152
|
+
const render = useCmdk(
|
|
7153
|
+
(state) => forceMount ? true : context.filter() === false ? true : !state.search ? true : state.filtered.groups.has(id)
|
|
7154
|
+
);
|
|
7155
|
+
useLayoutEffect(() => {
|
|
7156
|
+
return context.group(id);
|
|
7157
|
+
}, []);
|
|
7158
|
+
useValue(id, ref, [props.value, props.heading, headingRef]);
|
|
7159
|
+
const contextValue = React.useMemo(
|
|
7160
|
+
() => ({ id, forceMount }),
|
|
7161
|
+
[forceMount]
|
|
7162
|
+
);
|
|
7163
|
+
const combinedRef = useCombinedRef(ref, forwardedRef);
|
|
7164
|
+
const As = asChild ? Slot : "div";
|
|
7165
|
+
return /* @__PURE__ */ jsxs(
|
|
7166
|
+
As,
|
|
7167
|
+
{
|
|
7168
|
+
ref: combinedRef,
|
|
7169
|
+
"cmdk-group": "",
|
|
7170
|
+
role: "presentation",
|
|
7171
|
+
hidden: render ? void 0 : true,
|
|
7172
|
+
...etc,
|
|
7173
|
+
children: [
|
|
7174
|
+
heading && /* @__PURE__ */ jsx(
|
|
7175
|
+
"div",
|
|
7176
|
+
{
|
|
7177
|
+
ref: headingRef,
|
|
7178
|
+
"cmdk-group-heading": "",
|
|
7179
|
+
"aria-hidden": true,
|
|
7180
|
+
id: headingId,
|
|
7181
|
+
children: heading
|
|
7182
|
+
}
|
|
7183
|
+
),
|
|
7184
|
+
SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx(
|
|
7185
|
+
"div",
|
|
7186
|
+
{
|
|
7187
|
+
"cmdk-group-items": "",
|
|
7188
|
+
role: "group",
|
|
7189
|
+
"aria-labelledby": heading ? headingId : void 0,
|
|
7190
|
+
children: /* @__PURE__ */ jsx(GroupContext.Provider, { value: contextValue, children: child })
|
|
7191
|
+
}
|
|
7192
|
+
))
|
|
7193
|
+
]
|
|
7194
|
+
}
|
|
7195
|
+
);
|
|
7196
|
+
}
|
|
7197
|
+
);
|
|
7198
|
+
const Separator$1 = React.forwardRef(
|
|
7199
|
+
(props, forwardedRef) => {
|
|
7200
|
+
const { asChild, alwaysRender, ...etc } = props;
|
|
7201
|
+
const ref = React.useRef(null);
|
|
7202
|
+
const render = useCmdk((state) => !state.search);
|
|
7203
|
+
const combinedRef = useCombinedRef(ref, forwardedRef);
|
|
7204
|
+
if (!alwaysRender && !render) return null;
|
|
7205
|
+
const As = asChild ? Slot : "div";
|
|
7206
|
+
return /* @__PURE__ */ jsx(As, { ref: combinedRef, "cmdk-separator": "", role: "separator", ...etc });
|
|
7207
|
+
}
|
|
7208
|
+
);
|
|
7209
|
+
const Input = React.forwardRef(
|
|
7210
|
+
(props, forwardedRef) => {
|
|
7211
|
+
const { asChild, onValueChange, ...etc } = props;
|
|
7212
|
+
const isControlled = props.value != null;
|
|
7213
|
+
const store = useStore();
|
|
7214
|
+
const search = useCmdk((state) => state.search);
|
|
7215
|
+
const selectedItemId = useCmdk((state) => state.selectedItemId);
|
|
7216
|
+
const context = useCommand();
|
|
7217
|
+
React.useEffect(() => {
|
|
7218
|
+
if (props.value != null) {
|
|
7219
|
+
store.setState("search", props.value);
|
|
7220
|
+
}
|
|
7221
|
+
}, [props.value]);
|
|
7222
|
+
const As = asChild ? Slot : "input";
|
|
7223
|
+
return /* @__PURE__ */ jsx(
|
|
7224
|
+
As,
|
|
7225
|
+
{
|
|
7226
|
+
ref: forwardedRef,
|
|
7227
|
+
"cmdk-input": "",
|
|
7228
|
+
autoComplete: "off",
|
|
7229
|
+
autoCorrect: "off",
|
|
7230
|
+
spellCheck: false,
|
|
7231
|
+
"aria-autocomplete": "list",
|
|
7232
|
+
role: "combobox",
|
|
7233
|
+
"aria-expanded": true,
|
|
7234
|
+
"aria-controls": context.listId,
|
|
7235
|
+
"aria-labelledby": context.labelId,
|
|
7236
|
+
"aria-activedescendant": selectedItemId,
|
|
7237
|
+
id: context.inputId,
|
|
7238
|
+
type: "text",
|
|
7239
|
+
value: isControlled ? props.value : search,
|
|
7240
|
+
...etc,
|
|
7241
|
+
onChange: (e) => {
|
|
7242
|
+
if (!isControlled) {
|
|
7243
|
+
store.setState("search", e.target.value);
|
|
7244
|
+
}
|
|
7245
|
+
onValueChange?.(e.target.value);
|
|
7246
|
+
}
|
|
7247
|
+
}
|
|
7248
|
+
);
|
|
7249
|
+
}
|
|
7250
|
+
);
|
|
7251
|
+
const List = React.forwardRef(
|
|
7252
|
+
(props, forwardedRef) => {
|
|
7253
|
+
const { asChild, children, label = "Suggestions", ...etc } = props;
|
|
7254
|
+
const ref = React.useRef(null);
|
|
7255
|
+
const height = React.useRef(null);
|
|
7256
|
+
const selectedItemId = useCmdk((state) => state.selectedItemId);
|
|
7257
|
+
const context = useCommand();
|
|
7258
|
+
React.useEffect(() => {
|
|
7259
|
+
if (height.current && ref.current) {
|
|
7260
|
+
const el = height.current;
|
|
7261
|
+
const wrapper = ref.current;
|
|
7262
|
+
let animationFrame;
|
|
7263
|
+
const observer = new ResizeObserver(() => {
|
|
7264
|
+
animationFrame = requestAnimationFrame(() => {
|
|
7265
|
+
const height2 = el.offsetHeight;
|
|
7266
|
+
wrapper.style.setProperty(
|
|
7267
|
+
`--cmdk-list-height`,
|
|
7268
|
+
height2.toFixed(1) + "px"
|
|
7269
|
+
);
|
|
7270
|
+
});
|
|
7271
|
+
});
|
|
7272
|
+
observer.observe(el);
|
|
7273
|
+
return () => {
|
|
7274
|
+
cancelAnimationFrame(animationFrame);
|
|
7275
|
+
observer.unobserve(el);
|
|
7276
|
+
};
|
|
7277
|
+
}
|
|
7278
|
+
}, []);
|
|
7279
|
+
const combinedRef = useCombinedRef(ref, forwardedRef);
|
|
7280
|
+
const combinedListSizerRef = useCombinedRef(height, context.listInnerRef);
|
|
7281
|
+
const As = asChild ? Slot : "div";
|
|
7282
|
+
return /* @__PURE__ */ jsx(
|
|
7283
|
+
As,
|
|
7284
|
+
{
|
|
7285
|
+
ref: combinedRef,
|
|
7286
|
+
"cmdk-list": "",
|
|
7287
|
+
role: "listbox",
|
|
7288
|
+
tabIndex: -1,
|
|
7289
|
+
"aria-activedescendant": selectedItemId,
|
|
7290
|
+
"aria-label": label,
|
|
7291
|
+
id: context.listId,
|
|
7292
|
+
...etc,
|
|
7293
|
+
children: SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx("div", { ref: combinedListSizerRef, "cmdk-list-sizer": "", children: child }))
|
|
7294
|
+
}
|
|
7295
|
+
);
|
|
7296
|
+
}
|
|
7297
|
+
);
|
|
7298
|
+
const Empty = React.forwardRef(
|
|
7299
|
+
(props, forwardedRef) => {
|
|
7300
|
+
const render = useCmdk((state) => state.filtered.count === 0);
|
|
7301
|
+
if (!render) return null;
|
|
7302
|
+
const { asChild, ...etc } = props;
|
|
7303
|
+
const As = asChild ? Slot : "div";
|
|
7304
|
+
return /* @__PURE__ */ jsx(As, { ref: forwardedRef, "cmdk-empty": "", role: "presentation", ...etc });
|
|
7305
|
+
}
|
|
7306
|
+
);
|
|
7307
|
+
const Loading = React.forwardRef(
|
|
7308
|
+
(props, forwardedRef) => {
|
|
7309
|
+
const { asChild, progress, children, label = "Loading...", ...etc } = props;
|
|
7310
|
+
const As = asChild ? Slot : "div";
|
|
7311
|
+
return /* @__PURE__ */ jsx(
|
|
7312
|
+
As,
|
|
7313
|
+
{
|
|
7314
|
+
ref: forwardedRef,
|
|
7315
|
+
"cmdk-loading": "",
|
|
7316
|
+
role: "progressbar",
|
|
7317
|
+
"aria-valuenow": progress,
|
|
7318
|
+
"aria-valuemin": 0,
|
|
7319
|
+
"aria-valuemax": 100,
|
|
7320
|
+
"aria-label": label,
|
|
7321
|
+
...etc,
|
|
7322
|
+
children: SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx("div", { "aria-hidden": true, children: child }))
|
|
7323
|
+
}
|
|
7324
|
+
);
|
|
7325
|
+
}
|
|
7326
|
+
);
|
|
7327
|
+
const pkg = Object.assign(Command, {
|
|
7328
|
+
List,
|
|
7329
|
+
Item,
|
|
7330
|
+
Input,
|
|
7331
|
+
Group,
|
|
7332
|
+
Separator: Separator$1,
|
|
7333
|
+
Empty,
|
|
7334
|
+
Loading
|
|
7335
|
+
});
|
|
7336
|
+
function findNextSibling(el, selector) {
|
|
7337
|
+
let sibling = el.nextElementSibling;
|
|
7338
|
+
while (sibling) {
|
|
7339
|
+
if (sibling.matches(selector)) return sibling;
|
|
7340
|
+
sibling = sibling.nextElementSibling;
|
|
7341
|
+
}
|
|
7342
|
+
}
|
|
7343
|
+
function findPreviousSibling(el, selector) {
|
|
7344
|
+
let sibling = el.previousElementSibling;
|
|
7345
|
+
while (sibling) {
|
|
7346
|
+
if (sibling.matches(selector)) return sibling;
|
|
7347
|
+
sibling = sibling.previousElementSibling;
|
|
7348
|
+
}
|
|
7349
|
+
}
|
|
7350
|
+
function useAsRef(data) {
|
|
7351
|
+
const ref = React.useRef(data);
|
|
7352
|
+
useLayoutEffect(() => {
|
|
7353
|
+
ref.current = data;
|
|
7354
|
+
});
|
|
7355
|
+
return ref;
|
|
7356
|
+
}
|
|
7357
|
+
const useLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
|
|
7358
|
+
function useLazyRef(fn) {
|
|
7359
|
+
const ref = React.useRef();
|
|
7360
|
+
if (ref.current === void 0) {
|
|
7361
|
+
ref.current = fn();
|
|
7362
|
+
}
|
|
7363
|
+
return ref;
|
|
7364
|
+
}
|
|
7365
|
+
function useCmdk(selector) {
|
|
7366
|
+
const store = useStore();
|
|
7367
|
+
const cb = () => selector(store.snapshot());
|
|
7368
|
+
return React.useSyncExternalStore(store.subscribe, cb, cb);
|
|
7369
|
+
}
|
|
7370
|
+
function useValue(id, ref, deps, aliases = []) {
|
|
7371
|
+
const valueRef = React.useRef();
|
|
7372
|
+
const context = useCommand();
|
|
7373
|
+
useLayoutEffect(() => {
|
|
7374
|
+
const value = (() => {
|
|
7375
|
+
for (const part of deps) {
|
|
7376
|
+
if (typeof part === "string") {
|
|
7377
|
+
return part.trim();
|
|
7378
|
+
}
|
|
7379
|
+
if (typeof part === "object" && "current" in part) {
|
|
7380
|
+
if (part.current) {
|
|
7381
|
+
return part.current.textContent?.trim();
|
|
7382
|
+
}
|
|
7383
|
+
return valueRef.current;
|
|
7384
|
+
}
|
|
7385
|
+
}
|
|
7386
|
+
})();
|
|
7387
|
+
const keywords = aliases.map((alias) => alias.trim());
|
|
7388
|
+
context.value(id, value, keywords);
|
|
7389
|
+
ref.current?.setAttribute(VALUE_ATTR, value);
|
|
7390
|
+
valueRef.current = value;
|
|
7391
|
+
});
|
|
7392
|
+
return valueRef;
|
|
7393
|
+
}
|
|
7394
|
+
const useScheduleLayoutEffect = () => {
|
|
7395
|
+
const [s, ss] = React.useState();
|
|
7396
|
+
const fns = useLazyRef(() => /* @__PURE__ */ new Map());
|
|
7397
|
+
useLayoutEffect(() => {
|
|
7398
|
+
fns.current.forEach((f) => f());
|
|
7399
|
+
fns.current = /* @__PURE__ */ new Map();
|
|
7400
|
+
}, [s]);
|
|
7401
|
+
return (id, cb) => {
|
|
7402
|
+
fns.current.set(id, cb);
|
|
7403
|
+
ss({});
|
|
7404
|
+
};
|
|
7405
|
+
};
|
|
7406
|
+
function renderChildren(children) {
|
|
7407
|
+
const childrenType = children.type;
|
|
7408
|
+
if (typeof childrenType === "function") return childrenType(children.props);
|
|
7409
|
+
else if ("render" in childrenType) return childrenType.render(children.props);
|
|
7410
|
+
else return children;
|
|
7411
|
+
}
|
|
7412
|
+
function SlottableWithNestedChildren({ asChild, children }, render) {
|
|
7413
|
+
if (asChild && React.isValidElement(children)) {
|
|
7414
|
+
return React.cloneElement(
|
|
7415
|
+
renderChildren(children),
|
|
7416
|
+
{ ref: children.ref },
|
|
7417
|
+
render(children.props.children)
|
|
7418
|
+
);
|
|
7419
|
+
}
|
|
7420
|
+
return render(children);
|
|
7421
|
+
}
|
|
7422
|
+
const srOnlyStyles = {
|
|
7423
|
+
position: "absolute",
|
|
7424
|
+
width: "1px",
|
|
7425
|
+
height: "1px",
|
|
7426
|
+
padding: "0",
|
|
7427
|
+
margin: "-1px",
|
|
7428
|
+
overflow: "hidden",
|
|
7429
|
+
clip: "rect(0, 0, 0, 0)",
|
|
7430
|
+
whiteSpace: "nowrap",
|
|
7431
|
+
borderWidth: "0"
|
|
7432
|
+
};
|
|
6553
7433
|
const CommandMenu = forwardRef(
|
|
6554
7434
|
function CommandMenu2({
|
|
6555
7435
|
variant,
|
|
@@ -6603,7 +7483,7 @@ const CommandMenu = forwardRef(
|
|
|
6603
7483
|
}
|
|
6604
7484
|
);
|
|
6605
7485
|
return /* @__PURE__ */ jsxs(
|
|
6606
|
-
|
|
7486
|
+
pkg,
|
|
6607
7487
|
{
|
|
6608
7488
|
label,
|
|
6609
7489
|
className: cx(prefix("command-menu"), className),
|
|
@@ -6611,13 +7491,13 @@ const CommandMenu = forwardRef(
|
|
|
6611
7491
|
ref: forwardedRef,
|
|
6612
7492
|
children: [
|
|
6613
7493
|
/* @__PURE__ */ jsx(
|
|
6614
|
-
|
|
7494
|
+
pkg.Input,
|
|
6615
7495
|
{
|
|
6616
7496
|
asChild: true,
|
|
6617
7497
|
value: searchValue,
|
|
6618
7498
|
onValueChange: onSearchValueChange,
|
|
6619
7499
|
children: /* @__PURE__ */ jsx(
|
|
6620
|
-
Input,
|
|
7500
|
+
Input$1,
|
|
6621
7501
|
{
|
|
6622
7502
|
variant: "cell",
|
|
6623
7503
|
placeholder: searchPlaceholder,
|
|
@@ -6652,9 +7532,9 @@ const CommandMenu = forwardRef(
|
|
|
6652
7532
|
variant,
|
|
6653
7533
|
iconPlacement,
|
|
6654
7534
|
asChild: true,
|
|
6655
|
-
children: /* @__PURE__ */ jsxs(
|
|
7535
|
+
children: /* @__PURE__ */ jsxs(pkg.List, { label: listLabel, children: [
|
|
6656
7536
|
loading && /* @__PURE__ */ jsx(
|
|
6657
|
-
|
|
7537
|
+
pkg.Loading,
|
|
6658
7538
|
{
|
|
6659
7539
|
label: loadingLabel,
|
|
6660
7540
|
progress: loadingProgress,
|
|
@@ -6675,7 +7555,7 @@ const CommandMenu = forwardRef(
|
|
|
6675
7555
|
}
|
|
6676
7556
|
),
|
|
6677
7557
|
!loading && /* @__PURE__ */ jsx(
|
|
6678
|
-
|
|
7558
|
+
pkg.Empty,
|
|
6679
7559
|
{
|
|
6680
7560
|
...emptyMessageProps,
|
|
6681
7561
|
className: cx(
|
|
@@ -6764,7 +7644,7 @@ const CommandMenuDialog = forwardRef(function CommandMenuDialog2({
|
|
|
6764
7644
|
const CommandMenuGroup = forwardRef(function CommandMenuGroup2({ label, className, ...otherProps }, forwardedRef) {
|
|
6765
7645
|
const prefix = usePrefix();
|
|
6766
7646
|
return /* @__PURE__ */ jsx(
|
|
6767
|
-
|
|
7647
|
+
pkg.Group,
|
|
6768
7648
|
{
|
|
6769
7649
|
...otherProps,
|
|
6770
7650
|
heading: label,
|
|
@@ -6840,7 +7720,7 @@ const CommandMenuItem = forwardRef(function CommandMenuItem2({
|
|
|
6840
7720
|
keybindsProps,
|
|
6841
7721
|
asChild: true,
|
|
6842
7722
|
children: /* @__PURE__ */ jsx(
|
|
6843
|
-
|
|
7723
|
+
pkg.Item,
|
|
6844
7724
|
{
|
|
6845
7725
|
disabled,
|
|
6846
7726
|
...otherProps,
|
|
@@ -6862,6 +7742,7 @@ function useCreateSelectContext({
|
|
|
6862
7742
|
status,
|
|
6863
7743
|
disabled,
|
|
6864
7744
|
readOnly,
|
|
7745
|
+
valueTagCloseButtonLabel,
|
|
6865
7746
|
valueTagProps
|
|
6866
7747
|
}) {
|
|
6867
7748
|
const store = useConstant(
|
|
@@ -6892,6 +7773,7 @@ function useCreateSelectContext({
|
|
|
6892
7773
|
status,
|
|
6893
7774
|
disabled,
|
|
6894
7775
|
readOnly,
|
|
7776
|
+
valueTagCloseButtonLabel,
|
|
6895
7777
|
valueTagProps,
|
|
6896
7778
|
store
|
|
6897
7779
|
}),
|
|
@@ -6903,6 +7785,7 @@ function useCreateSelectContext({
|
|
|
6903
7785
|
status,
|
|
6904
7786
|
store,
|
|
6905
7787
|
value,
|
|
7788
|
+
valueTagCloseButtonLabel,
|
|
6906
7789
|
valueTagProps
|
|
6907
7790
|
]
|
|
6908
7791
|
);
|
|
@@ -6934,7 +7817,7 @@ const Option = memo(
|
|
|
6934
7817
|
onOptionSelect,
|
|
6935
7818
|
store
|
|
6936
7819
|
} = useSelectContext();
|
|
6937
|
-
const { registerOption, unregisterOption } = useStore(
|
|
7820
|
+
const { registerOption, unregisterOption } = useStore$1(
|
|
6938
7821
|
store,
|
|
6939
7822
|
(state) => state.actions
|
|
6940
7823
|
);
|
|
@@ -6963,7 +7846,7 @@ const Option = memo(
|
|
|
6963
7846
|
value: textValue,
|
|
6964
7847
|
onSelect: onOptionSelect,
|
|
6965
7848
|
selected,
|
|
6966
|
-
"aria-
|
|
7849
|
+
"aria-selected": selected || void 0,
|
|
6967
7850
|
disabled,
|
|
6968
7851
|
color,
|
|
6969
7852
|
icon: selected ? faCheck : void 0,
|
|
@@ -7043,7 +7926,8 @@ const Tag = forwardRef(function Tag2({
|
|
|
7043
7926
|
{
|
|
7044
7927
|
...containerProps,
|
|
7045
7928
|
className: cx(prefix("tag__container"), containerProps?.className),
|
|
7046
|
-
|
|
7929
|
+
asChild: true,
|
|
7930
|
+
children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsxs(
|
|
7047
7931
|
As,
|
|
7048
7932
|
{
|
|
7049
7933
|
className: cx(
|
|
@@ -7081,7 +7965,7 @@ const Tag = forwardRef(function Tag2({
|
|
|
7081
7965
|
) })
|
|
7082
7966
|
]
|
|
7083
7967
|
}
|
|
7084
|
-
)
|
|
7968
|
+
) })
|
|
7085
7969
|
}
|
|
7086
7970
|
)
|
|
7087
7971
|
}
|
|
@@ -7096,10 +7980,11 @@ function SelectMultipleValue() {
|
|
|
7096
7980
|
status,
|
|
7097
7981
|
disabled,
|
|
7098
7982
|
readOnly,
|
|
7983
|
+
valueTagCloseButtonLabel,
|
|
7099
7984
|
valueTagProps,
|
|
7100
7985
|
store
|
|
7101
7986
|
} = useSelectContext();
|
|
7102
|
-
useStore(store, (state) => state.actions.getOptionState(value));
|
|
7987
|
+
useStore$1(store, (state) => state.actions.getOptionState(value));
|
|
7103
7988
|
const handleCloseValueTag = useCallback(
|
|
7104
7989
|
(tagValue, evt) => {
|
|
7105
7990
|
evt.preventDefault();
|
|
@@ -7111,7 +7996,7 @@ function SelectMultipleValue() {
|
|
|
7111
7996
|
() => Array.from(new Set(value)),
|
|
7112
7997
|
[value]
|
|
7113
7998
|
);
|
|
7114
|
-
const valuesOptionStates = useStore(
|
|
7999
|
+
const valuesOptionStates = useStore$1(
|
|
7115
8000
|
store,
|
|
7116
8001
|
useShallow(
|
|
7117
8002
|
(state) => valuesToRender.map((v) => state.actions.getOptionState(v))
|
|
@@ -7125,57 +8010,65 @@ function SelectMultipleValue() {
|
|
|
7125
8010
|
[valuesOptionStates]
|
|
7126
8011
|
);
|
|
7127
8012
|
const valuesTags = useMemo(
|
|
7128
|
-
() =>
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
className: cx(
|
|
7157
|
-
prefix("select__value-tag-container"),
|
|
7158
|
-
valueTagProps?.containerProps?.className
|
|
7159
|
-
),
|
|
7160
|
-
...valueTagProps?.containerProps
|
|
7161
|
-
},
|
|
7162
|
-
contentProps: {
|
|
8013
|
+
() => intersperse(
|
|
8014
|
+
valuesToRender.map((v, i) => {
|
|
8015
|
+
const optionState = valuesOptionStates[i];
|
|
8016
|
+
return optionState && /* @__PURE__ */ jsx(
|
|
8017
|
+
Tag,
|
|
8018
|
+
{
|
|
8019
|
+
variant: "subtle",
|
|
8020
|
+
...valueTagProps,
|
|
8021
|
+
showCloseButton: !optionState.disabled,
|
|
8022
|
+
closeButtonProps: {
|
|
8023
|
+
label: null,
|
|
8024
|
+
tooltipContent: valueTagCloseButtonLabel,
|
|
8025
|
+
asChild: true,
|
|
8026
|
+
children: /* @__PURE__ */ jsx("span", {}),
|
|
8027
|
+
type: void 0,
|
|
8028
|
+
disabled,
|
|
8029
|
+
"data-disabled": boolDataAttr(disabled),
|
|
8030
|
+
// Prevent element from gaining focus
|
|
8031
|
+
onMouseDown: (evt) => evt.preventDefault(),
|
|
8032
|
+
onClick: (evt) => handleCloseValueTag(v, evt),
|
|
8033
|
+
// Override collapsible aria properties
|
|
8034
|
+
"aria-controls": void 0,
|
|
8035
|
+
"aria-expanded": void 0,
|
|
8036
|
+
// Override tooltip aria properties
|
|
8037
|
+
"aria-describedby": void 0,
|
|
8038
|
+
...valueTagProps?.closeButtonProps
|
|
8039
|
+
},
|
|
8040
|
+
color: optionState.color ?? controlStatusToAccent(status, "primary"),
|
|
7163
8041
|
className: cx(
|
|
7164
|
-
prefix("select__value-tag
|
|
7165
|
-
valueTagProps?.
|
|
8042
|
+
prefix("select__value-tag"),
|
|
8043
|
+
valueTagProps?.className
|
|
7166
8044
|
),
|
|
7167
|
-
|
|
8045
|
+
containerProps: {
|
|
8046
|
+
className: cx(
|
|
8047
|
+
prefix("select__value-tag-container"),
|
|
8048
|
+
valueTagProps?.containerProps?.className
|
|
8049
|
+
),
|
|
8050
|
+
...valueTagProps?.containerProps
|
|
8051
|
+
},
|
|
8052
|
+
contentProps: {
|
|
8053
|
+
className: cx(
|
|
8054
|
+
prefix("select__value-tag-content"),
|
|
8055
|
+
valueTagProps?.contentProps?.className
|
|
8056
|
+
),
|
|
8057
|
+
...valueTagProps?.contentProps
|
|
8058
|
+
},
|
|
8059
|
+
children: optionState.content
|
|
7168
8060
|
},
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
)
|
|
7173
|
-
|
|
8061
|
+
v
|
|
8062
|
+
);
|
|
8063
|
+
}),
|
|
8064
|
+
(i) => /* @__PURE__ */ jsx(VisuallyHidden, { children: ", " }, `separator-${i}`)
|
|
8065
|
+
),
|
|
7174
8066
|
[
|
|
7175
8067
|
disabled,
|
|
7176
8068
|
handleCloseValueTag,
|
|
7177
8069
|
prefix,
|
|
7178
8070
|
status,
|
|
8071
|
+
valueTagCloseButtonLabel,
|
|
7179
8072
|
valueTagProps,
|
|
7180
8073
|
valuesOptionStates,
|
|
7181
8074
|
valuesToRender
|
|
@@ -7183,15 +8076,12 @@ function SelectMultipleValue() {
|
|
|
7183
8076
|
);
|
|
7184
8077
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7185
8078
|
valuesToRender.length > 0 && readOnly && valuesList,
|
|
7186
|
-
valuesToRender.length > 0 && !readOnly &&
|
|
7187
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { children: valuesList }),
|
|
7188
|
-
valuesTags
|
|
7189
|
-
] })
|
|
8079
|
+
valuesToRender.length > 0 && !readOnly && valuesTags
|
|
7190
8080
|
] });
|
|
7191
8081
|
}
|
|
7192
8082
|
function SelectSingleValue() {
|
|
7193
8083
|
const { value, store } = useSelectContext();
|
|
7194
|
-
return useStore(
|
|
8084
|
+
return useStore$1(
|
|
7195
8085
|
store,
|
|
7196
8086
|
(state) => state.actions.getOptionState(value)?.content
|
|
7197
8087
|
);
|
|
@@ -7220,12 +8110,15 @@ const Select = forwardRef(function Select2({
|
|
|
7220
8110
|
startAdornment,
|
|
7221
8111
|
endAdornment,
|
|
7222
8112
|
showClearButton = "auto",
|
|
8113
|
+
clearDescription,
|
|
8114
|
+
searchLabel,
|
|
7223
8115
|
optionsLabel,
|
|
7224
8116
|
loadingOptions,
|
|
7225
8117
|
loadingOptionsLabel,
|
|
7226
8118
|
loadingOptionsProgress,
|
|
7227
8119
|
showSpinner = loading || loadingOptions,
|
|
7228
8120
|
emptyMessage,
|
|
8121
|
+
valueTagCloseButtonLabel,
|
|
7229
8122
|
valueTagMaxWidth,
|
|
7230
8123
|
onKeyDown,
|
|
7231
8124
|
onBlurToOutside,
|
|
@@ -7241,17 +8134,27 @@ const Select = forwardRef(function Select2({
|
|
|
7241
8134
|
popoverProps,
|
|
7242
8135
|
commandMenuProps,
|
|
7243
8136
|
style,
|
|
8137
|
+
"aria-label": ariaLabel,
|
|
8138
|
+
"aria-labelledby": ariaLabelledBy,
|
|
7244
8139
|
children,
|
|
7245
8140
|
...otherProps
|
|
7246
8141
|
}, forwardedRef) {
|
|
7247
8142
|
const prefix = usePrefix();
|
|
8143
|
+
const { cssVarStyle } = useCssVars();
|
|
7248
8144
|
const [locale7] = useLocale();
|
|
8145
|
+
placeholder ??= locale7.Select.placeholder;
|
|
8146
|
+
searchLabel ??= locale7.Select.searchLabel;
|
|
7249
8147
|
searchPlaceholder ??= locale7.Select.searchPlaceholder;
|
|
7250
8148
|
emptyMessage ??= locale7.Select.emptyMessage;
|
|
8149
|
+
valueTagCloseButtonLabel ??= locale7.Select.valueTagCloseButtonLabel;
|
|
7251
8150
|
optionsLabel ??= locale7.Select.optionsLabel;
|
|
7252
8151
|
loadingOptionsLabel ??= locale7.Select.loadingOptionsLabel;
|
|
7253
|
-
|
|
8152
|
+
clearDescription ??= locale7.Select.clearDescription;
|
|
7254
8153
|
const labelId = useFieldLabelId();
|
|
8154
|
+
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
8155
|
+
const generatedId = useId();
|
|
8156
|
+
const codeId = code ? codeProps?.id ?? prefix(`select-code-${generatedId}`) : void 0;
|
|
8157
|
+
const valueId = valueProps?.id ?? prefix(`select-value-${generatedId}`);
|
|
7255
8158
|
const { printHidden } = usePrintClassNames();
|
|
7256
8159
|
const [open, setOpen] = useControllableState(
|
|
7257
8160
|
defaultOpen ?? false,
|
|
@@ -7272,6 +8175,7 @@ const Select = forwardRef(function Select2({
|
|
|
7272
8175
|
const isEmpty = multiple ? actualValue.length === 0 : actualValue === "";
|
|
7273
8176
|
const buttonRef = useRef(null);
|
|
7274
8177
|
const popoverRef = useRef(null);
|
|
8178
|
+
const searchRef = useRef(null);
|
|
7275
8179
|
const handleContainerPointerDown = useCallback(
|
|
7276
8180
|
(evt) => {
|
|
7277
8181
|
evt.preventDefault();
|
|
@@ -7289,6 +8193,11 @@ const Select = forwardRef(function Select2({
|
|
|
7289
8193
|
const newValue = actualValue.includes(optionValue) ? actualValue.filter((v) => v !== optionValue) : [...actualValue, optionValue];
|
|
7290
8194
|
setValue(newValue);
|
|
7291
8195
|
onValueChange?.(newValue);
|
|
8196
|
+
if (open) {
|
|
8197
|
+
searchRef.current?.focus();
|
|
8198
|
+
} else {
|
|
8199
|
+
buttonRef.current?.focus();
|
|
8200
|
+
}
|
|
7292
8201
|
} else {
|
|
7293
8202
|
if (optionValue !== actualValue) {
|
|
7294
8203
|
setValue(optionValue);
|
|
@@ -7304,6 +8213,7 @@ const Select = forwardRef(function Select2({
|
|
|
7304
8213
|
multiple,
|
|
7305
8214
|
onSearchValueChange,
|
|
7306
8215
|
onValueChange,
|
|
8216
|
+
open,
|
|
7307
8217
|
setOpen,
|
|
7308
8218
|
setSearchValue,
|
|
7309
8219
|
setValue
|
|
@@ -7348,6 +8258,7 @@ const Select = forwardRef(function Select2({
|
|
|
7348
8258
|
status,
|
|
7349
8259
|
disabled: disabled || loading,
|
|
7350
8260
|
readOnly,
|
|
8261
|
+
valueTagCloseButtonLabel,
|
|
7351
8262
|
valueTagProps
|
|
7352
8263
|
});
|
|
7353
8264
|
const registeringOptionsSelectContext = useMemo(
|
|
@@ -7361,6 +8272,10 @@ const Select = forwardRef(function Select2({
|
|
|
7361
8272
|
);
|
|
7362
8273
|
const combinedButtonRef = useCombinedRef(buttonRef, forwardedRef);
|
|
7363
8274
|
const combinedPopoverRef = useCombinedRef(popoverRef, popoverProps?.ref);
|
|
8275
|
+
const combinedSearchRef = useCombinedRef(
|
|
8276
|
+
searchRef,
|
|
8277
|
+
commandMenuProps?.searchProps?.ref
|
|
8278
|
+
);
|
|
7364
8279
|
return /* @__PURE__ */ jsxs(SelectContext.Provider, { value: selectContext, children: [
|
|
7365
8280
|
/* @__PURE__ */ jsx(SelectContext.Provider, { value: registeringOptionsSelectContext, children }),
|
|
7366
8281
|
/* @__PURE__ */ jsxs(
|
|
@@ -7373,8 +8288,6 @@ const Select = forwardRef(function Select2({
|
|
|
7373
8288
|
PopoverTrigger,
|
|
7374
8289
|
{
|
|
7375
8290
|
className: cx(prefix("select"), className),
|
|
7376
|
-
role: "combobox",
|
|
7377
|
-
"aria-autocomplete": "none",
|
|
7378
8291
|
"data-multiple": boolDataAttr(multiple),
|
|
7379
8292
|
"data-limit-value-tags-width": boolDataAttr(valueTagMaxWidth != null),
|
|
7380
8293
|
onKeyDown: combineEventHandlers(onKeyDown, handleKeyDown),
|
|
@@ -7418,9 +8331,10 @@ const Select = forwardRef(function Select2({
|
|
|
7418
8331
|
endAdornment
|
|
7419
8332
|
] }),
|
|
7420
8333
|
showClearButton: showClearButton === "auto" ? !isEmpty : showClearButton,
|
|
8334
|
+
clearDescription,
|
|
7421
8335
|
onBlurToOutside: handleControlBlur,
|
|
7422
8336
|
rootProps,
|
|
7423
|
-
codeProps,
|
|
8337
|
+
codeProps: { ...codeProps, id: codeId },
|
|
7424
8338
|
containerProps: {
|
|
7425
8339
|
// Propagate open state to container for styling purposes
|
|
7426
8340
|
...{ "data-state": showOpen ? "open" : "closed" },
|
|
@@ -7447,6 +8361,13 @@ const Select = forwardRef(function Select2({
|
|
|
7447
8361
|
),
|
|
7448
8362
|
ref: combinedClearButtonRef
|
|
7449
8363
|
},
|
|
8364
|
+
...open ? {} : { "aria-controls": void 0 },
|
|
8365
|
+
"aria-label": ariaLabel,
|
|
8366
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 ? combineAriaIds(
|
|
8367
|
+
codeId,
|
|
8368
|
+
labelId ?? dataTableColumnLabelId,
|
|
8369
|
+
valueId
|
|
8370
|
+
) : void 0),
|
|
7450
8371
|
spinnerProps: {
|
|
7451
8372
|
...spinnerProps,
|
|
7452
8373
|
className: cx(prefix("select__spinner"), spinnerProps?.className)
|
|
@@ -7456,8 +8377,10 @@ const Select = forwardRef(function Select2({
|
|
|
7456
8377
|
"span",
|
|
7457
8378
|
{
|
|
7458
8379
|
...valueProps,
|
|
8380
|
+
id: valueId,
|
|
7459
8381
|
className: cx(prefix("select__value"), valueProps?.className),
|
|
7460
8382
|
children: [
|
|
8383
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: ", " }),
|
|
7461
8384
|
isEmpty && placeholder,
|
|
7462
8385
|
!isEmpty && !multiple && /* @__PURE__ */ jsx(SelectSingleValue, {}),
|
|
7463
8386
|
!isEmpty && multiple && /* @__PURE__ */ jsx(SelectMultipleValue, {})
|
|
@@ -7490,6 +8413,7 @@ const Select = forwardRef(function Select2({
|
|
|
7490
8413
|
...commandMenuProps,
|
|
7491
8414
|
searchPlaceholder,
|
|
7492
8415
|
emptyMessage,
|
|
8416
|
+
label: searchLabel,
|
|
7493
8417
|
listLabel: optionsLabel,
|
|
7494
8418
|
loading: loadingOptions,
|
|
7495
8419
|
loadingLabel: loadingOptionsLabel,
|
|
@@ -7500,7 +8424,10 @@ const Select = forwardRef(function Select2({
|
|
|
7500
8424
|
onSearchValueChange,
|
|
7501
8425
|
setSearchValue
|
|
7502
8426
|
),
|
|
7503
|
-
searchProps: {
|
|
8427
|
+
searchProps: {
|
|
8428
|
+
...commandMenuProps?.searchProps,
|
|
8429
|
+
ref: combinedSearchRef
|
|
8430
|
+
},
|
|
7504
8431
|
listProps: {
|
|
7505
8432
|
"aria-multiselectable": multiple ? true : void 0,
|
|
7506
8433
|
...commandMenuProps?.listProps
|
|
@@ -10057,7 +10984,7 @@ const Feedback = forwardRef(
|
|
|
10057
10984
|
const [locale7] = useLocale();
|
|
10058
10985
|
visuallyHiddenPrefix ??= locale7.Feedback.visuallyHiddenPrefix;
|
|
10059
10986
|
const { onAddFeedback, onRemoveFeedback } = useFeedbackPopoverContext() ?? {};
|
|
10060
|
-
useLayoutEffect(() => {
|
|
10987
|
+
useLayoutEffect$1(() => {
|
|
10061
10988
|
onAddFeedback?.(type);
|
|
10062
10989
|
return () => onRemoveFeedback?.(type);
|
|
10063
10990
|
}, [onAddFeedback, onRemoveFeedback, type]);
|
|
@@ -10675,7 +11602,7 @@ const NumericInput = forwardRef(function NumericInput2({
|
|
|
10675
11602
|
thousandSeparator: groupDigits ? groupSeparator : "",
|
|
10676
11603
|
isAllowed,
|
|
10677
11604
|
allowNegative,
|
|
10678
|
-
customInput: Input,
|
|
11605
|
+
customInput: Input$1,
|
|
10679
11606
|
getInputRef: forwardedRef,
|
|
10680
11607
|
...otherProps
|
|
10681
11608
|
}
|
|
@@ -10748,7 +11675,7 @@ const Output = forwardRef(
|
|
|
10748
11675
|
}, forwardedRef) {
|
|
10749
11676
|
const prefix = usePrefix();
|
|
10750
11677
|
return /* @__PURE__ */ jsx(
|
|
10751
|
-
Input,
|
|
11678
|
+
Input$1,
|
|
10752
11679
|
{
|
|
10753
11680
|
showSpinner,
|
|
10754
11681
|
"aria-busy": pending || void 0,
|
|
@@ -10893,6 +11820,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
10893
11820
|
showSpinner = loading,
|
|
10894
11821
|
code,
|
|
10895
11822
|
showClearButton,
|
|
11823
|
+
clearDescription,
|
|
10896
11824
|
clearButtonLabel,
|
|
10897
11825
|
onBlurToOutside,
|
|
10898
11826
|
codeProps,
|
|
@@ -10918,6 +11846,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
10918
11846
|
const [locale7] = useLocale();
|
|
10919
11847
|
loadingDescription ??= locale7.Input.loadingDescription;
|
|
10920
11848
|
clearButtonLabel ??= locale7.Input.clearButtonLabel;
|
|
11849
|
+
clearDescription ??= locale7.RadioGroup.clearDescription;
|
|
10921
11850
|
const labelId = useFieldLabelId();
|
|
10922
11851
|
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
10923
11852
|
const descriptionIds = useFieldDescriptionIds();
|
|
@@ -10965,6 +11894,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
10965
11894
|
radioGroupRef.current?.focus();
|
|
10966
11895
|
}, [handleValueChange]);
|
|
10967
11896
|
const hasClearButton = !disabled && !loading && !readOnly && (showClearButton === true || showClearButton === "auto" && (value?.length ?? 0) > 0);
|
|
11897
|
+
const clearDescriptionId = hasClearButton && clearDescription && prefix(`control-clear-${generatedId}`);
|
|
10968
11898
|
const handleKeyDown = useCallback(
|
|
10969
11899
|
(evt) => {
|
|
10970
11900
|
if (hasClearButton && (evt.code === "Delete" || evt.code === "Backspace")) {
|
|
@@ -11002,7 +11932,8 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11002
11932
|
loadingDescriptionId,
|
|
11003
11933
|
errorMessageIds,
|
|
11004
11934
|
ariaDescribedBy,
|
|
11005
|
-
descriptionIds
|
|
11935
|
+
descriptionIds,
|
|
11936
|
+
clearDescriptionId
|
|
11006
11937
|
),
|
|
11007
11938
|
onFocus: combineEventHandlers(onFocus, handleControlFocus),
|
|
11008
11939
|
onBlur: combineEventHandlers(onBlur, handleControlBlur),
|
|
@@ -11090,7 +12021,8 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11090
12021
|
]
|
|
11091
12022
|
}
|
|
11092
12023
|
),
|
|
11093
|
-
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription })
|
|
12024
|
+
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription }),
|
|
12025
|
+
clearDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: clearDescriptionId, children: clearDescription })
|
|
11094
12026
|
]
|
|
11095
12027
|
}
|
|
11096
12028
|
)
|
|
@@ -11100,7 +12032,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11100
12032
|
const Separator = forwardRef(function Separator2({ className, ...otherProps }, forwardedRef) {
|
|
11101
12033
|
const prefix = usePrefix();
|
|
11102
12034
|
return /* @__PURE__ */ jsx(
|
|
11103
|
-
Separator$
|
|
12035
|
+
Separator$2.Root,
|
|
11104
12036
|
{
|
|
11105
12037
|
className: cx(prefix("separator"), className),
|
|
11106
12038
|
...otherProps,
|
|
@@ -11324,7 +12256,7 @@ function useTabsContext() {
|
|
|
11324
12256
|
function useRegisterTabLabel(value, label) {
|
|
11325
12257
|
const { showAllTabsWhilePrinting, store } = useTabsContext();
|
|
11326
12258
|
const needsRegisteredTabLabels = usePrinting() && showAllTabsWhilePrinting;
|
|
11327
|
-
const { registerTabLabel } = useStore(store, (state) => state.actions);
|
|
12259
|
+
const { registerTabLabel } = useStore$1(store, (state) => state.actions);
|
|
11328
12260
|
useEffect(() => {
|
|
11329
12261
|
if (needsRegisteredTabLabels) {
|
|
11330
12262
|
return registerTabLabel(value, label);
|
|
@@ -11333,13 +12265,13 @@ function useRegisterTabLabel(value, label) {
|
|
|
11333
12265
|
}
|
|
11334
12266
|
function useTabLabel(value) {
|
|
11335
12267
|
const { store } = useTabsContext();
|
|
11336
|
-
return useStore(store, (state) => state.actions.getTabLabel(value));
|
|
12268
|
+
return useStore$1(store, (state) => state.actions.getTabLabel(value));
|
|
11337
12269
|
}
|
|
11338
12270
|
const Tab = forwardRef(function Tab2({ value, status, tabInnerProps, className, children, ...otherProps }, forwardedRef) {
|
|
11339
12271
|
const prefix = usePrefix();
|
|
11340
12272
|
const { variant, store } = useTabsContext();
|
|
11341
12273
|
const stringValue = value.toString();
|
|
11342
|
-
const isActive = useStore(store, (state) => state.activeTab === stringValue);
|
|
12274
|
+
const isActive = useStore$1(store, (state) => state.activeTab === stringValue);
|
|
11343
12275
|
useRegisterTabLabel(stringValue, children);
|
|
11344
12276
|
const tabRef = useRef(null);
|
|
11345
12277
|
useEffect(() => {
|
|
@@ -11580,8 +12512,8 @@ function TabListScrollButton({
|
|
|
11580
12512
|
}) {
|
|
11581
12513
|
const prefix = usePrefix();
|
|
11582
12514
|
const { store } = useTabsContext();
|
|
11583
|
-
const showScrollButtons = useStore(store, (state) => state.showScrollButtons);
|
|
11584
|
-
const shouldDisable = useStore(
|
|
12515
|
+
const showScrollButtons = useStore$1(store, (state) => state.showScrollButtons);
|
|
12516
|
+
const shouldDisable = useStore$1(
|
|
11585
12517
|
store,
|
|
11586
12518
|
({ scrollPosition }) => scrollPosition && (side === "left" ? scrollPosition.left === 0 : scrollPosition.right <= 1)
|
|
11587
12519
|
);
|
|
@@ -11640,7 +12572,7 @@ const TextArea = forwardRef(
|
|
|
11640
12572
|
function TextArea2({ rows, ...props }, forwardedRef) {
|
|
11641
12573
|
const isInTableCell = useIsInTableCell();
|
|
11642
12574
|
rows ??= isInTableCell ? 1 : DEFAULT_ROWS;
|
|
11643
|
-
return /* @__PURE__ */ jsx(Input, { asChild: true, ...props, children: /* @__PURE__ */ jsx("textarea", { rows, ref: forwardedRef }) });
|
|
12575
|
+
return /* @__PURE__ */ jsx(Input$1, { asChild: true, ...props, children: /* @__PURE__ */ jsx("textarea", { rows, ref: forwardedRef }) });
|
|
11644
12576
|
}
|
|
11645
12577
|
);
|
|
11646
12578
|
function useMediaQuery(query, options) {
|
|
@@ -11779,7 +12711,7 @@ function createLocationStore() {
|
|
|
11779
12711
|
function useLocation(selector) {
|
|
11780
12712
|
locationStore ??= createLocationStore();
|
|
11781
12713
|
useEffect(() => locationStore.getState().actions.subscribe(), []);
|
|
11782
|
-
return useStore(
|
|
12714
|
+
return useStore$1(
|
|
11783
12715
|
locationStore,
|
|
11784
12716
|
({ location: location2 }) => selector ? selector(location2) : location2
|
|
11785
12717
|
);
|
|
@@ -11938,7 +12870,7 @@ export {
|
|
|
11938
12870
|
HelperText,
|
|
11939
12871
|
Icon,
|
|
11940
12872
|
IconButton,
|
|
11941
|
-
Input,
|
|
12873
|
+
Input$1 as Input,
|
|
11942
12874
|
InputWithContainerRef,
|
|
11943
12875
|
Keybinds,
|
|
11944
12876
|
Keyboard,
|
|
@@ -12065,7 +12997,7 @@ export {
|
|
|
12065
12997
|
useIsInTableCell,
|
|
12066
12998
|
useKeyboardShortcut,
|
|
12067
12999
|
useLatestValues,
|
|
12068
|
-
useLayoutEffect,
|
|
13000
|
+
useLayoutEffect$1 as useLayoutEffect,
|
|
12069
13001
|
useLocale,
|
|
12070
13002
|
useLocation,
|
|
12071
13003
|
useMeasure,
|