@ostack.tech/ui 0.9.1 → 0.10.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/chunks/{en-Dem8nwZz.js → en-DwZKZVGL.js} +16 -3
- package/dist/chunks/en-DwZKZVGL.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 +15 -2
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +15 -2
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +59 -49
- package/dist/ostack-ui.js +1953 -939
- 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/AlertDialog/AlertDialog.d.ts +2 -1
- package/dist/types/components/Button/Button.d.ts +2 -1
- package/dist/types/components/Calendar/CalendarMonthGrid.d.ts +1 -0
- package/dist/types/components/CommandMenu/CommandMenu.d.ts +4 -3
- 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/DataTable/DataTable.d.ts +4 -0
- package/dist/types/components/DataTable/DataTableContext.d.ts +7 -1
- package/dist/types/components/DataTable/DataTablePagination.d.ts +2 -0
- package/dist/types/components/DataTable/PagedDataTablePagination.d.ts +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +2 -1
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +2 -1
- package/dist/types/components/Field/Field.d.ts +35 -6
- package/dist/types/components/Field/FieldProvider.d.ts +13 -0
- package/dist/types/components/Field/index.d.ts +1 -0
- package/dist/types/components/Heading/Heading.d.ts +3 -1
- package/dist/types/components/Icon/Icon.d.ts +5 -6
- package/dist/types/components/IconButton/IconButton.d.ts +7 -0
- package/dist/types/components/Input/Input.d.ts +11 -2
- package/dist/types/components/Keyboard/Keyboard.d.ts +17 -2
- package/dist/types/components/NumericInput/NumericInput.d.ts +27 -14
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +5 -0
- package/dist/types/components/Select/Select.d.ts +8 -4
- package/dist/types/components/Select/SelectContext.d.ts +3 -1
- package/dist/types/components/Tabs/Tabs.d.ts +3 -0
- package/dist/types/components/TextArea/TextArea.d.ts +14 -11
- package/dist/types/components/Tooltip/Tooltip.d.ts +25 -14
- package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +7 -4
- package/dist/types/utils/numericStringUtils.d.ts +2 -2
- package/package.json +2 -5
- package/scss/components/Code/_Code-variables.scss +1 -1
- package/scss/components/CommandMenu/_CommandMenu.scss +1 -7
- package/scss/components/DataTable/_DataTable-variables.scss +6 -0
- package/scss/components/DataTable/_DataTable.scss +7 -0
- package/scss/components/Dialog/_Dialog.scss +2 -1
- package/scss/components/DropdownMenu/_DropdownMenu.scss +3 -3
- package/scss/components/Keyboard/_Keyboard-variables.scss +2 -2
- package/scss/components/Keyboard/_Keyboard.scss +1 -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/components/Toast/_Toast.scss +4 -0
- package/scss/index.scss +1 -0
- package/scss/scss/helpers/_keyframes.scss +114 -0
- 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/scss/scss/utils/_animation.scss +0 -104
- package/scss/scss/utils/_spinner.scss +2 -7
- package/dist/chunks/en-Dem8nwZz.js.map +0 -1
- package/dist/ostack-ui.css.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,
|
|
@@ -433,7 +433,9 @@ function useCreateDataTableContext({
|
|
|
433
433
|
defaultSelectedRows,
|
|
434
434
|
selectedRows,
|
|
435
435
|
onSelectedRowsChange,
|
|
436
|
-
disabledSelections
|
|
436
|
+
disabledSelections,
|
|
437
|
+
selectAllRowsLabel,
|
|
438
|
+
selectRowLabel
|
|
437
439
|
}) {
|
|
438
440
|
const { startPrintingTask, finishPrintingTask } = usePrinterContentContext();
|
|
439
441
|
const latest = useLatestValues({
|
|
@@ -470,7 +472,7 @@ function useCreateDataTableContext({
|
|
|
470
472
|
() => [get().pageOffset(), get().limit, get().totalCount()],
|
|
471
473
|
(pageOffset, limit2, totalCount) => totalCount == null ? void 0 : Math.min(totalCount - pageOffset, limit2)
|
|
472
474
|
),
|
|
473
|
-
filter: filter ??
|
|
475
|
+
filter: filter ?? defaultFilter2,
|
|
474
476
|
sortBy: initialSortBy,
|
|
475
477
|
sortDirection: sortDirection ?? defaultSortDirection ?? (initialSortBy !== null && columns[initialSortBy].defaultSortDirection || "asc"),
|
|
476
478
|
selectedRows: [
|
|
@@ -775,6 +777,8 @@ function useCreateDataTableContext({
|
|
|
775
777
|
dynamicRowHeight,
|
|
776
778
|
estimatedRowHeight,
|
|
777
779
|
overscan,
|
|
780
|
+
selectAllRowsLabel,
|
|
781
|
+
selectRowLabel,
|
|
778
782
|
generatedId,
|
|
779
783
|
showAllRowsWhilePrinting,
|
|
780
784
|
apiRef,
|
|
@@ -790,6 +794,8 @@ function useCreateDataTableContext({
|
|
|
790
794
|
dynamicRowHeight,
|
|
791
795
|
estimatedRowHeight,
|
|
792
796
|
overscan,
|
|
797
|
+
selectAllRowsLabel,
|
|
798
|
+
selectRowLabel,
|
|
793
799
|
generatedId,
|
|
794
800
|
showAllRowsWhilePrinting,
|
|
795
801
|
apiRef,
|
|
@@ -851,7 +857,7 @@ function useFieldContext() {
|
|
|
851
857
|
return useContext(FieldContext);
|
|
852
858
|
}
|
|
853
859
|
function useFieldStore(selector) {
|
|
854
|
-
return useStore(useFieldContext() ?? EMPTY_STORE, selector);
|
|
860
|
+
return useStore$1(useFieldContext() ?? EMPTY_STORE, selector);
|
|
855
861
|
}
|
|
856
862
|
function useFieldControlId() {
|
|
857
863
|
return useFieldStore((state) => state.controlId);
|
|
@@ -1021,7 +1027,7 @@ function useTableContext() {
|
|
|
1021
1027
|
}
|
|
1022
1028
|
function useTableNumberOfColumns() {
|
|
1023
1029
|
const { store } = useTableContext();
|
|
1024
|
-
return useStore(store, (state) => state.numberOfColumns);
|
|
1030
|
+
return useStore$1(store, (state) => state.numberOfColumns);
|
|
1025
1031
|
}
|
|
1026
1032
|
const TableHeadContext = createContext(false);
|
|
1027
1033
|
function useIsInTableHead() {
|
|
@@ -1085,6 +1091,7 @@ const Portal = forwardRef(function Portal2({ asChild, children, ...otherProps },
|
|
|
1085
1091
|
);
|
|
1086
1092
|
});
|
|
1087
1093
|
const DialogContent = forwardRef(function DialogContent2({
|
|
1094
|
+
asChild,
|
|
1088
1095
|
variant = "solid",
|
|
1089
1096
|
mergeSections,
|
|
1090
1097
|
color = "neutral",
|
|
@@ -1094,6 +1101,7 @@ const DialogContent = forwardRef(function DialogContent2({
|
|
|
1094
1101
|
portalProps,
|
|
1095
1102
|
overlayProps,
|
|
1096
1103
|
className,
|
|
1104
|
+
children,
|
|
1097
1105
|
...otherProps
|
|
1098
1106
|
}, forwardedRef) {
|
|
1099
1107
|
const prefix = usePrefix();
|
|
@@ -1115,27 +1123,29 @@ const DialogContent = forwardRef(function DialogContent2({
|
|
|
1115
1123
|
...overlayProps,
|
|
1116
1124
|
className: cx(prefix("dialog__overlay"), overlayProps?.className),
|
|
1117
1125
|
children: /* @__PURE__ */ jsx(
|
|
1118
|
-
|
|
1126
|
+
Dialog$1.Content,
|
|
1119
1127
|
{
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1128
|
+
asChild: !asChild,
|
|
1129
|
+
onPointerDownOutside: combineEventHandlers(
|
|
1130
|
+
onPointerDownOutside,
|
|
1131
|
+
handlePointerDownOutside,
|
|
1132
|
+
{ checkDefaultPrevented: true }
|
|
1133
|
+
),
|
|
1134
|
+
className: cx(
|
|
1135
|
+
prefix("dialog"),
|
|
1136
|
+
prefix(`dialog--${size}`),
|
|
1137
|
+
className
|
|
1138
|
+
),
|
|
1139
|
+
ref: forwardedRef,
|
|
1140
|
+
...otherProps,
|
|
1124
1141
|
children: /* @__PURE__ */ jsx(
|
|
1125
|
-
|
|
1142
|
+
Card,
|
|
1126
1143
|
{
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
className: cx(
|
|
1133
|
-
prefix("dialog"),
|
|
1134
|
-
prefix(`dialog--${size}`),
|
|
1135
|
-
className
|
|
1136
|
-
),
|
|
1137
|
-
ref: forwardedRef,
|
|
1138
|
-
...otherProps
|
|
1144
|
+
asChild,
|
|
1145
|
+
variant,
|
|
1146
|
+
color,
|
|
1147
|
+
mergeSections,
|
|
1148
|
+
children
|
|
1139
1149
|
}
|
|
1140
1150
|
)
|
|
1141
1151
|
}
|
|
@@ -1801,10 +1811,12 @@ const IconButton = forwardRef(function IconButton2({
|
|
|
1801
1811
|
) : button;
|
|
1802
1812
|
});
|
|
1803
1813
|
const CloseButton = forwardRef(
|
|
1804
|
-
function CloseIconButton({ icon, label,
|
|
1814
|
+
function CloseIconButton({ icon, label, className, ...otherProps }, forwardedRef) {
|
|
1805
1815
|
const prefix = usePrefix();
|
|
1806
1816
|
const [locale7] = useLocale();
|
|
1807
|
-
label
|
|
1817
|
+
if (label === void 0) {
|
|
1818
|
+
label = locale7.CloseButton.label;
|
|
1819
|
+
}
|
|
1808
1820
|
return /* @__PURE__ */ jsx(
|
|
1809
1821
|
IconButton,
|
|
1810
1822
|
{
|
|
@@ -1813,7 +1825,6 @@ const CloseButton = forwardRef(
|
|
|
1813
1825
|
circle: true,
|
|
1814
1826
|
icon: icon ?? faClose,
|
|
1815
1827
|
label,
|
|
1816
|
-
tooltipContent,
|
|
1817
1828
|
...otherProps,
|
|
1818
1829
|
ref: forwardedRef
|
|
1819
1830
|
}
|
|
@@ -1894,6 +1905,7 @@ const AlertDialogCancel = forwardRef(function AlertDialogCancel2(props, forwarde
|
|
|
1894
1905
|
return /* @__PURE__ */ jsx(AlertDialog$1.Cancel, { ...props, asChild: true, ref: forwardedRef });
|
|
1895
1906
|
});
|
|
1896
1907
|
const AlertDialogContent = forwardRef(function AlertDialogContent2({
|
|
1908
|
+
asChild,
|
|
1897
1909
|
variant = "solid",
|
|
1898
1910
|
mergeSections,
|
|
1899
1911
|
color = "neutral",
|
|
@@ -1919,22 +1931,23 @@ const AlertDialogContent = forwardRef(function AlertDialogContent2({
|
|
|
1919
1931
|
...overlayProps,
|
|
1920
1932
|
className: cx(prefix("dialog__overlay"), overlayProps?.className),
|
|
1921
1933
|
children: /* @__PURE__ */ jsx(
|
|
1922
|
-
|
|
1934
|
+
AlertDialog$1.Content,
|
|
1923
1935
|
{
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1936
|
+
asChild: !asChild,
|
|
1937
|
+
className: cx(
|
|
1938
|
+
prefix("dialog"),
|
|
1939
|
+
prefix(`dialog--${size}`),
|
|
1940
|
+
className
|
|
1941
|
+
),
|
|
1942
|
+
ref: forwardedRef,
|
|
1943
|
+
...otherProps,
|
|
1928
1944
|
children: /* @__PURE__ */ jsx(
|
|
1929
|
-
|
|
1945
|
+
Card,
|
|
1930
1946
|
{
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
),
|
|
1936
|
-
ref: forwardedRef,
|
|
1937
|
-
...otherProps,
|
|
1947
|
+
asChild,
|
|
1948
|
+
variant,
|
|
1949
|
+
color,
|
|
1950
|
+
mergeSections,
|
|
1938
1951
|
children
|
|
1939
1952
|
}
|
|
1940
1953
|
)
|
|
@@ -2301,7 +2314,7 @@ function useCreateDocumentTitleStore(breadcrumbs) {
|
|
|
2301
2314
|
return store;
|
|
2302
2315
|
}
|
|
2303
2316
|
function useDocumentTitleStore(selector) {
|
|
2304
|
-
return useStore(useContext(DocumentTitleContext) ?? EMPTY_STORE, selector);
|
|
2317
|
+
return useStore$1(useContext(DocumentTitleContext) ?? EMPTY_STORE, selector);
|
|
2305
2318
|
}
|
|
2306
2319
|
function DocumentTitle({ title, children }) {
|
|
2307
2320
|
const context = useContext(DocumentTitleProviderContext);
|
|
@@ -2480,7 +2493,7 @@ const Toast = forwardRef(function Toast2({
|
|
|
2480
2493
|
icon = SEVERITY_ICON$1[severity],
|
|
2481
2494
|
action,
|
|
2482
2495
|
actionAltText,
|
|
2483
|
-
showCloseButton = action ===
|
|
2496
|
+
showCloseButton = action == null || typeof action === "boolean",
|
|
2484
2497
|
visuallyHidden,
|
|
2485
2498
|
rootProps,
|
|
2486
2499
|
containerProps,
|
|
@@ -2717,11 +2730,11 @@ const CollapsibleContext = createContext(
|
|
|
2717
2730
|
null
|
|
2718
2731
|
);
|
|
2719
2732
|
function useCollapsibleContext() {
|
|
2720
|
-
const
|
|
2721
|
-
if (!
|
|
2733
|
+
const collapsibleContent = useContext(CollapsibleContext);
|
|
2734
|
+
if (!collapsibleContent) {
|
|
2722
2735
|
throw new Error("Collapsible context not in scope.");
|
|
2723
2736
|
}
|
|
2724
|
-
return
|
|
2737
|
+
return collapsibleContent;
|
|
2725
2738
|
}
|
|
2726
2739
|
const Collapsible = forwardRef(function Collapsible2({
|
|
2727
2740
|
defaultOpen,
|
|
@@ -2774,6 +2787,14 @@ const CollapsibleTrigger = forwardRef(function CollapsibleTrigger2({ children, .
|
|
|
2774
2787
|
);
|
|
2775
2788
|
return /* @__PURE__ */ jsx(Collapsible$1.Trigger, { ...props, asChild: true, ref: forwardedRef, children: typeof children === "function" ? children(open) : children });
|
|
2776
2789
|
});
|
|
2790
|
+
const AlertContext = createContext(null);
|
|
2791
|
+
function useAlertContext() {
|
|
2792
|
+
const alertContext = useContext(AlertContext);
|
|
2793
|
+
if (!alertContext) {
|
|
2794
|
+
throw new Error("Alert context not in scope.");
|
|
2795
|
+
}
|
|
2796
|
+
return alertContext;
|
|
2797
|
+
}
|
|
2777
2798
|
const SEVERITY_ICON = {
|
|
2778
2799
|
neutral: null,
|
|
2779
2800
|
info: faCircleInfo,
|
|
@@ -2784,6 +2805,7 @@ const SEVERITY_ICON = {
|
|
|
2784
2805
|
const Alert = forwardRef(function Alert2({
|
|
2785
2806
|
variant = "subtle",
|
|
2786
2807
|
severity = "info",
|
|
2808
|
+
announce = "off",
|
|
2787
2809
|
defaultOpen = true,
|
|
2788
2810
|
open,
|
|
2789
2811
|
onOpenChange,
|
|
@@ -2798,11 +2820,16 @@ const Alert = forwardRef(function Alert2({
|
|
|
2798
2820
|
closeButtonProps,
|
|
2799
2821
|
children,
|
|
2800
2822
|
className,
|
|
2823
|
+
role,
|
|
2824
|
+
"aria-label": ariaLabel,
|
|
2825
|
+
"aria-labelledby": ariaLabelledBy,
|
|
2801
2826
|
...otherProps
|
|
2802
2827
|
}, forwardedRef) {
|
|
2803
2828
|
const prefix = usePrefix();
|
|
2829
|
+
const [titleId, setTitleId] = useState();
|
|
2804
2830
|
const accent = severity === "info" ? "primary" : severity;
|
|
2805
|
-
|
|
2831
|
+
const actualRole = role ?? (announce === "assertive" ? "alert" : announce === "polite" ? "status" : void 0);
|
|
2832
|
+
return /* @__PURE__ */ jsx(AlertContext, { value: { setTitleId }, children: /* @__PURE__ */ jsx(
|
|
2806
2833
|
Collapsible,
|
|
2807
2834
|
{
|
|
2808
2835
|
defaultOpen,
|
|
@@ -2827,7 +2854,9 @@ const Alert = forwardRef(function Alert2({
|
|
|
2827
2854
|
className
|
|
2828
2855
|
),
|
|
2829
2856
|
"data-accent": accent,
|
|
2830
|
-
role:
|
|
2857
|
+
role: actualRole,
|
|
2858
|
+
"aria-label": ariaLabel,
|
|
2859
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 && (actualRole === "alert" || actualRole === "status") ? titleId : void 0),
|
|
2831
2860
|
...otherProps,
|
|
2832
2861
|
ref: forwardedRef,
|
|
2833
2862
|
children: [
|
|
@@ -2844,7 +2873,10 @@ const Alert = forwardRef(function Alert2({
|
|
|
2844
2873
|
"div",
|
|
2845
2874
|
{
|
|
2846
2875
|
...contentProps,
|
|
2847
|
-
className: cx(
|
|
2876
|
+
className: cx(
|
|
2877
|
+
prefix("alert__content"),
|
|
2878
|
+
contentProps?.className
|
|
2879
|
+
),
|
|
2848
2880
|
children
|
|
2849
2881
|
}
|
|
2850
2882
|
),
|
|
@@ -2880,22 +2912,33 @@ const Alert = forwardRef(function Alert2({
|
|
|
2880
2912
|
}
|
|
2881
2913
|
)
|
|
2882
2914
|
}
|
|
2883
|
-
);
|
|
2915
|
+
) });
|
|
2884
2916
|
});
|
|
2885
2917
|
const AlertTitle = forwardRef(function AlertTitle2({
|
|
2886
2918
|
as = "div",
|
|
2887
2919
|
asChild,
|
|
2920
|
+
id,
|
|
2888
2921
|
className,
|
|
2889
2922
|
...otherProps
|
|
2890
2923
|
}, forwardedRef) {
|
|
2891
2924
|
const prefix = usePrefix();
|
|
2925
|
+
const generatedId = useId();
|
|
2926
|
+
const actualId = id ?? prefix(`alert-title-${generatedId}`);
|
|
2927
|
+
const { setTitleId } = useAlertContext();
|
|
2928
|
+
const ref = useCallback(
|
|
2929
|
+
(el) => {
|
|
2930
|
+
setTitleId(el ? actualId : void 0);
|
|
2931
|
+
},
|
|
2932
|
+
[actualId, setTitleId]
|
|
2933
|
+
);
|
|
2892
2934
|
const As = asChild ? Slot : as;
|
|
2893
2935
|
return /* @__PURE__ */ jsx(
|
|
2894
2936
|
As,
|
|
2895
2937
|
{
|
|
2938
|
+
id: actualId,
|
|
2896
2939
|
className: cx(prefix("alert__title"), className),
|
|
2897
2940
|
...otherProps,
|
|
2898
|
-
ref: forwardedRef
|
|
2941
|
+
ref: combineEventHandlers(ref, forwardedRef)
|
|
2899
2942
|
}
|
|
2900
2943
|
);
|
|
2901
2944
|
});
|
|
@@ -3660,6 +3703,10 @@ const Field = forwardRef(function Field2({ asChild, className, ...otherProps },
|
|
|
3660
3703
|
}
|
|
3661
3704
|
) });
|
|
3662
3705
|
});
|
|
3706
|
+
function FieldProvider({ children }) {
|
|
3707
|
+
const store = useCreateFieldContext();
|
|
3708
|
+
return /* @__PURE__ */ jsx(FieldContext.Provider, { value: store, children });
|
|
3709
|
+
}
|
|
3663
3710
|
const DEFAULT_TABLE_COLUMN_WIDTH = 150;
|
|
3664
3711
|
const Table = forwardRef(
|
|
3665
3712
|
function Table2({
|
|
@@ -3679,6 +3726,8 @@ const Table = forwardRef(
|
|
|
3679
3726
|
visuallyHiddenCaptionProps,
|
|
3680
3727
|
className,
|
|
3681
3728
|
children,
|
|
3729
|
+
"aria-label": ariaLabel,
|
|
3730
|
+
"aria-labelledby": ariaLabelledBy,
|
|
3682
3731
|
"aria-describedby": ariaDescribedBy,
|
|
3683
3732
|
...otherProps
|
|
3684
3733
|
}, forwardedRef) {
|
|
@@ -3687,13 +3736,14 @@ const Table = forwardRef(
|
|
|
3687
3736
|
visuallyHiddenCaption ??= label;
|
|
3688
3737
|
const descriptionIds = useFieldDescriptionIds();
|
|
3689
3738
|
const errorMessageIds = useFieldErrorMessageIds();
|
|
3690
|
-
const { controlId, codeId } = useSetFieldControl(
|
|
3739
|
+
const { generatedId, controlId, codeId } = useSetFieldControl(
|
|
3691
3740
|
containerProps?.id,
|
|
3692
3741
|
"DIV",
|
|
3693
3742
|
void 0,
|
|
3694
3743
|
false,
|
|
3695
3744
|
required
|
|
3696
3745
|
);
|
|
3746
|
+
const visuallyHiddenCaptionId = visuallyHiddenCaption ? visuallyHiddenCaptionProps?.id ?? prefix(`table-caption-${generatedId}`) : void 0;
|
|
3697
3747
|
const tableRef = useRef(null);
|
|
3698
3748
|
const [scrollableEl, setScrollableEl] = useState(
|
|
3699
3749
|
null
|
|
@@ -3732,6 +3782,7 @@ const Table = forwardRef(
|
|
|
3732
3782
|
const captionEl = caption && /* @__PURE__ */ jsx(
|
|
3733
3783
|
"div",
|
|
3734
3784
|
{
|
|
3785
|
+
"aria-hidden": true,
|
|
3735
3786
|
...captionProps,
|
|
3736
3787
|
className: cx(
|
|
3737
3788
|
prefix("table__caption"),
|
|
@@ -3787,8 +3838,9 @@ const Table = forwardRef(
|
|
|
3787
3838
|
className
|
|
3788
3839
|
),
|
|
3789
3840
|
"data-status": status,
|
|
3841
|
+
"aria-label": ariaLabel,
|
|
3842
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 && codeId ? combineAriaIds(codeId, visuallyHiddenCaptionId) : void 0),
|
|
3790
3843
|
"aria-describedby": combineAriaIds(
|
|
3791
|
-
codeId,
|
|
3792
3844
|
errorMessageIds,
|
|
3793
3845
|
ariaDescribedBy,
|
|
3794
3846
|
descriptionIds
|
|
@@ -3796,7 +3848,14 @@ const Table = forwardRef(
|
|
|
3796
3848
|
...otherProps,
|
|
3797
3849
|
ref: combinedTableRef,
|
|
3798
3850
|
children: [
|
|
3799
|
-
|
|
3851
|
+
visuallyHiddenCaptionId && /* @__PURE__ */ jsx(VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3852
|
+
"caption",
|
|
3853
|
+
{
|
|
3854
|
+
...visuallyHiddenCaptionProps,
|
|
3855
|
+
id: visuallyHiddenCaptionId,
|
|
3856
|
+
children: visuallyHiddenCaption
|
|
3857
|
+
}
|
|
3858
|
+
) }),
|
|
3800
3859
|
/* @__PURE__ */ jsx(ColumnWidths, {}),
|
|
3801
3860
|
children
|
|
3802
3861
|
]
|
|
@@ -3812,7 +3871,7 @@ const Table = forwardRef(
|
|
|
3812
3871
|
);
|
|
3813
3872
|
function ColumnWidths() {
|
|
3814
3873
|
const { store } = useTableContext();
|
|
3815
|
-
const columnWidths2 = useStore(store, (state) => state.columnWidths);
|
|
3874
|
+
const columnWidths2 = useStore$1(store, (state) => state.columnWidths);
|
|
3816
3875
|
return columnWidths2 && /* @__PURE__ */ jsx("colgroup", { children: columnWidths2.map((width, i) => /* @__PURE__ */ jsx("col", { style: width != null ? { width } : void 0 }, i)) });
|
|
3817
3876
|
}
|
|
3818
3877
|
const TableBody = forwardRef(
|
|
@@ -4179,14 +4238,16 @@ const TableHead = forwardRef(
|
|
|
4179
4238
|
}
|
|
4180
4239
|
)
|
|
4181
4240
|
] });
|
|
4241
|
+
const rowSpan = numberOfRows$1([column]) > 1 ? 1 : nRows - i;
|
|
4242
|
+
const colSpan = numberOfColumns([column]);
|
|
4182
4243
|
return /* @__PURE__ */ jsx(
|
|
4183
4244
|
TableCell,
|
|
4184
4245
|
{
|
|
4185
4246
|
header,
|
|
4186
4247
|
scope: header ? column.children.length > 0 ? "colgroup" : "col" : void 0,
|
|
4187
4248
|
align,
|
|
4188
|
-
rowSpan:
|
|
4189
|
-
colSpan:
|
|
4249
|
+
rowSpan: rowSpan === 1 ? void 0 : rowSpan,
|
|
4250
|
+
colSpan: colSpan === 1 ? void 0 : colSpan,
|
|
4190
4251
|
style: {
|
|
4191
4252
|
width: layout === "fixed" && width != null ? Array.isArray(width) ? width.reduce((sum, width2) => sum + width2, 0) : width : void 0,
|
|
4192
4253
|
...style
|
|
@@ -4412,7 +4473,7 @@ const DataTable = forwardRef(
|
|
|
4412
4473
|
defaultLimit = 10,
|
|
4413
4474
|
limit,
|
|
4414
4475
|
onLimitChange,
|
|
4415
|
-
defaultFilter = "",
|
|
4476
|
+
defaultFilter: defaultFilter2 = "",
|
|
4416
4477
|
filter,
|
|
4417
4478
|
onFilterChange,
|
|
4418
4479
|
defaultSortBy = null,
|
|
@@ -4425,6 +4486,8 @@ const DataTable = forwardRef(
|
|
|
4425
4486
|
selectedRows,
|
|
4426
4487
|
onSelectedRowsChange,
|
|
4427
4488
|
disabledSelections,
|
|
4489
|
+
selectAllRowsLabel,
|
|
4490
|
+
selectRowLabel,
|
|
4428
4491
|
renderRow,
|
|
4429
4492
|
renderCell,
|
|
4430
4493
|
dynamicRowHeight = false,
|
|
@@ -4463,7 +4526,7 @@ const DataTable = forwardRef(
|
|
|
4463
4526
|
defaultLimit,
|
|
4464
4527
|
limit,
|
|
4465
4528
|
onLimitChange,
|
|
4466
|
-
defaultFilter,
|
|
4529
|
+
defaultFilter: defaultFilter2,
|
|
4467
4530
|
filter,
|
|
4468
4531
|
onFilterChange,
|
|
4469
4532
|
defaultSortBy,
|
|
@@ -4475,7 +4538,9 @@ const DataTable = forwardRef(
|
|
|
4475
4538
|
defaultSelectedRows,
|
|
4476
4539
|
selectedRows,
|
|
4477
4540
|
onSelectedRowsChange,
|
|
4478
|
-
disabledSelections
|
|
4541
|
+
disabledSelections,
|
|
4542
|
+
selectAllRowsLabel,
|
|
4543
|
+
selectRowLabel
|
|
4479
4544
|
});
|
|
4480
4545
|
return /* @__PURE__ */ jsx(DataTableContext.Provider, { value: dataTableContextValue, children: /* @__PURE__ */ jsx(
|
|
4481
4546
|
"div",
|
|
@@ -4659,12 +4724,12 @@ function useCheckboxGroupContext() {
|
|
|
4659
4724
|
}
|
|
4660
4725
|
function useIsCheckedInGroup(checkboxValue) {
|
|
4661
4726
|
const store = useCheckboxGroupContext()?.store ?? EMPTY_STORE;
|
|
4662
|
-
const handleCheckedChange = useStore(
|
|
4727
|
+
const handleCheckedChange = useStore$1(
|
|
4663
4728
|
store,
|
|
4664
4729
|
(state) => state.actions?.handleCheckedChange
|
|
4665
4730
|
);
|
|
4666
4731
|
return [
|
|
4667
|
-
useStore(store, (state) => state.value?.includes(checkboxValue)),
|
|
4732
|
+
useStore$1(store, (state) => state.value?.includes(checkboxValue)),
|
|
4668
4733
|
useMemo(
|
|
4669
4734
|
() => handleCheckedChange && ((checked) => handleCheckedChange(checkboxValue, checked)),
|
|
4670
4735
|
[checkboxValue, handleCheckedChange]
|
|
@@ -4675,13 +4740,13 @@ function useIsRequiredInGroup() {
|
|
|
4675
4740
|
const context = useCheckboxGroupContext();
|
|
4676
4741
|
const store = context?.store ?? EMPTY_STORE;
|
|
4677
4742
|
const required = context?.required;
|
|
4678
|
-
return useStore(store, (state) => required && state.value.length === 0);
|
|
4743
|
+
return useStore$1(store, (state) => required && state.value.length === 0);
|
|
4679
4744
|
}
|
|
4680
4745
|
function useCheckboxGroupDescriptionIds(checkboxId) {
|
|
4681
4746
|
const context = useCheckboxGroupContext();
|
|
4682
4747
|
const store = context?.store ?? EMPTY_STORE;
|
|
4683
4748
|
const descriptionIds = context?.descriptionIds;
|
|
4684
|
-
const isFirstCheckbox = useStore(
|
|
4749
|
+
const isFirstCheckbox = useStore$1(
|
|
4685
4750
|
store,
|
|
4686
4751
|
(state) => state.firstCheckboxId === checkboxId
|
|
4687
4752
|
);
|
|
@@ -4926,7 +4991,7 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
4926
4991
|
);
|
|
4927
4992
|
const combinedCheckboxRef = useCombinedRef(checkboxRef, forwardedRef);
|
|
4928
4993
|
const combinedLabelRef = useCombinedRef(labelProps?.ref, labelRef);
|
|
4929
|
-
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */
|
|
4994
|
+
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsxs(
|
|
4930
4995
|
ControlContext.Provider,
|
|
4931
4996
|
{
|
|
4932
4997
|
value: {
|
|
@@ -4940,147 +5005,159 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
4940
5005
|
loading,
|
|
4941
5006
|
readOnly
|
|
4942
5007
|
},
|
|
4943
|
-
children:
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5008
|
+
children: [
|
|
5009
|
+
/* @__PURE__ */ jsxs(
|
|
5010
|
+
"div",
|
|
5011
|
+
{
|
|
5012
|
+
"data-status": status,
|
|
5013
|
+
"data-accent": controlStatusToAccent(status),
|
|
5014
|
+
"data-variant": checkboxVariant,
|
|
5015
|
+
...rootProps,
|
|
5016
|
+
className: cx(prefix("checkbox__root"), rootProps?.className),
|
|
5017
|
+
children: [
|
|
5018
|
+
code != null && typeof code !== "boolean" && /* @__PURE__ */ jsx(
|
|
5019
|
+
ControlCode,
|
|
5020
|
+
{
|
|
5021
|
+
...codeProps,
|
|
5022
|
+
id: codeId,
|
|
5023
|
+
className: cx(prefix("checkbox__code"), codeProps?.className),
|
|
5024
|
+
children: code
|
|
5025
|
+
}
|
|
5026
|
+
),
|
|
5027
|
+
/* @__PURE__ */ jsxs(
|
|
5028
|
+
"div",
|
|
5029
|
+
{
|
|
5030
|
+
"data-status": status,
|
|
5031
|
+
"data-variant": checkboxVariant,
|
|
5032
|
+
"data-disabled": boolDataAttr(disabled || loading),
|
|
5033
|
+
"data-readonly": boolDataAttr(readOnly),
|
|
5034
|
+
...containerProps,
|
|
5035
|
+
className: cx(
|
|
5036
|
+
prefix("checkbox__container"),
|
|
5037
|
+
containerProps?.className
|
|
5038
|
+
),
|
|
5039
|
+
onBlur: combineEventHandlers(
|
|
5040
|
+
containerProps?.onBlur,
|
|
5041
|
+
handleContainerBlur
|
|
5042
|
+
),
|
|
5043
|
+
ref: combinedContainerRef,
|
|
5044
|
+
children: [
|
|
5045
|
+
/* @__PURE__ */ jsx(
|
|
5046
|
+
Checkbox$1.Root,
|
|
5047
|
+
{
|
|
5048
|
+
id: controlId,
|
|
5049
|
+
className: cx(prefix("checkbox"), className),
|
|
5050
|
+
name: name ?? checkboxGroupContext?.name,
|
|
5051
|
+
value,
|
|
5052
|
+
checked,
|
|
5053
|
+
required: requiredInGroup || required || void 0,
|
|
5054
|
+
disabled,
|
|
5055
|
+
"data-loading": boolDataAttr(loading),
|
|
5056
|
+
"data-readonly": boolDataAttr(readOnly),
|
|
5057
|
+
"data-status": status,
|
|
5058
|
+
"data-variant": checkboxVariant,
|
|
5059
|
+
onCheckedChange: handleCheckedChange,
|
|
5060
|
+
onFocus: combineEventHandlers(onFocus, handleFocus),
|
|
5061
|
+
onBlur: combineEventHandlers(onBlur, handleBlur),
|
|
5062
|
+
"aria-disabled": loading || readOnly || void 0,
|
|
5063
|
+
"aria-label": ariaLabel,
|
|
5064
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 && combinedLabelIds !== labelId && combinedLabelIds !== fieldLabelId ? combinedLabelIds : void 0),
|
|
5065
|
+
"aria-invalid": status === "invalid" || void 0,
|
|
5066
|
+
"aria-describedby": combineAriaIds(
|
|
5067
|
+
loadingDescriptionId,
|
|
5068
|
+
checkboxGroupContext?.loadingDescriptionId,
|
|
5069
|
+
errorMessageIds,
|
|
5070
|
+
checkboxGroupContext?.errorMessageIds,
|
|
5071
|
+
ariaDescribedBy,
|
|
5072
|
+
descriptionIds,
|
|
5073
|
+
groupDescriptionIds
|
|
5074
|
+
),
|
|
5075
|
+
...otherProps,
|
|
5076
|
+
ref: combinedCheckboxRef,
|
|
5077
|
+
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
5078
|
+
Icon,
|
|
5079
|
+
{
|
|
5080
|
+
icon: checked === "indeterminate" ? faMinus : faCheck,
|
|
5081
|
+
...indicatorProps,
|
|
5082
|
+
className: cx(
|
|
5083
|
+
prefix("checkbox__indicator"),
|
|
5084
|
+
indicatorProps?.className
|
|
5085
|
+
)
|
|
5086
|
+
}
|
|
5087
|
+
) })
|
|
5088
|
+
}
|
|
5089
|
+
),
|
|
5090
|
+
labelId && /* @__PURE__ */ jsx(
|
|
5091
|
+
Label,
|
|
5092
|
+
{
|
|
5093
|
+
htmlFor: controlId,
|
|
5094
|
+
"data-status": status,
|
|
5095
|
+
...labelProps,
|
|
5096
|
+
id: labelId,
|
|
5097
|
+
className: cx(prefix("checkbox__label"), labelProps?.className),
|
|
5098
|
+
required,
|
|
5099
|
+
onMouseDown: combineEventHandlers(
|
|
5100
|
+
labelProps?.onMouseDown,
|
|
5101
|
+
handleLabelMouseDown
|
|
5102
|
+
),
|
|
5103
|
+
containerProps: {
|
|
5104
|
+
...labelProps?.containerProps,
|
|
5016
5105
|
className: cx(
|
|
5017
|
-
prefix("
|
|
5018
|
-
|
|
5106
|
+
prefix("checkbox__label-container"),
|
|
5107
|
+
labelProps?.containerProps?.className
|
|
5019
5108
|
)
|
|
5020
|
-
}
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
className: cx(prefix("checkbox__label"), labelProps?.className),
|
|
5032
|
-
required,
|
|
5033
|
-
onMouseDown: combineEventHandlers(
|
|
5034
|
-
labelProps?.onMouseDown,
|
|
5035
|
-
handleLabelMouseDown
|
|
5036
|
-
),
|
|
5037
|
-
containerProps: {
|
|
5038
|
-
...labelProps?.containerProps,
|
|
5109
|
+
},
|
|
5110
|
+
ref: combinedLabelRef,
|
|
5111
|
+
children
|
|
5112
|
+
}
|
|
5113
|
+
),
|
|
5114
|
+
showSpinner && /* @__PURE__ */ jsx(
|
|
5115
|
+
Spinner,
|
|
5116
|
+
{
|
|
5117
|
+
color: controlStatusToAccent(status, "neutral"),
|
|
5118
|
+
"data-disabled": boolDataAttr(disabled || loading),
|
|
5119
|
+
...spinnerProps,
|
|
5039
5120
|
className: cx(
|
|
5040
|
-
prefix("
|
|
5041
|
-
|
|
5121
|
+
prefix("checkbox__spinner"),
|
|
5122
|
+
spinnerProps?.className
|
|
5042
5123
|
)
|
|
5043
|
-
}
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
...spinnerProps,
|
|
5054
|
-
className: cx(
|
|
5055
|
-
prefix("checkbox__spinner"),
|
|
5056
|
-
spinnerProps?.className
|
|
5057
|
-
)
|
|
5058
|
-
}
|
|
5059
|
-
),
|
|
5060
|
-
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription })
|
|
5061
|
-
]
|
|
5062
|
-
}
|
|
5063
|
-
)
|
|
5064
|
-
]
|
|
5065
|
-
}
|
|
5066
|
-
)
|
|
5124
|
+
}
|
|
5125
|
+
)
|
|
5126
|
+
]
|
|
5127
|
+
}
|
|
5128
|
+
)
|
|
5129
|
+
]
|
|
5130
|
+
}
|
|
5131
|
+
),
|
|
5132
|
+
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription })
|
|
5133
|
+
]
|
|
5067
5134
|
}
|
|
5068
5135
|
) });
|
|
5069
5136
|
});
|
|
5070
5137
|
const DATA_TABLE_SELECTION_COLUMN_WIDTH = 42;
|
|
5071
5138
|
function useDataTableSelectionColumn() {
|
|
5072
5139
|
const prefix = usePrefix();
|
|
5073
|
-
const
|
|
5074
|
-
const
|
|
5075
|
-
|
|
5140
|
+
const [locale7] = useLocale();
|
|
5141
|
+
const {
|
|
5142
|
+
displayMode,
|
|
5143
|
+
rowKey,
|
|
5144
|
+
showSelectionColumn,
|
|
5145
|
+
selectAllRowsLabel,
|
|
5146
|
+
selectRowLabel,
|
|
5147
|
+
store
|
|
5148
|
+
} = useDataTableContext();
|
|
5149
|
+
const actualSelectAllRowsLabel = selectAllRowsLabel ?? locale7.DataTable.selectAllRowsLabel;
|
|
5150
|
+
const actualSelectRowLabel = selectRowLabel ?? locale7.DataTable.selectRowLabel;
|
|
5151
|
+
const [selectedRows] = useStore$1(store, (state) => state.selectedRows);
|
|
5152
|
+
const disabledSelections = useStore$1(
|
|
5076
5153
|
store,
|
|
5077
5154
|
(state) => state.disabledSelections
|
|
5078
5155
|
);
|
|
5079
|
-
const { selectRows, unselectRows } = useStore(
|
|
5156
|
+
const { selectRows, unselectRows } = useStore$1(
|
|
5080
5157
|
store,
|
|
5081
5158
|
(state) => state.actions
|
|
5082
5159
|
);
|
|
5083
|
-
const allCheckedStatus = useStore(
|
|
5160
|
+
const allCheckedStatus = useStore$1(
|
|
5084
5161
|
store,
|
|
5085
5162
|
useShallow((state) => {
|
|
5086
5163
|
if (state.loading || !showSelectionColumn) {
|
|
@@ -5121,7 +5198,11 @@ function useDataTableSelectionColumn() {
|
|
|
5121
5198
|
} else {
|
|
5122
5199
|
selectRows(keys);
|
|
5123
5200
|
}
|
|
5124
|
-
}
|
|
5201
|
+
},
|
|
5202
|
+
labelProps: {
|
|
5203
|
+
containerProps: { className: prefix("visually-hidden") }
|
|
5204
|
+
},
|
|
5205
|
+
children: actualSelectAllRowsLabel
|
|
5125
5206
|
}
|
|
5126
5207
|
),
|
|
5127
5208
|
header: true,
|
|
@@ -5143,7 +5224,11 @@ function useDataTableSelectionColumn() {
|
|
|
5143
5224
|
unselectRows([key]);
|
|
5144
5225
|
}
|
|
5145
5226
|
},
|
|
5146
|
-
disabled: disabledSelections?.has(key)
|
|
5227
|
+
disabled: disabledSelections?.has(key),
|
|
5228
|
+
labelProps: {
|
|
5229
|
+
containerProps: { className: prefix("visually-hidden") }
|
|
5230
|
+
},
|
|
5231
|
+
children: actualSelectRowLabel
|
|
5147
5232
|
}
|
|
5148
5233
|
);
|
|
5149
5234
|
}
|
|
@@ -5174,7 +5259,7 @@ const DataTableRow = memo(
|
|
|
5174
5259
|
const { rowKey, renderCell, generatedId, estimatedRowHeight, store } = useDataTableContext();
|
|
5175
5260
|
const selectionColumn = useDataTableSelectionColumn();
|
|
5176
5261
|
const dataTableSelectionColumnId = useDataTableSelectionColumnId();
|
|
5177
|
-
const leafColumns2 = useStore(
|
|
5262
|
+
const leafColumns2 = useStore$1(
|
|
5178
5263
|
store,
|
|
5179
5264
|
useShallow(
|
|
5180
5265
|
(state) => selectionColumn ? {
|
|
@@ -5183,9 +5268,9 @@ const DataTableRow = memo(
|
|
|
5183
5268
|
} : state.leafColumns
|
|
5184
5269
|
)
|
|
5185
5270
|
);
|
|
5186
|
-
const headCount = useStore(store, (state) => state.headCount);
|
|
5187
|
-
const filter = useStore(store, (state) => state.filter);
|
|
5188
|
-
const selected = useStore(
|
|
5271
|
+
const headCount = useStore$1(store, (state) => state.headCount);
|
|
5272
|
+
const filter = useStore$1(store, (state) => state.filter);
|
|
5273
|
+
const selected = useStore$1(
|
|
5189
5274
|
store,
|
|
5190
5275
|
(state) => row && state.selectedRows[0].has(getRowKey(row, rowKey))
|
|
5191
5276
|
);
|
|
@@ -5274,9 +5359,10 @@ function DataTableEmptyOrLoadingRows({
|
|
|
5274
5359
|
}) {
|
|
5275
5360
|
const prefix = usePrefix();
|
|
5276
5361
|
const { showSelectionColumn, renderRow, store, apiRef } = useDataTableContext();
|
|
5277
|
-
const loading = useStore(store, (state) => state.loading);
|
|
5278
|
-
const loadingCount = useStore(store, (state) => state.loadingCount);
|
|
5362
|
+
const loading = useStore$1(store, (state) => state.loading);
|
|
5363
|
+
const loadingCount = useStore$1(store, (state) => state.loadingCount);
|
|
5279
5364
|
const numberOfColumns2 = (useTableNumberOfColumns() ?? 1) + (showSelectionColumn ? 1 : 0);
|
|
5365
|
+
const headCount = useStore$1(store, (state) => state.headCount);
|
|
5280
5366
|
useImperativeHandle(
|
|
5281
5367
|
apiRef,
|
|
5282
5368
|
() => ({
|
|
@@ -5293,16 +5379,25 @@ function DataTableEmptyOrLoadingRows({
|
|
|
5293
5379
|
const props = { row: void 0, index: i };
|
|
5294
5380
|
const key = `loading-${i}`;
|
|
5295
5381
|
return renderRow ? /* @__PURE__ */ jsx(Fragment$1, { children: renderRow(props) }, key) : /* @__PURE__ */ jsx(DataTableRow, { ...props }, key);
|
|
5296
|
-
}) : /* @__PURE__ */ jsx(TableRow, {
|
|
5297
|
-
|
|
5382
|
+
}) : /* @__PURE__ */ jsx(TableRow, { "aria-rowindex": headCount + 1, children: /* @__PURE__ */ jsx(
|
|
5383
|
+
TableCell,
|
|
5298
5384
|
{
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
children:
|
|
5385
|
+
header: true,
|
|
5386
|
+
variant: "data",
|
|
5387
|
+
paddingless: false,
|
|
5388
|
+
colSpan: numberOfColumns2 === 1 ? void 0 : numberOfColumns2,
|
|
5389
|
+
children: !loading && /* @__PURE__ */ jsx(
|
|
5390
|
+
"div",
|
|
5391
|
+
{
|
|
5392
|
+
className: cx(
|
|
5393
|
+
prefix("data-table__empty-message"),
|
|
5394
|
+
emptyMessageProps?.className
|
|
5395
|
+
),
|
|
5396
|
+
children: emptyMessage
|
|
5397
|
+
}
|
|
5398
|
+
)
|
|
5304
5399
|
}
|
|
5305
|
-
) })
|
|
5400
|
+
) });
|
|
5306
5401
|
}
|
|
5307
5402
|
function PagedDataTableRows() {
|
|
5308
5403
|
const { rowKey, renderRow, showAllRowsWhilePrinting, apiRef, store } = useDataTableContext();
|
|
@@ -5339,11 +5434,11 @@ function PagedDataTableRows() {
|
|
|
5339
5434
|
),
|
|
5340
5435
|
[goTo, store]
|
|
5341
5436
|
);
|
|
5342
|
-
const pageOffset = useStore(
|
|
5437
|
+
const pageOffset = useStore$1(
|
|
5343
5438
|
store,
|
|
5344
5439
|
(state) => showAllRows ? 0 : state.pageOffset()
|
|
5345
5440
|
);
|
|
5346
|
-
const rowsWindow = useStore(
|
|
5441
|
+
const rowsWindow = useStore$1(
|
|
5347
5442
|
store,
|
|
5348
5443
|
useShallow(
|
|
5349
5444
|
(state) => state.rowsWindow(
|
|
@@ -5370,8 +5465,8 @@ function ScrolledDataTableRows({
|
|
|
5370
5465
|
apiRef,
|
|
5371
5466
|
store
|
|
5372
5467
|
} = useDataTableContext();
|
|
5373
|
-
const tableHeadHeight = useStore(store, (state) => state.tableHeadHeight);
|
|
5374
|
-
const bodyCount = useStore(store, (state) => state.bodyCount());
|
|
5468
|
+
const tableHeadHeight = useStore$1(store, (state) => state.tableHeadHeight);
|
|
5469
|
+
const bodyCount = useStore$1(store, (state) => state.bodyCount());
|
|
5375
5470
|
const virtualizer = useVirtualizer({
|
|
5376
5471
|
count: bodyCount,
|
|
5377
5472
|
getScrollElement: useCallback(() => scrollableRef.current, [scrollableRef]),
|
|
@@ -5462,7 +5557,7 @@ function ScrolledDataTableRows({
|
|
|
5462
5557
|
const virtualItems = virtualizer.getVirtualItems();
|
|
5463
5558
|
const firstVirtualItem = virtualItems[0];
|
|
5464
5559
|
const lastVirtualItem = virtualItems[virtualItems.length - 1];
|
|
5465
|
-
const rowsWindow = useStore(
|
|
5560
|
+
const rowsWindow = useStore$1(
|
|
5466
5561
|
store,
|
|
5467
5562
|
useShallow(
|
|
5468
5563
|
(state) => state.rowsWindow(firstVirtualItem?.index ?? 0, virtualItems.length)
|
|
@@ -5524,7 +5619,7 @@ function ScrolledDataTableRows({
|
|
|
5524
5619
|
}
|
|
5525
5620
|
const DataTableBody = forwardRef(function DataTableBody2({ emptyMessage, emptyMessageProps, scrollableRef, ...otherProps }, forwardedRef) {
|
|
5526
5621
|
const { displayMode, store } = useDataTableContext();
|
|
5527
|
-
const isEmptyOrLoading = useStore(
|
|
5622
|
+
const isEmptyOrLoading = useStore$1(
|
|
5528
5623
|
store,
|
|
5529
5624
|
(state) => state.loading || state.totalCount() === 0
|
|
5530
5625
|
);
|
|
@@ -5539,10 +5634,10 @@ const DataTableBody = forwardRef(function DataTableBody2({ emptyMessage, emptyMe
|
|
|
5539
5634
|
!isEmptyOrLoading && (displayMode === "paged" ? /* @__PURE__ */ jsx(PagedDataTableRows, {}) : /* @__PURE__ */ jsx(ScrolledDataTableRows, { scrollableRef }))
|
|
5540
5635
|
] });
|
|
5541
5636
|
});
|
|
5542
|
-
const useLayoutEffect = typeof document !== "undefined" ? useLayoutEffect$
|
|
5637
|
+
const useLayoutEffect$1 = typeof document !== "undefined" ? useLayoutEffect$2 : () => {
|
|
5543
5638
|
};
|
|
5544
5639
|
function useMeasure(element, setMeasurement) {
|
|
5545
|
-
useLayoutEffect(() => {
|
|
5640
|
+
useLayoutEffect$1(() => {
|
|
5546
5641
|
if (!element) {
|
|
5547
5642
|
setMeasurement(void 0);
|
|
5548
5643
|
return;
|
|
@@ -5560,7 +5655,7 @@ function useMeasure(element, setMeasurement) {
|
|
|
5560
5655
|
}
|
|
5561
5656
|
const DataTableFoot = forwardRef(function DataTableFoot2({ showWhenEmpty, ...otherProps }, forwardedRef) {
|
|
5562
5657
|
const { store } = useDataTableContext();
|
|
5563
|
-
const shouldShow = useStore(
|
|
5658
|
+
const shouldShow = useStore$1(
|
|
5564
5659
|
store,
|
|
5565
5660
|
(state) => showWhenEmpty || !state.loading && (state.totalCount() ?? 0) > 0
|
|
5566
5661
|
);
|
|
@@ -5579,7 +5674,7 @@ const DataTableHead = forwardRef(function DataTableHead2({ rowProps, ...otherPro
|
|
|
5579
5674
|
const { generatedId, store } = useDataTableContext();
|
|
5580
5675
|
const selectionColumn = useDataTableSelectionColumn();
|
|
5581
5676
|
const dataTableSelectionColumnId = useDataTableSelectionColumnId();
|
|
5582
|
-
const columns = useStore(
|
|
5677
|
+
const columns = useStore$1(
|
|
5583
5678
|
store,
|
|
5584
5679
|
useShallow(
|
|
5585
5680
|
(state) => selectionColumn ? {
|
|
@@ -5588,9 +5683,9 @@ const DataTableHead = forwardRef(function DataTableHead2({ rowProps, ...otherPro
|
|
|
5588
5683
|
} : state.columns
|
|
5589
5684
|
)
|
|
5590
5685
|
);
|
|
5591
|
-
const sortBy = useStore(store, (state) => state.sortBy);
|
|
5592
|
-
const sortDirection = useStore(store, (state) => state.sortDirection);
|
|
5593
|
-
const { setSort } = useStore(store, (state) => state.actions);
|
|
5686
|
+
const sortBy = useStore$1(store, (state) => state.sortBy);
|
|
5687
|
+
const sortDirection = useStore$1(store, (state) => state.sortDirection);
|
|
5688
|
+
const { setSort } = useStore$1(store, (state) => state.actions);
|
|
5594
5689
|
const [tableHeadEl, setTableHeadEl] = useState(null);
|
|
5595
5690
|
useMeasure(
|
|
5596
5691
|
tableHeadEl,
|
|
@@ -5672,13 +5767,13 @@ const DataTableContent = forwardRef(function DataTable2({
|
|
|
5672
5767
|
}, forwardedRef) {
|
|
5673
5768
|
const prefix = usePrefix();
|
|
5674
5769
|
const [locale7] = useLocale();
|
|
5675
|
-
emptyMessage ??= locale7.
|
|
5770
|
+
emptyMessage ??= locale7.DataTableContent.emptyMessage;
|
|
5676
5771
|
const { displayMode, required, estimatedRowHeight, store } = useDataTableContext();
|
|
5677
5772
|
const tableRef = useRef(null);
|
|
5678
5773
|
const scrollableRef = useRef(null);
|
|
5679
5774
|
const { height: scrollbarHeight } = useScrollbarSize();
|
|
5680
5775
|
const rowHeight = typeof estimatedRowHeight === "number" ? estimatedRowHeight : estimatedRowHeight(0);
|
|
5681
|
-
const maxHeight = useStore(
|
|
5776
|
+
const maxHeight = useStore$1(
|
|
5682
5777
|
store,
|
|
5683
5778
|
(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
|
|
5684
5779
|
scrollbarHeight : void 0
|
|
@@ -5755,12 +5850,12 @@ const DataTableFilter = forwardRef(function DataTableFilter2({
|
|
|
5755
5850
|
ariaLabel ??= locale7.DataTableFilter["aria-label"];
|
|
5756
5851
|
placeholder ??= locale7.DataTableFilter.placeholder;
|
|
5757
5852
|
const { store } = useDataTableContext();
|
|
5758
|
-
const filter = useStore(store, (state) => state.filter);
|
|
5853
|
+
const filter = useStore$1(store, (state) => state.filter);
|
|
5759
5854
|
const handleFilterChange = (value) => {
|
|
5760
5855
|
startTransition(() => store.getState().actions.setFilter(value));
|
|
5761
5856
|
};
|
|
5762
5857
|
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(
|
|
5763
|
-
Input,
|
|
5858
|
+
Input$1,
|
|
5764
5859
|
{
|
|
5765
5860
|
placeholder,
|
|
5766
5861
|
showClearButton: "auto",
|
|
@@ -5784,27 +5879,33 @@ const DataTableFilter = forwardRef(function DataTableFilter2({
|
|
|
5784
5879
|
});
|
|
5785
5880
|
const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
5786
5881
|
rowsRange,
|
|
5882
|
+
rowsRangeSelectLabel,
|
|
5787
5883
|
previousPageButtonLabel,
|
|
5788
5884
|
nextPageButtonLabel,
|
|
5789
5885
|
preferRightAlignment,
|
|
5790
5886
|
previousPageButtonProps,
|
|
5791
5887
|
nextPageButtonProps,
|
|
5792
5888
|
className,
|
|
5889
|
+
"aria-label": ariaLabel,
|
|
5793
5890
|
...otherProps
|
|
5794
5891
|
}, forwardedRef) {
|
|
5795
5892
|
const prefix = usePrefix();
|
|
5893
|
+
const [locale7] = useLocale();
|
|
5894
|
+
ariaLabel ??= locale7.DataTablePagination["aria-label"];
|
|
5796
5895
|
const { store } = useDataTableContext();
|
|
5797
|
-
const totalCount = useStore(store, (state) => state.totalCount());
|
|
5798
|
-
const limit = useStore(store, (state) => state.limit);
|
|
5799
|
-
const { setOffset } = useStore(store, (state) => state.actions);
|
|
5896
|
+
const totalCount = useStore$1(store, (state) => state.totalCount());
|
|
5897
|
+
const limit = useStore$1(store, (state) => state.limit);
|
|
5898
|
+
const { setOffset } = useStore$1(store, (state) => state.actions);
|
|
5800
5899
|
const setOffsetWithTransition = (offset) => startTransition(() => setOffset(offset));
|
|
5801
|
-
const currentPage = useStore(store, (state) => state.currentPage());
|
|
5900
|
+
const currentPage = useStore$1(store, (state) => state.currentPage());
|
|
5802
5901
|
const numberOfPages = Math.ceil((totalCount ?? 0) / limit);
|
|
5803
5902
|
const lastPage = Math.max(0, numberOfPages - 1);
|
|
5804
5903
|
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsxs(
|
|
5805
5904
|
"div",
|
|
5806
5905
|
{
|
|
5906
|
+
role: "group",
|
|
5807
5907
|
className: cx(prefix("data-table__pagination"), className),
|
|
5908
|
+
"aria-label": ariaLabel,
|
|
5808
5909
|
...otherProps,
|
|
5809
5910
|
"data-prefer-right-alignment": boolDataAttr(preferRightAlignment),
|
|
5810
5911
|
ref: forwardedRef,
|
|
@@ -5819,6 +5920,7 @@ const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
|
5819
5920
|
value: currentPage,
|
|
5820
5921
|
onValueChange: (value) => setOffsetWithTransition(+value * limit),
|
|
5821
5922
|
showClearButton: false,
|
|
5923
|
+
"aria-label": rowsRangeSelectLabel?.(totalCount),
|
|
5822
5924
|
rootProps: {
|
|
5823
5925
|
className: prefix("data-table__pagination-select-root")
|
|
5824
5926
|
},
|
|
@@ -5872,12 +5974,12 @@ const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
|
5872
5974
|
const ScrolledDataTablePagination = forwardRef(function ScrolledDataTablePagination2({ rowsRange, preferRightAlignment, className, ...otherProps }, forwardedRef) {
|
|
5873
5975
|
const prefix = usePrefix();
|
|
5874
5976
|
const { store } = useDataTableContext();
|
|
5875
|
-
const totalCount = useStore(store, (state) => state.totalCount());
|
|
5876
|
-
const scrolledRangeStart = useStore(
|
|
5977
|
+
const totalCount = useStore$1(store, (state) => state.totalCount());
|
|
5978
|
+
const scrolledRangeStart = useStore$1(
|
|
5877
5979
|
store,
|
|
5878
5980
|
(state) => state.scrolledRangeStart
|
|
5879
5981
|
);
|
|
5880
|
-
const scrolledRangeEnd = useStore(store, (state) => state.scrolledRangeEnd);
|
|
5982
|
+
const scrolledRangeEnd = useStore$1(store, (state) => state.scrolledRangeEnd);
|
|
5881
5983
|
return /* @__PURE__ */ jsxs(
|
|
5882
5984
|
"div",
|
|
5883
5985
|
{
|
|
@@ -5900,6 +6002,7 @@ const ScrolledDataTablePagination = forwardRef(function ScrolledDataTablePaginat
|
|
|
5900
6002
|
});
|
|
5901
6003
|
const DataTablePagination = forwardRef(function DataTablePagination2({
|
|
5902
6004
|
rowsRange,
|
|
6005
|
+
rowsRangeSelectLabel,
|
|
5903
6006
|
previousPageButtonLabel,
|
|
5904
6007
|
nextPageButtonLabel,
|
|
5905
6008
|
previousPageButtonProps,
|
|
@@ -5909,6 +6012,7 @@ const DataTablePagination = forwardRef(function DataTablePagination2({
|
|
|
5909
6012
|
}, forwardedRef) {
|
|
5910
6013
|
const [locale7] = useLocale();
|
|
5911
6014
|
rowsRange ??= locale7.DataTablePagination.rowsRange;
|
|
6015
|
+
rowsRangeSelectLabel ??= locale7.DataTablePagination.rowsRangeSelectLabel;
|
|
5912
6016
|
previousPageButtonLabel ??= locale7.DataTablePagination.previousPageButtonLabel;
|
|
5913
6017
|
nextPageButtonLabel ??= locale7.DataTablePagination.nextPageButtonLabel;
|
|
5914
6018
|
const { displayMode, showAllRowsWhilePrinting } = useDataTableContext();
|
|
@@ -5918,6 +6022,7 @@ const DataTablePagination = forwardRef(function DataTablePagination2({
|
|
|
5918
6022
|
{
|
|
5919
6023
|
...otherProps,
|
|
5920
6024
|
rowsRange,
|
|
6025
|
+
rowsRangeSelectLabel,
|
|
5921
6026
|
previousPageButtonLabel,
|
|
5922
6027
|
nextPageButtonLabel,
|
|
5923
6028
|
previousPageButtonProps,
|
|
@@ -5947,12 +6052,11 @@ const DataTableRowsPerPage = forwardRef(function DataTableRowsPerPage2({
|
|
|
5947
6052
|
const [locale7] = useLocale();
|
|
5948
6053
|
label ??= locale7.DataTableRowsPerPage.label;
|
|
5949
6054
|
const { store } = useDataTableContext();
|
|
5950
|
-
const limit = useStore(store, (state) => state.limit);
|
|
5951
|
-
const { setLimit } = useStore(store, (state) => state.actions);
|
|
6055
|
+
const limit = useStore$1(store, (state) => state.limit);
|
|
6056
|
+
const { setLimit } = useStore$1(store, (state) => state.actions);
|
|
5952
6057
|
const optionsIncludingLimit = limitOptions.includes(limit) ? [...limitOptions] : [...limitOptions, limit];
|
|
5953
6058
|
optionsIncludingLimit.sort((v1, v2) => v1 - v2);
|
|
5954
|
-
|
|
5955
|
-
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsxs(
|
|
6059
|
+
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(FieldProvider, { children: /* @__PURE__ */ jsxs(
|
|
5956
6060
|
"div",
|
|
5957
6061
|
{
|
|
5958
6062
|
className: cx(prefix("data-table__rows-per-page"), className),
|
|
@@ -5960,22 +6064,11 @@ const DataTableRowsPerPage = forwardRef(function DataTableRowsPerPage2({
|
|
|
5960
6064
|
"data-prefer-right-alignment": boolDataAttr(preferRightAlignment),
|
|
5961
6065
|
ref: forwardedRef,
|
|
5962
6066
|
children: [
|
|
5963
|
-
/* @__PURE__ */
|
|
5964
|
-
"label",
|
|
5965
|
-
{
|
|
5966
|
-
htmlFor: selectId,
|
|
5967
|
-
className: prefix("data-table__rows-per-page-label"),
|
|
5968
|
-
children: [
|
|
5969
|
-
label,
|
|
5970
|
-
":"
|
|
5971
|
-
]
|
|
5972
|
-
}
|
|
5973
|
-
),
|
|
6067
|
+
/* @__PURE__ */ jsx(Label, { className: prefix("data-table__rows-per-page-label"), children: label }),
|
|
5974
6068
|
/* @__PURE__ */ jsx(
|
|
5975
6069
|
Select,
|
|
5976
6070
|
{
|
|
5977
6071
|
className: prefix("data-table__rows-per-page-select"),
|
|
5978
|
-
id: selectId,
|
|
5979
6072
|
value: limit,
|
|
5980
6073
|
onValueChange: (value) => setLimit(+value),
|
|
5981
6074
|
showClearButton: false,
|
|
@@ -5987,7 +6080,7 @@ const DataTableRowsPerPage = forwardRef(function DataTableRowsPerPage2({
|
|
|
5987
6080
|
)
|
|
5988
6081
|
]
|
|
5989
6082
|
}
|
|
5990
|
-
) });
|
|
6083
|
+
) }) });
|
|
5991
6084
|
});
|
|
5992
6085
|
const DataTableSelectionTrigger = forwardRef(function DataTableSelectionTrigger2({
|
|
5993
6086
|
preferRightAlignment = true,
|
|
@@ -5999,7 +6092,7 @@ const DataTableSelectionTrigger = forwardRef(function DataTableSelectionTrigger2
|
|
|
5999
6092
|
}, forwardedRef) {
|
|
6000
6093
|
const prefix = usePrefix();
|
|
6001
6094
|
const { store } = useDataTableContext();
|
|
6002
|
-
const hasSelected = useStore(store, (state) => state.selectedRows.length > 0);
|
|
6095
|
+
const hasSelected = useStore$1(store, (state) => state.selectedRows.length > 0);
|
|
6003
6096
|
const handleClick = useCallback(
|
|
6004
6097
|
(event) => {
|
|
6005
6098
|
onClick(Array.from(store.getState().selectedRows[0]).sort(), event);
|
|
@@ -6023,7 +6116,7 @@ const DataTableSelectionTrigger = forwardRef(function DataTableSelectionTrigger2
|
|
|
6023
6116
|
const REQUIRED_TAGS = ["INPUT", "SELECT", "TEXTAREA"];
|
|
6024
6117
|
const READ_ONLY_TAGS = ["INPUT", "TEXTAREA"];
|
|
6025
6118
|
const NON_READONLY_INPUT_TYPES = ["file", "color"];
|
|
6026
|
-
const Input = forwardRef(
|
|
6119
|
+
const Input$1 = forwardRef(
|
|
6027
6120
|
function Input2({
|
|
6028
6121
|
asChild,
|
|
6029
6122
|
type,
|
|
@@ -6039,6 +6132,7 @@ const Input = forwardRef(
|
|
|
6039
6132
|
startAdornment,
|
|
6040
6133
|
endAdornment,
|
|
6041
6134
|
showClearButton,
|
|
6135
|
+
clearDescription,
|
|
6042
6136
|
clearButtonLabel,
|
|
6043
6137
|
onValueChange,
|
|
6044
6138
|
onBlurToOutside,
|
|
@@ -6163,6 +6257,7 @@ const Input = forwardRef(
|
|
|
6163
6257
|
}
|
|
6164
6258
|
}, [inputEl]);
|
|
6165
6259
|
const hasClearButton = !disabled && !loading && !readOnly && (showClearButton === true || showClearButton === "auto" && (isControlled ? (value?.toString() ?? "")?.length > 0 : shouldShowClearButton));
|
|
6260
|
+
const clearDescriptionId = hasClearButton && clearDescription && prefix(`control-clear-${generatedId}`);
|
|
6166
6261
|
const { cssVars, dataAttrs } = responsiveValuesToCssVarsAndDataAttrs(
|
|
6167
6262
|
"control",
|
|
6168
6263
|
{ align }
|
|
@@ -6187,12 +6282,12 @@ const Input = forwardRef(
|
|
|
6187
6282
|
clearButtonProps?.ref
|
|
6188
6283
|
);
|
|
6189
6284
|
const As = asChild ? Slot : "input";
|
|
6190
|
-
return /* @__PURE__ */
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
{
|
|
6194
|
-
|
|
6195
|
-
|
|
6285
|
+
return /* @__PURE__ */ jsx(ClearContexts, { field: false, children: /* @__PURE__ */ jsxs(
|
|
6286
|
+
ControlContext.Provider,
|
|
6287
|
+
{
|
|
6288
|
+
value: { variant, status, disabled, loading, readOnly },
|
|
6289
|
+
children: [
|
|
6290
|
+
/* @__PURE__ */ jsxs(
|
|
6196
6291
|
"div",
|
|
6197
6292
|
{
|
|
6198
6293
|
"data-status": status,
|
|
@@ -6263,7 +6358,8 @@ const Input = forwardRef(
|
|
|
6263
6358
|
loadingDescriptionId,
|
|
6264
6359
|
errorMessageIds,
|
|
6265
6360
|
ariaDescribedBy,
|
|
6266
|
-
descriptionIds
|
|
6361
|
+
descriptionIds,
|
|
6362
|
+
clearDescriptionId
|
|
6267
6363
|
),
|
|
6268
6364
|
...otherProps,
|
|
6269
6365
|
ref: combinedInputRef
|
|
@@ -6315,16 +6411,17 @@ const Input = forwardRef(
|
|
|
6315
6411
|
)
|
|
6316
6412
|
]
|
|
6317
6413
|
}
|
|
6318
|
-
)
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6414
|
+
),
|
|
6415
|
+
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription }),
|
|
6416
|
+
clearDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: clearDescriptionId, children: clearDescription })
|
|
6417
|
+
]
|
|
6418
|
+
}
|
|
6419
|
+
) });
|
|
6323
6420
|
}
|
|
6324
6421
|
);
|
|
6325
6422
|
const InputWithContainerRef = forwardRef(function InputWithContainerRef2({ inputRef, containerProps, ...otherProps }, forwardedRef) {
|
|
6326
6423
|
return /* @__PURE__ */ jsx(
|
|
6327
|
-
Input,
|
|
6424
|
+
Input$1,
|
|
6328
6425
|
{
|
|
6329
6426
|
containerProps: {
|
|
6330
6427
|
...containerProps,
|
|
@@ -6549,60 +6646,906 @@ const MenuListItem = forwardRef(
|
|
|
6549
6646
|
);
|
|
6550
6647
|
}
|
|
6551
6648
|
);
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
)
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6649
|
+
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;
|
|
6650
|
+
var IS_GAP_REGEXP = /[\\\/_+.#"@\[\(\{&]/, COUNT_GAPS_REGEXP = /[\\\/_+.#"@\[\(\{&]/g, IS_SPACE_REGEXP = /[\s-]/, COUNT_SPACE_REGEXP = /[\s-]/g;
|
|
6651
|
+
function commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, stringIndex, abbreviationIndex, memoizedResults) {
|
|
6652
|
+
if (abbreviationIndex === abbreviation.length) {
|
|
6653
|
+
if (stringIndex === string.length) {
|
|
6654
|
+
return SCORE_CONTINUE_MATCH;
|
|
6655
|
+
}
|
|
6656
|
+
return PENALTY_NOT_COMPLETE;
|
|
6657
|
+
}
|
|
6658
|
+
var memoizeKey = `${stringIndex},${abbreviationIndex}`;
|
|
6659
|
+
if (memoizedResults[memoizeKey] !== void 0) {
|
|
6660
|
+
return memoizedResults[memoizeKey];
|
|
6661
|
+
}
|
|
6662
|
+
var abbreviationChar = lowerAbbreviation.charAt(abbreviationIndex);
|
|
6663
|
+
var index = lowerString.indexOf(abbreviationChar, stringIndex);
|
|
6664
|
+
var highScore = 0;
|
|
6665
|
+
var score, transposedScore, wordBreaks, spaceBreaks;
|
|
6666
|
+
while (index >= 0) {
|
|
6667
|
+
score = commandScoreInner(
|
|
6668
|
+
string,
|
|
6669
|
+
abbreviation,
|
|
6670
|
+
lowerString,
|
|
6671
|
+
lowerAbbreviation,
|
|
6672
|
+
index + 1,
|
|
6673
|
+
abbreviationIndex + 1,
|
|
6674
|
+
memoizedResults
|
|
6675
|
+
);
|
|
6676
|
+
if (score > highScore) {
|
|
6677
|
+
if (index === stringIndex) {
|
|
6678
|
+
score *= SCORE_CONTINUE_MATCH;
|
|
6679
|
+
} else if (IS_GAP_REGEXP.test(string.charAt(index - 1))) {
|
|
6680
|
+
score *= SCORE_NON_SPACE_WORD_JUMP;
|
|
6681
|
+
wordBreaks = string.slice(stringIndex, index - 1).match(COUNT_GAPS_REGEXP);
|
|
6682
|
+
if (wordBreaks && stringIndex > 0) {
|
|
6683
|
+
score *= Math.pow(PENALTY_SKIPPED, wordBreaks.length);
|
|
6684
|
+
}
|
|
6685
|
+
} else if (IS_SPACE_REGEXP.test(string.charAt(index - 1))) {
|
|
6686
|
+
score *= SCORE_SPACE_WORD_JUMP;
|
|
6687
|
+
spaceBreaks = string.slice(stringIndex, index - 1).match(COUNT_SPACE_REGEXP);
|
|
6688
|
+
if (spaceBreaks && stringIndex > 0) {
|
|
6689
|
+
score *= Math.pow(PENALTY_SKIPPED, spaceBreaks.length);
|
|
6690
|
+
}
|
|
6691
|
+
} else {
|
|
6692
|
+
score *= SCORE_CHARACTER_JUMP;
|
|
6693
|
+
if (stringIndex > 0) {
|
|
6694
|
+
score *= Math.pow(PENALTY_SKIPPED, index - stringIndex);
|
|
6695
|
+
}
|
|
6696
|
+
}
|
|
6697
|
+
if (string.charAt(index) !== abbreviation.charAt(abbreviationIndex)) {
|
|
6698
|
+
score *= PENALTY_CASE_MISMATCH;
|
|
6699
|
+
}
|
|
6700
|
+
}
|
|
6701
|
+
if (score < SCORE_TRANSPOSITION && lowerString.charAt(index - 1) === lowerAbbreviation.charAt(abbreviationIndex + 1) || lowerAbbreviation.charAt(abbreviationIndex + 1) === lowerAbbreviation.charAt(abbreviationIndex) && // allow duplicate letters. Ref #7428
|
|
6702
|
+
lowerString.charAt(index - 1) !== lowerAbbreviation.charAt(abbreviationIndex)) {
|
|
6703
|
+
transposedScore = commandScoreInner(
|
|
6704
|
+
string,
|
|
6705
|
+
abbreviation,
|
|
6706
|
+
lowerString,
|
|
6707
|
+
lowerAbbreviation,
|
|
6708
|
+
index + 1,
|
|
6709
|
+
abbreviationIndex + 2,
|
|
6710
|
+
memoizedResults
|
|
6711
|
+
);
|
|
6712
|
+
if (transposedScore * SCORE_TRANSPOSITION > score) {
|
|
6713
|
+
score = transposedScore * SCORE_TRANSPOSITION;
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6716
|
+
if (score > highScore) {
|
|
6717
|
+
highScore = score;
|
|
6718
|
+
}
|
|
6719
|
+
index = lowerString.indexOf(abbreviationChar, index + 1);
|
|
6720
|
+
}
|
|
6721
|
+
memoizedResults[memoizeKey] = highScore;
|
|
6722
|
+
return highScore;
|
|
6723
|
+
}
|
|
6724
|
+
function formatInput(string) {
|
|
6725
|
+
return string.toLowerCase().replace(COUNT_SPACE_REGEXP, " ");
|
|
6726
|
+
}
|
|
6727
|
+
function commandScore(string, abbreviation, aliases) {
|
|
6728
|
+
string = aliases && aliases.length > 0 ? `${string + " " + aliases.join(" ")}` : string;
|
|
6729
|
+
return commandScoreInner(
|
|
6730
|
+
string,
|
|
6731
|
+
abbreviation,
|
|
6732
|
+
formatInput(string),
|
|
6733
|
+
formatInput(abbreviation),
|
|
6734
|
+
0,
|
|
6735
|
+
0,
|
|
6736
|
+
{}
|
|
6737
|
+
);
|
|
6738
|
+
}
|
|
6739
|
+
const GROUP_SELECTOR = `[cmdk-group=""]`;
|
|
6740
|
+
const GROUP_ITEMS_SELECTOR = `[cmdk-group-items=""]`;
|
|
6741
|
+
const GROUP_HEADING_SELECTOR = `[cmdk-group-heading=""]`;
|
|
6742
|
+
const ITEM_SELECTOR = `[cmdk-item=""]`;
|
|
6743
|
+
const VALID_ITEM_SELECTOR = `${ITEM_SELECTOR}:not([aria-disabled="true"])`;
|
|
6744
|
+
const SELECT_EVENT = `cmdk-item-select`;
|
|
6745
|
+
const VALUE_ATTR = `data-value`;
|
|
6746
|
+
const defaultFilter = (value, search, keywords) => commandScore(value, search, keywords);
|
|
6747
|
+
const CommandContext = React.createContext(void 0);
|
|
6748
|
+
const useCommand = () => React.useContext(CommandContext);
|
|
6749
|
+
const StoreContext = React.createContext(void 0);
|
|
6750
|
+
const useStore = () => React.useContext(StoreContext);
|
|
6751
|
+
const GroupContext = React.createContext(void 0);
|
|
6752
|
+
const Command = React.forwardRef(
|
|
6753
|
+
(props, forwardedRef) => {
|
|
6754
|
+
const state = useLazyRef(() => ({
|
|
6755
|
+
/** Value of the search query. */
|
|
6756
|
+
search: "",
|
|
6757
|
+
/** Currently selected item value. */
|
|
6758
|
+
value: props.value ?? props.defaultValue ?? "",
|
|
6759
|
+
/** Currently selected item id. */
|
|
6760
|
+
selectedItemId: void 0,
|
|
6761
|
+
filtered: {
|
|
6762
|
+
/** The count of all visible items. */
|
|
6763
|
+
count: 0,
|
|
6764
|
+
/** Map from visible item id to its search score. */
|
|
6765
|
+
items: /* @__PURE__ */ new Map(),
|
|
6766
|
+
/** Set of groups with at least one visible item. */
|
|
6767
|
+
groups: /* @__PURE__ */ new Set()
|
|
6768
|
+
}
|
|
6769
|
+
}));
|
|
6770
|
+
const allItems = useLazyRef(() => /* @__PURE__ */ new Set());
|
|
6771
|
+
const allGroups = useLazyRef(() => /* @__PURE__ */ new Map());
|
|
6772
|
+
const ids = useLazyRef(
|
|
6773
|
+
() => /* @__PURE__ */ new Map()
|
|
6774
|
+
);
|
|
6775
|
+
const listeners = useLazyRef(() => /* @__PURE__ */ new Set());
|
|
6776
|
+
const propsRef = useAsRef(props);
|
|
6777
|
+
const {
|
|
6778
|
+
asChild,
|
|
6779
|
+
label,
|
|
6780
|
+
children,
|
|
6781
|
+
value,
|
|
6782
|
+
onValueChange,
|
|
6783
|
+
filter,
|
|
6784
|
+
shouldFilter,
|
|
6785
|
+
loop,
|
|
6786
|
+
disablePointerSelection = false,
|
|
6787
|
+
...etc
|
|
6788
|
+
} = props;
|
|
6789
|
+
const listId = React.useId();
|
|
6790
|
+
const labelId = React.useId();
|
|
6791
|
+
const inputId = React.useId();
|
|
6792
|
+
const listInnerRef = React.useRef(null);
|
|
6793
|
+
const schedule = useScheduleLayoutEffect();
|
|
6794
|
+
useLayoutEffect(() => {
|
|
6795
|
+
if (value !== void 0) {
|
|
6796
|
+
const v = value.trim();
|
|
6797
|
+
state.current.value = v;
|
|
6798
|
+
store.emit();
|
|
6799
|
+
}
|
|
6800
|
+
}, [value]);
|
|
6801
|
+
useLayoutEffect(() => {
|
|
6802
|
+
setTimeout(() => {
|
|
6803
|
+
schedule(6, scrollSelectedIntoView);
|
|
6804
|
+
});
|
|
6805
|
+
}, []);
|
|
6806
|
+
const store = React.useMemo(() => {
|
|
6807
|
+
return {
|
|
6808
|
+
subscribe: (cb) => {
|
|
6809
|
+
listeners.current.add(cb);
|
|
6810
|
+
return () => listeners.current.delete(cb);
|
|
6811
|
+
},
|
|
6812
|
+
snapshot: () => {
|
|
6813
|
+
return state.current;
|
|
6814
|
+
},
|
|
6815
|
+
setState: (key, value2, opts) => {
|
|
6816
|
+
if (Object.is(state.current[key], value2)) return;
|
|
6817
|
+
state.current[key] = value2;
|
|
6818
|
+
if (key === "search") {
|
|
6819
|
+
filterItems();
|
|
6820
|
+
sort();
|
|
6821
|
+
schedule(1, selectFirstItem);
|
|
6822
|
+
} else if (key === "value") {
|
|
6823
|
+
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
6824
|
+
const input = document.getElementById(inputId);
|
|
6825
|
+
if (input) input.focus();
|
|
6826
|
+
else document.getElementById(listId)?.focus();
|
|
6827
|
+
}
|
|
6828
|
+
schedule(7, () => {
|
|
6829
|
+
state.current.selectedItemId = opts.id;
|
|
6830
|
+
store.emit();
|
|
6831
|
+
});
|
|
6832
|
+
if (!opts.disableScrollIntoView) {
|
|
6833
|
+
schedule(5, () => scrollSelectedIntoView(opts.id));
|
|
6834
|
+
}
|
|
6835
|
+
if (propsRef.current?.value !== void 0) {
|
|
6836
|
+
const newValue = value2 ?? "";
|
|
6837
|
+
propsRef.current.onValueChange?.(newValue);
|
|
6838
|
+
return;
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
store.emit();
|
|
6842
|
+
},
|
|
6843
|
+
emit: () => {
|
|
6844
|
+
listeners.current.forEach((l) => l());
|
|
6845
|
+
}
|
|
6846
|
+
};
|
|
6847
|
+
}, []);
|
|
6848
|
+
const context = React.useMemo(
|
|
6849
|
+
() => ({
|
|
6850
|
+
// Keep id → {value, keywords} mapping up-to-date
|
|
6851
|
+
value: (id, value2, keywords) => {
|
|
6852
|
+
if (value2 !== ids.current.get(id)?.value) {
|
|
6853
|
+
ids.current.set(id, { value: value2, keywords });
|
|
6854
|
+
state.current.filtered.items.set(id, score(value2, keywords));
|
|
6855
|
+
schedule(2, () => {
|
|
6856
|
+
sort();
|
|
6857
|
+
store.emit();
|
|
6858
|
+
});
|
|
6859
|
+
}
|
|
6860
|
+
},
|
|
6861
|
+
// Track item lifecycle (mount, unmount)
|
|
6862
|
+
item: (id, groupId) => {
|
|
6863
|
+
allItems.current.add(id);
|
|
6864
|
+
if (groupId) {
|
|
6865
|
+
if (!allGroups.current.has(groupId)) {
|
|
6866
|
+
allGroups.current.set(groupId, /* @__PURE__ */ new Set([id]));
|
|
6867
|
+
} else {
|
|
6868
|
+
allGroups.current.get(groupId).add(id);
|
|
6869
|
+
}
|
|
6870
|
+
}
|
|
6871
|
+
schedule(3, () => {
|
|
6872
|
+
filterItems();
|
|
6873
|
+
sort();
|
|
6874
|
+
if (!state.current.value) {
|
|
6875
|
+
selectFirstItem();
|
|
6876
|
+
}
|
|
6877
|
+
store.emit();
|
|
6878
|
+
});
|
|
6879
|
+
return () => {
|
|
6880
|
+
ids.current.delete(id);
|
|
6881
|
+
allItems.current.delete(id);
|
|
6882
|
+
state.current.filtered.items.delete(id);
|
|
6883
|
+
const selectedItem = getSelectedItem();
|
|
6884
|
+
schedule(4, () => {
|
|
6885
|
+
filterItems();
|
|
6886
|
+
if (selectedItem?.getAttribute("id") === id) selectFirstItem();
|
|
6887
|
+
store.emit();
|
|
6888
|
+
});
|
|
6889
|
+
};
|
|
6890
|
+
},
|
|
6891
|
+
// Track group lifecycle (mount, unmount)
|
|
6892
|
+
group: (id) => {
|
|
6893
|
+
if (!allGroups.current.has(id)) {
|
|
6894
|
+
allGroups.current.set(id, /* @__PURE__ */ new Set());
|
|
6895
|
+
}
|
|
6896
|
+
return () => {
|
|
6897
|
+
ids.current.delete(id);
|
|
6898
|
+
allGroups.current.delete(id);
|
|
6899
|
+
};
|
|
6900
|
+
},
|
|
6901
|
+
filter: () => {
|
|
6902
|
+
return propsRef.current.shouldFilter;
|
|
6903
|
+
},
|
|
6904
|
+
label: label || props["aria-label"],
|
|
6905
|
+
getDisablePointerSelection: () => {
|
|
6906
|
+
return propsRef.current.disablePointerSelection;
|
|
6907
|
+
},
|
|
6908
|
+
listId,
|
|
6909
|
+
inputId,
|
|
6910
|
+
labelId,
|
|
6911
|
+
listInnerRef
|
|
6912
|
+
}),
|
|
6913
|
+
[]
|
|
6914
|
+
);
|
|
6915
|
+
function score(value2, keywords) {
|
|
6916
|
+
const filter2 = propsRef.current?.filter ?? defaultFilter;
|
|
6917
|
+
return value2 ? filter2(value2, state.current.search, keywords) : 0;
|
|
6918
|
+
}
|
|
6919
|
+
function sort() {
|
|
6920
|
+
if (!state.current.search || // Explicitly false, because true | undefined is the default
|
|
6921
|
+
propsRef.current.shouldFilter === false) {
|
|
6922
|
+
return;
|
|
6923
|
+
}
|
|
6924
|
+
const scores = state.current.filtered.items;
|
|
6925
|
+
const groups = [];
|
|
6926
|
+
state.current.filtered.groups.forEach((value2) => {
|
|
6927
|
+
const items = allGroups.current.get(value2);
|
|
6928
|
+
let max2 = 0;
|
|
6929
|
+
items.forEach((item) => {
|
|
6930
|
+
const score2 = scores.get(item);
|
|
6931
|
+
max2 = Math.max(score2, max2);
|
|
6932
|
+
});
|
|
6933
|
+
groups.push([value2, max2]);
|
|
6934
|
+
});
|
|
6935
|
+
const listInsertionElement = listInnerRef.current;
|
|
6936
|
+
getValidItems().sort((a, b) => {
|
|
6937
|
+
const valueA = a.getAttribute("id");
|
|
6938
|
+
const valueB = b.getAttribute("id");
|
|
6939
|
+
return (scores.get(valueB) ?? 0) - (scores.get(valueA) ?? 0);
|
|
6940
|
+
}).forEach((item) => {
|
|
6941
|
+
const group = item.closest(GROUP_ITEMS_SELECTOR);
|
|
6942
|
+
if (group) {
|
|
6943
|
+
group.appendChild(
|
|
6944
|
+
item.parentElement === group ? item : item.closest(`${GROUP_ITEMS_SELECTOR} > *`)
|
|
6945
|
+
);
|
|
6946
|
+
} else {
|
|
6947
|
+
listInsertionElement.appendChild(
|
|
6948
|
+
item.parentElement === listInsertionElement ? item : item.closest(`${GROUP_ITEMS_SELECTOR} > *`)
|
|
6949
|
+
);
|
|
6950
|
+
}
|
|
6951
|
+
});
|
|
6952
|
+
groups.sort((a, b) => b[1] - a[1]).forEach((group) => {
|
|
6953
|
+
const element = listInnerRef.current?.querySelector(
|
|
6954
|
+
`${GROUP_SELECTOR}[${VALUE_ATTR}="${encodeURIComponent(group[0])}"]`
|
|
6955
|
+
);
|
|
6956
|
+
element?.parentElement.appendChild(element);
|
|
6957
|
+
});
|
|
6958
|
+
}
|
|
6959
|
+
function selectFirstItem() {
|
|
6960
|
+
const item = getValidItems().find(
|
|
6961
|
+
(item2) => item2.getAttribute("aria-disabled") !== "true"
|
|
6962
|
+
);
|
|
6963
|
+
const value2 = item?.getAttribute(VALUE_ATTR);
|
|
6964
|
+
store.setState("value", value2 || void 0, {
|
|
6965
|
+
id: item?.getAttribute("id")
|
|
6966
|
+
});
|
|
6967
|
+
}
|
|
6968
|
+
function filterItems() {
|
|
6969
|
+
if (!state.current.search || // Explicitly false, because true | undefined is the default
|
|
6970
|
+
propsRef.current.shouldFilter === false) {
|
|
6971
|
+
state.current.filtered.count = allItems.current.size;
|
|
6972
|
+
return;
|
|
6973
|
+
}
|
|
6974
|
+
state.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
6975
|
+
let itemCount = 0;
|
|
6976
|
+
for (const id of allItems.current) {
|
|
6977
|
+
const value2 = ids.current.get(id)?.value ?? "";
|
|
6978
|
+
const keywords = ids.current.get(id)?.keywords ?? [];
|
|
6979
|
+
const rank = score(value2, keywords);
|
|
6980
|
+
state.current.filtered.items.set(id, rank);
|
|
6981
|
+
if (rank > 0) itemCount++;
|
|
6982
|
+
}
|
|
6983
|
+
for (const [groupId, group] of allGroups.current) {
|
|
6984
|
+
for (const itemId of group) {
|
|
6985
|
+
if (state.current.filtered.items.get(itemId) > 0) {
|
|
6986
|
+
state.current.filtered.groups.add(groupId);
|
|
6987
|
+
break;
|
|
6988
|
+
}
|
|
6989
|
+
}
|
|
6990
|
+
}
|
|
6991
|
+
state.current.filtered.count = itemCount;
|
|
6992
|
+
}
|
|
6993
|
+
function scrollSelectedIntoView(itemId) {
|
|
6994
|
+
const item = itemId ? document.getElementById(itemId) : getSelectedItem();
|
|
6995
|
+
if (item) {
|
|
6996
|
+
if (item.parentElement?.firstChild === item) {
|
|
6997
|
+
item.closest(GROUP_SELECTOR)?.querySelector(GROUP_HEADING_SELECTOR)?.scrollIntoView({ block: "nearest" });
|
|
6998
|
+
}
|
|
6999
|
+
item.scrollIntoView({ block: "nearest" });
|
|
7000
|
+
}
|
|
7001
|
+
}
|
|
7002
|
+
function getSelectedItem() {
|
|
7003
|
+
return listInnerRef.current?.querySelector(
|
|
7004
|
+
`${ITEM_SELECTOR}[data-selected]`
|
|
7005
|
+
);
|
|
7006
|
+
}
|
|
7007
|
+
function getValidItems() {
|
|
7008
|
+
return Array.from(
|
|
7009
|
+
listInnerRef.current?.querySelectorAll(VALID_ITEM_SELECTOR) || []
|
|
7010
|
+
);
|
|
7011
|
+
}
|
|
7012
|
+
function updateSelectedToIndex(index) {
|
|
7013
|
+
const items = getValidItems();
|
|
7014
|
+
const item = items[index];
|
|
7015
|
+
if (item)
|
|
7016
|
+
store.setState("value", item.getAttribute(VALUE_ATTR), {
|
|
7017
|
+
id: item.getAttribute("id")
|
|
7018
|
+
});
|
|
7019
|
+
}
|
|
7020
|
+
function updateSelectedByItem(change) {
|
|
7021
|
+
const selected = getSelectedItem();
|
|
7022
|
+
const items = getValidItems();
|
|
7023
|
+
const index = selected ? items.findIndex((item) => item === selected) : -1;
|
|
7024
|
+
let newIndex = index === -1 ? change > 0 ? 0 : items.length - 1 : index + change;
|
|
7025
|
+
if (propsRef.current?.loop) {
|
|
7026
|
+
newIndex = newIndex < 0 ? items.length - 1 : newIndex >= items.length ? 0 : newIndex;
|
|
7027
|
+
} else {
|
|
7028
|
+
newIndex = Math.max(0, Math.min(newIndex, items.length - 1));
|
|
7029
|
+
}
|
|
7030
|
+
let newSelected = items[newIndex];
|
|
7031
|
+
if (newSelected)
|
|
7032
|
+
store.setState("value", newSelected.getAttribute(VALUE_ATTR), {
|
|
7033
|
+
id: newSelected.getAttribute("id")
|
|
7034
|
+
});
|
|
7035
|
+
}
|
|
7036
|
+
function updateSelectedByGroup(change) {
|
|
7037
|
+
const selected = getSelectedItem();
|
|
7038
|
+
let group = selected?.closest(GROUP_SELECTOR);
|
|
7039
|
+
let item;
|
|
7040
|
+
while (group && !item) {
|
|
7041
|
+
group = change > 0 ? findNextSibling(group, GROUP_SELECTOR) : findPreviousSibling(group, GROUP_SELECTOR);
|
|
7042
|
+
item = group?.querySelector(VALID_ITEM_SELECTOR);
|
|
7043
|
+
}
|
|
7044
|
+
if (item) {
|
|
7045
|
+
store.setState("value", item.getAttribute(VALUE_ATTR), {
|
|
7046
|
+
id: item.getAttribute("id")
|
|
7047
|
+
});
|
|
7048
|
+
} else {
|
|
7049
|
+
updateSelectedByItem(change);
|
|
7050
|
+
}
|
|
7051
|
+
}
|
|
7052
|
+
const last = () => updateSelectedToIndex(getValidItems().length - 1);
|
|
7053
|
+
const next = (e) => {
|
|
7054
|
+
e.preventDefault();
|
|
7055
|
+
if (e.metaKey) {
|
|
7056
|
+
last();
|
|
7057
|
+
} else if (e.altKey) {
|
|
7058
|
+
updateSelectedByGroup(1);
|
|
7059
|
+
} else {
|
|
7060
|
+
updateSelectedByItem(1);
|
|
7061
|
+
}
|
|
7062
|
+
};
|
|
7063
|
+
const prev = (e) => {
|
|
7064
|
+
e.preventDefault();
|
|
7065
|
+
if (e.metaKey) {
|
|
7066
|
+
updateSelectedToIndex(0);
|
|
7067
|
+
} else if (e.altKey) {
|
|
7068
|
+
updateSelectedByGroup(-1);
|
|
7069
|
+
} else {
|
|
7070
|
+
updateSelectedByItem(-1);
|
|
7071
|
+
}
|
|
7072
|
+
};
|
|
7073
|
+
const As = asChild ? Slot : "div";
|
|
7074
|
+
return /* @__PURE__ */ jsxs(
|
|
7075
|
+
As,
|
|
7076
|
+
{
|
|
7077
|
+
ref: forwardedRef,
|
|
7078
|
+
tabIndex: -1,
|
|
7079
|
+
...etc,
|
|
7080
|
+
"cmdk-root": "",
|
|
7081
|
+
onKeyDown: (e) => {
|
|
7082
|
+
etc.onKeyDown?.(e);
|
|
7083
|
+
const isComposing = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
7084
|
+
if (e.defaultPrevented || isComposing) {
|
|
7085
|
+
return;
|
|
7086
|
+
}
|
|
7087
|
+
switch (e.key) {
|
|
7088
|
+
case "ArrowDown": {
|
|
7089
|
+
next(e);
|
|
7090
|
+
break;
|
|
7091
|
+
}
|
|
7092
|
+
case "ArrowUp": {
|
|
7093
|
+
prev(e);
|
|
7094
|
+
break;
|
|
7095
|
+
}
|
|
7096
|
+
case "Home": {
|
|
7097
|
+
e.preventDefault();
|
|
7098
|
+
updateSelectedToIndex(0);
|
|
7099
|
+
break;
|
|
7100
|
+
}
|
|
7101
|
+
case "End": {
|
|
7102
|
+
e.preventDefault();
|
|
7103
|
+
last();
|
|
7104
|
+
break;
|
|
7105
|
+
}
|
|
7106
|
+
case "Enter": {
|
|
7107
|
+
e.preventDefault();
|
|
7108
|
+
const item = getSelectedItem();
|
|
7109
|
+
if (item) {
|
|
7110
|
+
const event = new Event(SELECT_EVENT);
|
|
7111
|
+
item.dispatchEvent(event);
|
|
7112
|
+
}
|
|
7113
|
+
}
|
|
7114
|
+
}
|
|
7115
|
+
},
|
|
7116
|
+
children: [
|
|
7117
|
+
/* @__PURE__ */ jsx(
|
|
7118
|
+
"label",
|
|
7119
|
+
{
|
|
7120
|
+
"cmdk-label": "",
|
|
7121
|
+
htmlFor: context.inputId,
|
|
7122
|
+
id: context.labelId,
|
|
7123
|
+
style: srOnlyStyles,
|
|
7124
|
+
children: label
|
|
7125
|
+
}
|
|
7126
|
+
),
|
|
7127
|
+
SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx(StoreContext.Provider, { value: store, children: /* @__PURE__ */ jsx(CommandContext.Provider, { value: context, children: child }) }))
|
|
7128
|
+
]
|
|
7129
|
+
}
|
|
7130
|
+
);
|
|
7131
|
+
}
|
|
7132
|
+
);
|
|
7133
|
+
const Item = React.forwardRef(
|
|
7134
|
+
(props, forwardedRef) => {
|
|
7135
|
+
const id = React.useId();
|
|
7136
|
+
const ref = React.useRef(null);
|
|
7137
|
+
const groupContext = React.useContext(GroupContext);
|
|
7138
|
+
const context = useCommand();
|
|
7139
|
+
const propsRef = useAsRef(props);
|
|
7140
|
+
const forceMount = propsRef.current?.forceMount ?? groupContext?.forceMount;
|
|
7141
|
+
useLayoutEffect(() => {
|
|
7142
|
+
if (!forceMount) {
|
|
7143
|
+
return context.item(id, groupContext?.id);
|
|
7144
|
+
}
|
|
7145
|
+
}, [forceMount]);
|
|
7146
|
+
const value = useValue(
|
|
7147
|
+
id,
|
|
7148
|
+
ref,
|
|
7149
|
+
[props.value, props.children, ref],
|
|
7150
|
+
props.keywords
|
|
7151
|
+
);
|
|
7152
|
+
const store = useStore();
|
|
7153
|
+
const selected = useCmdk(
|
|
7154
|
+
(state) => state.value && state.value === value.current
|
|
7155
|
+
);
|
|
7156
|
+
const render = useCmdk(
|
|
7157
|
+
(state) => forceMount ? true : context.filter() === false ? true : !state.search ? true : state.filtered.items.get(id) > 0
|
|
7158
|
+
);
|
|
7159
|
+
React.useEffect(() => {
|
|
7160
|
+
const element = ref.current;
|
|
7161
|
+
if (!element || props.disabled) return;
|
|
7162
|
+
element.addEventListener(SELECT_EVENT, onSelect);
|
|
7163
|
+
return () => element.removeEventListener(SELECT_EVENT, onSelect);
|
|
7164
|
+
}, [render, props.onSelect, props.disabled]);
|
|
7165
|
+
function onSelect() {
|
|
7166
|
+
select();
|
|
7167
|
+
propsRef.current.onSelect?.(value.current);
|
|
7168
|
+
}
|
|
7169
|
+
function select() {
|
|
7170
|
+
store.setState("value", value.current, {
|
|
7171
|
+
id,
|
|
7172
|
+
disableScrollIntoView: true
|
|
7173
|
+
});
|
|
7174
|
+
}
|
|
7175
|
+
const combinedRef = useCombinedRef(ref, forwardedRef);
|
|
7176
|
+
if (!render) return null;
|
|
7177
|
+
const {
|
|
7178
|
+
asChild,
|
|
7179
|
+
disabled,
|
|
7180
|
+
value: _,
|
|
7181
|
+
onSelect: __,
|
|
7182
|
+
forceMount: ___,
|
|
7183
|
+
keywords: ____,
|
|
7184
|
+
...etc
|
|
7185
|
+
} = props;
|
|
7186
|
+
const As = asChild ? Slot : "div";
|
|
7187
|
+
return /* @__PURE__ */ jsx(
|
|
7188
|
+
As,
|
|
7189
|
+
{
|
|
7190
|
+
ref: combinedRef,
|
|
7191
|
+
id,
|
|
7192
|
+
"cmdk-item": "",
|
|
7193
|
+
role: "option",
|
|
7194
|
+
"aria-disabled": Boolean(disabled) || void 0,
|
|
7195
|
+
"aria-selected": Boolean(selected) || void 0,
|
|
7196
|
+
"data-disabled": boolDataAttr(disabled),
|
|
7197
|
+
"data-selected": boolDataAttr(selected),
|
|
7198
|
+
...etc,
|
|
7199
|
+
onPointerMove: disabled || context.getDisablePointerSelection() ? void 0 : select,
|
|
7200
|
+
onClick: disabled ? void 0 : onSelect,
|
|
7201
|
+
children: props.children
|
|
7202
|
+
}
|
|
7203
|
+
);
|
|
7204
|
+
}
|
|
7205
|
+
);
|
|
7206
|
+
const Group = React.forwardRef(
|
|
7207
|
+
(props, forwardedRef) => {
|
|
7208
|
+
const { asChild, heading, children, forceMount, ...etc } = props;
|
|
7209
|
+
const id = React.useId();
|
|
7210
|
+
const ref = React.useRef(null);
|
|
7211
|
+
const headingRef = React.useRef(null);
|
|
7212
|
+
const headingId = React.useId();
|
|
7213
|
+
const context = useCommand();
|
|
7214
|
+
const render = useCmdk(
|
|
7215
|
+
(state) => forceMount ? true : context.filter() === false ? true : !state.search ? true : state.filtered.groups.has(id)
|
|
7216
|
+
);
|
|
7217
|
+
useLayoutEffect(() => {
|
|
7218
|
+
return context.group(id);
|
|
7219
|
+
}, []);
|
|
7220
|
+
useValue(id, ref, [props.value, props.heading, headingRef]);
|
|
7221
|
+
const contextValue = React.useMemo(
|
|
7222
|
+
() => ({ id, forceMount }),
|
|
7223
|
+
[forceMount]
|
|
7224
|
+
);
|
|
7225
|
+
const combinedRef = useCombinedRef(ref, forwardedRef);
|
|
7226
|
+
const As = asChild ? Slot : "div";
|
|
7227
|
+
return /* @__PURE__ */ jsxs(
|
|
7228
|
+
As,
|
|
7229
|
+
{
|
|
7230
|
+
ref: combinedRef,
|
|
7231
|
+
"cmdk-group": "",
|
|
7232
|
+
role: "presentation",
|
|
7233
|
+
hidden: render ? void 0 : true,
|
|
7234
|
+
...etc,
|
|
7235
|
+
children: [
|
|
7236
|
+
heading && /* @__PURE__ */ jsx(
|
|
7237
|
+
"div",
|
|
7238
|
+
{
|
|
7239
|
+
ref: headingRef,
|
|
7240
|
+
"cmdk-group-heading": "",
|
|
7241
|
+
"aria-hidden": true,
|
|
7242
|
+
id: headingId,
|
|
7243
|
+
children: heading
|
|
7244
|
+
}
|
|
7245
|
+
),
|
|
7246
|
+
SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx(
|
|
7247
|
+
"div",
|
|
7248
|
+
{
|
|
7249
|
+
"cmdk-group-items": "",
|
|
7250
|
+
role: "group",
|
|
7251
|
+
"aria-labelledby": heading ? headingId : void 0,
|
|
7252
|
+
children: /* @__PURE__ */ jsx(GroupContext.Provider, { value: contextValue, children: child })
|
|
7253
|
+
}
|
|
7254
|
+
))
|
|
7255
|
+
]
|
|
7256
|
+
}
|
|
7257
|
+
);
|
|
7258
|
+
}
|
|
7259
|
+
);
|
|
7260
|
+
const Separator$1 = React.forwardRef(
|
|
7261
|
+
(props, forwardedRef) => {
|
|
7262
|
+
const { asChild, alwaysRender, ...etc } = props;
|
|
7263
|
+
const ref = React.useRef(null);
|
|
7264
|
+
const render = useCmdk((state) => !state.search);
|
|
7265
|
+
const combinedRef = useCombinedRef(ref, forwardedRef);
|
|
7266
|
+
if (!alwaysRender && !render) return null;
|
|
7267
|
+
const As = asChild ? Slot : "div";
|
|
7268
|
+
return /* @__PURE__ */ jsx(As, { ref: combinedRef, "cmdk-separator": "", role: "separator", ...etc });
|
|
7269
|
+
}
|
|
7270
|
+
);
|
|
7271
|
+
const Input = React.forwardRef(
|
|
7272
|
+
(props, forwardedRef) => {
|
|
7273
|
+
const { asChild, onValueChange, ...etc } = props;
|
|
7274
|
+
const isControlled = props.value != null;
|
|
7275
|
+
const store = useStore();
|
|
7276
|
+
const search = useCmdk((state) => state.search);
|
|
7277
|
+
const selectedItemId = useCmdk((state) => state.selectedItemId);
|
|
7278
|
+
const context = useCommand();
|
|
7279
|
+
React.useEffect(() => {
|
|
7280
|
+
if (props.value != null) {
|
|
7281
|
+
store.setState("search", props.value);
|
|
7282
|
+
}
|
|
7283
|
+
}, [props.value]);
|
|
7284
|
+
const As = asChild ? Slot : "input";
|
|
7285
|
+
return /* @__PURE__ */ jsx(
|
|
7286
|
+
As,
|
|
7287
|
+
{
|
|
7288
|
+
ref: forwardedRef,
|
|
7289
|
+
"cmdk-input": "",
|
|
7290
|
+
autoComplete: "off",
|
|
7291
|
+
autoCorrect: "off",
|
|
7292
|
+
spellCheck: false,
|
|
7293
|
+
"aria-autocomplete": "list",
|
|
7294
|
+
role: "combobox",
|
|
7295
|
+
"aria-expanded": true,
|
|
7296
|
+
"aria-controls": context.listId,
|
|
7297
|
+
"aria-labelledby": context.labelId,
|
|
7298
|
+
"aria-activedescendant": selectedItemId,
|
|
7299
|
+
id: context.inputId,
|
|
7300
|
+
type: "text",
|
|
7301
|
+
value: isControlled ? props.value : search,
|
|
7302
|
+
...etc,
|
|
7303
|
+
onChange: (e) => {
|
|
7304
|
+
if (!isControlled) {
|
|
7305
|
+
store.setState("search", e.target.value);
|
|
7306
|
+
}
|
|
7307
|
+
onValueChange?.(e.target.value);
|
|
7308
|
+
}
|
|
7309
|
+
}
|
|
7310
|
+
);
|
|
7311
|
+
}
|
|
7312
|
+
);
|
|
7313
|
+
const List = React.forwardRef(
|
|
7314
|
+
(props, forwardedRef) => {
|
|
7315
|
+
const { asChild, children, label = "Suggestions", ...etc } = props;
|
|
7316
|
+
const ref = React.useRef(null);
|
|
7317
|
+
const height = React.useRef(null);
|
|
7318
|
+
const selectedItemId = useCmdk((state) => state.selectedItemId);
|
|
7319
|
+
const context = useCommand();
|
|
7320
|
+
React.useEffect(() => {
|
|
7321
|
+
if (height.current && ref.current) {
|
|
7322
|
+
const el = height.current;
|
|
7323
|
+
const wrapper = ref.current;
|
|
7324
|
+
let animationFrame;
|
|
7325
|
+
const observer = new ResizeObserver(() => {
|
|
7326
|
+
animationFrame = requestAnimationFrame(() => {
|
|
7327
|
+
const height2 = el.offsetHeight;
|
|
7328
|
+
wrapper.style.setProperty(
|
|
7329
|
+
`--cmdk-list-height`,
|
|
7330
|
+
height2.toFixed(1) + "px"
|
|
7331
|
+
);
|
|
7332
|
+
});
|
|
7333
|
+
});
|
|
7334
|
+
observer.observe(el);
|
|
7335
|
+
return () => {
|
|
7336
|
+
cancelAnimationFrame(animationFrame);
|
|
7337
|
+
observer.unobserve(el);
|
|
7338
|
+
};
|
|
7339
|
+
}
|
|
7340
|
+
}, []);
|
|
7341
|
+
const combinedRef = useCombinedRef(ref, forwardedRef);
|
|
7342
|
+
const combinedListSizerRef = useCombinedRef(height, context.listInnerRef);
|
|
7343
|
+
const As = asChild ? Slot : "div";
|
|
7344
|
+
return /* @__PURE__ */ jsx(
|
|
7345
|
+
As,
|
|
7346
|
+
{
|
|
7347
|
+
ref: combinedRef,
|
|
7348
|
+
"cmdk-list": "",
|
|
7349
|
+
role: "listbox",
|
|
7350
|
+
tabIndex: -1,
|
|
7351
|
+
"aria-activedescendant": selectedItemId,
|
|
7352
|
+
"aria-label": label,
|
|
7353
|
+
id: context.listId,
|
|
7354
|
+
...etc,
|
|
7355
|
+
children: SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx("div", { ref: combinedListSizerRef, "cmdk-list-sizer": "", children: child }))
|
|
7356
|
+
}
|
|
7357
|
+
);
|
|
7358
|
+
}
|
|
7359
|
+
);
|
|
7360
|
+
const Empty = React.forwardRef(
|
|
7361
|
+
(props, forwardedRef) => {
|
|
7362
|
+
const render = useCmdk((state) => state.filtered.count === 0);
|
|
7363
|
+
if (!render) return null;
|
|
7364
|
+
const { asChild, ...etc } = props;
|
|
7365
|
+
const As = asChild ? Slot : "div";
|
|
7366
|
+
return /* @__PURE__ */ jsx(As, { ref: forwardedRef, "cmdk-empty": "", role: "presentation", ...etc });
|
|
7367
|
+
}
|
|
7368
|
+
);
|
|
7369
|
+
const Loading = React.forwardRef(
|
|
7370
|
+
(props, forwardedRef) => {
|
|
7371
|
+
const { asChild, progress, children, label = "Loading...", ...etc } = props;
|
|
7372
|
+
const As = asChild ? Slot : "div";
|
|
7373
|
+
return /* @__PURE__ */ jsx(
|
|
7374
|
+
As,
|
|
7375
|
+
{
|
|
7376
|
+
ref: forwardedRef,
|
|
7377
|
+
"cmdk-loading": "",
|
|
7378
|
+
role: "progressbar",
|
|
7379
|
+
"aria-valuenow": progress,
|
|
7380
|
+
"aria-valuemin": 0,
|
|
7381
|
+
"aria-valuemax": 100,
|
|
7382
|
+
"aria-label": label,
|
|
7383
|
+
...etc,
|
|
7384
|
+
children: SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx("div", { "aria-hidden": true, children: child }))
|
|
7385
|
+
}
|
|
7386
|
+
);
|
|
7387
|
+
}
|
|
7388
|
+
);
|
|
7389
|
+
const pkg = Object.assign(Command, {
|
|
7390
|
+
List,
|
|
7391
|
+
Item,
|
|
7392
|
+
Input,
|
|
7393
|
+
Group,
|
|
7394
|
+
Separator: Separator$1,
|
|
7395
|
+
Empty,
|
|
7396
|
+
Loading
|
|
7397
|
+
});
|
|
7398
|
+
function findNextSibling(el, selector) {
|
|
7399
|
+
let sibling = el.nextElementSibling;
|
|
7400
|
+
while (sibling) {
|
|
7401
|
+
if (sibling.matches(selector)) return sibling;
|
|
7402
|
+
sibling = sibling.nextElementSibling;
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7405
|
+
function findPreviousSibling(el, selector) {
|
|
7406
|
+
let sibling = el.previousElementSibling;
|
|
7407
|
+
while (sibling) {
|
|
7408
|
+
if (sibling.matches(selector)) return sibling;
|
|
7409
|
+
sibling = sibling.previousElementSibling;
|
|
7410
|
+
}
|
|
7411
|
+
}
|
|
7412
|
+
function useAsRef(data) {
|
|
7413
|
+
const ref = React.useRef(data);
|
|
7414
|
+
useLayoutEffect(() => {
|
|
7415
|
+
ref.current = data;
|
|
7416
|
+
});
|
|
7417
|
+
return ref;
|
|
7418
|
+
}
|
|
7419
|
+
const useLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
|
|
7420
|
+
function useLazyRef(fn) {
|
|
7421
|
+
const ref = React.useRef();
|
|
7422
|
+
if (ref.current === void 0) {
|
|
7423
|
+
ref.current = fn();
|
|
7424
|
+
}
|
|
7425
|
+
return ref;
|
|
7426
|
+
}
|
|
7427
|
+
function useCmdk(selector) {
|
|
7428
|
+
const store = useStore();
|
|
7429
|
+
const cb = () => selector(store.snapshot());
|
|
7430
|
+
return React.useSyncExternalStore(store.subscribe, cb, cb);
|
|
7431
|
+
}
|
|
7432
|
+
function useValue(id, ref, deps, aliases = []) {
|
|
7433
|
+
const valueRef = React.useRef();
|
|
7434
|
+
const context = useCommand();
|
|
7435
|
+
useLayoutEffect(() => {
|
|
7436
|
+
const value = (() => {
|
|
7437
|
+
for (const part of deps) {
|
|
7438
|
+
if (typeof part === "string") {
|
|
7439
|
+
return part.trim();
|
|
7440
|
+
}
|
|
7441
|
+
if (typeof part === "object" && "current" in part) {
|
|
7442
|
+
if (part.current) {
|
|
7443
|
+
return part.current.textContent?.trim();
|
|
7444
|
+
}
|
|
7445
|
+
return valueRef.current;
|
|
7446
|
+
}
|
|
7447
|
+
}
|
|
7448
|
+
})();
|
|
7449
|
+
const keywords = aliases.map((alias) => alias.trim());
|
|
7450
|
+
context.value(id, value, keywords);
|
|
7451
|
+
ref.current?.setAttribute(VALUE_ATTR, value);
|
|
7452
|
+
valueRef.current = value;
|
|
7453
|
+
});
|
|
7454
|
+
return valueRef;
|
|
7455
|
+
}
|
|
7456
|
+
const useScheduleLayoutEffect = () => {
|
|
7457
|
+
const [s, ss] = React.useState();
|
|
7458
|
+
const fns = useLazyRef(() => /* @__PURE__ */ new Map());
|
|
7459
|
+
useLayoutEffect(() => {
|
|
7460
|
+
fns.current.forEach((f) => f());
|
|
7461
|
+
fns.current = /* @__PURE__ */ new Map();
|
|
7462
|
+
}, [s]);
|
|
7463
|
+
return (id, cb) => {
|
|
7464
|
+
fns.current.set(id, cb);
|
|
7465
|
+
ss({});
|
|
7466
|
+
};
|
|
7467
|
+
};
|
|
7468
|
+
function renderChildren(children) {
|
|
7469
|
+
const childrenType = children.type;
|
|
7470
|
+
if (typeof childrenType === "function") return childrenType(children.props);
|
|
7471
|
+
else if ("render" in childrenType) return childrenType.render(children.props);
|
|
7472
|
+
else return children;
|
|
7473
|
+
}
|
|
7474
|
+
function SlottableWithNestedChildren({ asChild, children }, render) {
|
|
7475
|
+
if (asChild && React.isValidElement(children)) {
|
|
7476
|
+
return React.cloneElement(
|
|
7477
|
+
renderChildren(children),
|
|
7478
|
+
{ ref: children.ref },
|
|
7479
|
+
render(children.props.children)
|
|
7480
|
+
);
|
|
7481
|
+
}
|
|
7482
|
+
return render(children);
|
|
7483
|
+
}
|
|
7484
|
+
const srOnlyStyles = {
|
|
7485
|
+
position: "absolute",
|
|
7486
|
+
width: "1px",
|
|
7487
|
+
height: "1px",
|
|
7488
|
+
padding: "0",
|
|
7489
|
+
margin: "-1px",
|
|
7490
|
+
overflow: "hidden",
|
|
7491
|
+
clip: "rect(0, 0, 0, 0)",
|
|
7492
|
+
whiteSpace: "nowrap",
|
|
7493
|
+
borderWidth: "0"
|
|
7494
|
+
};
|
|
7495
|
+
const CommandMenu = forwardRef(
|
|
7496
|
+
function CommandMenu2({
|
|
7497
|
+
variant,
|
|
7498
|
+
iconPlacement = "start",
|
|
7499
|
+
label,
|
|
7500
|
+
searchPlaceholder,
|
|
7501
|
+
searchValue,
|
|
7502
|
+
onSearchValueChange,
|
|
7503
|
+
listLabel,
|
|
7504
|
+
loading,
|
|
7505
|
+
loadingLabel,
|
|
7506
|
+
loadingProgress,
|
|
7507
|
+
emptyMessage,
|
|
7508
|
+
className,
|
|
7509
|
+
searchProps,
|
|
7510
|
+
searchAdornmentProps,
|
|
7511
|
+
searchIconProps,
|
|
7512
|
+
listProps,
|
|
7513
|
+
loadingProps,
|
|
7514
|
+
spinnerProps,
|
|
7515
|
+
emptyMessageProps,
|
|
7516
|
+
children,
|
|
7517
|
+
...otherProps
|
|
7518
|
+
}, forwardedRef) {
|
|
7519
|
+
const prefix = usePrefix();
|
|
7520
|
+
const [locale7] = useLocale();
|
|
7521
|
+
label ??= locale7.CommandMenu.label;
|
|
7522
|
+
searchPlaceholder ??= locale7.CommandMenu.searchPlaceholder;
|
|
7523
|
+
emptyMessage ??= locale7.CommandMenu.emptyMessage;
|
|
7524
|
+
listLabel ??= locale7.CommandMenu.listLabel;
|
|
7525
|
+
loadingLabel ??= locale7.CommandMenu.loadingLabel;
|
|
7526
|
+
const searchAdornmentEl = /* @__PURE__ */ jsx(
|
|
7527
|
+
ControlAddon,
|
|
7528
|
+
{
|
|
7529
|
+
...searchAdornmentProps,
|
|
7530
|
+
className: cx(
|
|
7531
|
+
prefix("command-menu__search-adornment"),
|
|
7532
|
+
searchAdornmentProps?.className
|
|
7533
|
+
),
|
|
7534
|
+
children: /* @__PURE__ */ jsx(
|
|
7535
|
+
Icon,
|
|
7536
|
+
{
|
|
7537
|
+
icon: faSearch,
|
|
7538
|
+
...searchIconProps,
|
|
7539
|
+
className: cx(
|
|
7540
|
+
prefix("command-menu__search-icon"),
|
|
7541
|
+
searchIconProps?.className
|
|
7542
|
+
)
|
|
7543
|
+
}
|
|
6601
7544
|
)
|
|
6602
7545
|
}
|
|
6603
7546
|
);
|
|
6604
7547
|
return /* @__PURE__ */ jsxs(
|
|
6605
|
-
|
|
7548
|
+
pkg,
|
|
6606
7549
|
{
|
|
6607
7550
|
label,
|
|
6608
7551
|
className: cx(prefix("command-menu"), className),
|
|
@@ -6610,13 +7553,13 @@ const CommandMenu = forwardRef(
|
|
|
6610
7553
|
ref: forwardedRef,
|
|
6611
7554
|
children: [
|
|
6612
7555
|
/* @__PURE__ */ jsx(
|
|
6613
|
-
|
|
7556
|
+
pkg.Input,
|
|
6614
7557
|
{
|
|
6615
7558
|
asChild: true,
|
|
6616
7559
|
value: searchValue,
|
|
6617
7560
|
onValueChange: onSearchValueChange,
|
|
6618
7561
|
children: /* @__PURE__ */ jsx(
|
|
6619
|
-
Input,
|
|
7562
|
+
Input$1,
|
|
6620
7563
|
{
|
|
6621
7564
|
variant: "cell",
|
|
6622
7565
|
placeholder: searchPlaceholder,
|
|
@@ -6651,9 +7594,9 @@ const CommandMenu = forwardRef(
|
|
|
6651
7594
|
variant,
|
|
6652
7595
|
iconPlacement,
|
|
6653
7596
|
asChild: true,
|
|
6654
|
-
children: /* @__PURE__ */ jsxs(
|
|
7597
|
+
children: /* @__PURE__ */ jsxs(pkg.List, { label: listLabel, children: [
|
|
6655
7598
|
loading && /* @__PURE__ */ jsx(
|
|
6656
|
-
|
|
7599
|
+
pkg.Loading,
|
|
6657
7600
|
{
|
|
6658
7601
|
label: loadingLabel,
|
|
6659
7602
|
progress: loadingProgress,
|
|
@@ -6674,7 +7617,7 @@ const CommandMenu = forwardRef(
|
|
|
6674
7617
|
}
|
|
6675
7618
|
),
|
|
6676
7619
|
!loading && /* @__PURE__ */ jsx(
|
|
6677
|
-
|
|
7620
|
+
pkg.Empty,
|
|
6678
7621
|
{
|
|
6679
7622
|
...emptyMessageProps,
|
|
6680
7623
|
className: cx(
|
|
@@ -6763,7 +7706,7 @@ const CommandMenuDialog = forwardRef(function CommandMenuDialog2({
|
|
|
6763
7706
|
const CommandMenuGroup = forwardRef(function CommandMenuGroup2({ label, className, ...otherProps }, forwardedRef) {
|
|
6764
7707
|
const prefix = usePrefix();
|
|
6765
7708
|
return /* @__PURE__ */ jsx(
|
|
6766
|
-
|
|
7709
|
+
pkg.Group,
|
|
6767
7710
|
{
|
|
6768
7711
|
...otherProps,
|
|
6769
7712
|
heading: label,
|
|
@@ -6839,7 +7782,7 @@ const CommandMenuItem = forwardRef(function CommandMenuItem2({
|
|
|
6839
7782
|
keybindsProps,
|
|
6840
7783
|
asChild: true,
|
|
6841
7784
|
children: /* @__PURE__ */ jsx(
|
|
6842
|
-
|
|
7785
|
+
pkg.Item,
|
|
6843
7786
|
{
|
|
6844
7787
|
disabled,
|
|
6845
7788
|
...otherProps,
|
|
@@ -6861,6 +7804,7 @@ function useCreateSelectContext({
|
|
|
6861
7804
|
status,
|
|
6862
7805
|
disabled,
|
|
6863
7806
|
readOnly,
|
|
7807
|
+
valueTagCloseButtonLabel,
|
|
6864
7808
|
valueTagProps
|
|
6865
7809
|
}) {
|
|
6866
7810
|
const store = useConstant(
|
|
@@ -6891,6 +7835,7 @@ function useCreateSelectContext({
|
|
|
6891
7835
|
status,
|
|
6892
7836
|
disabled,
|
|
6893
7837
|
readOnly,
|
|
7838
|
+
valueTagCloseButtonLabel,
|
|
6894
7839
|
valueTagProps,
|
|
6895
7840
|
store
|
|
6896
7841
|
}),
|
|
@@ -6902,6 +7847,7 @@ function useCreateSelectContext({
|
|
|
6902
7847
|
status,
|
|
6903
7848
|
store,
|
|
6904
7849
|
value,
|
|
7850
|
+
valueTagCloseButtonLabel,
|
|
6905
7851
|
valueTagProps
|
|
6906
7852
|
]
|
|
6907
7853
|
);
|
|
@@ -6933,7 +7879,7 @@ const Option = memo(
|
|
|
6933
7879
|
onOptionSelect,
|
|
6934
7880
|
store
|
|
6935
7881
|
} = useSelectContext();
|
|
6936
|
-
const { registerOption, unregisterOption } = useStore(
|
|
7882
|
+
const { registerOption, unregisterOption } = useStore$1(
|
|
6937
7883
|
store,
|
|
6938
7884
|
(state) => state.actions
|
|
6939
7885
|
);
|
|
@@ -6962,7 +7908,7 @@ const Option = memo(
|
|
|
6962
7908
|
value: textValue,
|
|
6963
7909
|
onSelect: onOptionSelect,
|
|
6964
7910
|
selected,
|
|
6965
|
-
"aria-
|
|
7911
|
+
"aria-selected": selected || void 0,
|
|
6966
7912
|
disabled,
|
|
6967
7913
|
color,
|
|
6968
7914
|
icon: selected ? faCheck : void 0,
|
|
@@ -7042,7 +7988,8 @@ const Tag = forwardRef(function Tag2({
|
|
|
7042
7988
|
{
|
|
7043
7989
|
...containerProps,
|
|
7044
7990
|
className: cx(prefix("tag__container"), containerProps?.className),
|
|
7045
|
-
|
|
7991
|
+
asChild: true,
|
|
7992
|
+
children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsxs(
|
|
7046
7993
|
As,
|
|
7047
7994
|
{
|
|
7048
7995
|
className: cx(
|
|
@@ -7080,7 +8027,7 @@ const Tag = forwardRef(function Tag2({
|
|
|
7080
8027
|
) })
|
|
7081
8028
|
]
|
|
7082
8029
|
}
|
|
7083
|
-
)
|
|
8030
|
+
) })
|
|
7084
8031
|
}
|
|
7085
8032
|
)
|
|
7086
8033
|
}
|
|
@@ -7095,10 +8042,11 @@ function SelectMultipleValue() {
|
|
|
7095
8042
|
status,
|
|
7096
8043
|
disabled,
|
|
7097
8044
|
readOnly,
|
|
8045
|
+
valueTagCloseButtonLabel,
|
|
7098
8046
|
valueTagProps,
|
|
7099
8047
|
store
|
|
7100
8048
|
} = useSelectContext();
|
|
7101
|
-
useStore(store, (state) => state.actions.getOptionState(value));
|
|
8049
|
+
useStore$1(store, (state) => state.actions.getOptionState(value));
|
|
7102
8050
|
const handleCloseValueTag = useCallback(
|
|
7103
8051
|
(tagValue, evt) => {
|
|
7104
8052
|
evt.preventDefault();
|
|
@@ -7110,7 +8058,7 @@ function SelectMultipleValue() {
|
|
|
7110
8058
|
() => Array.from(new Set(value)),
|
|
7111
8059
|
[value]
|
|
7112
8060
|
);
|
|
7113
|
-
const valuesOptionStates = useStore(
|
|
8061
|
+
const valuesOptionStates = useStore$1(
|
|
7114
8062
|
store,
|
|
7115
8063
|
useShallow(
|
|
7116
8064
|
(state) => valuesToRender.map((v) => state.actions.getOptionState(v))
|
|
@@ -7124,57 +8072,65 @@ function SelectMultipleValue() {
|
|
|
7124
8072
|
[valuesOptionStates]
|
|
7125
8073
|
);
|
|
7126
8074
|
const valuesTags = useMemo(
|
|
7127
|
-
() =>
|
|
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
|
-
className: cx(
|
|
7156
|
-
prefix("select__value-tag-container"),
|
|
7157
|
-
valueTagProps?.containerProps?.className
|
|
7158
|
-
),
|
|
7159
|
-
...valueTagProps?.containerProps
|
|
7160
|
-
},
|
|
7161
|
-
contentProps: {
|
|
8075
|
+
() => intersperse(
|
|
8076
|
+
valuesToRender.map((v, i) => {
|
|
8077
|
+
const optionState = valuesOptionStates[i];
|
|
8078
|
+
return optionState && /* @__PURE__ */ jsx(
|
|
8079
|
+
Tag,
|
|
8080
|
+
{
|
|
8081
|
+
variant: "subtle",
|
|
8082
|
+
...valueTagProps,
|
|
8083
|
+
showCloseButton: !optionState.disabled,
|
|
8084
|
+
closeButtonProps: {
|
|
8085
|
+
label: null,
|
|
8086
|
+
tooltipContent: valueTagCloseButtonLabel,
|
|
8087
|
+
asChild: true,
|
|
8088
|
+
children: /* @__PURE__ */ jsx("span", {}),
|
|
8089
|
+
type: void 0,
|
|
8090
|
+
disabled,
|
|
8091
|
+
"data-disabled": boolDataAttr(disabled),
|
|
8092
|
+
// Prevent element from gaining focus
|
|
8093
|
+
onMouseDown: (evt) => evt.preventDefault(),
|
|
8094
|
+
onClick: (evt) => handleCloseValueTag(v, evt),
|
|
8095
|
+
// Override collapsible aria properties
|
|
8096
|
+
"aria-controls": void 0,
|
|
8097
|
+
"aria-expanded": void 0,
|
|
8098
|
+
// Override tooltip aria properties
|
|
8099
|
+
"aria-describedby": void 0,
|
|
8100
|
+
...valueTagProps?.closeButtonProps
|
|
8101
|
+
},
|
|
8102
|
+
color: optionState.color ?? controlStatusToAccent(status, "primary"),
|
|
7162
8103
|
className: cx(
|
|
7163
|
-
prefix("select__value-tag
|
|
7164
|
-
valueTagProps?.
|
|
8104
|
+
prefix("select__value-tag"),
|
|
8105
|
+
valueTagProps?.className
|
|
7165
8106
|
),
|
|
7166
|
-
|
|
8107
|
+
containerProps: {
|
|
8108
|
+
className: cx(
|
|
8109
|
+
prefix("select__value-tag-container"),
|
|
8110
|
+
valueTagProps?.containerProps?.className
|
|
8111
|
+
),
|
|
8112
|
+
...valueTagProps?.containerProps
|
|
8113
|
+
},
|
|
8114
|
+
contentProps: {
|
|
8115
|
+
className: cx(
|
|
8116
|
+
prefix("select__value-tag-content"),
|
|
8117
|
+
valueTagProps?.contentProps?.className
|
|
8118
|
+
),
|
|
8119
|
+
...valueTagProps?.contentProps
|
|
8120
|
+
},
|
|
8121
|
+
children: optionState.content
|
|
7167
8122
|
},
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
)
|
|
7172
|
-
|
|
8123
|
+
v
|
|
8124
|
+
);
|
|
8125
|
+
}),
|
|
8126
|
+
(i) => /* @__PURE__ */ jsx(VisuallyHidden, { children: ", " }, `separator-${i}`)
|
|
8127
|
+
),
|
|
7173
8128
|
[
|
|
7174
8129
|
disabled,
|
|
7175
8130
|
handleCloseValueTag,
|
|
7176
8131
|
prefix,
|
|
7177
8132
|
status,
|
|
8133
|
+
valueTagCloseButtonLabel,
|
|
7178
8134
|
valueTagProps,
|
|
7179
8135
|
valuesOptionStates,
|
|
7180
8136
|
valuesToRender
|
|
@@ -7182,15 +8138,12 @@ function SelectMultipleValue() {
|
|
|
7182
8138
|
);
|
|
7183
8139
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7184
8140
|
valuesToRender.length > 0 && readOnly && valuesList,
|
|
7185
|
-
valuesToRender.length > 0 && !readOnly &&
|
|
7186
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { children: valuesList }),
|
|
7187
|
-
valuesTags
|
|
7188
|
-
] })
|
|
8141
|
+
valuesToRender.length > 0 && !readOnly && valuesTags
|
|
7189
8142
|
] });
|
|
7190
8143
|
}
|
|
7191
8144
|
function SelectSingleValue() {
|
|
7192
8145
|
const { value, store } = useSelectContext();
|
|
7193
|
-
return useStore(
|
|
8146
|
+
return useStore$1(
|
|
7194
8147
|
store,
|
|
7195
8148
|
(state) => state.actions.getOptionState(value)?.content
|
|
7196
8149
|
);
|
|
@@ -7219,12 +8172,15 @@ const Select = forwardRef(function Select2({
|
|
|
7219
8172
|
startAdornment,
|
|
7220
8173
|
endAdornment,
|
|
7221
8174
|
showClearButton = "auto",
|
|
8175
|
+
clearDescription,
|
|
8176
|
+
searchLabel,
|
|
7222
8177
|
optionsLabel,
|
|
7223
8178
|
loadingOptions,
|
|
7224
8179
|
loadingOptionsLabel,
|
|
7225
8180
|
loadingOptionsProgress,
|
|
7226
8181
|
showSpinner = loading || loadingOptions,
|
|
7227
8182
|
emptyMessage,
|
|
8183
|
+
valueTagCloseButtonLabel,
|
|
7228
8184
|
valueTagMaxWidth,
|
|
7229
8185
|
onKeyDown,
|
|
7230
8186
|
onBlurToOutside,
|
|
@@ -7240,17 +8196,28 @@ const Select = forwardRef(function Select2({
|
|
|
7240
8196
|
popoverProps,
|
|
7241
8197
|
commandMenuProps,
|
|
7242
8198
|
style,
|
|
8199
|
+
"aria-label": ariaLabel,
|
|
8200
|
+
"aria-labelledby": ariaLabelledBy,
|
|
7243
8201
|
children,
|
|
7244
8202
|
...otherProps
|
|
7245
8203
|
}, forwardedRef) {
|
|
7246
8204
|
const prefix = usePrefix();
|
|
8205
|
+
const { cssVarStyle } = useCssVars();
|
|
7247
8206
|
const [locale7] = useLocale();
|
|
8207
|
+
placeholder ??= locale7.Select.placeholder;
|
|
8208
|
+
searchLabel ??= locale7.Select.searchLabel;
|
|
7248
8209
|
searchPlaceholder ??= locale7.Select.searchPlaceholder;
|
|
7249
8210
|
emptyMessage ??= locale7.Select.emptyMessage;
|
|
8211
|
+
valueTagCloseButtonLabel ??= locale7.Select.valueTagCloseButtonLabel;
|
|
7250
8212
|
optionsLabel ??= locale7.Select.optionsLabel;
|
|
7251
8213
|
loadingOptionsLabel ??= locale7.Select.loadingOptionsLabel;
|
|
7252
|
-
|
|
8214
|
+
clearDescription ??= locale7.Select.clearDescription;
|
|
7253
8215
|
const labelId = useFieldLabelId();
|
|
8216
|
+
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
8217
|
+
const generatedId = useId();
|
|
8218
|
+
const codeId = code ? codeProps?.id ?? prefix(`select-code-${generatedId}`) : void 0;
|
|
8219
|
+
const valueId = valueProps?.id ?? prefix(`select-value-${generatedId}`);
|
|
8220
|
+
const ariaLabelId = ariaLabel && prefix(`select-aria-label-${generatedId}`);
|
|
7254
8221
|
const { printHidden } = usePrintClassNames();
|
|
7255
8222
|
const [open, setOpen] = useControllableState(
|
|
7256
8223
|
defaultOpen ?? false,
|
|
@@ -7271,6 +8238,7 @@ const Select = forwardRef(function Select2({
|
|
|
7271
8238
|
const isEmpty = multiple ? actualValue.length === 0 : actualValue === "";
|
|
7272
8239
|
const buttonRef = useRef(null);
|
|
7273
8240
|
const popoverRef = useRef(null);
|
|
8241
|
+
const searchRef = useRef(null);
|
|
7274
8242
|
const handleContainerPointerDown = useCallback(
|
|
7275
8243
|
(evt) => {
|
|
7276
8244
|
evt.preventDefault();
|
|
@@ -7288,6 +8256,11 @@ const Select = forwardRef(function Select2({
|
|
|
7288
8256
|
const newValue = actualValue.includes(optionValue) ? actualValue.filter((v) => v !== optionValue) : [...actualValue, optionValue];
|
|
7289
8257
|
setValue(newValue);
|
|
7290
8258
|
onValueChange?.(newValue);
|
|
8259
|
+
if (open) {
|
|
8260
|
+
searchRef.current?.focus();
|
|
8261
|
+
} else {
|
|
8262
|
+
buttonRef.current?.focus();
|
|
8263
|
+
}
|
|
7291
8264
|
} else {
|
|
7292
8265
|
if (optionValue !== actualValue) {
|
|
7293
8266
|
setValue(optionValue);
|
|
@@ -7303,6 +8276,7 @@ const Select = forwardRef(function Select2({
|
|
|
7303
8276
|
multiple,
|
|
7304
8277
|
onSearchValueChange,
|
|
7305
8278
|
onValueChange,
|
|
8279
|
+
open,
|
|
7306
8280
|
setOpen,
|
|
7307
8281
|
setSearchValue,
|
|
7308
8282
|
setValue
|
|
@@ -7347,6 +8321,7 @@ const Select = forwardRef(function Select2({
|
|
|
7347
8321
|
status,
|
|
7348
8322
|
disabled: disabled || loading,
|
|
7349
8323
|
readOnly,
|
|
8324
|
+
valueTagCloseButtonLabel,
|
|
7350
8325
|
valueTagProps
|
|
7351
8326
|
});
|
|
7352
8327
|
const registeringOptionsSelectContext = useMemo(
|
|
@@ -7360,6 +8335,10 @@ const Select = forwardRef(function Select2({
|
|
|
7360
8335
|
);
|
|
7361
8336
|
const combinedButtonRef = useCombinedRef(buttonRef, forwardedRef);
|
|
7362
8337
|
const combinedPopoverRef = useCombinedRef(popoverRef, popoverProps?.ref);
|
|
8338
|
+
const combinedSearchRef = useCombinedRef(
|
|
8339
|
+
searchRef,
|
|
8340
|
+
commandMenuProps?.searchProps?.ref
|
|
8341
|
+
);
|
|
7363
8342
|
return /* @__PURE__ */ jsxs(SelectContext.Provider, { value: selectContext, children: [
|
|
7364
8343
|
/* @__PURE__ */ jsx(SelectContext.Provider, { value: registeringOptionsSelectContext, children }),
|
|
7365
8344
|
/* @__PURE__ */ jsxs(
|
|
@@ -7372,8 +8351,6 @@ const Select = forwardRef(function Select2({
|
|
|
7372
8351
|
PopoverTrigger,
|
|
7373
8352
|
{
|
|
7374
8353
|
className: cx(prefix("select"), className),
|
|
7375
|
-
role: "combobox",
|
|
7376
|
-
"aria-autocomplete": "none",
|
|
7377
8354
|
"data-multiple": boolDataAttr(multiple),
|
|
7378
8355
|
"data-limit-value-tags-width": boolDataAttr(valueTagMaxWidth != null),
|
|
7379
8356
|
onKeyDown: combineEventHandlers(onKeyDown, handleKeyDown),
|
|
@@ -7417,9 +8394,10 @@ const Select = forwardRef(function Select2({
|
|
|
7417
8394
|
endAdornment
|
|
7418
8395
|
] }),
|
|
7419
8396
|
showClearButton: showClearButton === "auto" ? !isEmpty : showClearButton,
|
|
8397
|
+
clearDescription,
|
|
7420
8398
|
onBlurToOutside: handleControlBlur,
|
|
7421
8399
|
rootProps,
|
|
7422
|
-
codeProps,
|
|
8400
|
+
codeProps: { ...codeProps, id: codeId },
|
|
7423
8401
|
containerProps: {
|
|
7424
8402
|
// Propagate open state to container for styling purposes
|
|
7425
8403
|
...{ "data-state": showOpen ? "open" : "closed" },
|
|
@@ -7446,6 +8424,11 @@ const Select = forwardRef(function Select2({
|
|
|
7446
8424
|
),
|
|
7447
8425
|
ref: combinedClearButtonRef
|
|
7448
8426
|
},
|
|
8427
|
+
...open ? {} : { "aria-controls": void 0 },
|
|
8428
|
+
"aria-labelledby": combineAriaIds(
|
|
8429
|
+
ariaLabelledBy ?? ariaLabelId ?? combineAriaIds(codeId, labelId ?? dataTableColumnLabelId),
|
|
8430
|
+
valueId
|
|
8431
|
+
),
|
|
7449
8432
|
spinnerProps: {
|
|
7450
8433
|
...spinnerProps,
|
|
7451
8434
|
className: cx(prefix("select__spinner"), spinnerProps?.className)
|
|
@@ -7455,8 +8438,10 @@ const Select = forwardRef(function Select2({
|
|
|
7455
8438
|
"span",
|
|
7456
8439
|
{
|
|
7457
8440
|
...valueProps,
|
|
8441
|
+
id: valueId,
|
|
7458
8442
|
className: cx(prefix("select__value"), valueProps?.className),
|
|
7459
8443
|
children: [
|
|
8444
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: ", " }),
|
|
7460
8445
|
isEmpty && placeholder,
|
|
7461
8446
|
!isEmpty && !multiple && /* @__PURE__ */ jsx(SelectSingleValue, {}),
|
|
7462
8447
|
!isEmpty && multiple && /* @__PURE__ */ jsx(SelectMultipleValue, {})
|
|
@@ -7489,6 +8474,7 @@ const Select = forwardRef(function Select2({
|
|
|
7489
8474
|
...commandMenuProps,
|
|
7490
8475
|
searchPlaceholder,
|
|
7491
8476
|
emptyMessage,
|
|
8477
|
+
label: searchLabel,
|
|
7492
8478
|
listLabel: optionsLabel,
|
|
7493
8479
|
loading: loadingOptions,
|
|
7494
8480
|
loadingLabel: loadingOptionsLabel,
|
|
@@ -7499,7 +8485,10 @@ const Select = forwardRef(function Select2({
|
|
|
7499
8485
|
onSearchValueChange,
|
|
7500
8486
|
setSearchValue
|
|
7501
8487
|
),
|
|
7502
|
-
searchProps: {
|
|
8488
|
+
searchProps: {
|
|
8489
|
+
...commandMenuProps?.searchProps,
|
|
8490
|
+
ref: combinedSearchRef
|
|
8491
|
+
},
|
|
7503
8492
|
listProps: {
|
|
7504
8493
|
"aria-multiselectable": multiple ? true : void 0,
|
|
7505
8494
|
...commandMenuProps?.listProps
|
|
@@ -7511,7 +8500,8 @@ const Select = forwardRef(function Select2({
|
|
|
7511
8500
|
)
|
|
7512
8501
|
]
|
|
7513
8502
|
}
|
|
7514
|
-
)
|
|
8503
|
+
),
|
|
8504
|
+
ariaLabelId && /* @__PURE__ */ jsx("span", { hidden: true, id: ariaLabelId, children: ariaLabel })
|
|
7515
8505
|
] });
|
|
7516
8506
|
});
|
|
7517
8507
|
const CAPTION_FORMAT = "LLLL y";
|
|
@@ -7736,6 +8726,18 @@ const CalendarHeader = memo(function CalendarHeader2({
|
|
|
7736
8726
|
}
|
|
7737
8727
|
);
|
|
7738
8728
|
});
|
|
8729
|
+
const CalendarMonthGrid = memo(function CalendarMonthGrid2({
|
|
8730
|
+
children,
|
|
8731
|
+
"aria-label": ariaLabel,
|
|
8732
|
+
...otherProps
|
|
8733
|
+
}) {
|
|
8734
|
+
const prefix = usePrefix();
|
|
8735
|
+
const captionId = prefix(`calendar-grid-caption-${useId()}`);
|
|
8736
|
+
return /* @__PURE__ */ jsxs("table", { ...otherProps, "aria-labelledby": captionId, children: [
|
|
8737
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsx("caption", { id: captionId, children: ariaLabel }) }),
|
|
8738
|
+
children
|
|
8739
|
+
] });
|
|
8740
|
+
});
|
|
7739
8741
|
function Calendar({
|
|
7740
8742
|
required,
|
|
7741
8743
|
minDate,
|
|
@@ -7878,6 +8880,7 @@ function Calendar({
|
|
|
7878
8880
|
disabled: composedDisabled,
|
|
7879
8881
|
components: {
|
|
7880
8882
|
MonthCaption: CalendarHeader,
|
|
8883
|
+
MonthGrid: CalendarMonthGrid,
|
|
7881
8884
|
Day: CalendarDay,
|
|
7882
8885
|
Nav: () => null
|
|
7883
8886
|
},
|
|
@@ -8036,87 +9039,89 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
8036
9039
|
ControlContext.Provider,
|
|
8037
9040
|
{
|
|
8038
9041
|
value: { variant, status, disabled, loading, readOnly },
|
|
8039
|
-
children: /* @__PURE__ */
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
onMouseDown: combineEventHandlers(onMouseDown, handleMouseDown),
|
|
8054
|
-
onFocus: combineEventHandlers(onFocus, handleFocus),
|
|
8055
|
-
onBlur: combineEventHandlers(onBlur, handleBlur),
|
|
8056
|
-
"aria-disabled": loading || readOnly || void 0,
|
|
8057
|
-
"aria-label": ariaLabel,
|
|
8058
|
-
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 ? combineAriaIds(codeId, labelId ?? dataTableColumnLabelId) : void 0),
|
|
8059
|
-
tabIndex,
|
|
8060
|
-
ref: combinedCheckboxGroupRef,
|
|
8061
|
-
children: [
|
|
8062
|
-
code != null && typeof code !== "boolean" && /* @__PURE__ */ jsx(
|
|
8063
|
-
ControlCode,
|
|
8064
|
-
{
|
|
8065
|
-
status,
|
|
8066
|
-
...codeProps,
|
|
8067
|
-
id: codeId,
|
|
8068
|
-
className: cx(
|
|
8069
|
-
prefix("checkbox-group__code"),
|
|
8070
|
-
codeProps?.className
|
|
8071
|
-
),
|
|
8072
|
-
children: code
|
|
8073
|
-
}
|
|
8074
|
-
),
|
|
8075
|
-
/* @__PURE__ */ jsx(
|
|
8076
|
-
"div",
|
|
8077
|
-
{
|
|
8078
|
-
"data-status": status,
|
|
8079
|
-
"data-variant": variant,
|
|
8080
|
-
"data-disabled": boolDataAttr(disabled || loading),
|
|
8081
|
-
"data-readonly": boolDataAttr(readOnly),
|
|
8082
|
-
...containerProps,
|
|
8083
|
-
className: cx(
|
|
8084
|
-
prefix("checkbox-group__container"),
|
|
8085
|
-
containerProps?.className
|
|
8086
|
-
),
|
|
8087
|
-
children: /* @__PURE__ */ jsx(ClearContexts, { children })
|
|
8088
|
-
}
|
|
8089
|
-
),
|
|
8090
|
-
showSpinner && /* @__PURE__ */ jsx(
|
|
8091
|
-
"div",
|
|
8092
|
-
{
|
|
8093
|
-
"data-status": status,
|
|
8094
|
-
"data-variant": variant,
|
|
8095
|
-
"data-disabled": boolDataAttr(disabled || loading),
|
|
8096
|
-
"data-readonly": boolDataAttr(readOnly),
|
|
8097
|
-
...endContainerProps,
|
|
8098
|
-
className: cx(
|
|
8099
|
-
prefix("checkbox-group__end-container"),
|
|
8100
|
-
endContainerProps?.className
|
|
8101
|
-
),
|
|
8102
|
-
children: /* @__PURE__ */ jsx(
|
|
8103
|
-
Spinner,
|
|
8104
|
-
{
|
|
8105
|
-
color: controlStatusToAccent(status, "neutral"),
|
|
8106
|
-
"data-disabled": boolDataAttr(disabled || loading),
|
|
8107
|
-
...spinnerProps,
|
|
8108
|
-
className: cx(
|
|
8109
|
-
prefix("checkbox-group__spinner"),
|
|
8110
|
-
spinnerProps?.className
|
|
8111
|
-
)
|
|
8112
|
-
}
|
|
8113
|
-
)
|
|
8114
|
-
}
|
|
9042
|
+
children: /* @__PURE__ */ jsxs(CheckboxGroupContext.Provider, { value: checkboxGroupContextValue, children: [
|
|
9043
|
+
/* @__PURE__ */ jsxs(
|
|
9044
|
+
"div",
|
|
9045
|
+
{
|
|
9046
|
+
role: "group",
|
|
9047
|
+
id: controlId,
|
|
9048
|
+
...otherProps,
|
|
9049
|
+
"data-status": status,
|
|
9050
|
+
"data-accent": controlStatusToAccent(status),
|
|
9051
|
+
"data-variant": variant,
|
|
9052
|
+
className: cx(
|
|
9053
|
+
prefix("checkbox-group"),
|
|
9054
|
+
inline && prefix("checkbox-group--inline"),
|
|
9055
|
+
className
|
|
8115
9056
|
),
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
9057
|
+
onMouseDown: combineEventHandlers(onMouseDown, handleMouseDown),
|
|
9058
|
+
onFocus: combineEventHandlers(onFocus, handleFocus),
|
|
9059
|
+
onBlur: combineEventHandlers(onBlur, handleBlur),
|
|
9060
|
+
"aria-disabled": loading || readOnly || void 0,
|
|
9061
|
+
"aria-label": ariaLabel,
|
|
9062
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 ? combineAriaIds(codeId, labelId ?? dataTableColumnLabelId) : void 0),
|
|
9063
|
+
tabIndex,
|
|
9064
|
+
ref: combinedCheckboxGroupRef,
|
|
9065
|
+
children: [
|
|
9066
|
+
code != null && typeof code !== "boolean" && /* @__PURE__ */ jsx(
|
|
9067
|
+
ControlCode,
|
|
9068
|
+
{
|
|
9069
|
+
status,
|
|
9070
|
+
...codeProps,
|
|
9071
|
+
id: codeId,
|
|
9072
|
+
className: cx(
|
|
9073
|
+
prefix("checkbox-group__code"),
|
|
9074
|
+
codeProps?.className
|
|
9075
|
+
),
|
|
9076
|
+
children: code
|
|
9077
|
+
}
|
|
9078
|
+
),
|
|
9079
|
+
/* @__PURE__ */ jsx(
|
|
9080
|
+
"div",
|
|
9081
|
+
{
|
|
9082
|
+
"data-status": status,
|
|
9083
|
+
"data-variant": variant,
|
|
9084
|
+
"data-disabled": boolDataAttr(disabled || loading),
|
|
9085
|
+
"data-readonly": boolDataAttr(readOnly),
|
|
9086
|
+
...containerProps,
|
|
9087
|
+
className: cx(
|
|
9088
|
+
prefix("checkbox-group__container"),
|
|
9089
|
+
containerProps?.className
|
|
9090
|
+
),
|
|
9091
|
+
children: /* @__PURE__ */ jsx(ClearContexts, { children })
|
|
9092
|
+
}
|
|
9093
|
+
),
|
|
9094
|
+
showSpinner && /* @__PURE__ */ jsx(
|
|
9095
|
+
"div",
|
|
9096
|
+
{
|
|
9097
|
+
"data-status": status,
|
|
9098
|
+
"data-variant": variant,
|
|
9099
|
+
"data-disabled": boolDataAttr(disabled || loading),
|
|
9100
|
+
"data-readonly": boolDataAttr(readOnly),
|
|
9101
|
+
...endContainerProps,
|
|
9102
|
+
className: cx(
|
|
9103
|
+
prefix("checkbox-group__end-container"),
|
|
9104
|
+
endContainerProps?.className
|
|
9105
|
+
),
|
|
9106
|
+
children: /* @__PURE__ */ jsx(
|
|
9107
|
+
Spinner,
|
|
9108
|
+
{
|
|
9109
|
+
color: controlStatusToAccent(status, "neutral"),
|
|
9110
|
+
"data-disabled": boolDataAttr(disabled || loading),
|
|
9111
|
+
...spinnerProps,
|
|
9112
|
+
className: cx(
|
|
9113
|
+
prefix("checkbox-group__spinner"),
|
|
9114
|
+
spinnerProps?.className
|
|
9115
|
+
)
|
|
9116
|
+
}
|
|
9117
|
+
)
|
|
9118
|
+
}
|
|
9119
|
+
)
|
|
9120
|
+
]
|
|
9121
|
+
}
|
|
9122
|
+
),
|
|
9123
|
+
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription })
|
|
9124
|
+
] })
|
|
8120
9125
|
}
|
|
8121
9126
|
) });
|
|
8122
9127
|
});
|
|
@@ -8444,7 +9449,7 @@ const DateInput = forwardRef(
|
|
|
8444
9449
|
showClearButton,
|
|
8445
9450
|
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8446
9451
|
endAdornment,
|
|
8447
|
-
/* @__PURE__ */ jsx(Tooltip, { content: calendarButtonLabel, children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */
|
|
9452
|
+
/* @__PURE__ */ jsx(Tooltip, { content: calendarButtonLabel, children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(
|
|
8448
9453
|
"button",
|
|
8449
9454
|
{
|
|
8450
9455
|
className: printHidden,
|
|
@@ -8453,10 +9458,7 @@ const DateInput = forwardRef(
|
|
|
8453
9458
|
"data-state": void 0,
|
|
8454
9459
|
ref: addonButtonRef,
|
|
8455
9460
|
"aria-describedby": selectedDateDescriptionId,
|
|
8456
|
-
children:
|
|
8457
|
-
/* @__PURE__ */ jsx(Icon, { icon: faCalendar }),
|
|
8458
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { children: calendarButtonLabel })
|
|
8459
|
-
]
|
|
9461
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: faCalendar, label: calendarButtonLabel })
|
|
8460
9462
|
}
|
|
8461
9463
|
) }) }) })
|
|
8462
9464
|
] }),
|
|
@@ -9077,402 +10079,401 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9077
10079
|
popoverRef,
|
|
9078
10080
|
popoverContentProps?.ref
|
|
9079
10081
|
);
|
|
9080
|
-
return /* @__PURE__ */ jsx(ClearContexts, { field: false, children: /* @__PURE__ */
|
|
10082
|
+
return /* @__PURE__ */ jsx(ClearContexts, { field: false, children: /* @__PURE__ */ jsxs(
|
|
9081
10083
|
ControlContext.Provider,
|
|
9082
10084
|
{
|
|
9083
10085
|
value: { variant, status, disabled, loading, readOnly },
|
|
9084
|
-
children:
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
disabled
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
popoverAnchorProps?.className
|
|
9140
|
-
),
|
|
9141
|
-
children: [
|
|
9142
|
-
startAdornment,
|
|
9143
|
-
/* @__PURE__ */ jsxs(
|
|
9144
|
-
"div",
|
|
9145
|
-
{
|
|
9146
|
-
"data-focused": boolDataAttr(
|
|
9147
|
-
!disabled && !startInputProps?.disabled && popoverState.open && selectionMode === "start"
|
|
9148
|
-
),
|
|
9149
|
-
"data-status": status,
|
|
9150
|
-
"data-accent": controlStatusToAccent(status),
|
|
9151
|
-
"data-variant": variant,
|
|
9152
|
-
"data-disabled": boolDataAttr(
|
|
9153
|
-
disabled || loading || startInputProps?.disabled && endInputProps?.disabled
|
|
9154
|
-
),
|
|
9155
|
-
"data-readonly": boolDataAttr(
|
|
9156
|
-
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
9157
|
-
),
|
|
9158
|
-
...startContainerProps,
|
|
9159
|
-
className: cx(
|
|
9160
|
-
prefix("date-range-input__container"),
|
|
9161
|
-
prefix("date-range-input__container--start"),
|
|
9162
|
-
startContainerProps?.className
|
|
9163
|
-
),
|
|
9164
|
-
onPointerDown: combineEventHandlers(
|
|
9165
|
-
startContainerProps?.onPointerDown,
|
|
9166
|
-
handleContainerPointerDown("start")
|
|
9167
|
-
),
|
|
9168
|
-
ref: combinedStartContainerRef,
|
|
9169
|
-
children: [
|
|
9170
|
-
/* @__PURE__ */ jsx(
|
|
9171
|
-
"input",
|
|
9172
|
-
{
|
|
9173
|
-
...startInputProps,
|
|
9174
|
-
id: controlId,
|
|
9175
|
-
"data-loading": boolDataAttr(loading),
|
|
9176
|
-
"data-status": status,
|
|
9177
|
-
"data-variant": variant,
|
|
9178
|
-
className: cx(
|
|
9179
|
-
prefix("date-range-input"),
|
|
9180
|
-
prefix("date-range-input--start"),
|
|
9181
|
-
startInputProps?.className
|
|
9182
|
-
),
|
|
9183
|
-
value: formattedValue.start,
|
|
9184
|
-
placeholder: startInputProps?.placeholder ?? startPlaceholder ?? placeholder,
|
|
9185
|
-
required: required || startInputProps?.required,
|
|
9186
|
-
disabled: disabled || startInputProps?.disabled,
|
|
9187
|
-
readOnly: readOnly || loading || startInputProps?.readOnly,
|
|
9188
|
-
onChange: combineEventHandlers(
|
|
9189
|
-
startInputProps?.onChange,
|
|
9190
|
-
handleStartInputChange
|
|
9191
|
-
),
|
|
9192
|
-
onFocus: combineEventHandlers(
|
|
9193
|
-
startInputProps?.onFocus,
|
|
9194
|
-
handleInputFocus("start")
|
|
9195
|
-
),
|
|
9196
|
-
onBlur: combineEventHandlers(
|
|
9197
|
-
startInputProps?.onBlur,
|
|
9198
|
-
handleControlBlur
|
|
9199
|
-
),
|
|
9200
|
-
style: { ...cssVars, ...startInputProps?.style },
|
|
9201
|
-
...dataAttrs,
|
|
9202
|
-
"aria-invalid": status === "invalid" || void 0,
|
|
9203
|
-
"aria-labelledby": startInputProps?.["aria-labelledby"] ?? (startInputProps?.["aria-label"] === void 0 ? combineAriaIds(
|
|
9204
|
-
codeId,
|
|
9205
|
-
labelId ?? dataTableColumnLabelId,
|
|
9206
|
-
startInputLabelId
|
|
9207
|
-
) : void 0),
|
|
9208
|
-
"aria-describedby": combineAriaIds(
|
|
9209
|
-
loadingDescriptionId,
|
|
9210
|
-
errorMessageIds,
|
|
9211
|
-
startInputProps?.["aria-describedby"],
|
|
9212
|
-
descriptionIds,
|
|
9213
|
-
formatDescriptionId,
|
|
9214
|
-
selectedStartDateDescriptionId
|
|
9215
|
-
),
|
|
9216
|
-
ref: combinedStartInputRef
|
|
9217
|
-
}
|
|
10086
|
+
children: [
|
|
10087
|
+
/* @__PURE__ */ jsxs(
|
|
10088
|
+
"div",
|
|
10089
|
+
{
|
|
10090
|
+
"data-status": status,
|
|
10091
|
+
"data-accent": controlStatusToAccent(status),
|
|
10092
|
+
"data-variant": variant,
|
|
10093
|
+
"data-disabled": boolDataAttr(
|
|
10094
|
+
disabled || loading || startInputProps?.disabled && endInputProps?.disabled
|
|
10095
|
+
),
|
|
10096
|
+
"data-readonly": boolDataAttr(
|
|
10097
|
+
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
10098
|
+
),
|
|
10099
|
+
className: cx(prefix("date-range-input__root"), className),
|
|
10100
|
+
...otherProps,
|
|
10101
|
+
ref: forwardedRef,
|
|
10102
|
+
children: [
|
|
10103
|
+
code != null && typeof code !== "boolean" && /* @__PURE__ */ jsx(
|
|
10104
|
+
ControlCode,
|
|
10105
|
+
{
|
|
10106
|
+
...codeProps,
|
|
10107
|
+
id: codeId,
|
|
10108
|
+
className: cx(
|
|
10109
|
+
prefix("date-range-input__code"),
|
|
10110
|
+
codeProps?.className
|
|
10111
|
+
),
|
|
10112
|
+
children: code
|
|
10113
|
+
}
|
|
10114
|
+
),
|
|
10115
|
+
/* @__PURE__ */ jsxs(Popover, { open: popoverState.open, modal: popoverState.modal, children: [
|
|
10116
|
+
/* @__PURE__ */ jsxs(
|
|
10117
|
+
PopoverAnchor,
|
|
10118
|
+
{
|
|
10119
|
+
"data-status": status,
|
|
10120
|
+
"data-accent": controlStatusToAccent(status),
|
|
10121
|
+
"data-variant": variant,
|
|
10122
|
+
"data-disabled": boolDataAttr(
|
|
10123
|
+
disabled || loading || startInputProps?.disabled && endInputProps?.disabled
|
|
10124
|
+
),
|
|
10125
|
+
"data-readonly": boolDataAttr(
|
|
10126
|
+
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
10127
|
+
),
|
|
10128
|
+
...popoverAnchorProps,
|
|
10129
|
+
className: cx(
|
|
10130
|
+
prefix("date-range-input__container"),
|
|
10131
|
+
prefix("date-range-input__popover-anchor"),
|
|
10132
|
+
popoverAnchorProps?.className
|
|
10133
|
+
),
|
|
10134
|
+
children: [
|
|
10135
|
+
startAdornment,
|
|
10136
|
+
/* @__PURE__ */ jsxs(
|
|
10137
|
+
"div",
|
|
10138
|
+
{
|
|
10139
|
+
"data-focused": boolDataAttr(
|
|
10140
|
+
!disabled && !startInputProps?.disabled && popoverState.open && selectionMode === "start"
|
|
9218
10141
|
),
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
tabIndex: -1,
|
|
9225
|
-
...startClearButtonProps,
|
|
9226
|
-
className: cx(
|
|
9227
|
-
prefix("date-range-input__clear-button"),
|
|
9228
|
-
prefix("date-range-input__clear-button--start"),
|
|
9229
|
-
printHidden,
|
|
9230
|
-
startClearButtonProps?.className
|
|
9231
|
-
),
|
|
9232
|
-
onClick: combineEventHandlers(
|
|
9233
|
-
startClearButtonProps?.onClick,
|
|
9234
|
-
handleClearButtonClick(startInputRef),
|
|
9235
|
-
{ checkDefaultPrevented: true }
|
|
9236
|
-
),
|
|
9237
|
-
ref: combinedStartClearButtonRef
|
|
9238
|
-
}
|
|
10142
|
+
"data-status": status,
|
|
10143
|
+
"data-accent": controlStatusToAccent(status),
|
|
10144
|
+
"data-variant": variant,
|
|
10145
|
+
"data-disabled": boolDataAttr(
|
|
10146
|
+
disabled || loading || startInputProps?.disabled && endInputProps?.disabled
|
|
9239
10147
|
),
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
{
|
|
9243
|
-
color: controlStatusToAccent(status, "neutral"),
|
|
9244
|
-
"data-disabled": boolDataAttr(
|
|
9245
|
-
disabled || loading || startInputProps?.disabled
|
|
9246
|
-
),
|
|
9247
|
-
...spinnerProps,
|
|
9248
|
-
className: cx(
|
|
9249
|
-
prefix("date-range-input__spinner"),
|
|
9250
|
-
prefix("date-range-input__spinner--start"),
|
|
9251
|
-
spinnerProps?.className
|
|
9252
|
-
)
|
|
9253
|
-
}
|
|
9254
|
-
)
|
|
9255
|
-
]
|
|
9256
|
-
}
|
|
9257
|
-
),
|
|
9258
|
-
/* @__PURE__ */ jsx(ControlAddon, { className: cx(prefix("date-range-input__arrow")), children: /* @__PURE__ */ jsx(Icon, { icon: faArrowRight }) }),
|
|
9259
|
-
/* @__PURE__ */ jsxs(
|
|
9260
|
-
"div",
|
|
9261
|
-
{
|
|
9262
|
-
"data-focused": boolDataAttr(
|
|
9263
|
-
!disabled && !endInputProps?.disabled && popoverState.open && selectionMode === "end"
|
|
9264
|
-
),
|
|
9265
|
-
"data-status": status,
|
|
9266
|
-
"data-accent": controlStatusToAccent(status),
|
|
9267
|
-
"data-variant": variant,
|
|
9268
|
-
"data-disabled": boolDataAttr(
|
|
9269
|
-
disabled || loading || startInputProps?.disabled && endInputProps?.disabled
|
|
9270
|
-
),
|
|
9271
|
-
"data-readonly": boolDataAttr(
|
|
9272
|
-
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
9273
|
-
),
|
|
9274
|
-
...endContainerProps,
|
|
9275
|
-
className: cx(
|
|
9276
|
-
prefix("date-range-input__container"),
|
|
9277
|
-
prefix("date-range-input__container--end"),
|
|
9278
|
-
endContainerProps?.className
|
|
9279
|
-
),
|
|
9280
|
-
onPointerDown: combineEventHandlers(
|
|
9281
|
-
endContainerProps?.onPointerDown,
|
|
9282
|
-
handleContainerPointerDown("end")
|
|
9283
|
-
),
|
|
9284
|
-
ref: combinedEndContainerRef,
|
|
9285
|
-
children: [
|
|
9286
|
-
/* @__PURE__ */ jsx(
|
|
9287
|
-
"input",
|
|
9288
|
-
{
|
|
9289
|
-
...endInputProps,
|
|
9290
|
-
"data-loading": boolDataAttr(loading),
|
|
9291
|
-
"data-status": status,
|
|
9292
|
-
"data-variant": variant,
|
|
9293
|
-
className: cx(
|
|
9294
|
-
prefix("date-range-input"),
|
|
9295
|
-
prefix("date-range-input--end"),
|
|
9296
|
-
endInputProps?.className
|
|
9297
|
-
),
|
|
9298
|
-
value: formattedValue.end,
|
|
9299
|
-
placeholder: endInputProps?.placeholder ?? endPlaceholder ?? placeholder,
|
|
9300
|
-
required: required || endInputProps?.required,
|
|
9301
|
-
disabled: disabled || endInputProps?.disabled,
|
|
9302
|
-
readOnly: readOnly || loading || endInputProps?.readOnly,
|
|
9303
|
-
onChange: combineEventHandlers(
|
|
9304
|
-
endInputProps?.onChange,
|
|
9305
|
-
handleEndInputChange
|
|
9306
|
-
),
|
|
9307
|
-
onFocus: combineEventHandlers(
|
|
9308
|
-
endInputProps?.onFocus,
|
|
9309
|
-
handleInputFocus("end")
|
|
9310
|
-
),
|
|
9311
|
-
onBlur: combineEventHandlers(
|
|
9312
|
-
endInputProps?.onBlur,
|
|
9313
|
-
handleControlBlur
|
|
9314
|
-
),
|
|
9315
|
-
style: { ...cssVars, ...endInputProps?.style },
|
|
9316
|
-
...dataAttrs,
|
|
9317
|
-
"aria-invalid": status === "invalid" || void 0,
|
|
9318
|
-
"aria-labelledby": endInputProps?.["aria-labelledby"] ?? (endInputProps?.["aria-label"] === void 0 ? combineAriaIds(
|
|
9319
|
-
codeId,
|
|
9320
|
-
labelId ?? dataTableColumnLabelId,
|
|
9321
|
-
endInputLabelId
|
|
9322
|
-
) : void 0),
|
|
9323
|
-
"aria-describedby": combineAriaIds(
|
|
9324
|
-
loadingDescriptionId,
|
|
9325
|
-
errorMessageIds,
|
|
9326
|
-
endInputProps?.["aria-describedby"],
|
|
9327
|
-
descriptionIds,
|
|
9328
|
-
formatDescriptionId,
|
|
9329
|
-
selectedEndDateDescriptionId
|
|
9330
|
-
),
|
|
9331
|
-
ref: combinedEndInputRef
|
|
9332
|
-
}
|
|
10148
|
+
"data-readonly": boolDataAttr(
|
|
10149
|
+
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
9333
10150
|
),
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
tabIndex: -1,
|
|
9340
|
-
...endClearButtonProps,
|
|
9341
|
-
className: cx(
|
|
9342
|
-
prefix("date-range-input__clear-button"),
|
|
9343
|
-
prefix("date-range-input__clear-button--end"),
|
|
9344
|
-
printHidden,
|
|
9345
|
-
endClearButtonProps?.className
|
|
9346
|
-
),
|
|
9347
|
-
onClick: combineEventHandlers(
|
|
9348
|
-
endClearButtonProps?.onClick,
|
|
9349
|
-
handleClearButtonClick(endInputRef),
|
|
9350
|
-
{ checkDefaultPrevented: true }
|
|
9351
|
-
),
|
|
9352
|
-
ref: combinedEndClearButtonRef
|
|
9353
|
-
}
|
|
10151
|
+
...startContainerProps,
|
|
10152
|
+
className: cx(
|
|
10153
|
+
prefix("date-range-input__container"),
|
|
10154
|
+
prefix("date-range-input__container--start"),
|
|
10155
|
+
startContainerProps?.className
|
|
9354
10156
|
),
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
10157
|
+
onPointerDown: combineEventHandlers(
|
|
10158
|
+
startContainerProps?.onPointerDown,
|
|
10159
|
+
handleContainerPointerDown("start")
|
|
10160
|
+
),
|
|
10161
|
+
ref: combinedStartContainerRef,
|
|
10162
|
+
children: [
|
|
10163
|
+
/* @__PURE__ */ jsx(
|
|
10164
|
+
"input",
|
|
10165
|
+
{
|
|
10166
|
+
...startInputProps,
|
|
10167
|
+
id: controlId,
|
|
10168
|
+
"data-loading": boolDataAttr(loading),
|
|
10169
|
+
"data-status": status,
|
|
10170
|
+
"data-variant": variant,
|
|
10171
|
+
className: cx(
|
|
10172
|
+
prefix("date-range-input"),
|
|
10173
|
+
prefix("date-range-input--start"),
|
|
10174
|
+
startInputProps?.className
|
|
10175
|
+
),
|
|
10176
|
+
value: formattedValue.start,
|
|
10177
|
+
placeholder: startInputProps?.placeholder ?? startPlaceholder ?? placeholder,
|
|
10178
|
+
required: required || startInputProps?.required,
|
|
10179
|
+
disabled: disabled || startInputProps?.disabled,
|
|
10180
|
+
readOnly: readOnly || loading || startInputProps?.readOnly,
|
|
10181
|
+
onChange: combineEventHandlers(
|
|
10182
|
+
startInputProps?.onChange,
|
|
10183
|
+
handleStartInputChange
|
|
10184
|
+
),
|
|
10185
|
+
onFocus: combineEventHandlers(
|
|
10186
|
+
startInputProps?.onFocus,
|
|
10187
|
+
handleInputFocus("start")
|
|
10188
|
+
),
|
|
10189
|
+
onBlur: combineEventHandlers(
|
|
10190
|
+
startInputProps?.onBlur,
|
|
10191
|
+
handleControlBlur
|
|
10192
|
+
),
|
|
10193
|
+
style: { ...cssVars, ...startInputProps?.style },
|
|
10194
|
+
...dataAttrs,
|
|
10195
|
+
"aria-invalid": status === "invalid" || void 0,
|
|
10196
|
+
"aria-labelledby": startInputProps?.["aria-labelledby"] ?? (startInputProps?.["aria-label"] === void 0 ? combineAriaIds(
|
|
10197
|
+
codeId,
|
|
10198
|
+
labelId ?? dataTableColumnLabelId,
|
|
10199
|
+
startInputLabelId
|
|
10200
|
+
) : void 0),
|
|
10201
|
+
"aria-describedby": combineAriaIds(
|
|
10202
|
+
loadingDescriptionId,
|
|
10203
|
+
errorMessageIds,
|
|
10204
|
+
startInputProps?.["aria-describedby"],
|
|
10205
|
+
descriptionIds,
|
|
10206
|
+
formatDescriptionId,
|
|
10207
|
+
selectedStartDateDescriptionId
|
|
10208
|
+
),
|
|
10209
|
+
ref: combinedStartInputRef
|
|
10210
|
+
}
|
|
10211
|
+
),
|
|
10212
|
+
hasStartClearButton && /* @__PURE__ */ jsx(
|
|
10213
|
+
CloseButton,
|
|
10214
|
+
{
|
|
10215
|
+
size: "sm",
|
|
10216
|
+
label: clearButtonsLabel,
|
|
10217
|
+
tabIndex: -1,
|
|
10218
|
+
...startClearButtonProps,
|
|
10219
|
+
className: cx(
|
|
10220
|
+
prefix("date-range-input__clear-button"),
|
|
10221
|
+
prefix("date-range-input__clear-button--start"),
|
|
10222
|
+
printHidden,
|
|
10223
|
+
startClearButtonProps?.className
|
|
10224
|
+
),
|
|
10225
|
+
onClick: combineEventHandlers(
|
|
10226
|
+
startClearButtonProps?.onClick,
|
|
10227
|
+
handleClearButtonClick(startInputRef),
|
|
10228
|
+
{ checkDefaultPrevented: true }
|
|
10229
|
+
),
|
|
10230
|
+
ref: combinedStartClearButtonRef
|
|
10231
|
+
}
|
|
10232
|
+
),
|
|
10233
|
+
showStartSpinner && /* @__PURE__ */ jsx(
|
|
10234
|
+
Spinner,
|
|
10235
|
+
{
|
|
10236
|
+
color: controlStatusToAccent(status, "neutral"),
|
|
10237
|
+
"data-disabled": boolDataAttr(
|
|
10238
|
+
disabled || loading || startInputProps?.disabled
|
|
10239
|
+
),
|
|
10240
|
+
...spinnerProps,
|
|
10241
|
+
className: cx(
|
|
10242
|
+
prefix("date-range-input__spinner"),
|
|
10243
|
+
prefix("date-range-input__spinner--start"),
|
|
10244
|
+
spinnerProps?.className
|
|
10245
|
+
)
|
|
10246
|
+
}
|
|
10247
|
+
)
|
|
10248
|
+
]
|
|
10249
|
+
}
|
|
10250
|
+
),
|
|
10251
|
+
/* @__PURE__ */ jsx(ControlAddon, { className: cx(prefix("date-range-input__arrow")), children: /* @__PURE__ */ jsx(Icon, { icon: faArrowRight }) }),
|
|
10252
|
+
/* @__PURE__ */ jsxs(
|
|
10253
|
+
"div",
|
|
10254
|
+
{
|
|
10255
|
+
"data-focused": boolDataAttr(
|
|
10256
|
+
!disabled && !endInputProps?.disabled && popoverState.open && selectionMode === "end"
|
|
10257
|
+
),
|
|
10258
|
+
"data-status": status,
|
|
10259
|
+
"data-accent": controlStatusToAccent(status),
|
|
10260
|
+
"data-variant": variant,
|
|
10261
|
+
"data-disabled": boolDataAttr(
|
|
10262
|
+
disabled || loading || startInputProps?.disabled && endInputProps?.disabled
|
|
10263
|
+
),
|
|
10264
|
+
"data-readonly": boolDataAttr(
|
|
10265
|
+
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
10266
|
+
),
|
|
10267
|
+
...endContainerProps,
|
|
10268
|
+
className: cx(
|
|
10269
|
+
prefix("date-range-input__container"),
|
|
10270
|
+
prefix("date-range-input__container--end"),
|
|
10271
|
+
endContainerProps?.className
|
|
10272
|
+
),
|
|
10273
|
+
onPointerDown: combineEventHandlers(
|
|
10274
|
+
endContainerProps?.onPointerDown,
|
|
10275
|
+
handleContainerPointerDown("end")
|
|
10276
|
+
),
|
|
10277
|
+
ref: combinedEndContainerRef,
|
|
10278
|
+
children: [
|
|
10279
|
+
/* @__PURE__ */ jsx(
|
|
10280
|
+
"input",
|
|
10281
|
+
{
|
|
10282
|
+
...endInputProps,
|
|
10283
|
+
"data-loading": boolDataAttr(loading),
|
|
10284
|
+
"data-status": status,
|
|
10285
|
+
"data-variant": variant,
|
|
10286
|
+
className: cx(
|
|
10287
|
+
prefix("date-range-input"),
|
|
10288
|
+
prefix("date-range-input--end"),
|
|
10289
|
+
endInputProps?.className
|
|
10290
|
+
),
|
|
10291
|
+
value: formattedValue.end,
|
|
10292
|
+
placeholder: endInputProps?.placeholder ?? endPlaceholder ?? placeholder,
|
|
10293
|
+
required: required || endInputProps?.required,
|
|
10294
|
+
disabled: disabled || endInputProps?.disabled,
|
|
10295
|
+
readOnly: readOnly || loading || endInputProps?.readOnly,
|
|
10296
|
+
onChange: combineEventHandlers(
|
|
10297
|
+
endInputProps?.onChange,
|
|
10298
|
+
handleEndInputChange
|
|
10299
|
+
),
|
|
10300
|
+
onFocus: combineEventHandlers(
|
|
10301
|
+
endInputProps?.onFocus,
|
|
10302
|
+
handleInputFocus("end")
|
|
10303
|
+
),
|
|
10304
|
+
onBlur: combineEventHandlers(
|
|
10305
|
+
endInputProps?.onBlur,
|
|
10306
|
+
handleControlBlur
|
|
10307
|
+
),
|
|
10308
|
+
style: { ...cssVars, ...endInputProps?.style },
|
|
10309
|
+
...dataAttrs,
|
|
10310
|
+
"aria-invalid": status === "invalid" || void 0,
|
|
10311
|
+
"aria-labelledby": endInputProps?.["aria-labelledby"] ?? (endInputProps?.["aria-label"] === void 0 ? combineAriaIds(
|
|
10312
|
+
codeId,
|
|
10313
|
+
labelId ?? dataTableColumnLabelId,
|
|
10314
|
+
endInputLabelId
|
|
10315
|
+
) : void 0),
|
|
10316
|
+
"aria-describedby": combineAriaIds(
|
|
10317
|
+
loadingDescriptionId,
|
|
10318
|
+
errorMessageIds,
|
|
10319
|
+
endInputProps?.["aria-describedby"],
|
|
10320
|
+
descriptionIds,
|
|
10321
|
+
formatDescriptionId,
|
|
10322
|
+
selectedEndDateDescriptionId
|
|
10323
|
+
),
|
|
10324
|
+
ref: combinedEndInputRef
|
|
10325
|
+
}
|
|
10326
|
+
),
|
|
10327
|
+
hasEndClearButton && /* @__PURE__ */ jsx(
|
|
10328
|
+
CloseButton,
|
|
10329
|
+
{
|
|
10330
|
+
size: "sm",
|
|
10331
|
+
label: clearButtonsLabel,
|
|
10332
|
+
tabIndex: -1,
|
|
10333
|
+
...endClearButtonProps,
|
|
10334
|
+
className: cx(
|
|
10335
|
+
prefix("date-range-input__clear-button"),
|
|
10336
|
+
prefix("date-range-input__clear-button--end"),
|
|
10337
|
+
printHidden,
|
|
10338
|
+
endClearButtonProps?.className
|
|
10339
|
+
),
|
|
10340
|
+
onClick: combineEventHandlers(
|
|
10341
|
+
endClearButtonProps?.onClick,
|
|
10342
|
+
handleClearButtonClick(endInputRef),
|
|
10343
|
+
{ checkDefaultPrevented: true }
|
|
10344
|
+
),
|
|
10345
|
+
ref: combinedEndClearButtonRef
|
|
10346
|
+
}
|
|
10347
|
+
),
|
|
10348
|
+
showEndSpinner && /* @__PURE__ */ jsx(
|
|
10349
|
+
Spinner,
|
|
10350
|
+
{
|
|
10351
|
+
color: controlStatusToAccent(status, "neutral"),
|
|
10352
|
+
"data-disabled": boolDataAttr(
|
|
10353
|
+
disabled || loading || endInputProps?.disabled
|
|
10354
|
+
),
|
|
10355
|
+
...spinnerProps,
|
|
10356
|
+
className: cx(
|
|
10357
|
+
prefix("date-range-input__spinner"),
|
|
10358
|
+
prefix("date-range-input__spinner--end"),
|
|
10359
|
+
spinnerProps?.className
|
|
10360
|
+
)
|
|
10361
|
+
}
|
|
10362
|
+
)
|
|
10363
|
+
]
|
|
10364
|
+
}
|
|
10365
|
+
),
|
|
10366
|
+
endAdornment,
|
|
10367
|
+
/* @__PURE__ */ jsx(Tooltip, { content: calendarButtonLabel, children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(
|
|
10368
|
+
"button",
|
|
10369
|
+
{
|
|
10370
|
+
onClick: handleAddonButtonClick,
|
|
10371
|
+
onBlur: handleControlBlur,
|
|
10372
|
+
"data-state": void 0,
|
|
10373
|
+
className: cx(
|
|
10374
|
+
prefix("date-range-input__calendar-button"),
|
|
10375
|
+
printHidden
|
|
10376
|
+
),
|
|
10377
|
+
ref: addonButtonRef,
|
|
10378
|
+
"aria-describedby": selectedDateRangeDescriptionId,
|
|
10379
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: faCalendar, label: calendarButtonLabel })
|
|
10380
|
+
}
|
|
10381
|
+
) }) }) })
|
|
10382
|
+
]
|
|
10383
|
+
}
|
|
10384
|
+
),
|
|
10385
|
+
/* @__PURE__ */ jsx(
|
|
10386
|
+
PopoverContent,
|
|
10387
|
+
{
|
|
10388
|
+
...popoverContentProps,
|
|
10389
|
+
className: cx(
|
|
10390
|
+
prefix("date-range-input__popover"),
|
|
10391
|
+
popoverContentProps?.className
|
|
10392
|
+
),
|
|
10393
|
+
side: popoverContentProps?.side ?? "bottom",
|
|
10394
|
+
sideOffset: popoverContentProps?.sideOffset ?? 5,
|
|
10395
|
+
showArrow: popoverContentProps?.showArrow ?? false,
|
|
10396
|
+
onOpenAutoFocus: combineEventHandlers(
|
|
10397
|
+
popoverContentProps?.onOpenAutoFocus,
|
|
10398
|
+
handlePopoverOpenAutoFocus
|
|
9372
10399
|
),
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
10400
|
+
onEscapeKeyDown: combineEventHandlers(
|
|
10401
|
+
popoverContentProps?.onEscapeKeyDown,
|
|
10402
|
+
handlePopoverEscapeKeyDown
|
|
10403
|
+
),
|
|
10404
|
+
onPointerDownOutside: combineEventHandlers(
|
|
10405
|
+
popoverContentProps?.onPointerDownOutside,
|
|
10406
|
+
handlePopoverPointerDownOutside
|
|
10407
|
+
),
|
|
10408
|
+
onInteractOutside: combineEventHandlers(
|
|
10409
|
+
popoverContentProps?.onInteractOutside,
|
|
10410
|
+
handlePopoverInteractOutside
|
|
10411
|
+
),
|
|
10412
|
+
onBlur: combineEventHandlers(
|
|
10413
|
+
popoverContentProps?.onBlur,
|
|
10414
|
+
handleControlBlur
|
|
10415
|
+
),
|
|
10416
|
+
ref: combinedPopoverRef,
|
|
10417
|
+
children: /* @__PURE__ */ jsx(
|
|
10418
|
+
DateRangePicker,
|
|
9376
10419
|
{
|
|
9377
|
-
onClick: handleAddonButtonClick,
|
|
9378
|
-
onBlur: handleControlBlur,
|
|
9379
|
-
"data-state": void 0,
|
|
9380
10420
|
className: cx(
|
|
9381
|
-
prefix("date-range-
|
|
9382
|
-
|
|
10421
|
+
prefix("date-range-input__picker"),
|
|
10422
|
+
dateRangePickerProps?.className
|
|
9383
10423
|
),
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
),
|
|
9418
|
-
onInteractOutside: combineEventHandlers(
|
|
9419
|
-
popoverContentProps?.onInteractOutside,
|
|
9420
|
-
handlePopoverInteractOutside
|
|
9421
|
-
),
|
|
9422
|
-
onBlur: combineEventHandlers(
|
|
9423
|
-
popoverContentProps?.onBlur,
|
|
9424
|
-
handleControlBlur
|
|
9425
|
-
),
|
|
9426
|
-
ref: combinedPopoverRef,
|
|
9427
|
-
children: /* @__PURE__ */ jsx(
|
|
9428
|
-
DateRangePicker,
|
|
9429
|
-
{
|
|
9430
|
-
className: cx(
|
|
9431
|
-
prefix("date-range-input__picker"),
|
|
9432
|
-
dateRangePickerProps?.className
|
|
9433
|
-
),
|
|
9434
|
-
...dateRangePickerProps,
|
|
9435
|
-
value: deferredDateValue,
|
|
9436
|
-
onChange: combineEventHandlers(
|
|
9437
|
-
dateRangePickerProps?.onChange,
|
|
9438
|
-
handleDatePickerChange
|
|
9439
|
-
),
|
|
9440
|
-
selectionMode,
|
|
9441
|
-
month,
|
|
9442
|
-
onMonthChange: handleMonthChange,
|
|
9443
|
-
disabled: disabled || loading || readOnly || (startInputProps?.disabled || startInputProps?.readOnly) && (endInputProps?.disabled || endInputProps?.readOnly) || dateRangePickerProps?.disabled,
|
|
9444
|
-
minDate,
|
|
9445
|
-
maxDate,
|
|
9446
|
-
minMonth,
|
|
9447
|
-
maxMonth,
|
|
9448
|
-
minYear,
|
|
9449
|
-
maxYear,
|
|
9450
|
-
monthSelectProps: {
|
|
9451
|
-
...dateRangePickerProps?.monthSelectProps,
|
|
9452
|
-
popoverProps: {
|
|
9453
|
-
...dateRangePickerProps?.monthSelectProps?.popoverProps,
|
|
9454
|
-
ref: monthSelectMenuRef
|
|
9455
|
-
}
|
|
9456
|
-
},
|
|
9457
|
-
yearSelectProps: {
|
|
9458
|
-
...dateRangePickerProps?.yearSelectProps,
|
|
9459
|
-
popoverProps: {
|
|
9460
|
-
...dateRangePickerProps?.yearSelectProps?.popoverProps,
|
|
9461
|
-
ref: yearSelectMenuRef
|
|
10424
|
+
...dateRangePickerProps,
|
|
10425
|
+
value: deferredDateValue,
|
|
10426
|
+
onChange: combineEventHandlers(
|
|
10427
|
+
dateRangePickerProps?.onChange,
|
|
10428
|
+
handleDatePickerChange
|
|
10429
|
+
),
|
|
10430
|
+
selectionMode,
|
|
10431
|
+
month,
|
|
10432
|
+
onMonthChange: handleMonthChange,
|
|
10433
|
+
disabled: disabled || loading || readOnly || (startInputProps?.disabled || startInputProps?.readOnly) && (endInputProps?.disabled || endInputProps?.readOnly) || dateRangePickerProps?.disabled,
|
|
10434
|
+
minDate,
|
|
10435
|
+
maxDate,
|
|
10436
|
+
minMonth,
|
|
10437
|
+
maxMonth,
|
|
10438
|
+
minYear,
|
|
10439
|
+
maxYear,
|
|
10440
|
+
monthSelectProps: {
|
|
10441
|
+
...dateRangePickerProps?.monthSelectProps,
|
|
10442
|
+
popoverProps: {
|
|
10443
|
+
...dateRangePickerProps?.monthSelectProps?.popoverProps,
|
|
10444
|
+
ref: monthSelectMenuRef
|
|
10445
|
+
}
|
|
10446
|
+
},
|
|
10447
|
+
yearSelectProps: {
|
|
10448
|
+
...dateRangePickerProps?.yearSelectProps,
|
|
10449
|
+
popoverProps: {
|
|
10450
|
+
...dateRangePickerProps?.yearSelectProps?.popoverProps,
|
|
10451
|
+
ref: yearSelectMenuRef
|
|
10452
|
+
}
|
|
10453
|
+
},
|
|
10454
|
+
headerLabelProps: {
|
|
10455
|
+
role: popoverState.modal ? "status" : void 0,
|
|
10456
|
+
...dateRangePickerProps?.headerLabelProps
|
|
9462
10457
|
}
|
|
9463
|
-
},
|
|
9464
|
-
headerLabelProps: {
|
|
9465
|
-
role: popoverState.modal ? "status" : void 0,
|
|
9466
|
-
...dateRangePickerProps?.headerLabelProps
|
|
9467
10458
|
}
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
)
|
|
9472
|
-
]
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
10459
|
+
)
|
|
10460
|
+
}
|
|
10461
|
+
)
|
|
10462
|
+
] })
|
|
10463
|
+
]
|
|
10464
|
+
}
|
|
10465
|
+
),
|
|
10466
|
+
startInputLabelId && /* @__PURE__ */ jsx("span", { hidden: true, id: startInputLabelId, children: startInputLabel }),
|
|
10467
|
+
endInputLabelId && /* @__PURE__ */ jsx("span", { hidden: true, id: endInputLabelId, children: endInputLabel }),
|
|
10468
|
+
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription }),
|
|
10469
|
+
formatDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: formatDescriptionId, children: formatDescription }),
|
|
10470
|
+
selectedStartDateDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: selectedStartDateDescriptionId, children: selectedDateDescription(descriptionFormattedStart) }),
|
|
10471
|
+
selectedEndDateDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: selectedEndDateDescriptionId, children: selectedDateDescription(descriptionFormattedEnd) }),
|
|
10472
|
+
selectedDateRangeDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: selectedDateRangeDescriptionId, children: selectedDateRangeDescription({
|
|
10473
|
+
start: descriptionFormattedStart,
|
|
10474
|
+
end: descriptionFormattedEnd
|
|
10475
|
+
}) })
|
|
10476
|
+
]
|
|
9476
10477
|
}
|
|
9477
10478
|
) });
|
|
9478
10479
|
});
|
|
@@ -10056,7 +11057,7 @@ const Feedback = forwardRef(
|
|
|
10056
11057
|
const [locale7] = useLocale();
|
|
10057
11058
|
visuallyHiddenPrefix ??= locale7.Feedback.visuallyHiddenPrefix;
|
|
10058
11059
|
const { onAddFeedback, onRemoveFeedback } = useFeedbackPopoverContext() ?? {};
|
|
10059
|
-
useLayoutEffect(() => {
|
|
11060
|
+
useLayoutEffect$1(() => {
|
|
10060
11061
|
onAddFeedback?.(type);
|
|
10061
11062
|
return () => onRemoveFeedback?.(type);
|
|
10062
11063
|
}, [onAddFeedback, onRemoveFeedback, type]);
|
|
@@ -10360,7 +11361,7 @@ const Link = forwardRef(function Link2({
|
|
|
10360
11361
|
);
|
|
10361
11362
|
});
|
|
10362
11363
|
function numericToString(v) {
|
|
10363
|
-
return typeof v === "string" ? v : v == null || isNaN(v) ? "" : fromExponential(v);
|
|
11364
|
+
return typeof v === "string" ? v : typeof v === "bigint" ? v.toString() : v == null || isNaN(v) ? "" : fromExponential(v);
|
|
10364
11365
|
}
|
|
10365
11366
|
function isNumericStringNegative(v) {
|
|
10366
11367
|
return v.startsWith("-");
|
|
@@ -10674,7 +11675,7 @@ const NumericInput = forwardRef(function NumericInput2({
|
|
|
10674
11675
|
thousandSeparator: groupDigits ? groupSeparator : "",
|
|
10675
11676
|
isAllowed,
|
|
10676
11677
|
allowNegative,
|
|
10677
|
-
customInput: Input,
|
|
11678
|
+
customInput: Input$1,
|
|
10678
11679
|
getInputRef: forwardedRef,
|
|
10679
11680
|
...otherProps
|
|
10680
11681
|
}
|
|
@@ -10747,7 +11748,7 @@ const Output = forwardRef(
|
|
|
10747
11748
|
}, forwardedRef) {
|
|
10748
11749
|
const prefix = usePrefix();
|
|
10749
11750
|
return /* @__PURE__ */ jsx(
|
|
10750
|
-
Input,
|
|
11751
|
+
Input$1,
|
|
10751
11752
|
{
|
|
10752
11753
|
showSpinner,
|
|
10753
11754
|
"aria-busy": pending || void 0,
|
|
@@ -10806,79 +11807,84 @@ const Radio = forwardRef(function Radio2({
|
|
|
10806
11807
|
[loading, readOnly]
|
|
10807
11808
|
);
|
|
10808
11809
|
const combinedLabelIds = combineAriaIds(codeId, labelId);
|
|
10809
|
-
return /* @__PURE__ */ jsxs(
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
Label,
|
|
10853
|
-
{
|
|
10854
|
-
htmlFor: controlId,
|
|
10855
|
-
"data-status": status,
|
|
10856
|
-
...labelProps,
|
|
10857
|
-
id: labelId,
|
|
10858
|
-
className: cx(prefix("radio__label"), labelProps?.className),
|
|
10859
|
-
containerProps: {
|
|
10860
|
-
...labelProps?.containerProps,
|
|
10861
|
-
className: cx(
|
|
10862
|
-
prefix("radio__label-container"),
|
|
10863
|
-
labelProps?.containerProps?.className
|
|
11810
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11811
|
+
/* @__PURE__ */ jsxs(
|
|
11812
|
+
"div",
|
|
11813
|
+
{
|
|
11814
|
+
"data-status": status,
|
|
11815
|
+
...rootProps,
|
|
11816
|
+
className: cx(prefix("radio__root"), rootProps?.className),
|
|
11817
|
+
children: [
|
|
11818
|
+
codeId && /* @__PURE__ */ jsx(
|
|
11819
|
+
ControlCode,
|
|
11820
|
+
{
|
|
11821
|
+
status,
|
|
11822
|
+
...codeProps,
|
|
11823
|
+
id: codeId,
|
|
11824
|
+
className: cx(prefix("radio__code"), codeProps?.className),
|
|
11825
|
+
children: code
|
|
11826
|
+
}
|
|
11827
|
+
),
|
|
11828
|
+
/* @__PURE__ */ jsx(
|
|
11829
|
+
RadioGroup$1.Item,
|
|
11830
|
+
{
|
|
11831
|
+
id: controlId,
|
|
11832
|
+
className: cx(prefix("radio"), className),
|
|
11833
|
+
value: value?.toString() ?? "",
|
|
11834
|
+
disabled,
|
|
11835
|
+
"data-loading": boolDataAttr(loading),
|
|
11836
|
+
"data-readonly": boolDataAttr(readOnly),
|
|
11837
|
+
"data-status": status,
|
|
11838
|
+
"aria-disabled": loading || readOnly || void 0,
|
|
11839
|
+
"aria-label": ariaLabel,
|
|
11840
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 && combinedLabelIds !== labelId ? combinedLabelIds : void 0),
|
|
11841
|
+
...otherProps,
|
|
11842
|
+
onClick: combineEventHandlers(onClick, handleClick),
|
|
11843
|
+
ref: forwardedRef,
|
|
11844
|
+
children: /* @__PURE__ */ jsx(
|
|
11845
|
+
RadioGroup$1.Indicator,
|
|
11846
|
+
{
|
|
11847
|
+
...indicatorProps,
|
|
11848
|
+
className: cx(
|
|
11849
|
+
prefix("radio__indicator"),
|
|
11850
|
+
indicatorProps?.className
|
|
11851
|
+
)
|
|
11852
|
+
}
|
|
10864
11853
|
)
|
|
10865
|
-
}
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
11854
|
+
}
|
|
11855
|
+
),
|
|
11856
|
+
labelId && /* @__PURE__ */ jsx(
|
|
11857
|
+
Label,
|
|
11858
|
+
{
|
|
11859
|
+
htmlFor: controlId,
|
|
11860
|
+
"data-status": status,
|
|
11861
|
+
...labelProps,
|
|
11862
|
+
id: labelId,
|
|
11863
|
+
className: cx(prefix("radio__label"), labelProps?.className),
|
|
11864
|
+
containerProps: {
|
|
11865
|
+
...labelProps?.containerProps,
|
|
11866
|
+
className: cx(
|
|
11867
|
+
prefix("radio__label-container"),
|
|
11868
|
+
labelProps?.containerProps?.className
|
|
11869
|
+
)
|
|
11870
|
+
},
|
|
11871
|
+
children
|
|
11872
|
+
}
|
|
11873
|
+
),
|
|
11874
|
+
showSpinner && /* @__PURE__ */ jsx(
|
|
11875
|
+
Spinner,
|
|
11876
|
+
{
|
|
11877
|
+
"data-status": status,
|
|
11878
|
+
"data-disabled": boolDataAttr(disabled || loading),
|
|
11879
|
+
...spinnerProps,
|
|
11880
|
+
className: cx(prefix("radio__spinner"), spinnerProps?.className)
|
|
11881
|
+
}
|
|
11882
|
+
)
|
|
11883
|
+
]
|
|
11884
|
+
}
|
|
11885
|
+
),
|
|
11886
|
+
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription })
|
|
11887
|
+
] });
|
|
10882
11888
|
});
|
|
10883
11889
|
const RadioGroup = forwardRef(function RadioGroup2({
|
|
10884
11890
|
defaultValue,
|
|
@@ -10892,6 +11898,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
10892
11898
|
showSpinner = loading,
|
|
10893
11899
|
code,
|
|
10894
11900
|
showClearButton,
|
|
11901
|
+
clearDescription,
|
|
10895
11902
|
clearButtonLabel,
|
|
10896
11903
|
onBlurToOutside,
|
|
10897
11904
|
codeProps,
|
|
@@ -10917,6 +11924,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
10917
11924
|
const [locale7] = useLocale();
|
|
10918
11925
|
loadingDescription ??= locale7.Input.loadingDescription;
|
|
10919
11926
|
clearButtonLabel ??= locale7.Input.clearButtonLabel;
|
|
11927
|
+
clearDescription ??= locale7.RadioGroup.clearDescription;
|
|
10920
11928
|
const labelId = useFieldLabelId();
|
|
10921
11929
|
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
10922
11930
|
const descriptionIds = useFieldDescriptionIds();
|
|
@@ -10964,6 +11972,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
10964
11972
|
radioGroupRef.current?.focus();
|
|
10965
11973
|
}, [handleValueChange]);
|
|
10966
11974
|
const hasClearButton = !disabled && !loading && !readOnly && (showClearButton === true || showClearButton === "auto" && (value?.length ?? 0) > 0);
|
|
11975
|
+
const clearDescriptionId = hasClearButton && clearDescription && prefix(`control-clear-${generatedId}`);
|
|
10967
11976
|
const handleKeyDown = useCallback(
|
|
10968
11977
|
(evt) => {
|
|
10969
11978
|
if (hasClearButton && (evt.code === "Delete" || evt.code === "Backspace")) {
|
|
@@ -11001,7 +12010,8 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11001
12010
|
loadingDescriptionId,
|
|
11002
12011
|
errorMessageIds,
|
|
11003
12012
|
ariaDescribedBy,
|
|
11004
|
-
descriptionIds
|
|
12013
|
+
descriptionIds,
|
|
12014
|
+
clearDescriptionId
|
|
11005
12015
|
),
|
|
11006
12016
|
onFocus: combineEventHandlers(onFocus, handleControlFocus),
|
|
11007
12017
|
onBlur: combineEventHandlers(onBlur, handleControlBlur),
|
|
@@ -11089,7 +12099,8 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11089
12099
|
]
|
|
11090
12100
|
}
|
|
11091
12101
|
),
|
|
11092
|
-
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription })
|
|
12102
|
+
loadingDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: loadingDescriptionId, children: loadingDescription }),
|
|
12103
|
+
clearDescriptionId && /* @__PURE__ */ jsx("span", { hidden: true, id: clearDescriptionId, children: clearDescription })
|
|
11093
12104
|
]
|
|
11094
12105
|
}
|
|
11095
12106
|
)
|
|
@@ -11099,7 +12110,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11099
12110
|
const Separator = forwardRef(function Separator2({ className, ...otherProps }, forwardedRef) {
|
|
11100
12111
|
const prefix = usePrefix();
|
|
11101
12112
|
return /* @__PURE__ */ jsx(
|
|
11102
|
-
Separator$
|
|
12113
|
+
Separator$2.Root,
|
|
11103
12114
|
{
|
|
11104
12115
|
className: cx(prefix("separator"), className),
|
|
11105
12116
|
...otherProps,
|
|
@@ -11323,7 +12334,7 @@ function useTabsContext() {
|
|
|
11323
12334
|
function useRegisterTabLabel(value, label) {
|
|
11324
12335
|
const { showAllTabsWhilePrinting, store } = useTabsContext();
|
|
11325
12336
|
const needsRegisteredTabLabels = usePrinting() && showAllTabsWhilePrinting;
|
|
11326
|
-
const { registerTabLabel } = useStore(store, (state) => state.actions);
|
|
12337
|
+
const { registerTabLabel } = useStore$1(store, (state) => state.actions);
|
|
11327
12338
|
useEffect(() => {
|
|
11328
12339
|
if (needsRegisteredTabLabels) {
|
|
11329
12340
|
return registerTabLabel(value, label);
|
|
@@ -11332,19 +12343,21 @@ function useRegisterTabLabel(value, label) {
|
|
|
11332
12343
|
}
|
|
11333
12344
|
function useTabLabel(value) {
|
|
11334
12345
|
const { store } = useTabsContext();
|
|
11335
|
-
return useStore(store, (state) => state.actions.getTabLabel(value));
|
|
12346
|
+
return useStore$1(store, (state) => state.actions.getTabLabel(value));
|
|
11336
12347
|
}
|
|
11337
12348
|
const Tab = forwardRef(function Tab2({ value, status, tabInnerProps, className, children, ...otherProps }, forwardedRef) {
|
|
11338
12349
|
const prefix = usePrefix();
|
|
11339
12350
|
const { variant, store } = useTabsContext();
|
|
11340
12351
|
const stringValue = value.toString();
|
|
11341
|
-
const isActive = useStore(store, (state) => state.activeTab === stringValue);
|
|
12352
|
+
const isActive = useStore$1(store, (state) => state.activeTab === stringValue);
|
|
11342
12353
|
useRegisterTabLabel(stringValue, children);
|
|
11343
12354
|
const tabRef = useRef(null);
|
|
12355
|
+
const prevIsActiveRef = useRef(isActive);
|
|
11344
12356
|
useEffect(() => {
|
|
11345
|
-
if (isActive) {
|
|
12357
|
+
if (isActive && !prevIsActiveRef.current) {
|
|
11346
12358
|
setTimeout(() => tabRef.current?.scrollIntoView({ block: "nearest" }));
|
|
11347
12359
|
}
|
|
12360
|
+
prevIsActiveRef.current = isActive;
|
|
11348
12361
|
}, [isActive]);
|
|
11349
12362
|
const combinedTabRef = useCombinedRef(tabRef, forwardedRef);
|
|
11350
12363
|
return /* @__PURE__ */ jsxs(
|
|
@@ -11579,8 +12592,8 @@ function TabListScrollButton({
|
|
|
11579
12592
|
}) {
|
|
11580
12593
|
const prefix = usePrefix();
|
|
11581
12594
|
const { store } = useTabsContext();
|
|
11582
|
-
const showScrollButtons = useStore(store, (state) => state.showScrollButtons);
|
|
11583
|
-
const shouldDisable = useStore(
|
|
12595
|
+
const showScrollButtons = useStore$1(store, (state) => state.showScrollButtons);
|
|
12596
|
+
const shouldDisable = useStore$1(
|
|
11584
12597
|
store,
|
|
11585
12598
|
({ scrollPosition }) => scrollPosition && (side === "left" ? scrollPosition.left === 0 : scrollPosition.right <= 1)
|
|
11586
12599
|
);
|
|
@@ -11639,7 +12652,7 @@ const TextArea = forwardRef(
|
|
|
11639
12652
|
function TextArea2({ rows, ...props }, forwardedRef) {
|
|
11640
12653
|
const isInTableCell = useIsInTableCell();
|
|
11641
12654
|
rows ??= isInTableCell ? 1 : DEFAULT_ROWS;
|
|
11642
|
-
return /* @__PURE__ */ jsx(Input, { asChild: true, ...props, children: /* @__PURE__ */ jsx("textarea", { rows, ref: forwardedRef }) });
|
|
12655
|
+
return /* @__PURE__ */ jsx(Input$1, { asChild: true, ...props, children: /* @__PURE__ */ jsx("textarea", { rows, ref: forwardedRef }) });
|
|
11643
12656
|
}
|
|
11644
12657
|
);
|
|
11645
12658
|
function useMediaQuery(query, options) {
|
|
@@ -11778,7 +12791,7 @@ function createLocationStore() {
|
|
|
11778
12791
|
function useLocation(selector) {
|
|
11779
12792
|
locationStore ??= createLocationStore();
|
|
11780
12793
|
useEffect(() => locationStore.getState().actions.subscribe(), []);
|
|
11781
|
-
return useStore(
|
|
12794
|
+
return useStore$1(
|
|
11782
12795
|
locationStore,
|
|
11783
12796
|
({ location: location2 }) => selector ? selector(location2) : location2
|
|
11784
12797
|
);
|
|
@@ -11932,12 +12945,13 @@ export {
|
|
|
11932
12945
|
FieldGroupBody,
|
|
11933
12946
|
FieldGroupHeader,
|
|
11934
12947
|
FieldGroupTitle,
|
|
12948
|
+
FieldProvider,
|
|
11935
12949
|
Grid,
|
|
11936
12950
|
Heading,
|
|
11937
12951
|
HelperText,
|
|
11938
12952
|
Icon,
|
|
11939
12953
|
IconButton,
|
|
11940
|
-
Input,
|
|
12954
|
+
Input$1 as Input,
|
|
11941
12955
|
InputWithContainerRef,
|
|
11942
12956
|
Keybinds,
|
|
11943
12957
|
Keyboard,
|
|
@@ -12064,7 +13078,7 @@ export {
|
|
|
12064
13078
|
useIsInTableCell,
|
|
12065
13079
|
useKeyboardShortcut,
|
|
12066
13080
|
useLatestValues,
|
|
12067
|
-
useLayoutEffect,
|
|
13081
|
+
useLayoutEffect$1 as useLayoutEffect,
|
|
12068
13082
|
useLocale,
|
|
12069
13083
|
useLocation,
|
|
12070
13084
|
useMeasure,
|