@ostack.tech/ui 0.10.4 → 0.11.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-DwZKZVGL.js → en-DtnihkTA.js} +20 -3
- package/dist/chunks/en-DtnihkTA.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 +19 -2
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +19 -2
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +186 -110
- package/dist/ostack-ui.js +1466 -681
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +3 -3
- package/dist/types/components/AlertDialog/AlertDialog.d.ts +6 -2
- package/dist/types/components/Button/Button.d.ts +7 -7
- package/dist/types/components/Calendar/Calendar.d.ts +60 -4
- package/dist/types/components/Card/Card.d.ts +2 -2
- package/dist/types/components/Code/Code.d.ts +1 -1
- package/dist/types/components/Collapsible/Collapsible.d.ts +26 -8
- package/dist/types/components/Collapsible/CollapsibleContext.d.ts +2 -2
- package/dist/types/components/Collapsible/CollapsibleTrigger.d.ts +22 -6
- package/dist/types/components/CommandMenu/CommandMenu.d.ts +1 -1
- package/dist/types/components/Container/Container.d.ts +21 -10
- package/dist/types/components/DataTable/DataTable.d.ts +63 -29
- package/dist/types/components/DataTable/DataTableContext.d.ts +3 -1
- package/dist/types/components/DateInput/DateInput.d.ts +8 -5
- package/dist/types/components/DateRangeInput/DateRangeInput.d.ts +6 -5
- package/dist/types/components/DescriptionList/DescriptionList.d.ts +38 -0
- package/dist/types/components/DescriptionList/DescriptionListItem.d.ts +15 -0
- package/dist/types/components/DescriptionList/index.d.ts +2 -0
- package/dist/types/components/Dialog/Dialog.d.ts +1 -2
- package/dist/types/components/Dialog/DialogContent.d.ts +3 -3
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/types/components/FieldGroup/FieldGroup.d.ts +42 -14
- package/dist/types/components/Grid/Grid.d.ts +64 -11
- package/dist/types/components/Icon/Icon.d.ts +1 -1
- package/dist/types/components/IconButton/IconButton.d.ts +8 -10
- package/dist/types/components/Input/Input.d.ts +2 -3
- package/dist/types/components/Link/Link.d.ts +1 -3
- package/dist/types/components/Mark/Mark.d.ts +1 -1
- package/dist/types/components/MenuList/MenuList.d.ts +5 -0
- package/dist/types/components/MenuList/MenuListItem.d.ts +3 -3
- package/dist/types/components/NumericInput/NumericInput.d.ts +2 -2
- package/dist/types/components/Popover/Popover.d.ts +32 -19
- package/dist/types/components/Popover/PopoverClose.d.ts +10 -3
- package/dist/types/components/Printer/Printer.d.ts +4 -4
- package/dist/types/components/Printer/PrinterContentContext.d.ts +4 -4
- package/dist/types/components/Printer/PrinterContext.d.ts +2 -2
- package/dist/types/components/Root/Root.d.ts +7 -7
- package/dist/types/components/Select/Select.d.ts +6 -0
- package/dist/types/components/Select/SelectContext.d.ts +2 -1
- package/dist/types/components/Select/SelectNative.d.ts +7 -0
- package/dist/types/components/Separator/Separator.d.ts +39 -1
- package/dist/types/components/Stack/Stack.d.ts +27 -5
- package/dist/types/components/Stepper/Step.d.ts +21 -6
- package/dist/types/components/Stepper/StepContent.d.ts +13 -4
- package/dist/types/components/Stepper/StepList.d.ts +8 -3
- package/dist/types/components/Stepper/Stepper.d.ts +51 -34
- package/dist/types/components/Stepper/StepperContext.d.ts +77 -4
- package/dist/types/components/Stepper/StepperFinishTrigger.d.ts +37 -0
- package/dist/types/components/Stepper/StepperNextTrigger.d.ts +34 -0
- package/dist/types/components/Stepper/StepperPreviousTrigger.d.ts +37 -0
- package/dist/types/components/Stepper/StepperState.d.ts +8 -0
- package/dist/types/components/Stepper/index.d.ts +5 -0
- package/dist/types/components/Table/Table.d.ts +2 -2
- package/dist/types/components/Table/TableColumn.d.ts +1 -1
- package/dist/types/components/Tabs/Tab.d.ts +6 -1
- package/dist/types/components/Tabs/Tabs.d.ts +1 -1
- package/dist/types/components/Toast/Toast.d.ts +81 -15
- package/dist/types/components/Tooltip/Tooltip.d.ts +4 -0
- package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts +22 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/providers/AlertDialogProvider/AlertDialogProviderContext.d.ts +2 -2
- package/dist/types/providers/ErrorReportingProvider/ErrorReport.d.ts +3 -3
- package/dist/types/providers/ErrorReportingProvider/ErrorReportingProvider.d.ts +2 -2
- package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +7 -0
- package/dist/types/providers/ToastManagerProvider/ToastManagerContext.d.ts +4 -2
- package/dist/types/utils/control.d.ts +1 -1
- package/dist/types/utils/keyboardShortcut.d.ts +1 -1
- package/dist/types/utils/useSearchParam.d.ts +5 -5
- package/dist/types/utils/useSearchParams.d.ts +7 -4
- package/package.json +3 -3
- package/scss/_utils.scss +3 -0
- package/scss/components/Checkbox/_Checkbox.scss +1 -1
- package/scss/components/Collapsible/_Collapsible-variables.scss +0 -1
- package/scss/components/Collapsible/_Collapsible.scss +2 -6
- package/scss/components/Container/_Container.scss +16 -5
- package/scss/components/DescriptionList/_DescriptionList-variables.scss +21 -0
- package/scss/components/DescriptionList/_DescriptionList.scss +33 -0
- package/scss/components/DropdownMenu/_DropdownMenu.scss +1 -3
- package/scss/components/FeedbackPopover/_FeedbackPopover-variables.scss +9 -9
- package/scss/components/FeedbackPopover/_FeedbackPopover.scss +1 -1
- package/scss/components/Field/_Field-variables.scss +9 -0
- package/scss/components/Field/_Field.scss +6 -8
- package/scss/components/Input/_Input.scss +5 -0
- package/scss/components/Label/_Label-variables.scss +1 -1
- package/scss/components/MenuList/_MenuList.scss +4 -1
- package/scss/components/RadioGroup/_Radio.scss +1 -1
- package/scss/components/Separator/_Separator-variables.scss +11 -0
- package/scss/components/Separator/_Separator.scss +13 -5
- package/scss/components/Stepper/_Stepper-variables.scss +37 -9
- package/scss/components/Stepper/_Stepper.scss +69 -22
- package/scss/components/Tabs/_Tabs.scss +6 -4
- package/scss/index.scss +1 -0
- package/scss/scss/placeholders/checkable/_checkable.scss +3 -3
- package/scss/scss/placeholders/control/_control.scss +1 -1
- package/scss/scss/placeholders/menu/_menu.scss +5 -16
- package/scss/scss/utils/_animation.scss +1 -1
- package/scss/scss/utils/_transition.scss +1 -1
- package/dist/chunks/en-DwZKZVGL.js.map +0 -1
- package/dist/types/components/DatePicker/DatePicker.d.ts +0 -27
- package/dist/types/components/DatePicker/index.d.ts +0 -1
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +0 -41
- package/dist/types/components/DateRangePicker/index.d.ts +0 -1
package/dist/ostack-ui.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
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,
|
|
3
|
-
import {
|
|
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, useSyncExternalStore, useDeferredValue } from "react";
|
|
3
|
+
import { parseKeybinding, tinykeys } from "tinykeys";
|
|
4
4
|
import fromExponential from "from-exponential";
|
|
5
|
-
import { isValid, isDate, addMonths, isAfter, isBefore, startOfMonth, setMonth, getYear, setYear, startOfYear, format, isSameYear, getMonth, max, min, lastDayOfMonth, parseISO, parse, isWithinInterval
|
|
5
|
+
import { isValid, isDate, addMonths, isAfter, isBefore, startOfMonth, setMonth, getYear, setYear, startOfYear, format, isSameYear, getMonth, max, min, isSameDay, lastDayOfMonth, isEqual, parseISO, parse, isWithinInterval } from "date-fns";
|
|
6
6
|
import { createStore, useStore as useStore$1, create } from "zustand";
|
|
7
7
|
import { shallow } from "zustand/shallow";
|
|
8
|
-
import {
|
|
8
|
+
import { numericFormatter, removeNumericFormat, NumericFormat } from "react-number-format";
|
|
9
9
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
10
|
-
import { faArrowRight, faArrowLeft, faArrowDown, faArrowUp, faClose, faTriangleExclamation, faCircleExclamation, faCircleCheck, faCircleInfo,
|
|
11
|
-
import { ErrorBoundary as ErrorBoundary$1 } from "react-error-boundary";
|
|
12
|
-
import { useErrorBoundary } from "react-error-boundary";
|
|
10
|
+
import { faArrowRight, faArrowLeft, faArrowDown, faArrowUp, faClose, faTriangleExclamation, faCircleExclamation, faCircleCheck, faCircleInfo, faChevronRight, faChevronDown, faChevronLeft, faChevronUp, faRedo, faCircleQuestion, faSortDown, faSortUp, faAsterisk, faMinus, faCheck, faSearch, faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
|
|
13
11
|
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";
|
|
14
12
|
import { subscribeWithSelector } from "zustand/middleware";
|
|
15
|
-
import {
|
|
13
|
+
import { ErrorBoundary as ErrorBoundary$1 } from "react-error-boundary";
|
|
14
|
+
import { useErrorBoundary } from "react-error-boundary";
|
|
16
15
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
17
|
-
import {
|
|
18
|
-
import { locale as locale2 } from "./locales/en-US.js";
|
|
19
|
-
import { locale as locale3, locale as locale4 } from "./locales/fr-FR.js";
|
|
20
|
-
import { locale as locale5, locale as locale6 } from "./locales/pt-PT.js";
|
|
16
|
+
import { I as IS_APPLE } from "./chunks/platformUtils-C3IHCr90.js";
|
|
21
17
|
import { useDayPicker, DayPicker } from "react-day-picker";
|
|
22
18
|
import { useShallow } from "zustand/react/shallow";
|
|
23
19
|
import { useVirtualizer, observeElementRect } from "@tanstack/react-virtual";
|
|
24
20
|
import { faCalendar } from "@fortawesome/free-regular-svg-icons";
|
|
25
21
|
import { flushSync } from "react-dom";
|
|
26
22
|
import { useReactToPrint } from "react-to-print";
|
|
23
|
+
import { locale } from "./locales/en-GB.js";
|
|
24
|
+
import { locale as locale2 } from "./locales/en-US.js";
|
|
25
|
+
import { locale as locale3, locale as locale4 } from "./locales/fr-FR.js";
|
|
26
|
+
import { locale as locale5, locale as locale6 } from "./locales/pt-PT.js";
|
|
27
27
|
const AlertDialog = AlertDialog$1.Root;
|
|
28
28
|
const AlertDialogAction = forwardRef(function AlertDialogAction2(props, forwardedRef) {
|
|
29
29
|
return /* @__PURE__ */ jsx(AlertDialog$1.Action, { ...props, asChild: true, ref: forwardedRef });
|
|
@@ -460,16 +460,37 @@ function useCreateDataTableContext({
|
|
|
460
460
|
(offset2, totalCount = offset2) => Math.min(Math.max(offset2, 0), Math.max(totalCount - 1, 0))
|
|
461
461
|
),
|
|
462
462
|
currentPage: computed(
|
|
463
|
-
() => [get().offset(), get().limit],
|
|
463
|
+
() => [get().offset(), get().limit()],
|
|
464
464
|
(offset2, limit2) => Math.floor(offset2 / limit2)
|
|
465
465
|
),
|
|
466
466
|
pageOffset: computed(
|
|
467
|
-
() => [get().currentPage(), get().limit],
|
|
467
|
+
() => [get().currentPage(), get().limit()],
|
|
468
468
|
(currentPage, limit2) => currentPage * limit2
|
|
469
469
|
),
|
|
470
|
-
|
|
470
|
+
limitOptions: void 0,
|
|
471
|
+
_limit: limit ?? defaultLimit,
|
|
472
|
+
limit: computed(
|
|
473
|
+
() => [get()._limit, get().limitOptions],
|
|
474
|
+
(limit2, limitOptions) => {
|
|
475
|
+
if (!limitOptions || limitOptions.length === 0) {
|
|
476
|
+
return Math.max(limit2, 1);
|
|
477
|
+
}
|
|
478
|
+
let curLimit = limitOptions[0];
|
|
479
|
+
let curDelta = Math.abs(limit2 - curLimit);
|
|
480
|
+
for (let i = 1; i < limitOptions.length; ++i) {
|
|
481
|
+
const nextLimit = limitOptions[i];
|
|
482
|
+
const nextDelta = Math.abs(limit2 - nextLimit);
|
|
483
|
+
if (nextDelta > curDelta) {
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
curLimit = nextLimit;
|
|
487
|
+
curDelta = nextDelta;
|
|
488
|
+
}
|
|
489
|
+
return curLimit;
|
|
490
|
+
}
|
|
491
|
+
),
|
|
471
492
|
pageLimit: computed(
|
|
472
|
-
() => [get().pageOffset(), get().limit, get().totalCount()],
|
|
493
|
+
() => [get().pageOffset(), get().limit(), get().totalCount()],
|
|
473
494
|
(pageOffset, limit2, totalCount) => totalCount == null ? void 0 : Math.min(totalCount - pageOffset, limit2)
|
|
474
495
|
),
|
|
475
496
|
filter: filter ?? defaultFilter2,
|
|
@@ -532,7 +553,7 @@ function useCreateDataTableContext({
|
|
|
532
553
|
latest.onOffsetChange?.(offset2);
|
|
533
554
|
},
|
|
534
555
|
setLimit: (limit2) => {
|
|
535
|
-
set({ updateCounter: get().updateCounter + 1,
|
|
556
|
+
set({ updateCounter: get().updateCounter + 1, _limit: limit2 });
|
|
536
557
|
latest.onLimitChange?.(limit2);
|
|
537
558
|
},
|
|
538
559
|
setFilter: (filter2) => {
|
|
@@ -724,7 +745,7 @@ function useCreateDataTableContext({
|
|
|
724
745
|
}
|
|
725
746
|
}, [offset, store]);
|
|
726
747
|
useEffect(() => {
|
|
727
|
-
if (limit !== void 0 && limit !== store.getState().
|
|
748
|
+
if (limit !== void 0 && limit !== store.getState()._limit) {
|
|
728
749
|
store.getState().actions.setLimit(limit);
|
|
729
750
|
}
|
|
730
751
|
}, [limit, store]);
|
|
@@ -1740,6 +1761,7 @@ const IconButton = forwardRef(function IconButton2({
|
|
|
1740
1761
|
onClick,
|
|
1741
1762
|
className,
|
|
1742
1763
|
children,
|
|
1764
|
+
"aria-disabled": ariaDisabled,
|
|
1743
1765
|
...otherProps
|
|
1744
1766
|
}, forwardedRef) {
|
|
1745
1767
|
const prefix = usePrefix();
|
|
@@ -1764,15 +1786,16 @@ const IconButton = forwardRef(function IconButton2({
|
|
|
1764
1786
|
if (asChild) {
|
|
1765
1787
|
content = cloneElement(children, void 0, content);
|
|
1766
1788
|
}
|
|
1789
|
+
const isAriaDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
1767
1790
|
const handleClick = useCallback(
|
|
1768
1791
|
(evt) => {
|
|
1769
|
-
if (disabled ||
|
|
1792
|
+
if (disabled || isAriaDisabled) {
|
|
1770
1793
|
evt.preventDefault();
|
|
1771
1794
|
return;
|
|
1772
1795
|
}
|
|
1773
1796
|
onClick?.(evt);
|
|
1774
1797
|
},
|
|
1775
|
-
[disabled,
|
|
1798
|
+
[disabled, isAriaDisabled, onClick]
|
|
1776
1799
|
);
|
|
1777
1800
|
const isButton = as === "button" && !asChild;
|
|
1778
1801
|
const As = asChild ? Slot : as;
|
|
@@ -1790,8 +1813,8 @@ const IconButton = forwardRef(function IconButton2({
|
|
|
1790
1813
|
onClick: handleClick,
|
|
1791
1814
|
"data-accent": color,
|
|
1792
1815
|
disabled,
|
|
1793
|
-
"data-disabled": boolDataAttr(
|
|
1794
|
-
"aria-disabled":
|
|
1816
|
+
"data-disabled": boolDataAttr(isAriaDisabled || !isButton && disabled),
|
|
1817
|
+
"aria-disabled": isAriaDisabled || !isButton && disabled || void 0,
|
|
1795
1818
|
"data-active": boolDataAttr(active),
|
|
1796
1819
|
"aria-keyshortcuts": keybindsToAriaKeyShortcuts(keybinds),
|
|
1797
1820
|
tabIndex: !isButton && disabled ? -1 : void 0,
|
|
@@ -2040,6 +2063,7 @@ const Button = forwardRef(function Button2({
|
|
|
2040
2063
|
onClick,
|
|
2041
2064
|
className,
|
|
2042
2065
|
children,
|
|
2066
|
+
"aria-disabled": ariaDisabled,
|
|
2043
2067
|
...otherProps
|
|
2044
2068
|
}, forwardedRef) {
|
|
2045
2069
|
const prefix = usePrefix();
|
|
@@ -2051,7 +2075,7 @@ const Button = forwardRef(function Button2({
|
|
|
2051
2075
|
prefix(`button__icon--${iconPlacement}`),
|
|
2052
2076
|
iconProps?.className
|
|
2053
2077
|
),
|
|
2054
|
-
children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(Icon, { icon, ...iconProps })
|
|
2078
|
+
children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(Icon, { icon, widthAuto: true, ...iconProps })
|
|
2055
2079
|
}
|
|
2056
2080
|
);
|
|
2057
2081
|
const spinnerEl = showSpinner && /* @__PURE__ */ jsx(
|
|
@@ -2066,15 +2090,16 @@ const Button = forwardRef(function Button2({
|
|
|
2066
2090
|
}
|
|
2067
2091
|
);
|
|
2068
2092
|
const content = loading && loadingContent ? asChild ? cloneElement(children, void 0, loadingContent) : loadingContent : children;
|
|
2093
|
+
const isAriaDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
2069
2094
|
const handleClick = useCallback(
|
|
2070
2095
|
(evt) => {
|
|
2071
|
-
if (disabled ||
|
|
2096
|
+
if (disabled || isAriaDisabled) {
|
|
2072
2097
|
evt.preventDefault();
|
|
2073
2098
|
return;
|
|
2074
2099
|
}
|
|
2075
2100
|
onClick?.(evt);
|
|
2076
2101
|
},
|
|
2077
|
-
[disabled,
|
|
2102
|
+
[disabled, isAriaDisabled, onClick]
|
|
2078
2103
|
);
|
|
2079
2104
|
const isButton = as === "button" && !asChild;
|
|
2080
2105
|
const As = asChild ? Slot : as;
|
|
@@ -2092,8 +2117,8 @@ const Button = forwardRef(function Button2({
|
|
|
2092
2117
|
onClick: handleClick,
|
|
2093
2118
|
"data-accent": color,
|
|
2094
2119
|
disabled,
|
|
2095
|
-
"data-disabled": boolDataAttr(
|
|
2096
|
-
"aria-disabled":
|
|
2120
|
+
"data-disabled": boolDataAttr(isAriaDisabled || !isButton && disabled),
|
|
2121
|
+
"aria-disabled": isAriaDisabled || !isButton && disabled || void 0,
|
|
2097
2122
|
"data-active": boolDataAttr(active),
|
|
2098
2123
|
"aria-keyshortcuts": keybindsToAriaKeyShortcuts(keybinds),
|
|
2099
2124
|
tabIndex: !isButton && disabled ? -1 : void 0,
|
|
@@ -2490,7 +2515,6 @@ const SEVERITY_ICON$1 = {
|
|
|
2490
2515
|
warning: faTriangleExclamation
|
|
2491
2516
|
};
|
|
2492
2517
|
const Toast = forwardRef(function Toast2({
|
|
2493
|
-
type,
|
|
2494
2518
|
duration,
|
|
2495
2519
|
defaultOpen,
|
|
2496
2520
|
open: controlledOpen,
|
|
@@ -2499,13 +2523,17 @@ const Toast = forwardRef(function Toast2({
|
|
|
2499
2523
|
onPause,
|
|
2500
2524
|
onResume,
|
|
2501
2525
|
onSwipeStart,
|
|
2526
|
+
onSwipeMove,
|
|
2502
2527
|
onSwipeEnd,
|
|
2528
|
+
onSwipeCancel,
|
|
2503
2529
|
forceMount,
|
|
2504
2530
|
variant = "solid",
|
|
2505
2531
|
severity = "info",
|
|
2532
|
+
announce = "assertive",
|
|
2506
2533
|
icon = SEVERITY_ICON$1[severity],
|
|
2507
2534
|
action,
|
|
2508
2535
|
actionAltText,
|
|
2536
|
+
dismissible = true,
|
|
2509
2537
|
showCloseButton = action == null || typeof action === "boolean",
|
|
2510
2538
|
visuallyHidden,
|
|
2511
2539
|
rootProps,
|
|
@@ -2522,19 +2550,35 @@ const Toast = forwardRef(function Toast2({
|
|
|
2522
2550
|
const [open, setOpen] = useControllableState(defaultOpen, controlledOpen);
|
|
2523
2551
|
const [collapsibleOpen, setCollapsibleOpen] = useState(open);
|
|
2524
2552
|
useEffect(() => setCollapsibleOpen(open), [open]);
|
|
2553
|
+
const preventIfUndismissible = useCallback(
|
|
2554
|
+
(evt) => {
|
|
2555
|
+
if (!dismissible) {
|
|
2556
|
+
evt.preventDefault();
|
|
2557
|
+
}
|
|
2558
|
+
},
|
|
2559
|
+
[dismissible]
|
|
2560
|
+
);
|
|
2525
2561
|
const accent = severity === "info" ? "primary" : severity;
|
|
2526
2562
|
const toast = /* @__PURE__ */ jsx(
|
|
2527
2563
|
Toast$1.Root,
|
|
2528
2564
|
{
|
|
2529
|
-
type,
|
|
2565
|
+
type: announce === "polite" ? "background" : "foreground",
|
|
2530
2566
|
duration,
|
|
2531
2567
|
open,
|
|
2532
2568
|
onOpenChange: combineEventHandlers(onOpenChange, setOpen),
|
|
2533
|
-
onEscapeKeyDown
|
|
2569
|
+
onEscapeKeyDown: combineEventHandlers(
|
|
2570
|
+
preventIfUndismissible,
|
|
2571
|
+
onEscapeKeyDown
|
|
2572
|
+
),
|
|
2534
2573
|
onPause,
|
|
2535
2574
|
onResume,
|
|
2536
|
-
onSwipeStart,
|
|
2537
|
-
|
|
2575
|
+
onSwipeStart: combineEventHandlers(preventIfUndismissible, onSwipeStart),
|
|
2576
|
+
onSwipeMove: combineEventHandlers(preventIfUndismissible, onSwipeMove),
|
|
2577
|
+
onSwipeEnd: combineEventHandlers(preventIfUndismissible, onSwipeEnd),
|
|
2578
|
+
onSwipeCancel: combineEventHandlers(
|
|
2579
|
+
preventIfUndismissible,
|
|
2580
|
+
onSwipeCancel
|
|
2581
|
+
),
|
|
2538
2582
|
forceMount,
|
|
2539
2583
|
...rootProps,
|
|
2540
2584
|
className: cx(prefix("toast__root"), rootProps?.className),
|
|
@@ -2580,7 +2624,7 @@ const Toast = forwardRef(function Toast2({
|
|
|
2580
2624
|
children
|
|
2581
2625
|
}
|
|
2582
2626
|
),
|
|
2583
|
-
(action || showCloseButton) && /* @__PURE__ */ jsxs(
|
|
2627
|
+
(action || dismissible && showCloseButton) && /* @__PURE__ */ jsxs(
|
|
2584
2628
|
"div",
|
|
2585
2629
|
{
|
|
2586
2630
|
...actionContainerProps,
|
|
@@ -2590,7 +2634,7 @@ const Toast = forwardRef(function Toast2({
|
|
|
2590
2634
|
),
|
|
2591
2635
|
children: [
|
|
2592
2636
|
action && /* @__PURE__ */ jsx(Toast$1.Action, { altText: actionAltText, asChild: true, children: action }),
|
|
2593
|
-
showCloseButton && /* @__PURE__ */ jsx(Toast$1.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2637
|
+
dismissible && showCloseButton && /* @__PURE__ */ jsx(Toast$1.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2594
2638
|
CloseButton,
|
|
2595
2639
|
{
|
|
2596
2640
|
color: variant === "solid" ? "neutral" : accent,
|
|
@@ -2663,17 +2707,19 @@ function ToastManagerProvider({ children }) {
|
|
|
2663
2707
|
[]
|
|
2664
2708
|
);
|
|
2665
2709
|
const removeToast = useCallback((toastId2) => {
|
|
2666
|
-
|
|
2667
|
-
|
|
2710
|
+
if (toastId2 == null) {
|
|
2711
|
+
return;
|
|
2712
|
+
}
|
|
2713
|
+
setToasts((toasts2) => {
|
|
2714
|
+
return toastId2 in toasts2 && toasts2[toastId2].open ? Object.entries(toasts2).reduce(
|
|
2668
2715
|
(res, [id, toast]) => {
|
|
2669
2716
|
const numId = +id;
|
|
2670
2717
|
res[numId] = numId === toastId2 ? { ...toast, open: false } : toast;
|
|
2671
2718
|
return res;
|
|
2672
2719
|
},
|
|
2673
2720
|
{}
|
|
2674
|
-
)
|
|
2675
|
-
);
|
|
2676
|
-
setTimeout(() => setToasts(({ [toastId2]: _, ...toasts2 }) => toasts2), 250);
|
|
2721
|
+
) : toasts2;
|
|
2722
|
+
});
|
|
2677
2723
|
}, []);
|
|
2678
2724
|
const handleAnimationEnd = useCallback(
|
|
2679
2725
|
(toastId2) => {
|
|
@@ -2753,7 +2799,7 @@ const Collapsible = forwardRef(function Collapsible2({
|
|
|
2753
2799
|
defaultOpen,
|
|
2754
2800
|
open: controlledOpen,
|
|
2755
2801
|
onOpenChange,
|
|
2756
|
-
|
|
2802
|
+
orientation = "vertical",
|
|
2757
2803
|
className,
|
|
2758
2804
|
...otherProps
|
|
2759
2805
|
}, forwardedRef) {
|
|
@@ -2762,7 +2808,7 @@ const Collapsible = forwardRef(function Collapsible2({
|
|
|
2762
2808
|
defaultOpen ?? false,
|
|
2763
2809
|
controlledOpen
|
|
2764
2810
|
);
|
|
2765
|
-
return /* @__PURE__ */ jsx(CollapsibleContext.Provider, { value: { open,
|
|
2811
|
+
return /* @__PURE__ */ jsx(CollapsibleContext.Provider, { value: { open, orientation }, children: /* @__PURE__ */ jsx(
|
|
2766
2812
|
Collapsible$1.Root,
|
|
2767
2813
|
{
|
|
2768
2814
|
open,
|
|
@@ -2775,30 +2821,53 @@ const Collapsible = forwardRef(function Collapsible2({
|
|
|
2775
2821
|
});
|
|
2776
2822
|
const CollapsibleContent = forwardRef(function CollapsibleContent2({ className, ...otherProps }, forwardedRef) {
|
|
2777
2823
|
const prefix = usePrefix();
|
|
2778
|
-
const {
|
|
2824
|
+
const { orientation } = useCollapsibleContext();
|
|
2779
2825
|
return /* @__PURE__ */ jsx(
|
|
2780
2826
|
Collapsible$1.Content,
|
|
2781
2827
|
{
|
|
2782
2828
|
className: cx(prefix("collapsible__content"), className),
|
|
2783
2829
|
...otherProps,
|
|
2784
|
-
"data-
|
|
2830
|
+
"data-orientation": orientation,
|
|
2785
2831
|
ref: forwardedRef
|
|
2786
2832
|
}
|
|
2787
2833
|
);
|
|
2788
2834
|
});
|
|
2789
|
-
const CollapsibleTrigger = forwardRef(function CollapsibleTrigger2({ children, ...
|
|
2835
|
+
const CollapsibleTrigger = forwardRef(function CollapsibleTrigger2({ children, ...otherProps }, forwardedRef) {
|
|
2790
2836
|
const prefix = usePrefix();
|
|
2791
|
-
const
|
|
2792
|
-
|
|
2837
|
+
const [locale7] = useLocale();
|
|
2838
|
+
const { open, orientation } = useCollapsibleContext();
|
|
2839
|
+
if (children !== void 0) {
|
|
2840
|
+
return /* @__PURE__ */ jsx(
|
|
2841
|
+
Collapsible$1.Trigger,
|
|
2842
|
+
{
|
|
2843
|
+
...otherProps,
|
|
2844
|
+
asChild: true,
|
|
2845
|
+
ref: forwardedRef,
|
|
2846
|
+
children: typeof children === "function" ? children(open) : children
|
|
2847
|
+
}
|
|
2848
|
+
);
|
|
2849
|
+
}
|
|
2850
|
+
const {
|
|
2851
|
+
icon,
|
|
2852
|
+
expandIcon = icon ?? (orientation === "horizontal" ? faChevronRight : faChevronDown),
|
|
2853
|
+
collapseIcon = icon ?? (orientation === "horizontal" ? faChevronLeft : faChevronUp),
|
|
2854
|
+
label,
|
|
2855
|
+
expandLabel = label ?? locale7.CollapsibleTrigger.expandLabel,
|
|
2856
|
+
collapseLabel = label ?? locale7.CollapsibleTrigger.collapseLabel,
|
|
2857
|
+
className,
|
|
2858
|
+
...iconButtonProps
|
|
2859
|
+
} = otherProps;
|
|
2860
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2793
2861
|
IconButton,
|
|
2794
2862
|
{
|
|
2795
2863
|
variant: "ghost",
|
|
2796
|
-
className: prefix("collapsible__trigger"),
|
|
2797
|
-
|
|
2798
|
-
|
|
2864
|
+
className: cx(prefix("collapsible__trigger"), className),
|
|
2865
|
+
...iconButtonProps,
|
|
2866
|
+
icon: open ? collapseIcon : expandIcon,
|
|
2867
|
+
label: open ? collapseLabel : expandLabel,
|
|
2868
|
+
ref: forwardedRef
|
|
2799
2869
|
}
|
|
2800
|
-
);
|
|
2801
|
-
return /* @__PURE__ */ jsx(Collapsible$1.Trigger, { ...props, asChild: true, ref: forwardedRef, children: typeof children === "function" ? children(open) : children });
|
|
2870
|
+
) });
|
|
2802
2871
|
});
|
|
2803
2872
|
const AlertContext = createContext(null);
|
|
2804
2873
|
function useAlertContext() {
|
|
@@ -2842,7 +2911,7 @@ const Alert = forwardRef(function Alert2({
|
|
|
2842
2911
|
const [titleId, setTitleId] = useState();
|
|
2843
2912
|
const accent = severity === "info" ? "primary" : severity;
|
|
2844
2913
|
const actualRole = role ?? (announce === "assertive" ? "alert" : announce === "polite" ? "status" : void 0);
|
|
2845
|
-
return /* @__PURE__ */ jsx(AlertContext, { value: { setTitleId }, children: /* @__PURE__ */ jsx(
|
|
2914
|
+
return /* @__PURE__ */ jsx(AlertContext.Provider, { value: { setTitleId }, children: /* @__PURE__ */ jsx(
|
|
2846
2915
|
Collapsible,
|
|
2847
2916
|
{
|
|
2848
2917
|
defaultOpen,
|
|
@@ -3225,12 +3294,13 @@ const CalendarDay = memo(function CalendarDay2({
|
|
|
3225
3294
|
const prefix = usePrefix();
|
|
3226
3295
|
const {
|
|
3227
3296
|
classNames,
|
|
3228
|
-
dayPickerProps: { onDayClick }
|
|
3297
|
+
dayPickerProps: { disableNavigation, onDayClick }
|
|
3229
3298
|
} = useDayPicker();
|
|
3230
|
-
const isInteractive = onDayClick !== void 0;
|
|
3299
|
+
const isInteractive = children && onDayClick !== void 0;
|
|
3300
|
+
const renderButton = isInteractive && (!disableNavigation || !modifiers.outside);
|
|
3231
3301
|
const dayText = isInteractive ? children.props.children : children;
|
|
3232
3302
|
const dayContent = /* @__PURE__ */ jsx("span", { className: prefix("calendar__day-content"), children: dayText });
|
|
3233
|
-
return /* @__PURE__ */ jsx("td", { ...otherProps, children: !modifiers.hidden && (
|
|
3303
|
+
return /* @__PURE__ */ jsx("td", { ...otherProps, children: !modifiers.hidden && (renderButton ? cloneElement(children, {
|
|
3234
3304
|
children: dayContent
|
|
3235
3305
|
}) : /* @__PURE__ */ jsx("span", { className: classNames.day_button, children: dayContent })) });
|
|
3236
3306
|
});
|
|
@@ -3270,7 +3340,7 @@ const ControlAddon = forwardRef(
|
|
|
3270
3340
|
"data-variant": controlContext?.variant ?? variant,
|
|
3271
3341
|
"data-status": controlContext?.status ?? status,
|
|
3272
3342
|
"data-muted": boolDataAttr(
|
|
3273
|
-
controlContext?.disabled || controlContext?.
|
|
3343
|
+
controlContext?.disabled || controlContext?.softDisabled || muted
|
|
3274
3344
|
),
|
|
3275
3345
|
"data-readonly": boolDataAttr(controlContext?.readOnly || readOnly),
|
|
3276
3346
|
ref: forwardedRef,
|
|
@@ -3989,8 +4059,14 @@ const TableFoot = forwardRef(
|
|
|
3989
4059
|
);
|
|
3990
4060
|
const Popover = Popover$1.Root;
|
|
3991
4061
|
const PopoverAnchor = Popover$1.Anchor;
|
|
3992
|
-
const PopoverClose = forwardRef(function PopoverClose2(
|
|
3993
|
-
return /* @__PURE__ */ jsx(Popover$1.Close, {
|
|
4062
|
+
const PopoverClose = forwardRef(function PopoverClose2({ children, ...otherProps }, forwardedRef) {
|
|
4063
|
+
return children === void 0 ? /* @__PURE__ */ jsx(Popover$1.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4064
|
+
CloseButton,
|
|
4065
|
+
{
|
|
4066
|
+
...otherProps,
|
|
4067
|
+
ref: forwardedRef
|
|
4068
|
+
}
|
|
4069
|
+
) }) : /* @__PURE__ */ jsx(Popover$1.Close, { ...otherProps, asChild: true, ref: forwardedRef, children });
|
|
3994
4070
|
});
|
|
3995
4071
|
const PopoverContent = forwardRef(function PopoverContent2({
|
|
3996
4072
|
showArrow = true,
|
|
@@ -4071,6 +4147,7 @@ const Stack = forwardRef(function Stack2({
|
|
|
4071
4147
|
const stackContext = useContext(StackContext);
|
|
4072
4148
|
const childMarginMapper = (gapVar) => (d) => d === "column" ? `${cssVar(`stack-${gapVar}`)} 0 0 0` : d === "column-reverse" ? `0 0 ${cssVar(`stack-${gapVar}`)} 0` : d === "row" ? `0 0 0 ${cssVar(`stack-${gapVar}`)}` : `0 ${cssVar(`stack-${gapVar}`)} 0 0`;
|
|
4073
4149
|
const gapMapper = (v) => typeof v === "number" ? spacing(v) : v;
|
|
4150
|
+
const wrapMapper = (v) => v === "reverse" ? "wrap-reverse" : v ? "wrap" : "nowrap";
|
|
4074
4151
|
const { cssVars, dataAttrs } = responsiveValuesToCssVarsAndDataAttrs(
|
|
4075
4152
|
"stack",
|
|
4076
4153
|
{
|
|
@@ -4088,7 +4165,8 @@ const Stack = forwardRef(function Stack2({
|
|
|
4088
4165
|
ancestorGap: gapMapper,
|
|
4089
4166
|
ancestorChildMargin: childMarginMapper("ancestor-gap"),
|
|
4090
4167
|
gap: gapMapper,
|
|
4091
|
-
childMargin: childMarginMapper("gap")
|
|
4168
|
+
childMargin: childMarginMapper("gap"),
|
|
4169
|
+
wrap: wrapMapper
|
|
4092
4170
|
}
|
|
4093
4171
|
);
|
|
4094
4172
|
const As = asChild ? Slot : "div";
|
|
@@ -4471,6 +4549,8 @@ function rightMostColumns(columns) {
|
|
|
4471
4549
|
const lastColumn = columns[columns.length - 1];
|
|
4472
4550
|
return [lastColumn, ...rightMostColumns(lastColumn.children)];
|
|
4473
4551
|
}
|
|
4552
|
+
const DEFAULT_OFFSET = 0;
|
|
4553
|
+
const DEFAULT_LIMIT = 10;
|
|
4474
4554
|
const DataTable = forwardRef(
|
|
4475
4555
|
function DataTableRoot({
|
|
4476
4556
|
displayMode = "paged",
|
|
@@ -4481,10 +4561,10 @@ const DataTable = forwardRef(
|
|
|
4481
4561
|
loadingCount = 2,
|
|
4482
4562
|
required,
|
|
4483
4563
|
loading = false,
|
|
4484
|
-
defaultOffset =
|
|
4564
|
+
defaultOffset = DEFAULT_OFFSET,
|
|
4485
4565
|
offset,
|
|
4486
4566
|
onOffsetChange,
|
|
4487
|
-
defaultLimit =
|
|
4567
|
+
defaultLimit = DEFAULT_LIMIT,
|
|
4488
4568
|
limit,
|
|
4489
4569
|
onLimitChange,
|
|
4490
4570
|
defaultFilter: defaultFilter2 = "",
|
|
@@ -4516,6 +4596,14 @@ const DataTable = forwardRef(
|
|
|
4516
4596
|
const printing = usePrinting();
|
|
4517
4597
|
const leaves = useMemo(() => leafColumns(columns), [columns]);
|
|
4518
4598
|
const headCount = useMemo(() => numberOfRows(columns), [columns]);
|
|
4599
|
+
defaultOffset = sanitizeNumeric(defaultOffset) ?? DEFAULT_OFFSET;
|
|
4600
|
+
offset = sanitizeNumeric(offset);
|
|
4601
|
+
defaultLimit = sanitizeNumeric(defaultLimit) ?? DEFAULT_LIMIT;
|
|
4602
|
+
limit = sanitizeNumeric(limit);
|
|
4603
|
+
defaultSortBy = sanitizeSortBy(defaultSortBy, leaves) ?? null;
|
|
4604
|
+
sortBy = sanitizeSortBy(sortBy, leaves);
|
|
4605
|
+
defaultSortDirection = sanitizeSortDirection(defaultSortDirection);
|
|
4606
|
+
sortDirection = sanitizeSortDirection(sortDirection);
|
|
4519
4607
|
const dataTableContextValue = useCreateDataTableContext({
|
|
4520
4608
|
displayMode: printing ? "paged" : displayMode,
|
|
4521
4609
|
columns,
|
|
@@ -4585,6 +4673,18 @@ function numberOfRows(columns) {
|
|
|
4585
4673
|
0
|
|
4586
4674
|
);
|
|
4587
4675
|
}
|
|
4676
|
+
function sanitizeNumeric(value) {
|
|
4677
|
+
if (typeof value === "string") {
|
|
4678
|
+
value = +value;
|
|
4679
|
+
}
|
|
4680
|
+
return value === void 0 || Number.isNaN(value) ? void 0 : Math.trunc(value);
|
|
4681
|
+
}
|
|
4682
|
+
function sanitizeSortBy(sortBy, leaves) {
|
|
4683
|
+
return sortBy == null || sortBy in leaves ? sortBy : null;
|
|
4684
|
+
}
|
|
4685
|
+
function sanitizeSortDirection(sortDirection) {
|
|
4686
|
+
return sortDirection === void 0 || sortDirection === "asc" || sortDirection === "desc" ? sortDirection : void 0;
|
|
4687
|
+
}
|
|
4588
4688
|
function useDataTableApiRef() {
|
|
4589
4689
|
return useRef(null);
|
|
4590
4690
|
}
|
|
@@ -4922,6 +5022,7 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
4922
5022
|
required,
|
|
4923
5023
|
disabled,
|
|
4924
5024
|
readOnly,
|
|
5025
|
+
"aria-disabled": ariaDisabled,
|
|
4925
5026
|
"aria-label": ariaLabel,
|
|
4926
5027
|
"aria-labelledby": ariaLabelledBy,
|
|
4927
5028
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -4953,7 +5054,6 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
4953
5054
|
const checkboxVariant = variant ?? (isInTableCell ? "cell" : "default");
|
|
4954
5055
|
status = controlContext?.status ?? status;
|
|
4955
5056
|
disabled = controlContext?.disabled || disabled;
|
|
4956
|
-
loading = controlContext?.loading || loading;
|
|
4957
5057
|
readOnly = controlContext?.readOnly || readOnly;
|
|
4958
5058
|
const requiredInGroup = useIsRequiredInGroup();
|
|
4959
5059
|
const groupDescriptionIds = useCheckboxGroupDescriptionIds(controlId);
|
|
@@ -4964,15 +5064,16 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
4964
5064
|
defaultChecked ?? false,
|
|
4965
5065
|
checkedInGroup ?? controlledChecked
|
|
4966
5066
|
);
|
|
5067
|
+
const softDisabled = controlContext?.softDisabled || loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
4967
5068
|
const handleCheckedChange = useCallback(
|
|
4968
5069
|
(state) => {
|
|
4969
|
-
if (!
|
|
5070
|
+
if (!softDisabled && !readOnly) {
|
|
4970
5071
|
onCheckedChange?.(state);
|
|
4971
5072
|
setChecked(state);
|
|
4972
5073
|
setCheckedInGroup?.(state === true);
|
|
4973
5074
|
}
|
|
4974
5075
|
},
|
|
4975
|
-
[
|
|
5076
|
+
[softDisabled, onCheckedChange, readOnly, setChecked, setCheckedInGroup]
|
|
4976
5077
|
);
|
|
4977
5078
|
const setFieldControlFocused = useSetFieldControlFocused();
|
|
4978
5079
|
const handleFocus = useCallback(() => {
|
|
@@ -5017,7 +5118,7 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
5017
5118
|
),
|
|
5018
5119
|
status,
|
|
5019
5120
|
disabled,
|
|
5020
|
-
|
|
5121
|
+
softDisabled,
|
|
5021
5122
|
readOnly
|
|
5022
5123
|
},
|
|
5023
5124
|
children: [
|
|
@@ -5044,7 +5145,7 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
5044
5145
|
{
|
|
5045
5146
|
"data-status": status,
|
|
5046
5147
|
"data-variant": checkboxVariant,
|
|
5047
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
5148
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
5048
5149
|
"data-readonly": boolDataAttr(readOnly),
|
|
5049
5150
|
...containerProps,
|
|
5050
5151
|
className: cx(
|
|
@@ -5067,14 +5168,14 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
5067
5168
|
checked,
|
|
5068
5169
|
required: requiredInGroup || required || void 0,
|
|
5069
5170
|
disabled,
|
|
5070
|
-
"data-
|
|
5171
|
+
"data-disabled": boolDataAttr(softDisabled),
|
|
5071
5172
|
"data-readonly": boolDataAttr(readOnly),
|
|
5072
5173
|
"data-status": status,
|
|
5073
5174
|
"data-variant": checkboxVariant,
|
|
5074
5175
|
onCheckedChange: handleCheckedChange,
|
|
5075
5176
|
onFocus: combineEventHandlers(onFocus, handleFocus),
|
|
5076
5177
|
onBlur: combineEventHandlers(onBlur, handleBlur),
|
|
5077
|
-
"aria-disabled":
|
|
5178
|
+
"aria-disabled": softDisabled || readOnly || void 0,
|
|
5078
5179
|
"aria-label": ariaLabel,
|
|
5079
5180
|
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 && combinedLabelIds !== labelId && combinedLabelIds !== fieldLabelId ? combinedLabelIds : void 0),
|
|
5080
5181
|
"aria-invalid": status === "invalid" || void 0,
|
|
@@ -5130,7 +5231,7 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
5130
5231
|
Spinner,
|
|
5131
5232
|
{
|
|
5132
5233
|
color: controlStatusToAccent(status, "neutral"),
|
|
5133
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
5234
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
5134
5235
|
...spinnerProps,
|
|
5135
5236
|
className: cx(
|
|
5136
5237
|
prefix("checkbox__spinner"),
|
|
@@ -5187,14 +5288,12 @@ function useDataTableSelectionColumn() {
|
|
|
5187
5288
|
return "loading";
|
|
5188
5289
|
}
|
|
5189
5290
|
const key = getRowKey(row, rowKey);
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
selectedCount += +selectedRows2.has(key);
|
|
5193
|
-
}
|
|
5291
|
+
enabledCount += +!disabledSelections?.has(key);
|
|
5292
|
+
selectedCount += +selectedRows2.has(key);
|
|
5194
5293
|
}
|
|
5195
5294
|
return {
|
|
5196
5295
|
allChecked: selectedCount === window2.length ? true : selectedCount === 0 ? false : "indeterminate",
|
|
5197
|
-
allEnabledChecked: selectedCount
|
|
5296
|
+
allEnabledChecked: selectedCount >= enabledCount
|
|
5198
5297
|
};
|
|
5199
5298
|
})
|
|
5200
5299
|
);
|
|
@@ -5258,10 +5357,10 @@ function selectionWindow(displayMode, state) {
|
|
|
5258
5357
|
if (displayMode === "paged") {
|
|
5259
5358
|
return state.rowsWindow(
|
|
5260
5359
|
state.pageOffset(),
|
|
5261
|
-
state.pageLimit() ?? state.limit
|
|
5360
|
+
state.pageLimit() ?? state.limit()
|
|
5262
5361
|
);
|
|
5263
5362
|
} else {
|
|
5264
|
-
const totalCount = state.totalCount() ?? state.limit;
|
|
5363
|
+
const totalCount = state.totalCount() ?? state.limit();
|
|
5265
5364
|
const start = Math.min(state.scrolledRangeStart, totalCount - 1);
|
|
5266
5365
|
const end = Math.min(state.scrolledRangeEnd, totalCount - 1);
|
|
5267
5366
|
return state.rowsWindow(start, end - start + 1);
|
|
@@ -5421,7 +5520,7 @@ function PagedDataTableRows() {
|
|
|
5421
5520
|
const splice = useCallback(
|
|
5422
5521
|
(startIndex, deleted = 0, added = 0) => {
|
|
5423
5522
|
const { pageOffset: pageOffset2, limit, actions } = store.getState();
|
|
5424
|
-
actions.spliceWindow(pageOffset2(), limit, startIndex, deleted, added);
|
|
5523
|
+
actions.spliceWindow(pageOffset2(), limit(), startIndex, deleted, added);
|
|
5425
5524
|
},
|
|
5426
5525
|
[store]
|
|
5427
5526
|
);
|
|
@@ -5443,7 +5542,7 @@ function PagedDataTableRows() {
|
|
|
5443
5542
|
(state) => state.updateCounter,
|
|
5444
5543
|
() => {
|
|
5445
5544
|
const { pageOffset: pageOffset2, pageLimit, limit, actions } = store.getState();
|
|
5446
|
-
actions.updateWindow(pageOffset2(), pageLimit() ?? limit);
|
|
5545
|
+
actions.updateWindow(pageOffset2(), pageLimit() ?? limit());
|
|
5447
5546
|
},
|
|
5448
5547
|
{ fireImmediately: true }
|
|
5449
5548
|
),
|
|
@@ -5513,7 +5612,7 @@ function ScrolledDataTableRows({
|
|
|
5513
5612
|
const { offset, limit, totalCount, actions } = store.getState();
|
|
5514
5613
|
if (totalCount() == null) {
|
|
5515
5614
|
const from = Math.max(0, offset() - overscan);
|
|
5516
|
-
const to = offset() + limit + overscan;
|
|
5615
|
+
const to = offset() + limit() + overscan;
|
|
5517
5616
|
actions.updateWindow(from, to - from + 1);
|
|
5518
5617
|
} else {
|
|
5519
5618
|
actions.updateWindow(virtualItems2[0]?.index ?? 0, virtualItems2.length);
|
|
@@ -5532,7 +5631,7 @@ function ScrolledDataTableRows({
|
|
|
5532
5631
|
(startIndex2, deleted = 0, added = 0) => {
|
|
5533
5632
|
const { limit, actions } = store.getState();
|
|
5534
5633
|
const windowOffset = virtualizer.getVirtualItems()[0]?.index ?? 0;
|
|
5535
|
-
const windowLimit = limit + Math.min(windowOffset, overscan) + overscan;
|
|
5634
|
+
const windowLimit = limit() + Math.min(windowOffset, overscan) + overscan;
|
|
5536
5635
|
actions.spliceWindow(
|
|
5537
5636
|
windowOffset,
|
|
5538
5637
|
windowLimit,
|
|
@@ -5554,7 +5653,7 @@ function ScrolledDataTableRows({
|
|
|
5554
5653
|
(index, options) => {
|
|
5555
5654
|
const state = store.getState();
|
|
5556
5655
|
const totalCount = state.totalCount();
|
|
5557
|
-
if (totalCount != null && totalCount > state.limit) {
|
|
5656
|
+
if (totalCount != null && totalCount > state.limit()) {
|
|
5558
5657
|
if (index < totalCount - 1) {
|
|
5559
5658
|
virtualizer.scrollToIndex(index, options);
|
|
5560
5659
|
} else {
|
|
@@ -5790,7 +5889,7 @@ const DataTableContent = forwardRef(function DataTable2({
|
|
|
5790
5889
|
const rowHeight = typeof estimatedRowHeight === "number" ? estimatedRowHeight : estimatedRowHeight(0);
|
|
5791
5890
|
const maxHeight = useStore$1(
|
|
5792
5891
|
store,
|
|
5793
|
-
(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
|
|
5892
|
+
(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
|
|
5794
5893
|
scrollbarHeight : void 0
|
|
5795
5894
|
);
|
|
5796
5895
|
const stickyHeadFoot = maxHeight !== void 0;
|
|
@@ -5852,7 +5951,7 @@ const DataTableContent = forwardRef(function DataTable2({
|
|
|
5852
5951
|
});
|
|
5853
5952
|
const DataTableFilter = forwardRef(function DataTableFilter2({
|
|
5854
5953
|
preferRightAlignment = true,
|
|
5855
|
-
endAdornment = /* @__PURE__ */ jsx(ControlAddon, { children: /* @__PURE__ */ jsx(Icon, { icon:
|
|
5954
|
+
endAdornment = /* @__PURE__ */ jsx(ControlAddon, { children: /* @__PURE__ */ jsx(Icon, { icon: faSearch }) }),
|
|
5856
5955
|
placeholder,
|
|
5857
5956
|
["aria-label"]: ariaLabel,
|
|
5858
5957
|
onValueChange,
|
|
@@ -5872,8 +5971,8 @@ const DataTableFilter = forwardRef(function DataTableFilter2({
|
|
|
5872
5971
|
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(
|
|
5873
5972
|
Input$1,
|
|
5874
5973
|
{
|
|
5974
|
+
type: "search",
|
|
5875
5975
|
placeholder,
|
|
5876
|
-
showClearButton: "auto",
|
|
5877
5976
|
endAdornment,
|
|
5878
5977
|
className: cx(prefix("data-table__filter"), className),
|
|
5879
5978
|
value: filter,
|
|
@@ -5908,8 +6007,9 @@ const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
|
5908
6007
|
const [locale7] = useLocale();
|
|
5909
6008
|
ariaLabel ??= locale7.DataTablePagination["aria-label"];
|
|
5910
6009
|
const { store } = useDataTableContext();
|
|
6010
|
+
const loading = useStore$1(store, (state) => state.loading);
|
|
5911
6011
|
const totalCount = useStore$1(store, (state) => state.totalCount());
|
|
5912
|
-
const limit = useStore$1(store, (state) => state.limit);
|
|
6012
|
+
const limit = useStore$1(store, (state) => state.limit());
|
|
5913
6013
|
const { setOffset } = useStore$1(store, (state) => state.actions);
|
|
5914
6014
|
const setOffsetWithTransition = (offset) => startTransition(() => setOffset(offset));
|
|
5915
6015
|
const currentPage = useStore$1(store, (state) => state.currentPage());
|
|
@@ -5926,8 +6026,8 @@ const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
|
5926
6026
|
ref: forwardedRef,
|
|
5927
6027
|
children: [
|
|
5928
6028
|
/* @__PURE__ */ jsxs("label", { className: prefix("data-table__pagination-label"), children: [
|
|
5929
|
-
totalCount == null && /* @__PURE__ */ jsx(Spinner, { className: prefix("data-table__pagination-spinner") }),
|
|
5930
|
-
totalCount != null && rowsRange?.(
|
|
6029
|
+
(loading || totalCount == null) && /* @__PURE__ */ jsx(Spinner, { className: prefix("data-table__pagination-spinner") }),
|
|
6030
|
+
!loading && totalCount != null && rowsRange?.(
|
|
5931
6031
|
/* @__PURE__ */ jsxs(
|
|
5932
6032
|
Select,
|
|
5933
6033
|
{
|
|
@@ -5960,7 +6060,7 @@ const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
|
5960
6060
|
icon: faArrowLeft,
|
|
5961
6061
|
label: previousPageButtonLabel ?? "",
|
|
5962
6062
|
...previousPageButtonProps,
|
|
5963
|
-
disabled: currentPage === 0 || previousPageButtonProps?.disabled,
|
|
6063
|
+
disabled: loading || currentPage === 0 || previousPageButtonProps?.disabled,
|
|
5964
6064
|
onClick: combineEventHandlers(
|
|
5965
6065
|
(() => setOffsetWithTransition((currentPage - 1) * limit)),
|
|
5966
6066
|
previousPageButtonProps?.onClick
|
|
@@ -5974,7 +6074,7 @@ const PagedDataTablePagination = forwardRef(function PagedDataTablePagination2({
|
|
|
5974
6074
|
icon: faArrowRight,
|
|
5975
6075
|
label: nextPageButtonLabel ?? "",
|
|
5976
6076
|
...nextPageButtonProps,
|
|
5977
|
-
disabled: currentPage === lastPage || nextPageButtonProps?.disabled,
|
|
6077
|
+
disabled: loading || currentPage === lastPage || nextPageButtonProps?.disabled,
|
|
5978
6078
|
onClick: combineEventHandlers(
|
|
5979
6079
|
(() => setOffsetWithTransition((currentPage + 1) * limit)),
|
|
5980
6080
|
nextPageButtonProps?.onClick
|
|
@@ -6055,9 +6155,9 @@ const DataTablePagination = forwardRef(function DataTablePagination2({
|
|
|
6055
6155
|
}
|
|
6056
6156
|
);
|
|
6057
6157
|
});
|
|
6058
|
-
const
|
|
6158
|
+
const DEFAULT_LIMIT_OPTIONS = [10, 15, 25, 50];
|
|
6059
6159
|
const DataTableRowsPerPage = forwardRef(function DataTableRowsPerPage2({
|
|
6060
|
-
limitOptions =
|
|
6160
|
+
limitOptions = DEFAULT_LIMIT_OPTIONS,
|
|
6061
6161
|
label,
|
|
6062
6162
|
preferRightAlignment,
|
|
6063
6163
|
className,
|
|
@@ -6067,10 +6167,15 @@ const DataTableRowsPerPage = forwardRef(function DataTableRowsPerPage2({
|
|
|
6067
6167
|
const [locale7] = useLocale();
|
|
6068
6168
|
label ??= locale7.DataTableRowsPerPage.label;
|
|
6069
6169
|
const { store } = useDataTableContext();
|
|
6070
|
-
const limit = useStore$1(store, (state) => state.limit);
|
|
6170
|
+
const limit = useStore$1(store, (state) => state.limit());
|
|
6071
6171
|
const { setLimit } = useStore$1(store, (state) => state.actions);
|
|
6072
|
-
const
|
|
6073
|
-
|
|
6172
|
+
const normalizedLimitOptions = useMemo(() => {
|
|
6173
|
+
return limitOptions === DEFAULT_LIMIT_OPTIONS ? limitOptions : Array.from(new Set(limitOptions.map(Math.trunc))).sort((a, b) => a - b).filter((limit2) => limit2 >= 1);
|
|
6174
|
+
}, [limitOptions]);
|
|
6175
|
+
useEffect(() => {
|
|
6176
|
+
store.setState({ limitOptions: normalizedLimitOptions });
|
|
6177
|
+
return () => store.setState({ limitOptions: void 0 });
|
|
6178
|
+
}, [normalizedLimitOptions, store]);
|
|
6074
6179
|
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(FieldProvider, { children: /* @__PURE__ */ jsxs(
|
|
6075
6180
|
"div",
|
|
6076
6181
|
{
|
|
@@ -6090,7 +6195,7 @@ const DataTableRowsPerPage = forwardRef(function DataTableRowsPerPage2({
|
|
|
6090
6195
|
rootProps: {
|
|
6091
6196
|
className: prefix("data-table__rows-per-page-select-root")
|
|
6092
6197
|
},
|
|
6093
|
-
children:
|
|
6198
|
+
children: normalizedLimitOptions.map((option) => /* @__PURE__ */ jsx(Option, { value: option, children: option }, option))
|
|
6094
6199
|
}
|
|
6095
6200
|
)
|
|
6096
6201
|
]
|
|
@@ -6107,7 +6212,10 @@ const DataTableSelectionTrigger = forwardRef(function DataTableSelectionTrigger2
|
|
|
6107
6212
|
}, forwardedRef) {
|
|
6108
6213
|
const prefix = usePrefix();
|
|
6109
6214
|
const { store } = useDataTableContext();
|
|
6110
|
-
const hasSelected = useStore$1(
|
|
6215
|
+
const hasSelected = useStore$1(
|
|
6216
|
+
store,
|
|
6217
|
+
(state) => state.selectedRows[0].size > 0
|
|
6218
|
+
);
|
|
6111
6219
|
const handleClick = useCallback(
|
|
6112
6220
|
(event) => {
|
|
6113
6221
|
onClick(Array.from(store.getState().selectedRows[0]).sort(), event);
|
|
@@ -6146,7 +6254,7 @@ const Input$1 = forwardRef(
|
|
|
6146
6254
|
align,
|
|
6147
6255
|
startAdornment,
|
|
6148
6256
|
endAdornment,
|
|
6149
|
-
showClearButton,
|
|
6257
|
+
showClearButton = type === "search" ? "auto" : void 0,
|
|
6150
6258
|
clearDescription,
|
|
6151
6259
|
clearButtonLabel,
|
|
6152
6260
|
onValueChange,
|
|
@@ -6166,6 +6274,7 @@ const Input$1 = forwardRef(
|
|
|
6166
6274
|
onFocus,
|
|
6167
6275
|
onBlur,
|
|
6168
6276
|
onClick,
|
|
6277
|
+
"aria-disabled": ariaDisabled,
|
|
6169
6278
|
"aria-label": ariaLabel,
|
|
6170
6279
|
"aria-labelledby": ariaLabelledBy,
|
|
6171
6280
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -6197,6 +6306,7 @@ const Input$1 = forwardRef(
|
|
|
6197
6306
|
const isInTableCell = useIsInTableCell();
|
|
6198
6307
|
variant ??= isInTableCell ? "cell" : "default";
|
|
6199
6308
|
const isControlled = value !== void 0;
|
|
6309
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
6200
6310
|
const [shouldShowClearButton, setShouldShowClearButton] = useState(
|
|
6201
6311
|
((value ?? defaultValue)?.toString() ?? "").length > 0
|
|
6202
6312
|
);
|
|
@@ -6206,14 +6316,18 @@ const Input$1 = forwardRef(
|
|
|
6206
6316
|
}
|
|
6207
6317
|
}, [inputEl, isControlled, showClearButton]);
|
|
6208
6318
|
const handleChange = useCallback(
|
|
6209
|
-
(
|
|
6210
|
-
|
|
6319
|
+
(evt) => {
|
|
6320
|
+
if (softDisabled) {
|
|
6321
|
+
evt.preventDefault();
|
|
6322
|
+
return;
|
|
6323
|
+
}
|
|
6324
|
+
const inputEl2 = evt.target;
|
|
6211
6325
|
onValueChange?.(inputEl2.value);
|
|
6212
6326
|
if (showClearButton === "auto" && !isControlled) {
|
|
6213
6327
|
setShouldShowClearButton(inputEl2.value.length > 0);
|
|
6214
6328
|
}
|
|
6215
6329
|
},
|
|
6216
|
-
[isControlled, onValueChange, showClearButton]
|
|
6330
|
+
[softDisabled, isControlled, onValueChange, showClearButton]
|
|
6217
6331
|
);
|
|
6218
6332
|
const setFieldControlFocused = useSetFieldControlFocused();
|
|
6219
6333
|
const handleControlFocus = useCallback(
|
|
@@ -6272,7 +6386,7 @@ const Input$1 = forwardRef(
|
|
|
6272
6386
|
}
|
|
6273
6387
|
}
|
|
6274
6388
|
}, [inputEl]);
|
|
6275
|
-
const hasClearButton = !disabled && !
|
|
6389
|
+
const hasClearButton = !disabled && !softDisabled && !readOnly && (showClearButton === true || showClearButton === "auto" && (isControlled ? (value?.toString() ?? "")?.length > 0 : shouldShowClearButton));
|
|
6276
6390
|
const clearDescriptionId = hasClearButton && clearDescription && prefix(`control-clear-${generatedId}`);
|
|
6277
6391
|
const { cssVars, dataAttrs } = responsiveValuesToCssVarsAndDataAttrs(
|
|
6278
6392
|
"control",
|
|
@@ -6301,7 +6415,7 @@ const Input$1 = forwardRef(
|
|
|
6301
6415
|
return /* @__PURE__ */ jsx(ClearContexts, { field: false, children: /* @__PURE__ */ jsxs(
|
|
6302
6416
|
ControlContext.Provider,
|
|
6303
6417
|
{
|
|
6304
|
-
value: { variant, status, disabled,
|
|
6418
|
+
value: { variant, status, disabled, softDisabled, readOnly },
|
|
6305
6419
|
children: [
|
|
6306
6420
|
/* @__PURE__ */ jsxs(
|
|
6307
6421
|
"div",
|
|
@@ -6309,7 +6423,7 @@ const Input$1 = forwardRef(
|
|
|
6309
6423
|
"data-status": status,
|
|
6310
6424
|
"data-accent": controlStatusToAccent(status),
|
|
6311
6425
|
"data-variant": variant,
|
|
6312
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
6426
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
6313
6427
|
"data-readonly": boolDataAttr(readOnly),
|
|
6314
6428
|
...rootProps,
|
|
6315
6429
|
className: cx(prefix("input__root"), rootProps?.className),
|
|
@@ -6329,7 +6443,7 @@ const Input$1 = forwardRef(
|
|
|
6329
6443
|
"data-status": status,
|
|
6330
6444
|
"data-accent": controlStatusToAccent(status),
|
|
6331
6445
|
"data-variant": variant,
|
|
6332
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
6446
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
6333
6447
|
"data-readonly": boolDataAttr(readOnly),
|
|
6334
6448
|
...containerProps,
|
|
6335
6449
|
className: cx(
|
|
@@ -6354,18 +6468,20 @@ const Input$1 = forwardRef(
|
|
|
6354
6468
|
className: cx(prefix("input"), className),
|
|
6355
6469
|
required: required && supportsRequired,
|
|
6356
6470
|
disabled,
|
|
6357
|
-
readOnly: (
|
|
6358
|
-
onChange: combineEventHandlers(onChange,
|
|
6471
|
+
readOnly: (softDisabled || readOnly) && supportsReadOnly,
|
|
6472
|
+
onChange: combineEventHandlers(handleChange, onChange, {
|
|
6473
|
+
checkDefaultPrevented: true
|
|
6474
|
+
}),
|
|
6359
6475
|
onFocus: combineEventHandlers(onFocus, handleControlFocus),
|
|
6360
6476
|
onBlur: combineEventHandlers(onBlur, handleControlBlur),
|
|
6361
6477
|
onClick: combineEventHandlers(onClick, handleClick),
|
|
6362
6478
|
style: { ...cssVars, ...style },
|
|
6363
6479
|
...dataAttrs,
|
|
6364
|
-
"data-
|
|
6480
|
+
"data-disabled": boolDataAttr(softDisabled),
|
|
6365
6481
|
"data-status": status,
|
|
6366
6482
|
"data-accent": controlStatusToAccent(status),
|
|
6367
6483
|
"data-variant": variant,
|
|
6368
|
-
"aria-disabled": (
|
|
6484
|
+
"aria-disabled": (softDisabled || readOnly) && !supportsReadOnly || void 0,
|
|
6369
6485
|
"aria-required": required && !supportsRequired || void 0,
|
|
6370
6486
|
"aria-invalid": status === "invalid" || void 0,
|
|
6371
6487
|
"aria-label": ariaLabel,
|
|
@@ -6413,7 +6529,7 @@ const Input$1 = forwardRef(
|
|
|
6413
6529
|
Spinner,
|
|
6414
6530
|
{
|
|
6415
6531
|
color: controlStatusToAccent(status, "neutral"),
|
|
6416
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
6532
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
6417
6533
|
...spinnerProps,
|
|
6418
6534
|
className: cx(
|
|
6419
6535
|
prefix("input__spinner"),
|
|
@@ -6552,21 +6668,23 @@ const MenuListItem = forwardRef(
|
|
|
6552
6668
|
keybindsProps,
|
|
6553
6669
|
className,
|
|
6554
6670
|
children,
|
|
6671
|
+
"aria-disabled": ariaDisabled,
|
|
6555
6672
|
...otherProps
|
|
6556
6673
|
}, forwardedRef) {
|
|
6557
6674
|
const prefix = usePrefix();
|
|
6558
6675
|
const menuListContext = useMenuListContext();
|
|
6559
6676
|
const variant = menuListContext.variant;
|
|
6560
6677
|
iconPlacement ??= menuListContext.iconPlacement;
|
|
6678
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
6561
6679
|
const handleSelect = useCallback(
|
|
6562
6680
|
(evt) => {
|
|
6563
|
-
if (disabled ||
|
|
6681
|
+
if (disabled || softDisabled) {
|
|
6564
6682
|
evt.preventDefault();
|
|
6565
6683
|
return;
|
|
6566
6684
|
}
|
|
6567
6685
|
onSelect?.(evt);
|
|
6568
6686
|
},
|
|
6569
|
-
[disabled,
|
|
6687
|
+
[disabled, onSelect, softDisabled]
|
|
6570
6688
|
);
|
|
6571
6689
|
const iconEl = icon && !showSpinner && /* @__PURE__ */ jsx(
|
|
6572
6690
|
Slot,
|
|
@@ -6596,9 +6714,10 @@ const MenuListItem = forwardRef(
|
|
|
6596
6714
|
{
|
|
6597
6715
|
type: type === "button" ? "button" : void 0,
|
|
6598
6716
|
disabled: type === "button" ? disabled : void 0,
|
|
6599
|
-
"data-disabled": boolDataAttr(
|
|
6600
|
-
|
|
6601
|
-
|
|
6717
|
+
"data-disabled": boolDataAttr(
|
|
6718
|
+
type !== "button" && disabled || softDisabled
|
|
6719
|
+
),
|
|
6720
|
+
"aria-disabled": type === "button" && softDisabled || type === "link" && (disabled || softDisabled) || void 0,
|
|
6602
6721
|
"data-selected": boolDataAttr(selected),
|
|
6603
6722
|
"data-accent": color,
|
|
6604
6723
|
href,
|
|
@@ -6756,7 +6875,7 @@ const GROUP_SELECTOR = `[cmdk-group=""]`;
|
|
|
6756
6875
|
const GROUP_ITEMS_SELECTOR = `[cmdk-group-items=""]`;
|
|
6757
6876
|
const GROUP_HEADING_SELECTOR = `[cmdk-group-heading=""]`;
|
|
6758
6877
|
const ITEM_SELECTOR = `[cmdk-item=""]`;
|
|
6759
|
-
const VALID_ITEM_SELECTOR = `${ITEM_SELECTOR}:not([
|
|
6878
|
+
const VALID_ITEM_SELECTOR = `${ITEM_SELECTOR}:not([data-disabled])`;
|
|
6760
6879
|
const SELECT_EVENT = `cmdk-item-select`;
|
|
6761
6880
|
const VALUE_ATTR = `data-value`;
|
|
6762
6881
|
const defaultFilter = (value, search, keywords) => commandScore(value, search, keywords);
|
|
@@ -6973,9 +7092,7 @@ const Command = React.forwardRef(
|
|
|
6973
7092
|
});
|
|
6974
7093
|
}
|
|
6975
7094
|
function selectFirstItem() {
|
|
6976
|
-
const item = getValidItems()
|
|
6977
|
-
(item2) => item2.getAttribute("aria-disabled") !== "true"
|
|
6978
|
-
);
|
|
7095
|
+
const item = getValidItems()[0];
|
|
6979
7096
|
const value2 = item?.getAttribute(VALUE_ATTR);
|
|
6980
7097
|
store.setState("value", value2 || void 0, {
|
|
6981
7098
|
id: item?.getAttribute("id")
|
|
@@ -7754,23 +7871,26 @@ const CommandMenuItem = forwardRef(function CommandMenuItem2({
|
|
|
7754
7871
|
keybindsProps,
|
|
7755
7872
|
className,
|
|
7756
7873
|
children,
|
|
7874
|
+
"aria-disabled": ariaDisabled,
|
|
7757
7875
|
...otherProps
|
|
7758
7876
|
}, forwardedRef) {
|
|
7759
7877
|
const prefix = usePrefix();
|
|
7878
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
7760
7879
|
const handleSelect = useCallback(
|
|
7761
7880
|
(value) => {
|
|
7762
|
-
if (!
|
|
7881
|
+
if (!softDisabled) {
|
|
7763
7882
|
onSelect?.(value);
|
|
7764
7883
|
if (asLink) {
|
|
7765
7884
|
window.open(href, target, rel?.split(" ").join(","));
|
|
7766
7885
|
}
|
|
7767
7886
|
}
|
|
7768
7887
|
},
|
|
7769
|
-
[asLink, href,
|
|
7888
|
+
[asLink, href, onSelect, rel, softDisabled, target]
|
|
7770
7889
|
);
|
|
7771
7890
|
return /* @__PURE__ */ jsx(
|
|
7772
7891
|
MenuListItem,
|
|
7773
7892
|
{
|
|
7893
|
+
asChild: true,
|
|
7774
7894
|
selected,
|
|
7775
7895
|
type: asLink ? "link" : "text",
|
|
7776
7896
|
color,
|
|
@@ -7796,15 +7916,16 @@ const CommandMenuItem = forwardRef(function CommandMenuItem2({
|
|
|
7796
7916
|
iconProps,
|
|
7797
7917
|
spinnerProps,
|
|
7798
7918
|
keybindsProps,
|
|
7799
|
-
|
|
7919
|
+
"aria-disabled": ariaDisabled,
|
|
7800
7920
|
children: /* @__PURE__ */ jsx(
|
|
7801
7921
|
pkg.Item,
|
|
7802
7922
|
{
|
|
7923
|
+
className: cx(prefix("command-menu__item"), className),
|
|
7924
|
+
onSelect: handleSelect,
|
|
7925
|
+
keywords: typeof children === "string" ? [children, ...keywords ?? []] : keywords,
|
|
7803
7926
|
disabled,
|
|
7927
|
+
"aria-disabled": disabled || softDisabled,
|
|
7804
7928
|
...otherProps,
|
|
7805
|
-
keywords: typeof children === "string" ? [children, ...keywords ?? []] : keywords,
|
|
7806
|
-
onSelect: handleSelect,
|
|
7807
|
-
className: cx(prefix("command-menu__item"), className),
|
|
7808
7929
|
ref: forwardedRef,
|
|
7809
7930
|
children
|
|
7810
7931
|
}
|
|
@@ -7826,18 +7947,18 @@ function useCreateSelectContext({
|
|
|
7826
7947
|
const store = useConstant(
|
|
7827
7948
|
() => createStore()(
|
|
7828
7949
|
subscribeWithSelector((set, get) => ({
|
|
7829
|
-
|
|
7950
|
+
options: [/* @__PURE__ */ new Map()],
|
|
7830
7951
|
actions: {
|
|
7831
|
-
getOptionState: (value2) => get().
|
|
7952
|
+
getOptionState: (value2) => get().options[0].get(value2),
|
|
7832
7953
|
registerOption: (value2, content) => {
|
|
7833
|
-
const [optionsContent] = get().
|
|
7954
|
+
const [optionsContent] = get().options;
|
|
7834
7955
|
optionsContent.set(value2, content);
|
|
7835
|
-
set({
|
|
7956
|
+
set({ options: [optionsContent] });
|
|
7836
7957
|
},
|
|
7837
7958
|
unregisterOption: (value2) => {
|
|
7838
|
-
const [optionsContent] = get().
|
|
7959
|
+
const [optionsContent] = get().options;
|
|
7839
7960
|
optionsContent.delete(value2);
|
|
7840
|
-
set({
|
|
7961
|
+
set({ options: [optionsContent] });
|
|
7841
7962
|
}
|
|
7842
7963
|
}
|
|
7843
7964
|
}))
|
|
@@ -7901,7 +8022,12 @@ const Option = memo(
|
|
|
7901
8022
|
);
|
|
7902
8023
|
useEffect(() => {
|
|
7903
8024
|
if (registering) {
|
|
7904
|
-
registerOption(textValue, {
|
|
8025
|
+
registerOption(textValue, {
|
|
8026
|
+
value: textValue,
|
|
8027
|
+
content: children,
|
|
8028
|
+
color,
|
|
8029
|
+
disabled
|
|
8030
|
+
});
|
|
7905
8031
|
return () => unregisterOption(textValue);
|
|
7906
8032
|
}
|
|
7907
8033
|
}, [
|
|
@@ -7997,7 +8123,7 @@ const Tag = forwardRef(function Tag2({
|
|
|
7997
8123
|
defaultOpen,
|
|
7998
8124
|
open,
|
|
7999
8125
|
onOpenChange,
|
|
8000
|
-
|
|
8126
|
+
orientation: "horizontal",
|
|
8001
8127
|
asChild: true,
|
|
8002
8128
|
children: /* @__PURE__ */ jsx(
|
|
8003
8129
|
CollapsibleContent,
|
|
@@ -8157,6 +8283,50 @@ function SelectMultipleValue() {
|
|
|
8157
8283
|
valuesToRender.length > 0 && !readOnly && valuesTags
|
|
8158
8284
|
] });
|
|
8159
8285
|
}
|
|
8286
|
+
function SelectNative({
|
|
8287
|
+
multiple,
|
|
8288
|
+
onValueChange,
|
|
8289
|
+
...otherProps
|
|
8290
|
+
}) {
|
|
8291
|
+
const { store } = useSelectContext();
|
|
8292
|
+
const hasEmptyOption = useStore$1(
|
|
8293
|
+
store,
|
|
8294
|
+
(state) => state.actions.getOptionState("") !== void 0
|
|
8295
|
+
);
|
|
8296
|
+
const optionStates = useStore$1(
|
|
8297
|
+
store,
|
|
8298
|
+
useShallow((state) => Array.from(state.options[0].values()))
|
|
8299
|
+
);
|
|
8300
|
+
const handleChange = useCallback(
|
|
8301
|
+
(evt) => onValueChange(
|
|
8302
|
+
multiple ? Array.from(evt.target.options).filter((option) => option.selected).map((option) => option.value) : evt.target.value
|
|
8303
|
+
),
|
|
8304
|
+
[multiple, onValueChange]
|
|
8305
|
+
);
|
|
8306
|
+
const selectKey = useMemo(
|
|
8307
|
+
() => (hasEmptyOption ? "" : ";") + optionStates.map((opt) => opt.value).join(";"),
|
|
8308
|
+
[hasEmptyOption, optionStates]
|
|
8309
|
+
);
|
|
8310
|
+
const options = useMemo(
|
|
8311
|
+
() => optionStates.map(({ value, content, disabled }) => /* @__PURE__ */ jsx("option", { value, disabled, children: content }, value)),
|
|
8312
|
+
[optionStates]
|
|
8313
|
+
);
|
|
8314
|
+
return /* @__PURE__ */ jsxs(
|
|
8315
|
+
"select",
|
|
8316
|
+
{
|
|
8317
|
+
multiple,
|
|
8318
|
+
...otherProps,
|
|
8319
|
+
onChange: handleChange,
|
|
8320
|
+
tabIndex: -1,
|
|
8321
|
+
"aria-hidden": true,
|
|
8322
|
+
children: [
|
|
8323
|
+
!hasEmptyOption && /* @__PURE__ */ jsx("option", { value: "" }),
|
|
8324
|
+
options
|
|
8325
|
+
]
|
|
8326
|
+
},
|
|
8327
|
+
selectKey
|
|
8328
|
+
);
|
|
8329
|
+
}
|
|
8160
8330
|
function SelectSingleValue() {
|
|
8161
8331
|
const { value, store } = useSelectContext();
|
|
8162
8332
|
return useStore$1(
|
|
@@ -8211,7 +8381,10 @@ const Select = forwardRef(function Select2({
|
|
|
8211
8381
|
arrowProps,
|
|
8212
8382
|
popoverProps,
|
|
8213
8383
|
commandMenuProps,
|
|
8384
|
+
autoComplete,
|
|
8385
|
+
form,
|
|
8214
8386
|
style,
|
|
8387
|
+
"aria-disabled": ariaDisabled,
|
|
8215
8388
|
"aria-label": ariaLabel,
|
|
8216
8389
|
"aria-labelledby": ariaLabelledBy,
|
|
8217
8390
|
children,
|
|
@@ -8247,24 +8420,25 @@ const Select = forwardRef(function Select2({
|
|
|
8247
8420
|
"",
|
|
8248
8421
|
controlledSearchValue
|
|
8249
8422
|
);
|
|
8423
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
8250
8424
|
const actualValue = useMemo(
|
|
8251
8425
|
() => multiple ? Array.isArray(value) ? value : value === "" ? [] : [value.toString()] : Array.isArray(value) ? value.at(-1) ?? "" : value.toString(),
|
|
8252
8426
|
[multiple, value]
|
|
8253
8427
|
);
|
|
8254
8428
|
const isEmpty = multiple ? actualValue.length === 0 : actualValue === "";
|
|
8255
|
-
const
|
|
8429
|
+
const [buttonEl, setButtonEl] = useState(null);
|
|
8256
8430
|
const popoverRef = useRef(null);
|
|
8257
8431
|
const searchRef = useRef(null);
|
|
8432
|
+
const isFormControl = buttonEl ? !!form || !!buttonEl?.closest("form") : true;
|
|
8258
8433
|
const handleContainerPointerDown = useCallback(
|
|
8259
8434
|
(evt) => {
|
|
8260
8435
|
evt.preventDefault();
|
|
8261
|
-
const buttonEl = buttonRef.current;
|
|
8262
8436
|
const target = evt.target;
|
|
8263
|
-
if (buttonEl && !disabled && !
|
|
8437
|
+
if (buttonEl && !disabled && !softDisabled && !target.closest("input, select, textarea, button, a")) {
|
|
8264
8438
|
setOpen((open2) => !open2);
|
|
8265
8439
|
}
|
|
8266
8440
|
},
|
|
8267
|
-
[disabled,
|
|
8441
|
+
[buttonEl, disabled, setOpen, softDisabled]
|
|
8268
8442
|
);
|
|
8269
8443
|
const handleOptionSelect = useCallback(
|
|
8270
8444
|
(optionValue) => {
|
|
@@ -8275,7 +8449,7 @@ const Select = forwardRef(function Select2({
|
|
|
8275
8449
|
if (open) {
|
|
8276
8450
|
searchRef.current?.focus();
|
|
8277
8451
|
} else {
|
|
8278
|
-
|
|
8452
|
+
buttonEl?.focus();
|
|
8279
8453
|
}
|
|
8280
8454
|
} else {
|
|
8281
8455
|
if (optionValue !== actualValue) {
|
|
@@ -8289,6 +8463,7 @@ const Select = forwardRef(function Select2({
|
|
|
8289
8463
|
},
|
|
8290
8464
|
[
|
|
8291
8465
|
actualValue,
|
|
8466
|
+
buttonEl,
|
|
8292
8467
|
multiple,
|
|
8293
8468
|
onSearchValueChange,
|
|
8294
8469
|
onValueChange,
|
|
@@ -8305,12 +8480,15 @@ const Select = forwardRef(function Select2({
|
|
|
8305
8480
|
onValueChange?.(newValue);
|
|
8306
8481
|
}
|
|
8307
8482
|
}, [isEmpty, multiple, onValueChange, setValue]);
|
|
8308
|
-
const handleCloseAutoFocus = useCallback(
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8483
|
+
const handleCloseAutoFocus = useCallback(
|
|
8484
|
+
(evt) => {
|
|
8485
|
+
if (document.activeElement === document.body || document.activeElement === document.documentElement) {
|
|
8486
|
+
evt.preventDefault();
|
|
8487
|
+
buttonEl?.focus();
|
|
8488
|
+
}
|
|
8489
|
+
},
|
|
8490
|
+
[buttonEl]
|
|
8491
|
+
);
|
|
8314
8492
|
const clearButtonRef = useRef(null);
|
|
8315
8493
|
const handleKeyDown = useCallback(
|
|
8316
8494
|
(evt) => {
|
|
@@ -8324,18 +8502,27 @@ const Select = forwardRef(function Select2({
|
|
|
8324
8502
|
);
|
|
8325
8503
|
const handleControlBlur = useCallback(
|
|
8326
8504
|
(evt) => {
|
|
8327
|
-
if (onBlurToOutside && (!evt.relatedTarget || !
|
|
8505
|
+
if (onBlurToOutside && (!evt.relatedTarget || !buttonEl?.contains(evt.relatedTarget) && !popoverRef.current?.contains(evt.relatedTarget))) {
|
|
8328
8506
|
onBlurToOutside(evt);
|
|
8329
8507
|
}
|
|
8330
8508
|
},
|
|
8331
|
-
[onBlurToOutside]
|
|
8509
|
+
[buttonEl, onBlurToOutside]
|
|
8332
8510
|
);
|
|
8511
|
+
const initialValueRef = useRef(value);
|
|
8512
|
+
useEffect(() => {
|
|
8513
|
+
const form2 = buttonEl?.form;
|
|
8514
|
+
if (form2) {
|
|
8515
|
+
const reset = () => setValue(initialValueRef.current);
|
|
8516
|
+
form2.addEventListener("reset", reset);
|
|
8517
|
+
return () => form2.removeEventListener("reset", reset);
|
|
8518
|
+
}
|
|
8519
|
+
}, [buttonEl?.form, multiple, setValue]);
|
|
8333
8520
|
const selectContext = useCreateSelectContext({
|
|
8334
8521
|
multiple,
|
|
8335
8522
|
value: actualValue,
|
|
8336
8523
|
onOptionSelect: handleOptionSelect,
|
|
8337
8524
|
status,
|
|
8338
|
-
disabled: disabled ||
|
|
8525
|
+
disabled: disabled || softDisabled,
|
|
8339
8526
|
readOnly,
|
|
8340
8527
|
valueTagCloseButtonLabel,
|
|
8341
8528
|
valueTagProps
|
|
@@ -8344,12 +8531,12 @@ const Select = forwardRef(function Select2({
|
|
|
8344
8531
|
() => ({ registering: true, ...selectContext }),
|
|
8345
8532
|
[selectContext]
|
|
8346
8533
|
);
|
|
8347
|
-
const showOpen = open && !disabled && !
|
|
8534
|
+
const showOpen = open && !disabled && !softDisabled && !readOnly;
|
|
8348
8535
|
const combinedClearButtonRef = useCombinedRef(
|
|
8349
8536
|
clearButtonRef,
|
|
8350
8537
|
clearButtonProps?.ref
|
|
8351
8538
|
);
|
|
8352
|
-
const combinedButtonRef = useCombinedRef(
|
|
8539
|
+
const combinedButtonRef = useCombinedRef(setButtonEl, forwardedRef);
|
|
8353
8540
|
const combinedPopoverRef = useCombinedRef(popoverRef, popoverProps?.ref);
|
|
8354
8541
|
const combinedSearchRef = useCombinedRef(
|
|
8355
8542
|
searchRef,
|
|
@@ -8382,7 +8569,6 @@ const Select = forwardRef(function Select2({
|
|
|
8382
8569
|
InputWithContainerRef,
|
|
8383
8570
|
{
|
|
8384
8571
|
asChild: true,
|
|
8385
|
-
name,
|
|
8386
8572
|
variant,
|
|
8387
8573
|
status,
|
|
8388
8574
|
code,
|
|
@@ -8404,7 +8590,7 @@ const Select = forwardRef(function Select2({
|
|
|
8404
8590
|
arrowProps?.className
|
|
8405
8591
|
),
|
|
8406
8592
|
"data-status": status,
|
|
8407
|
-
"data-disabled": disabled ||
|
|
8593
|
+
"data-disabled": boolDataAttr(disabled || softDisabled)
|
|
8408
8594
|
}
|
|
8409
8595
|
),
|
|
8410
8596
|
endAdornment
|
|
@@ -8441,6 +8627,7 @@ const Select = forwardRef(function Select2({
|
|
|
8441
8627
|
ref: combinedClearButtonRef
|
|
8442
8628
|
},
|
|
8443
8629
|
...open ? {} : { "aria-controls": void 0 },
|
|
8630
|
+
"aria-disabled": ariaDisabled,
|
|
8444
8631
|
"aria-labelledby": combineAriaIds(
|
|
8445
8632
|
ariaLabelledBy ?? ariaLabelId ?? combineAriaIds(codeId, labelId ?? dataTableColumnLabelId),
|
|
8446
8633
|
valueId
|
|
@@ -8517,7 +8704,20 @@ const Select = forwardRef(function Select2({
|
|
|
8517
8704
|
]
|
|
8518
8705
|
}
|
|
8519
8706
|
),
|
|
8520
|
-
ariaLabelId && /* @__PURE__ */ jsx("span", { hidden: true, id: ariaLabelId, children: ariaLabel })
|
|
8707
|
+
ariaLabelId && /* @__PURE__ */ jsx("span", { hidden: true, id: ariaLabelId, children: ariaLabel }),
|
|
8708
|
+
isFormControl && /* @__PURE__ */ jsx(VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
8709
|
+
SelectNative,
|
|
8710
|
+
{
|
|
8711
|
+
name,
|
|
8712
|
+
value: actualValue,
|
|
8713
|
+
onValueChange: setValue,
|
|
8714
|
+
multiple,
|
|
8715
|
+
required,
|
|
8716
|
+
disabled,
|
|
8717
|
+
autoComplete,
|
|
8718
|
+
form
|
|
8719
|
+
}
|
|
8720
|
+
) })
|
|
8521
8721
|
] });
|
|
8522
8722
|
});
|
|
8523
8723
|
const CAPTION_FORMAT = "LLLL y";
|
|
@@ -8698,7 +8898,6 @@ const CalendarHeader = memo(function CalendarHeader2({
|
|
|
8698
8898
|
Select,
|
|
8699
8899
|
{
|
|
8700
8900
|
"aria-label": monthSelectLabel,
|
|
8701
|
-
disabled: !allowsPrevMonth && !allowsNextMonth,
|
|
8702
8901
|
showClearButton: false,
|
|
8703
8902
|
...monthSelectProps,
|
|
8704
8903
|
className: cx(
|
|
@@ -8717,7 +8916,6 @@ const CalendarHeader = memo(function CalendarHeader2({
|
|
|
8717
8916
|
Select,
|
|
8718
8917
|
{
|
|
8719
8918
|
"aria-label": yearSelectLabel,
|
|
8720
|
-
disabled: yearDates.length < 2,
|
|
8721
8919
|
showClearButton: false,
|
|
8722
8920
|
...yearSelectProps,
|
|
8723
8921
|
className: cx(
|
|
@@ -8755,6 +8953,10 @@ const CalendarMonthGrid = memo(function CalendarMonthGrid2({
|
|
|
8755
8953
|
] });
|
|
8756
8954
|
});
|
|
8757
8955
|
function Calendar({
|
|
8956
|
+
selectionMode = "none",
|
|
8957
|
+
defaultValue,
|
|
8958
|
+
value: controlledValue,
|
|
8959
|
+
onValueChange,
|
|
8758
8960
|
required,
|
|
8759
8961
|
minDate,
|
|
8760
8962
|
maxDate,
|
|
@@ -8770,10 +8972,12 @@ function Calendar({
|
|
|
8770
8972
|
month: controlledMonth,
|
|
8771
8973
|
onMonthChange,
|
|
8772
8974
|
onDayClick,
|
|
8975
|
+
onDayFocus,
|
|
8976
|
+
onDayMouseEnter,
|
|
8773
8977
|
numberOfMonths = 1,
|
|
8774
8978
|
// Show outside days and fix the number of weeks by default
|
|
8775
|
-
showOutsideDays = true,
|
|
8776
8979
|
fixedWeeks = true,
|
|
8980
|
+
showOutsideDays = true,
|
|
8777
8981
|
disableNavigation,
|
|
8778
8982
|
disabled,
|
|
8779
8983
|
modifiers,
|
|
@@ -8792,6 +8996,53 @@ function Calendar({
|
|
|
8792
8996
|
yearSelectLabel ??= locale7.Calendar.yearSelectLabel;
|
|
8793
8997
|
previousMonthLabel ??= locale7.Calendar.previousMonthLabel;
|
|
8794
8998
|
nextMonthLabel ??= locale7.Calendar.nextMonthLabel;
|
|
8999
|
+
const [unnormalizedValue, setValue] = useControllableState(
|
|
9000
|
+
defaultValue ?? null,
|
|
9001
|
+
controlledValue
|
|
9002
|
+
);
|
|
9003
|
+
const normalizedValue = useMemo(() => {
|
|
9004
|
+
if (unnormalizedValue == null) {
|
|
9005
|
+
return null;
|
|
9006
|
+
}
|
|
9007
|
+
if (typeof unnormalizedValue === "string" || isDate(unnormalizedValue)) {
|
|
9008
|
+
return toValidDate(unnormalizedValue);
|
|
9009
|
+
}
|
|
9010
|
+
if (Array.isArray(unnormalizedValue)) {
|
|
9011
|
+
return unnormalizedValue.reduce((dates, d) => {
|
|
9012
|
+
const validDate = toValidDate(d);
|
|
9013
|
+
if (validDate !== null) {
|
|
9014
|
+
dates.push(validDate);
|
|
9015
|
+
}
|
|
9016
|
+
return dates;
|
|
9017
|
+
}, []);
|
|
9018
|
+
}
|
|
9019
|
+
const rangeValue = {
|
|
9020
|
+
start: toValidDate(unnormalizedValue.start),
|
|
9021
|
+
end: toValidDate(unnormalizedValue.end)
|
|
9022
|
+
};
|
|
9023
|
+
return rangeValue.start && rangeValue.end && isAfter(rangeValue.start, rangeValue.end) ? null : rangeValue;
|
|
9024
|
+
}, [unnormalizedValue]);
|
|
9025
|
+
const value = useMemo(() => {
|
|
9026
|
+
switch (selectionMode) {
|
|
9027
|
+
case "none":
|
|
9028
|
+
return null;
|
|
9029
|
+
case "single":
|
|
9030
|
+
return normalizedValue === null || isDate(normalizedValue) ? normalizedValue : Array.isArray(normalizedValue) ? normalizedValue[0] ?? null : normalizedValue.start ?? normalizedValue.end;
|
|
9031
|
+
case "multiple":
|
|
9032
|
+
return Array.isArray(normalizedValue) ? normalizedValue : normalizedValue === null ? [] : isDate(normalizedValue) ? [normalizedValue] : [normalizedValue.start, normalizedValue.end].filter(
|
|
9033
|
+
(d) => d !== null
|
|
9034
|
+
);
|
|
9035
|
+
case "range":
|
|
9036
|
+
case "range-start":
|
|
9037
|
+
case "range-end":
|
|
9038
|
+
return normalizedValue === null ? { start: null, end: null } : isDate(normalizedValue) ? { start: normalizedValue, end: null } : Array.isArray(normalizedValue) ? normalizedValue.length === 0 ? { start: null, end: null } : { start: min(normalizedValue), end: max(normalizedValue) } : normalizedValue;
|
|
9039
|
+
}
|
|
9040
|
+
}, [normalizedValue, selectionMode]);
|
|
9041
|
+
const firstSelectedDate = selectionMode === "none" ? void 0 : selectionMode === "single" ? value ?? void 0 : selectionMode === "multiple" ? value[0] : value.start ?? value.end ?? void 0;
|
|
9042
|
+
const [focusedRange, setFocusedRange] = useState({
|
|
9043
|
+
start: null,
|
|
9044
|
+
end: null
|
|
9045
|
+
});
|
|
8795
9046
|
const minAllowedDate = useMemo(() => {
|
|
8796
9047
|
const minDates = [
|
|
8797
9048
|
toValidDate(minDate),
|
|
@@ -8808,8 +9059,9 @@ function Calendar({
|
|
|
8808
9059
|
].filter((d) => d);
|
|
8809
9060
|
return maxDates.length > 0 ? min(maxDates) : void 0;
|
|
8810
9061
|
}, [maxDate, maxMonth, maxYear]);
|
|
9062
|
+
const curMonth = startOfMonth(/* @__PURE__ */ new Date());
|
|
8811
9063
|
const [month, setMonth2] = useControllableState(
|
|
8812
|
-
defaultMonth ??
|
|
9064
|
+
defaultMonth ?? firstSelectedDate ?? ((!minAllowedDate || !isBefore(curMonth, minAllowedDate)) && (!maxAllowedDate || !isAfter(curMonth, maxAllowedDate)) ? curMonth : minAllowedDate ?? maxAllowedDate ?? curMonth),
|
|
8813
9065
|
controlledMonth
|
|
8814
9066
|
);
|
|
8815
9067
|
const handleMonthChange = useCallback(
|
|
@@ -8822,7 +9074,49 @@ function Calendar({
|
|
|
8822
9074
|
const handleDayClick = useCallback(
|
|
8823
9075
|
(date, modifiers2, evt) => {
|
|
8824
9076
|
onDayClick?.(date, modifiers2, evt);
|
|
8825
|
-
|
|
9077
|
+
switch (selectionMode) {
|
|
9078
|
+
case "single": {
|
|
9079
|
+
const singleValue = value;
|
|
9080
|
+
const isSame = singleValue !== null && isSameDay(singleValue, date);
|
|
9081
|
+
if (!required && isSame) {
|
|
9082
|
+
setValue(null);
|
|
9083
|
+
onValueChange?.(null);
|
|
9084
|
+
} else if (!isSame) {
|
|
9085
|
+
setValue(date);
|
|
9086
|
+
onValueChange?.(date);
|
|
9087
|
+
}
|
|
9088
|
+
break;
|
|
9089
|
+
}
|
|
9090
|
+
case "multiple": {
|
|
9091
|
+
const multipleValue = value;
|
|
9092
|
+
const hasDate = multipleValue.some((d) => isSameDay(d, date));
|
|
9093
|
+
const newValue = hasDate ? multipleValue.filter((d) => !isSameDay(d, date)) : [...multipleValue, date];
|
|
9094
|
+
setValue(newValue);
|
|
9095
|
+
onValueChange?.(newValue);
|
|
9096
|
+
break;
|
|
9097
|
+
}
|
|
9098
|
+
case "range":
|
|
9099
|
+
case "range-start":
|
|
9100
|
+
case "range-end": {
|
|
9101
|
+
setFocusedRange({ start: null, end: null });
|
|
9102
|
+
const rangeValue = value;
|
|
9103
|
+
let newValue;
|
|
9104
|
+
if (selectionMode === "range-start") {
|
|
9105
|
+
newValue = !rangeValue.end || !isAfter(date, rangeValue.end) ? { start: date, end: rangeValue.end } : { start: date, end: null };
|
|
9106
|
+
} else if (selectionMode === "range-end") {
|
|
9107
|
+
newValue = !rangeValue.start || !isBefore(date, rangeValue.start) ? { start: rangeValue.start, end: date } : { start: date, end: null };
|
|
9108
|
+
} else if (!rangeValue.start && !rangeValue.end || rangeValue.start && rangeValue.end) {
|
|
9109
|
+
newValue = { start: date, end: null };
|
|
9110
|
+
} else {
|
|
9111
|
+
const filledDate = rangeValue.start ?? rangeValue.end;
|
|
9112
|
+
newValue = isAfter(date, filledDate) ? { start: filledDate, end: date } : { start: date, end: filledDate };
|
|
9113
|
+
}
|
|
9114
|
+
setValue(newValue);
|
|
9115
|
+
onValueChange?.(newValue);
|
|
9116
|
+
break;
|
|
9117
|
+
}
|
|
9118
|
+
}
|
|
9119
|
+
if (modifiers2.outside) {
|
|
8826
9120
|
const firstDay = startOfMonth(month);
|
|
8827
9121
|
const lastDay = lastDayOfMonth(addMonths(firstDay, numberOfMonths - 1));
|
|
8828
9122
|
if (isBefore(date, firstDay)) {
|
|
@@ -8837,14 +9131,37 @@ function Calendar({
|
|
|
8837
9131
|
}
|
|
8838
9132
|
},
|
|
8839
9133
|
[
|
|
8840
|
-
disableNavigation,
|
|
8841
9134
|
handleMonthChange,
|
|
8842
9135
|
month,
|
|
8843
9136
|
numberOfMonths,
|
|
8844
9137
|
onDayClick,
|
|
8845
|
-
|
|
9138
|
+
onValueChange,
|
|
9139
|
+
pagedNavigation,
|
|
9140
|
+
required,
|
|
9141
|
+
selectionMode,
|
|
9142
|
+
setValue,
|
|
9143
|
+
value
|
|
8846
9144
|
]
|
|
8847
9145
|
);
|
|
9146
|
+
const handleDayFocus = useCallback(
|
|
9147
|
+
(date, modifiers2, evt, handler) => {
|
|
9148
|
+
handler?.(date, modifiers2, evt);
|
|
9149
|
+
const rangeValue = value;
|
|
9150
|
+
let newFocusedRange;
|
|
9151
|
+
if (selectionMode === "range-start" && rangeValue.end && isBefore(date, rangeValue.end)) {
|
|
9152
|
+
newFocusedRange = { start: date, end: rangeValue.end };
|
|
9153
|
+
} else if (selectionMode === "range-end" && rangeValue.start && isAfter(date, rangeValue.start)) {
|
|
9154
|
+
newFocusedRange = { start: rangeValue.start, end: date };
|
|
9155
|
+
} else if (selectionMode === "range" && (rangeValue.start && !rangeValue.end || !rangeValue.start && rangeValue.end)) {
|
|
9156
|
+
const filledDate = rangeValue.start ?? rangeValue.end;
|
|
9157
|
+
newFocusedRange = isAfter(date, filledDate) ? { start: filledDate, end: date } : { start: date, end: filledDate };
|
|
9158
|
+
} else {
|
|
9159
|
+
newFocusedRange = { start: null, end: null };
|
|
9160
|
+
}
|
|
9161
|
+
setFocusedRange(newFocusedRange);
|
|
9162
|
+
},
|
|
9163
|
+
[selectionMode, value]
|
|
9164
|
+
);
|
|
8848
9165
|
const dynamicModifierClasses = modifiers ? Object.keys(modifiers).reduce(
|
|
8849
9166
|
(classNames, modifier) => {
|
|
8850
9167
|
classNames[modifier] = prefix(
|
|
@@ -8871,6 +9188,20 @@ function Calendar({
|
|
|
8871
9188
|
}
|
|
8872
9189
|
return composedDisabled2;
|
|
8873
9190
|
}, [disabled, maxAllowedDate, minAllowedDate]);
|
|
9191
|
+
const rangeModifiers = useMemo(() => {
|
|
9192
|
+
if (selectionMode !== "range" && selectionMode !== "range-start" && selectionMode !== "range-end") {
|
|
9193
|
+
return {};
|
|
9194
|
+
}
|
|
9195
|
+
const rangeValue = value;
|
|
9196
|
+
return {
|
|
9197
|
+
range_start: rangeValue.start ?? rangeValue.end ?? false,
|
|
9198
|
+
range_end: rangeValue.end ?? rangeValue.start ?? false,
|
|
9199
|
+
range_middle: rangeValue.start && rangeValue.end && !isEqual(rangeValue.start, rangeValue.end) ? { after: rangeValue.start, before: rangeValue.end } : false,
|
|
9200
|
+
focused_range_start: focusedRange.start ?? false,
|
|
9201
|
+
focused_range_end: focusedRange.end ?? false,
|
|
9202
|
+
focused_range_middle: focusedRange.start && focusedRange.end && !isEqual(focusedRange.start, focusedRange.end) ? { after: focusedRange.start, before: focusedRange.end } : false
|
|
9203
|
+
};
|
|
9204
|
+
}, [focusedRange.end, focusedRange.start, selectionMode, value]);
|
|
8874
9205
|
return /* @__PURE__ */ jsx(
|
|
8875
9206
|
CalendarContext.Provider,
|
|
8876
9207
|
{
|
|
@@ -8894,6 +9225,7 @@ function Calendar({
|
|
|
8894
9225
|
locale: locale7.dayPickerLocale,
|
|
8895
9226
|
required,
|
|
8896
9227
|
disabled: composedDisabled,
|
|
9228
|
+
selected: firstSelectedDate,
|
|
8897
9229
|
components: {
|
|
8898
9230
|
MonthCaption: CalendarHeader,
|
|
8899
9231
|
MonthGrid: CalendarMonthGrid,
|
|
@@ -8918,7 +9250,14 @@ function Calendar({
|
|
|
8918
9250
|
day_button: prefix("calendar__day-inner"),
|
|
8919
9251
|
footer: prefix("calendar__footer")
|
|
8920
9252
|
},
|
|
8921
|
-
modifiers
|
|
9253
|
+
modifiers: {
|
|
9254
|
+
...modifiers,
|
|
9255
|
+
selected: value === null ? void 0 : selectionMode === "single" ? value : selectionMode === "multiple" ? value : selectionMode === "range" || selectionMode === "range-start" || selectionMode === "range-end" ? {
|
|
9256
|
+
from: value.start ?? value.end ?? void 0,
|
|
9257
|
+
to: value.end ?? value.start ?? void 0
|
|
9258
|
+
} : void 0,
|
|
9259
|
+
...rangeModifiers
|
|
9260
|
+
},
|
|
8922
9261
|
modifiersClassNames: {
|
|
8923
9262
|
// Dynamic modifiers
|
|
8924
9263
|
...dynamicModifierClasses,
|
|
@@ -8928,14 +9267,23 @@ function Calendar({
|
|
|
8928
9267
|
disabled: prefix("calendar__day--disabled"),
|
|
8929
9268
|
hidden: prefix("calendar__day--hidden"),
|
|
8930
9269
|
today: prefix("calendar__day--today"),
|
|
8931
|
-
outside: prefix("calendar__day--outside")
|
|
9270
|
+
outside: prefix("calendar__day--outside"),
|
|
9271
|
+
// Range modifiers
|
|
9272
|
+
range_start: prefix("calendar__day--range-start"),
|
|
9273
|
+
range_middle: prefix("calendar__day--range-middle"),
|
|
9274
|
+
range_end: prefix("calendar__day--range-end"),
|
|
9275
|
+
focused_range_start: prefix("calendar__day--focused-range-start"),
|
|
9276
|
+
focused_range_middle: prefix("calendar__day--focused-range-middle"),
|
|
9277
|
+
focused_range_end: prefix("calendar__day--focused-range-end")
|
|
8932
9278
|
},
|
|
8933
|
-
onDayClick: onDayClick && handleDayClick,
|
|
9279
|
+
onDayClick: selectionMode === "none" ? onDayClick && handleDayClick : handleDayClick,
|
|
9280
|
+
onDayFocus: (date, activeModifiers, evt) => handleDayFocus(date, activeModifiers, evt, onDayFocus),
|
|
9281
|
+
onDayMouseEnter: (date, activeModifiers, evt) => handleDayFocus(date, activeModifiers, evt, onDayMouseEnter),
|
|
8934
9282
|
month,
|
|
8935
9283
|
onMonthChange: handleMonthChange,
|
|
8936
9284
|
numberOfMonths,
|
|
8937
|
-
showOutsideDays,
|
|
8938
9285
|
fixedWeeks,
|
|
9286
|
+
showOutsideDays,
|
|
8939
9287
|
disableNavigation,
|
|
8940
9288
|
pagedNavigation,
|
|
8941
9289
|
...otherProps
|
|
@@ -8945,8 +9293,8 @@ function Calendar({
|
|
|
8945
9293
|
);
|
|
8946
9294
|
}
|
|
8947
9295
|
function toValidDate(value) {
|
|
8948
|
-
const date = typeof value === "string" ? parseISO(value) : value ??
|
|
8949
|
-
return date ===
|
|
9296
|
+
const date = typeof value === "string" ? parseISO(value) : value ?? null;
|
|
9297
|
+
return date === null || !isValid(date) ? null : date;
|
|
8950
9298
|
}
|
|
8951
9299
|
const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
8952
9300
|
inline,
|
|
@@ -8975,6 +9323,7 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
8975
9323
|
onMouseDown,
|
|
8976
9324
|
tabIndex: controlledTabIndex,
|
|
8977
9325
|
children,
|
|
9326
|
+
"aria-disabled": ariaDisabled,
|
|
8978
9327
|
"aria-label": ariaLabel,
|
|
8979
9328
|
"aria-labelledby": ariaLabelledBy,
|
|
8980
9329
|
...otherProps
|
|
@@ -8999,6 +9348,7 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
8999
9348
|
const isInTableCell = useIsInTableCell();
|
|
9000
9349
|
inline ??= isInTableCell;
|
|
9001
9350
|
variant ??= isInTableCell ? "cell" : "default";
|
|
9351
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
9002
9352
|
const [tabIndex, setTabIndex] = useControllableState(
|
|
9003
9353
|
disabled ? -1 : 0,
|
|
9004
9354
|
controlledTabIndex ?? (disabled ? -1 : void 0)
|
|
@@ -9055,7 +9405,7 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
9055
9405
|
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(
|
|
9056
9406
|
ControlContext.Provider,
|
|
9057
9407
|
{
|
|
9058
|
-
value: { variant, status, disabled,
|
|
9408
|
+
value: { variant, status, disabled, softDisabled, readOnly },
|
|
9059
9409
|
children: /* @__PURE__ */ jsxs(CheckboxGroupContext.Provider, { value: checkboxGroupContextValue, children: [
|
|
9060
9410
|
/* @__PURE__ */ jsxs(
|
|
9061
9411
|
"div",
|
|
@@ -9074,7 +9424,7 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
9074
9424
|
onMouseDown: combineEventHandlers(onMouseDown, handleMouseDown),
|
|
9075
9425
|
onFocus: combineEventHandlers(onFocus, handleFocus),
|
|
9076
9426
|
onBlur: combineEventHandlers(onBlur, handleBlur),
|
|
9077
|
-
"aria-disabled":
|
|
9427
|
+
"aria-disabled": softDisabled || readOnly || void 0,
|
|
9078
9428
|
"aria-label": ariaLabel,
|
|
9079
9429
|
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 ? combineAriaIds(codeId, labelId ?? dataTableColumnLabelId) : void 0),
|
|
9080
9430
|
tabIndex,
|
|
@@ -9098,7 +9448,7 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
9098
9448
|
{
|
|
9099
9449
|
"data-status": status,
|
|
9100
9450
|
"data-variant": variant,
|
|
9101
|
-
"data-disabled": boolDataAttr(
|
|
9451
|
+
"data-disabled": boolDataAttr(softDisabled),
|
|
9102
9452
|
"data-readonly": boolDataAttr(readOnly),
|
|
9103
9453
|
...containerProps,
|
|
9104
9454
|
className: cx(
|
|
@@ -9113,7 +9463,7 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
9113
9463
|
{
|
|
9114
9464
|
"data-status": status,
|
|
9115
9465
|
"data-variant": variant,
|
|
9116
|
-
"data-disabled": boolDataAttr(
|
|
9466
|
+
"data-disabled": boolDataAttr(softDisabled),
|
|
9117
9467
|
"data-readonly": boolDataAttr(readOnly),
|
|
9118
9468
|
...endContainerProps,
|
|
9119
9469
|
className: cx(
|
|
@@ -9124,7 +9474,7 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
9124
9474
|
Spinner,
|
|
9125
9475
|
{
|
|
9126
9476
|
color: controlStatusToAccent(status, "neutral"),
|
|
9127
|
-
"data-disabled": boolDataAttr(
|
|
9477
|
+
"data-disabled": boolDataAttr(softDisabled),
|
|
9128
9478
|
...spinnerProps,
|
|
9129
9479
|
className: cx(
|
|
9130
9480
|
prefix("checkbox-group__spinner"),
|
|
@@ -9142,10 +9492,67 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
9142
9492
|
}
|
|
9143
9493
|
) });
|
|
9144
9494
|
});
|
|
9495
|
+
function useMediaQuery(query, options) {
|
|
9496
|
+
const matchMedia = options?.matchMedia ?? (typeof window !== "undefined" ? window.matchMedia : void 0);
|
|
9497
|
+
const getDefaultSnapshot = useCallback(
|
|
9498
|
+
() => options?.defaultMatches ?? false,
|
|
9499
|
+
[options?.defaultMatches]
|
|
9500
|
+
);
|
|
9501
|
+
const getServerSnapshot = useCallback(
|
|
9502
|
+
() => matchMedia?.(query).matches ?? getDefaultSnapshot(),
|
|
9503
|
+
[getDefaultSnapshot, matchMedia, query]
|
|
9504
|
+
);
|
|
9505
|
+
const { getSnapshot, subscribe } = useMemo(() => {
|
|
9506
|
+
if (!matchMedia) {
|
|
9507
|
+
return {
|
|
9508
|
+
getSnapshot: getDefaultSnapshot,
|
|
9509
|
+
subscribe: () => () => {
|
|
9510
|
+
}
|
|
9511
|
+
};
|
|
9512
|
+
}
|
|
9513
|
+
const queryList = matchMedia(query);
|
|
9514
|
+
return {
|
|
9515
|
+
getSnapshot: () => queryList.matches,
|
|
9516
|
+
subscribe: (notify) => {
|
|
9517
|
+
if (queryList.addEventListener) {
|
|
9518
|
+
queryList.addEventListener("change", notify);
|
|
9519
|
+
} else {
|
|
9520
|
+
queryList.addListener(notify);
|
|
9521
|
+
}
|
|
9522
|
+
return () => {
|
|
9523
|
+
if (queryList.removeEventListener) {
|
|
9524
|
+
queryList.removeEventListener("change", notify);
|
|
9525
|
+
} else {
|
|
9526
|
+
queryList.removeListener(notify);
|
|
9527
|
+
}
|
|
9528
|
+
};
|
|
9529
|
+
}
|
|
9530
|
+
};
|
|
9531
|
+
}, [getDefaultSnapshot, matchMedia, query]);
|
|
9532
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
9533
|
+
}
|
|
9534
|
+
const BREAKPOINTS = {
|
|
9535
|
+
xs: 0,
|
|
9536
|
+
sm: 576,
|
|
9537
|
+
md: 768,
|
|
9538
|
+
lg: 992,
|
|
9539
|
+
xl: 1200,
|
|
9540
|
+
xxl: 1400
|
|
9541
|
+
};
|
|
9542
|
+
function useMediaBreakpointUp(breakpoint, options) {
|
|
9543
|
+
return useMediaQuery(`(min-width:${BREAKPOINTS[breakpoint]}px)`, options);
|
|
9544
|
+
}
|
|
9545
|
+
function useMediaBreakpointDown(breakpoint, options) {
|
|
9546
|
+
return useMediaQuery(
|
|
9547
|
+
`(max-width:${BREAKPOINTS[breakpoint] - 0.02}px)`,
|
|
9548
|
+
options
|
|
9549
|
+
);
|
|
9550
|
+
}
|
|
9145
9551
|
const Container = forwardRef(
|
|
9146
9552
|
function Container2({
|
|
9147
9553
|
asChild,
|
|
9148
9554
|
fluid = "sm",
|
|
9555
|
+
maxWidth,
|
|
9149
9556
|
gutter,
|
|
9150
9557
|
leftGutter = gutter,
|
|
9151
9558
|
rightGutter = gutter,
|
|
@@ -9155,6 +9562,7 @@ const Container = forwardRef(
|
|
|
9155
9562
|
}, forwardedRef) {
|
|
9156
9563
|
const prefix = usePrefix();
|
|
9157
9564
|
const spacing = useSpacing();
|
|
9565
|
+
const { cssVar, cssVarStyle } = useCssVars();
|
|
9158
9566
|
const { responsiveValuesToCssVarsAndDataAttrs } = useResponsiveValues();
|
|
9159
9567
|
const { cssVars, dataAttrs } = responsiveValuesToCssVarsAndDataAttrs(
|
|
9160
9568
|
"container",
|
|
@@ -9170,10 +9578,17 @@ const Container = forwardRef(
|
|
|
9170
9578
|
{
|
|
9171
9579
|
className: cx(
|
|
9172
9580
|
prefix("container"),
|
|
9173
|
-
fluid !== true && prefix(`container
|
|
9581
|
+
fluid !== true && prefix(`container--fluid-${fluid}`),
|
|
9174
9582
|
className
|
|
9175
9583
|
),
|
|
9176
|
-
style: {
|
|
9584
|
+
style: {
|
|
9585
|
+
...cssVarStyle(
|
|
9586
|
+
"container-max-width",
|
|
9587
|
+
typeof maxWidth === "string" && maxWidth !== "xs" && maxWidth in BREAKPOINTS ? cssVar(`container-max-width-${maxWidth}`) : typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth
|
|
9588
|
+
),
|
|
9589
|
+
...cssVars,
|
|
9590
|
+
...style
|
|
9591
|
+
},
|
|
9177
9592
|
...dataAttrs,
|
|
9178
9593
|
ref: forwardedRef,
|
|
9179
9594
|
...otherProps
|
|
@@ -9214,36 +9629,6 @@ function useDateTransformer({
|
|
|
9214
9629
|
[dateFnsLocale, format$1]
|
|
9215
9630
|
);
|
|
9216
9631
|
}
|
|
9217
|
-
function DatePicker({
|
|
9218
|
-
defaultValue,
|
|
9219
|
-
value: controlledValue,
|
|
9220
|
-
defaultMonth,
|
|
9221
|
-
onChange,
|
|
9222
|
-
onDayClick,
|
|
9223
|
-
...otherProps
|
|
9224
|
-
}) {
|
|
9225
|
-
const [value, setValue] = useControllableState(
|
|
9226
|
-
defaultValue ?? void 0,
|
|
9227
|
-
controlledValue
|
|
9228
|
-
);
|
|
9229
|
-
const handleDayClick = useCallback(
|
|
9230
|
-
(date, modifiers, evt) => {
|
|
9231
|
-
onDayClick?.(date, modifiers, evt);
|
|
9232
|
-
setValue(date);
|
|
9233
|
-
onChange?.(date);
|
|
9234
|
-
},
|
|
9235
|
-
[onChange, onDayClick, setValue]
|
|
9236
|
-
);
|
|
9237
|
-
return /* @__PURE__ */ jsx(
|
|
9238
|
-
Calendar,
|
|
9239
|
-
{
|
|
9240
|
-
modifiers: { selected: value ?? void 0 },
|
|
9241
|
-
onDayClick: handleDayClick,
|
|
9242
|
-
defaultMonth: defaultMonth ?? value ?? void 0,
|
|
9243
|
-
...otherProps
|
|
9244
|
-
}
|
|
9245
|
-
);
|
|
9246
|
-
}
|
|
9247
9632
|
const DateInput = forwardRef(
|
|
9248
9633
|
function DateInput2({
|
|
9249
9634
|
value: controlledValue,
|
|
@@ -9262,6 +9647,7 @@ const DateInput = forwardRef(
|
|
|
9262
9647
|
maxMonth,
|
|
9263
9648
|
minYear,
|
|
9264
9649
|
maxYear,
|
|
9650
|
+
required,
|
|
9265
9651
|
format: format2,
|
|
9266
9652
|
announcedFormat,
|
|
9267
9653
|
formatDescription,
|
|
@@ -9271,10 +9657,11 @@ const DateInput = forwardRef(
|
|
|
9271
9657
|
onBlurToOutside,
|
|
9272
9658
|
containerProps,
|
|
9273
9659
|
clearButtonProps,
|
|
9274
|
-
|
|
9660
|
+
calendarProps,
|
|
9275
9661
|
popoverContentProps,
|
|
9276
9662
|
className,
|
|
9277
9663
|
placeholder,
|
|
9664
|
+
"aria-disabled": ariaDisabled,
|
|
9278
9665
|
"aria-describedby": ariaDescribedBy,
|
|
9279
9666
|
...otherProps
|
|
9280
9667
|
}, forwardedRef) {
|
|
@@ -9288,6 +9675,7 @@ const DateInput = forwardRef(
|
|
|
9288
9675
|
selectedDateDescription ??= locale7.DateInput.selectedDateDescription;
|
|
9289
9676
|
calendarButtonLabel ??= locale7.DateInput.calendarButtonLabel;
|
|
9290
9677
|
const { printHidden } = usePrintClassNames();
|
|
9678
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
9291
9679
|
const { format: formatDate, parse: parseDate } = useDateTransformer({
|
|
9292
9680
|
format: format2
|
|
9293
9681
|
});
|
|
@@ -9326,24 +9714,24 @@ const DateInput = forwardRef(
|
|
|
9326
9714
|
[onPopoverOpenChange, popoverState.open]
|
|
9327
9715
|
);
|
|
9328
9716
|
const monthToDisplay = useCallback(
|
|
9329
|
-
() => startOfMonth(
|
|
9330
|
-
[
|
|
9717
|
+
() => startOfMonth(calendarProps?.defaultMonth ?? dateValue ?? /* @__PURE__ */ new Date()),
|
|
9718
|
+
[calendarProps?.defaultMonth, dateValue]
|
|
9331
9719
|
);
|
|
9332
9720
|
const [month, setMonth2] = useControllableState(
|
|
9333
9721
|
() => monthToDisplay(),
|
|
9334
|
-
|
|
9722
|
+
calendarProps?.month
|
|
9335
9723
|
);
|
|
9336
9724
|
const dateIsVisible = useCallback(
|
|
9337
9725
|
(date) => isWithinInterval(date, {
|
|
9338
9726
|
start: month,
|
|
9339
9727
|
end: lastDayOfMonth(
|
|
9340
|
-
addMonths(month, (
|
|
9728
|
+
addMonths(month, (calendarProps?.numberOfMonths ?? 1) - 1)
|
|
9341
9729
|
)
|
|
9342
9730
|
}),
|
|
9343
|
-
[
|
|
9731
|
+
[calendarProps?.numberOfMonths, month]
|
|
9344
9732
|
);
|
|
9345
9733
|
const handleMonthChange = combineEventHandlers(
|
|
9346
|
-
|
|
9734
|
+
calendarProps?.onMonthChange,
|
|
9347
9735
|
setMonth2
|
|
9348
9736
|
);
|
|
9349
9737
|
const handleInputChange = useCallback(
|
|
@@ -9379,7 +9767,7 @@ const DateInput = forwardRef(
|
|
|
9379
9767
|
handleMonthChange(monthToDisplay());
|
|
9380
9768
|
changePopoverState({ open: true, modal: true });
|
|
9381
9769
|
}, [changePopoverState, handleMonthChange, monthToDisplay]);
|
|
9382
|
-
const
|
|
9770
|
+
const handleCalendarValueChange = useCallback(
|
|
9383
9771
|
(date) => {
|
|
9384
9772
|
const formattedValue2 = formatDate(date);
|
|
9385
9773
|
onValueChange?.({ formattedValue: formattedValue2, dateValue: date });
|
|
@@ -9457,6 +9845,7 @@ const DateInput = forwardRef(
|
|
|
9457
9845
|
className: cx(prefix("date-input"), className),
|
|
9458
9846
|
value: formattedValue,
|
|
9459
9847
|
placeholder,
|
|
9848
|
+
required,
|
|
9460
9849
|
disabled,
|
|
9461
9850
|
loading,
|
|
9462
9851
|
readOnly,
|
|
@@ -9479,6 +9868,7 @@ const DateInput = forwardRef(
|
|
|
9479
9868
|
}
|
|
9480
9869
|
) }) }) })
|
|
9481
9870
|
] }),
|
|
9871
|
+
"aria-disabled": ariaDisabled,
|
|
9482
9872
|
"aria-describedby": combineAriaIds(
|
|
9483
9873
|
ariaDescribedBy,
|
|
9484
9874
|
formatDescriptionId,
|
|
@@ -9530,21 +9920,20 @@ const DateInput = forwardRef(
|
|
|
9530
9920
|
),
|
|
9531
9921
|
ref: combinedPopoverRef,
|
|
9532
9922
|
children: /* @__PURE__ */ jsx(
|
|
9533
|
-
|
|
9923
|
+
Calendar,
|
|
9534
9924
|
{
|
|
9535
9925
|
className: cx(
|
|
9536
9926
|
prefix("date-input__picker"),
|
|
9537
|
-
|
|
9927
|
+
calendarProps?.className
|
|
9538
9928
|
),
|
|
9539
|
-
|
|
9929
|
+
required: true,
|
|
9930
|
+
...calendarProps,
|
|
9931
|
+
selectionMode: "single",
|
|
9540
9932
|
value: deferredDateValue,
|
|
9541
|
-
|
|
9542
|
-
datePickerProps?.onChange,
|
|
9543
|
-
handleDatePickerChange
|
|
9544
|
-
),
|
|
9933
|
+
onValueChange: handleCalendarValueChange,
|
|
9545
9934
|
month,
|
|
9546
9935
|
onMonthChange: handleMonthChange,
|
|
9547
|
-
disabled: disabled ||
|
|
9936
|
+
disabled: disabled || softDisabled || readOnly || calendarProps?.disabled,
|
|
9548
9937
|
minDate,
|
|
9549
9938
|
maxDate,
|
|
9550
9939
|
minMonth,
|
|
@@ -9552,22 +9941,22 @@ const DateInput = forwardRef(
|
|
|
9552
9941
|
minYear,
|
|
9553
9942
|
maxYear,
|
|
9554
9943
|
monthSelectProps: {
|
|
9555
|
-
...
|
|
9944
|
+
...calendarProps?.monthSelectProps,
|
|
9556
9945
|
popoverProps: {
|
|
9557
|
-
...
|
|
9946
|
+
...calendarProps?.monthSelectProps?.popoverProps,
|
|
9558
9947
|
ref: monthSelectMenuRef
|
|
9559
9948
|
}
|
|
9560
9949
|
},
|
|
9561
9950
|
yearSelectProps: {
|
|
9562
|
-
...
|
|
9951
|
+
...calendarProps?.yearSelectProps,
|
|
9563
9952
|
popoverProps: {
|
|
9564
|
-
...
|
|
9953
|
+
...calendarProps?.yearSelectProps?.popoverProps,
|
|
9565
9954
|
ref: yearSelectMenuRef
|
|
9566
9955
|
}
|
|
9567
9956
|
},
|
|
9568
9957
|
headerLabelProps: {
|
|
9569
9958
|
role: popoverState.modal ? "status" : void 0,
|
|
9570
|
-
...
|
|
9959
|
+
...calendarProps?.headerLabelProps
|
|
9571
9960
|
}
|
|
9572
9961
|
}
|
|
9573
9962
|
)
|
|
@@ -9579,98 +9968,10 @@ const DateInput = forwardRef(
|
|
|
9579
9968
|
] });
|
|
9580
9969
|
}
|
|
9581
9970
|
);
|
|
9582
|
-
function
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
selectionMode = "both",
|
|
9587
|
-
defaultMonth,
|
|
9588
|
-
modifiers,
|
|
9589
|
-
onDayClick,
|
|
9590
|
-
onDayFocus,
|
|
9591
|
-
onDayMouseEnter,
|
|
9592
|
-
numberOfMonths = 2,
|
|
9593
|
-
...otherProps
|
|
9594
|
-
}) {
|
|
9595
|
-
const [unnormalizedValue, setValue] = useControllableState(
|
|
9596
|
-
defaultValue ?? { start: null, end: null },
|
|
9597
|
-
controlledValue
|
|
9598
|
-
);
|
|
9599
|
-
const value = useMemo(
|
|
9600
|
-
() => unnormalizedValue.start && unnormalizedValue.end && isAfter(unnormalizedValue.start, unnormalizedValue.end) ? { start: null, end: null } : unnormalizedValue,
|
|
9601
|
-
[unnormalizedValue]
|
|
9602
|
-
);
|
|
9603
|
-
const [focusedDates, setFocusedDates] = useState({
|
|
9604
|
-
start: null,
|
|
9605
|
-
end: null
|
|
9606
|
-
});
|
|
9607
|
-
const handleDayClick = useCallback(
|
|
9608
|
-
(date, modifiers2, evt) => {
|
|
9609
|
-
onDayClick?.(date, modifiers2, evt);
|
|
9610
|
-
setFocusedDates({ start: null, end: null });
|
|
9611
|
-
let newValue;
|
|
9612
|
-
if (selectionMode === "start") {
|
|
9613
|
-
newValue = !value.end || !isAfter(date, value.end) ? { start: date, end: value.end } : { start: date, end: null };
|
|
9614
|
-
} else if (selectionMode === "end") {
|
|
9615
|
-
newValue = !value.start || !isBefore(date, value.start) ? { start: value.start, end: date } : { start: date, end: null };
|
|
9616
|
-
} else if (!value.start && !value.end || value.start && value.end) {
|
|
9617
|
-
newValue = { start: date, end: null };
|
|
9618
|
-
} else {
|
|
9619
|
-
const filledDate = value.start ?? value.end;
|
|
9620
|
-
newValue = isAfter(date, filledDate) ? { start: filledDate, end: date } : { start: date, end: filledDate };
|
|
9621
|
-
}
|
|
9622
|
-
setValue(newValue);
|
|
9623
|
-
onChange?.(newValue);
|
|
9624
|
-
},
|
|
9625
|
-
[onChange, onDayClick, selectionMode, setValue, value.end, value.start]
|
|
9626
|
-
);
|
|
9627
|
-
const handleDayFocus = useCallback(
|
|
9628
|
-
(date, modifiers2, evt, handler) => {
|
|
9629
|
-
handler?.(date, modifiers2, evt);
|
|
9630
|
-
let newFocused;
|
|
9631
|
-
if (selectionMode === "start" && value.end && isBefore(date, value.end)) {
|
|
9632
|
-
newFocused = { start: date, end: value.end };
|
|
9633
|
-
} else if (selectionMode === "end" && value.start && isAfter(date, value.start)) {
|
|
9634
|
-
newFocused = { start: value.start, end: date };
|
|
9635
|
-
} else if (selectionMode === "both" && (value.start && !value.end || !value.start && value.end)) {
|
|
9636
|
-
const filledDate = value.start ?? value.end;
|
|
9637
|
-
newFocused = isAfter(date, filledDate) ? { start: filledDate, end: date } : { start: date, end: filledDate };
|
|
9638
|
-
} else {
|
|
9639
|
-
newFocused = { start: null, end: null };
|
|
9640
|
-
}
|
|
9641
|
-
setFocusedDates(newFocused);
|
|
9642
|
-
},
|
|
9643
|
-
[selectionMode, value.end, value.start]
|
|
9644
|
-
);
|
|
9645
|
-
return /* @__PURE__ */ jsx(
|
|
9646
|
-
Calendar,
|
|
9647
|
-
{
|
|
9648
|
-
modifiers: {
|
|
9649
|
-
...modifiers,
|
|
9650
|
-
selected: {
|
|
9651
|
-
from: value.start ?? value.end ?? void 0,
|
|
9652
|
-
to: value.end ?? value.start ?? void 0
|
|
9653
|
-
},
|
|
9654
|
-
range_start: value.start ?? value.end ?? false,
|
|
9655
|
-
range_end: value.end ?? value.start ?? false,
|
|
9656
|
-
range_middle: value.start && value.end && !isEqual(value.start, value.end) ? { after: value.start, before: value.end } : false,
|
|
9657
|
-
focused_range_start: focusedDates.start ?? false,
|
|
9658
|
-
focused_range_end: focusedDates.end ?? false,
|
|
9659
|
-
focused_range_middle: focusedDates.start && focusedDates.end && !isEqual(focusedDates.start, focusedDates.end) ? { after: focusedDates.start, before: focusedDates.end } : false
|
|
9660
|
-
},
|
|
9661
|
-
numberOfMonths,
|
|
9662
|
-
defaultMonth: defaultMonth ?? value.start ?? value.end ?? void 0,
|
|
9663
|
-
onDayClick: handleDayClick,
|
|
9664
|
-
onDayFocus: (date, activeModifiers, evt) => handleDayFocus(date, activeModifiers, evt, onDayFocus),
|
|
9665
|
-
onDayMouseEnter: (date, activeModifiers, evt) => handleDayFocus(date, activeModifiers, evt, onDayMouseEnter),
|
|
9666
|
-
...otherProps
|
|
9667
|
-
}
|
|
9668
|
-
);
|
|
9669
|
-
}
|
|
9670
|
-
const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
9671
|
-
variant,
|
|
9672
|
-
status,
|
|
9673
|
-
code,
|
|
9971
|
+
const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
9972
|
+
variant,
|
|
9973
|
+
status,
|
|
9974
|
+
code,
|
|
9674
9975
|
value: controlledValue,
|
|
9675
9976
|
defaultValue,
|
|
9676
9977
|
onValueChange,
|
|
@@ -9716,8 +10017,9 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9716
10017
|
startClearButtonProps,
|
|
9717
10018
|
endClearButtonProps,
|
|
9718
10019
|
spinnerProps,
|
|
9719
|
-
|
|
10020
|
+
calendarProps,
|
|
9720
10021
|
popoverContentProps,
|
|
10022
|
+
"aria-disabled": ariaDisabled,
|
|
9721
10023
|
...otherProps
|
|
9722
10024
|
}, forwardedRef) {
|
|
9723
10025
|
const prefix = usePrefix();
|
|
@@ -9757,6 +10059,16 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9757
10059
|
const formatDescriptionId = formatDescription && typeof formatDescription !== "boolean" ? prefix(`control-format-${generatedId}`) : void 0;
|
|
9758
10060
|
const isInTableCell = useIsInTableCell();
|
|
9759
10061
|
variant ??= isInTableCell ? "cell" : "default";
|
|
10062
|
+
const startDisabled = disabled || startInputProps?.disabled;
|
|
10063
|
+
const endDisabled = disabled || endInputProps?.disabled;
|
|
10064
|
+
const bothDisabled = startDisabled && endDisabled;
|
|
10065
|
+
const isAriaDisabled = ariaDisabled === "true" || ariaDisabled === true;
|
|
10066
|
+
const startSoftDisabled = loading || isAriaDisabled || startInputProps?.["aria-disabled"] === "true" || startInputProps?.["aria-disabled"] === true;
|
|
10067
|
+
const endSoftDisabled = loading || isAriaDisabled || endInputProps?.["aria-disabled"] === "true" || endInputProps?.["aria-disabled"] === true;
|
|
10068
|
+
const bothSoftDisabled = startSoftDisabled && endSoftDisabled;
|
|
10069
|
+
const startReadOnly = readOnly || startInputProps?.readOnly;
|
|
10070
|
+
const endReadOnly = readOnly || endInputProps?.readOnly;
|
|
10071
|
+
const bothReadOnly = startReadOnly && endReadOnly;
|
|
9760
10072
|
const [formattedValue, setFormattedValue] = useControllableState(
|
|
9761
10073
|
defaultValue && (defaultValue.start === null || isDate(defaultValue.start)) ? {
|
|
9762
10074
|
start: formatDate(defaultValue.start),
|
|
@@ -9812,15 +10124,12 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9812
10124
|
const monthToDisplay = useCallback(
|
|
9813
10125
|
(input) => {
|
|
9814
10126
|
let toDisplay;
|
|
9815
|
-
if (
|
|
9816
|
-
toDisplay =
|
|
10127
|
+
if (calendarProps?.defaultMonth) {
|
|
10128
|
+
toDisplay = calendarProps.defaultMonth;
|
|
9817
10129
|
} else if (input === "start" && dateValue.start) {
|
|
9818
10130
|
toDisplay = dateValue.start;
|
|
9819
10131
|
} else {
|
|
9820
|
-
const relevantForEnd = dateValue.end && addMonths(
|
|
9821
|
-
dateValue.end,
|
|
9822
|
-
-(dateRangePickerProps?.numberOfMonths ?? 2) + 1
|
|
9823
|
-
);
|
|
10132
|
+
const relevantForEnd = dateValue.end && addMonths(dateValue.end, -(calendarProps?.numberOfMonths ?? 1) + 1);
|
|
9824
10133
|
toDisplay = relevantForEnd ?? dateValue.start ?? /* @__PURE__ */ new Date();
|
|
9825
10134
|
}
|
|
9826
10135
|
return startOfMonth(toDisplay);
|
|
@@ -9828,25 +10137,25 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9828
10137
|
[
|
|
9829
10138
|
dateValue.end,
|
|
9830
10139
|
dateValue.start,
|
|
9831
|
-
|
|
9832
|
-
|
|
10140
|
+
calendarProps?.defaultMonth,
|
|
10141
|
+
calendarProps?.numberOfMonths
|
|
9833
10142
|
]
|
|
9834
10143
|
);
|
|
9835
10144
|
const [month, setMonth2] = useControllableState(
|
|
9836
10145
|
() => monthToDisplay("start"),
|
|
9837
|
-
|
|
10146
|
+
calendarProps?.month
|
|
9838
10147
|
);
|
|
9839
10148
|
const dateIsVisible = useCallback(
|
|
9840
10149
|
(date) => isWithinInterval(date, {
|
|
9841
10150
|
start: month,
|
|
9842
10151
|
end: lastDayOfMonth(
|
|
9843
|
-
addMonths(month, (
|
|
10152
|
+
addMonths(month, (calendarProps?.numberOfMonths ?? 1) - 1)
|
|
9844
10153
|
)
|
|
9845
10154
|
}),
|
|
9846
|
-
[
|
|
10155
|
+
[calendarProps?.numberOfMonths, month]
|
|
9847
10156
|
);
|
|
9848
10157
|
const handleMonthChange = combineEventHandlers(
|
|
9849
|
-
|
|
10158
|
+
calendarProps?.onMonthChange,
|
|
9850
10159
|
setMonth2
|
|
9851
10160
|
);
|
|
9852
10161
|
const handleStartInputChange = useCallback(
|
|
@@ -9895,7 +10204,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9895
10204
|
handleMonthChange(
|
|
9896
10205
|
addMonths(
|
|
9897
10206
|
startOfMonth(dateEnd),
|
|
9898
|
-
-(
|
|
10207
|
+
-(calendarProps?.numberOfMonths ?? 1) + 1
|
|
9899
10208
|
)
|
|
9900
10209
|
);
|
|
9901
10210
|
}
|
|
@@ -9903,7 +10212,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9903
10212
|
[
|
|
9904
10213
|
dateIsVisible,
|
|
9905
10214
|
dateValue.start,
|
|
9906
|
-
|
|
10215
|
+
calendarProps?.numberOfMonths,
|
|
9907
10216
|
handleMonthChange,
|
|
9908
10217
|
onValueChange,
|
|
9909
10218
|
parseDate,
|
|
@@ -9948,7 +10257,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9948
10257
|
(input) => (evt) => {
|
|
9949
10258
|
const target = evt.target;
|
|
9950
10259
|
const inputEl = input === "start" ? startInputRef.current : endInputRef.current;
|
|
9951
|
-
if (inputEl && !disabled && !target.closest("input, select, textarea, button, a")) {
|
|
10260
|
+
if (inputEl && !inputEl.disabled && !target.closest("input, select, textarea, button, a")) {
|
|
9952
10261
|
const cursorIdx = target.closest(`.${prefix("date-range-input")} ~ *`) ? inputEl.value.length : 0;
|
|
9953
10262
|
requestAnimationFrame(() => {
|
|
9954
10263
|
try {
|
|
@@ -9959,14 +10268,14 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
9959
10268
|
});
|
|
9960
10269
|
}
|
|
9961
10270
|
},
|
|
9962
|
-
[
|
|
10271
|
+
[prefix]
|
|
9963
10272
|
);
|
|
9964
10273
|
const handleAddonButtonClick = useCallback(() => {
|
|
9965
10274
|
setSelectionMode("start");
|
|
9966
10275
|
handleMonthChange(monthToDisplay("start"));
|
|
9967
10276
|
changePopoverState({ open: true, modal: true });
|
|
9968
10277
|
}, [handleMonthChange, monthToDisplay, changePopoverState]);
|
|
9969
|
-
const
|
|
10278
|
+
const handleCalendarValueChange = useCallback(
|
|
9970
10279
|
(range) => {
|
|
9971
10280
|
const newFormattedValue = {
|
|
9972
10281
|
start: formatDate(range.start),
|
|
@@ -10054,8 +10363,8 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10054
10363
|
setFormattedValue
|
|
10055
10364
|
]
|
|
10056
10365
|
);
|
|
10057
|
-
const hasStartClearButton = !
|
|
10058
|
-
const hasEndClearButton = !
|
|
10366
|
+
const hasStartClearButton = !startDisabled && !startSoftDisabled && !startReadOnly && (showClearButtons === true || showClearButtons === "auto" && formattedValue.start !== "");
|
|
10367
|
+
const hasEndClearButton = !endDisabled && !endSoftDisabled && !endReadOnly && (showClearButtons === true || showClearButtons === "auto" && formattedValue.end !== "");
|
|
10059
10368
|
const { responsiveValuesToCssVarsAndDataAttrs } = useResponsiveValues();
|
|
10060
10369
|
const { cssVars, dataAttrs } = responsiveValuesToCssVarsAndDataAttrs(
|
|
10061
10370
|
"control",
|
|
@@ -10100,7 +10409,13 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10100
10409
|
return /* @__PURE__ */ jsx(ClearContexts, { field: false, children: /* @__PURE__ */ jsxs(
|
|
10101
10410
|
ControlContext.Provider,
|
|
10102
10411
|
{
|
|
10103
|
-
value: {
|
|
10412
|
+
value: {
|
|
10413
|
+
variant,
|
|
10414
|
+
status,
|
|
10415
|
+
disabled,
|
|
10416
|
+
softDisabled: bothSoftDisabled,
|
|
10417
|
+
readOnly: bothReadOnly
|
|
10418
|
+
},
|
|
10104
10419
|
children: [
|
|
10105
10420
|
/* @__PURE__ */ jsxs(
|
|
10106
10421
|
"div",
|
|
@@ -10108,9 +10423,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10108
10423
|
"data-status": status,
|
|
10109
10424
|
"data-accent": controlStatusToAccent(status),
|
|
10110
10425
|
"data-variant": variant,
|
|
10111
|
-
"data-disabled": boolDataAttr(
|
|
10112
|
-
disabled || loading || startInputProps?.disabled && endInputProps?.disabled
|
|
10113
|
-
),
|
|
10426
|
+
"data-disabled": boolDataAttr(bothDisabled || bothSoftDisabled),
|
|
10114
10427
|
"data-readonly": boolDataAttr(
|
|
10115
10428
|
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
10116
10429
|
),
|
|
@@ -10137,9 +10450,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10137
10450
|
"data-status": status,
|
|
10138
10451
|
"data-accent": controlStatusToAccent(status),
|
|
10139
10452
|
"data-variant": variant,
|
|
10140
|
-
"data-disabled": boolDataAttr(
|
|
10141
|
-
disabled || loading || startInputProps?.disabled && endInputProps?.disabled
|
|
10142
|
-
),
|
|
10453
|
+
"data-disabled": boolDataAttr(bothDisabled || bothSoftDisabled),
|
|
10143
10454
|
"data-readonly": boolDataAttr(
|
|
10144
10455
|
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
10145
10456
|
),
|
|
@@ -10155,17 +10466,13 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10155
10466
|
"div",
|
|
10156
10467
|
{
|
|
10157
10468
|
"data-focused": boolDataAttr(
|
|
10158
|
-
!
|
|
10469
|
+
!startDisabled && popoverState.open && selectionMode === "start"
|
|
10159
10470
|
),
|
|
10160
10471
|
"data-status": status,
|
|
10161
10472
|
"data-accent": controlStatusToAccent(status),
|
|
10162
10473
|
"data-variant": variant,
|
|
10163
|
-
"data-disabled": boolDataAttr(
|
|
10164
|
-
|
|
10165
|
-
),
|
|
10166
|
-
"data-readonly": boolDataAttr(
|
|
10167
|
-
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
10168
|
-
),
|
|
10474
|
+
"data-disabled": boolDataAttr(bothDisabled || bothSoftDisabled),
|
|
10475
|
+
"data-readonly": boolDataAttr(bothReadOnly),
|
|
10169
10476
|
...startContainerProps,
|
|
10170
10477
|
className: cx(
|
|
10171
10478
|
prefix("date-range-input__container"),
|
|
@@ -10183,7 +10490,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10183
10490
|
{
|
|
10184
10491
|
...startInputProps,
|
|
10185
10492
|
id: controlId,
|
|
10186
|
-
"data-
|
|
10493
|
+
"data-disabled": boolDataAttr(startSoftDisabled),
|
|
10187
10494
|
"data-status": status,
|
|
10188
10495
|
"data-variant": variant,
|
|
10189
10496
|
className: cx(
|
|
@@ -10194,8 +10501,8 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10194
10501
|
value: formattedValue.start,
|
|
10195
10502
|
placeholder: startInputProps?.placeholder ?? startPlaceholder ?? placeholder,
|
|
10196
10503
|
required: required || startInputProps?.required,
|
|
10197
|
-
disabled:
|
|
10198
|
-
readOnly:
|
|
10504
|
+
disabled: startDisabled,
|
|
10505
|
+
readOnly: startSoftDisabled || startReadOnly,
|
|
10199
10506
|
onChange: combineEventHandlers(
|
|
10200
10507
|
startInputProps?.onChange,
|
|
10201
10508
|
handleStartInputChange
|
|
@@ -10253,7 +10560,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10253
10560
|
{
|
|
10254
10561
|
color: controlStatusToAccent(status, "neutral"),
|
|
10255
10562
|
"data-disabled": boolDataAttr(
|
|
10256
|
-
|
|
10563
|
+
startDisabled || startSoftDisabled
|
|
10257
10564
|
),
|
|
10258
10565
|
...spinnerProps,
|
|
10259
10566
|
className: cx(
|
|
@@ -10271,17 +10578,13 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10271
10578
|
"div",
|
|
10272
10579
|
{
|
|
10273
10580
|
"data-focused": boolDataAttr(
|
|
10274
|
-
!
|
|
10581
|
+
!endDisabled && popoverState.open && selectionMode === "end"
|
|
10275
10582
|
),
|
|
10276
10583
|
"data-status": status,
|
|
10277
10584
|
"data-accent": controlStatusToAccent(status),
|
|
10278
10585
|
"data-variant": variant,
|
|
10279
|
-
"data-disabled": boolDataAttr(
|
|
10280
|
-
|
|
10281
|
-
),
|
|
10282
|
-
"data-readonly": boolDataAttr(
|
|
10283
|
-
readOnly || startInputProps?.readOnly && endInputProps?.readOnly
|
|
10284
|
-
),
|
|
10586
|
+
"data-disabled": boolDataAttr(bothDisabled || bothSoftDisabled),
|
|
10587
|
+
"data-readonly": boolDataAttr(bothReadOnly),
|
|
10285
10588
|
...endContainerProps,
|
|
10286
10589
|
className: cx(
|
|
10287
10590
|
prefix("date-range-input__container"),
|
|
@@ -10298,7 +10601,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10298
10601
|
"input",
|
|
10299
10602
|
{
|
|
10300
10603
|
...endInputProps,
|
|
10301
|
-
"data-
|
|
10604
|
+
"data-disabled": boolDataAttr(endSoftDisabled),
|
|
10302
10605
|
"data-status": status,
|
|
10303
10606
|
"data-variant": variant,
|
|
10304
10607
|
className: cx(
|
|
@@ -10309,8 +10612,8 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10309
10612
|
value: formattedValue.end,
|
|
10310
10613
|
placeholder: endInputProps?.placeholder ?? endPlaceholder ?? placeholder,
|
|
10311
10614
|
required: required || endInputProps?.required,
|
|
10312
|
-
disabled:
|
|
10313
|
-
readOnly:
|
|
10615
|
+
disabled: endDisabled,
|
|
10616
|
+
readOnly: endSoftDisabled || endReadOnly,
|
|
10314
10617
|
onChange: combineEventHandlers(
|
|
10315
10618
|
endInputProps?.onChange,
|
|
10316
10619
|
handleEndInputChange
|
|
@@ -10367,9 +10670,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10367
10670
|
Spinner,
|
|
10368
10671
|
{
|
|
10369
10672
|
color: controlStatusToAccent(status, "neutral"),
|
|
10370
|
-
"data-disabled": boolDataAttr(
|
|
10371
|
-
disabled || loading || endInputProps?.disabled
|
|
10372
|
-
),
|
|
10673
|
+
"data-disabled": boolDataAttr(endDisabled || endSoftDisabled),
|
|
10373
10674
|
...spinnerProps,
|
|
10374
10675
|
className: cx(
|
|
10375
10676
|
prefix("date-range-input__spinner"),
|
|
@@ -10433,22 +10734,20 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10433
10734
|
),
|
|
10434
10735
|
ref: combinedPopoverRef,
|
|
10435
10736
|
children: /* @__PURE__ */ jsx(
|
|
10436
|
-
|
|
10737
|
+
Calendar,
|
|
10437
10738
|
{
|
|
10438
10739
|
className: cx(
|
|
10439
10740
|
prefix("date-range-input__picker"),
|
|
10440
|
-
|
|
10741
|
+
calendarProps?.className
|
|
10441
10742
|
),
|
|
10442
|
-
|
|
10743
|
+
required: true,
|
|
10744
|
+
...calendarProps,
|
|
10745
|
+
selectionMode: `range-${selectionMode}`,
|
|
10443
10746
|
value: deferredDateValue,
|
|
10444
|
-
|
|
10445
|
-
dateRangePickerProps?.onChange,
|
|
10446
|
-
handleDatePickerChange
|
|
10447
|
-
),
|
|
10448
|
-
selectionMode,
|
|
10747
|
+
onValueChange: handleCalendarValueChange,
|
|
10449
10748
|
month,
|
|
10450
10749
|
onMonthChange: handleMonthChange,
|
|
10451
|
-
disabled:
|
|
10750
|
+
disabled: bothDisabled || bothSoftDisabled || bothReadOnly || (startDisabled || startSoftDisabled || startReadOnly) && (endDisabled || endSoftDisabled || endReadOnly) || calendarProps?.disabled,
|
|
10452
10751
|
minDate,
|
|
10453
10752
|
maxDate,
|
|
10454
10753
|
minMonth,
|
|
@@ -10456,22 +10755,22 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10456
10755
|
minYear,
|
|
10457
10756
|
maxYear,
|
|
10458
10757
|
monthSelectProps: {
|
|
10459
|
-
...
|
|
10758
|
+
...calendarProps?.monthSelectProps,
|
|
10460
10759
|
popoverProps: {
|
|
10461
|
-
...
|
|
10760
|
+
...calendarProps?.monthSelectProps?.popoverProps,
|
|
10462
10761
|
ref: monthSelectMenuRef
|
|
10463
10762
|
}
|
|
10464
10763
|
},
|
|
10465
10764
|
yearSelectProps: {
|
|
10466
|
-
...
|
|
10765
|
+
...calendarProps?.yearSelectProps,
|
|
10467
10766
|
popoverProps: {
|
|
10468
|
-
...
|
|
10767
|
+
...calendarProps?.yearSelectProps?.popoverProps,
|
|
10469
10768
|
ref: yearSelectMenuRef
|
|
10470
10769
|
}
|
|
10471
10770
|
},
|
|
10472
10771
|
headerLabelProps: {
|
|
10473
10772
|
role: popoverState.modal ? "status" : void 0,
|
|
10474
|
-
...
|
|
10773
|
+
...calendarProps?.headerLabelProps
|
|
10475
10774
|
}
|
|
10476
10775
|
}
|
|
10477
10776
|
)
|
|
@@ -10495,6 +10794,151 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
10495
10794
|
}
|
|
10496
10795
|
) });
|
|
10497
10796
|
});
|
|
10797
|
+
const GridContext = createContext(null);
|
|
10798
|
+
const Grid = forwardRef(function Grid2({
|
|
10799
|
+
asChild,
|
|
10800
|
+
container = false,
|
|
10801
|
+
columns,
|
|
10802
|
+
gap,
|
|
10803
|
+
rowGap = gap,
|
|
10804
|
+
columnGap = gap,
|
|
10805
|
+
xs,
|
|
10806
|
+
sm,
|
|
10807
|
+
md,
|
|
10808
|
+
lg,
|
|
10809
|
+
xl,
|
|
10810
|
+
xxl,
|
|
10811
|
+
xsOffset,
|
|
10812
|
+
smOffset,
|
|
10813
|
+
mdOffset,
|
|
10814
|
+
lgOffset,
|
|
10815
|
+
xlOffset,
|
|
10816
|
+
xxlOffset,
|
|
10817
|
+
className,
|
|
10818
|
+
style,
|
|
10819
|
+
...otherProps
|
|
10820
|
+
}, forwardedRef) {
|
|
10821
|
+
const prefix = usePrefix();
|
|
10822
|
+
const { cssToggler } = useCssVars();
|
|
10823
|
+
const spacing = useSpacing();
|
|
10824
|
+
const { responsiveValuesToCssVarsAndDataAttrs } = useResponsiveValues();
|
|
10825
|
+
const gridContext = useContext(GridContext);
|
|
10826
|
+
const sizes = { xs, sm, md, lg, xl, xxl };
|
|
10827
|
+
const offsets = {
|
|
10828
|
+
xs: xsOffset,
|
|
10829
|
+
sm: smOffset,
|
|
10830
|
+
md: mdOffset,
|
|
10831
|
+
lg: lgOffset,
|
|
10832
|
+
xl: xlOffset,
|
|
10833
|
+
xxl: xxlOffset
|
|
10834
|
+
};
|
|
10835
|
+
const gapMapper = (v) => typeof v === "number" ? spacing(v) : v;
|
|
10836
|
+
const { cssVars, dataAttrs } = responsiveValuesToCssVarsAndDataAttrs(
|
|
10837
|
+
"grid",
|
|
10838
|
+
{
|
|
10839
|
+
rowGap: container ? rowGap : void 0,
|
|
10840
|
+
columnGap: container ? columnGap : void 0,
|
|
10841
|
+
containerColumns: gridContext?.container ? gridContext?.columns : void 0,
|
|
10842
|
+
containerRowGap: gridContext?.container ? gridContext?.rowGap : void 0,
|
|
10843
|
+
containerColumnGap: gridContext?.container ? gridContext?.columnGap : void 0,
|
|
10844
|
+
itemSize: gridContext?.container ? sizes : void 0,
|
|
10845
|
+
itemAutoSize: gridContext?.container ? sizes : void 0,
|
|
10846
|
+
itemOffset: gridContext?.container ? offsets : void 0,
|
|
10847
|
+
itemAutoOffset: gridContext?.container ? offsets : void 0
|
|
10848
|
+
},
|
|
10849
|
+
{
|
|
10850
|
+
rowGap: gapMapper,
|
|
10851
|
+
columnGap: gapMapper,
|
|
10852
|
+
containerRowGap: gapMapper,
|
|
10853
|
+
containerColumnGap: gapMapper,
|
|
10854
|
+
itemSize: (v) => typeof v === "number" ? v : "auto",
|
|
10855
|
+
itemAutoSize: (v) => cssToggler(v === "auto"),
|
|
10856
|
+
itemAutoOffset: (v) => cssToggler(v === "auto")
|
|
10857
|
+
}
|
|
10858
|
+
);
|
|
10859
|
+
const As = asChild ? Slot : "div";
|
|
10860
|
+
return /* @__PURE__ */ jsx(GridContext.Provider, { value: { container, columns, rowGap, columnGap }, children: /* @__PURE__ */ jsx(
|
|
10861
|
+
As,
|
|
10862
|
+
{
|
|
10863
|
+
className: cx(
|
|
10864
|
+
prefix("grid"),
|
|
10865
|
+
// Grid container classes
|
|
10866
|
+
container && prefix("grid__container"),
|
|
10867
|
+
gridContext?.container && prefix("grid__item"),
|
|
10868
|
+
className
|
|
10869
|
+
),
|
|
10870
|
+
style: { ...cssVars, ...style },
|
|
10871
|
+
...dataAttrs,
|
|
10872
|
+
ref: forwardedRef,
|
|
10873
|
+
...otherProps
|
|
10874
|
+
}
|
|
10875
|
+
) });
|
|
10876
|
+
});
|
|
10877
|
+
const DescriptionList = forwardRef(function DescriptionList2({ asChild, columns, gap, rowGap, columnGap, className, ...otherProps }, forwardedRef) {
|
|
10878
|
+
const prefix = usePrefix();
|
|
10879
|
+
const As = asChild ? Slot : "dl";
|
|
10880
|
+
return /* @__PURE__ */ jsx(
|
|
10881
|
+
Grid,
|
|
10882
|
+
{
|
|
10883
|
+
asChild: true,
|
|
10884
|
+
container: true,
|
|
10885
|
+
columns,
|
|
10886
|
+
gap,
|
|
10887
|
+
rowGap,
|
|
10888
|
+
columnGap,
|
|
10889
|
+
children: /* @__PURE__ */ jsx(
|
|
10890
|
+
As,
|
|
10891
|
+
{
|
|
10892
|
+
className: cx(prefix("description-list"), className),
|
|
10893
|
+
...otherProps,
|
|
10894
|
+
ref: forwardedRef
|
|
10895
|
+
}
|
|
10896
|
+
)
|
|
10897
|
+
}
|
|
10898
|
+
);
|
|
10899
|
+
});
|
|
10900
|
+
const DescriptionListItem = forwardRef(function DescriptionList3({
|
|
10901
|
+
term,
|
|
10902
|
+
children,
|
|
10903
|
+
descriptionTermProps,
|
|
10904
|
+
descriptionDetailsProps,
|
|
10905
|
+
className,
|
|
10906
|
+
...otherProps
|
|
10907
|
+
}, forwardedRef) {
|
|
10908
|
+
const prefix = usePrefix();
|
|
10909
|
+
return /* @__PURE__ */ jsxs(
|
|
10910
|
+
Grid,
|
|
10911
|
+
{
|
|
10912
|
+
className: cx(prefix("description-list__item"), className),
|
|
10913
|
+
...otherProps,
|
|
10914
|
+
ref: forwardedRef,
|
|
10915
|
+
children: [
|
|
10916
|
+
/* @__PURE__ */ jsx(
|
|
10917
|
+
"dt",
|
|
10918
|
+
{
|
|
10919
|
+
...descriptionTermProps,
|
|
10920
|
+
className: cx(
|
|
10921
|
+
prefix("description-list__term"),
|
|
10922
|
+
descriptionTermProps?.className
|
|
10923
|
+
),
|
|
10924
|
+
children: term
|
|
10925
|
+
}
|
|
10926
|
+
),
|
|
10927
|
+
/* @__PURE__ */ jsx(
|
|
10928
|
+
"dd",
|
|
10929
|
+
{
|
|
10930
|
+
...descriptionDetailsProps,
|
|
10931
|
+
className: cx(
|
|
10932
|
+
prefix("description-list__details"),
|
|
10933
|
+
descriptionDetailsProps?.className
|
|
10934
|
+
),
|
|
10935
|
+
children
|
|
10936
|
+
}
|
|
10937
|
+
)
|
|
10938
|
+
]
|
|
10939
|
+
}
|
|
10940
|
+
);
|
|
10941
|
+
});
|
|
10498
10942
|
const DropdownMenu = DropdownMenu$1.Root;
|
|
10499
10943
|
const DropdownMenuCheckboxItem = forwardRef(function DropdownMenuCheckboxItem2({
|
|
10500
10944
|
showCheckbox = true,
|
|
@@ -10516,35 +10960,38 @@ const DropdownMenuCheckboxItem = forwardRef(function DropdownMenuCheckboxItem2({
|
|
|
10516
10960
|
keybindsProps,
|
|
10517
10961
|
indicatorProps,
|
|
10518
10962
|
className,
|
|
10963
|
+
"aria-disabled": ariaDisabled,
|
|
10519
10964
|
...otherProps
|
|
10520
10965
|
}, forwardedRef) {
|
|
10521
10966
|
const prefix = usePrefix();
|
|
10967
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
10522
10968
|
const [checked, setChecked] = useControllableState(
|
|
10523
10969
|
defaultChecked ?? false,
|
|
10524
10970
|
controlledChecked
|
|
10525
10971
|
);
|
|
10526
10972
|
const handleCheckedChange = useCallback(
|
|
10527
10973
|
(checked2) => {
|
|
10528
|
-
if (!
|
|
10974
|
+
if (!softDisabled) {
|
|
10529
10975
|
onCheckedChange?.(checked2);
|
|
10530
10976
|
setChecked(checked2);
|
|
10531
10977
|
}
|
|
10532
10978
|
},
|
|
10533
|
-
[
|
|
10979
|
+
[onCheckedChange, setChecked, softDisabled]
|
|
10534
10980
|
);
|
|
10535
10981
|
const handleSelect = useCallback(
|
|
10536
10982
|
(evt) => {
|
|
10537
|
-
if (
|
|
10983
|
+
if (softDisabled) {
|
|
10538
10984
|
evt.preventDefault();
|
|
10539
10985
|
return;
|
|
10540
10986
|
}
|
|
10541
10987
|
onSelect?.(evt);
|
|
10542
10988
|
},
|
|
10543
|
-
[
|
|
10989
|
+
[onSelect, softDisabled]
|
|
10544
10990
|
);
|
|
10545
10991
|
return /* @__PURE__ */ jsx(
|
|
10546
10992
|
MenuListItem,
|
|
10547
10993
|
{
|
|
10994
|
+
asChild: true,
|
|
10548
10995
|
type: "text",
|
|
10549
10996
|
color,
|
|
10550
10997
|
disabled,
|
|
@@ -10570,16 +11017,18 @@ const DropdownMenuCheckboxItem = forwardRef(function DropdownMenuCheckboxItem2({
|
|
|
10570
11017
|
iconProps,
|
|
10571
11018
|
spinnerProps,
|
|
10572
11019
|
keybindsProps,
|
|
10573
|
-
|
|
11020
|
+
"aria-disabled": ariaDisabled,
|
|
10574
11021
|
children: /* @__PURE__ */ jsx(
|
|
10575
11022
|
DropdownMenu$1.CheckboxItem,
|
|
10576
11023
|
{
|
|
11024
|
+
className: cx(prefix("dropdown-menu__checkbox-item"), className),
|
|
10577
11025
|
checked,
|
|
10578
11026
|
onCheckedChange: handleCheckedChange,
|
|
10579
11027
|
onSelect: handleSelect,
|
|
10580
11028
|
disabled,
|
|
11029
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
11030
|
+
"aria-disabled": disabled || softDisabled,
|
|
10581
11031
|
...otherProps,
|
|
10582
|
-
className: cx(prefix("dropdown-menu__checkbox-item"), className),
|
|
10583
11032
|
ref: forwardedRef
|
|
10584
11033
|
}
|
|
10585
11034
|
)
|
|
@@ -10687,12 +11136,14 @@ const DropdownMenuItem = forwardRef(function DropdownMenuItem2({
|
|
|
10687
11136
|
spinnerProps,
|
|
10688
11137
|
keybindsProps,
|
|
10689
11138
|
className,
|
|
11139
|
+
"aria-disabled": ariaDisabled,
|
|
10690
11140
|
...otherProps
|
|
10691
11141
|
}, forwardedRef) {
|
|
10692
11142
|
const prefix = usePrefix();
|
|
11143
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
10693
11144
|
const handleSelect = useCallback(
|
|
10694
11145
|
(evt) => {
|
|
10695
|
-
if (
|
|
11146
|
+
if (softDisabled) {
|
|
10696
11147
|
evt.preventDefault();
|
|
10697
11148
|
return;
|
|
10698
11149
|
}
|
|
@@ -10701,11 +11152,12 @@ const DropdownMenuItem = forwardRef(function DropdownMenuItem2({
|
|
|
10701
11152
|
window.open(href, target, rel?.split(" ").join(","));
|
|
10702
11153
|
}
|
|
10703
11154
|
},
|
|
10704
|
-
[asLink, href,
|
|
11155
|
+
[asLink, href, onSelect, rel, softDisabled, target]
|
|
10705
11156
|
);
|
|
10706
11157
|
return /* @__PURE__ */ jsx(
|
|
10707
11158
|
MenuListItem,
|
|
10708
11159
|
{
|
|
11160
|
+
asChild: true,
|
|
10709
11161
|
type: asLink ? "link" : "text",
|
|
10710
11162
|
selected,
|
|
10711
11163
|
color,
|
|
@@ -10724,14 +11176,16 @@ const DropdownMenuItem = forwardRef(function DropdownMenuItem2({
|
|
|
10724
11176
|
iconProps,
|
|
10725
11177
|
spinnerProps,
|
|
10726
11178
|
keybindsProps,
|
|
10727
|
-
|
|
11179
|
+
"aria-disabled": ariaDisabled,
|
|
10728
11180
|
children: /* @__PURE__ */ jsx(
|
|
10729
11181
|
DropdownMenu$1.Item,
|
|
10730
11182
|
{
|
|
11183
|
+
className: cx(prefix("dropdown-menu__item"), className),
|
|
11184
|
+
onSelect: handleSelect,
|
|
10731
11185
|
disabled,
|
|
11186
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
11187
|
+
"aria-disabled": disabled || softDisabled,
|
|
10732
11188
|
...otherProps,
|
|
10733
|
-
onSelect: handleSelect,
|
|
10734
|
-
className: cx(prefix("dropdown-menu__item"), className),
|
|
10735
11189
|
ref: forwardedRef
|
|
10736
11190
|
}
|
|
10737
11191
|
)
|
|
@@ -10775,22 +11229,25 @@ const DropdownMenuRadioItem = forwardRef(function DropdownMenuRadioItem2({
|
|
|
10775
11229
|
keybindsProps,
|
|
10776
11230
|
indicatorProps,
|
|
10777
11231
|
className,
|
|
11232
|
+
"aria-disabled": ariaDisabled,
|
|
10778
11233
|
...otherProps
|
|
10779
11234
|
}, forwardedRef) {
|
|
10780
11235
|
const prefix = usePrefix();
|
|
11236
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
10781
11237
|
const handleSelect = useCallback(
|
|
10782
11238
|
(evt) => {
|
|
10783
|
-
if (
|
|
11239
|
+
if (softDisabled) {
|
|
10784
11240
|
evt.preventDefault();
|
|
10785
11241
|
return;
|
|
10786
11242
|
}
|
|
10787
11243
|
onSelect?.(evt);
|
|
10788
11244
|
},
|
|
10789
|
-
[
|
|
11245
|
+
[onSelect, softDisabled]
|
|
10790
11246
|
);
|
|
10791
11247
|
return /* @__PURE__ */ jsx(
|
|
10792
11248
|
MenuListItem,
|
|
10793
11249
|
{
|
|
11250
|
+
asChild: true,
|
|
10794
11251
|
type: "text",
|
|
10795
11252
|
color,
|
|
10796
11253
|
disabled,
|
|
@@ -10815,15 +11272,17 @@ const DropdownMenuRadioItem = forwardRef(function DropdownMenuRadioItem2({
|
|
|
10815
11272
|
iconProps,
|
|
10816
11273
|
spinnerProps,
|
|
10817
11274
|
keybindsProps,
|
|
10818
|
-
|
|
11275
|
+
"aria-disabled": ariaDisabled,
|
|
10819
11276
|
children: /* @__PURE__ */ jsx(
|
|
10820
11277
|
DropdownMenu$1.RadioItem,
|
|
10821
11278
|
{
|
|
10822
|
-
disabled,
|
|
10823
|
-
onSelect: handleSelect,
|
|
10824
11279
|
className: cx(prefix("dropdown-menu__radio-item"), className),
|
|
10825
|
-
|
|
10826
|
-
|
|
11280
|
+
onSelect: handleSelect,
|
|
11281
|
+
disabled,
|
|
11282
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
11283
|
+
"aria-disabled": disabled || softDisabled,
|
|
11284
|
+
...otherProps,
|
|
11285
|
+
ref: forwardedRef
|
|
10827
11286
|
}
|
|
10828
11287
|
)
|
|
10829
11288
|
}
|
|
@@ -10877,6 +11336,7 @@ const DropdownMenuSubTrigger = forwardRef(function DropdownMenuSubTrigger2({
|
|
|
10877
11336
|
return /* @__PURE__ */ jsx(
|
|
10878
11337
|
MenuListItem,
|
|
10879
11338
|
{
|
|
11339
|
+
asChild: true,
|
|
10880
11340
|
type: "text",
|
|
10881
11341
|
color,
|
|
10882
11342
|
icon,
|
|
@@ -10891,12 +11351,12 @@ const DropdownMenuSubTrigger = forwardRef(function DropdownMenuSubTrigger2({
|
|
|
10891
11351
|
iconProps?.className
|
|
10892
11352
|
)
|
|
10893
11353
|
},
|
|
10894
|
-
asChild: true,
|
|
10895
11354
|
children: /* @__PURE__ */ jsx(
|
|
10896
11355
|
DropdownMenu$1.SubTrigger,
|
|
10897
11356
|
{
|
|
10898
|
-
...otherProps,
|
|
10899
11357
|
className: cx(prefix("dropdown-menu__sub-trigger"), className),
|
|
11358
|
+
disabled,
|
|
11359
|
+
...otherProps,
|
|
10900
11360
|
ref: forwardedRef
|
|
10901
11361
|
}
|
|
10902
11362
|
)
|
|
@@ -11225,91 +11685,11 @@ const FieldGroupTitle = forwardRef(function FieldGroupTitle2({
|
|
|
11225
11685
|
}
|
|
11226
11686
|
);
|
|
11227
11687
|
});
|
|
11228
|
-
const
|
|
11229
|
-
const Grid = forwardRef(function Grid2({
|
|
11230
|
-
asChild,
|
|
11231
|
-
container = false,
|
|
11232
|
-
columns,
|
|
11233
|
-
gap,
|
|
11234
|
-
rowGap = gap,
|
|
11235
|
-
columnGap = gap,
|
|
11236
|
-
xs,
|
|
11237
|
-
sm,
|
|
11238
|
-
md,
|
|
11239
|
-
lg,
|
|
11240
|
-
xl,
|
|
11241
|
-
xxl,
|
|
11242
|
-
xsOffset,
|
|
11243
|
-
smOffset,
|
|
11244
|
-
mdOffset,
|
|
11245
|
-
lgOffset,
|
|
11246
|
-
xlOffset,
|
|
11247
|
-
xxlOffset,
|
|
11248
|
-
className,
|
|
11249
|
-
style,
|
|
11250
|
-
...otherProps
|
|
11251
|
-
}, forwardedRef) {
|
|
11688
|
+
const Heading = forwardRef(function Heading2({ as, asChild, level = 2, className, ...otherProps }, forwardedRef) {
|
|
11252
11689
|
const prefix = usePrefix();
|
|
11253
|
-
const
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
const gridContext = useContext(GridContext);
|
|
11257
|
-
const sizes = { xs, sm, md, lg, xl, xxl };
|
|
11258
|
-
const offsets = {
|
|
11259
|
-
xs: xsOffset,
|
|
11260
|
-
sm: smOffset,
|
|
11261
|
-
md: mdOffset,
|
|
11262
|
-
lg: lgOffset,
|
|
11263
|
-
xl: xlOffset,
|
|
11264
|
-
xxl: xxlOffset
|
|
11265
|
-
};
|
|
11266
|
-
const gapMapper = (v) => typeof v === "number" ? spacing(v) : v;
|
|
11267
|
-
const { cssVars, dataAttrs } = responsiveValuesToCssVarsAndDataAttrs(
|
|
11268
|
-
"grid",
|
|
11269
|
-
{
|
|
11270
|
-
rowGap: container ? rowGap : void 0,
|
|
11271
|
-
columnGap: container ? columnGap : void 0,
|
|
11272
|
-
containerColumns: gridContext?.container ? gridContext?.columns : void 0,
|
|
11273
|
-
containerRowGap: gridContext?.container ? gridContext?.rowGap : void 0,
|
|
11274
|
-
containerColumnGap: gridContext?.container ? gridContext?.columnGap : void 0,
|
|
11275
|
-
itemSize: gridContext?.container ? sizes : void 0,
|
|
11276
|
-
itemAutoSize: gridContext?.container ? sizes : void 0,
|
|
11277
|
-
itemOffset: gridContext?.container ? offsets : void 0,
|
|
11278
|
-
itemAutoOffset: gridContext?.container ? offsets : void 0
|
|
11279
|
-
},
|
|
11280
|
-
{
|
|
11281
|
-
rowGap: gapMapper,
|
|
11282
|
-
columnGap: gapMapper,
|
|
11283
|
-
containerRowGap: gapMapper,
|
|
11284
|
-
containerColumnGap: gapMapper,
|
|
11285
|
-
itemSize: (v) => typeof v === "number" ? v : "auto",
|
|
11286
|
-
itemAutoSize: (v) => cssToggler(v === "auto"),
|
|
11287
|
-
itemAutoOffset: (v) => cssToggler(v === "auto")
|
|
11288
|
-
}
|
|
11289
|
-
);
|
|
11290
|
-
const As = asChild ? Slot : "div";
|
|
11291
|
-
return /* @__PURE__ */ jsx(GridContext.Provider, { value: { container, columns, rowGap, columnGap }, children: /* @__PURE__ */ jsx(
|
|
11292
|
-
As,
|
|
11293
|
-
{
|
|
11294
|
-
className: cx(
|
|
11295
|
-
prefix("grid"),
|
|
11296
|
-
// Grid container classes
|
|
11297
|
-
container && prefix("grid__container"),
|
|
11298
|
-
gridContext?.container && prefix("grid__item"),
|
|
11299
|
-
className
|
|
11300
|
-
),
|
|
11301
|
-
style: { ...cssVars, ...style },
|
|
11302
|
-
...dataAttrs,
|
|
11303
|
-
ref: forwardedRef,
|
|
11304
|
-
...otherProps
|
|
11305
|
-
}
|
|
11306
|
-
) });
|
|
11307
|
-
});
|
|
11308
|
-
const Heading = forwardRef(function Heading2({ as, asChild, level = 2, className, ...otherProps }, forwardedRef) {
|
|
11309
|
-
const prefix = usePrefix();
|
|
11310
|
-
const As = asChild ? Slot : as ?? `h${level}`;
|
|
11311
|
-
return /* @__PURE__ */ jsx(
|
|
11312
|
-
As,
|
|
11690
|
+
const As = asChild ? Slot : as ?? `h${level}`;
|
|
11691
|
+
return /* @__PURE__ */ jsx(
|
|
11692
|
+
As,
|
|
11313
11693
|
{
|
|
11314
11694
|
className: cx(prefix("heading"), prefix(`heading--${level}`), className),
|
|
11315
11695
|
ref: forwardedRef,
|
|
@@ -11801,6 +12181,7 @@ const Radio = forwardRef(function Radio2({
|
|
|
11801
12181
|
readOnly,
|
|
11802
12182
|
onClick,
|
|
11803
12183
|
className,
|
|
12184
|
+
"aria-disabled": ariaDisabled,
|
|
11804
12185
|
"aria-label": ariaLabel,
|
|
11805
12186
|
"aria-labelledby": ariaLabelledBy,
|
|
11806
12187
|
...otherProps
|
|
@@ -11816,15 +12197,15 @@ const Radio = forwardRef(function Radio2({
|
|
|
11816
12197
|
const loadingDescriptionId = loading && loadingDescription && prefix(`control-loading-${generatedId}`);
|
|
11817
12198
|
status = controlContext?.status ?? status;
|
|
11818
12199
|
disabled = controlContext?.disabled || disabled;
|
|
11819
|
-
loading = controlContext?.loading || loading;
|
|
11820
12200
|
readOnly = controlContext?.readOnly || readOnly;
|
|
12201
|
+
const softDisabled = controlContext?.softDisabled || loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
11821
12202
|
const handleClick = useCallback(
|
|
11822
12203
|
(evt) => {
|
|
11823
|
-
if (
|
|
12204
|
+
if (softDisabled || readOnly) {
|
|
11824
12205
|
evt.preventDefault();
|
|
11825
12206
|
}
|
|
11826
12207
|
},
|
|
11827
|
-
[
|
|
12208
|
+
[softDisabled, readOnly]
|
|
11828
12209
|
);
|
|
11829
12210
|
const combinedLabelIds = combineAriaIds(codeId, labelId);
|
|
11830
12211
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -11852,10 +12233,10 @@ const Radio = forwardRef(function Radio2({
|
|
|
11852
12233
|
className: cx(prefix("radio"), className),
|
|
11853
12234
|
value: value?.toString() ?? "",
|
|
11854
12235
|
disabled,
|
|
11855
|
-
"data-
|
|
12236
|
+
"data-disabled": boolDataAttr(softDisabled),
|
|
11856
12237
|
"data-readonly": boolDataAttr(readOnly),
|
|
11857
12238
|
"data-status": status,
|
|
11858
|
-
"aria-disabled":
|
|
12239
|
+
"aria-disabled": softDisabled || readOnly || void 0,
|
|
11859
12240
|
"aria-label": ariaLabel,
|
|
11860
12241
|
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 && combinedLabelIds !== labelId ? combinedLabelIds : void 0),
|
|
11861
12242
|
...otherProps,
|
|
@@ -11895,7 +12276,7 @@ const Radio = forwardRef(function Radio2({
|
|
|
11895
12276
|
Spinner,
|
|
11896
12277
|
{
|
|
11897
12278
|
"data-status": status,
|
|
11898
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
12279
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
11899
12280
|
...spinnerProps,
|
|
11900
12281
|
className: cx(prefix("radio__spinner"), spinnerProps?.className)
|
|
11901
12282
|
}
|
|
@@ -11932,6 +12313,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11932
12313
|
readOnly,
|
|
11933
12314
|
className,
|
|
11934
12315
|
children,
|
|
12316
|
+
"aria-disabled": ariaDisabled,
|
|
11935
12317
|
"aria-label": ariaLabel,
|
|
11936
12318
|
"aria-labelledby": ariaLabelledBy,
|
|
11937
12319
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -11966,14 +12348,15 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11966
12348
|
const isInTableCell = useIsInTableCell();
|
|
11967
12349
|
inline ??= isInTableCell;
|
|
11968
12350
|
variant ??= isInTableCell ? "cell" : "default";
|
|
12351
|
+
const softDisabled = loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
11969
12352
|
const handleValueChange = useCallback(
|
|
11970
12353
|
(value2) => {
|
|
11971
|
-
if (!
|
|
12354
|
+
if (!softDisabled && !readOnly) {
|
|
11972
12355
|
setValue(value2);
|
|
11973
12356
|
onValueChange?.(value2);
|
|
11974
12357
|
}
|
|
11975
12358
|
},
|
|
11976
|
-
[
|
|
12359
|
+
[softDisabled, onValueChange, readOnly, setValue]
|
|
11977
12360
|
);
|
|
11978
12361
|
const setFieldControlFocused = useSetFieldControlFocused();
|
|
11979
12362
|
const handleControlFocus = useCallback(() => {
|
|
@@ -11992,7 +12375,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
11992
12375
|
handleValueChange("");
|
|
11993
12376
|
radioGroupRef.current?.focus();
|
|
11994
12377
|
}, [handleValueChange]);
|
|
11995
|
-
const hasClearButton = !disabled && !
|
|
12378
|
+
const hasClearButton = !disabled && !softDisabled && !readOnly && (showClearButton === true || showClearButton === "auto" && (value?.length ?? 0) > 0);
|
|
11996
12379
|
const clearDescriptionId = hasClearButton && clearDescription && prefix(`control-clear-${generatedId}`);
|
|
11997
12380
|
const handleKeyDown = useCallback(
|
|
11998
12381
|
(evt) => {
|
|
@@ -12006,7 +12389,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
12006
12389
|
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(
|
|
12007
12390
|
ControlContext.Provider,
|
|
12008
12391
|
{
|
|
12009
|
-
value: { variant, status, disabled,
|
|
12392
|
+
value: { variant, status, disabled, softDisabled, readOnly },
|
|
12010
12393
|
children: /* @__PURE__ */ jsxs(
|
|
12011
12394
|
RadioGroup$1.Root,
|
|
12012
12395
|
{
|
|
@@ -12023,7 +12406,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
12023
12406
|
inline && prefix("radio-group--inline"),
|
|
12024
12407
|
className
|
|
12025
12408
|
),
|
|
12026
|
-
"aria-disabled":
|
|
12409
|
+
"aria-disabled": softDisabled || readOnly || void 0,
|
|
12027
12410
|
"aria-invalid": status === "invalid" || void 0,
|
|
12028
12411
|
"aria-label": ariaLabel,
|
|
12029
12412
|
"aria-labelledby": ariaLabelledBy ?? (ariaLabel === void 0 ? combineAriaIds(codeId, labelId ?? dataTableColumnLabelId) : void 0),
|
|
@@ -12055,7 +12438,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
12055
12438
|
{
|
|
12056
12439
|
"data-status": status,
|
|
12057
12440
|
"data-variant": variant,
|
|
12058
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
12441
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
12059
12442
|
"data-readonly": boolDataAttr(readOnly),
|
|
12060
12443
|
...containerProps,
|
|
12061
12444
|
className: cx(
|
|
@@ -12070,7 +12453,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
12070
12453
|
{
|
|
12071
12454
|
"data-status": status,
|
|
12072
12455
|
"data-variant": variant,
|
|
12073
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
12456
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
12074
12457
|
"data-readonly": boolDataAttr(readOnly),
|
|
12075
12458
|
...endContainerProps,
|
|
12076
12459
|
className: cx(
|
|
@@ -12109,7 +12492,7 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
12109
12492
|
Spinner,
|
|
12110
12493
|
{
|
|
12111
12494
|
color: controlStatusToAccent(status, "neutral"),
|
|
12112
|
-
"data-disabled": boolDataAttr(disabled ||
|
|
12495
|
+
"data-disabled": boolDataAttr(disabled || softDisabled),
|
|
12113
12496
|
...spinnerProps,
|
|
12114
12497
|
className: cx(
|
|
12115
12498
|
prefix("radio-group__spinner"),
|
|
@@ -12128,185 +12511,601 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
12128
12511
|
}
|
|
12129
12512
|
) });
|
|
12130
12513
|
});
|
|
12131
|
-
const Separator = forwardRef(function Separator2({
|
|
12514
|
+
const Separator = forwardRef(function Separator2({
|
|
12515
|
+
asChild,
|
|
12516
|
+
color = "neutral",
|
|
12517
|
+
length,
|
|
12518
|
+
className,
|
|
12519
|
+
style,
|
|
12520
|
+
children,
|
|
12521
|
+
...otherProps
|
|
12522
|
+
}, forwardedRef) {
|
|
12132
12523
|
const prefix = usePrefix();
|
|
12524
|
+
const { cssVarStyle } = useCssVars();
|
|
12525
|
+
const spacing = useSpacing();
|
|
12133
12526
|
return /* @__PURE__ */ jsx(
|
|
12134
12527
|
Separator$2.Root,
|
|
12135
12528
|
{
|
|
12529
|
+
asChild: true,
|
|
12136
12530
|
className: cx(prefix("separator"), className),
|
|
12531
|
+
"data-accent": color,
|
|
12532
|
+
style: {
|
|
12533
|
+
...cssVarStyle(
|
|
12534
|
+
"separator-length",
|
|
12535
|
+
typeof length === "number" ? spacing(length) : length
|
|
12536
|
+
),
|
|
12537
|
+
...style
|
|
12538
|
+
},
|
|
12137
12539
|
...otherProps,
|
|
12138
|
-
ref: forwardedRef
|
|
12540
|
+
ref: forwardedRef,
|
|
12541
|
+
children: asChild ? children : /* @__PURE__ */ jsx("span", { children })
|
|
12139
12542
|
}
|
|
12140
12543
|
);
|
|
12141
12544
|
});
|
|
12142
12545
|
const StepperContext = createContext(null);
|
|
12546
|
+
function useCreateStepperContext(defaultActiveStep, activeStep, onActiveStepChange, showAllStepsWhilePrinting) {
|
|
12547
|
+
const latest = useLatestValues({ onActiveStepChange });
|
|
12548
|
+
const store = useConstant(
|
|
12549
|
+
() => createStore()(
|
|
12550
|
+
subscribeWithSelector((set, get) => ({
|
|
12551
|
+
_activeStep: defaultActiveStep ?? 0,
|
|
12552
|
+
_controlledActiveStep: activeStep,
|
|
12553
|
+
activeStep: computed(
|
|
12554
|
+
() => [
|
|
12555
|
+
get()._controlledActiveStep ?? get()._activeStep,
|
|
12556
|
+
get().stepCount()
|
|
12557
|
+
],
|
|
12558
|
+
(activeStep2, stepCount) => Number.isNaN(activeStep2) ? 0 : Math.max(0, Math.min(activeStep2, stepCount))
|
|
12559
|
+
),
|
|
12560
|
+
stepsInfo: {},
|
|
12561
|
+
stepsContent: {},
|
|
12562
|
+
stepCount: computed(
|
|
12563
|
+
() => [get().stepsInfo],
|
|
12564
|
+
(stepLabels) => Object.keys(stepLabels).length
|
|
12565
|
+
),
|
|
12566
|
+
actions: {
|
|
12567
|
+
registerStep: (index, info) => {
|
|
12568
|
+
set(({ stepsInfo }) => ({
|
|
12569
|
+
stepsInfo: { ...stepsInfo, [index]: info }
|
|
12570
|
+
}));
|
|
12571
|
+
return () => {
|
|
12572
|
+
set(({ stepsInfo: { [index]: _, ...otherInfo } }) => ({
|
|
12573
|
+
stepsInfo: otherInfo
|
|
12574
|
+
}));
|
|
12575
|
+
};
|
|
12576
|
+
},
|
|
12577
|
+
registerStepContent: (index, info) => {
|
|
12578
|
+
set(({ stepsContent }) => ({
|
|
12579
|
+
stepsContent: { ...stepsContent, [index]: info }
|
|
12580
|
+
}));
|
|
12581
|
+
return () => {
|
|
12582
|
+
set(({ stepsContent: { [index]: _, ...id } }) => ({
|
|
12583
|
+
stepsContent: id
|
|
12584
|
+
}));
|
|
12585
|
+
};
|
|
12586
|
+
},
|
|
12587
|
+
getStepInfo: (index) => {
|
|
12588
|
+
return get().stepsInfo[index];
|
|
12589
|
+
},
|
|
12590
|
+
getStepContent: (index) => {
|
|
12591
|
+
return get().stepsContent[index];
|
|
12592
|
+
},
|
|
12593
|
+
goTo: (index) => {
|
|
12594
|
+
index = +index;
|
|
12595
|
+
if (Number.isNaN(index)) {
|
|
12596
|
+
index = 0;
|
|
12597
|
+
}
|
|
12598
|
+
index = Math.max(0, Math.min(index, get().stepCount()));
|
|
12599
|
+
if (get().activeStep() !== index) {
|
|
12600
|
+
set({ _activeStep: index });
|
|
12601
|
+
latest.onActiveStepChange?.(index);
|
|
12602
|
+
}
|
|
12603
|
+
},
|
|
12604
|
+
next: () => {
|
|
12605
|
+
get().actions.goTo(get().activeStep() + 1);
|
|
12606
|
+
},
|
|
12607
|
+
previous: () => {
|
|
12608
|
+
get().actions.goTo(get().activeStep() - 1);
|
|
12609
|
+
}
|
|
12610
|
+
}
|
|
12611
|
+
}))
|
|
12612
|
+
)
|
|
12613
|
+
);
|
|
12614
|
+
useEffect(() => {
|
|
12615
|
+
if (activeStep !== void 0) {
|
|
12616
|
+
store.setState({ _controlledActiveStep: activeStep });
|
|
12617
|
+
}
|
|
12618
|
+
}, [store, activeStep]);
|
|
12619
|
+
return useMemo(
|
|
12620
|
+
() => ({ showAllStepsWhilePrinting, store }),
|
|
12621
|
+
[showAllStepsWhilePrinting, store]
|
|
12622
|
+
);
|
|
12623
|
+
}
|
|
12143
12624
|
function useStepperContext() {
|
|
12144
|
-
const
|
|
12145
|
-
if (!
|
|
12625
|
+
const stepperContent = useContext(StepperContext);
|
|
12626
|
+
if (!stepperContent) {
|
|
12146
12627
|
throw new Error("Stepper context not in scope.");
|
|
12147
12628
|
}
|
|
12148
|
-
return
|
|
12629
|
+
return stepperContent;
|
|
12630
|
+
}
|
|
12631
|
+
function useRegisterStep(index, info) {
|
|
12632
|
+
const { store } = useStepperContext();
|
|
12633
|
+
const printing = usePrinting();
|
|
12634
|
+
useEffect(() => {
|
|
12635
|
+
if (!printing) {
|
|
12636
|
+
return store.getState().actions.registerStep(index, info);
|
|
12637
|
+
}
|
|
12638
|
+
}, [index, info, printing, store]);
|
|
12639
|
+
}
|
|
12640
|
+
function useRegisterStepContent(index, info) {
|
|
12641
|
+
const { store } = useStepperContext();
|
|
12642
|
+
const printing = usePrinting();
|
|
12643
|
+
useEffect(() => {
|
|
12644
|
+
if (!printing) {
|
|
12645
|
+
return store.getState().actions.registerStepContent(index, info);
|
|
12646
|
+
}
|
|
12647
|
+
}, [info, index, printing, store]);
|
|
12648
|
+
}
|
|
12649
|
+
function useStepInfo(index) {
|
|
12650
|
+
const { store } = useStepperContext();
|
|
12651
|
+
return useStore$1(store, (state) => state.actions.getStepInfo(index));
|
|
12652
|
+
}
|
|
12653
|
+
function useStepContentInfo(index) {
|
|
12654
|
+
const { store } = useStepperContext();
|
|
12655
|
+
return useStore$1(store, (state) => state.actions.getStepContent(index));
|
|
12656
|
+
}
|
|
12657
|
+
function useStepperApi() {
|
|
12658
|
+
const { store } = useStepperContext();
|
|
12659
|
+
return useStore$1(
|
|
12660
|
+
store,
|
|
12661
|
+
useShallow((state) => ({
|
|
12662
|
+
activeStep: state.activeStep(),
|
|
12663
|
+
goTo: state.actions.goTo,
|
|
12664
|
+
next: state.actions.next,
|
|
12665
|
+
previous: state.actions.previous
|
|
12666
|
+
}))
|
|
12667
|
+
);
|
|
12149
12668
|
}
|
|
12150
12669
|
const Step = forwardRef(function Step2({
|
|
12670
|
+
asChild,
|
|
12151
12671
|
index,
|
|
12672
|
+
completed,
|
|
12152
12673
|
status,
|
|
12153
|
-
|
|
12674
|
+
stepNumberLabel,
|
|
12675
|
+
completedLabel,
|
|
12676
|
+
variant,
|
|
12677
|
+
disabled,
|
|
12678
|
+
loading,
|
|
12679
|
+
showSpinner,
|
|
12154
12680
|
className,
|
|
12155
12681
|
children,
|
|
12156
|
-
|
|
12682
|
+
buttonProps,
|
|
12157
12683
|
labelProps,
|
|
12158
12684
|
...otherProps
|
|
12159
12685
|
}, forwardedRef) {
|
|
12160
12686
|
if (index == null) {
|
|
12161
|
-
throw new Error(
|
|
12687
|
+
throw new Error(
|
|
12688
|
+
"Missing `index` property. When a `Step` is not a direct child of `StepList`, its index must be manually provided."
|
|
12689
|
+
);
|
|
12162
12690
|
}
|
|
12691
|
+
const [locale7] = useLocale();
|
|
12692
|
+
stepNumberLabel ??= locale7.Step.stepNumberLabel;
|
|
12693
|
+
completedLabel ??= locale7.Step.completedLabel;
|
|
12163
12694
|
const prefix = usePrefix();
|
|
12164
|
-
const {
|
|
12165
|
-
const
|
|
12695
|
+
const { store } = useStepperContext();
|
|
12696
|
+
const isActive = useStore$1(store, (state) => state.activeStep() === index);
|
|
12697
|
+
const isCompleted = useStore$1(
|
|
12698
|
+
store,
|
|
12699
|
+
(state) => completed ?? state.activeStep() > index
|
|
12700
|
+
);
|
|
12166
12701
|
const generatedId = useId();
|
|
12167
|
-
const
|
|
12702
|
+
const labelId = labelProps?.id ?? prefix(`stepper-step-label-${generatedId}`);
|
|
12703
|
+
const buttonId = buttonProps?.id ?? prefix(`stepper-step-button-${generatedId}`);
|
|
12704
|
+
const stepContentInfo = useStepContentInfo(index);
|
|
12705
|
+
useRegisterStep(
|
|
12706
|
+
index,
|
|
12707
|
+
useMemo(
|
|
12708
|
+
() => ({ labelId, label: children, disabled }),
|
|
12709
|
+
[children, disabled, labelId]
|
|
12710
|
+
)
|
|
12711
|
+
);
|
|
12712
|
+
const handleClick = useCallback(
|
|
12713
|
+
(evt) => {
|
|
12714
|
+
store.getState().actions.goTo(index);
|
|
12715
|
+
buttonProps?.onClick?.(evt);
|
|
12716
|
+
},
|
|
12717
|
+
[buttonProps, index, store]
|
|
12718
|
+
);
|
|
12719
|
+
const As = asChild ? Slot : "li";
|
|
12168
12720
|
return /* @__PURE__ */ jsxs(
|
|
12169
|
-
|
|
12721
|
+
As,
|
|
12170
12722
|
{
|
|
12171
|
-
|
|
12723
|
+
className: cx(prefix("stepper__step"), className),
|
|
12724
|
+
"data-completed": boolDataAttr(isCompleted),
|
|
12725
|
+
"data-active": boolDataAttr(isActive),
|
|
12172
12726
|
"data-status": status,
|
|
12173
12727
|
"data-accent": controlStatusToAccent(
|
|
12174
12728
|
status,
|
|
12175
|
-
|
|
12176
|
-
),
|
|
12177
|
-
...containerProps,
|
|
12178
|
-
className: cx(
|
|
12179
|
-
prefix("stepper__step-container"),
|
|
12180
|
-
containerProps?.className
|
|
12729
|
+
isCompleted ? "primary" : "neutral"
|
|
12181
12730
|
),
|
|
12731
|
+
...otherProps,
|
|
12732
|
+
ref: forwardedRef,
|
|
12182
12733
|
children: [
|
|
12183
|
-
/* @__PURE__ */
|
|
12734
|
+
/* @__PURE__ */ jsxs(
|
|
12184
12735
|
Label,
|
|
12185
12736
|
{
|
|
12186
|
-
"data-
|
|
12737
|
+
"data-completed": boolDataAttr(isCompleted),
|
|
12738
|
+
"data-active": boolDataAttr(isActive),
|
|
12187
12739
|
...labelProps,
|
|
12740
|
+
id: labelId,
|
|
12188
12741
|
className: cx(prefix("stepper__step-label"), labelProps?.className),
|
|
12189
|
-
htmlFor:
|
|
12190
|
-
children
|
|
12742
|
+
htmlFor: buttonId,
|
|
12743
|
+
children: [
|
|
12744
|
+
stepNumberLabel && /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
|
|
12745
|
+
stepNumberLabel(index),
|
|
12746
|
+
", "
|
|
12747
|
+
] }),
|
|
12748
|
+
children,
|
|
12749
|
+
isCompleted && /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
|
|
12750
|
+
", ",
|
|
12751
|
+
completedLabel
|
|
12752
|
+
] })
|
|
12753
|
+
]
|
|
12191
12754
|
}
|
|
12192
12755
|
),
|
|
12193
12756
|
/* @__PURE__ */ jsx(
|
|
12194
|
-
|
|
12757
|
+
Button,
|
|
12195
12758
|
{
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
)
|
|
12759
|
+
variant: variant ?? (isCompleted || isActive ? "solid" : "subtle"),
|
|
12760
|
+
color: controlStatusToAccent(
|
|
12761
|
+
status,
|
|
12762
|
+
isCompleted || isActive ? "primary" : "neutral"
|
|
12763
|
+
),
|
|
12764
|
+
"data-completed": boolDataAttr(isCompleted),
|
|
12765
|
+
"data-active": boolDataAttr(isActive),
|
|
12766
|
+
"data-status": status,
|
|
12767
|
+
loading,
|
|
12768
|
+
showSpinner,
|
|
12769
|
+
"aria-disabled": disabled,
|
|
12770
|
+
"aria-current": isActive ? "step" : void 0,
|
|
12771
|
+
"aria-controls": isActive ? stepContentInfo?.id : void 0,
|
|
12772
|
+
...buttonProps,
|
|
12773
|
+
id: buttonId,
|
|
12774
|
+
className: cx(prefix("stepper__step-button"), buttonProps?.className),
|
|
12775
|
+
onClick: handleClick,
|
|
12776
|
+
children: isCompleted ? /* @__PURE__ */ jsx(Icon, { icon: faCheck }) : /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: index + 1 })
|
|
12212
12777
|
}
|
|
12213
12778
|
)
|
|
12214
12779
|
]
|
|
12215
12780
|
}
|
|
12216
12781
|
);
|
|
12217
12782
|
});
|
|
12218
|
-
const StepContent = forwardRef(
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12783
|
+
const StepContent = forwardRef(
|
|
12784
|
+
function StepContent2({
|
|
12785
|
+
asChild,
|
|
12786
|
+
index,
|
|
12787
|
+
id,
|
|
12788
|
+
className,
|
|
12789
|
+
stepContentLabelProps,
|
|
12790
|
+
stepContentLabelIndexProps,
|
|
12791
|
+
...otherProps
|
|
12792
|
+
}, forwardedRef) {
|
|
12793
|
+
if (index == null) {
|
|
12794
|
+
throw new Error(
|
|
12795
|
+
"Missing `index` property. When a `StepContent` is not a direct child of `Stepper`, its index must be manually provided."
|
|
12796
|
+
);
|
|
12227
12797
|
}
|
|
12798
|
+
const prefix = usePrefix();
|
|
12799
|
+
const printing = usePrinting();
|
|
12800
|
+
const contentRef = useRef(null);
|
|
12801
|
+
const generatedId = useId();
|
|
12802
|
+
const actualId = id ?? prefix(`stepper-step-content-${generatedId}`);
|
|
12803
|
+
useRegisterStepContent(
|
|
12804
|
+
index,
|
|
12805
|
+
useMemo(() => ({ id: actualId, ref: contentRef }), [actualId])
|
|
12806
|
+
);
|
|
12807
|
+
const { showAllStepsWhilePrinting, store } = useStepperContext();
|
|
12808
|
+
const isActive = useStore$1(store, (state) => state.activeStep() === index);
|
|
12809
|
+
const stepInfo = useStepInfo(index);
|
|
12810
|
+
const combinedRef = useCombinedRef(contentRef, forwardedRef);
|
|
12811
|
+
const As = asChild ? Slot : "div";
|
|
12812
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12813
|
+
printing && showAllStepsWhilePrinting && stepInfo?.label && /* @__PURE__ */ jsxs(
|
|
12814
|
+
"span",
|
|
12815
|
+
{
|
|
12816
|
+
...stepContentLabelProps,
|
|
12817
|
+
className: cx(
|
|
12818
|
+
prefix("stepper__step-content-label"),
|
|
12819
|
+
stepContentLabelProps?.className
|
|
12820
|
+
),
|
|
12821
|
+
children: [
|
|
12822
|
+
/* @__PURE__ */ jsx(
|
|
12823
|
+
"span",
|
|
12824
|
+
{
|
|
12825
|
+
className: cx(
|
|
12826
|
+
prefix("stepper__step-content-label-index"),
|
|
12827
|
+
stepContentLabelIndexProps?.className
|
|
12828
|
+
),
|
|
12829
|
+
children: index + 1
|
|
12830
|
+
}
|
|
12831
|
+
),
|
|
12832
|
+
stepInfo.label
|
|
12833
|
+
]
|
|
12834
|
+
}
|
|
12835
|
+
),
|
|
12836
|
+
(printing && showAllStepsWhilePrinting || isActive) && /* @__PURE__ */ jsx(
|
|
12837
|
+
As,
|
|
12838
|
+
{
|
|
12839
|
+
className: cx(prefix("stepper__step-content"), className),
|
|
12840
|
+
role: "region",
|
|
12841
|
+
"aria-labelledby": stepInfo?.labelId,
|
|
12842
|
+
"data-active": boolDataAttr(isActive),
|
|
12843
|
+
tabIndex: -1,
|
|
12844
|
+
...otherProps,
|
|
12845
|
+
ref: combinedRef
|
|
12846
|
+
}
|
|
12847
|
+
)
|
|
12848
|
+
] });
|
|
12849
|
+
}
|
|
12850
|
+
);
|
|
12851
|
+
const StepList = forwardRef(
|
|
12852
|
+
function StepList2({ asChild, className, children, ...otherProps }, forwardedRef) {
|
|
12853
|
+
const prefix = usePrefix();
|
|
12854
|
+
const { showAllStepsWhilePrinting } = useStepperContext();
|
|
12855
|
+
const { printHidden } = usePrintClassNames();
|
|
12856
|
+
let currentIndex = 0;
|
|
12857
|
+
const indexedChildren = Children.toArray(children).map((child) => {
|
|
12858
|
+
if (!isValidElement(child) || child.type !== Step) {
|
|
12859
|
+
return child;
|
|
12860
|
+
}
|
|
12861
|
+
const { index, ...otherStepProps } = child.props;
|
|
12862
|
+
if (index) {
|
|
12863
|
+
currentIndex = index;
|
|
12864
|
+
}
|
|
12865
|
+
return cloneElement(child, {
|
|
12866
|
+
index: currentIndex++,
|
|
12867
|
+
...otherStepProps
|
|
12868
|
+
});
|
|
12869
|
+
});
|
|
12870
|
+
const As = asChild ? Slot : "ol";
|
|
12871
|
+
return /* @__PURE__ */ jsx(
|
|
12872
|
+
As,
|
|
12873
|
+
{
|
|
12874
|
+
className: cx(
|
|
12875
|
+
prefix("stepper__step-list"),
|
|
12876
|
+
showAllStepsWhilePrinting && printHidden,
|
|
12877
|
+
className
|
|
12878
|
+
),
|
|
12879
|
+
...otherProps,
|
|
12880
|
+
ref: forwardedRef,
|
|
12881
|
+
children: indexedChildren
|
|
12882
|
+
}
|
|
12883
|
+
);
|
|
12884
|
+
}
|
|
12885
|
+
);
|
|
12886
|
+
const Stepper = forwardRef(
|
|
12887
|
+
function Stepper2({
|
|
12888
|
+
asChild,
|
|
12889
|
+
defaultActiveStep,
|
|
12890
|
+
activeStep: controlledActiveStep,
|
|
12891
|
+
onActiveStepChange,
|
|
12892
|
+
showAllStepsWhilePrinting,
|
|
12893
|
+
className,
|
|
12894
|
+
apiRef,
|
|
12895
|
+
children,
|
|
12896
|
+
...otherProps
|
|
12897
|
+
}, forwardedRef) {
|
|
12898
|
+
const prefix = usePrefix();
|
|
12899
|
+
const stepperContext = useCreateStepperContext(
|
|
12900
|
+
defaultActiveStep,
|
|
12901
|
+
controlledActiveStep,
|
|
12902
|
+
onActiveStepChange,
|
|
12903
|
+
showAllStepsWhilePrinting
|
|
12904
|
+
);
|
|
12905
|
+
const { store } = stepperContext;
|
|
12906
|
+
const api = useStore$1(
|
|
12907
|
+
store,
|
|
12908
|
+
useShallow(
|
|
12909
|
+
(state) => apiRef ? {
|
|
12910
|
+
activeStep: state.activeStep(),
|
|
12911
|
+
goTo: state.actions.goTo,
|
|
12912
|
+
next: state.actions.next,
|
|
12913
|
+
previous: state.actions.previous
|
|
12914
|
+
} : null
|
|
12915
|
+
)
|
|
12916
|
+
);
|
|
12917
|
+
useImperativeHandle(apiRef, () => api, [api]);
|
|
12918
|
+
let currentIndex = 0;
|
|
12919
|
+
const indexedChildren = Children.toArray(children).map((child) => {
|
|
12920
|
+
if (!isValidElement(child) || child.type !== StepContent) {
|
|
12921
|
+
return child;
|
|
12922
|
+
}
|
|
12923
|
+
const { index, ...otherStepContentProps } = child.props;
|
|
12924
|
+
if (index) {
|
|
12925
|
+
currentIndex = index;
|
|
12926
|
+
}
|
|
12927
|
+
return cloneElement(child, {
|
|
12928
|
+
index: currentIndex++,
|
|
12929
|
+
...otherStepContentProps
|
|
12930
|
+
});
|
|
12931
|
+
});
|
|
12932
|
+
const As = asChild ? Slot : "div";
|
|
12933
|
+
return /* @__PURE__ */ jsx(StepperContext.Provider, { value: stepperContext, children: /* @__PURE__ */ jsx(
|
|
12934
|
+
As,
|
|
12935
|
+
{
|
|
12936
|
+
className: cx(prefix("stepper"), className),
|
|
12937
|
+
...otherProps,
|
|
12938
|
+
ref: forwardedRef,
|
|
12939
|
+
children: indexedChildren
|
|
12940
|
+
}
|
|
12941
|
+
) });
|
|
12942
|
+
}
|
|
12943
|
+
);
|
|
12944
|
+
const StepperFinishTrigger = forwardRef(function StepperFinishTrigger2({
|
|
12945
|
+
showWhenNotLast,
|
|
12946
|
+
showWhilePrinting,
|
|
12947
|
+
disabled,
|
|
12948
|
+
className,
|
|
12949
|
+
children,
|
|
12950
|
+
...otherProps
|
|
12951
|
+
}, forwardedRef) {
|
|
12952
|
+
const prefix = usePrefix();
|
|
12953
|
+
const [locale7] = useLocale();
|
|
12954
|
+
const { printHidden } = usePrintClassNames();
|
|
12955
|
+
const { store } = useStepperContext();
|
|
12956
|
+
const isLast = useStore$1(
|
|
12957
|
+
store,
|
|
12958
|
+
(state) => state.activeStep() >= state.stepCount() - 1
|
|
12228
12959
|
);
|
|
12960
|
+
const shouldRender = showWhenNotLast || isLast;
|
|
12961
|
+
if (!shouldRender) {
|
|
12962
|
+
return null;
|
|
12963
|
+
}
|
|
12964
|
+
const shouldDisable = !isLast || disabled;
|
|
12965
|
+
const commonProps = {
|
|
12966
|
+
className: cx(
|
|
12967
|
+
prefix("stepper__finish-trigger"),
|
|
12968
|
+
showWhilePrinting || printHidden,
|
|
12969
|
+
className
|
|
12970
|
+
),
|
|
12971
|
+
disabled: shouldDisable
|
|
12972
|
+
};
|
|
12973
|
+
if (children === void 0) {
|
|
12974
|
+
const { label = locale7.StepperFinishTrigger.label, ...buttonProps } = otherProps;
|
|
12975
|
+
return /* @__PURE__ */ jsx(
|
|
12976
|
+
Button,
|
|
12977
|
+
{
|
|
12978
|
+
iconPlacement: "end",
|
|
12979
|
+
color: "primary",
|
|
12980
|
+
...buttonProps,
|
|
12981
|
+
...commonProps,
|
|
12982
|
+
ref: forwardedRef,
|
|
12983
|
+
children: label
|
|
12984
|
+
}
|
|
12985
|
+
);
|
|
12986
|
+
}
|
|
12987
|
+
return /* @__PURE__ */ jsx(Slot, { ...otherProps, ...commonProps, ref: forwardedRef, children });
|
|
12229
12988
|
});
|
|
12230
|
-
const
|
|
12989
|
+
const StepperNextTrigger = forwardRef(function StepperNextTrigger2({
|
|
12990
|
+
showWhenLast,
|
|
12991
|
+
showWhilePrinting,
|
|
12992
|
+
disabled,
|
|
12993
|
+
onClick,
|
|
12994
|
+
className,
|
|
12995
|
+
children,
|
|
12996
|
+
...otherProps
|
|
12997
|
+
}, forwardedRef) {
|
|
12231
12998
|
const prefix = usePrefix();
|
|
12232
|
-
|
|
12233
|
-
const
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
const stepIndex = index ?? currentIndex++;
|
|
12239
|
-
return cloneElement(child, {
|
|
12240
|
-
index: stepIndex,
|
|
12241
|
-
...otherStepProps
|
|
12242
|
-
});
|
|
12243
|
-
});
|
|
12244
|
-
return /* @__PURE__ */ jsx(
|
|
12245
|
-
Tabs$1.List,
|
|
12246
|
-
{
|
|
12247
|
-
className: cx(prefix("stepper__step-list"), className),
|
|
12248
|
-
...otherProps,
|
|
12249
|
-
ref: forwardedRef,
|
|
12250
|
-
children: indexedChildren
|
|
12251
|
-
}
|
|
12999
|
+
const [locale7] = useLocale();
|
|
13000
|
+
const { printHidden } = usePrintClassNames();
|
|
13001
|
+
const { store } = useStepperContext();
|
|
13002
|
+
const isLast = useStore$1(
|
|
13003
|
+
store,
|
|
13004
|
+
(state) => state.activeStep() >= state.stepCount() - 1
|
|
12252
13005
|
);
|
|
13006
|
+
const nextIsDisabled = useStore$1(
|
|
13007
|
+
store,
|
|
13008
|
+
(state) => state.actions.getStepInfo(state.activeStep() + 1)?.disabled
|
|
13009
|
+
);
|
|
13010
|
+
const handleClick = useCallback(() => {
|
|
13011
|
+
const { next, getStepContent } = store.getState().actions;
|
|
13012
|
+
next();
|
|
13013
|
+
setTimeout(
|
|
13014
|
+
() => getStepContent(store.getState().activeStep())?.ref.current?.focus()
|
|
13015
|
+
);
|
|
13016
|
+
}, [store]);
|
|
13017
|
+
const shouldRender = showWhenLast || !isLast;
|
|
13018
|
+
if (!shouldRender) {
|
|
13019
|
+
return null;
|
|
13020
|
+
}
|
|
13021
|
+
const shouldDisable = isLast || nextIsDisabled || disabled;
|
|
13022
|
+
const commonProps = {
|
|
13023
|
+
className: cx(
|
|
13024
|
+
prefix("stepper__next-trigger"),
|
|
13025
|
+
showWhilePrinting || printHidden,
|
|
13026
|
+
className
|
|
13027
|
+
),
|
|
13028
|
+
disabled: shouldDisable,
|
|
13029
|
+
onClick: combineEventHandlers(onClick, handleClick, {
|
|
13030
|
+
checkDefaultPrevented: true
|
|
13031
|
+
})
|
|
13032
|
+
};
|
|
13033
|
+
if (children === void 0) {
|
|
13034
|
+
const { label = locale7.StepperNextTrigger.label, ...buttonProps } = otherProps;
|
|
13035
|
+
return /* @__PURE__ */ jsx(
|
|
13036
|
+
Button,
|
|
13037
|
+
{
|
|
13038
|
+
iconPlacement: "end",
|
|
13039
|
+
color: "primary",
|
|
13040
|
+
...buttonProps,
|
|
13041
|
+
...commonProps,
|
|
13042
|
+
ref: forwardedRef,
|
|
13043
|
+
children: label
|
|
13044
|
+
}
|
|
13045
|
+
);
|
|
13046
|
+
}
|
|
13047
|
+
return /* @__PURE__ */ jsx(Slot, { ...otherProps, ...commonProps, ref: forwardedRef, children });
|
|
12253
13048
|
});
|
|
12254
|
-
const
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
13049
|
+
const StepperPreviousTrigger = forwardRef(function StepperPreviousTrigger2({
|
|
13050
|
+
showWhenFirst = true,
|
|
13051
|
+
showWhilePrinting,
|
|
13052
|
+
disabled,
|
|
13053
|
+
onClick,
|
|
12259
13054
|
className,
|
|
12260
|
-
apiRef,
|
|
12261
13055
|
children,
|
|
12262
13056
|
...otherProps
|
|
12263
13057
|
}, forwardedRef) {
|
|
12264
13058
|
const prefix = usePrefix();
|
|
12265
|
-
const [
|
|
12266
|
-
|
|
12267
|
-
|
|
13059
|
+
const [locale7] = useLocale();
|
|
13060
|
+
const { printHidden } = usePrintClassNames();
|
|
13061
|
+
const { store } = useStepperContext();
|
|
13062
|
+
const isFirst = useStore$1(store, (state) => state.activeStep() === 0);
|
|
13063
|
+
const prevIsDisabled = useStore$1(
|
|
13064
|
+
store,
|
|
13065
|
+
(state) => state.actions.getStepInfo(state.activeStep() - 1)?.disabled
|
|
12268
13066
|
);
|
|
12269
|
-
const
|
|
12270
|
-
(
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
13067
|
+
const handleClick = useCallback(() => {
|
|
13068
|
+
const { previous, getStepContent } = store.getState().actions;
|
|
13069
|
+
previous();
|
|
13070
|
+
setTimeout(
|
|
13071
|
+
() => getStepContent(store.getState().activeStep())?.ref.current?.focus()
|
|
13072
|
+
);
|
|
13073
|
+
}, [store]);
|
|
13074
|
+
const shouldRender = showWhenFirst || !isFirst;
|
|
13075
|
+
if (!shouldRender) {
|
|
13076
|
+
return null;
|
|
13077
|
+
}
|
|
13078
|
+
const shouldDisable = isFirst || prevIsDisabled || disabled;
|
|
13079
|
+
const commonProps = {
|
|
13080
|
+
className: cx(
|
|
13081
|
+
prefix("stepper__previous-trigger"),
|
|
13082
|
+
showWhilePrinting || printHidden,
|
|
13083
|
+
className
|
|
13084
|
+
),
|
|
13085
|
+
disabled: shouldDisable,
|
|
13086
|
+
onClick: combineEventHandlers(onClick, handleClick, {
|
|
13087
|
+
checkDefaultPrevented: true
|
|
13088
|
+
})
|
|
13089
|
+
};
|
|
13090
|
+
if (children === void 0) {
|
|
13091
|
+
const { label = locale7.StepperPreviousTrigger.label, ...buttonProps } = otherProps;
|
|
13092
|
+
return /* @__PURE__ */ jsx(
|
|
13093
|
+
Button,
|
|
13094
|
+
{
|
|
13095
|
+
variant: "subtle",
|
|
13096
|
+
...buttonProps,
|
|
13097
|
+
...commonProps,
|
|
13098
|
+
ref: forwardedRef,
|
|
13099
|
+
children: label
|
|
12275
13100
|
}
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
);
|
|
12279
|
-
const next = useCallback(
|
|
12280
|
-
() => handleValueChange(activeStep + 1),
|
|
12281
|
-
[activeStep, handleValueChange]
|
|
12282
|
-
);
|
|
12283
|
-
const previous = useCallback(
|
|
12284
|
-
() => handleValueChange(activeStep - 1),
|
|
12285
|
-
[activeStep, handleValueChange]
|
|
12286
|
-
);
|
|
12287
|
-
const api = useMemo(
|
|
12288
|
-
() => ({
|
|
12289
|
-
activeStep,
|
|
12290
|
-
goTo: handleValueChange,
|
|
12291
|
-
next,
|
|
12292
|
-
previous
|
|
12293
|
-
}),
|
|
12294
|
-
[activeStep, handleValueChange, next, previous]
|
|
12295
|
-
);
|
|
12296
|
-
useImperativeHandle(apiRef, () => api, [api]);
|
|
12297
|
-
return /* @__PURE__ */ jsx(StepperContext.Provider, { value: { activeStep }, children: /* @__PURE__ */ jsx(
|
|
12298
|
-
Tabs$1.Root,
|
|
12299
|
-
{
|
|
12300
|
-
value: activeStep?.toString(),
|
|
12301
|
-
onValueChange: handleValueChange,
|
|
12302
|
-
className: cx(prefix("stepper"), className),
|
|
12303
|
-
activationMode,
|
|
12304
|
-
...otherProps,
|
|
12305
|
-
ref: forwardedRef,
|
|
12306
|
-
children: typeof children === "function" ? children(api) : children
|
|
12307
|
-
}
|
|
12308
|
-
) });
|
|
13101
|
+
);
|
|
13102
|
+
}
|
|
13103
|
+
return /* @__PURE__ */ jsx(Slot, { ...otherProps, ...commonProps, ref: forwardedRef, children });
|
|
12309
13104
|
});
|
|
13105
|
+
function StepperState({ children }) {
|
|
13106
|
+
const api = useStepperApi();
|
|
13107
|
+
return children?.(api);
|
|
13108
|
+
}
|
|
12310
13109
|
const TabsContext = createContext(null);
|
|
12311
13110
|
function useCreateTabsContext(variant, defaultValue, value, showAllTabsWhilePrinting) {
|
|
12312
13111
|
const store = useConstant(
|
|
@@ -12366,7 +13165,16 @@ function useTabLabel(value) {
|
|
|
12366
13165
|
const { store } = useTabsContext();
|
|
12367
13166
|
return useStore$1(store, (state) => state.actions.getTabLabel(value));
|
|
12368
13167
|
}
|
|
12369
|
-
const Tab = forwardRef(function Tab2({
|
|
13168
|
+
const Tab = forwardRef(function Tab2({
|
|
13169
|
+
value,
|
|
13170
|
+
status,
|
|
13171
|
+
tooltipProps,
|
|
13172
|
+
tabInnerProps,
|
|
13173
|
+
tabTextProps,
|
|
13174
|
+
className,
|
|
13175
|
+
children,
|
|
13176
|
+
...otherProps
|
|
13177
|
+
}, forwardedRef) {
|
|
12370
13178
|
const prefix = usePrefix();
|
|
12371
13179
|
const { variant, store } = useTabsContext();
|
|
12372
13180
|
const stringValue = value.toString();
|
|
@@ -12380,7 +13188,16 @@ const Tab = forwardRef(function Tab2({ value, status, tabInnerProps, className,
|
|
|
12380
13188
|
}
|
|
12381
13189
|
prevIsActiveRef.current = isActive;
|
|
12382
13190
|
}, [isActive]);
|
|
13191
|
+
const [tabTextOverflows, setTabTextOverflows] = useState(false);
|
|
13192
|
+
const tabTextRef = useRef(null);
|
|
13193
|
+
useEffect(() => {
|
|
13194
|
+
const el = tabTextRef.current;
|
|
13195
|
+
if (el) {
|
|
13196
|
+
setTabTextOverflows(el.scrollWidth > el.clientWidth);
|
|
13197
|
+
}
|
|
13198
|
+
}, [children]);
|
|
12383
13199
|
const combinedTabRef = useCombinedRef(tabRef, forwardedRef);
|
|
13200
|
+
const combinedTabTextRef = useCombinedRef(tabTextRef, tabTextProps?.ref);
|
|
12384
13201
|
return /* @__PURE__ */ jsxs(
|
|
12385
13202
|
Tabs$1.Trigger,
|
|
12386
13203
|
{
|
|
@@ -12397,23 +13214,39 @@ const Tab = forwardRef(function Tab2({ value, status, tabInnerProps, className,
|
|
|
12397
13214
|
ref: combinedTabRef,
|
|
12398
13215
|
children: [
|
|
12399
13216
|
/* @__PURE__ */ jsx(
|
|
12400
|
-
|
|
13217
|
+
Tooltip,
|
|
12401
13218
|
{
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
children
|
|
13219
|
+
side: "top",
|
|
13220
|
+
...tooltipProps,
|
|
13221
|
+
content: tabTextOverflows ? children : null,
|
|
13222
|
+
children: /* @__PURE__ */ jsx(
|
|
13223
|
+
"span",
|
|
13224
|
+
{
|
|
13225
|
+
"aria-describedby": void 0,
|
|
13226
|
+
...tabInnerProps,
|
|
13227
|
+
className: cx(prefix("tabs__tab-inner"), tabInnerProps?.className),
|
|
13228
|
+
children: /* @__PURE__ */ jsx(
|
|
13229
|
+
"span",
|
|
13230
|
+
{
|
|
13231
|
+
...tabTextProps,
|
|
13232
|
+
className: cx(prefix("tabs__tab-text"), tabTextProps?.className),
|
|
13233
|
+
ref: combinedTabTextRef,
|
|
13234
|
+
children
|
|
13235
|
+
}
|
|
13236
|
+
)
|
|
13237
|
+
}
|
|
13238
|
+
)
|
|
12405
13239
|
}
|
|
12406
13240
|
),
|
|
12407
13241
|
/* @__PURE__ */ jsx(
|
|
12408
13242
|
"span",
|
|
12409
13243
|
{
|
|
12410
|
-
...tabInnerProps,
|
|
12411
13244
|
className: cx(
|
|
12412
13245
|
prefix("tabs__tab-inner"),
|
|
12413
13246
|
prefix("tabs__tab-inner--hidden"),
|
|
12414
13247
|
tabInnerProps?.className
|
|
12415
13248
|
),
|
|
12416
|
-
children
|
|
13249
|
+
children: /* @__PURE__ */ jsx("span", { className: cx(prefix("tabs__tab-text"), tabTextProps?.className), children })
|
|
12417
13250
|
}
|
|
12418
13251
|
)
|
|
12419
13252
|
]
|
|
@@ -12676,62 +13509,6 @@ const TextArea = forwardRef(
|
|
|
12676
13509
|
return /* @__PURE__ */ jsx(Input$1, { asChild: true, ...props, children: /* @__PURE__ */ jsx("textarea", { rows, ref: forwardedRef }) });
|
|
12677
13510
|
}
|
|
12678
13511
|
);
|
|
12679
|
-
function useMediaQuery(query, options) {
|
|
12680
|
-
const matchMedia = options?.matchMedia ?? (typeof window !== "undefined" ? window.matchMedia : void 0);
|
|
12681
|
-
const getDefaultSnapshot = useCallback(
|
|
12682
|
-
() => options?.defaultMatches ?? false,
|
|
12683
|
-
[options?.defaultMatches]
|
|
12684
|
-
);
|
|
12685
|
-
const getServerSnapshot = useCallback(
|
|
12686
|
-
() => matchMedia?.(query).matches ?? getDefaultSnapshot(),
|
|
12687
|
-
[getDefaultSnapshot, matchMedia, query]
|
|
12688
|
-
);
|
|
12689
|
-
const { getSnapshot, subscribe } = useMemo(() => {
|
|
12690
|
-
if (!matchMedia) {
|
|
12691
|
-
return {
|
|
12692
|
-
getSnapshot: getDefaultSnapshot,
|
|
12693
|
-
subscribe: () => () => {
|
|
12694
|
-
}
|
|
12695
|
-
};
|
|
12696
|
-
}
|
|
12697
|
-
const queryList = matchMedia(query);
|
|
12698
|
-
return {
|
|
12699
|
-
getSnapshot: () => queryList.matches,
|
|
12700
|
-
subscribe: (notify) => {
|
|
12701
|
-
if (queryList.addEventListener) {
|
|
12702
|
-
queryList.addEventListener("change", notify);
|
|
12703
|
-
} else {
|
|
12704
|
-
queryList.addListener(notify);
|
|
12705
|
-
}
|
|
12706
|
-
return () => {
|
|
12707
|
-
if (queryList.removeEventListener) {
|
|
12708
|
-
queryList.removeEventListener("change", notify);
|
|
12709
|
-
} else {
|
|
12710
|
-
queryList.removeListener(notify);
|
|
12711
|
-
}
|
|
12712
|
-
};
|
|
12713
|
-
}
|
|
12714
|
-
};
|
|
12715
|
-
}, [getDefaultSnapshot, matchMedia, query]);
|
|
12716
|
-
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
12717
|
-
}
|
|
12718
|
-
const BREAKPOINTS = {
|
|
12719
|
-
xs: 0,
|
|
12720
|
-
sm: 576,
|
|
12721
|
-
md: 768,
|
|
12722
|
-
lg: 992,
|
|
12723
|
-
xl: 1200,
|
|
12724
|
-
xxl: 1400
|
|
12725
|
-
};
|
|
12726
|
-
function useMediaBreakpointUp(breakpoint, options) {
|
|
12727
|
-
return useMediaQuery(`(min-width:${BREAKPOINTS[breakpoint]}px)`, options);
|
|
12728
|
-
}
|
|
12729
|
-
function useMediaBreakpointDown(breakpoint, options) {
|
|
12730
|
-
return useMediaQuery(
|
|
12731
|
-
`(max-width:${BREAKPOINTS[breakpoint] - 0.02}px)`,
|
|
12732
|
-
options
|
|
12733
|
-
);
|
|
12734
|
-
}
|
|
12735
13512
|
function navigate(url, options) {
|
|
12736
13513
|
history[options?.replace ? "replaceState" : "pushState"](
|
|
12737
13514
|
options?.state,
|
|
@@ -12867,7 +13644,10 @@ function useSearchParams() {
|
|
|
12867
13644
|
[]
|
|
12868
13645
|
);
|
|
12869
13646
|
return useMemo(
|
|
12870
|
-
() =>
|
|
13647
|
+
() => ({
|
|
13648
|
+
searchParams: new URLSearchParams(locationSearch),
|
|
13649
|
+
setSearchParams
|
|
13650
|
+
}),
|
|
12871
13651
|
[locationSearch, setSearchParams]
|
|
12872
13652
|
);
|
|
12873
13653
|
}
|
|
@@ -12927,9 +13707,9 @@ export {
|
|
|
12927
13707
|
DataTableRowsPerPage,
|
|
12928
13708
|
DataTableSelectionTrigger,
|
|
12929
13709
|
DateInput,
|
|
12930
|
-
DatePicker,
|
|
12931
13710
|
DateRangeInput,
|
|
12932
|
-
|
|
13711
|
+
DescriptionList,
|
|
13712
|
+
DescriptionListItem,
|
|
12933
13713
|
Dialog,
|
|
12934
13714
|
DialogBody,
|
|
12935
13715
|
DialogClose,
|
|
@@ -13014,6 +13794,10 @@ export {
|
|
|
13014
13794
|
StepContent,
|
|
13015
13795
|
StepList,
|
|
13016
13796
|
Stepper,
|
|
13797
|
+
StepperFinishTrigger,
|
|
13798
|
+
StepperNextTrigger,
|
|
13799
|
+
StepperPreviousTrigger,
|
|
13800
|
+
StepperState,
|
|
13017
13801
|
Tab,
|
|
13018
13802
|
TabContent,
|
|
13019
13803
|
TabList,
|
|
@@ -13127,6 +13911,7 @@ export {
|
|
|
13127
13911
|
useSetFieldLabel,
|
|
13128
13912
|
useSpacing,
|
|
13129
13913
|
useStartPrintingTask,
|
|
13914
|
+
useStepperApi,
|
|
13130
13915
|
useTableNumberOfColumns,
|
|
13131
13916
|
useToastManager,
|
|
13132
13917
|
validateNumericTransformerOptions,
|