@atom-learning/components 9.0.0-beta.5 → 10.0.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/components/alert-dialog/AlertDialog.context.js +9 -6
- package/dist/components/alert-dialog/AlertDialog.context.js.map +1 -1
- package/dist/components/alert-dialog/alert-context/reducer.js +1 -5
- package/dist/components/alert-dialog/alert-context/reducer.js.map +1 -1
- package/dist/components/alert-dialog/alert-context/types.d.ts +1 -2
- package/dist/components/avatar/Avatar.js +5 -6
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/avatar/AvatarIcon.js +2 -2
- package/dist/components/avatar/AvatarIcon.js.map +1 -1
- package/dist/components/avatar/AvatarInitial.js +2 -2
- package/dist/components/avatar/AvatarInitial.js.map +1 -1
- package/dist/components/badge/Badge.context.js +12 -13
- package/dist/components/badge/Badge.context.js.map +1 -1
- package/dist/components/badge/Badge.js +4 -3
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/badge/BadgeText.js +3 -3
- package/dist/components/badge/BadgeText.js.map +1 -1
- package/dist/components/banner/Banner.context.js +13 -14
- package/dist/components/banner/Banner.context.js.map +1 -1
- package/dist/components/banner/banner-regular/BannerRegularActions.js +2 -8
- package/dist/components/banner/banner-regular/BannerRegularActions.js.map +1 -1
- package/dist/components/banner/banner-regular/BannerRegularButton.js +2 -2
- package/dist/components/banner/banner-regular/BannerRegularButton.js.map +1 -1
- package/dist/components/banner/banner-regular/BannerRegularDismiss.js +1 -1
- package/dist/components/banner/banner-regular/BannerRegularDismiss.js.map +1 -1
- package/dist/components/banner/banner-slim/BannerSlimButton.js +2 -2
- package/dist/components/banner/banner-slim/BannerSlimButton.js.map +1 -1
- package/dist/components/banner/banner-slim/BannerSlimContainer.js +4 -13
- package/dist/components/banner/banner-slim/BannerSlimContainer.js.map +1 -1
- package/dist/components/button/Button.js +5 -1
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/calendar/Calendar.d.ts +1 -1
- package/dist/components/calendar/Calendar.js +4 -2
- package/dist/components/calendar/Calendar.js.map +1 -1
- package/dist/components/carousel/Carousel.js +2 -2
- package/dist/components/carousel/Carousel.js.map +1 -1
- package/dist/components/carousel/CarouselSlide.js +1 -1
- package/dist/components/carousel/CarouselSlide.js.map +1 -1
- package/dist/components/carousel/CarouselSlider.js +1 -1
- package/dist/components/carousel/CarouselSlider.js.map +1 -1
- package/dist/components/checkbox/Checkbox.js +2 -2
- package/dist/components/checkbox/Checkbox.js.map +1 -1
- package/dist/components/checkbox-field/CheckboxField.js +7 -3
- package/dist/components/checkbox-field/CheckboxField.js.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroupAllItem.js +2 -2
- package/dist/components/checkbox-group/CheckboxGroupAllItem.js.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroupChecked.context.js +13 -14
- package/dist/components/checkbox-group/CheckboxGroupChecked.context.js.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroupItem.js +2 -2
- package/dist/components/checkbox-group/CheckboxGroupItem.js.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroupMounted.context.js +6 -7
- package/dist/components/checkbox-group/CheckboxGroupMounted.context.js.map +1 -1
- package/dist/components/chip/Chip.js +4 -5
- package/dist/components/chip/Chip.js.map +1 -1
- package/dist/components/create-password-field/CreatePasswordField.js +1 -1
- package/dist/components/create-password-field/CreatePasswordField.js.map +1 -1
- package/dist/components/data-table/DataTable.context.js +43 -26
- package/dist/components/data-table/DataTable.context.js.map +1 -1
- package/dist/components/data-table/DataTable.types.d.ts +1 -0
- package/dist/components/data-table/DataTable.types.js.map +1 -1
- package/dist/components/data-table/DataTableBulkActionsFloating.js +2 -6
- package/dist/components/data-table/DataTableBulkActionsFloating.js.map +1 -1
- package/dist/components/data-table/DataTableGlobalFilter.js +16 -8
- package/dist/components/data-table/DataTableGlobalFilter.js.map +1 -1
- package/dist/components/data-table/DataTableHead.js +5 -14
- package/dist/components/data-table/DataTableHead.js.map +1 -1
- package/dist/components/data-table/DataTableRowSelectionCheckbox.js +1 -0
- package/dist/components/data-table/DataTableRowSelectionCheckbox.js.map +1 -1
- package/dist/components/data-table/DataTableSelectAllRowsCheckbox.js +2 -1
- package/dist/components/data-table/DataTableSelectAllRowsCheckbox.js.map +1 -1
- package/dist/components/data-table/DataTableTable.js +8 -6
- package/dist/components/data-table/DataTableTable.js.map +1 -1
- package/dist/components/data-table/drag-and-drop/DragAndDropTable.js +1 -1
- package/dist/components/data-table/drag-and-drop/DragAndDropTable.js.map +1 -1
- package/dist/components/data-table/pagination/Pagination.js +3 -2
- package/dist/components/data-table/pagination/Pagination.js.map +1 -1
- package/dist/components/data-table/usePagination.d.ts +1 -0
- package/dist/components/data-table/usePagination.js +7 -2
- package/dist/components/data-table/usePagination.js.map +1 -1
- package/dist/components/date-input/DateInput.js +4 -3
- package/dist/components/date-input/DateInput.js.map +1 -1
- package/dist/components/dialog/DialogContent.js +19 -6
- package/dist/components/dialog/DialogContent.js.map +1 -1
- package/dist/components/dismissible/DismissibleRoot.js +15 -16
- package/dist/components/dismissible/DismissibleRoot.js.map +1 -1
- package/dist/components/dismissible/DismissibleTrigger.js +1 -1
- package/dist/components/dismissible/DismissibleTrigger.js.map +1 -1
- package/dist/components/dismissible-group/DismissibleGroupItem.js +1 -1
- package/dist/components/dismissible-group/DismissibleGroupItem.js.map +1 -1
- package/dist/components/dismissible-group/DismissibleGroupRoot.js +5 -6
- package/dist/components/dismissible-group/DismissibleGroupRoot.js.map +1 -1
- package/dist/components/drawer/Drawer.context.js +2 -3
- package/dist/components/drawer/Drawer.context.js.map +1 -1
- package/dist/components/drawer/DrawerContent.js +1 -1
- package/dist/components/drawer/DrawerContent.js.map +1 -1
- package/dist/components/empty-state/EmptyState.context.js +2 -3
- package/dist/components/empty-state/EmptyState.context.js.map +1 -1
- package/dist/components/empty-state/EmptyStateBody.js +1 -1
- package/dist/components/empty-state/EmptyStateBody.js.map +1 -1
- package/dist/components/empty-state/EmptyStateImage.js +1 -1
- package/dist/components/empty-state/EmptyStateImage.js.map +1 -1
- package/dist/components/empty-state/EmptyStateTitle.js +1 -1
- package/dist/components/empty-state/EmptyStateTitle.js.map +1 -1
- package/dist/components/file-drop/FileDrop.js +3 -3
- package/dist/components/file-drop/FileDrop.js.map +1 -1
- package/dist/components/file-drop/useFileDrop.js +1 -1
- package/dist/components/file-drop/useFileDrop.js.map +1 -1
- package/dist/components/form/Form.js +7 -6
- package/dist/components/form/Form.js.map +1 -1
- package/dist/components/form/useFormCustomContext.js +1 -1
- package/dist/components/form/useFormCustomContext.js.map +1 -1
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +1 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/input/Input.js +2 -2
- package/dist/components/input/Input.js.map +1 -1
- package/dist/components/keyboard-shortcut/KeyboardShortcut.js +10 -7
- package/dist/components/keyboard-shortcut/KeyboardShortcut.js.map +1 -1
- package/dist/components/markdown-content/MarkdownContent.d.ts +1 -1
- package/dist/components/markdown-content/MarkdownContent.js +4 -4
- package/dist/components/markdown-content/MarkdownContent.js.map +1 -1
- package/dist/components/navigation/NavigationMenu.context.js +1 -1
- package/dist/components/navigation/NavigationMenu.context.js.map +1 -1
- package/dist/components/navigation/NavigationMenu.js +7 -6
- package/dist/components/navigation/NavigationMenu.js.map +1 -1
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordion.d.ts +2 -2
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordion.js +3 -3
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordion.js.map +1 -1
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordionContent.js +1 -1
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordionContent.js.map +1 -1
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordionTrigger.js +1 -1
- package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordionTrigger.js.map +1 -1
- package/dist/components/number-input/NumberInput.js +15 -16
- package/dist/components/number-input/NumberInput.js.map +1 -1
- package/dist/components/number-input-field/NumberInputField.js +7 -3
- package/dist/components/number-input-field/NumberInputField.js.map +1 -1
- package/dist/components/pagination/Pagination.context.js +29 -22
- package/dist/components/pagination/Pagination.context.js.map +1 -1
- package/dist/components/pagination/usePagination.js +1 -1
- package/dist/components/pagination/usePagination.js.map +1 -1
- package/dist/components/password-input/PasswordInput.js +1 -2
- package/dist/components/password-input/PasswordInput.js.map +1 -1
- package/dist/components/radio-button-field/RadioButtonField.js +7 -3
- package/dist/components/radio-button-field/RadioButtonField.js.map +1 -1
- package/dist/components/search-input/SearchInput.js +7 -11
- package/dist/components/search-input/SearchInput.js.map +1 -1
- package/dist/components/section-message/SectionMessage.context.js +15 -16
- package/dist/components/section-message/SectionMessage.context.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlBadge.js +1 -1
- package/dist/components/segmented-control/SegmentedControlBadge.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlDescription.js +1 -1
- package/dist/components/segmented-control/SegmentedControlDescription.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlHeading.js +1 -1
- package/dist/components/segmented-control/SegmentedControlHeading.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlIcon.js +1 -1
- package/dist/components/segmented-control/SegmentedControlIcon.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlItem.js +1 -1
- package/dist/components/segmented-control/SegmentedControlItem.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlItemList.js +20 -14
- package/dist/components/segmented-control/SegmentedControlItemList.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControlRoot.js +18 -19
- package/dist/components/segmented-control/SegmentedControlRoot.js.map +1 -1
- package/dist/components/select-menu/SelectMenu.context.js +1 -1
- package/dist/components/select-menu/SelectMenu.context.js.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +18 -12
- package/dist/components/select-menu/SelectMenu.js.map +1 -1
- package/dist/components/side-bar/SideBar.context.js +1 -1
- package/dist/components/side-bar/SideBar.context.js.map +1 -1
- package/dist/components/side-bar/SideBar.js +2 -2
- package/dist/components/side-bar/SideBar.js.map +1 -1
- package/dist/components/skeleton-loader/SkeletonCard.js.map +1 -1
- package/dist/components/slider-field/SliderField.js +8 -3
- package/dist/components/slider-field/SliderField.js.map +1 -1
- package/dist/components/sortable/SortableRoot.js +5 -3
- package/dist/components/sortable/SortableRoot.js.map +1 -1
- package/dist/components/stepper/Stepper.context.js +38 -30
- package/dist/components/stepper/Stepper.context.js.map +1 -1
- package/dist/components/toast/Toast.context.js +1 -1
- package/dist/components/toast/Toast.context.js.map +1 -1
- package/dist/components/toast/ToastProvider.js +3 -3
- package/dist/components/toast/ToastProvider.js.map +1 -1
- package/dist/components/top-bar/TopBar.js +4 -4
- package/dist/components/top-bar/TopBar.js.map +1 -1
- package/dist/components/tree/TreeCollapsible.d.ts +2 -2
- package/dist/components/tree/TreeCollapsible.js +3 -3
- package/dist/components/tree/TreeCollapsible.js.map +1 -1
- package/dist/components/tree/TreeCollapsibleContent.js +1 -1
- package/dist/components/tree/TreeCollapsibleContent.js.map +1 -1
- package/dist/components/tree/TreeCollapsibleTrigger.js +1 -1
- package/dist/components/tree/TreeCollapsibleTrigger.js.map +1 -1
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +553 -595
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -4
- package/dist/styled.js +5 -1
- package/dist/styled.js.map +1 -1
- package/dist/utilities/hooks/useCallbackRef.d.ts +3 -3
- package/dist/utilities/hooks/useCallbackRef.js +4 -1
- package/dist/utilities/hooks/useCallbackRef.js.map +1 -1
- package/dist/utilities/hooks/useResizeObserver.js +13 -3
- package/dist/utilities/hooks/useResizeObserver.js.map +1 -1
- package/dist/utilities/hooks/useScrollPosition.js +22 -17
- package/dist/utilities/hooks/useScrollPosition.js.map +1 -1
- package/dist/utilities/hooks/useWindowScrollPosition.js +19 -15
- package/dist/utilities/hooks/useWindowScrollPosition.js.map +1 -1
- package/dist/utilities/uri/index.js +1 -6
- package/dist/utilities/uri/index.js.map +1 -1
- package/package.json +31 -31
- package/src/index.css +2 -0
- package/src/responsive-variant-classes.css +1 -1
- package/src/utilities.css +6 -0
- package/dist/components/box/Box.d.ts +0 -1
- package/dist/components/box/Box.js +0 -8
- package/dist/components/box/Box.js.map +0 -1
- package/dist/components/flex/Flex.d.ts +0 -7
- package/dist/components/flex/Flex.js +0 -88
- package/dist/components/flex/Flex.js.map +0 -1
- package/dist/components/grid/Grid.d.ts +0 -13
- package/dist/components/grid/Grid.js +0 -35
- package/dist/components/grid/Grid.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -32,6 +32,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
//#endregion
|
|
33
33
|
let react = require("react");
|
|
34
34
|
react = __toESM(react, 1);
|
|
35
|
+
let _radix_ui_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
35
36
|
let clsx = require("clsx");
|
|
36
37
|
clsx = __toESM(clsx, 1);
|
|
37
38
|
let tailwind_merge = require("tailwind-merge");
|
|
@@ -39,7 +40,6 @@ let tailwind_variants = require("tailwind-variants");
|
|
|
39
40
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
40
41
|
let _radix_ui_react_alert_dialog = require("@radix-ui/react-alert-dialog");
|
|
41
42
|
let _atom_learning_icons = require("@atom-learning/icons");
|
|
42
|
-
let uid = require("uid");
|
|
43
43
|
let _radix_ui_react_accordion = require("@radix-ui/react-accordion");
|
|
44
44
|
let _radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
45
45
|
let invariant = require("invariant");
|
|
@@ -59,7 +59,6 @@ dlv = __toESM(dlv, 1);
|
|
|
59
59
|
let _radix_ui_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
60
60
|
_radix_ui_react_toggle_group = __toESM(_radix_ui_react_toggle_group, 1);
|
|
61
61
|
let _reach_combobox = require("@reach/combobox");
|
|
62
|
-
let _lukeed_uuid = require("@lukeed/uuid");
|
|
63
62
|
let _tanstack_react_table = require("@tanstack/react-table");
|
|
64
63
|
let use_deep_compare_effect = require("use-deep-compare-effect");
|
|
65
64
|
let react_aria = require("react-aria");
|
|
@@ -212,7 +211,10 @@ function styled(el, styles, options) {
|
|
|
212
211
|
as: props.as || element.props.as,
|
|
213
212
|
className: finalClassName
|
|
214
213
|
};
|
|
215
|
-
if (ref)
|
|
214
|
+
if (ref) {
|
|
215
|
+
const existingRef = element.props.ref;
|
|
216
|
+
cloneProps.ref = existingRef ? (0, _radix_ui_react_compose_refs.composeRefs)(existingRef, ref) : ref;
|
|
217
|
+
}
|
|
216
218
|
return react.default.cloneElement(element, cloneProps);
|
|
217
219
|
}
|
|
218
220
|
throw Error("Something is wrong");
|
|
@@ -224,12 +226,7 @@ function styled(el, styles, options) {
|
|
|
224
226
|
}
|
|
225
227
|
//#endregion
|
|
226
228
|
//#region src/utilities/uri/index.ts
|
|
227
|
-
var isExternalUrl = (url) =>
|
|
228
|
-
if (!url) return false;
|
|
229
|
-
const isAbsoluteUrl = /^https?:\/\//.test(url);
|
|
230
|
-
if (typeof window === "undefined") return isAbsoluteUrl;
|
|
231
|
-
return isAbsoluteUrl && new URL(url).origin !== window.location.origin;
|
|
232
|
-
};
|
|
229
|
+
var isExternalUrl = (url) => !!url && /^https?:\/\//.test(url);
|
|
233
230
|
var getExternalAnchorProps = (url) => isExternalUrl(url) ? {
|
|
234
231
|
target: "_blank",
|
|
235
232
|
rel: "noopener noreferrer"
|
|
@@ -380,7 +377,11 @@ var StyledButton = styled("button", {
|
|
|
380
377
|
"[&_svg]:size-[22px]"
|
|
381
378
|
]
|
|
382
379
|
},
|
|
383
|
-
isLoading: { true: [
|
|
380
|
+
isLoading: { true: [
|
|
381
|
+
"cursor-not-allowed",
|
|
382
|
+
"opacity-60",
|
|
383
|
+
"pointer-events-none"
|
|
384
|
+
] },
|
|
384
385
|
fullWidth: {
|
|
385
386
|
true: ["w-full"],
|
|
386
387
|
false: ["w-max"]
|
|
@@ -701,25 +702,25 @@ var Alert$1 = ({ title, size, theme, description, onAction, cancelActionText, co
|
|
|
701
702
|
var initialState = [];
|
|
702
703
|
var reducer = (state, action) => {
|
|
703
704
|
switch (action.type) {
|
|
704
|
-
case "ADD": return [...state,
|
|
705
|
-
...action.payload,
|
|
706
|
-
id: (0, uid.uid)()
|
|
707
|
-
}];
|
|
705
|
+
case "ADD": return [...state, action.payload];
|
|
708
706
|
case "REMOVE": return state.filter(({ id }) => id !== action.payload);
|
|
709
707
|
default: return state;
|
|
710
708
|
}
|
|
711
709
|
};
|
|
712
710
|
//#endregion
|
|
713
711
|
//#region src/components/alert-dialog/AlertDialog.context.tsx
|
|
714
|
-
var AlertContext = react.createContext(
|
|
712
|
+
var AlertContext = react.createContext(void 0);
|
|
715
713
|
var AlertProvider = ({ children }) => {
|
|
716
714
|
const [alerts, dispatch] = react.useReducer(reducer, initialState);
|
|
717
715
|
const isMountedRef = useIsMountedRef();
|
|
718
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AlertContext
|
|
719
|
-
value: { showAlert: (content) => dispatch({
|
|
720
|
-
payload:
|
|
716
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AlertContext, {
|
|
717
|
+
value: react.useMemo(() => ({ showAlert: (content) => dispatch({
|
|
718
|
+
payload: {
|
|
719
|
+
...content,
|
|
720
|
+
id: crypto.randomUUID()
|
|
721
|
+
},
|
|
721
722
|
type: "ADD"
|
|
722
|
-
}) },
|
|
723
|
+
}) }), []),
|
|
723
724
|
children: [Boolean(alerts.length) && /* @__PURE__ */ (0, react.createElement)(Alert$1, {
|
|
724
725
|
...alerts[0],
|
|
725
726
|
key: alerts[0].id,
|
|
@@ -733,7 +734,7 @@ var AlertProvider = ({ children }) => {
|
|
|
733
734
|
});
|
|
734
735
|
};
|
|
735
736
|
var useAlert = () => {
|
|
736
|
-
const context = react.
|
|
737
|
+
const context = react.use(AlertContext);
|
|
737
738
|
if (context === void 0) throw new Error("useAlert must be used within a AlertProvider");
|
|
738
739
|
return context;
|
|
739
740
|
};
|
|
@@ -1168,9 +1169,9 @@ var toIconSize$3 = {
|
|
|
1168
1169
|
xxl: "lg"
|
|
1169
1170
|
};
|
|
1170
1171
|
var AvatarIcon = ({ is }) => {
|
|
1171
|
-
const { size } = react.
|
|
1172
|
+
const { size } = react.use(AvatarRootContext);
|
|
1172
1173
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
1173
|
-
size:
|
|
1174
|
+
size: overrideStyledVariantValue(size, (s) => toIconSize$3[s]),
|
|
1174
1175
|
is
|
|
1175
1176
|
});
|
|
1176
1177
|
};
|
|
@@ -1344,8 +1345,8 @@ var toTextSize$2 = {
|
|
|
1344
1345
|
xxl: "lg"
|
|
1345
1346
|
};
|
|
1346
1347
|
var AvatarInitial = () => {
|
|
1347
|
-
const { name, size } = react.
|
|
1348
|
-
const textSize =
|
|
1348
|
+
const { name, size } = react.use(AvatarRootContext);
|
|
1349
|
+
const textSize = overrideStyledVariantValue(size, (s) => toTextSize$2[s]);
|
|
1349
1350
|
if (!name) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AvatarPlaceholder, {});
|
|
1350
1351
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
|
|
1351
1352
|
size: textSize,
|
|
@@ -1426,12 +1427,11 @@ var StyledButton$4 = /* @__PURE__ */ styled("button", {
|
|
|
1426
1427
|
}
|
|
1427
1428
|
});
|
|
1428
1429
|
var AvatarRootProvider = ({ children, name, size }) => {
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
value,
|
|
1430
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AvatarRootContext, {
|
|
1431
|
+
value: react.useMemo(() => ({
|
|
1432
|
+
name,
|
|
1433
|
+
size
|
|
1434
|
+
}), [name, size]),
|
|
1435
1435
|
children
|
|
1436
1436
|
});
|
|
1437
1437
|
};
|
|
@@ -1490,7 +1490,10 @@ AvatarRoot.displayName = "Avatar";
|
|
|
1490
1490
|
var useCallbackRef = () => {
|
|
1491
1491
|
const elRef = react.useRef(null);
|
|
1492
1492
|
return [elRef, react.useCallback((el) => {
|
|
1493
|
-
|
|
1493
|
+
elRef.current = el;
|
|
1494
|
+
return () => {
|
|
1495
|
+
elRef.current = null;
|
|
1496
|
+
};
|
|
1494
1497
|
}, [])];
|
|
1495
1498
|
};
|
|
1496
1499
|
var useCallbackRefState = () => {
|
|
@@ -1604,19 +1607,18 @@ var colorSchemes$3 = {
|
|
|
1604
1607
|
var BadgeContext = react.createContext({});
|
|
1605
1608
|
var BadgeProvider = ({ size, overflow, children }) => {
|
|
1606
1609
|
const [isOverflowing, setIsOverflowing] = react.useState(false);
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
value,
|
|
1610
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BadgeContext, {
|
|
1611
|
+
value: react.useMemo(() => ({
|
|
1612
|
+
size,
|
|
1613
|
+
overflow,
|
|
1614
|
+
isOverflowing,
|
|
1615
|
+
setIsOverflowing
|
|
1616
|
+
}), [
|
|
1617
|
+
size,
|
|
1618
|
+
overflow,
|
|
1619
|
+
isOverflowing,
|
|
1620
|
+
setIsOverflowing
|
|
1621
|
+
]),
|
|
1620
1622
|
children
|
|
1621
1623
|
});
|
|
1622
1624
|
};
|
|
@@ -1640,13 +1642,23 @@ var useResizeObserver = ({ delay = 500, elements, onResize }) => {
|
|
|
1640
1642
|
react.useLayoutEffect(() => {
|
|
1641
1643
|
onResizeRef.current = onResize;
|
|
1642
1644
|
});
|
|
1643
|
-
const observer = react.
|
|
1645
|
+
const [observer, setObserver] = react.useState(null);
|
|
1646
|
+
react.useEffect(() => {
|
|
1647
|
+
const debouncedOnResize = (0, throttle_debounce.debounce)(delay, (entries) => onResizeRef.current(entries));
|
|
1648
|
+
const resizeObserver = createResizeObserver(debouncedOnResize);
|
|
1649
|
+
setObserver(resizeObserver);
|
|
1650
|
+
return () => {
|
|
1651
|
+
debouncedOnResize.cancel();
|
|
1652
|
+
resizeObserver?.disconnect();
|
|
1653
|
+
};
|
|
1654
|
+
}, [delay]);
|
|
1644
1655
|
react.useEffect(() => {
|
|
1656
|
+
if (!observer) return;
|
|
1645
1657
|
elements.forEach((element) => {
|
|
1646
|
-
if (element) observer
|
|
1658
|
+
if (element) observer.observe(element);
|
|
1647
1659
|
});
|
|
1648
1660
|
return () => {
|
|
1649
|
-
elements.forEach((element) => element && observer
|
|
1661
|
+
elements.forEach((element) => element && observer.unobserve(element));
|
|
1650
1662
|
};
|
|
1651
1663
|
}, [observer, elements]);
|
|
1652
1664
|
return observer;
|
|
@@ -1654,7 +1666,7 @@ var useResizeObserver = ({ delay = 500, elements, onResize }) => {
|
|
|
1654
1666
|
//#endregion
|
|
1655
1667
|
//#region src/components/badge/BadgeText.tsx
|
|
1656
1668
|
var ObserveBadgeTextOverflow = ({ elRef }) => {
|
|
1657
|
-
const { setIsOverflowing } = react.
|
|
1669
|
+
const { setIsOverflowing } = react.use(BadgeContext);
|
|
1658
1670
|
useResizeObserver({
|
|
1659
1671
|
delay: 0,
|
|
1660
1672
|
elements: [elRef],
|
|
@@ -1682,8 +1694,8 @@ var toTextSize$1 = {
|
|
|
1682
1694
|
md: "md"
|
|
1683
1695
|
};
|
|
1684
1696
|
var BadgeText = ({ children, ...rest }) => {
|
|
1685
|
-
const { size: badgeSize, overflow } = react.
|
|
1686
|
-
const size =
|
|
1697
|
+
const { size: badgeSize, overflow } = react.use(BadgeContext);
|
|
1698
|
+
const size = overrideStyledVariantValue(badgeSize, (s) => toTextSize$1[s]);
|
|
1687
1699
|
const [elRef, setElRef] = useCallbackRefState();
|
|
1688
1700
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [overflow === "ellipsis" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ObserveBadgeTextOverflow, { elRef }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledBadgeText, {
|
|
1689
1701
|
size,
|
|
@@ -1755,9 +1767,9 @@ var StyledBadge$1 = styled("div", {
|
|
|
1755
1767
|
]
|
|
1756
1768
|
}, { enableResponsiveVariants: true });
|
|
1757
1769
|
var BadgeInner = ({ ref, theme = "info", emphasis = "subtle", children, style, ...rest }) => {
|
|
1758
|
-
const { size, overflow, isOverflowing } = react.
|
|
1770
|
+
const { size, overflow, isOverflowing } = react.use(BadgeContext);
|
|
1759
1771
|
const [badgeElRef, setBadgeElRef] = useCallbackRefState();
|
|
1760
|
-
|
|
1772
|
+
const composedBadgeRef = (0, _radix_ui_react_compose_refs.useComposedRefs)(ref, setBadgeElRef);
|
|
1761
1773
|
const label = badgeElRef?.textContent;
|
|
1762
1774
|
const isInfoOnly = badgeSemanticNames.includes(theme);
|
|
1763
1775
|
const isClickable = Object.keys(rest).includes("onClick") || Object.keys(rest).includes("href");
|
|
@@ -1773,7 +1785,7 @@ var BadgeInner = ({ ref, theme = "info", emphasis = "subtle", children, style, .
|
|
|
1773
1785
|
...style
|
|
1774
1786
|
},
|
|
1775
1787
|
...rest,
|
|
1776
|
-
ref:
|
|
1788
|
+
ref: composedBadgeRef,
|
|
1777
1789
|
isClickable: isClickable && !isInfoOnly,
|
|
1778
1790
|
children: react.Children.map(children, (child) => {
|
|
1779
1791
|
if (typeof child === "string" || typeof child === "number") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BadgeText, { children: child });
|
|
@@ -1807,27 +1819,26 @@ var DismissibleRootContext = react.createContext({
|
|
|
1807
1819
|
});
|
|
1808
1820
|
var DismissibleRootProvider = ({ dismissed: controlledIsDismissed, children, disabled, onDismiss = () => null }) => {
|
|
1809
1821
|
const [isDismissed, setIsDismissed] = react.useState(false);
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1822
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DismissibleRootContext, {
|
|
1823
|
+
value: react.useMemo(() => {
|
|
1824
|
+
const isControlled = typeof controlledIsDismissed === "boolean";
|
|
1825
|
+
return {
|
|
1826
|
+
disabled,
|
|
1827
|
+
isDismissed: isControlled ? controlledIsDismissed : isDismissed,
|
|
1828
|
+
setIsDismissed: isControlled ? () => null : setIsDismissed,
|
|
1829
|
+
onDismiss
|
|
1830
|
+
};
|
|
1831
|
+
}, [
|
|
1813
1832
|
disabled,
|
|
1814
|
-
isDismissed
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
}, [
|
|
1819
|
-
disabled,
|
|
1820
|
-
isDismissed,
|
|
1821
|
-
onDismiss,
|
|
1822
|
-
controlledIsDismissed
|
|
1823
|
-
]);
|
|
1824
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DismissibleRootContext.Provider, {
|
|
1825
|
-
value,
|
|
1833
|
+
isDismissed,
|
|
1834
|
+
onDismiss,
|
|
1835
|
+
controlledIsDismissed
|
|
1836
|
+
]),
|
|
1826
1837
|
children
|
|
1827
1838
|
});
|
|
1828
1839
|
};
|
|
1829
1840
|
var DismissibleRootInternal = ({ asChild = false, ...rest }) => {
|
|
1830
|
-
const { isDismissed, disabled } = react.
|
|
1841
|
+
const { isDismissed, disabled } = react.use(DismissibleRootContext);
|
|
1831
1842
|
if (isDismissed) return null;
|
|
1832
1843
|
const props = {
|
|
1833
1844
|
...disabled && { [`data-disabled`]: "" },
|
|
@@ -1850,7 +1861,7 @@ var DefaultTrigger = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("butt
|
|
|
1850
1861
|
children: "Dismiss"
|
|
1851
1862
|
});
|
|
1852
1863
|
var DismissibleTrigger = ({ asChild = false, ...rest }) => {
|
|
1853
|
-
const context = react.
|
|
1864
|
+
const context = react.use(DismissibleRootContext);
|
|
1854
1865
|
if (context === void 0) throw new Error("Dismissible.Trigger can only be used within a Dismissible.Item");
|
|
1855
1866
|
const { setIsDismissed, disabled, onDismiss } = context;
|
|
1856
1867
|
const handleDismiss = () => {
|
|
@@ -1879,7 +1890,7 @@ var BannerContext = react.createContext({
|
|
|
1879
1890
|
setHasDismiss: () => null
|
|
1880
1891
|
});
|
|
1881
1892
|
var useBannerContext = () => {
|
|
1882
|
-
const context = react.
|
|
1893
|
+
const context = react.use(BannerContext);
|
|
1883
1894
|
if (context === void 0) throw new Error("useBannerContext must be used within a BannerProvider");
|
|
1884
1895
|
return context;
|
|
1885
1896
|
};
|
|
@@ -1888,19 +1899,18 @@ var BannerProvider = ({ emphasis = "minimal", size = {
|
|
|
1888
1899
|
"@md": "md"
|
|
1889
1900
|
}, children }) => {
|
|
1890
1901
|
const [hasDismiss, setHasDismiss] = react.useState(false);
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
value,
|
|
1902
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerContext, {
|
|
1903
|
+
value: react.useMemo(() => ({
|
|
1904
|
+
emphasis,
|
|
1905
|
+
size,
|
|
1906
|
+
hasDismiss,
|
|
1907
|
+
setHasDismiss
|
|
1908
|
+
}), [
|
|
1909
|
+
emphasis,
|
|
1910
|
+
size,
|
|
1911
|
+
hasDismiss,
|
|
1912
|
+
setHasDismiss
|
|
1913
|
+
]),
|
|
1904
1914
|
children
|
|
1905
1915
|
});
|
|
1906
1916
|
};
|
|
@@ -1914,7 +1924,7 @@ var BannerRegularButton = (props) => {
|
|
|
1914
1924
|
const { emphasis, size } = useBannerContext();
|
|
1915
1925
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
1916
1926
|
size,
|
|
1917
|
-
fullWidth:
|
|
1927
|
+
fullWidth: overrideStyledVariantValue(size, (s) => s === "sm"),
|
|
1918
1928
|
theme: emphasis === "bold" ? "neutral" : "primary",
|
|
1919
1929
|
...props
|
|
1920
1930
|
});
|
|
@@ -1933,14 +1943,8 @@ var toDirection$1 = {
|
|
|
1933
1943
|
};
|
|
1934
1944
|
var BannerRegularActions = ({ children, className, ...rest }) => {
|
|
1935
1945
|
const { size } = useBannerContext();
|
|
1936
|
-
const gap =
|
|
1937
|
-
|
|
1938
|
-
return "gap-2 md:gap-4";
|
|
1939
|
-
}, [size]);
|
|
1940
|
-
const direction = react.useMemo(() => {
|
|
1941
|
-
if (typeof size === "string") return toDirection$1[size];
|
|
1942
|
-
return "flex-col md:flex-row";
|
|
1943
|
-
}, [size]);
|
|
1946
|
+
const gap = typeof size === "string" ? toGap[size] : "gap-2 md:gap-4";
|
|
1947
|
+
const direction = typeof size === "string" ? toDirection$1[size] : "flex-col md:flex-row";
|
|
1944
1948
|
(0, invariant.default)(react.Children.count(children) <= MAX_ALLOWED_CHILDREN, `A maximum of ${MAX_ALLOWED_CHILDREN} ${BannerRegularButton.displayName} component(s) are permitted as children of ${BannerRegularActions.displayName}`);
|
|
1945
1949
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1946
1950
|
className: cn("flex", gap, direction, className),
|
|
@@ -2042,7 +2046,7 @@ var BannerRegularDismiss = ({ label = "dismiss", ...rest }) => {
|
|
|
2042
2046
|
setHasDismiss(false);
|
|
2043
2047
|
};
|
|
2044
2048
|
}, [setHasDismiss]);
|
|
2045
|
-
const actionIconSize =
|
|
2049
|
+
const actionIconSize = overrideStyledVariantValue(size, (s) => toActionIconSize[s]);
|
|
2046
2050
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Banner.Dismiss, {
|
|
2047
2051
|
asChild: true,
|
|
2048
2052
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledDismiss$1, {
|
|
@@ -2184,7 +2188,7 @@ var BannerSlimButton = (({ className, ...rest }) => {
|
|
|
2184
2188
|
const { emphasis, size } = useBannerContext();
|
|
2185
2189
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
2186
2190
|
size: "md",
|
|
2187
|
-
fullWidth:
|
|
2191
|
+
fullWidth: overrideStyledVariantValue(size, (s) => s === "sm"),
|
|
2188
2192
|
theme: emphasis === "bold" ? "neutral" : "primary",
|
|
2189
2193
|
...rest,
|
|
2190
2194
|
className: cn("ml-auto", className)
|
|
@@ -2214,18 +2218,9 @@ var StyledBannerSlimContainer = styled(BannerContainer, {
|
|
|
2214
2218
|
}, { enableResponsiveVariants: true });
|
|
2215
2219
|
var BannerSlimContainer = ({ className, ...rest }) => {
|
|
2216
2220
|
const { size } = useBannerContext();
|
|
2217
|
-
const direction =
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
}, [size]);
|
|
2221
|
-
const align = react.useMemo(() => {
|
|
2222
|
-
if (typeof size === "string") return toAlign[size];
|
|
2223
|
-
return "items-start md:items-center";
|
|
2224
|
-
}, [size]);
|
|
2225
|
-
const wrap = react.useMemo(() => {
|
|
2226
|
-
if (typeof size === "string") return toWrap[size];
|
|
2227
|
-
return "flex-wrap md:flex-nowrap";
|
|
2228
|
-
}, [size]);
|
|
2221
|
+
const direction = typeof size === "string" ? toDirection[size] : "flex-col md:flex-row";
|
|
2222
|
+
const align = typeof size === "string" ? toAlign[size] : "items-start md:items-center";
|
|
2223
|
+
const wrap = typeof size === "string" ? toWrap[size] : "flex-wrap md:flex-nowrap";
|
|
2229
2224
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledBannerSlimContainer, {
|
|
2230
2225
|
...rest,
|
|
2231
2226
|
sizeWorkaround: size,
|
|
@@ -2359,10 +2354,6 @@ var BannerSlim = /* @__PURE__ */ Object.assign(BannerSlimComponent, {
|
|
|
2359
2354
|
});
|
|
2360
2355
|
BannerSlimComponent.displayName = "BannerSlim";
|
|
2361
2356
|
//#endregion
|
|
2362
|
-
//#region src/components/box/Box.tsx
|
|
2363
|
-
var Box = styled("div", { base: [] });
|
|
2364
|
-
Box.displayName = "Box";
|
|
2365
|
-
//#endregion
|
|
2366
2357
|
//#region src/components/carousel/CarouselArrows.tsx
|
|
2367
2358
|
var ArrowButton = /* @__PURE__ */ styled("button", { base: [
|
|
2368
2359
|
"items-center",
|
|
@@ -2456,7 +2447,7 @@ var CarouselSlider = ({ children, className, gap = 3, overflow, tabIndex = 0, ..
|
|
|
2456
2447
|
...rest,
|
|
2457
2448
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2458
2449
|
className: "flex",
|
|
2459
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CarouselSlideGapContext
|
|
2450
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CarouselSlideGapContext, {
|
|
2460
2451
|
value: gap,
|
|
2461
2452
|
children
|
|
2462
2453
|
})
|
|
@@ -2467,7 +2458,7 @@ var CarouselSlider = ({ children, className, gap = 3, overflow, tabIndex = 0, ..
|
|
|
2467
2458
|
//#region src/components/carousel/CarouselSlide.tsx
|
|
2468
2459
|
var CarouselSlide = ({ children, className, index, ...rest }) => {
|
|
2469
2460
|
const { selectedIndex } = useCarousel();
|
|
2470
|
-
const gap = react.
|
|
2461
|
+
const gap = react.use(CarouselSlideGapContext);
|
|
2471
2462
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2472
2463
|
role: "option",
|
|
2473
2464
|
"aria-selected": selectedIndex === index,
|
|
@@ -2551,14 +2542,14 @@ var CarouselComponent = ({ children, currentSlide = 0, className, ...rest }) =>
|
|
|
2551
2542
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2552
2543
|
className: cn("relative", "w-full", className),
|
|
2553
2544
|
...rest,
|
|
2554
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CarouselContext
|
|
2545
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CarouselContext, {
|
|
2555
2546
|
value: contextValue,
|
|
2556
2547
|
children
|
|
2557
2548
|
})
|
|
2558
2549
|
});
|
|
2559
2550
|
};
|
|
2560
2551
|
var useCarousel = () => {
|
|
2561
|
-
const context = react.
|
|
2552
|
+
const context = react.use(CarouselContext);
|
|
2562
2553
|
if (!context) throw new Error("useCarousel must be used within a Carousel");
|
|
2563
2554
|
return {
|
|
2564
2555
|
...context,
|
|
@@ -2632,7 +2623,7 @@ var toIconSize$2 = {
|
|
|
2632
2623
|
lg: "sm"
|
|
2633
2624
|
};
|
|
2634
2625
|
var Checkbox = ({ ref, size = "md", checked, ...rest }) => {
|
|
2635
|
-
const iconSize =
|
|
2626
|
+
const iconSize = overrideStyledVariantValue(size, (s) => toIconSize$2[s]);
|
|
2636
2627
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2637
2628
|
className: "relative z-1",
|
|
2638
2629
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledCheckbox, {
|
|
@@ -2679,20 +2670,19 @@ var CheckboxGroupCheckedProvider = ({ checked: controlledChecked, defaultChecked
|
|
|
2679
2670
|
return newChecked;
|
|
2680
2671
|
});
|
|
2681
2672
|
}, [onCheckedChange]);
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
value,
|
|
2673
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckboxGroupCheckedContext, {
|
|
2674
|
+
value: react.useMemo(() => {
|
|
2675
|
+
const isControlled = Array.isArray(controlledChecked);
|
|
2676
|
+
return {
|
|
2677
|
+
checked: isControlled ? controlledChecked : checked,
|
|
2678
|
+
handleItemCheckedChange: isControlled ? handleItemControlledCheckedChange : handleItemCheckedChange
|
|
2679
|
+
};
|
|
2680
|
+
}, [
|
|
2681
|
+
checked,
|
|
2682
|
+
handleItemCheckedChange,
|
|
2683
|
+
handleItemControlledCheckedChange,
|
|
2684
|
+
controlledChecked
|
|
2685
|
+
]),
|
|
2696
2686
|
...rest
|
|
2697
2687
|
});
|
|
2698
2688
|
};
|
|
@@ -2703,7 +2693,7 @@ var CheckboxGroupMountedContext = react.createContext({
|
|
|
2703
2693
|
handleItemMountedChange: () => null
|
|
2704
2694
|
});
|
|
2705
2695
|
var CheckboxGroupMountedProvider = (props) => {
|
|
2706
|
-
const { handleItemMountedChange: handleItemMountedChangeFurtherUpContext } = react.
|
|
2696
|
+
const { handleItemMountedChange: handleItemMountedChangeFurtherUpContext } = react.use(CheckboxGroupMountedContext);
|
|
2707
2697
|
const [mounted, setMounted] = react.useState([]);
|
|
2708
2698
|
const handleItemMountedChange = react.useCallback((newItemMounted, itemValue) => {
|
|
2709
2699
|
handleItemMountedChangeFurtherUpContext?.(newItemMounted, itemValue);
|
|
@@ -2714,20 +2704,19 @@ var CheckboxGroupMountedProvider = (props) => {
|
|
|
2714
2704
|
return Array.from(newMountedSet);
|
|
2715
2705
|
});
|
|
2716
2706
|
}, [handleItemMountedChangeFurtherUpContext]);
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
value,
|
|
2707
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckboxGroupMountedContext, {
|
|
2708
|
+
value: react.useMemo(() => ({
|
|
2709
|
+
mounted,
|
|
2710
|
+
handleItemMountedChange
|
|
2711
|
+
}), [mounted, handleItemMountedChange]),
|
|
2723
2712
|
...props
|
|
2724
2713
|
});
|
|
2725
2714
|
};
|
|
2726
2715
|
//#endregion
|
|
2727
2716
|
//#region src/components/checkbox-group/CheckboxGroupAllItem.tsx
|
|
2728
2717
|
var CheckboxGroupAllItem = ({ onCheckedChange, title = "all", ...rest }) => {
|
|
2729
|
-
const { checked: checkedItems, handleItemCheckedChange: handleItemCheckedChangeContext } = react.
|
|
2730
|
-
const { mounted: mountedItems } = react.
|
|
2718
|
+
const { checked: checkedItems, handleItemCheckedChange: handleItemCheckedChangeContext } = react.use(CheckboxGroupCheckedContext);
|
|
2719
|
+
const { mounted: mountedItems } = react.use(CheckboxGroupMountedContext);
|
|
2731
2720
|
const handleItemCheckedChange = (newChecked) => {
|
|
2732
2721
|
mountedItems.forEach((value) => {
|
|
2733
2722
|
handleItemCheckedChangeContext(newChecked, value);
|
|
@@ -2749,8 +2738,8 @@ var CheckboxGroupAllItem = ({ onCheckedChange, title = "all", ...rest }) => {
|
|
|
2749
2738
|
//#endregion
|
|
2750
2739
|
//#region src/components/checkbox-group/CheckboxGroupItem.tsx
|
|
2751
2740
|
var CheckboxGroupItem = ({ value, title, onCheckedChange, ...rest }) => {
|
|
2752
|
-
const { checked: checkedItems, handleItemCheckedChange: handleItemCheckedChangeContext } = react.
|
|
2753
|
-
const { handleItemMountedChange } = react.
|
|
2741
|
+
const { checked: checkedItems, handleItemCheckedChange: handleItemCheckedChangeContext } = react.use(CheckboxGroupCheckedContext);
|
|
2742
|
+
const { handleItemMountedChange } = react.use(CheckboxGroupMountedContext);
|
|
2754
2743
|
const handleItemCheckedChange = (newChecked) => {
|
|
2755
2744
|
handleItemCheckedChangeContext(newChecked, value);
|
|
2756
2745
|
onCheckedChange?.(newChecked);
|
|
@@ -2801,11 +2790,11 @@ var TreeListItem = ({ ref, className, ...rest }) => /* @__PURE__ */ (0, react_js
|
|
|
2801
2790
|
var TreeCollapsibleContext = react.createContext({});
|
|
2802
2791
|
var TreeCollapsibleProvider = ({ children }) => {
|
|
2803
2792
|
const [triggerRef, setTriggerRef] = useCallbackRef();
|
|
2804
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeCollapsibleContext
|
|
2805
|
-
value: {
|
|
2793
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TreeCollapsibleContext, {
|
|
2794
|
+
value: react.useMemo(() => ({
|
|
2806
2795
|
triggerRef,
|
|
2807
2796
|
setTriggerRef
|
|
2808
|
-
},
|
|
2797
|
+
}), [triggerRef, setTriggerRef]),
|
|
2809
2798
|
children
|
|
2810
2799
|
});
|
|
2811
2800
|
};
|
|
@@ -2828,7 +2817,7 @@ var TreeList = styled("ul", { base: [
|
|
|
2828
2817
|
//#endregion
|
|
2829
2818
|
//#region src/components/tree/TreeCollapsibleContent.tsx
|
|
2830
2819
|
var TreeCollapsibleContent = ({ ref, children, className, ...rest }) => {
|
|
2831
|
-
const { triggerRef } = react.
|
|
2820
|
+
const { triggerRef } = react.use(TreeCollapsibleContext);
|
|
2832
2821
|
const handleOnKeydown = (e) => {
|
|
2833
2822
|
if (!triggerRef?.current) return;
|
|
2834
2823
|
if (e.key === "Escape") {
|
|
@@ -2901,7 +2890,7 @@ var StyledActionIcon$2 = styled(ActionIcon, { base: [
|
|
|
2901
2890
|
"[&[data-state=open]>svg]:rotate-0"
|
|
2902
2891
|
] });
|
|
2903
2892
|
var TreeCollapsibleTrigger = ({ children, label, className, onClick, ...rest }) => {
|
|
2904
|
-
const { setTriggerRef, triggerRef } = react.
|
|
2893
|
+
const { setTriggerRef, triggerRef } = react.use(TreeCollapsibleContext);
|
|
2905
2894
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TreeItemContent, {
|
|
2906
2895
|
...rest,
|
|
2907
2896
|
className: cn("cursor-pointer", className),
|
|
@@ -3254,7 +3243,7 @@ var useFieldError = (fieldName) => {
|
|
|
3254
3243
|
//#endregion
|
|
3255
3244
|
//#region src/components/checkbox-field/CheckboxField.tsx
|
|
3256
3245
|
var CheckboxField = ({ className, label, name, validation, description, defaultChecked = false, checked, onCheckedChange, ...rest }) => {
|
|
3257
|
-
const { control } = (0, react_hook_form.useFormContext)();
|
|
3246
|
+
const { control, setValue } = (0, react_hook_form.useFormContext)();
|
|
3258
3247
|
const { error } = useFieldError(name);
|
|
3259
3248
|
const { field: { ref, onChange, value: innerChecked, name: innerName } } = (0, react_hook_form.useController)({
|
|
3260
3249
|
name,
|
|
@@ -3263,8 +3252,12 @@ var CheckboxField = ({ className, label, name, validation, description, defaultC
|
|
|
3263
3252
|
defaultValue: defaultChecked
|
|
3264
3253
|
});
|
|
3265
3254
|
react.useEffect(() => {
|
|
3266
|
-
if (typeof checked !== "undefined")
|
|
3267
|
-
}, [
|
|
3255
|
+
if (typeof checked !== "undefined") setValue(name, checked, { shouldDirty: false });
|
|
3256
|
+
}, [
|
|
3257
|
+
checked,
|
|
3258
|
+
name,
|
|
3259
|
+
setValue
|
|
3260
|
+
]);
|
|
3268
3261
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InlineFieldWrapper, {
|
|
3269
3262
|
className,
|
|
3270
3263
|
description,
|
|
@@ -3304,8 +3297,8 @@ var toIconSize$1 = {
|
|
|
3304
3297
|
lg: "md"
|
|
3305
3298
|
};
|
|
3306
3299
|
var ChipIcon = (props) => {
|
|
3307
|
-
const { size } = react.
|
|
3308
|
-
const iconSize =
|
|
3300
|
+
const { size } = react.use(ChipRootContext);
|
|
3301
|
+
const iconSize = overrideStyledVariantValue(size, (s) => toIconSize$1[s]);
|
|
3309
3302
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
3310
3303
|
...props,
|
|
3311
3304
|
size: iconSize
|
|
@@ -3377,9 +3370,8 @@ var StyledRoot$4 = styled("div", {
|
|
|
3377
3370
|
});
|
|
3378
3371
|
var ChipRootContext = react.createContext({});
|
|
3379
3372
|
var ChipRootProvider = ({ size, children }) => {
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
value,
|
|
3373
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChipRootContext, {
|
|
3374
|
+
value: react.useMemo(() => ({ size }), [size]),
|
|
3383
3375
|
children
|
|
3384
3376
|
});
|
|
3385
3377
|
};
|
|
@@ -3407,12 +3399,11 @@ var ChipGroup = styled("div", { base: [
|
|
|
3407
3399
|
//#region src/components/dismissible-group/DismissibleGroupRoot.tsx
|
|
3408
3400
|
var DismissibleGroupContext = react.createContext({ onDismiss: () => null });
|
|
3409
3401
|
var DismissibleGroupProvider = ({ children, disabled, onDismiss }) => {
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
value,
|
|
3402
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DismissibleGroupContext, {
|
|
3403
|
+
value: react.useMemo(() => ({
|
|
3404
|
+
disabled,
|
|
3405
|
+
onDismiss
|
|
3406
|
+
}), [disabled, onDismiss]),
|
|
3416
3407
|
children
|
|
3417
3408
|
});
|
|
3418
3409
|
};
|
|
@@ -3425,7 +3416,7 @@ DismissibleGroupRoot.displayName = "DismissibleGroup";
|
|
|
3425
3416
|
//#endregion
|
|
3426
3417
|
//#region src/components/dismissible-group/DismissibleGroupItem.tsx
|
|
3427
3418
|
var DismissibleGroupItem = ({ children, value, disabled: itemDisabled = false, ...rest }) => {
|
|
3428
|
-
const groupContext = react.
|
|
3419
|
+
const groupContext = react.use(DismissibleGroupContext);
|
|
3429
3420
|
if (groupContext === void 0) throw new Error("DismissibleGroup.Item can only be used within a DismissibleGroup");
|
|
3430
3421
|
const { onDismiss, disabled: groupDisabled } = groupContext;
|
|
3431
3422
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dismissible, {
|
|
@@ -3730,7 +3721,7 @@ FieldWrapper.displayName = "FieldWrapper";
|
|
|
3730
3721
|
//#endregion
|
|
3731
3722
|
//#region src/components/form/useFormCustomContext.ts
|
|
3732
3723
|
var FormCustomContext = react.createContext({ appearance: "standard" });
|
|
3733
|
-
var useFormCustomContext = () => react.
|
|
3724
|
+
var useFormCustomContext = () => react.use(FormCustomContext);
|
|
3734
3725
|
//#endregion
|
|
3735
3726
|
//#region src/utilities/style/get-icon-size.ts
|
|
3736
3727
|
var toIconSize = {
|
|
@@ -3828,7 +3819,7 @@ var toTextSize = {
|
|
|
3828
3819
|
xl: "lg"
|
|
3829
3820
|
};
|
|
3830
3821
|
var InputText = ({ ref, type = "text", size, ...rest }) => {
|
|
3831
|
-
const textSize =
|
|
3822
|
+
const textSize = overrideStyledVariantValue(size, (s) => toTextSize[s]);
|
|
3832
3823
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledInputText, {
|
|
3833
3824
|
ref,
|
|
3834
3825
|
as: "input",
|
|
@@ -3859,7 +3850,7 @@ var Input = ({ ref, className, size = "md", appearance = "standard", theme, stat
|
|
|
3859
3850
|
var PasswordInput = ({ ref, className, hidePasswordText = "Hide password", showPasswordText = "Show password", size = "md", ...restProps }) => {
|
|
3860
3851
|
const [isPasswordVisible, setIsPasswordVisible] = (0, react.useState)(false);
|
|
3861
3852
|
const togglePasswordVisibility = () => setIsPasswordVisible((currentState) => !currentState);
|
|
3862
|
-
const iconSize =
|
|
3853
|
+
const iconSize = getFieldIconSize(size);
|
|
3863
3854
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3864
3855
|
className: cn("relative", className),
|
|
3865
3856
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
|
|
@@ -3929,7 +3920,7 @@ var CreatePasswordField = ({ validate, defaultValidation, messageDirection = "ro
|
|
|
3929
3920
|
}
|
|
3930
3921
|
return false;
|
|
3931
3922
|
}, [setValidationResult]);
|
|
3932
|
-
const handleChange = react.
|
|
3923
|
+
const handleChange = react.useMemo(() => (0, throttle_debounce.throttle)(500, validatePassword), [validatePassword]);
|
|
3933
3924
|
const getMessageTheme = (result, isFocused) => {
|
|
3934
3925
|
if (result) return "success";
|
|
3935
3926
|
return isFocused ? "neutral" : "error";
|
|
@@ -3999,12 +3990,17 @@ var usePagination$1 = (initialPaginationState) => {
|
|
|
3999
3990
|
...defaultPaginationState,
|
|
4000
3991
|
...initialPaginationState || {}
|
|
4001
3992
|
});
|
|
3993
|
+
const applyPagination = react.useCallback(() => {
|
|
3994
|
+
setIsPaginated(true);
|
|
3995
|
+
}, []);
|
|
3996
|
+
const wasInitiallyPaginated = react.useRef(!!initialPaginationState);
|
|
4002
3997
|
return {
|
|
4003
3998
|
isPaginated,
|
|
4004
3999
|
paginationState,
|
|
4005
4000
|
setPaginationState,
|
|
4006
|
-
applyPagination
|
|
4007
|
-
|
|
4001
|
+
applyPagination,
|
|
4002
|
+
removePagination: react.useCallback(() => {
|
|
4003
|
+
setIsPaginated(wasInitiallyPaginated.current);
|
|
4008
4004
|
}, [])
|
|
4009
4005
|
};
|
|
4010
4006
|
};
|
|
@@ -4027,7 +4023,7 @@ var useSortByColumn = (defaultSort) => {
|
|
|
4027
4023
|
//#region src/components/data-table/DataTable.context.tsx
|
|
4028
4024
|
var DataTableContext = react.createContext(null);
|
|
4029
4025
|
var DataTableProvider = ({ columns, data: dataProp = [], getAsyncData, defaultSort, initialState = void 0, disabledRows, enableRowSelection, onRowSelectionChange, children }) => {
|
|
4030
|
-
const tableId = react.
|
|
4026
|
+
const tableId = react.useId();
|
|
4031
4027
|
const [data, setData] = react.useState({
|
|
4032
4028
|
results: dataProp ?? [],
|
|
4033
4029
|
total: dataProp?.length ?? 0
|
|
@@ -4040,17 +4036,22 @@ var DataTableProvider = ({ columns, data: dataProp = [], getAsyncData, defaultSo
|
|
|
4040
4036
|
offsetTop: 0,
|
|
4041
4037
|
isVisible: true
|
|
4042
4038
|
});
|
|
4043
|
-
const { isPaginated, applyPagination, paginationState, setPaginationState } = usePagination$1(initialState?.pagination);
|
|
4039
|
+
const { isPaginated, applyPagination, removePagination, paginationState, setPaginationState } = usePagination$1(initialState?.pagination);
|
|
4044
4040
|
const [asyncDataState, setAsyncDataState] = react.useState(AsyncDataState.NONE);
|
|
4045
4041
|
const [globalFilter, setGlobalFilter] = react.useState("");
|
|
4046
4042
|
const { setIsSortable, isSortable, sorting, setSorting } = useSortByColumn(defaultSort);
|
|
4043
|
+
const asyncRequestIdRef = react.useRef(0);
|
|
4047
4044
|
const runAsyncData = react.useCallback(async (overrideAsyncDataOptions) => {
|
|
4048
4045
|
if (!getAsyncData) return;
|
|
4046
|
+
const requestId = ++asyncRequestIdRef.current;
|
|
4049
4047
|
try {
|
|
4050
4048
|
setAsyncDataState(AsyncDataState.PENDING);
|
|
4051
|
-
|
|
4049
|
+
const newData = await getNewAsyncData(getAsyncData, overrideAsyncDataOptions, paginationState, sorting, globalFilter);
|
|
4050
|
+
if (requestId !== asyncRequestIdRef.current) return;
|
|
4051
|
+
setData(newData);
|
|
4052
4052
|
setAsyncDataState(AsyncDataState.FULFILLED);
|
|
4053
4053
|
} catch (_error) {
|
|
4054
|
+
if (requestId !== asyncRequestIdRef.current) return;
|
|
4054
4055
|
setAsyncDataState(AsyncDataState.REJECTED);
|
|
4055
4056
|
}
|
|
4056
4057
|
}, [
|
|
@@ -4070,7 +4071,7 @@ var DataTableProvider = ({ columns, data: dataProp = [], getAsyncData, defaultSo
|
|
|
4070
4071
|
total: dataProp.length
|
|
4071
4072
|
});
|
|
4072
4073
|
}, [dataProp]);
|
|
4073
|
-
const getTotalRows = () => data.total;
|
|
4074
|
+
const getTotalRows = react.useCallback(() => data.total, [data.total]);
|
|
4074
4075
|
const table = (0, _tanstack_react_table.useReactTable)({
|
|
4075
4076
|
columns,
|
|
4076
4077
|
data: data.results,
|
|
@@ -4114,42 +4115,55 @@ var DataTableProvider = ({ columns, data: dataProp = [], getAsyncData, defaultSo
|
|
|
4114
4115
|
}
|
|
4115
4116
|
}
|
|
4116
4117
|
});
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4118
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableContext, {
|
|
4119
|
+
value: react.useMemo(() => {
|
|
4120
|
+
return {
|
|
4121
|
+
...table,
|
|
4122
|
+
columns,
|
|
4123
|
+
data,
|
|
4124
|
+
setData,
|
|
4125
|
+
setIsSortable,
|
|
4126
|
+
applyPagination,
|
|
4127
|
+
removePagination,
|
|
4128
|
+
getTotalRows,
|
|
4129
|
+
isSortable,
|
|
4130
|
+
asyncDataState,
|
|
4131
|
+
runAsyncData,
|
|
4132
|
+
hasAsyncData: !!getAsyncData,
|
|
4133
|
+
disabledRows,
|
|
4134
|
+
enableRowSelection,
|
|
4135
|
+
rowSelection,
|
|
4136
|
+
tablePosition,
|
|
4137
|
+
setTablePosition,
|
|
4138
|
+
tableId
|
|
4139
|
+
};
|
|
4140
|
+
}, [
|
|
4141
|
+
table,
|
|
4120
4142
|
columns,
|
|
4121
4143
|
data,
|
|
4122
|
-
setData,
|
|
4123
|
-
setIsSortable,
|
|
4124
4144
|
applyPagination,
|
|
4145
|
+
removePagination,
|
|
4125
4146
|
getTotalRows,
|
|
4126
4147
|
isSortable,
|
|
4127
4148
|
asyncDataState,
|
|
4128
4149
|
runAsyncData,
|
|
4129
|
-
|
|
4150
|
+
getAsyncData,
|
|
4130
4151
|
disabledRows,
|
|
4131
4152
|
enableRowSelection,
|
|
4132
4153
|
rowSelection,
|
|
4133
4154
|
tablePosition,
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
isSortable,
|
|
4142
|
-
enableRowSelection,
|
|
4143
|
-
tableId,
|
|
4144
|
-
getAsyncData
|
|
4145
|
-
]);
|
|
4146
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableContext.Provider, {
|
|
4147
|
-
value,
|
|
4155
|
+
expanded,
|
|
4156
|
+
sorting,
|
|
4157
|
+
globalFilter,
|
|
4158
|
+
paginationState,
|
|
4159
|
+
isPaginated,
|
|
4160
|
+
tableId
|
|
4161
|
+
]),
|
|
4148
4162
|
children
|
|
4149
4163
|
});
|
|
4150
4164
|
};
|
|
4151
4165
|
var useDataTable = () => {
|
|
4152
|
-
const context = react.
|
|
4166
|
+
const context = react.use(DataTableContext);
|
|
4153
4167
|
if (!context) throw new Error("useDataTable can only be called from inside a DataTableProvider");
|
|
4154
4168
|
return context;
|
|
4155
4169
|
};
|
|
@@ -4397,6 +4411,7 @@ var DataTableRowSelectionCheckbox = ({ row, checked, onCheckedChange, label = `R
|
|
|
4397
4411
|
style: { "--depth": row.depth },
|
|
4398
4412
|
checked,
|
|
4399
4413
|
onCheckedChange,
|
|
4414
|
+
id: `${tableId}_row_${row.id}_selection`,
|
|
4400
4415
|
name: `${tableId}_row_${row.id}_selection`,
|
|
4401
4416
|
disabled: !row.getCanSelect(),
|
|
4402
4417
|
className: "mr-3 ml-[calc((var(--depth,0)*2)*4px)]"
|
|
@@ -4655,14 +4670,10 @@ var StyledContainer$2 = styled("div", { base: [
|
|
|
4655
4670
|
] });
|
|
4656
4671
|
var DataTableBulkActionsFloating = /* @__PURE__ */ Object.assign(({ children, ...rest }) => {
|
|
4657
4672
|
const { rowSelection, toggleAllPageRowsSelected } = useDataTable();
|
|
4658
|
-
const
|
|
4659
|
-
const numberOfSelectedRows = react.useMemo(() => {
|
|
4660
|
-
return Object.keys(rowSelection || {}).length;
|
|
4661
|
-
}, [rowSelection]);
|
|
4673
|
+
const numberOfSelectedRows = Object.keys(rowSelection || {}).length;
|
|
4662
4674
|
const handleDeselectAllPageRows = () => toggleAllPageRowsSelected(false);
|
|
4663
4675
|
if (numberOfSelectedRows === 0) return null;
|
|
4664
4676
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
4665
|
-
ref: actionBarRef,
|
|
4666
4677
|
className: "pointer-events-none sticky bottom-0 left-0 flex justify-center",
|
|
4667
4678
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContainer$2, {
|
|
4668
4679
|
...rest,
|
|
@@ -4698,9 +4709,8 @@ var DataTableBulkActionsFloating = /* @__PURE__ */ Object.assign(({ children, ..
|
|
|
4698
4709
|
//#region src/components/empty-state/EmptyState.context.tsx
|
|
4699
4710
|
var EmptyStateContext = react.createContext({});
|
|
4700
4711
|
var EmptyStateProvider = ({ size, children }) => {
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
value,
|
|
4712
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmptyStateContext, {
|
|
4713
|
+
value: react.useMemo(() => ({ size }), [size]),
|
|
4704
4714
|
children
|
|
4705
4715
|
});
|
|
4706
4716
|
};
|
|
@@ -4717,7 +4727,7 @@ var StyledEmptyStateBody = styled(Text, {
|
|
|
4717
4727
|
} }
|
|
4718
4728
|
}, { enableResponsiveVariants: true });
|
|
4719
4729
|
var EmptyStateBody = (props) => {
|
|
4720
|
-
const { size } = react.
|
|
4730
|
+
const { size } = react.use(EmptyStateContext);
|
|
4721
4731
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledEmptyStateBody, {
|
|
4722
4732
|
...props,
|
|
4723
4733
|
size
|
|
@@ -4756,7 +4766,7 @@ var StyledEmptyStateImage = styled(Image, {
|
|
|
4756
4766
|
} }
|
|
4757
4767
|
}, { enableResponsiveVariants: true });
|
|
4758
4768
|
var EmptyStateImage = (props) => {
|
|
4759
|
-
const { size } = react.
|
|
4769
|
+
const { size } = react.use(EmptyStateContext);
|
|
4760
4770
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledEmptyStateImage, {
|
|
4761
4771
|
size,
|
|
4762
4772
|
...props
|
|
@@ -4780,7 +4790,7 @@ var StyledEmptyStateTitle = styled("h2", {
|
|
|
4780
4790
|
} }
|
|
4781
4791
|
}, { enableResponsiveVariants: true });
|
|
4782
4792
|
var EmptyStateTitle = (props) => {
|
|
4783
|
-
const { size } = react.
|
|
4793
|
+
const { size } = react.use(EmptyStateContext);
|
|
4784
4794
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledEmptyStateTitle, {
|
|
4785
4795
|
size,
|
|
4786
4796
|
...props
|
|
@@ -4851,14 +4861,10 @@ var StyledIcon$1 = styled(Icon, {
|
|
|
4851
4861
|
var SearchInput = ({ ref, size = "md", appearance = "standard", theme, className, value, defaultValue = "", onValueChange, clearText = "Clear", onChange, ...rest }) => {
|
|
4852
4862
|
const [inputElRef, setInputElRef] = useCallbackRef();
|
|
4853
4863
|
const [innerValue, setInnerValue] = react.useState(defaultValue);
|
|
4854
|
-
const
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
setActiveIcon(value ? "CLEAR" : "SEARCH");
|
|
4859
|
-
}, [value]);
|
|
4860
|
-
const iconSize = react.useMemo(() => getFieldIconSize(size), [size]);
|
|
4861
|
-
react.useImperativeHandle(ref, () => inputElRef.current);
|
|
4864
|
+
const currentValue = value ?? innerValue;
|
|
4865
|
+
const activeIcon = currentValue ? "CLEAR" : "SEARCH";
|
|
4866
|
+
const iconSize = getFieldIconSize(size);
|
|
4867
|
+
const composedInputRef = (0, _radix_ui_react_compose_refs.useComposedRefs)(ref, setInputElRef);
|
|
4862
4868
|
const handleClear = () => {
|
|
4863
4869
|
const inputEl = inputElRef.current;
|
|
4864
4870
|
if (!inputEl) return;
|
|
@@ -4873,7 +4879,6 @@ var SearchInput = ({ ref, size = "md", appearance = "standard", theme, className
|
|
|
4873
4879
|
const newValue = event.target.value;
|
|
4874
4880
|
setInnerValue(newValue);
|
|
4875
4881
|
onValueChange?.(newValue);
|
|
4876
|
-
setActiveIcon(newValue ? "CLEAR" : "SEARCH");
|
|
4877
4882
|
};
|
|
4878
4883
|
const getIcon = () => {
|
|
4879
4884
|
if (activeIcon === "SEARCH") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIcon$1, {
|
|
@@ -4896,11 +4901,11 @@ var SearchInput = ({ ref, size = "md", appearance = "standard", theme, className
|
|
|
4896
4901
|
theme,
|
|
4897
4902
|
className: cn("relative", "w-auto", className),
|
|
4898
4903
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InputText, {
|
|
4899
|
-
ref:
|
|
4904
|
+
ref: composedInputRef,
|
|
4900
4905
|
size,
|
|
4901
4906
|
type: "search",
|
|
4902
4907
|
...rest,
|
|
4903
|
-
value:
|
|
4908
|
+
value: currentValue,
|
|
4904
4909
|
onChange: handleOnChange,
|
|
4905
4910
|
className: cn(size === "sm" ? "pr-8" : "pr-10", "[&::-webkit-search-decoration]:appearance-none", "[&::-webkit-search-cancel-button]:appearance-none", "[&::-webkit-search-results-button]:appearance-none")
|
|
4906
4911
|
}), getIcon()]
|
|
@@ -4911,19 +4916,27 @@ var SearchInput = ({ ref, size = "md", appearance = "standard", theme, className
|
|
|
4911
4916
|
var DataTableGlobalFilter = ({ onChange, label, hideLabel = false, ...rest }) => {
|
|
4912
4917
|
const { setGlobalFilter, getState, resetPagination, getTotalRows, asyncDataState } = useDataTable();
|
|
4913
4918
|
const { globalFilter } = getState();
|
|
4914
|
-
|
|
4915
|
-
const handleChange = (0, throttle_debounce.debounce)(250, (event) => {
|
|
4916
|
-
const { target: { value } } = event;
|
|
4919
|
+
const inputId = react.useId();
|
|
4920
|
+
const handleChange = react.useMemo(() => (0, throttle_debounce.debounce)(250, (event) => {
|
|
4917
4921
|
onChange?.(event);
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4922
|
+
react.startTransition(() => {
|
|
4923
|
+
resetPagination();
|
|
4924
|
+
setGlobalFilter(event.target.value);
|
|
4925
|
+
});
|
|
4926
|
+
}), [
|
|
4927
|
+
onChange,
|
|
4928
|
+
resetPagination,
|
|
4929
|
+
setGlobalFilter
|
|
4930
|
+
]);
|
|
4931
|
+
react.useEffect(() => () => handleChange.cancel(), [handleChange]);
|
|
4932
|
+
if (!(asyncDataState === AsyncDataState.PENDING) && getTotalRows() === 0) return null;
|
|
4921
4933
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, {
|
|
4922
|
-
htmlFor:
|
|
4934
|
+
htmlFor: inputId,
|
|
4923
4935
|
className: cn("mb-3", hideLabel && "sr-only"),
|
|
4924
4936
|
children: label
|
|
4925
4937
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
4926
4938
|
...rest,
|
|
4939
|
+
id: inputId,
|
|
4927
4940
|
defaultValue: globalFilter,
|
|
4928
4941
|
onChange: handleChange,
|
|
4929
4942
|
name: label
|
|
@@ -5028,29 +5041,21 @@ var DataTableSelectAllRowsCheckbox = ({ label = "All rows selection" }) => {
|
|
|
5028
5041
|
size: "lg",
|
|
5029
5042
|
checked: getCheckedState(),
|
|
5030
5043
|
onCheckedChange: updateCheckedState,
|
|
5031
|
-
|
|
5044
|
+
id: `${tableId}_all_rows_selection`,
|
|
5045
|
+
name: `${tableId}_all_rows_selection`
|
|
5032
5046
|
})] });
|
|
5033
5047
|
};
|
|
5034
5048
|
//#endregion
|
|
5035
5049
|
//#region src/components/data-table/DataTableHead.tsx
|
|
5036
5050
|
var DataTableHead = ({ sortable = true, theme = "light", isSticky = false, stickyOffset = 0, showTotalInFirstColumn, totalSuffix, style, className, ...rest }) => {
|
|
5037
|
-
const { getHeaderGroups, setIsSortable, enableRowSelection, getCanSomeRowsExpand, tablePosition
|
|
5051
|
+
const { getHeaderGroups, setIsSortable, enableRowSelection, getCanSomeRowsExpand, tablePosition } = useDataTable();
|
|
5038
5052
|
react.useEffect(() => {
|
|
5039
5053
|
setIsSortable(sortable);
|
|
5040
5054
|
}, [sortable, setIsSortable]);
|
|
5041
5055
|
const tableHeaderRowRef = react.useRef(null);
|
|
5042
5056
|
const tableRef = react.useRef(null);
|
|
5043
|
-
const headerOffsetRef = react.useRef(0);
|
|
5044
5057
|
const [headerOffset, setHeaderOffset] = react.useState(0);
|
|
5045
5058
|
const [headerHide, setHeaderHide] = react.useState(false);
|
|
5046
|
-
const tableHeadElement = tableHeaderRowRef?.current?.closest("thead");
|
|
5047
|
-
if (tableHeadElement && tablePosition?.offsetTop === null) {
|
|
5048
|
-
const intersectionOffset = stickyOffset + tableHeadElement.getBoundingClientRect().height;
|
|
5049
|
-
if (tablePosition) setTablePosition({
|
|
5050
|
-
...tablePosition,
|
|
5051
|
-
offsetTop: intersectionOffset || 0
|
|
5052
|
-
});
|
|
5053
|
-
}
|
|
5054
5059
|
react.useEffect(() => {
|
|
5055
5060
|
if (!isSticky) return;
|
|
5056
5061
|
if (!tableRef.current && tableHeaderRowRef.current) tableRef.current = tableHeaderRowRef.current.closest("table");
|
|
@@ -5058,11 +5063,11 @@ var DataTableHead = ({ sortable = true, theme = "light", isSticky = false, stick
|
|
|
5058
5063
|
if (tablePosition?.top !== null && tablePosition?.bottom !== null) {
|
|
5059
5064
|
const newOffset = tablePosition?.top != null && tablePosition?.bottom != null && tablePosition.top < stickyOffset && tablePosition.bottom > 100 ? -tablePosition.top + stickyOffset : 0;
|
|
5060
5065
|
if (newOffset !== 0) setHeaderHide(true);
|
|
5061
|
-
headerOffsetRef.current = newOffset;
|
|
5062
5066
|
setHeaderOffset(newOffset);
|
|
5063
|
-
requestAnimationFrame(() => {
|
|
5067
|
+
const rafId = requestAnimationFrame(() => {
|
|
5064
5068
|
setHeaderHide(false);
|
|
5065
5069
|
});
|
|
5070
|
+
return () => cancelAnimationFrame(rafId);
|
|
5066
5071
|
}
|
|
5067
5072
|
}
|
|
5068
5073
|
}, [
|
|
@@ -5078,9 +5083,9 @@ var DataTableHead = ({ sortable = true, theme = "light", isSticky = false, stick
|
|
|
5078
5083
|
},
|
|
5079
5084
|
...rest,
|
|
5080
5085
|
className: cn("relative", "z-3", "[&_tr:not(:last-child)>th]:border-b-none", "[&_tr:not(:first-child)>th]:rounded-none!", className),
|
|
5081
|
-
children: getHeaderGroups().map((headerGroup) => {
|
|
5086
|
+
children: getHeaderGroups().map((headerGroup, headerGroupIndex) => {
|
|
5082
5087
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Table.Row, {
|
|
5083
|
-
ref: tableHeaderRowRef,
|
|
5088
|
+
ref: headerGroupIndex === 0 ? tableHeaderRowRef : void 0,
|
|
5084
5089
|
className: isSticky && headerOffset !== 0 ? cn("translate-y-(--header-offset)", headerHide ? "delay-0ms opacity-0 transition-none" : "delay-150ms opacity-100 transition-opacity duration-100", "[&_th]:last:before:absolute", "[&_th]:last:before:bottom-0", "[&_th]:last:before:pointer-events-none", "[&_th]:last:before:right-0", "[&_th]:last:before:shadow-sm", "[&_th]:last:before:top-0", "[&_th]:last:before:w-full") : void 0,
|
|
5085
5090
|
children: [
|
|
5086
5091
|
getCanSomeRowsExpand() && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Table.HeaderCell, { className: "w-10" }),
|
|
@@ -5131,10 +5136,8 @@ var DataTableTable = ({ sortable, striped, theme = "white", className, scrollOpt
|
|
|
5131
5136
|
const tableRef = react.useRef(null);
|
|
5132
5137
|
const isTableVisible = react.useRef(false);
|
|
5133
5138
|
const isScrolling = react.useRef(false);
|
|
5134
|
-
const
|
|
5135
|
-
|
|
5136
|
-
return window;
|
|
5137
|
-
}, []);
|
|
5139
|
+
const scrollRafIdRef = react.useRef(null);
|
|
5140
|
+
const scrollTarget = typeof window === "undefined" ? null : window;
|
|
5138
5141
|
react.useEffect(() => {
|
|
5139
5142
|
if (!scrollTarget || typeof IntersectionObserver === "undefined") return;
|
|
5140
5143
|
const updatePosition = () => {
|
|
@@ -5151,7 +5154,7 @@ var DataTableTable = ({ sortable, striped, theme = "white", className, scrollOpt
|
|
|
5151
5154
|
};
|
|
5152
5155
|
const handleScroll = () => {
|
|
5153
5156
|
if (!isScrolling.current) {
|
|
5154
|
-
requestAnimationFrame(updatePosition);
|
|
5157
|
+
scrollRafIdRef.current = requestAnimationFrame(updatePosition);
|
|
5155
5158
|
isScrolling.current = true;
|
|
5156
5159
|
}
|
|
5157
5160
|
};
|
|
@@ -5176,13 +5179,17 @@ var DataTableTable = ({ sortable, striped, theme = "white", className, scrollOpt
|
|
|
5176
5179
|
if (tableRef.current && (scrollOptions.hasStickyHeader || Object.keys(rowSelection || {}).length > 0)) tableObserver.observe(tableRef.current);
|
|
5177
5180
|
return () => {
|
|
5178
5181
|
tableObserver.disconnect();
|
|
5182
|
+
if (scrollRafIdRef.current !== null) {
|
|
5183
|
+
cancelAnimationFrame(scrollRafIdRef.current);
|
|
5184
|
+
scrollRafIdRef.current = null;
|
|
5185
|
+
}
|
|
5186
|
+
isScrolling.current = false;
|
|
5179
5187
|
if (scrollTarget) scrollTarget?.removeEventListener("scroll", handleScroll);
|
|
5180
5188
|
};
|
|
5181
5189
|
}, [
|
|
5182
5190
|
rowSelection,
|
|
5183
5191
|
scrollOptions.hasStickyHeader,
|
|
5184
5192
|
scrollOptions?.stickyHeaderOffset,
|
|
5185
|
-
scrollTarget,
|
|
5186
5193
|
setTablePosition
|
|
5187
5194
|
]);
|
|
5188
5195
|
const isPending = asyncDataState === AsyncDataState.PENDING;
|
|
@@ -5292,9 +5299,11 @@ SortableItem.displayName = "SortableItem";
|
|
|
5292
5299
|
//#region src/components/sortable/SortableRoot.tsx
|
|
5293
5300
|
var SortableRoot = ({ sortableIds, onSortChange, children }) => {
|
|
5294
5301
|
const [order, setOrder] = react.useState(sortableIds);
|
|
5295
|
-
react.
|
|
5296
|
-
|
|
5297
|
-
|
|
5302
|
+
const [prevIds, setPrevIds] = react.useState(sortableIds);
|
|
5303
|
+
if (prevIds !== sortableIds) {
|
|
5304
|
+
setPrevIds(sortableIds);
|
|
5305
|
+
if (prevIds.length !== sortableIds.length || sortableIds.some((id, index) => id !== prevIds[index])) setOrder(sortableIds);
|
|
5306
|
+
}
|
|
5298
5307
|
const sensors = (0, _dnd_kit_core.useSensors)((0, _dnd_kit_core.useSensor)(_dnd_kit_core.PointerSensor), (0, _dnd_kit_core.useSensor)(_dnd_kit_core.KeyboardSensor, { coordinateGetter: _dnd_kit_sortable.sortableKeyboardCoordinates }));
|
|
5299
5308
|
const handleDragEnd = (event) => {
|
|
5300
5309
|
const { active, over } = event;
|
|
@@ -5366,7 +5375,7 @@ var DragAndDropTable = ({ idColumn = "id", onDragAndDrop, sortable, striped, the
|
|
|
5366
5375
|
const isPending = asyncDataState === AsyncDataState.PENDING;
|
|
5367
5376
|
const rowIds = react.useMemo(() => data.results.map((row) => {
|
|
5368
5377
|
return row[idColumn];
|
|
5369
|
-
}), [data]);
|
|
5378
|
+
}), [data, idColumn]);
|
|
5370
5379
|
const handleSortChange = react.useCallback(({ oldIndex, newIndex }) => {
|
|
5371
5380
|
const sortedResults = (0, _dnd_kit_sortable.arrayMove)(data.results, oldIndex, newIndex);
|
|
5372
5381
|
const newData = {
|
|
@@ -5546,7 +5555,11 @@ var PaginationContext = react.createContext({
|
|
|
5546
5555
|
indicatedPages: [],
|
|
5547
5556
|
disabledPages: []
|
|
5548
5557
|
});
|
|
5549
|
-
var
|
|
5558
|
+
var DEFAULT_LABELS$1 = {};
|
|
5559
|
+
var DEFAULT_ON_ITEM_HOVER = () => null;
|
|
5560
|
+
var DEFAULT_INDICATED_PAGES = [];
|
|
5561
|
+
var DEFAULT_DISABLED_PAGES = [];
|
|
5562
|
+
var PaginationProvider = ({ onSelectedPageChange, selectedPage, visibleElementsCount = VisibleElementsAmount.LESS, pagesCount, indicatedPages = DEFAULT_INDICATED_PAGES, disabledPages = DEFAULT_DISABLED_PAGES, onItemHover = DEFAULT_ON_ITEM_HOVER, labels = DEFAULT_LABELS$1, children }) => {
|
|
5550
5563
|
const [internalCurrentPage, setInternalCurrentPage] = react.useState(1);
|
|
5551
5564
|
const currentPage = selectedPage || internalCurrentPage;
|
|
5552
5565
|
const goToPage = react.useCallback((pageNumber) => {
|
|
@@ -5561,45 +5574,48 @@ var PaginationProvider = ({ onSelectedPageChange, selectedPage, visibleElementsC
|
|
|
5561
5574
|
const goToNextPage = react.useCallback(() => {
|
|
5562
5575
|
if (nextAvailablePage) goToPage(nextAvailablePage);
|
|
5563
5576
|
}, [goToPage, nextAvailablePage]);
|
|
5564
|
-
const paginationItems = getPaginationElementsToRender(currentPage, pagesCount, visibleElementsCount)
|
|
5565
|
-
|
|
5566
|
-
|
|
5577
|
+
const paginationItems = react.useMemo(() => getPaginationElementsToRender(currentPage, pagesCount, visibleElementsCount), [
|
|
5578
|
+
currentPage,
|
|
5579
|
+
pagesCount,
|
|
5580
|
+
visibleElementsCount
|
|
5581
|
+
]);
|
|
5582
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationContext, {
|
|
5583
|
+
value: react.useMemo(() => {
|
|
5584
|
+
return {
|
|
5585
|
+
goToNextPage,
|
|
5586
|
+
goToPreviousPage,
|
|
5587
|
+
goToPage,
|
|
5588
|
+
currentPage,
|
|
5589
|
+
paginationItems,
|
|
5590
|
+
indicatedPages,
|
|
5591
|
+
disabledPages,
|
|
5592
|
+
pagesCount,
|
|
5593
|
+
onItemHover,
|
|
5594
|
+
previousAvailablePage,
|
|
5595
|
+
nextAvailablePage,
|
|
5596
|
+
labels
|
|
5597
|
+
};
|
|
5598
|
+
}, [
|
|
5567
5599
|
goToNextPage,
|
|
5568
5600
|
goToPreviousPage,
|
|
5569
5601
|
goToPage,
|
|
5570
5602
|
currentPage,
|
|
5571
|
-
paginationItems,
|
|
5572
5603
|
indicatedPages,
|
|
5604
|
+
paginationItems,
|
|
5573
5605
|
disabledPages,
|
|
5574
5606
|
pagesCount,
|
|
5575
5607
|
onItemHover,
|
|
5576
5608
|
previousAvailablePage,
|
|
5577
5609
|
nextAvailablePage,
|
|
5578
5610
|
labels
|
|
5579
|
-
|
|
5580
|
-
}, [
|
|
5581
|
-
goToNextPage,
|
|
5582
|
-
goToPreviousPage,
|
|
5583
|
-
goToPage,
|
|
5584
|
-
currentPage,
|
|
5585
|
-
indicatedPages,
|
|
5586
|
-
paginationItems,
|
|
5587
|
-
disabledPages,
|
|
5588
|
-
pagesCount,
|
|
5589
|
-
onItemHover,
|
|
5590
|
-
previousAvailablePage,
|
|
5591
|
-
nextAvailablePage,
|
|
5592
|
-
labels
|
|
5593
|
-
]);
|
|
5594
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationContext.Provider, {
|
|
5595
|
-
value,
|
|
5611
|
+
]),
|
|
5596
5612
|
children
|
|
5597
5613
|
});
|
|
5598
5614
|
};
|
|
5599
5615
|
//#endregion
|
|
5600
5616
|
//#region src/components/pagination/usePagination.tsx
|
|
5601
5617
|
var usePagination = () => {
|
|
5602
|
-
const context = react.
|
|
5618
|
+
const context = react.use(PaginationContext);
|
|
5603
5619
|
if (!context) throw new Error("Ensure that you wrap any components with the PaginationProvider component");
|
|
5604
5620
|
return context;
|
|
5605
5621
|
};
|
|
@@ -5890,10 +5906,11 @@ var StyledNav = styled("nav", { base: [
|
|
|
5890
5906
|
] });
|
|
5891
5907
|
/** Applies pagination to parent DataTableProvider and renders UI to switch pages etc */
|
|
5892
5908
|
var Pagination$1 = ({ colorScheme, ...rest }) => {
|
|
5893
|
-
const { applyPagination, getState, getExpandedRowModel, getRowModel, setPageIndex, getTotalRows, getPageCount, asyncDataState, hasAsyncData } = useDataTable();
|
|
5909
|
+
const { applyPagination, removePagination, getState, getExpandedRowModel, getRowModel, setPageIndex, getTotalRows, getPageCount, asyncDataState, hasAsyncData } = useDataTable();
|
|
5894
5910
|
react.useEffect(() => {
|
|
5895
5911
|
applyPagination();
|
|
5896
|
-
|
|
5912
|
+
return () => removePagination();
|
|
5913
|
+
}, [applyPagination, removePagination]);
|
|
5897
5914
|
const { pagination: paginationState } = getState();
|
|
5898
5915
|
const isEmpty = !(asyncDataState === AsyncDataState.PENDING) && getTotalRows() === 0;
|
|
5899
5916
|
const showPagination = hasAsyncData ? getPageCount() > 1 : getExpandedRowModel().rows.length / paginationState.pageSize > 1;
|
|
@@ -6121,11 +6138,13 @@ var offsetWeekdayNames = (weekdayNames, firstDayOfWeek) => {
|
|
|
6121
6138
|
const start = weekdayNames.slice(0, firstDayOfWeek);
|
|
6122
6139
|
return weekdayNames.slice(firstDayOfWeek).concat(start);
|
|
6123
6140
|
};
|
|
6124
|
-
var Calendar = ({ className, refDateSelected, refDateToday, firstDayOfWeek = 0, monthNames = monthNamesShort, weekdayNames = weekdayNamesShort, labels = DEFAULT_LABELS, date
|
|
6141
|
+
var Calendar = ({ className, refDateSelected, refDateToday, firstDayOfWeek = 0, monthNames = monthNamesShort, weekdayNames = weekdayNamesShort, labels = DEFAULT_LABELS, date: dateProp, minDate, maxDate, setYear, ...rest }) => {
|
|
6142
|
+
const [fallbackDate] = react.useState(() => /* @__PURE__ */ new Date());
|
|
6143
|
+
const date = dateProp ?? fallbackDate;
|
|
6125
6144
|
const [showYears, setShowYears] = react.useState(false);
|
|
6126
6145
|
const [currentYear, setCurrentYear] = react.useState(date?.getFullYear());
|
|
6127
6146
|
const handleSetYear = (year) => {
|
|
6128
|
-
const newDate = date;
|
|
6147
|
+
const newDate = new Date(date);
|
|
6129
6148
|
newDate.setFullYear(year);
|
|
6130
6149
|
setYear(newDate);
|
|
6131
6150
|
setShowYears(false);
|
|
@@ -6238,7 +6257,7 @@ var formatDateToString = (date, dateFormat = DEFAULT_DATE_FORMAT) => date ? (0,
|
|
|
6238
6257
|
var DateInput = ({ ref, initialDate, dateFormat = DEFAULT_DATE_FORMAT, firstDayOfWeek = 1, disabled, monthNames, weekdayNames, size = "md", appearance, theme, labels, revalidate, onChange, minDate, maxDate, ...rest }) => {
|
|
6239
6258
|
const [date, setDate] = react.useState(initialDate ? (0, dayjs.default)(initialDate).toDate() : void 0);
|
|
6240
6259
|
const [inputElRef, setInputElRef] = useCallbackRefState();
|
|
6241
|
-
|
|
6260
|
+
const composedInputRef = (0, _radix_ui_react_compose_refs.useComposedRefs)(ref, setInputElRef);
|
|
6242
6261
|
const dateString = formatDateToString(date, dateFormat);
|
|
6243
6262
|
const handleInputChange = react.useCallback((event) => {
|
|
6244
6263
|
const newDateString = event.target.value;
|
|
@@ -6264,7 +6283,7 @@ var DateInput = ({ ref, initialDate, dateFormat = DEFAULT_DATE_FORMAT, firstDayO
|
|
|
6264
6283
|
const [calendarOpen, setCalendarOpen] = react.useState(false);
|
|
6265
6284
|
const refDateToday = react.useRef(null);
|
|
6266
6285
|
const refDateSelected = react.useRef(null);
|
|
6267
|
-
const iconSize =
|
|
6286
|
+
const iconSize = getFieldIconSize(size);
|
|
6268
6287
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6269
6288
|
className: "relative h-max",
|
|
6270
6289
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
|
|
@@ -6275,7 +6294,7 @@ var DateInput = ({ ref, initialDate, dateFormat = DEFAULT_DATE_FORMAT, firstDayO
|
|
|
6275
6294
|
theme,
|
|
6276
6295
|
...rest,
|
|
6277
6296
|
onChange: handleInputChange,
|
|
6278
|
-
ref:
|
|
6297
|
+
ref: composedInputRef,
|
|
6279
6298
|
defaultValue: dateString
|
|
6280
6299
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Popover, {
|
|
6281
6300
|
modal: true,
|
|
@@ -6418,7 +6437,9 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
6418
6437
|
"max-h-[90vh]",
|
|
6419
6438
|
"supports-svh:h-auto",
|
|
6420
6439
|
"supports-svh:max-h-[90vh]",
|
|
6421
|
-
"w-95"
|
|
6440
|
+
"w-95",
|
|
6441
|
+
"[&>[data-dialog-close]]:top-4",
|
|
6442
|
+
"[&>[data-dialog-close]]:right-4"
|
|
6422
6443
|
],
|
|
6423
6444
|
sm: [
|
|
6424
6445
|
"rounded-md",
|
|
@@ -6427,7 +6448,9 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
6427
6448
|
"max-h-[90vh]",
|
|
6428
6449
|
"supports-svh:h-auto",
|
|
6429
6450
|
"supports-svh:max-h-[90vh]",
|
|
6430
|
-
"w-120"
|
|
6451
|
+
"w-120",
|
|
6452
|
+
"[&>[data-dialog-close]]:top-4",
|
|
6453
|
+
"[&>[data-dialog-close]]:right-4"
|
|
6431
6454
|
],
|
|
6432
6455
|
md: [
|
|
6433
6456
|
"rounded-md",
|
|
@@ -6436,7 +6459,9 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
6436
6459
|
"max-h-[90vh]",
|
|
6437
6460
|
"supports-svh:h-auto",
|
|
6438
6461
|
"supports-svh:max-h-[90vh]",
|
|
6439
|
-
"w-150"
|
|
6462
|
+
"w-150",
|
|
6463
|
+
"[&>[data-dialog-close]]:top-4",
|
|
6464
|
+
"[&>[data-dialog-close]]:right-4"
|
|
6440
6465
|
],
|
|
6441
6466
|
lg: [
|
|
6442
6467
|
"rounded-md",
|
|
@@ -6445,7 +6470,9 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
6445
6470
|
"max-h-[90vh]",
|
|
6446
6471
|
"supports-svh:h-auto",
|
|
6447
6472
|
"supports-svh:max-h-[90vh]",
|
|
6448
|
-
"w-200"
|
|
6473
|
+
"w-200",
|
|
6474
|
+
"[&>[data-dialog-close]]:top-4",
|
|
6475
|
+
"[&>[data-dialog-close]]:right-4"
|
|
6449
6476
|
],
|
|
6450
6477
|
xl: [
|
|
6451
6478
|
"rounded-md",
|
|
@@ -6454,7 +6481,9 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
6454
6481
|
"max-h-[90vh]",
|
|
6455
6482
|
"supports-svh:h-auto",
|
|
6456
6483
|
"supports-svh:max-h-[90vh]",
|
|
6457
|
-
"w-275"
|
|
6484
|
+
"w-275",
|
|
6485
|
+
"[&>[data-dialog-close]]:top-4",
|
|
6486
|
+
"[&>[data-dialog-close]]:right-4"
|
|
6458
6487
|
],
|
|
6459
6488
|
fullscreen: [
|
|
6460
6489
|
"rounded-none",
|
|
@@ -6463,7 +6492,9 @@ var StyledDialogContent = styled(_radix_ui_react_dialog.Content, {
|
|
|
6463
6492
|
"max-w-screen",
|
|
6464
6493
|
"max-h-screen",
|
|
6465
6494
|
"supports-svh:h-svh",
|
|
6466
|
-
"supports-svh:max-h-svh"
|
|
6495
|
+
"supports-svh:max-h-svh",
|
|
6496
|
+
"[&>[data-dialog-close]]:top-safe-offset-4",
|
|
6497
|
+
"[&>[data-dialog-close]]:right-safe-offset-4"
|
|
6467
6498
|
]
|
|
6468
6499
|
},
|
|
6469
6500
|
layout: { panel: [
|
|
@@ -6488,6 +6519,7 @@ var DialogContent = ({ size = "sm", children, closeDialogText = "Close dialog",
|
|
|
6488
6519
|
hasTooltip: false,
|
|
6489
6520
|
size: "md",
|
|
6490
6521
|
theme: "neutral",
|
|
6522
|
+
"data-dialog-close": true,
|
|
6491
6523
|
className: "absolute top-4 right-4 size-12",
|
|
6492
6524
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { is: _atom_learning_icons.Close })
|
|
6493
6525
|
}), react.Children.map(children, (child) => react.isValidElement(child) && child.type === DialogBackground ? null : child)]
|
|
@@ -6600,7 +6632,7 @@ var StyledContent$1 = styled(_radix_ui_react_dialog.Content, {
|
|
|
6600
6632
|
}
|
|
6601
6633
|
});
|
|
6602
6634
|
var DrawerContent = ({ children, ...rest }) => {
|
|
6603
|
-
const { position } = react.
|
|
6635
|
+
const { position } = react.use(DrawerContext);
|
|
6604
6636
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Portal, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawerOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorScheme, {
|
|
6605
6637
|
base: "grey1",
|
|
6606
6638
|
accent: "primary1",
|
|
@@ -6621,9 +6653,8 @@ var DrawerContent = ({ children, ...rest }) => {
|
|
|
6621
6653
|
//#region src/components/drawer/Drawer.context.tsx
|
|
6622
6654
|
var DrawerContext = react.createContext({ position: "left" });
|
|
6623
6655
|
var DrawerProvider = ({ position = "left", ...rest }) => {
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
value,
|
|
6656
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawerContext, {
|
|
6657
|
+
value: react.useMemo(() => ({ position }), [position]),
|
|
6627
6658
|
...rest
|
|
6628
6659
|
});
|
|
6629
6660
|
};
|
|
@@ -6812,90 +6843,6 @@ var FileInput = ({ accept, children, className, disabled = false, multiple = fal
|
|
|
6812
6843
|
};
|
|
6813
6844
|
FileInput.displayName = "FileInput";
|
|
6814
6845
|
//#endregion
|
|
6815
|
-
//#region src/components/flex/Flex.tsx
|
|
6816
|
-
var Flex = styled("div", {
|
|
6817
|
-
base: ["flex"],
|
|
6818
|
-
variants: {
|
|
6819
|
-
direction: {
|
|
6820
|
-
row: ["flex-row"],
|
|
6821
|
-
"row-reverse": ["flex-row-reverse"],
|
|
6822
|
-
column: ["flex-col"],
|
|
6823
|
-
"column-reverse": ["flex-col-reverse"],
|
|
6824
|
-
inherit: ["direction-[inherit]"],
|
|
6825
|
-
initial: ["direction-[initial]"],
|
|
6826
|
-
revert: ["direction-[revert]"],
|
|
6827
|
-
"revert-layer": ["direction-[revert-layer]"],
|
|
6828
|
-
unset: ["direction-[unset]"]
|
|
6829
|
-
},
|
|
6830
|
-
wrap: {
|
|
6831
|
-
nowrap: ["flex-nowrap"],
|
|
6832
|
-
wrap: ["flex-wrap"],
|
|
6833
|
-
"wrap-reverse": ["flex-wrap-reverse"],
|
|
6834
|
-
inherit: ["[flex-wrap:inherit]"],
|
|
6835
|
-
initial: ["[flex-wrap:initial]"],
|
|
6836
|
-
revert: ["[flex-wrap:revert]"],
|
|
6837
|
-
"revert-layer": ["[flex-wrap:revert-layer]"],
|
|
6838
|
-
unset: ["[flex-wrap:unset]"]
|
|
6839
|
-
},
|
|
6840
|
-
justify: {
|
|
6841
|
-
normal: ["justify-normal"],
|
|
6842
|
-
unsafe: ["[justify-content:unsafe]"],
|
|
6843
|
-
safe: ["[justify-content:safe]"],
|
|
6844
|
-
start: ["justify-start"],
|
|
6845
|
-
center: ["justify-center"],
|
|
6846
|
-
end: ["justify-end"],
|
|
6847
|
-
"flex-start": ["justify-start"],
|
|
6848
|
-
"flex-end": ["justify-end"],
|
|
6849
|
-
left: ["[justify-content:left]"],
|
|
6850
|
-
right: ["[justify-content:right]"],
|
|
6851
|
-
"space-between": ["justify-between"],
|
|
6852
|
-
"space-around": ["justify-around"],
|
|
6853
|
-
"space-evenly": ["justify-evenly"],
|
|
6854
|
-
stretch: ["justify-stretch"],
|
|
6855
|
-
inherit: ["[justify-content:inherit]"],
|
|
6856
|
-
initial: ["[justify-content:initial]"],
|
|
6857
|
-
revert: ["[justify-content:revert]"],
|
|
6858
|
-
"revert-layer": ["[justify-content:revert-layer]"],
|
|
6859
|
-
unset: ["[justify-content:unset]"]
|
|
6860
|
-
},
|
|
6861
|
-
align: {
|
|
6862
|
-
normal: ["[align-items:normal]"],
|
|
6863
|
-
unsafe: ["[align-items:unsafe]"],
|
|
6864
|
-
safe: ["[align-items:safe]"],
|
|
6865
|
-
center: ["items-center"],
|
|
6866
|
-
start: ["items-start"],
|
|
6867
|
-
end: ["items-end"],
|
|
6868
|
-
"self-start": ["[align-items:self-start]"],
|
|
6869
|
-
"self-end": ["[align-items:self-end]"],
|
|
6870
|
-
"flex-start": ["items-start"],
|
|
6871
|
-
"flex-end": ["items-end"],
|
|
6872
|
-
baseline: ["items-baseline"],
|
|
6873
|
-
"first baseline": ["[align-items:first baseline]"],
|
|
6874
|
-
"last baseline": ["[align-items:last baseline]"],
|
|
6875
|
-
stretch: ["items-stretch"],
|
|
6876
|
-
inherit: ["[align-items:inherit]"],
|
|
6877
|
-
initial: ["[align-items:initial]"],
|
|
6878
|
-
revert: ["[align-items:revert]"],
|
|
6879
|
-
"revert-layer": ["[align-items:revert-layer]"],
|
|
6880
|
-
unset: ["[align-items:unset]"]
|
|
6881
|
-
},
|
|
6882
|
-
gap: {
|
|
6883
|
-
0: ["gap-0.5"],
|
|
6884
|
-
1: ["gap-1"],
|
|
6885
|
-
2: ["gap-2"],
|
|
6886
|
-
3: ["gap-3"],
|
|
6887
|
-
4: ["gap-4"],
|
|
6888
|
-
24: ["gap-6"],
|
|
6889
|
-
5: ["gap-8"],
|
|
6890
|
-
6: ["gap-10"],
|
|
6891
|
-
7: ["gap-12"],
|
|
6892
|
-
8: ["gap-16"],
|
|
6893
|
-
9: ["gap-20"]
|
|
6894
|
-
}
|
|
6895
|
-
}
|
|
6896
|
-
}, { enableResponsiveVariants: true });
|
|
6897
|
-
Flex.displayName = "Flex";
|
|
6898
|
-
//#endregion
|
|
6899
6846
|
//#region src/components/form/Form.tsx
|
|
6900
6847
|
var Form = (props) => {
|
|
6901
6848
|
const { children, defaultValues, validationMode = "onBlur", onSubmit, onError, appearance, theme, ...rest } = props;
|
|
@@ -6903,13 +6850,14 @@ var Form = (props) => {
|
|
|
6903
6850
|
defaultValues,
|
|
6904
6851
|
mode: validationMode
|
|
6905
6852
|
});
|
|
6853
|
+
const customContextValue = react.useMemo(() => ({
|
|
6854
|
+
appearance,
|
|
6855
|
+
theme
|
|
6856
|
+
}), [appearance, theme]);
|
|
6906
6857
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_hook_form.FormProvider, {
|
|
6907
6858
|
...methods,
|
|
6908
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormCustomContext
|
|
6909
|
-
value:
|
|
6910
|
-
appearance,
|
|
6911
|
-
theme
|
|
6912
|
-
},
|
|
6859
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormCustomContext, {
|
|
6860
|
+
value: customContextValue,
|
|
6913
6861
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("form", {
|
|
6914
6862
|
"aria-label": "form",
|
|
6915
6863
|
onSubmit: methods.handleSubmit(onSubmit, onError),
|
|
@@ -6921,35 +6869,6 @@ var Form = (props) => {
|
|
|
6921
6869
|
};
|
|
6922
6870
|
Form.displayName = "Form";
|
|
6923
6871
|
//#endregion
|
|
6924
|
-
//#region src/components/grid/Grid.tsx
|
|
6925
|
-
var GridContainer = styled("div", {
|
|
6926
|
-
base: ["grid"],
|
|
6927
|
-
variants: { gap: {
|
|
6928
|
-
0: ["gap-0.5"],
|
|
6929
|
-
1: ["gap-1"],
|
|
6930
|
-
2: ["gap-2"],
|
|
6931
|
-
3: ["gap-3"],
|
|
6932
|
-
4: ["gap-4"],
|
|
6933
|
-
24: ["gap-6"],
|
|
6934
|
-
5: ["gap-8"],
|
|
6935
|
-
6: ["gap-10"],
|
|
6936
|
-
7: ["gap-12"],
|
|
6937
|
-
8: ["gap-16"],
|
|
6938
|
-
9: ["gap-20"]
|
|
6939
|
-
} }
|
|
6940
|
-
}, { enableResponsiveVariants: true });
|
|
6941
|
-
var Grid = ({ className, style, gap = "2", minItemSize, maxItemSize = "1fr", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GridContainer, {
|
|
6942
|
-
...rest,
|
|
6943
|
-
style: {
|
|
6944
|
-
...style,
|
|
6945
|
-
...minItemSize && { "--min-item-size": minItemSize },
|
|
6946
|
-
...maxItemSize && { "--max-item-size": maxItemSize }
|
|
6947
|
-
},
|
|
6948
|
-
gap,
|
|
6949
|
-
className: cn(minItemSize && ["grid-cols-[repeat(auto-fit,minmax(var(--min-item-size,0),var(--max-item-size,0)))]"], className)
|
|
6950
|
-
});
|
|
6951
|
-
Grid.displayName = "Grid";
|
|
6952
|
-
//#endregion
|
|
6953
6872
|
//#region src/components/input-field/InputField.tsx
|
|
6954
6873
|
var InputField = ({ className, label, name, validation, prompt, description, hideLabel, appearance, theme, ...rest }) => {
|
|
6955
6874
|
const { register } = (0, react_hook_form.useFormContext)();
|
|
@@ -7181,12 +7100,12 @@ var defaultComponentsMap = {
|
|
|
7181
7100
|
text: MarkdownText,
|
|
7182
7101
|
thematicBreak: MarkdownThematicBreak
|
|
7183
7102
|
};
|
|
7184
|
-
var generateNodeKey = (node) => {
|
|
7103
|
+
var generateNodeKey = (node, index) => {
|
|
7185
7104
|
if (node.position?.start) {
|
|
7186
7105
|
const { line, column, offset } = node.position.start;
|
|
7187
7106
|
return `${node.type}${line}${column}${offset}`;
|
|
7188
7107
|
}
|
|
7189
|
-
return `${node.type}${
|
|
7108
|
+
return `${node.type}${index}`;
|
|
7190
7109
|
};
|
|
7191
7110
|
var MarkdownContent = ({ content, customComponents = {}, className }) => {
|
|
7192
7111
|
const AST = (0, mdast_util_from_markdown.default)(content, {
|
|
@@ -7197,12 +7116,12 @@ var MarkdownContent = ({ content, customComponents = {}, className }) => {
|
|
|
7197
7116
|
...defaultComponentsMap,
|
|
7198
7117
|
...customComponents
|
|
7199
7118
|
};
|
|
7200
|
-
const handleNode = (node) => {
|
|
7119
|
+
const handleNode = (node, index = 0) => {
|
|
7201
7120
|
const MarkdownComponent = componentsMap[node.type];
|
|
7202
7121
|
return MarkdownComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkdownComponent, {
|
|
7203
7122
|
node,
|
|
7204
7123
|
handleNode
|
|
7205
|
-
}, generateNodeKey(node)) : null;
|
|
7124
|
+
}, generateNodeKey(node, index)) : null;
|
|
7206
7125
|
};
|
|
7207
7126
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMarkdownContent, {
|
|
7208
7127
|
className,
|
|
@@ -7233,7 +7152,7 @@ var colorSchemes$2 = { light: {
|
|
|
7233
7152
|
//#region src/components/navigation/NavigationMenu.context.tsx
|
|
7234
7153
|
var NavigationMenuContext = react.createContext(void 0);
|
|
7235
7154
|
var useNavigationMenuContext = () => {
|
|
7236
|
-
const context = react.
|
|
7155
|
+
const context = react.use(NavigationMenuContext);
|
|
7237
7156
|
if (context === void 0) throw new Error("useNavigationMenuContext must be used within a NavigationMenuContextProvider");
|
|
7238
7157
|
return context;
|
|
7239
7158
|
};
|
|
@@ -7431,10 +7350,10 @@ var ViewportPosition = styled("div", { base: [
|
|
|
7431
7350
|
var NavigationMenuComponent = ({ children, className, ...rest }) => {
|
|
7432
7351
|
const [offset, setOffset] = react.useState();
|
|
7433
7352
|
const [activeItem, setActiveItem] = react.useState();
|
|
7434
|
-
const [listWidth, setListWidth] = react.useState(0);
|
|
7435
7353
|
const listRef = react.useRef(null);
|
|
7354
|
+
const listWidthRef = react.useRef(0);
|
|
7436
7355
|
react.useLayoutEffect(() => {
|
|
7437
|
-
if (listRef.current)
|
|
7356
|
+
if (listRef.current) listWidthRef.current = listRef.current.offsetWidth;
|
|
7438
7357
|
}, [react.Children.toArray(children).length]);
|
|
7439
7358
|
react.useEffect(() => {
|
|
7440
7359
|
let timer;
|
|
@@ -7443,16 +7362,17 @@ var NavigationMenuComponent = ({ children, className, ...rest }) => {
|
|
|
7443
7362
|
if (timer !== null) clearTimeout(timer);
|
|
7444
7363
|
};
|
|
7445
7364
|
}, [activeItem]);
|
|
7446
|
-
const onNodeUpdate = (trigger, itemValue) => {
|
|
7365
|
+
const onNodeUpdate = react.useCallback((trigger, itemValue) => {
|
|
7366
|
+
const listWidth = listWidthRef.current;
|
|
7447
7367
|
if (trigger && listWidth && activeItem === itemValue) {
|
|
7448
7368
|
const listCenter = listWidth / 2;
|
|
7449
7369
|
const triggerOffsetRight = listWidth - trigger.offsetLeft - trigger.offsetWidth + trigger.offsetWidth / 2;
|
|
7450
7370
|
setOffset(Math.round(listCenter - triggerOffsetRight));
|
|
7451
7371
|
}
|
|
7452
7372
|
return trigger;
|
|
7453
|
-
};
|
|
7454
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuContext
|
|
7455
|
-
value: { onNodeUpdate },
|
|
7373
|
+
}, [activeItem]);
|
|
7374
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuContext, {
|
|
7375
|
+
value: react.useMemo(() => ({ onNodeUpdate }), [onNodeUpdate]),
|
|
7456
7376
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledMenu, {
|
|
7457
7377
|
className: cn(className),
|
|
7458
7378
|
style: colorSchemes$2["light"],
|
|
@@ -7500,11 +7420,11 @@ var NavigationMenuVerticalItem = (props) => /* @__PURE__ */ (0, react_jsx_runtim
|
|
|
7500
7420
|
var NavigationMenuVerticalAccordionContext = react.createContext({});
|
|
7501
7421
|
var NavigationMenuVerticalAccordionProvider = ({ children }) => {
|
|
7502
7422
|
const [triggerRef, setTriggerRef] = useCallbackRef();
|
|
7503
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuVerticalAccordionContext
|
|
7504
|
-
value: {
|
|
7423
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuVerticalAccordionContext, {
|
|
7424
|
+
value: react.useMemo(() => ({
|
|
7505
7425
|
triggerRef,
|
|
7506
7426
|
setTriggerRef
|
|
7507
|
-
},
|
|
7427
|
+
}), [triggerRef, setTriggerRef]),
|
|
7508
7428
|
children
|
|
7509
7429
|
});
|
|
7510
7430
|
};
|
|
@@ -7523,7 +7443,7 @@ var NavigationMenuVerticalList = styled(_radix_ui_react_navigation_menu.List, {
|
|
|
7523
7443
|
//#region src/components/navigation-menu-vertical/NavigationMenuVerticalAccordionContent.tsx
|
|
7524
7444
|
var StyledNavigationMenuVerticalAccordionContent = _radix_ui_react_collapsible.Content;
|
|
7525
7445
|
var NavigationMenuVerticalAccordionContent = ({ children, ...rest }) => {
|
|
7526
|
-
const { triggerRef } = react.
|
|
7446
|
+
const { triggerRef } = react.use(NavigationMenuVerticalAccordionContext);
|
|
7527
7447
|
const handleOnKeydown = (e) => {
|
|
7528
7448
|
if (!triggerRef?.current) return;
|
|
7529
7449
|
if (e.key === "Escape") {
|
|
@@ -7581,7 +7501,7 @@ var NavigationMenuVerticalIcon = (props) => /* @__PURE__ */ (0, react_jsx_runtim
|
|
|
7581
7501
|
//#endregion
|
|
7582
7502
|
//#region src/components/side-bar/SideBar.context.tsx
|
|
7583
7503
|
var SideBarContext = react.createContext({ isExpanded: void 0 });
|
|
7584
|
-
var useSidebarState = () => react.
|
|
7504
|
+
var useSidebarState = () => react.use(SideBarContext);
|
|
7585
7505
|
//#endregion
|
|
7586
7506
|
//#region src/components/navigation-menu-vertical/NavigationMenuVerticalText.tsx
|
|
7587
7507
|
var StyledNavigationMenuVerticalText = styled(Text, {
|
|
@@ -7634,7 +7554,7 @@ var StyledIcon = styled(Icon, { base: [
|
|
|
7634
7554
|
"[[data-state=open]>&]:rotate-180"
|
|
7635
7555
|
] });
|
|
7636
7556
|
var NavigationMenuVerticalAccordionTrigger = ({ children, ...rest }) => {
|
|
7637
|
-
const { setTriggerRef } = react.
|
|
7557
|
+
const { setTriggerRef } = react.use(NavigationMenuVerticalAccordionContext);
|
|
7638
7558
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_navigation_menu.Link, {
|
|
7639
7559
|
asChild: true,
|
|
7640
7560
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledNavigationMenuVerticalAccordionTrigger, {
|
|
@@ -7816,13 +7736,11 @@ var NumberInputContainer = styled("div", {
|
|
|
7816
7736
|
}
|
|
7817
7737
|
});
|
|
7818
7738
|
var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max = Number.MAX_SAFE_INTEGER, step = 1, disabled: isDisabled = false, readonly: isReadOnly = false, size = "md", stepperButtonLabels: stepperButtonLabelsProp, disabledTooltipContent: disabledTooltipContentProp, className, appearance = "standard", theme, emphasis, ...rest }) => {
|
|
7819
|
-
const [internalValue, setInternalValue] = react.useState(value
|
|
7820
|
-
|
|
7821
|
-
if (typeof value !== "undefined") setInternalValue(value);
|
|
7822
|
-
}, [value]);
|
|
7739
|
+
const [internalValue, setInternalValue] = react.useState(value ?? defaultValue);
|
|
7740
|
+
const currentValue = value ?? internalValue;
|
|
7823
7741
|
const inputRef = react.useRef(null);
|
|
7824
|
-
|
|
7825
|
-
const iconSize =
|
|
7742
|
+
const composedInputRef = (0, _radix_ui_react_compose_refs.useComposedRefs)(ref, inputRef);
|
|
7743
|
+
const iconSize = getFieldIconSize(size);
|
|
7826
7744
|
const stepperButtonLabels = {
|
|
7827
7745
|
increment: "increment",
|
|
7828
7746
|
decrement: "decrement",
|
|
@@ -7833,8 +7751,8 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7833
7751
|
increment: `Cannot enter values above ${max}`,
|
|
7834
7752
|
...disabledTooltipContentProp
|
|
7835
7753
|
};
|
|
7836
|
-
const isAtMax =
|
|
7837
|
-
const isAtMin =
|
|
7754
|
+
const isAtMax = currentValue >= max;
|
|
7755
|
+
const isAtMin = currentValue <= min;
|
|
7838
7756
|
const clamp = react.useCallback((internalValue) => Math.min(Math.max(internalValue, min), max), [max, min]);
|
|
7839
7757
|
const updateValue = react.useCallback((newValue) => {
|
|
7840
7758
|
onValueChange?.(newValue);
|
|
@@ -7846,19 +7764,19 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7846
7764
|
const increment = react.useCallback(() => {
|
|
7847
7765
|
if (isAtMax || isReadOnly) return;
|
|
7848
7766
|
inputRef?.current?.focus();
|
|
7849
|
-
updateValue(clamp(Number(
|
|
7767
|
+
updateValue(clamp(Number(currentValue) + step));
|
|
7850
7768
|
}, [
|
|
7851
7769
|
clamp,
|
|
7852
7770
|
isAtMax,
|
|
7853
7771
|
isReadOnly,
|
|
7854
7772
|
step,
|
|
7855
7773
|
updateValue,
|
|
7856
|
-
|
|
7774
|
+
currentValue
|
|
7857
7775
|
]);
|
|
7858
7776
|
const decrement = react.useCallback(() => {
|
|
7859
7777
|
if (isAtMin || isReadOnly) return;
|
|
7860
7778
|
inputRef?.current?.focus();
|
|
7861
|
-
updateValue(clamp(Number(
|
|
7779
|
+
updateValue(clamp(Number(currentValue) - step));
|
|
7862
7780
|
}, [
|
|
7863
7781
|
clamp,
|
|
7864
7782
|
isAtMin,
|
|
@@ -7866,7 +7784,7 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7866
7784
|
min,
|
|
7867
7785
|
step,
|
|
7868
7786
|
updateValue,
|
|
7869
|
-
|
|
7787
|
+
currentValue
|
|
7870
7788
|
]);
|
|
7871
7789
|
const onKeyDown = react.useCallback((event) => {
|
|
7872
7790
|
if (event.nativeEvent.isComposing) return;
|
|
@@ -7898,11 +7816,11 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7898
7816
|
min,
|
|
7899
7817
|
max
|
|
7900
7818
|
]);
|
|
7901
|
-
const hasError =
|
|
7819
|
+
const hasError = currentValue < min || currentValue > max;
|
|
7902
7820
|
const { state: externalState, "aria-invalid": externalAriaInvalid, ...restProps } = rest;
|
|
7903
7821
|
const inputProps = {
|
|
7904
7822
|
type: "number",
|
|
7905
|
-
value:
|
|
7823
|
+
value: currentValue,
|
|
7906
7824
|
...restProps,
|
|
7907
7825
|
onChange: onInputChange,
|
|
7908
7826
|
onKeyDown,
|
|
@@ -7922,12 +7840,12 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7922
7840
|
"focus-within:border-2",
|
|
7923
7841
|
"focus-within:border-blue-800"
|
|
7924
7842
|
]),
|
|
7925
|
-
ref:
|
|
7843
|
+
ref: composedInputRef,
|
|
7926
7844
|
readOnly: isReadOnly,
|
|
7927
7845
|
disabled: isDisabled,
|
|
7928
7846
|
"aria-valuemin": min,
|
|
7929
7847
|
"aria-valuemax": max,
|
|
7930
|
-
"aria-valuenow":
|
|
7848
|
+
"aria-valuenow": currentValue,
|
|
7931
7849
|
role: "spinbutton"
|
|
7932
7850
|
};
|
|
7933
7851
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NumberInputContainer, {
|
|
@@ -7968,7 +7886,7 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7968
7886
|
//#endregion
|
|
7969
7887
|
//#region src/components/number-input-field/NumberInputField.tsx
|
|
7970
7888
|
var NumberInputField = ({ className, defaultValue = 0, hideLabel, value, prompt, description, label, name, validation, onValueChange, appearance, theme, ...rest }) => {
|
|
7971
|
-
const { control } = (0, react_hook_form.useFormContext)();
|
|
7889
|
+
const { control, setValue } = (0, react_hook_form.useFormContext)();
|
|
7972
7890
|
const context = useFormCustomContext();
|
|
7973
7891
|
const { field: { ref, onChange, value: innerValue, name: innerName } } = (0, react_hook_form.useController)({
|
|
7974
7892
|
name,
|
|
@@ -7980,8 +7898,12 @@ var NumberInputField = ({ className, defaultValue = 0, hideLabel, value, prompt,
|
|
|
7980
7898
|
const formAppearance = context?.appearance || appearance;
|
|
7981
7899
|
const formTheme = context?.theme ?? theme;
|
|
7982
7900
|
react.useEffect(() => {
|
|
7983
|
-
if (typeof value !== "undefined")
|
|
7984
|
-
}, [
|
|
7901
|
+
if (typeof value !== "undefined") setValue(name, value, { shouldDirty: false });
|
|
7902
|
+
}, [
|
|
7903
|
+
value,
|
|
7904
|
+
name,
|
|
7905
|
+
setValue
|
|
7906
|
+
]);
|
|
7985
7907
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
|
|
7986
7908
|
className,
|
|
7987
7909
|
description,
|
|
@@ -8090,7 +8012,7 @@ var Fieldset = styled("fieldset", { base: [
|
|
|
8090
8012
|
"min-w-0"
|
|
8091
8013
|
] });
|
|
8092
8014
|
var RadioButtonFieldComponent = ({ children, className, direction = "column", defaultValue, value, description, label, name, validation, onValueChange, ...rest }) => {
|
|
8093
|
-
const { control } = (0, react_hook_form.useFormContext)();
|
|
8015
|
+
const { control, setValue } = (0, react_hook_form.useFormContext)();
|
|
8094
8016
|
const { field: { ref, onChange, value: innerValue } } = (0, react_hook_form.useController)({
|
|
8095
8017
|
name,
|
|
8096
8018
|
control,
|
|
@@ -8099,8 +8021,12 @@ var RadioButtonFieldComponent = ({ children, className, direction = "column", de
|
|
|
8099
8021
|
});
|
|
8100
8022
|
const { error } = useFieldError(name);
|
|
8101
8023
|
react.useEffect(() => {
|
|
8102
|
-
if (typeof value !== "undefined")
|
|
8103
|
-
}, [
|
|
8024
|
+
if (typeof value !== "undefined") setValue(name, value, { shouldDirty: false });
|
|
8025
|
+
}, [
|
|
8026
|
+
value,
|
|
8027
|
+
name,
|
|
8028
|
+
setValue
|
|
8029
|
+
]);
|
|
8104
8030
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Fieldset, {
|
|
8105
8031
|
className,
|
|
8106
8032
|
children: [
|
|
@@ -8276,26 +8202,25 @@ var SectionMessageContext = react.createContext(null);
|
|
|
8276
8202
|
var SectionMessageProvider = ({ theme = "info", children }) => {
|
|
8277
8203
|
const [hasIcon, setHasIcon] = react.useState(false);
|
|
8278
8204
|
const [hasDismiss, setHasDismiss] = react.useState(false);
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
value,
|
|
8205
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionMessageContext, {
|
|
8206
|
+
value: react.useMemo(() => ({
|
|
8207
|
+
theme,
|
|
8208
|
+
hasIcon,
|
|
8209
|
+
setHasIcon,
|
|
8210
|
+
hasDismiss,
|
|
8211
|
+
setHasDismiss
|
|
8212
|
+
}), [
|
|
8213
|
+
theme,
|
|
8214
|
+
hasIcon,
|
|
8215
|
+
setHasIcon,
|
|
8216
|
+
hasDismiss,
|
|
8217
|
+
setHasDismiss
|
|
8218
|
+
]),
|
|
8294
8219
|
children
|
|
8295
8220
|
});
|
|
8296
8221
|
};
|
|
8297
8222
|
var useSectionMessageContext = () => {
|
|
8298
|
-
const context = react.
|
|
8223
|
+
const context = react.use(SectionMessageContext);
|
|
8299
8224
|
if (!context) throw new Error("useSectionMessageContext must be used within a SectionMessageProvider");
|
|
8300
8225
|
return context;
|
|
8301
8226
|
};
|
|
@@ -8575,7 +8500,7 @@ var SelectMenuContext = react.createContext({
|
|
|
8575
8500
|
size: "md",
|
|
8576
8501
|
theme: "grey"
|
|
8577
8502
|
});
|
|
8578
|
-
var useSelectMenuContext = () => react.
|
|
8503
|
+
var useSelectMenuContext = () => react.use(SelectMenuContext);
|
|
8579
8504
|
//#endregion
|
|
8580
8505
|
//#region src/components/select-menu/SelectMenuContent.tsx
|
|
8581
8506
|
var Content$2 = styled(_radix_ui_react_select.Content, {
|
|
@@ -8798,17 +8723,23 @@ var SelectMenuTrigger = ({ ref, placeholder, children, ...rest }) => {
|
|
|
8798
8723
|
};
|
|
8799
8724
|
//#endregion
|
|
8800
8725
|
//#region src/components/select-menu/SelectMenu.tsx
|
|
8801
|
-
var SelectMenuRoot = ({ size = "md", theme = "grey", state, children, ...rest }) =>
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8726
|
+
var SelectMenuRoot = ({ size = "md", theme = "grey", state, children, ...rest }) => {
|
|
8727
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectMenuContext, {
|
|
8728
|
+
value: react.useMemo(() => ({
|
|
8729
|
+
size,
|
|
8730
|
+
theme,
|
|
8731
|
+
state
|
|
8732
|
+
}), [
|
|
8733
|
+
size,
|
|
8734
|
+
theme,
|
|
8735
|
+
state
|
|
8736
|
+
]),
|
|
8737
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_select.Root, {
|
|
8738
|
+
...rest,
|
|
8739
|
+
children
|
|
8740
|
+
})
|
|
8741
|
+
});
|
|
8742
|
+
};
|
|
8812
8743
|
var SelectMenu = /* @__PURE__ */ Object.assign(SelectMenuRoot, {
|
|
8813
8744
|
Trigger: SelectMenuTrigger,
|
|
8814
8745
|
Content: SelectMenuContent,
|
|
@@ -8969,8 +8900,8 @@ var SideBarComponent = ({ theme, className, children, type = "expandable", offse
|
|
|
8969
8900
|
...touchProps,
|
|
8970
8901
|
ref
|
|
8971
8902
|
} : {};
|
|
8972
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SideBarContext
|
|
8973
|
-
value: { isExpanded },
|
|
8903
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SideBarContext, {
|
|
8904
|
+
value: react.useMemo(() => ({ isExpanded }), [isExpanded]),
|
|
8974
8905
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Theme, {
|
|
8975
8906
|
theme: theme || light$1,
|
|
8976
8907
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$2, {
|
|
@@ -9106,16 +9037,21 @@ var Slider = /* @__PURE__ */ Object.assign(SliderComponent, {
|
|
|
9106
9037
|
//#endregion
|
|
9107
9038
|
//#region src/components/slider-field/SliderField.tsx
|
|
9108
9039
|
var SliderField = ({ className, hideLabel, label, name, defaultValue, value, validation, outputLabel, min = 0, max = 100, steps = [], ...rest }) => {
|
|
9109
|
-
const { control } = (0, react_hook_form.useFormContext)();
|
|
9040
|
+
const { control, setValue } = (0, react_hook_form.useFormContext)();
|
|
9110
9041
|
const { field: { ref, onChange, value: innerValue, name: innerName } } = (0, react_hook_form.useController)({
|
|
9111
9042
|
name,
|
|
9112
9043
|
control,
|
|
9113
9044
|
rules: validation,
|
|
9114
9045
|
defaultValue
|
|
9115
9046
|
});
|
|
9047
|
+
const serializedValue = JSON.stringify(value);
|
|
9116
9048
|
react.useEffect(() => {
|
|
9117
|
-
if (value
|
|
9118
|
-
}, [
|
|
9049
|
+
if (typeof value !== "undefined") setValue(name, value, { shouldDirty: false });
|
|
9050
|
+
}, [
|
|
9051
|
+
serializedValue,
|
|
9052
|
+
name,
|
|
9053
|
+
setValue
|
|
9054
|
+
]);
|
|
9119
9055
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
|
|
9120
9056
|
className,
|
|
9121
9057
|
fieldId: name,
|
|
@@ -9370,43 +9306,37 @@ var Spacer = styled("div", { base: [
|
|
|
9370
9306
|
Spacer.displayName = "Spacer";
|
|
9371
9307
|
//#endregion
|
|
9372
9308
|
//#region src/components/stepper/Stepper.context.tsx
|
|
9373
|
-
var StepperContext = react.createContext(
|
|
9374
|
-
steps: [],
|
|
9375
|
-
goToPreviousStep: () => null,
|
|
9376
|
-
goToNextStep: () => null,
|
|
9377
|
-
goToStep: () => null,
|
|
9378
|
-
activeStep: 0,
|
|
9379
|
-
viewedSteps: [],
|
|
9380
|
-
allowSkip: false,
|
|
9381
|
-
direction: "horizontal",
|
|
9382
|
-
hideLabels: false,
|
|
9383
|
-
completedSteps: [],
|
|
9384
|
-
showCompletedIcons: false
|
|
9385
|
-
});
|
|
9309
|
+
var StepperContext = react.createContext(null);
|
|
9386
9310
|
var StepperProvider = ({ children, stepCount, allowSkip, onComplete, onStepChange, direction, steps, hideLabels, showCompletedIcons }) => {
|
|
9387
9311
|
const [activeStep, setActiveStep] = react.useState(0);
|
|
9388
9312
|
const [viewedSteps, setviewedSteps] = react.useState([0]);
|
|
9389
9313
|
const [completedSteps, setCompletedSteps] = react.useState([]);
|
|
9390
9314
|
const isControlled = !stepCount;
|
|
9391
|
-
react.
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9315
|
+
const changeStep = react.useCallback((nextStep) => {
|
|
9316
|
+
setActiveStep(nextStep);
|
|
9317
|
+
setviewedSteps((prev) => prev.includes(nextStep) ? prev : [...prev, nextStep]);
|
|
9318
|
+
onStepChange?.(nextStep);
|
|
9319
|
+
}, [onStepChange]);
|
|
9320
|
+
const goToNextStep = react.useCallback(() => {
|
|
9396
9321
|
const isCompleted = onComplete && activeStep === stepCount - 1;
|
|
9397
9322
|
const isNextStep = activeStep < stepCount - 1;
|
|
9398
9323
|
if (onComplete || isNextStep) setCompletedSteps((prev) => prev.includes(activeStep) ? prev : [...prev, activeStep]);
|
|
9399
9324
|
if (isCompleted) return onComplete?.();
|
|
9400
|
-
if (isNextStep) return
|
|
9401
|
-
}
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9325
|
+
if (isNextStep) return changeStep(activeStep + 1);
|
|
9326
|
+
}, [
|
|
9327
|
+
activeStep,
|
|
9328
|
+
stepCount,
|
|
9329
|
+
onComplete,
|
|
9330
|
+
changeStep
|
|
9331
|
+
]);
|
|
9332
|
+
const goToPreviousStep = react.useCallback(() => {
|
|
9333
|
+
changeStep(activeStep - 1);
|
|
9334
|
+
}, [activeStep, changeStep]);
|
|
9335
|
+
const goToStep = react.useCallback((index) => {
|
|
9336
|
+
changeStep(index);
|
|
9337
|
+
}, [changeStep]);
|
|
9338
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StepperContext, {
|
|
9339
|
+
value: react.useMemo(() => ({
|
|
9410
9340
|
steps: steps || Array(stepCount).fill(""),
|
|
9411
9341
|
goToPreviousStep: isControlled ? void 0 : goToPreviousStep,
|
|
9412
9342
|
goToNextStep: isControlled ? void 0 : goToNextStep,
|
|
@@ -9418,12 +9348,26 @@ var StepperProvider = ({ children, stepCount, allowSkip, onComplete, onStepChang
|
|
|
9418
9348
|
direction,
|
|
9419
9349
|
hideLabels,
|
|
9420
9350
|
showCompletedIcons
|
|
9421
|
-
},
|
|
9351
|
+
}), [
|
|
9352
|
+
steps,
|
|
9353
|
+
stepCount,
|
|
9354
|
+
isControlled,
|
|
9355
|
+
goToPreviousStep,
|
|
9356
|
+
goToNextStep,
|
|
9357
|
+
goToStep,
|
|
9358
|
+
activeStep,
|
|
9359
|
+
viewedSteps,
|
|
9360
|
+
completedSteps,
|
|
9361
|
+
allowSkip,
|
|
9362
|
+
direction,
|
|
9363
|
+
hideLabels,
|
|
9364
|
+
showCompletedIcons
|
|
9365
|
+
]),
|
|
9422
9366
|
children
|
|
9423
9367
|
});
|
|
9424
9368
|
};
|
|
9425
9369
|
var useStepper = () => {
|
|
9426
|
-
const context = react.
|
|
9370
|
+
const context = react.use(StepperContext);
|
|
9427
9371
|
if (!context) throw new Error("Ensure that you wrap any components with the root component Stepper");
|
|
9428
9372
|
return context;
|
|
9429
9373
|
};
|
|
@@ -9809,30 +9753,35 @@ var TabsTrigger = ({ ref, children, ...rest }) => /* @__PURE__ */ (0, react_jsx_
|
|
|
9809
9753
|
});
|
|
9810
9754
|
//#endregion
|
|
9811
9755
|
//#region src/utilities/hooks/useScrollPosition.ts
|
|
9756
|
+
var NO_ELEMENT_SNAPSHOT = {
|
|
9757
|
+
left: 0,
|
|
9758
|
+
top: 0
|
|
9759
|
+
};
|
|
9812
9760
|
var useScrollPosition = ({ element, delay = 500, delayMethod = "throttle" }) => {
|
|
9813
|
-
const
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
const delayMethodFn = (0, react.useMemo)(() => delayMethod === "debounce" ? throttle_debounce.debounce : throttle_debounce.throttle, [delayMethod]);
|
|
9818
|
-
(0, react.useEffect)(() => {
|
|
9819
|
-
if (!element) return;
|
|
9820
|
-
const handleScroll = delayMethodFn(delay, () => {
|
|
9821
|
-
setScrollPosition((prev) => prev.left === element.scrollLeft && prev.top === element.scrollTop ? prev : {
|
|
9822
|
-
left: element.scrollLeft,
|
|
9823
|
-
top: element.scrollTop
|
|
9824
|
-
});
|
|
9825
|
-
});
|
|
9761
|
+
const snapshotRef = (0, react.useRef)(null);
|
|
9762
|
+
const subscribe = (0, react.useCallback)((onStoreChange) => {
|
|
9763
|
+
if (!element) return () => void 0;
|
|
9764
|
+
const handleScroll = (delayMethod === "debounce" ? throttle_debounce.debounce : throttle_debounce.throttle)(delay, onStoreChange);
|
|
9826
9765
|
element.addEventListener("scroll", handleScroll);
|
|
9827
9766
|
return () => {
|
|
9767
|
+
handleScroll.cancel();
|
|
9828
9768
|
element.removeEventListener("scroll", handleScroll);
|
|
9829
9769
|
};
|
|
9830
9770
|
}, [
|
|
9831
9771
|
element,
|
|
9832
|
-
|
|
9833
|
-
|
|
9772
|
+
delay,
|
|
9773
|
+
delayMethod
|
|
9834
9774
|
]);
|
|
9835
|
-
|
|
9775
|
+
const getSnapshot = () => {
|
|
9776
|
+
if (!element) return NO_ELEMENT_SNAPSHOT;
|
|
9777
|
+
const prev = snapshotRef.current;
|
|
9778
|
+
if (!prev || prev.left !== element.scrollLeft || prev.top !== element.scrollTop) snapshotRef.current = {
|
|
9779
|
+
left: element.scrollLeft,
|
|
9780
|
+
top: element.scrollTop
|
|
9781
|
+
};
|
|
9782
|
+
return snapshotRef.current;
|
|
9783
|
+
};
|
|
9784
|
+
return (0, react.useSyncExternalStore)(subscribe, getSnapshot, () => NO_ELEMENT_SNAPSHOT);
|
|
9836
9785
|
};
|
|
9837
9786
|
//#endregion
|
|
9838
9787
|
//#region src/utilities/hooks/useSize.ts
|
|
@@ -10143,7 +10092,7 @@ TileToggleGroup.Item = TileToggleGroupItem;
|
|
|
10143
10092
|
//#region src/components/toast/Toast.context.tsx
|
|
10144
10093
|
var ToastContext = react.createContext(null);
|
|
10145
10094
|
var useToastContext = () => {
|
|
10146
|
-
const context = react.
|
|
10095
|
+
const context = react.use(ToastContext);
|
|
10147
10096
|
if (!context) throw new Error("useToastContext must be used within a ToastProvider");
|
|
10148
10097
|
return context;
|
|
10149
10098
|
};
|
|
@@ -10212,9 +10161,9 @@ var Toast$1 = /* @__PURE__ */ Object.assign(ToastComponent, {
|
|
|
10212
10161
|
var ToastProviderBase = /* @__PURE__ */ styled("div", { base: [
|
|
10213
10162
|
"fixed",
|
|
10214
10163
|
"z-2147483647",
|
|
10215
|
-
"inset-2",
|
|
10164
|
+
"inset-safe-offset-2",
|
|
10216
10165
|
"pointer-events-none",
|
|
10217
|
-
"sm:top-3"
|
|
10166
|
+
"sm:top-safe-offset-3"
|
|
10218
10167
|
] });
|
|
10219
10168
|
var ToastWrapper = /* @__PURE__ */ styled("div", {
|
|
10220
10169
|
base: [
|
|
@@ -10257,7 +10206,7 @@ var ToastProvider = ({ children, className }) => {
|
|
|
10257
10206
|
"aria-live": toast.ariaProps["aria-live"],
|
|
10258
10207
|
style: { "--offset": `${offset}px` },
|
|
10259
10208
|
className: "top-(--offset)",
|
|
10260
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToastContext
|
|
10209
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToastContext, {
|
|
10261
10210
|
value: toast,
|
|
10262
10211
|
children: typeof children === "function" ? children(toast) : react.isValidElement(children) ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Toast$1, {
|
|
10263
10212
|
className: "w-100",
|
|
@@ -10554,25 +10503,29 @@ var ToggleGroup = {
|
|
|
10554
10503
|
};
|
|
10555
10504
|
//#endregion
|
|
10556
10505
|
//#region src/utilities/hooks/useWindowScrollPosition.ts
|
|
10506
|
+
var SERVER_SNAPSHOT = {
|
|
10507
|
+
x: 0,
|
|
10508
|
+
y: 0
|
|
10509
|
+
};
|
|
10557
10510
|
var useWindowScrollPosition = ({ delay = 500, delayMethod = "throttle" } = {}) => {
|
|
10558
|
-
const
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
});
|
|
10562
|
-
const delayMethodFn = (0, react.useMemo)(() => delayMethod === "debounce" ? throttle_debounce.debounce : throttle_debounce.throttle, [delayMethod]);
|
|
10563
|
-
(0, react.useEffect)(() => {
|
|
10564
|
-
const handleScroll = delayMethodFn(delay, () => {
|
|
10565
|
-
setScrollPosition({
|
|
10566
|
-
x: window.scrollX,
|
|
10567
|
-
y: window.scrollY
|
|
10568
|
-
});
|
|
10569
|
-
});
|
|
10511
|
+
const snapshotRef = (0, react.useRef)(null);
|
|
10512
|
+
const subscribe = (0, react.useCallback)((onStoreChange) => {
|
|
10513
|
+
const handleScroll = (delayMethod === "debounce" ? throttle_debounce.debounce : throttle_debounce.throttle)(delay, onStoreChange);
|
|
10570
10514
|
window.addEventListener("scroll", handleScroll);
|
|
10571
10515
|
return () => {
|
|
10516
|
+
handleScroll.cancel();
|
|
10572
10517
|
window.removeEventListener("scroll", handleScroll);
|
|
10573
10518
|
};
|
|
10574
|
-
}, [
|
|
10575
|
-
|
|
10519
|
+
}, [delay, delayMethod]);
|
|
10520
|
+
const getSnapshot = () => {
|
|
10521
|
+
const prev = snapshotRef.current;
|
|
10522
|
+
if (!prev || prev.x !== window.scrollX || prev.y !== window.scrollY) snapshotRef.current = {
|
|
10523
|
+
x: window.scrollX,
|
|
10524
|
+
y: window.scrollY
|
|
10525
|
+
};
|
|
10526
|
+
return snapshotRef.current;
|
|
10527
|
+
};
|
|
10528
|
+
return (0, react.useSyncExternalStore)(subscribe, getSnapshot, () => SERVER_SNAPSHOT);
|
|
10576
10529
|
};
|
|
10577
10530
|
var colorSchemes = { light: {
|
|
10578
10531
|
"--background": "white",
|
|
@@ -10625,21 +10578,21 @@ var StyledRoot = styled("header", {
|
|
|
10625
10578
|
variants: {
|
|
10626
10579
|
hasScrolled: { true: ["shadow-[0px_4px_4px_-2px_rgba(31,31,31,0.1)]"] },
|
|
10627
10580
|
size: {
|
|
10628
|
-
md: ["h-16"],
|
|
10629
|
-
lg: ["h-24"]
|
|
10581
|
+
md: ["h-safe-offset-top-16", "pt-safe"],
|
|
10582
|
+
lg: ["h-safe-offset-top-24", "pt-safe"]
|
|
10630
10583
|
},
|
|
10631
10584
|
diffused: { true: ["supports-color-mix:bg-[color-mix(in_hsl,(--base-1)_70%,transparent)]", "supports-color-mix:backdrop-blur-sm"] },
|
|
10632
10585
|
appearance: {
|
|
10633
10586
|
standard: [
|
|
10634
10587
|
"w-screen",
|
|
10635
10588
|
"max-w-full",
|
|
10636
|
-
"top-
|
|
10589
|
+
"top-safe",
|
|
10637
10590
|
"border-b",
|
|
10638
10591
|
"border-b-(--border-bottom)"
|
|
10639
10592
|
],
|
|
10640
10593
|
rounded: [
|
|
10641
10594
|
"w-full",
|
|
10642
|
-
"top-2",
|
|
10595
|
+
"top-safe-offset-2",
|
|
10643
10596
|
"p-2",
|
|
10644
10597
|
"border",
|
|
10645
10598
|
"border-white",
|
|
@@ -10698,8 +10651,6 @@ var Video = ({ ref, id, ratio = 9 / 16, className, ...rest }) => /* @__PURE__ */
|
|
|
10698
10651
|
//#endregion
|
|
10699
10652
|
//#region src/components/keyboard-shortcut/KeyboardShortcut.tsx
|
|
10700
10653
|
var KeyboardShortcut$1 = ({ ref, asChild, config, targetWindow = false, onKeyDown, ...rest }) => {
|
|
10701
|
-
const [targetElRef, setTargetElRef] = useCallbackRefState();
|
|
10702
|
-
react.useImperativeHandle(ref, () => targetElRef);
|
|
10703
10654
|
const handleOnKeydown = react.useCallback((e) => {
|
|
10704
10655
|
config.forEach(({ shortcut, action }) => {
|
|
10705
10656
|
if (Object.entries(shortcut).every(([key, value]) => e[key] === value)) action({
|
|
@@ -10709,15 +10660,21 @@ var KeyboardShortcut$1 = ({ ref, asChild, config, targetWindow = false, onKeyDow
|
|
|
10709
10660
|
});
|
|
10710
10661
|
onKeyDown?.(e);
|
|
10711
10662
|
}, [config, onKeyDown]);
|
|
10663
|
+
const handleOnKeydownRef = react.useRef(handleOnKeydown);
|
|
10664
|
+
react.useLayoutEffect(() => {
|
|
10665
|
+
handleOnKeydownRef.current = handleOnKeydown;
|
|
10666
|
+
});
|
|
10712
10667
|
react.useEffect(() => {
|
|
10713
|
-
if (targetWindow)
|
|
10668
|
+
if (!targetWindow) return;
|
|
10669
|
+
const listener = (e) => handleOnKeydownRef.current(e);
|
|
10670
|
+
window.addEventListener("keydown", listener);
|
|
10714
10671
|
return () => {
|
|
10715
|
-
window.removeEventListener("keydown",
|
|
10672
|
+
window.removeEventListener("keydown", listener);
|
|
10716
10673
|
};
|
|
10717
|
-
}, [targetWindow
|
|
10674
|
+
}, [targetWindow]);
|
|
10718
10675
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "div", {
|
|
10719
10676
|
onKeyDown: targetWindow ? void 0 : handleOnKeydown,
|
|
10720
|
-
ref
|
|
10677
|
+
ref,
|
|
10721
10678
|
...rest
|
|
10722
10679
|
});
|
|
10723
10680
|
};
|
|
@@ -10763,7 +10720,7 @@ var badgeSizeMap = {
|
|
|
10763
10720
|
lg: "sm"
|
|
10764
10721
|
};
|
|
10765
10722
|
var SegmentedControlBadge = ({ className, ...rest }) => {
|
|
10766
|
-
const { size } = react.
|
|
10723
|
+
const { size } = react.use(SegmentedControlContext);
|
|
10767
10724
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
|
|
10768
10725
|
...rest,
|
|
10769
10726
|
size: badgeSizeMap[size],
|
|
@@ -10788,7 +10745,7 @@ var StyledText = styled(Text, {
|
|
|
10788
10745
|
} }
|
|
10789
10746
|
}, { enableResponsiveVariants: true });
|
|
10790
10747
|
var SegmentedControlDescription = (props) => {
|
|
10791
|
-
const { size } = react.
|
|
10748
|
+
const { size } = react.use(SegmentedControlContext);
|
|
10792
10749
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledText, {
|
|
10793
10750
|
...props,
|
|
10794
10751
|
size
|
|
@@ -10805,7 +10762,7 @@ var StyledHeading = styled(Text, {
|
|
|
10805
10762
|
} }
|
|
10806
10763
|
}, { enableResponsiveVariants: true });
|
|
10807
10764
|
var SegmentedControlHeading = (props) => {
|
|
10808
|
-
const { size } = react.
|
|
10765
|
+
const { size } = react.use(SegmentedControlContext);
|
|
10809
10766
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledHeading, {
|
|
10810
10767
|
...props,
|
|
10811
10768
|
size
|
|
@@ -10819,7 +10776,7 @@ var sizeMap = {
|
|
|
10819
10776
|
lg: "md"
|
|
10820
10777
|
};
|
|
10821
10778
|
var SegmentedControlIcon = (props) => {
|
|
10822
|
-
const { size } = react.
|
|
10779
|
+
const { size } = react.use(SegmentedControlContext);
|
|
10823
10780
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
10824
10781
|
...props,
|
|
10825
10782
|
size: sizeMap[size]
|
|
@@ -10887,7 +10844,7 @@ var StyledItem = styled(_radix_ui_react_tabs.Trigger, {
|
|
|
10887
10844
|
}
|
|
10888
10845
|
}, { enableResponsiveVariants: true });
|
|
10889
10846
|
var SegmentedControlItem = ({ ref, children, ...rest }) => {
|
|
10890
|
-
const { size, theme } = react.
|
|
10847
|
+
const { size, theme } = react.use(SegmentedControlContext);
|
|
10891
10848
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledItem, {
|
|
10892
10849
|
...rest,
|
|
10893
10850
|
theme,
|
|
@@ -10928,7 +10885,7 @@ var SelectionIndicator = styled("div", {
|
|
|
10928
10885
|
} }
|
|
10929
10886
|
});
|
|
10930
10887
|
var SegmentedControlItemList = (props) => {
|
|
10931
|
-
const { theme, defaultValue, value } = react.
|
|
10888
|
+
const { theme, defaultValue, value } = react.use(SegmentedControlContext);
|
|
10932
10889
|
const tabsRef = react.useRef([]);
|
|
10933
10890
|
const selectedIndex = react.Children.toArray(props.children).findIndex((child) => child?.props.value === value);
|
|
10934
10891
|
const [indicatorStyles, setIndicatorStyles] = react.useState({
|
|
@@ -10947,26 +10904,28 @@ var SegmentedControlItemList = (props) => {
|
|
|
10947
10904
|
width: Math.round(width)
|
|
10948
10905
|
});
|
|
10949
10906
|
}, [selectedIndex]);
|
|
10907
|
+
const updateIndicatorPositionRef = react.useRef(updateIndicatorPosition);
|
|
10908
|
+
react.useLayoutEffect(() => {
|
|
10909
|
+
updateIndicatorPositionRef.current = updateIndicatorPosition;
|
|
10910
|
+
});
|
|
10911
|
+
const tabCount = react.Children.count(props.children);
|
|
10950
10912
|
react.useEffect(() => {
|
|
10951
|
-
const resizeObserver = new ResizeObserver(
|
|
10952
|
-
|
|
10953
|
-
currentTabs.forEach((tab) => {
|
|
10913
|
+
const resizeObserver = new ResizeObserver(() => updateIndicatorPositionRef.current());
|
|
10914
|
+
tabsRef.current.forEach((tab) => {
|
|
10954
10915
|
if (tab) resizeObserver.observe(tab);
|
|
10955
10916
|
});
|
|
10956
10917
|
return () => {
|
|
10957
|
-
currentTabs.forEach((tab) => {
|
|
10958
|
-
if (tab) resizeObserver.unobserve(tab);
|
|
10959
|
-
});
|
|
10960
10918
|
resizeObserver.disconnect();
|
|
10961
10919
|
};
|
|
10962
|
-
}, [
|
|
10920
|
+
}, [tabCount]);
|
|
10963
10921
|
react.useEffect(() => {
|
|
10964
|
-
|
|
10922
|
+
const handleResize = () => updateIndicatorPositionRef.current();
|
|
10923
|
+
window.addEventListener("resize", handleResize);
|
|
10965
10924
|
return () => {
|
|
10966
|
-
window.removeEventListener("resize",
|
|
10925
|
+
window.removeEventListener("resize", handleResize);
|
|
10967
10926
|
};
|
|
10968
|
-
}, [
|
|
10969
|
-
react.
|
|
10927
|
+
}, []);
|
|
10928
|
+
react.useLayoutEffect(() => {
|
|
10970
10929
|
updateIndicatorPosition();
|
|
10971
10930
|
}, [selectedIndex, updateIndicatorPosition]);
|
|
10972
10931
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledTriggerList, {
|
|
@@ -10983,9 +10942,12 @@ var SegmentedControlItemList = (props) => {
|
|
|
10983
10942
|
setHasInteracted(true);
|
|
10984
10943
|
if (child.props.onClick) child.props.onClick(e);
|
|
10985
10944
|
},
|
|
10986
|
-
ref: (el) => {
|
|
10945
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(child.props.ref, (el) => {
|
|
10987
10946
|
tabsRef.current[index] = el;
|
|
10988
|
-
|
|
10947
|
+
return () => {
|
|
10948
|
+
tabsRef.current[index] = null;
|
|
10949
|
+
};
|
|
10950
|
+
})
|
|
10989
10951
|
});
|
|
10990
10952
|
})]
|
|
10991
10953
|
});
|
|
@@ -11004,25 +10966,24 @@ var SegmentedControlRoot = ({ size, theme = "primary", defaultValue, children, v
|
|
|
11004
10966
|
const isControlled = value !== void 0;
|
|
11005
10967
|
const [internalValue, setInternalValue] = react.useState(defaultValue);
|
|
11006
10968
|
const currentValue = isControlled ? value : internalValue;
|
|
11007
|
-
const handleValueChange =
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
}, [
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
value: contextValue,
|
|
10969
|
+
const handleValueChange = react.useCallback((newValue) => {
|
|
10970
|
+
if (!isControlled) setInternalValue(newValue);
|
|
10971
|
+
onValueChange?.(newValue);
|
|
10972
|
+
}, [isControlled, onValueChange]);
|
|
10973
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentedControlContext, {
|
|
10974
|
+
value: react.useMemo(() => ({
|
|
10975
|
+
size,
|
|
10976
|
+
theme,
|
|
10977
|
+
defaultValue,
|
|
10978
|
+
onValueChange: handleValueChange,
|
|
10979
|
+
value: currentValue
|
|
10980
|
+
}), [
|
|
10981
|
+
size,
|
|
10982
|
+
theme,
|
|
10983
|
+
defaultValue,
|
|
10984
|
+
handleValueChange,
|
|
10985
|
+
currentValue
|
|
10986
|
+
]),
|
|
11026
10987
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSegmentedControlRoot, {
|
|
11027
10988
|
size,
|
|
11028
10989
|
value: currentValue,
|
|
@@ -11085,11 +11046,11 @@ var FileDrop = ({ children, accept, multiple, onDrop, ...rest }) => {
|
|
|
11085
11046
|
const handleKeyDown = (event) => {
|
|
11086
11047
|
if (["Space", "Enter"].includes(event.key)) fileUploadInputRef.current?.click();
|
|
11087
11048
|
};
|
|
11088
|
-
const value = {
|
|
11049
|
+
const value = react.useMemo(() => ({
|
|
11089
11050
|
isDragging,
|
|
11090
11051
|
files
|
|
11091
|
-
};
|
|
11092
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileDropContext
|
|
11052
|
+
}), [isDragging, files]);
|
|
11053
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileDropContext, {
|
|
11093
11054
|
value,
|
|
11094
11055
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContainer, {
|
|
11095
11056
|
onDragOver: handleDragOver,
|
|
@@ -11119,7 +11080,7 @@ var FileDrop = ({ children, accept, multiple, onDrop, ...rest }) => {
|
|
|
11119
11080
|
FileDrop.displayName = "FileDrop";
|
|
11120
11081
|
//#endregion
|
|
11121
11082
|
//#region src/components/file-drop/useFileDrop.ts
|
|
11122
|
-
var useFileDrop = () => react.
|
|
11083
|
+
var useFileDrop = () => react.use(FileDropContext);
|
|
11123
11084
|
//#endregion
|
|
11124
11085
|
//#region src/components/index.ts
|
|
11125
11086
|
var Alert = { Provider: AlertProvider };
|
|
@@ -11132,7 +11093,6 @@ exports.Avatar = Avatar;
|
|
|
11132
11093
|
exports.Badge = Badge;
|
|
11133
11094
|
exports.BannerRegular = BannerRegular;
|
|
11134
11095
|
exports.BannerSlim = BannerSlim;
|
|
11135
|
-
exports.Box = Box;
|
|
11136
11096
|
exports.Button = Button;
|
|
11137
11097
|
exports.Carousel = Carousel;
|
|
11138
11098
|
exports.Checkbox = Checkbox;
|
|
@@ -11159,9 +11119,7 @@ exports.EmptyState = EmptyState;
|
|
|
11159
11119
|
exports.FieldWrapper = FieldWrapper;
|
|
11160
11120
|
exports.FileDrop = FileDrop;
|
|
11161
11121
|
exports.FileInput = FileInput;
|
|
11162
|
-
exports.Flex = Flex;
|
|
11163
11122
|
exports.Form = Form;
|
|
11164
|
-
exports.Grid = Grid;
|
|
11165
11123
|
exports.Heading = Heading;
|
|
11166
11124
|
exports.Icon = Icon;
|
|
11167
11125
|
exports.Image = Image;
|