@atom-learning/components 9.0.0 → 10.0.1
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/accordion/Accordion.js +1 -1
- package/dist/components/accordion/AccordionContent.js +1 -1
- package/dist/components/accordion/AccordionItem.js +1 -1
- package/dist/components/accordion/AccordionTrigger.js +2 -2
- package/dist/components/action-icon/ActionIcon.js +1 -1
- package/dist/components/alert-dialog/Alert.d.ts +3 -0
- package/dist/components/alert-dialog/Alert.js +7 -0
- package/dist/components/alert-dialog/Alert.js.map +1 -0
- 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/AlertDialog.js +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/calendar/Calendar.d.ts +1 -1
- package/dist/components/calendar/Calendar.js +6 -4
- 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/CheckboxGroup.d.ts +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 +3 -7
- 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/DataTableHeaderCell.js +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/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/file-input/FileInput.js +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 +1 -3
- package/dist/components/inline-message/InlineMessage.js +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 +9 -9
- package/dist/components/markdown-content/MarkdownContent.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownEmphasis.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownEmphasis.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownHeading.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownHeading.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownLink.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownLink.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownList.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownList.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownListItem.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownListItem.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownParagraph.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownParagraph.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownStrong.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownStrong.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 +8 -7
- 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 +14 -18
- 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/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/tabs/TabsTriggerList.js +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 +1 -1
- package/dist/components/toast/ToastProvider.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 +1299 -1244
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +7 -7
- 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 +39 -35
- package/dist/components/index.js +0 -102
- package/dist/components/index.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -30,21 +30,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
enumerable: true
|
|
31
31
|
}) : target, mod));
|
|
32
32
|
//#endregion
|
|
33
|
+
let _radix_ui_react_accordion = require("@radix-ui/react-accordion");
|
|
33
34
|
let react = require("react");
|
|
34
35
|
react = __toESM(react, 1);
|
|
36
|
+
let _radix_ui_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
35
37
|
let clsx = require("clsx");
|
|
36
38
|
clsx = __toESM(clsx, 1);
|
|
37
39
|
let tailwind_merge = require("tailwind-merge");
|
|
38
40
|
let tailwind_variants = require("tailwind-variants");
|
|
39
41
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
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
|
-
let _radix_ui_react_accordion = require("@radix-ui/react-accordion");
|
|
44
43
|
let _radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
45
44
|
let invariant = require("invariant");
|
|
46
45
|
invariant = __toESM(invariant, 1);
|
|
47
46
|
let _radix_ui_react_tooltip = require("@radix-ui/react-tooltip");
|
|
47
|
+
let _radix_ui_react_alert_dialog = require("@radix-ui/react-alert-dialog");
|
|
48
48
|
let throttle_debounce = require("throttle-debounce");
|
|
49
49
|
let embla_carousel_react = require("embla-carousel-react");
|
|
50
50
|
embla_carousel_react = __toESM(embla_carousel_react, 1);
|
|
@@ -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");
|
|
@@ -74,11 +73,8 @@ let dayzed = require("dayzed");
|
|
|
74
73
|
let _radix_ui_react_dialog = require("@radix-ui/react-dialog");
|
|
75
74
|
let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
76
75
|
let mdast_util_directive = require("mdast-util-directive");
|
|
77
|
-
mdast_util_directive = __toESM(mdast_util_directive, 1);
|
|
78
76
|
let mdast_util_from_markdown = require("mdast-util-from-markdown");
|
|
79
|
-
mdast_util_from_markdown = __toESM(mdast_util_from_markdown, 1);
|
|
80
77
|
let micromark_extension_directive = require("micromark-extension-directive");
|
|
81
|
-
micromark_extension_directive = __toESM(micromark_extension_directive, 1);
|
|
82
78
|
let _radix_ui_react_navigation_menu = require("@radix-ui/react-navigation-menu");
|
|
83
79
|
_radix_ui_react_navigation_menu = __toESM(_radix_ui_react_navigation_menu, 1);
|
|
84
80
|
let _radix_ui_react_progress = require("@radix-ui/react-progress");
|
|
@@ -92,18 +88,6 @@ let _radix_ui_react_tabs = require("@radix-ui/react-tabs");
|
|
|
92
88
|
let react_hot_toast = require("react-hot-toast");
|
|
93
89
|
let react_player_vimeo_js = require("react-player/vimeo.js");
|
|
94
90
|
react_player_vimeo_js = __toESM(react_player_vimeo_js, 1);
|
|
95
|
-
//#region src/utilities/hooks/useIsMountedRef.ts
|
|
96
|
-
var useIsMountedRef = () => {
|
|
97
|
-
const isMountedRef = (0, react.useRef)(void 0);
|
|
98
|
-
(0, react.useEffect)(() => {
|
|
99
|
-
isMountedRef.current = true;
|
|
100
|
-
return () => {
|
|
101
|
-
isMountedRef.current = false;
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
return isMountedRef;
|
|
105
|
-
};
|
|
106
|
-
//#endregion
|
|
107
91
|
//#region src/styled.tsx
|
|
108
92
|
tailwind_variants.defaultConfig.twMerge = false;
|
|
109
93
|
var isArbitraryNumber = (value) => /^\[[\d.]+\]$/.test(value) || !Number.isNaN(Number(value));
|
|
@@ -212,7 +196,10 @@ function styled(el, styles, options) {
|
|
|
212
196
|
as: props.as || element.props.as,
|
|
213
197
|
className: finalClassName
|
|
214
198
|
};
|
|
215
|
-
if (ref)
|
|
199
|
+
if (ref) {
|
|
200
|
+
const existingRef = element.props.ref;
|
|
201
|
+
cloneProps.ref = existingRef ? (0, _radix_ui_react_compose_refs.composeRefs)(existingRef, ref) : ref;
|
|
202
|
+
}
|
|
216
203
|
return react.default.cloneElement(element, cloneProps);
|
|
217
204
|
}
|
|
218
205
|
throw Error("Something is wrong");
|
|
@@ -223,169 +210,650 @@ function styled(el, styles, options) {
|
|
|
223
210
|
return Comp;
|
|
224
211
|
}
|
|
225
212
|
//#endregion
|
|
226
|
-
//#region src/utilities/
|
|
227
|
-
var
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
213
|
+
//#region src/utilities/css-wrapper/CSSWrapper.tsx
|
|
214
|
+
var CSSWrapper = ({ className, children }) => className ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
215
|
+
className,
|
|
216
|
+
children
|
|
217
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
218
|
+
CSSWrapper.displayName = "CSSWrapper";
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/components/accordion/AccordionContent.tsx
|
|
221
|
+
var StyledContent$4 = styled(_radix_ui_react_accordion.Content, { base: [
|
|
222
|
+
"border-none",
|
|
223
|
+
"w-full",
|
|
224
|
+
"bg-(--base-1)",
|
|
225
|
+
"overflow-hidden",
|
|
226
|
+
"data-[state=open]:rounded-b-sm",
|
|
227
|
+
"data-[state=open]:rounded-t-none",
|
|
228
|
+
"motion-safe:data-[state=open]:animate-accordion-open",
|
|
229
|
+
"motion-safe:data-[state=closed]:animate-accordion-close"
|
|
230
|
+
] });
|
|
231
|
+
var AccordionContent = ({ children, className, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledContent$4, {
|
|
232
|
+
...rest,
|
|
233
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CSSWrapper, {
|
|
234
|
+
className,
|
|
235
|
+
children
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/components/accordion/AccordionItem.tsx
|
|
240
|
+
var AccordionItem = styled(_radix_ui_react_accordion.Item, { base: ["w-full", "not-last:mb-1"] }, { enablePolymorphism: false });
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/experiments/color-scheme/ColorScheme.config.ts
|
|
243
|
+
var generateColors = ({ prefix, colorName, color0 = "" }) => {
|
|
244
|
+
const colors = {};
|
|
245
|
+
let i = 1;
|
|
246
|
+
if (color0) {
|
|
247
|
+
colors[`--${prefix}-${i}`] = `var(--color-${color0})`;
|
|
248
|
+
i++;
|
|
249
|
+
}
|
|
250
|
+
let k = 1;
|
|
251
|
+
for (; i <= 11; i++) {
|
|
252
|
+
colors[`--${prefix}-${i}`] = `var(--color-${colorName}-${k * 100})`;
|
|
253
|
+
k++;
|
|
254
|
+
}
|
|
255
|
+
return colors;
|
|
232
256
|
};
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
257
|
+
var colorSchemes$4 = {};
|
|
258
|
+
colorSchemes$4["interactive-loContrast"] = {
|
|
259
|
+
"--interactive-foreground": "var(--foreground)",
|
|
260
|
+
"--interactive-1": "var(--accent-1)",
|
|
261
|
+
"--interactive-2": "var(--accent-2)",
|
|
262
|
+
"--interactive-3": "var(--accent-3)"
|
|
263
|
+
};
|
|
264
|
+
colorSchemes$4["interactive-hiContrast"] = {
|
|
265
|
+
"--interactive-foreground": "var(--foreground-7-plus)",
|
|
266
|
+
"--interactive-1": "var(--accent-9)",
|
|
267
|
+
"--interactive-2": "var(--accent-10)",
|
|
268
|
+
"--interactive-3": "var(--accent-11)"
|
|
269
|
+
};
|
|
270
|
+
var colorNames = [
|
|
271
|
+
"primary",
|
|
272
|
+
"grey",
|
|
273
|
+
"blue",
|
|
274
|
+
"pink",
|
|
275
|
+
"purple",
|
|
276
|
+
"cyan",
|
|
277
|
+
"green",
|
|
278
|
+
"magenta",
|
|
279
|
+
"red",
|
|
280
|
+
"teal",
|
|
281
|
+
"orange",
|
|
282
|
+
"yellow",
|
|
283
|
+
"lime"
|
|
284
|
+
];
|
|
285
|
+
var createVariants = () => Object.fromEntries(colorNames.flatMap((c) => [[`${c}1`, {
|
|
286
|
+
colorName: c,
|
|
287
|
+
color0: "white"
|
|
288
|
+
}], [`${c}2`, { colorName: c }]]));
|
|
289
|
+
var bases = createVariants();
|
|
290
|
+
var accents = bases;
|
|
291
|
+
(() => {
|
|
292
|
+
Object.entries(bases).forEach(([name, config]) => {
|
|
293
|
+
const themeName = `base-${name}`;
|
|
294
|
+
colorSchemes$4[themeName] = {
|
|
295
|
+
"--foreground": "var(--color-grey-1000)",
|
|
296
|
+
"--foreground-7-plus": "var(--color-white)",
|
|
297
|
+
...generateColors({
|
|
298
|
+
prefix: "base",
|
|
299
|
+
colorName: config.colorName,
|
|
300
|
+
color0: config.color0
|
|
301
|
+
})
|
|
302
|
+
};
|
|
303
|
+
});
|
|
304
|
+
Object.entries(accents).forEach(([name, config]) => {
|
|
305
|
+
colorSchemes$4[`accent-${name}`] = generateColors({
|
|
306
|
+
prefix: "accent",
|
|
307
|
+
colorName: config.colorName,
|
|
308
|
+
color0: config.color0
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
})();
|
|
237
312
|
//#endregion
|
|
238
|
-
//#region src/
|
|
239
|
-
|
|
313
|
+
//#region src/experiments/color-scheme/ColorScheme.tsx
|
|
314
|
+
/**
|
|
315
|
+
* @experimental Component has not been finalised. Further design input required. Use with caution.
|
|
316
|
+
*/
|
|
317
|
+
var ColorScheme = ({ ref, base = "", accent = "", interactive, asChild = false, ...rest }) => {
|
|
318
|
+
const Component = asChild ? _radix_ui_react_slot.Slot : "div";
|
|
319
|
+
const style = {
|
|
320
|
+
...interactive && colorSchemes$4[`interactive-${interactive}`],
|
|
321
|
+
...accent && colorSchemes$4[`accent-${accent}`],
|
|
322
|
+
...base && colorSchemes$4[`base-${base}`]
|
|
323
|
+
};
|
|
324
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
325
|
+
...rest,
|
|
326
|
+
ref,
|
|
327
|
+
style
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/components/icon/Icon.tsx
|
|
332
|
+
var StyledIcon$3 = styled("svg", {
|
|
240
333
|
base: [
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
334
|
+
"inline-block",
|
|
335
|
+
"fill-none",
|
|
336
|
+
"shrink-0",
|
|
337
|
+
"stroke-current",
|
|
338
|
+
"[stroke-linecap:round]",
|
|
339
|
+
"[stroke-linejoin:round]",
|
|
340
|
+
"align-middle"
|
|
247
341
|
],
|
|
248
342
|
variants: { size: {
|
|
249
|
-
sm: ["size-
|
|
250
|
-
md: ["size-
|
|
251
|
-
lg: ["size-
|
|
343
|
+
sm: ["size-4", "stroke-[1.5]"],
|
|
344
|
+
md: ["size-6", "stroke-[1.75]"],
|
|
345
|
+
lg: ["size-8", "stroke-2"]
|
|
252
346
|
} }
|
|
253
|
-
});
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
|
|
347
|
+
}, { enableResponsiveVariants: true });
|
|
348
|
+
var Icon = ({ ref, is: SVG, size = "md", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIcon$3, {
|
|
349
|
+
size,
|
|
350
|
+
"aria-hidden": "true",
|
|
257
351
|
...rest,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
className: "sr-only",
|
|
261
|
-
children: message
|
|
262
|
-
}),
|
|
263
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot$1, { size }),
|
|
264
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot$1, { size }),
|
|
265
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot$1, { size })
|
|
266
|
-
]
|
|
352
|
+
as: SVG,
|
|
353
|
+
ref
|
|
267
354
|
});
|
|
268
355
|
//#endregion
|
|
269
|
-
//#region src/components/
|
|
270
|
-
var
|
|
356
|
+
//#region src/components/accordion/AccordionTrigger.tsx
|
|
357
|
+
var RotatingIcon = styled(Icon, { base: [
|
|
358
|
+
"transition-transform",
|
|
359
|
+
"duration-300",
|
|
360
|
+
"[[data-state=open]>&]:rotate-180",
|
|
361
|
+
"[[data-state=closed]>&]:rotate-0"
|
|
362
|
+
] });
|
|
363
|
+
var StyledTrigger$1 = styled(_radix_ui_react_accordion.Trigger, {
|
|
271
364
|
base: [
|
|
365
|
+
"border-none",
|
|
366
|
+
"py-3",
|
|
367
|
+
"px-4",
|
|
368
|
+
"w-full",
|
|
369
|
+
"flex",
|
|
370
|
+
"justify-between",
|
|
272
371
|
"items-center",
|
|
273
|
-
"bg-[unset]",
|
|
274
|
-
"rounded-md",
|
|
275
372
|
"cursor-pointer",
|
|
276
|
-
"
|
|
277
|
-
"
|
|
278
|
-
"font-semibold",
|
|
279
|
-
"justify-center",
|
|
280
|
-
"no-underline",
|
|
281
|
-
"transition-all",
|
|
282
|
-
"duration-100",
|
|
283
|
-
"ease-out",
|
|
284
|
-
"whitespace-nowrap",
|
|
285
|
-
"w-max",
|
|
373
|
+
"bg-(--interactive-2)",
|
|
374
|
+
"text-(--interactive-foreground)",
|
|
286
375
|
"disabled:cursor-not-allowed",
|
|
287
|
-
"disabled:opacity-30"
|
|
376
|
+
"disabled:opacity-30",
|
|
377
|
+
"not-disabled:active:bg-(--interactive-3)",
|
|
378
|
+
"not-disabled:focus-visible:bg-(--interactive-3)",
|
|
379
|
+
"not-disabled:focus-visible:outline-none",
|
|
380
|
+
"not-disabled:focus-visible:relative",
|
|
381
|
+
"not-disabled:focus-visible:shadow-[var(--color-primary-800)_0px_0px_0px_4px]",
|
|
382
|
+
"not-disabled:focus-visible:shadow-[white_0px_0px_0px_2px]",
|
|
383
|
+
"not-disabled:focus-visible:z-1",
|
|
384
|
+
"not-disabled:hover:bg-(--interactive-3)",
|
|
385
|
+
"data-[state=open]:rounded-b-none",
|
|
386
|
+
"data-[state=open]:rounded-t-sm",
|
|
387
|
+
"data-[state=closed]:rounded-sm"
|
|
288
388
|
],
|
|
289
|
-
variants: {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
389
|
+
variants: { arrowPosition: {
|
|
390
|
+
left: [
|
|
391
|
+
"flex-row-reverse",
|
|
392
|
+
"gap-2",
|
|
393
|
+
"justify-end"
|
|
394
|
+
],
|
|
395
|
+
right: []
|
|
396
|
+
} }
|
|
397
|
+
});
|
|
398
|
+
var AccordionTrigger = ({ children, colorScheme = {}, asChild, arrowPosition = "right", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorScheme, {
|
|
399
|
+
asChild: true,
|
|
400
|
+
accent: "grey1",
|
|
401
|
+
interactive: "loContrast",
|
|
402
|
+
...colorScheme,
|
|
403
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledTrigger$1, {
|
|
404
|
+
asChild,
|
|
405
|
+
arrowPosition,
|
|
406
|
+
...rest,
|
|
407
|
+
children: asChild ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RotatingIcon, {
|
|
408
|
+
is: _atom_learning_icons.ChevronDown,
|
|
409
|
+
"data-testid": "accordion-chevron"
|
|
410
|
+
})] })
|
|
411
|
+
})
|
|
412
|
+
});
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/components/accordion/Accordion.tsx
|
|
415
|
+
var AccordionBase = ({ ref, type = "single", className, children, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_accordion.Root, {
|
|
416
|
+
ref,
|
|
417
|
+
type,
|
|
418
|
+
className: cn("w-full", className),
|
|
419
|
+
...rest,
|
|
420
|
+
children
|
|
421
|
+
});
|
|
422
|
+
var Accordion = /* @__PURE__ */ Object.assign(AccordionBase, {
|
|
423
|
+
Item: AccordionItem,
|
|
424
|
+
Content: AccordionContent,
|
|
425
|
+
Trigger: AccordionTrigger
|
|
426
|
+
});
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/components/tooltip/TooltipContent.tsx
|
|
429
|
+
var StyledContent$3 = styled(_radix_ui_react_tooltip.Content, {
|
|
430
|
+
base: [
|
|
431
|
+
"bg-grey-900",
|
|
432
|
+
"rounded-sm",
|
|
433
|
+
"shadow-sm",
|
|
434
|
+
"text-white",
|
|
435
|
+
"font-body",
|
|
436
|
+
"text-sm",
|
|
437
|
+
"leading-normal",
|
|
438
|
+
"whitespace-normal",
|
|
439
|
+
"px-3",
|
|
440
|
+
"py-2",
|
|
441
|
+
"z-10",
|
|
442
|
+
"will-change-transform",
|
|
443
|
+
"will-change-[opacity]",
|
|
444
|
+
"[--slide-opacity-out:0]",
|
|
445
|
+
"data-[side=top]:[--slide-direction-out-y:-4px]",
|
|
446
|
+
"data-[side=right]:[--slide-direction-out-x:4px]",
|
|
447
|
+
"data-[side=bottom]:[--slide-direction-out-y:4px]",
|
|
448
|
+
"data-[side=left]:[--slide-direction-out-x:-4px]",
|
|
449
|
+
"motion-safe:data-[state=delayed-open]:animate-slide-direction-in",
|
|
450
|
+
"motion-safe:data-[state=closed]:animate-slide-direction-out"
|
|
451
|
+
],
|
|
452
|
+
variants: { size: {
|
|
453
|
+
sm: ["max-w-25"],
|
|
454
|
+
md: ["max-w-[250px]"],
|
|
455
|
+
lg: ["max-w-100"]
|
|
456
|
+
} }
|
|
457
|
+
});
|
|
458
|
+
var StyledArrow$1 = styled(_radix_ui_react_tooltip.Arrow, { base: [
|
|
459
|
+
"fill-grey-900",
|
|
460
|
+
"in-data-[align=end]:mr-2",
|
|
461
|
+
"in-data-[align=start]:ml-2"
|
|
462
|
+
] });
|
|
463
|
+
var TooltipContent = ({ children, side = "top", sideOffset = 4, size = "md", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContent$3, {
|
|
464
|
+
side,
|
|
465
|
+
sideOffset,
|
|
466
|
+
size,
|
|
467
|
+
...rest,
|
|
468
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArrow$1, {})]
|
|
469
|
+
});
|
|
470
|
+
//#endregion
|
|
471
|
+
//#region src/components/tooltip/Tooltip.tsx
|
|
472
|
+
var TooltipComponent = ({ children, delayDuration = 350, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Root, {
|
|
473
|
+
delayDuration,
|
|
474
|
+
...rest,
|
|
475
|
+
children
|
|
476
|
+
});
|
|
477
|
+
var Tooltip = /* @__PURE__ */ Object.assign(TooltipComponent, {
|
|
478
|
+
Content: TooltipContent,
|
|
479
|
+
Trigger: _radix_ui_react_tooltip.Trigger,
|
|
480
|
+
Portal: _radix_ui_react_tooltip.Portal,
|
|
481
|
+
Provider: _radix_ui_react_tooltip.Provider
|
|
482
|
+
});
|
|
483
|
+
TooltipComponent.displayName = "Tooltip";
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/utilities/optional-tooltip-wrapper/OptionalTooltipWrapper.tsx
|
|
486
|
+
var OptionalTooltipWrapper = ({ hasTooltip, label, tooltipSide, children }) => {
|
|
487
|
+
if (hasTooltip) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip.Trigger, {
|
|
488
|
+
asChild: true,
|
|
489
|
+
onFocus: (e) => {
|
|
490
|
+
if (!e.currentTarget.matches(":focus-visible")) e.preventDefault();
|
|
491
|
+
},
|
|
492
|
+
children
|
|
493
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip.Content, {
|
|
494
|
+
side: tooltipSide,
|
|
495
|
+
children: label
|
|
496
|
+
})] });
|
|
497
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
498
|
+
};
|
|
499
|
+
OptionalTooltipWrapper.displayName = "OptionalTooltipWrapper";
|
|
500
|
+
//#endregion
|
|
501
|
+
//#region src/utilities/uri/index.ts
|
|
502
|
+
var isExternalUrl = (url) => !!url && /^https?:\/\//.test(url);
|
|
503
|
+
var getExternalAnchorProps = (url) => isExternalUrl(url) ? {
|
|
504
|
+
target: "_blank",
|
|
505
|
+
rel: "noopener noreferrer"
|
|
506
|
+
} : {};
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region src/components/action-icon/ActionIcon.constants.ts
|
|
509
|
+
var ActionIconSizeMap = {
|
|
510
|
+
xs: "sm",
|
|
511
|
+
sm: "sm",
|
|
512
|
+
md: "md",
|
|
513
|
+
lg: "lg"
|
|
514
|
+
};
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region src/components/action-icon/ActionIcon.tsx
|
|
517
|
+
var StyledButton$5 = styled("button", {
|
|
518
|
+
base: [
|
|
519
|
+
"items-center",
|
|
520
|
+
"appearance-none",
|
|
521
|
+
"bg-white",
|
|
522
|
+
"rounded-md",
|
|
523
|
+
"box-border",
|
|
524
|
+
"cursor-pointer",
|
|
525
|
+
"flex",
|
|
526
|
+
"shrink-0",
|
|
527
|
+
"justify-center",
|
|
528
|
+
"transition-all",
|
|
529
|
+
"duration-100",
|
|
530
|
+
"ease-out",
|
|
531
|
+
"disabled:cursor-not-allowed",
|
|
532
|
+
"disabled:opacity-30"
|
|
533
|
+
],
|
|
534
|
+
variants: {
|
|
535
|
+
theme: {
|
|
536
|
+
neutral: [
|
|
537
|
+
"[--solid-base:var(--color-white)]",
|
|
538
|
+
"[--solid-interact:var(--color-grey-100)]",
|
|
539
|
+
"[--solid-active:var(--color-grey-200)]",
|
|
540
|
+
"[--solid-text:var(--color-grey-1200)]",
|
|
541
|
+
"[--base:var(--color-grey-700)]",
|
|
542
|
+
"[--interact:var(--color-primary-900)]",
|
|
543
|
+
"[--active:var(--color-primary-1100)]"
|
|
544
|
+
],
|
|
545
|
+
primary: [
|
|
546
|
+
"[--base:var(--color-primary-800)]",
|
|
547
|
+
"[--interact:var(--color-primary-900)]",
|
|
548
|
+
"[--active:var(--color-primary-1000)]"
|
|
549
|
+
],
|
|
550
|
+
primaryDark: [
|
|
551
|
+
"[--base:var(--color-primary-1000)]",
|
|
552
|
+
"[--interact:var(--color-primary-1100)]",
|
|
553
|
+
"[--active:var(--color-primary-1200)]"
|
|
554
|
+
],
|
|
555
|
+
success: [
|
|
556
|
+
"[--base:var(--color-success)]",
|
|
557
|
+
"[--interact:var(--color-success-mid)]",
|
|
558
|
+
"[--active:var(--color-success-dark)]"
|
|
559
|
+
],
|
|
560
|
+
warning: [
|
|
561
|
+
"[--base:var(--color-warning)]",
|
|
562
|
+
"[--interact:var(--color-warning-mid)]",
|
|
563
|
+
"[--active:var(--color-warning-dark)]"
|
|
564
|
+
],
|
|
565
|
+
danger: [
|
|
566
|
+
"[--base:var(--color-danger)]",
|
|
567
|
+
"[--interact:var(--color-danger-mid)]",
|
|
568
|
+
"[--active:var(--color-danger-dark)]"
|
|
569
|
+
],
|
|
570
|
+
white: [
|
|
571
|
+
"[--base:var(--color-white)]",
|
|
572
|
+
"[--interact:var(--color-white)]",
|
|
573
|
+
"[--active:var(--color-white)]"
|
|
322
574
|
]
|
|
323
575
|
},
|
|
324
576
|
appearance: {
|
|
325
|
-
|
|
326
|
-
"bg-
|
|
327
|
-
"text-(--
|
|
328
|
-
"disabled:
|
|
329
|
-
"disabled:
|
|
330
|
-
"not-disabled:
|
|
331
|
-
"not-disabled:hover:text-(--text,white)",
|
|
332
|
-
"not-disabled:focus:bg-(--interact)",
|
|
333
|
-
"not-disabled:focus:text-(--text,white)",
|
|
334
|
-
"not-disabled:active:bg-(--active)"
|
|
577
|
+
simple: [
|
|
578
|
+
"bg-transparent",
|
|
579
|
+
"text-(--base)",
|
|
580
|
+
"not-disabled:hover:text-(--interact)",
|
|
581
|
+
"not-disabled:focus:text-(--interact)",
|
|
582
|
+
"not-disabled:active:text-(--active)"
|
|
335
583
|
],
|
|
336
584
|
outline: [
|
|
585
|
+
"bg-[unset]",
|
|
337
586
|
"border",
|
|
338
587
|
"border-current",
|
|
339
588
|
"text-(--base)",
|
|
340
|
-
"disabled:opacity-30",
|
|
341
|
-
"disabled:cursor-not-allowed",
|
|
342
|
-
"not-disabled:hover:no-underline",
|
|
343
589
|
"not-disabled:hover:text-(--interact)",
|
|
344
|
-
"not-disabled:focus:no-underline",
|
|
345
590
|
"not-disabled:focus:text-(--interact)",
|
|
346
591
|
"not-disabled:active:text-(--active)"
|
|
592
|
+
],
|
|
593
|
+
solid: [
|
|
594
|
+
"bg-(--solid-base,var(--base))",
|
|
595
|
+
"text-(--solid-text,white)",
|
|
596
|
+
"not-disabled:hover:bg-(--solid-interact,var(--interact))",
|
|
597
|
+
"not-disabled:hover:text-(--solid-text,white)",
|
|
598
|
+
"not-disabled:focus:bg-(--solid-interact,var(--interact))",
|
|
599
|
+
"not-disabled:focus:text-(--solid-text,white)",
|
|
600
|
+
"not-disabled:active:bg-(--solid-active,var(--active))"
|
|
347
601
|
]
|
|
348
602
|
},
|
|
349
603
|
size: {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
"px-4",
|
|
355
|
-
"gap-2",
|
|
356
|
-
"[&_svg]:size-4"
|
|
357
|
-
],
|
|
358
|
-
md: [
|
|
359
|
-
"text-md",
|
|
360
|
-
"leading-normal",
|
|
361
|
-
"h-10",
|
|
362
|
-
"px-8",
|
|
363
|
-
"gap-3",
|
|
364
|
-
"[&_svg]:size-5"
|
|
365
|
-
],
|
|
366
|
-
lg: [
|
|
367
|
-
"text-lg",
|
|
368
|
-
"leading-normal",
|
|
369
|
-
"h-12",
|
|
370
|
-
"px-8",
|
|
371
|
-
"gap-3",
|
|
372
|
-
"[&_svg]:size-[22px]"
|
|
373
|
-
],
|
|
374
|
-
xl: [
|
|
375
|
-
"text-lg",
|
|
376
|
-
"leading-normal",
|
|
377
|
-
"h-16",
|
|
378
|
-
"px-8",
|
|
379
|
-
"gap-3",
|
|
380
|
-
"[&_svg]:size-[22px]"
|
|
381
|
-
]
|
|
604
|
+
xs: ["size-6"],
|
|
605
|
+
sm: ["size-8"],
|
|
606
|
+
md: ["size-10"],
|
|
607
|
+
lg: ["size-12"]
|
|
382
608
|
},
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
609
|
+
isRounded: { true: ["rounded-full"] }
|
|
610
|
+
}
|
|
611
|
+
}, { enableResponsiveVariants: true });
|
|
612
|
+
var ActionIcon = ({ ref, children, theme = "primary", appearance = "simple", size = "sm", label, href, disabled, hasTooltip = true, tooltipSide, ...rest }) => {
|
|
613
|
+
const INVALID_CHILDREN_MESSAGE = `A single ${Icon.name} component is permitted as a child of ActionIcon`;
|
|
614
|
+
(0, invariant.default)(react.Children.count(children) === 1, INVALID_CHILDREN_MESSAGE);
|
|
615
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OptionalTooltipWrapper, {
|
|
616
|
+
hasTooltip,
|
|
617
|
+
label,
|
|
618
|
+
tooltipSide,
|
|
619
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledButton$5, {
|
|
620
|
+
...href ? {
|
|
621
|
+
as: "a",
|
|
622
|
+
href: disabled ? void 0 : href,
|
|
623
|
+
onClick: void 0,
|
|
624
|
+
"aria-disabled": !!disabled
|
|
625
|
+
} : { type: "button" },
|
|
626
|
+
...getExternalAnchorProps(href),
|
|
627
|
+
...rest,
|
|
628
|
+
"aria-label": label,
|
|
629
|
+
theme,
|
|
630
|
+
appearance,
|
|
631
|
+
size,
|
|
632
|
+
ref,
|
|
633
|
+
disabled,
|
|
634
|
+
children: react.Children.map(children, (child) => {
|
|
635
|
+
if (!react.isValidElement(child)) throw new Error(INVALID_CHILDREN_MESSAGE);
|
|
636
|
+
(0, invariant.default)(child.type === Icon, `Children of type ${child?.type} aren't permitted. Only an ${Icon.name} component is allowed in ActionIcon`);
|
|
637
|
+
return react.cloneElement(child, { size: ActionIconSizeMap[size] });
|
|
638
|
+
})
|
|
639
|
+
})
|
|
640
|
+
});
|
|
641
|
+
};
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/components/alert-dialog/AlertDialogContent.tsx
|
|
644
|
+
var StyledAlertDialogOverlay = styled(_radix_ui_react_alert_dialog.Overlay, { base: [
|
|
645
|
+
"bg-alpha-600",
|
|
646
|
+
"top-0",
|
|
647
|
+
"right-0",
|
|
648
|
+
"bottom-0",
|
|
649
|
+
"left-0",
|
|
650
|
+
"fixed",
|
|
651
|
+
"z-1147483646",
|
|
652
|
+
"motion-safe:data-[state=open]:animate-fade-in",
|
|
653
|
+
"motion-safe:data-[state=closed]:animate-fade-out"
|
|
654
|
+
] });
|
|
655
|
+
var StyledAlertDialogContent = styled(_radix_ui_react_alert_dialog.Content, {
|
|
656
|
+
base: [
|
|
657
|
+
"transform-[translate(-50%,-50%)]",
|
|
658
|
+
"bg-white",
|
|
659
|
+
"rounded-md",
|
|
660
|
+
"shadow-xl",
|
|
661
|
+
"box-border",
|
|
662
|
+
"left-1/2",
|
|
663
|
+
"max-w-[90vw]",
|
|
664
|
+
"p-8",
|
|
665
|
+
"fixed",
|
|
666
|
+
"top-1/2",
|
|
667
|
+
"focus:outline-none",
|
|
668
|
+
"z-1147483646",
|
|
669
|
+
"motion-safe:data-[state=open]:animate-slide-in-center",
|
|
670
|
+
"motion-safe:data-[state=closed]:animate-slide-out-center"
|
|
671
|
+
],
|
|
672
|
+
variants: { size: {
|
|
673
|
+
sm: ["w-95"],
|
|
674
|
+
md: ["w-120"],
|
|
675
|
+
lg: ["w-150"]
|
|
676
|
+
} }
|
|
677
|
+
});
|
|
678
|
+
var AlertDialogContent = ({ size = "sm", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_alert_dialog.Portal, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledAlertDialogOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledAlertDialogContent, {
|
|
679
|
+
size,
|
|
680
|
+
...rest
|
|
681
|
+
})] });
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/components/alert-dialog/AlertDialog.tsx
|
|
684
|
+
var AlertDialog = /* @__PURE__ */ Object.assign(_radix_ui_react_alert_dialog.Root, {
|
|
685
|
+
Description: _radix_ui_react_alert_dialog.Description,
|
|
686
|
+
Title: _radix_ui_react_alert_dialog.Title,
|
|
687
|
+
Action: _radix_ui_react_alert_dialog.Action,
|
|
688
|
+
Cancel: _radix_ui_react_alert_dialog.Cancel,
|
|
689
|
+
Content: AlertDialogContent,
|
|
690
|
+
Trigger: _radix_ui_react_alert_dialog.Trigger
|
|
691
|
+
});
|
|
692
|
+
AlertDialog.displayName = "AlertDialog";
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/utilities/hooks/useIsMountedRef.ts
|
|
695
|
+
var useIsMountedRef = () => {
|
|
696
|
+
const isMountedRef = (0, react.useRef)(void 0);
|
|
697
|
+
(0, react.useEffect)(() => {
|
|
698
|
+
isMountedRef.current = true;
|
|
699
|
+
return () => {
|
|
700
|
+
isMountedRef.current = false;
|
|
701
|
+
};
|
|
702
|
+
});
|
|
703
|
+
return isMountedRef;
|
|
704
|
+
};
|
|
705
|
+
//#endregion
|
|
706
|
+
//#region src/components/loader/Loader.tsx
|
|
707
|
+
var Dot$1 = styled("div", {
|
|
708
|
+
base: [
|
|
709
|
+
"animate-pulse",
|
|
710
|
+
"bg-current",
|
|
711
|
+
"rounded-full",
|
|
712
|
+
"animation-duration-900",
|
|
713
|
+
"nth-3:animation-delay-300",
|
|
714
|
+
"nth-4:animation-delay-600"
|
|
715
|
+
],
|
|
716
|
+
variants: { size: {
|
|
717
|
+
sm: ["size-1", "mx-0.5"],
|
|
718
|
+
md: ["size-1.5", "mx-0.5"],
|
|
719
|
+
lg: ["size-2", "mx-[3px]"]
|
|
720
|
+
} }
|
|
721
|
+
});
|
|
722
|
+
var Loader = ({ className, message = "Loading", size = "md", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
723
|
+
className: cn("flex", "justify-center", className),
|
|
724
|
+
role: "alert",
|
|
725
|
+
...rest,
|
|
726
|
+
children: [
|
|
727
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
728
|
+
className: "sr-only",
|
|
729
|
+
children: message
|
|
730
|
+
}),
|
|
731
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot$1, { size }),
|
|
732
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot$1, { size }),
|
|
733
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot$1, { size })
|
|
734
|
+
]
|
|
735
|
+
});
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/components/button/Button.tsx
|
|
738
|
+
var StyledButton = styled("button", {
|
|
739
|
+
base: [
|
|
740
|
+
"items-center",
|
|
741
|
+
"bg-[unset]",
|
|
742
|
+
"rounded-md",
|
|
743
|
+
"cursor-pointer",
|
|
744
|
+
"flex",
|
|
745
|
+
"font-body",
|
|
746
|
+
"font-semibold",
|
|
747
|
+
"justify-center",
|
|
748
|
+
"no-underline",
|
|
749
|
+
"transition-all",
|
|
750
|
+
"duration-100",
|
|
751
|
+
"ease-out",
|
|
752
|
+
"whitespace-nowrap",
|
|
753
|
+
"w-max",
|
|
754
|
+
"disabled:cursor-not-allowed",
|
|
755
|
+
"disabled:opacity-30"
|
|
756
|
+
],
|
|
757
|
+
variants: {
|
|
758
|
+
theme: {
|
|
759
|
+
primary: [
|
|
760
|
+
"[--base:var(--color-primary-800)]",
|
|
761
|
+
"[--interact:var(--color-primary-900)]",
|
|
762
|
+
"[--active:var(--color-primary-1000)]"
|
|
763
|
+
],
|
|
764
|
+
secondary: [
|
|
765
|
+
"[--base:var(--color-primary-1000)]",
|
|
766
|
+
"[--interact:var(--color-primary-1100)]",
|
|
767
|
+
"[--active:var(--color-primary-1200)]"
|
|
768
|
+
],
|
|
769
|
+
success: [
|
|
770
|
+
"[--base:var(--color-success)]",
|
|
771
|
+
"[--interact:var(--color-success-mid)]",
|
|
772
|
+
"[--active:var(--color-success-dark)]"
|
|
773
|
+
],
|
|
774
|
+
warning: [
|
|
775
|
+
"[--base:var(--color-warning)]",
|
|
776
|
+
"[--interact:var(--color-warning-mid)]",
|
|
777
|
+
"[--active:var(--color-warning-dark)]",
|
|
778
|
+
"[--text:var(--color-grey-800)]"
|
|
779
|
+
],
|
|
780
|
+
danger: [
|
|
781
|
+
"[--base:var(--color-danger)]",
|
|
782
|
+
"[--interact:var(--color-danger-mid)]",
|
|
783
|
+
"[--active:var(--color-danger-dark)]"
|
|
784
|
+
],
|
|
785
|
+
neutral: [
|
|
786
|
+
"[--base:white]",
|
|
787
|
+
"[--interact:rgba(255,255,255,0.9)]",
|
|
788
|
+
"[--active:rgba(255,255,255,0.75)]",
|
|
789
|
+
"[--text:var(--color-primary-800)]"
|
|
790
|
+
]
|
|
791
|
+
},
|
|
792
|
+
appearance: {
|
|
793
|
+
solid: [
|
|
794
|
+
"bg-(--base)",
|
|
795
|
+
"text-(--text,white)",
|
|
796
|
+
"disabled:opacity-30",
|
|
797
|
+
"disabled:cursor-not-allowed",
|
|
798
|
+
"not-disabled:hover:bg-(--interact)",
|
|
799
|
+
"not-disabled:hover:text-(--text,white)",
|
|
800
|
+
"not-disabled:focus:bg-(--interact)",
|
|
801
|
+
"not-disabled:focus:text-(--text,white)",
|
|
802
|
+
"not-disabled:active:bg-(--active)"
|
|
803
|
+
],
|
|
804
|
+
outline: [
|
|
805
|
+
"border",
|
|
806
|
+
"border-current",
|
|
807
|
+
"text-(--base)",
|
|
808
|
+
"disabled:opacity-30",
|
|
809
|
+
"disabled:cursor-not-allowed",
|
|
810
|
+
"not-disabled:hover:no-underline",
|
|
811
|
+
"not-disabled:hover:text-(--interact)",
|
|
812
|
+
"not-disabled:focus:no-underline",
|
|
813
|
+
"not-disabled:focus:text-(--interact)",
|
|
814
|
+
"not-disabled:active:text-(--active)"
|
|
815
|
+
]
|
|
816
|
+
},
|
|
817
|
+
size: {
|
|
818
|
+
sm: [
|
|
819
|
+
"text-sm",
|
|
820
|
+
"leading-[1.53]",
|
|
821
|
+
"h-8",
|
|
822
|
+
"px-4",
|
|
823
|
+
"gap-2",
|
|
824
|
+
"[&_svg]:size-4"
|
|
825
|
+
],
|
|
826
|
+
md: [
|
|
827
|
+
"text-md",
|
|
828
|
+
"leading-normal",
|
|
829
|
+
"h-10",
|
|
830
|
+
"px-8",
|
|
831
|
+
"gap-3",
|
|
832
|
+
"[&_svg]:size-5"
|
|
833
|
+
],
|
|
834
|
+
lg: [
|
|
835
|
+
"text-lg",
|
|
836
|
+
"leading-normal",
|
|
837
|
+
"h-12",
|
|
838
|
+
"px-8",
|
|
839
|
+
"gap-3",
|
|
840
|
+
"[&_svg]:size-[22px]"
|
|
841
|
+
],
|
|
842
|
+
xl: [
|
|
843
|
+
"text-lg",
|
|
844
|
+
"leading-normal",
|
|
845
|
+
"h-16",
|
|
846
|
+
"px-8",
|
|
847
|
+
"gap-3",
|
|
848
|
+
"[&_svg]:size-[22px]"
|
|
849
|
+
]
|
|
850
|
+
},
|
|
851
|
+
isLoading: { true: [
|
|
852
|
+
"cursor-not-allowed",
|
|
853
|
+
"opacity-60",
|
|
854
|
+
"pointer-events-none"
|
|
855
|
+
] },
|
|
856
|
+
fullWidth: {
|
|
389
857
|
true: ["w-full"],
|
|
390
858
|
false: ["w-max"]
|
|
391
859
|
}
|
|
@@ -481,664 +949,193 @@ var Heading = styled("h2", {
|
|
|
481
949
|
"capsize-before-[0.1]",
|
|
482
950
|
"capsize-after-[0.2]"
|
|
483
951
|
]
|
|
484
|
-
},
|
|
485
|
-
noCapsize: { true: ["capsize-none"] },
|
|
486
|
-
weight: {
|
|
487
|
-
medium: ["font-medium"],
|
|
488
|
-
bold: ["font-bold"]
|
|
489
|
-
}
|
|
490
|
-
},
|
|
491
|
-
defaultVariants: {
|
|
492
|
-
size: "md",
|
|
493
|
-
weight: "bold"
|
|
494
|
-
}
|
|
495
|
-
}, { enableResponsiveVariants: true });
|
|
496
|
-
//#endregion
|
|
497
|
-
//#region src/components/text/Text.tsx
|
|
498
|
-
var Text = styled("p", {
|
|
499
|
-
base: ["m-0"],
|
|
500
|
-
variants: {
|
|
501
|
-
size: {
|
|
502
|
-
xs: [
|
|
503
|
-
"text-xs",
|
|
504
|
-
"leading-[1.6]",
|
|
505
|
-
"capsize-[0.4364]"
|
|
506
|
-
],
|
|
507
|
-
sm: [
|
|
508
|
-
"text-sm",
|
|
509
|
-
"leading-[1.53]",
|
|
510
|
-
"capsize-[0.4056]"
|
|
511
|
-
],
|
|
512
|
-
md: [
|
|
513
|
-
"text-md",
|
|
514
|
-
"leading-normal",
|
|
515
|
-
"capsize-[0.3864]"
|
|
516
|
-
],
|
|
517
|
-
lg: [
|
|
518
|
-
"text-lg",
|
|
519
|
-
"leading-[1.52]",
|
|
520
|
-
"capsize-[0.3983]"
|
|
521
|
-
],
|
|
522
|
-
xl: [
|
|
523
|
-
"text-xl",
|
|
524
|
-
"leading-[1.42]",
|
|
525
|
-
"capsize-[0.3506]"
|
|
526
|
-
],
|
|
527
|
-
"2xl": [
|
|
528
|
-
"text-2xl",
|
|
529
|
-
"leading-[1.40]",
|
|
530
|
-
"capsize-[0.3336]"
|
|
531
|
-
],
|
|
532
|
-
"3xl": [
|
|
533
|
-
"text-3xl",
|
|
534
|
-
"leading-[1.28]",
|
|
535
|
-
"capsize-[0.2709]"
|
|
536
|
-
],
|
|
537
|
-
"4xl": [
|
|
538
|
-
"text-4xl",
|
|
539
|
-
"leading-none",
|
|
540
|
-
"capsize-[0.1309]"
|
|
541
|
-
]
|
|
542
|
-
},
|
|
543
|
-
noCapsize: { true: ["capsize-none"] },
|
|
544
|
-
weight: {
|
|
545
|
-
normal: ["font-normal"],
|
|
546
|
-
bold: ["font-semibold"]
|
|
547
|
-
},
|
|
548
|
-
family: {
|
|
549
|
-
body: ["font-body"],
|
|
550
|
-
display: ["font-display"],
|
|
551
|
-
mono: ["font-mono"]
|
|
552
|
-
}
|
|
553
|
-
},
|
|
554
|
-
defaultVariants: {
|
|
555
|
-
size: "md",
|
|
556
|
-
family: "body"
|
|
557
|
-
}
|
|
558
|
-
}, { enableResponsiveVariants: true });
|
|
559
|
-
//#endregion
|
|
560
|
-
//#region src/components/alert-dialog/AlertDialogContent.tsx
|
|
561
|
-
var StyledAlertDialogOverlay = styled(_radix_ui_react_alert_dialog.Overlay, { base: [
|
|
562
|
-
"bg-alpha-600",
|
|
563
|
-
"top-0",
|
|
564
|
-
"right-0",
|
|
565
|
-
"bottom-0",
|
|
566
|
-
"left-0",
|
|
567
|
-
"fixed",
|
|
568
|
-
"z-1147483646",
|
|
569
|
-
"motion-safe:data-[state=open]:animate-fade-in",
|
|
570
|
-
"motion-safe:data-[state=closed]:animate-fade-out"
|
|
571
|
-
] });
|
|
572
|
-
var StyledAlertDialogContent = styled(_radix_ui_react_alert_dialog.Content, {
|
|
573
|
-
base: [
|
|
574
|
-
"transform-[translate(-50%,-50%)]",
|
|
575
|
-
"bg-white",
|
|
576
|
-
"rounded-md",
|
|
577
|
-
"shadow-xl",
|
|
578
|
-
"box-border",
|
|
579
|
-
"left-1/2",
|
|
580
|
-
"max-w-[90vw]",
|
|
581
|
-
"p-8",
|
|
582
|
-
"fixed",
|
|
583
|
-
"top-1/2",
|
|
584
|
-
"focus:outline-none",
|
|
585
|
-
"z-1147483646",
|
|
586
|
-
"motion-safe:data-[state=open]:animate-slide-in-center",
|
|
587
|
-
"motion-safe:data-[state=closed]:animate-slide-out-center"
|
|
588
|
-
],
|
|
589
|
-
variants: { size: {
|
|
590
|
-
sm: ["w-95"],
|
|
591
|
-
md: ["w-120"],
|
|
592
|
-
lg: ["w-150"]
|
|
593
|
-
} }
|
|
594
|
-
});
|
|
595
|
-
var AlertDialogContent = ({ size = "sm", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_alert_dialog.Portal, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledAlertDialogOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledAlertDialogContent, {
|
|
596
|
-
size,
|
|
597
|
-
...rest
|
|
598
|
-
})] });
|
|
599
|
-
//#endregion
|
|
600
|
-
//#region src/components/alert-dialog/AlertDialog.tsx
|
|
601
|
-
var AlertDialog = /* @__PURE__ */ Object.assign(_radix_ui_react_alert_dialog.Root, {
|
|
602
|
-
Description: _radix_ui_react_alert_dialog.Description,
|
|
603
|
-
Title: _radix_ui_react_alert_dialog.Title,
|
|
604
|
-
Action: _radix_ui_react_alert_dialog.Action,
|
|
605
|
-
Cancel: _radix_ui_react_alert_dialog.Cancel,
|
|
606
|
-
Content: AlertDialogContent,
|
|
607
|
-
Trigger: _radix_ui_react_alert_dialog.Trigger
|
|
608
|
-
});
|
|
609
|
-
AlertDialog.displayName = "AlertDialog";
|
|
610
|
-
//#endregion
|
|
611
|
-
//#region src/components/icon/Icon.tsx
|
|
612
|
-
var StyledIcon$3 = styled("svg", {
|
|
613
|
-
base: [
|
|
614
|
-
"inline-block",
|
|
615
|
-
"fill-none",
|
|
616
|
-
"shrink-0",
|
|
617
|
-
"stroke-current",
|
|
618
|
-
"[stroke-linecap:round]",
|
|
619
|
-
"[stroke-linejoin:round]",
|
|
620
|
-
"align-middle"
|
|
621
|
-
],
|
|
622
|
-
variants: { size: {
|
|
623
|
-
sm: ["size-4", "stroke-[1.5]"],
|
|
624
|
-
md: ["size-6", "stroke-[1.75]"],
|
|
625
|
-
lg: ["size-8", "stroke-2"]
|
|
626
|
-
} }
|
|
627
|
-
}, { enableResponsiveVariants: true });
|
|
628
|
-
var Icon = ({ ref, is: SVG, size = "md", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIcon$3, {
|
|
629
|
-
size,
|
|
630
|
-
"aria-hidden": "true",
|
|
631
|
-
...rest,
|
|
632
|
-
as: SVG,
|
|
633
|
-
ref
|
|
634
|
-
});
|
|
635
|
-
//#endregion
|
|
636
|
-
//#region src/components/alert-dialog/alert-context/AlertDialogIcon.tsx
|
|
637
|
-
var StyledIcon$2 = styled(Icon, {
|
|
638
|
-
base: ["self-start"],
|
|
639
|
-
variants: { theme: {
|
|
640
|
-
info: ["text-info"],
|
|
641
|
-
warning: ["text-warning-mid"],
|
|
642
|
-
danger: ["rotate-180", "text-danger"],
|
|
643
|
-
success: ["text-success"]
|
|
644
|
-
} }
|
|
645
|
-
});
|
|
646
|
-
var iconMap = {
|
|
647
|
-
info: _atom_learning_icons.Info,
|
|
648
|
-
warning: _atom_learning_icons.Danger,
|
|
649
|
-
danger: _atom_learning_icons.Info,
|
|
650
|
-
success: _atom_learning_icons.OkCircle
|
|
651
|
-
};
|
|
652
|
-
var AlertDialogIcon = ({ theme }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIcon$2, {
|
|
653
|
-
theme,
|
|
654
|
-
is: iconMap[theme]
|
|
655
|
-
});
|
|
656
|
-
//#endregion
|
|
657
|
-
//#region src/components/alert-dialog/alert-context/AlertDialog.tsx
|
|
658
|
-
var Alert$1 = ({ title, size, theme, description, onAction, cancelActionText, confirmActionText, onClose, confirmElement, cancelElement, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDialog, {
|
|
659
|
-
defaultOpen: true,
|
|
660
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AlertDialog.Content, {
|
|
661
|
-
size,
|
|
662
|
-
onEscapeKeyDown: (e) => e.preventDefault(),
|
|
663
|
-
onCloseAutoFocus: onClose,
|
|
664
|
-
...rest,
|
|
665
|
-
className: "flex max-h-[90vh] flex-col gap-8",
|
|
666
|
-
children: [
|
|
667
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
668
|
-
className: "flex items-center gap-2",
|
|
669
|
-
children: [theme && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDialogIcon, { theme }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
670
|
-
as: AlertDialog.Title,
|
|
671
|
-
size: "sm",
|
|
672
|
-
className: "mr-4",
|
|
673
|
-
children: title
|
|
674
|
-
})]
|
|
675
|
-
}),
|
|
676
|
-
description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
|
|
677
|
-
as: AlertDialog.Description,
|
|
678
|
-
className: "flex overflow-y-auto",
|
|
679
|
-
children: description
|
|
680
|
-
}),
|
|
681
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
682
|
-
className: "flex flex-wrap justify-end gap-2",
|
|
683
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDialog.Cancel, {
|
|
684
|
-
asChild: true,
|
|
685
|
-
children: cancelElement || cancelActionText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
686
|
-
size: "sm",
|
|
687
|
-
appearance: "outline",
|
|
688
|
-
onClick: () => onAction?.(false),
|
|
689
|
-
children: cancelActionText
|
|
690
|
-
})
|
|
691
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDialog.Action, {
|
|
692
|
-
asChild: true,
|
|
693
|
-
children: confirmElement || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
694
|
-
size: "sm",
|
|
695
|
-
onClick: () => onAction?.(true),
|
|
696
|
-
children: confirmActionText
|
|
697
|
-
})
|
|
698
|
-
})]
|
|
699
|
-
})
|
|
700
|
-
]
|
|
701
|
-
})
|
|
702
|
-
});
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region src/components/alert-dialog/alert-context/reducer.ts
|
|
705
|
-
var initialState = [];
|
|
706
|
-
var reducer = (state, action) => {
|
|
707
|
-
switch (action.type) {
|
|
708
|
-
case "ADD": return [...state, {
|
|
709
|
-
...action.payload,
|
|
710
|
-
id: (0, uid.uid)()
|
|
711
|
-
}];
|
|
712
|
-
case "REMOVE": return state.filter(({ id }) => id !== action.payload);
|
|
713
|
-
default: return state;
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
//#endregion
|
|
717
|
-
//#region src/components/alert-dialog/AlertDialog.context.tsx
|
|
718
|
-
var AlertContext = react.createContext({ showAlert: () => null });
|
|
719
|
-
var AlertProvider = ({ children }) => {
|
|
720
|
-
const [alerts, dispatch] = react.useReducer(reducer, initialState);
|
|
721
|
-
const isMountedRef = useIsMountedRef();
|
|
722
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AlertContext.Provider, {
|
|
723
|
-
value: { showAlert: (content) => dispatch({
|
|
724
|
-
payload: content,
|
|
725
|
-
type: "ADD"
|
|
726
|
-
}) },
|
|
727
|
-
children: [Boolean(alerts.length) && /* @__PURE__ */ (0, react.createElement)(Alert$1, {
|
|
728
|
-
...alerts[0],
|
|
729
|
-
key: alerts[0].id,
|
|
730
|
-
onClose: () => {
|
|
731
|
-
if (isMountedRef.current) dispatch({
|
|
732
|
-
payload: alerts[0].id,
|
|
733
|
-
type: "REMOVE"
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
}), children]
|
|
737
|
-
});
|
|
738
|
-
};
|
|
739
|
-
var useAlert = () => {
|
|
740
|
-
const context = react.useContext(AlertContext);
|
|
741
|
-
if (context === void 0) throw new Error("useAlert must be used within a AlertProvider");
|
|
742
|
-
return context;
|
|
743
|
-
};
|
|
744
|
-
//#endregion
|
|
745
|
-
//#region src/utilities/css-wrapper/CSSWrapper.tsx
|
|
746
|
-
var CSSWrapper = ({ className, children }) => className ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
747
|
-
className,
|
|
748
|
-
children
|
|
749
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
750
|
-
CSSWrapper.displayName = "CSSWrapper";
|
|
751
|
-
//#endregion
|
|
752
|
-
//#region src/components/accordion/AccordionContent.tsx
|
|
753
|
-
var StyledContent$4 = styled(_radix_ui_react_accordion.Content, { base: [
|
|
754
|
-
"border-none",
|
|
755
|
-
"w-full",
|
|
756
|
-
"bg-(--base-1)",
|
|
757
|
-
"overflow-hidden",
|
|
758
|
-
"data-[state=open]:rounded-b-sm",
|
|
759
|
-
"data-[state=open]:rounded-t-none",
|
|
760
|
-
"motion-safe:data-[state=open]:animate-accordion-open",
|
|
761
|
-
"motion-safe:data-[state=closed]:animate-accordion-close"
|
|
762
|
-
] });
|
|
763
|
-
var AccordionContent = ({ children, className, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledContent$4, {
|
|
764
|
-
...rest,
|
|
765
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CSSWrapper, {
|
|
766
|
-
className,
|
|
767
|
-
children
|
|
768
|
-
})
|
|
769
|
-
});
|
|
770
|
-
//#endregion
|
|
771
|
-
//#region src/components/accordion/AccordionItem.tsx
|
|
772
|
-
var AccordionItem = styled(_radix_ui_react_accordion.Item, { base: ["w-full", "not-last:mb-1"] }, { enablePolymorphism: false });
|
|
773
|
-
//#endregion
|
|
774
|
-
//#region src/experiments/color-scheme/ColorScheme.config.ts
|
|
775
|
-
var generateColors = ({ prefix, colorName, color0 = "" }) => {
|
|
776
|
-
const colors = {};
|
|
777
|
-
let i = 1;
|
|
778
|
-
if (color0) {
|
|
779
|
-
colors[`--${prefix}-${i}`] = `var(--color-${color0})`;
|
|
780
|
-
i++;
|
|
781
|
-
}
|
|
782
|
-
let k = 1;
|
|
783
|
-
for (; i <= 11; i++) {
|
|
784
|
-
colors[`--${prefix}-${i}`] = `var(--color-${colorName}-${k * 100})`;
|
|
785
|
-
k++;
|
|
786
|
-
}
|
|
787
|
-
return colors;
|
|
788
|
-
};
|
|
789
|
-
var colorSchemes$4 = {};
|
|
790
|
-
colorSchemes$4["interactive-loContrast"] = {
|
|
791
|
-
"--interactive-foreground": "var(--foreground)",
|
|
792
|
-
"--interactive-1": "var(--accent-1)",
|
|
793
|
-
"--interactive-2": "var(--accent-2)",
|
|
794
|
-
"--interactive-3": "var(--accent-3)"
|
|
795
|
-
};
|
|
796
|
-
colorSchemes$4["interactive-hiContrast"] = {
|
|
797
|
-
"--interactive-foreground": "var(--foreground-7-plus)",
|
|
798
|
-
"--interactive-1": "var(--accent-9)",
|
|
799
|
-
"--interactive-2": "var(--accent-10)",
|
|
800
|
-
"--interactive-3": "var(--accent-11)"
|
|
801
|
-
};
|
|
802
|
-
var colorNames = [
|
|
803
|
-
"primary",
|
|
804
|
-
"grey",
|
|
805
|
-
"blue",
|
|
806
|
-
"pink",
|
|
807
|
-
"purple",
|
|
808
|
-
"cyan",
|
|
809
|
-
"green",
|
|
810
|
-
"magenta",
|
|
811
|
-
"red",
|
|
812
|
-
"teal",
|
|
813
|
-
"orange",
|
|
814
|
-
"yellow",
|
|
815
|
-
"lime"
|
|
816
|
-
];
|
|
817
|
-
var createVariants = () => Object.fromEntries(colorNames.flatMap((c) => [[`${c}1`, {
|
|
818
|
-
colorName: c,
|
|
819
|
-
color0: "white"
|
|
820
|
-
}], [`${c}2`, { colorName: c }]]));
|
|
821
|
-
var bases = createVariants();
|
|
822
|
-
var accents = bases;
|
|
823
|
-
(() => {
|
|
824
|
-
Object.entries(bases).forEach(([name, config]) => {
|
|
825
|
-
const themeName = `base-${name}`;
|
|
826
|
-
colorSchemes$4[themeName] = {
|
|
827
|
-
"--foreground": "var(--color-grey-1000)",
|
|
828
|
-
"--foreground-7-plus": "var(--color-white)",
|
|
829
|
-
...generateColors({
|
|
830
|
-
prefix: "base",
|
|
831
|
-
colorName: config.colorName,
|
|
832
|
-
color0: config.color0
|
|
833
|
-
})
|
|
834
|
-
};
|
|
835
|
-
});
|
|
836
|
-
Object.entries(accents).forEach(([name, config]) => {
|
|
837
|
-
colorSchemes$4[`accent-${name}`] = generateColors({
|
|
838
|
-
prefix: "accent",
|
|
839
|
-
colorName: config.colorName,
|
|
840
|
-
color0: config.color0
|
|
841
|
-
});
|
|
842
|
-
});
|
|
843
|
-
})();
|
|
844
|
-
//#endregion
|
|
845
|
-
//#region src/experiments/color-scheme/ColorScheme.tsx
|
|
846
|
-
/**
|
|
847
|
-
* @experimental Component has not been finalised. Further design input required. Use with caution.
|
|
848
|
-
*/
|
|
849
|
-
var ColorScheme = ({ ref, base = "", accent = "", interactive, asChild = false, ...rest }) => {
|
|
850
|
-
const Component = asChild ? _radix_ui_react_slot.Slot : "div";
|
|
851
|
-
const style = {
|
|
852
|
-
...interactive && colorSchemes$4[`interactive-${interactive}`],
|
|
853
|
-
...accent && colorSchemes$4[`accent-${accent}`],
|
|
854
|
-
...base && colorSchemes$4[`base-${base}`]
|
|
855
|
-
};
|
|
856
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
857
|
-
...rest,
|
|
858
|
-
ref,
|
|
859
|
-
style
|
|
860
|
-
});
|
|
861
|
-
};
|
|
862
|
-
//#endregion
|
|
863
|
-
//#region src/components/accordion/AccordionTrigger.tsx
|
|
864
|
-
var RotatingIcon = styled(Icon, { base: [
|
|
865
|
-
"transition-transform",
|
|
866
|
-
"duration-300",
|
|
867
|
-
"[[data-state=open]>&]:rotate-180",
|
|
868
|
-
"[[data-state=closed]>&]:rotate-0"
|
|
869
|
-
] });
|
|
870
|
-
var StyledTrigger$1 = styled(_radix_ui_react_accordion.Trigger, {
|
|
871
|
-
base: [
|
|
872
|
-
"border-none",
|
|
873
|
-
"py-3",
|
|
874
|
-
"px-4",
|
|
875
|
-
"w-full",
|
|
876
|
-
"flex",
|
|
877
|
-
"justify-between",
|
|
878
|
-
"items-center",
|
|
879
|
-
"cursor-pointer",
|
|
880
|
-
"bg-(--interactive-2)",
|
|
881
|
-
"text-(--interactive-foreground)",
|
|
882
|
-
"disabled:cursor-not-allowed",
|
|
883
|
-
"disabled:opacity-30",
|
|
884
|
-
"not-disabled:active:bg-(--interactive-3)",
|
|
885
|
-
"not-disabled:focus-visible:bg-(--interactive-3)",
|
|
886
|
-
"not-disabled:focus-visible:outline-none",
|
|
887
|
-
"not-disabled:focus-visible:relative",
|
|
888
|
-
"not-disabled:focus-visible:shadow-[var(--color-primary-800)_0px_0px_0px_4px]",
|
|
889
|
-
"not-disabled:focus-visible:shadow-[white_0px_0px_0px_2px]",
|
|
890
|
-
"not-disabled:focus-visible:z-1",
|
|
891
|
-
"not-disabled:hover:bg-(--interactive-3)",
|
|
892
|
-
"data-[state=open]:rounded-b-none",
|
|
893
|
-
"data-[state=open]:rounded-t-sm",
|
|
894
|
-
"data-[state=closed]:rounded-sm"
|
|
895
|
-
],
|
|
896
|
-
variants: { arrowPosition: {
|
|
897
|
-
left: [
|
|
898
|
-
"flex-row-reverse",
|
|
899
|
-
"gap-2",
|
|
900
|
-
"justify-end"
|
|
901
|
-
],
|
|
902
|
-
right: []
|
|
903
|
-
} }
|
|
904
|
-
});
|
|
905
|
-
var AccordionTrigger = ({ children, colorScheme = {}, asChild, arrowPosition = "right", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorScheme, {
|
|
906
|
-
asChild: true,
|
|
907
|
-
accent: "grey1",
|
|
908
|
-
interactive: "loContrast",
|
|
909
|
-
...colorScheme,
|
|
910
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledTrigger$1, {
|
|
911
|
-
asChild,
|
|
912
|
-
arrowPosition,
|
|
913
|
-
...rest,
|
|
914
|
-
children: asChild ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RotatingIcon, {
|
|
915
|
-
is: _atom_learning_icons.ChevronDown,
|
|
916
|
-
"data-testid": "accordion-chevron"
|
|
917
|
-
})] })
|
|
918
|
-
})
|
|
919
|
-
});
|
|
920
|
-
//#endregion
|
|
921
|
-
//#region src/components/accordion/Accordion.tsx
|
|
922
|
-
var AccordionBase = ({ ref, type = "single", className, children, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_accordion.Root, {
|
|
923
|
-
ref,
|
|
924
|
-
type,
|
|
925
|
-
className: cn("w-full", className),
|
|
926
|
-
...rest,
|
|
927
|
-
children
|
|
928
|
-
});
|
|
929
|
-
var Accordion = /* @__PURE__ */ Object.assign(AccordionBase, {
|
|
930
|
-
Item: AccordionItem,
|
|
931
|
-
Content: AccordionContent,
|
|
932
|
-
Trigger: AccordionTrigger
|
|
933
|
-
});
|
|
934
|
-
//#endregion
|
|
935
|
-
//#region src/components/tooltip/TooltipContent.tsx
|
|
936
|
-
var StyledContent$3 = styled(_radix_ui_react_tooltip.Content, {
|
|
937
|
-
base: [
|
|
938
|
-
"bg-grey-900",
|
|
939
|
-
"rounded-sm",
|
|
940
|
-
"shadow-sm",
|
|
941
|
-
"text-white",
|
|
942
|
-
"font-body",
|
|
943
|
-
"text-sm",
|
|
944
|
-
"leading-normal",
|
|
945
|
-
"whitespace-normal",
|
|
946
|
-
"px-3",
|
|
947
|
-
"py-2",
|
|
948
|
-
"z-10",
|
|
949
|
-
"will-change-transform",
|
|
950
|
-
"will-change-[opacity]",
|
|
951
|
-
"[--slide-opacity-out:0]",
|
|
952
|
-
"data-[side=top]:[--slide-direction-out-y:-4px]",
|
|
953
|
-
"data-[side=right]:[--slide-direction-out-x:4px]",
|
|
954
|
-
"data-[side=bottom]:[--slide-direction-out-y:4px]",
|
|
955
|
-
"data-[side=left]:[--slide-direction-out-x:-4px]",
|
|
956
|
-
"motion-safe:data-[state=delayed-open]:animate-slide-direction-in",
|
|
957
|
-
"motion-safe:data-[state=closed]:animate-slide-direction-out"
|
|
958
|
-
],
|
|
959
|
-
variants: { size: {
|
|
960
|
-
sm: ["max-w-25"],
|
|
961
|
-
md: ["max-w-[250px]"],
|
|
962
|
-
lg: ["max-w-100"]
|
|
963
|
-
} }
|
|
964
|
-
});
|
|
965
|
-
var StyledArrow$1 = styled(_radix_ui_react_tooltip.Arrow, { base: [
|
|
966
|
-
"fill-grey-900",
|
|
967
|
-
"in-data-[align=end]:mr-2",
|
|
968
|
-
"in-data-[align=start]:ml-2"
|
|
969
|
-
] });
|
|
970
|
-
var TooltipContent = ({ children, side = "top", sideOffset = 4, size = "md", ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContent$3, {
|
|
971
|
-
side,
|
|
972
|
-
sideOffset,
|
|
973
|
-
size,
|
|
974
|
-
...rest,
|
|
975
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArrow$1, {})]
|
|
976
|
-
});
|
|
977
|
-
//#endregion
|
|
978
|
-
//#region src/components/tooltip/Tooltip.tsx
|
|
979
|
-
var TooltipComponent = ({ children, delayDuration = 350, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Root, {
|
|
980
|
-
delayDuration,
|
|
981
|
-
...rest,
|
|
982
|
-
children
|
|
983
|
-
});
|
|
984
|
-
var Tooltip = /* @__PURE__ */ Object.assign(TooltipComponent, {
|
|
985
|
-
Content: TooltipContent,
|
|
986
|
-
Trigger: _radix_ui_react_tooltip.Trigger,
|
|
987
|
-
Portal: _radix_ui_react_tooltip.Portal,
|
|
988
|
-
Provider: _radix_ui_react_tooltip.Provider
|
|
989
|
-
});
|
|
990
|
-
TooltipComponent.displayName = "Tooltip";
|
|
991
|
-
//#endregion
|
|
992
|
-
//#region src/utilities/optional-tooltip-wrapper/OptionalTooltipWrapper.tsx
|
|
993
|
-
var OptionalTooltipWrapper = ({ hasTooltip, label, tooltipSide, children }) => {
|
|
994
|
-
if (hasTooltip) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip.Trigger, {
|
|
995
|
-
asChild: true,
|
|
996
|
-
onFocus: (e) => {
|
|
997
|
-
if (!e.currentTarget.matches(":focus-visible")) e.preventDefault();
|
|
998
|
-
},
|
|
999
|
-
children
|
|
1000
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip.Content, {
|
|
1001
|
-
side: tooltipSide,
|
|
1002
|
-
children: label
|
|
1003
|
-
})] });
|
|
1004
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
1005
|
-
};
|
|
1006
|
-
OptionalTooltipWrapper.displayName = "OptionalTooltipWrapper";
|
|
1007
|
-
//#endregion
|
|
1008
|
-
//#region src/components/action-icon/ActionIcon.constants.ts
|
|
1009
|
-
var ActionIconSizeMap = {
|
|
1010
|
-
xs: "sm",
|
|
1011
|
-
sm: "sm",
|
|
1012
|
-
md: "md",
|
|
1013
|
-
lg: "lg"
|
|
1014
|
-
};
|
|
952
|
+
},
|
|
953
|
+
noCapsize: { true: ["capsize-none"] },
|
|
954
|
+
weight: {
|
|
955
|
+
medium: ["font-medium"],
|
|
956
|
+
bold: ["font-bold"]
|
|
957
|
+
}
|
|
958
|
+
},
|
|
959
|
+
defaultVariants: {
|
|
960
|
+
size: "md",
|
|
961
|
+
weight: "bold"
|
|
962
|
+
}
|
|
963
|
+
}, { enableResponsiveVariants: true });
|
|
1015
964
|
//#endregion
|
|
1016
|
-
//#region src/components/
|
|
1017
|
-
var
|
|
1018
|
-
base: [
|
|
1019
|
-
"items-center",
|
|
1020
|
-
"appearance-none",
|
|
1021
|
-
"bg-white",
|
|
1022
|
-
"rounded-md",
|
|
1023
|
-
"box-border",
|
|
1024
|
-
"cursor-pointer",
|
|
1025
|
-
"flex",
|
|
1026
|
-
"shrink-0",
|
|
1027
|
-
"justify-center",
|
|
1028
|
-
"transition-all",
|
|
1029
|
-
"duration-100",
|
|
1030
|
-
"ease-out",
|
|
1031
|
-
"disabled:cursor-not-allowed",
|
|
1032
|
-
"disabled:opacity-30"
|
|
1033
|
-
],
|
|
965
|
+
//#region src/components/text/Text.tsx
|
|
966
|
+
var Text = styled("p", {
|
|
967
|
+
base: ["m-0"],
|
|
1034
968
|
variants: {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
"
|
|
1038
|
-
"[
|
|
1039
|
-
"[
|
|
1040
|
-
"[--solid-text:var(--color-grey-1200)]",
|
|
1041
|
-
"[--base:var(--color-grey-700)]",
|
|
1042
|
-
"[--interact:var(--color-primary-900)]",
|
|
1043
|
-
"[--active:var(--color-primary-1100)]"
|
|
1044
|
-
],
|
|
1045
|
-
primary: [
|
|
1046
|
-
"[--base:var(--color-primary-800)]",
|
|
1047
|
-
"[--interact:var(--color-primary-900)]",
|
|
1048
|
-
"[--active:var(--color-primary-1000)]"
|
|
969
|
+
size: {
|
|
970
|
+
xs: [
|
|
971
|
+
"text-xs",
|
|
972
|
+
"leading-[1.6]",
|
|
973
|
+
"capsize-[0.4364]"
|
|
1049
974
|
],
|
|
1050
|
-
|
|
1051
|
-
"
|
|
1052
|
-
"[
|
|
1053
|
-
"[
|
|
975
|
+
sm: [
|
|
976
|
+
"text-sm",
|
|
977
|
+
"leading-[1.53]",
|
|
978
|
+
"capsize-[0.4056]"
|
|
1054
979
|
],
|
|
1055
|
-
|
|
1056
|
-
"
|
|
1057
|
-
"
|
|
1058
|
-
"[
|
|
980
|
+
md: [
|
|
981
|
+
"text-md",
|
|
982
|
+
"leading-normal",
|
|
983
|
+
"capsize-[0.3864]"
|
|
1059
984
|
],
|
|
1060
|
-
|
|
1061
|
-
"
|
|
1062
|
-
"[
|
|
1063
|
-
"[
|
|
985
|
+
lg: [
|
|
986
|
+
"text-lg",
|
|
987
|
+
"leading-[1.52]",
|
|
988
|
+
"capsize-[0.3983]"
|
|
1064
989
|
],
|
|
1065
|
-
|
|
1066
|
-
"
|
|
1067
|
-
"[
|
|
1068
|
-
"[
|
|
990
|
+
xl: [
|
|
991
|
+
"text-xl",
|
|
992
|
+
"leading-[1.42]",
|
|
993
|
+
"capsize-[0.3506]"
|
|
1069
994
|
],
|
|
1070
|
-
|
|
1071
|
-
"
|
|
1072
|
-
"[
|
|
1073
|
-
"[
|
|
1074
|
-
]
|
|
1075
|
-
},
|
|
1076
|
-
appearance: {
|
|
1077
|
-
simple: [
|
|
1078
|
-
"bg-transparent",
|
|
1079
|
-
"text-(--base)",
|
|
1080
|
-
"not-disabled:hover:text-(--interact)",
|
|
1081
|
-
"not-disabled:focus:text-(--interact)",
|
|
1082
|
-
"not-disabled:active:text-(--active)"
|
|
995
|
+
"2xl": [
|
|
996
|
+
"text-2xl",
|
|
997
|
+
"leading-[1.40]",
|
|
998
|
+
"capsize-[0.3336]"
|
|
1083
999
|
],
|
|
1084
|
-
|
|
1085
|
-
"
|
|
1086
|
-
"
|
|
1087
|
-
"
|
|
1088
|
-
"text-(--base)",
|
|
1089
|
-
"not-disabled:hover:text-(--interact)",
|
|
1090
|
-
"not-disabled:focus:text-(--interact)",
|
|
1091
|
-
"not-disabled:active:text-(--active)"
|
|
1000
|
+
"3xl": [
|
|
1001
|
+
"text-3xl",
|
|
1002
|
+
"leading-[1.28]",
|
|
1003
|
+
"capsize-[0.2709]"
|
|
1092
1004
|
],
|
|
1093
|
-
|
|
1094
|
-
"
|
|
1095
|
-
"
|
|
1096
|
-
"
|
|
1097
|
-
"not-disabled:hover:text-(--solid-text,white)",
|
|
1098
|
-
"not-disabled:focus:bg-(--solid-interact,var(--interact))",
|
|
1099
|
-
"not-disabled:focus:text-(--solid-text,white)",
|
|
1100
|
-
"not-disabled:active:bg-(--solid-active,var(--active))"
|
|
1005
|
+
"4xl": [
|
|
1006
|
+
"text-4xl",
|
|
1007
|
+
"leading-none",
|
|
1008
|
+
"capsize-[0.1309]"
|
|
1101
1009
|
]
|
|
1102
1010
|
},
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
lg: ["size-12"]
|
|
1011
|
+
noCapsize: { true: ["capsize-none"] },
|
|
1012
|
+
weight: {
|
|
1013
|
+
normal: ["font-normal"],
|
|
1014
|
+
bold: ["font-semibold"]
|
|
1108
1015
|
},
|
|
1109
|
-
|
|
1016
|
+
family: {
|
|
1017
|
+
body: ["font-body"],
|
|
1018
|
+
display: ["font-display"],
|
|
1019
|
+
mono: ["font-mono"]
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
defaultVariants: {
|
|
1023
|
+
size: "md",
|
|
1024
|
+
family: "body"
|
|
1110
1025
|
}
|
|
1111
1026
|
}, { enableResponsiveVariants: true });
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1027
|
+
//#endregion
|
|
1028
|
+
//#region src/components/alert-dialog/alert-context/AlertDialogIcon.tsx
|
|
1029
|
+
var StyledIcon$2 = styled(Icon, {
|
|
1030
|
+
base: ["self-start"],
|
|
1031
|
+
variants: { theme: {
|
|
1032
|
+
info: ["text-info"],
|
|
1033
|
+
warning: ["text-warning-mid"],
|
|
1034
|
+
danger: ["rotate-180", "text-danger"],
|
|
1035
|
+
success: ["text-success"]
|
|
1036
|
+
} }
|
|
1037
|
+
});
|
|
1038
|
+
var iconMap = {
|
|
1039
|
+
info: _atom_learning_icons.Info,
|
|
1040
|
+
warning: _atom_learning_icons.Danger,
|
|
1041
|
+
danger: _atom_learning_icons.Info,
|
|
1042
|
+
success: _atom_learning_icons.OkCircle
|
|
1043
|
+
};
|
|
1044
|
+
var AlertDialogIcon = ({ theme }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIcon$2, {
|
|
1045
|
+
theme,
|
|
1046
|
+
is: iconMap[theme]
|
|
1047
|
+
});
|
|
1048
|
+
//#endregion
|
|
1049
|
+
//#region src/components/alert-dialog/alert-context/AlertDialog.tsx
|
|
1050
|
+
var Alert$1 = ({ title, size, theme, description, onAction, cancelActionText, confirmActionText, onClose, confirmElement, cancelElement, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDialog, {
|
|
1051
|
+
defaultOpen: true,
|
|
1052
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AlertDialog.Content, {
|
|
1053
|
+
size,
|
|
1054
|
+
onEscapeKeyDown: (e) => e.preventDefault(),
|
|
1055
|
+
onCloseAutoFocus: onClose,
|
|
1056
|
+
...rest,
|
|
1057
|
+
className: "flex max-h-[90vh] flex-col gap-8",
|
|
1058
|
+
children: [
|
|
1059
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1060
|
+
className: "flex items-center gap-2",
|
|
1061
|
+
children: [theme && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDialogIcon, { theme }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
1062
|
+
as: AlertDialog.Title,
|
|
1063
|
+
size: "sm",
|
|
1064
|
+
className: "mr-4",
|
|
1065
|
+
children: title
|
|
1066
|
+
})]
|
|
1067
|
+
}),
|
|
1068
|
+
description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
|
|
1069
|
+
as: AlertDialog.Description,
|
|
1070
|
+
className: "flex overflow-y-auto",
|
|
1071
|
+
children: description
|
|
1072
|
+
}),
|
|
1073
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1074
|
+
className: "flex flex-wrap justify-end gap-2",
|
|
1075
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDialog.Cancel, {
|
|
1076
|
+
asChild: true,
|
|
1077
|
+
children: cancelElement || cancelActionText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
1078
|
+
size: "sm",
|
|
1079
|
+
appearance: "outline",
|
|
1080
|
+
onClick: () => onAction?.(false),
|
|
1081
|
+
children: cancelActionText
|
|
1082
|
+
})
|
|
1083
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDialog.Action, {
|
|
1084
|
+
asChild: true,
|
|
1085
|
+
children: confirmElement || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
1086
|
+
size: "sm",
|
|
1087
|
+
onClick: () => onAction?.(true),
|
|
1088
|
+
children: confirmActionText
|
|
1089
|
+
})
|
|
1090
|
+
})]
|
|
1138
1091
|
})
|
|
1139
|
-
|
|
1092
|
+
]
|
|
1093
|
+
})
|
|
1094
|
+
});
|
|
1095
|
+
//#endregion
|
|
1096
|
+
//#region src/components/alert-dialog/alert-context/reducer.ts
|
|
1097
|
+
var initialState = [];
|
|
1098
|
+
var reducer = (state, action) => {
|
|
1099
|
+
switch (action.type) {
|
|
1100
|
+
case "ADD": return [...state, action.payload];
|
|
1101
|
+
case "REMOVE": return state.filter(({ id }) => id !== action.payload);
|
|
1102
|
+
default: return state;
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
//#endregion
|
|
1106
|
+
//#region src/components/alert-dialog/AlertDialog.context.tsx
|
|
1107
|
+
var AlertContext = react.createContext(void 0);
|
|
1108
|
+
var AlertProvider = ({ children }) => {
|
|
1109
|
+
const [alerts, dispatch] = react.useReducer(reducer, initialState);
|
|
1110
|
+
const isMountedRef = useIsMountedRef();
|
|
1111
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AlertContext, {
|
|
1112
|
+
value: react.useMemo(() => ({ showAlert: (content) => dispatch({
|
|
1113
|
+
payload: {
|
|
1114
|
+
...content,
|
|
1115
|
+
id: crypto.randomUUID()
|
|
1116
|
+
},
|
|
1117
|
+
type: "ADD"
|
|
1118
|
+
}) }), []),
|
|
1119
|
+
children: [Boolean(alerts.length) && /* @__PURE__ */ (0, react.createElement)(Alert$1, {
|
|
1120
|
+
...alerts[0],
|
|
1121
|
+
key: alerts[0].id,
|
|
1122
|
+
onClose: () => {
|
|
1123
|
+
if (isMountedRef.current) dispatch({
|
|
1124
|
+
payload: alerts[0].id,
|
|
1125
|
+
type: "REMOVE"
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
}), children]
|
|
1140
1129
|
});
|
|
1141
1130
|
};
|
|
1131
|
+
var useAlert = () => {
|
|
1132
|
+
const context = react.use(AlertContext);
|
|
1133
|
+
if (context === void 0) throw new Error("useAlert must be used within a AlertProvider");
|
|
1134
|
+
return context;
|
|
1135
|
+
};
|
|
1136
|
+
//#endregion
|
|
1137
|
+
//#region src/components/alert-dialog/Alert.ts
|
|
1138
|
+
var Alert = { Provider: AlertProvider };
|
|
1142
1139
|
//#endregion
|
|
1143
1140
|
//#region src/components/avatar/Avatar.context.tsx
|
|
1144
1141
|
var AvatarRootContext = react.createContext({
|
|
@@ -1172,9 +1169,9 @@ var toIconSize$3 = {
|
|
|
1172
1169
|
xxl: "lg"
|
|
1173
1170
|
};
|
|
1174
1171
|
var AvatarIcon = ({ is }) => {
|
|
1175
|
-
const { size } = react.
|
|
1172
|
+
const { size } = react.use(AvatarRootContext);
|
|
1176
1173
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
1177
|
-
size:
|
|
1174
|
+
size: overrideStyledVariantValue(size, (s) => toIconSize$3[s]),
|
|
1178
1175
|
is
|
|
1179
1176
|
});
|
|
1180
1177
|
};
|
|
@@ -1348,8 +1345,8 @@ var toTextSize$2 = {
|
|
|
1348
1345
|
xxl: "lg"
|
|
1349
1346
|
};
|
|
1350
1347
|
var AvatarInitial = () => {
|
|
1351
|
-
const { name, size } = react.
|
|
1352
|
-
const textSize =
|
|
1348
|
+
const { name, size } = react.use(AvatarRootContext);
|
|
1349
|
+
const textSize = overrideStyledVariantValue(size, (s) => toTextSize$2[s]);
|
|
1353
1350
|
if (!name) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AvatarPlaceholder, {});
|
|
1354
1351
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text, {
|
|
1355
1352
|
size: textSize,
|
|
@@ -1430,12 +1427,11 @@ var StyledButton$4 = /* @__PURE__ */ styled("button", {
|
|
|
1430
1427
|
}
|
|
1431
1428
|
});
|
|
1432
1429
|
var AvatarRootProvider = ({ children, name, size }) => {
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
value,
|
|
1430
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AvatarRootContext, {
|
|
1431
|
+
value: react.useMemo(() => ({
|
|
1432
|
+
name,
|
|
1433
|
+
size
|
|
1434
|
+
}), [name, size]),
|
|
1439
1435
|
children
|
|
1440
1436
|
});
|
|
1441
1437
|
};
|
|
@@ -1494,7 +1490,10 @@ AvatarRoot.displayName = "Avatar";
|
|
|
1494
1490
|
var useCallbackRef = () => {
|
|
1495
1491
|
const elRef = react.useRef(null);
|
|
1496
1492
|
return [elRef, react.useCallback((el) => {
|
|
1497
|
-
|
|
1493
|
+
elRef.current = el;
|
|
1494
|
+
return () => {
|
|
1495
|
+
elRef.current = null;
|
|
1496
|
+
};
|
|
1498
1497
|
}, [])];
|
|
1499
1498
|
};
|
|
1500
1499
|
var useCallbackRefState = () => {
|
|
@@ -1608,19 +1607,18 @@ var colorSchemes$3 = {
|
|
|
1608
1607
|
var BadgeContext = react.createContext({});
|
|
1609
1608
|
var BadgeProvider = ({ size, overflow, children }) => {
|
|
1610
1609
|
const [isOverflowing, setIsOverflowing] = react.useState(false);
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
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
|
+
]),
|
|
1624
1622
|
children
|
|
1625
1623
|
});
|
|
1626
1624
|
};
|
|
@@ -1644,13 +1642,23 @@ var useResizeObserver = ({ delay = 500, elements, onResize }) => {
|
|
|
1644
1642
|
react.useLayoutEffect(() => {
|
|
1645
1643
|
onResizeRef.current = onResize;
|
|
1646
1644
|
});
|
|
1647
|
-
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]);
|
|
1648
1655
|
react.useEffect(() => {
|
|
1656
|
+
if (!observer) return;
|
|
1649
1657
|
elements.forEach((element) => {
|
|
1650
|
-
if (element) observer
|
|
1658
|
+
if (element) observer.observe(element);
|
|
1651
1659
|
});
|
|
1652
1660
|
return () => {
|
|
1653
|
-
elements.forEach((element) => element && observer
|
|
1661
|
+
elements.forEach((element) => element && observer.unobserve(element));
|
|
1654
1662
|
};
|
|
1655
1663
|
}, [observer, elements]);
|
|
1656
1664
|
return observer;
|
|
@@ -1658,7 +1666,7 @@ var useResizeObserver = ({ delay = 500, elements, onResize }) => {
|
|
|
1658
1666
|
//#endregion
|
|
1659
1667
|
//#region src/components/badge/BadgeText.tsx
|
|
1660
1668
|
var ObserveBadgeTextOverflow = ({ elRef }) => {
|
|
1661
|
-
const { setIsOverflowing } = react.
|
|
1669
|
+
const { setIsOverflowing } = react.use(BadgeContext);
|
|
1662
1670
|
useResizeObserver({
|
|
1663
1671
|
delay: 0,
|
|
1664
1672
|
elements: [elRef],
|
|
@@ -1686,8 +1694,8 @@ var toTextSize$1 = {
|
|
|
1686
1694
|
md: "md"
|
|
1687
1695
|
};
|
|
1688
1696
|
var BadgeText = ({ children, ...rest }) => {
|
|
1689
|
-
const { size: badgeSize, overflow } = react.
|
|
1690
|
-
const size =
|
|
1697
|
+
const { size: badgeSize, overflow } = react.use(BadgeContext);
|
|
1698
|
+
const size = overrideStyledVariantValue(badgeSize, (s) => toTextSize$1[s]);
|
|
1691
1699
|
const [elRef, setElRef] = useCallbackRefState();
|
|
1692
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, {
|
|
1693
1701
|
size,
|
|
@@ -1759,9 +1767,9 @@ var StyledBadge$1 = styled("div", {
|
|
|
1759
1767
|
]
|
|
1760
1768
|
}, { enableResponsiveVariants: true });
|
|
1761
1769
|
var BadgeInner = ({ ref, theme = "info", emphasis = "subtle", children, style, ...rest }) => {
|
|
1762
|
-
const { size, overflow, isOverflowing } = react.
|
|
1770
|
+
const { size, overflow, isOverflowing } = react.use(BadgeContext);
|
|
1763
1771
|
const [badgeElRef, setBadgeElRef] = useCallbackRefState();
|
|
1764
|
-
|
|
1772
|
+
const composedBadgeRef = (0, _radix_ui_react_compose_refs.useComposedRefs)(ref, setBadgeElRef);
|
|
1765
1773
|
const label = badgeElRef?.textContent;
|
|
1766
1774
|
const isInfoOnly = badgeSemanticNames.includes(theme);
|
|
1767
1775
|
const isClickable = Object.keys(rest).includes("onClick") || Object.keys(rest).includes("href");
|
|
@@ -1777,7 +1785,7 @@ var BadgeInner = ({ ref, theme = "info", emphasis = "subtle", children, style, .
|
|
|
1777
1785
|
...style
|
|
1778
1786
|
},
|
|
1779
1787
|
...rest,
|
|
1780
|
-
ref:
|
|
1788
|
+
ref: composedBadgeRef,
|
|
1781
1789
|
isClickable: isClickable && !isInfoOnly,
|
|
1782
1790
|
children: react.Children.map(children, (child) => {
|
|
1783
1791
|
if (typeof child === "string" || typeof child === "number") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BadgeText, { children: child });
|
|
@@ -1811,27 +1819,26 @@ var DismissibleRootContext = react.createContext({
|
|
|
1811
1819
|
});
|
|
1812
1820
|
var DismissibleRootProvider = ({ dismissed: controlledIsDismissed, children, disabled, onDismiss = () => null }) => {
|
|
1813
1821
|
const [isDismissed, setIsDismissed] = react.useState(false);
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
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
|
+
}, [
|
|
1817
1832
|
disabled,
|
|
1818
|
-
isDismissed
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
}, [
|
|
1823
|
-
disabled,
|
|
1824
|
-
isDismissed,
|
|
1825
|
-
onDismiss,
|
|
1826
|
-
controlledIsDismissed
|
|
1827
|
-
]);
|
|
1828
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DismissibleRootContext.Provider, {
|
|
1829
|
-
value,
|
|
1833
|
+
isDismissed,
|
|
1834
|
+
onDismiss,
|
|
1835
|
+
controlledIsDismissed
|
|
1836
|
+
]),
|
|
1830
1837
|
children
|
|
1831
1838
|
});
|
|
1832
1839
|
};
|
|
1833
1840
|
var DismissibleRootInternal = ({ asChild = false, ...rest }) => {
|
|
1834
|
-
const { isDismissed, disabled } = react.
|
|
1841
|
+
const { isDismissed, disabled } = react.use(DismissibleRootContext);
|
|
1835
1842
|
if (isDismissed) return null;
|
|
1836
1843
|
const props = {
|
|
1837
1844
|
...disabled && { [`data-disabled`]: "" },
|
|
@@ -1854,7 +1861,7 @@ var DefaultTrigger = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("butt
|
|
|
1854
1861
|
children: "Dismiss"
|
|
1855
1862
|
});
|
|
1856
1863
|
var DismissibleTrigger = ({ asChild = false, ...rest }) => {
|
|
1857
|
-
const context = react.
|
|
1864
|
+
const context = react.use(DismissibleRootContext);
|
|
1858
1865
|
if (context === void 0) throw new Error("Dismissible.Trigger can only be used within a Dismissible.Item");
|
|
1859
1866
|
const { setIsDismissed, disabled, onDismiss } = context;
|
|
1860
1867
|
const handleDismiss = () => {
|
|
@@ -1883,7 +1890,7 @@ var BannerContext = react.createContext({
|
|
|
1883
1890
|
setHasDismiss: () => null
|
|
1884
1891
|
});
|
|
1885
1892
|
var useBannerContext = () => {
|
|
1886
|
-
const context = react.
|
|
1893
|
+
const context = react.use(BannerContext);
|
|
1887
1894
|
if (context === void 0) throw new Error("useBannerContext must be used within a BannerProvider");
|
|
1888
1895
|
return context;
|
|
1889
1896
|
};
|
|
@@ -1892,19 +1899,18 @@ var BannerProvider = ({ emphasis = "minimal", size = {
|
|
|
1892
1899
|
"@md": "md"
|
|
1893
1900
|
}, children }) => {
|
|
1894
1901
|
const [hasDismiss, setHasDismiss] = react.useState(false);
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
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
|
+
]),
|
|
1908
1914
|
children
|
|
1909
1915
|
});
|
|
1910
1916
|
};
|
|
@@ -1918,7 +1924,7 @@ var BannerRegularButton = (props) => {
|
|
|
1918
1924
|
const { emphasis, size } = useBannerContext();
|
|
1919
1925
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
1920
1926
|
size,
|
|
1921
|
-
fullWidth:
|
|
1927
|
+
fullWidth: overrideStyledVariantValue(size, (s) => s === "sm"),
|
|
1922
1928
|
theme: emphasis === "bold" ? "neutral" : "primary",
|
|
1923
1929
|
...props
|
|
1924
1930
|
});
|
|
@@ -1937,14 +1943,8 @@ var toDirection$1 = {
|
|
|
1937
1943
|
};
|
|
1938
1944
|
var BannerRegularActions = ({ children, className, ...rest }) => {
|
|
1939
1945
|
const { size } = useBannerContext();
|
|
1940
|
-
const gap =
|
|
1941
|
-
|
|
1942
|
-
return "gap-2 md:gap-4";
|
|
1943
|
-
}, [size]);
|
|
1944
|
-
const direction = react.useMemo(() => {
|
|
1945
|
-
if (typeof size === "string") return toDirection$1[size];
|
|
1946
|
-
return "flex-col md:flex-row";
|
|
1947
|
-
}, [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";
|
|
1948
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}`);
|
|
1949
1949
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1950
1950
|
className: cn("flex", gap, direction, className),
|
|
@@ -2046,7 +2046,7 @@ var BannerRegularDismiss = ({ label = "dismiss", ...rest }) => {
|
|
|
2046
2046
|
setHasDismiss(false);
|
|
2047
2047
|
};
|
|
2048
2048
|
}, [setHasDismiss]);
|
|
2049
|
-
const actionIconSize =
|
|
2049
|
+
const actionIconSize = overrideStyledVariantValue(size, (s) => toActionIconSize[s]);
|
|
2050
2050
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Banner.Dismiss, {
|
|
2051
2051
|
asChild: true,
|
|
2052
2052
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledDismiss$1, {
|
|
@@ -2188,7 +2188,7 @@ var BannerSlimButton = (({ className, ...rest }) => {
|
|
|
2188
2188
|
const { emphasis, size } = useBannerContext();
|
|
2189
2189
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
2190
2190
|
size: "md",
|
|
2191
|
-
fullWidth:
|
|
2191
|
+
fullWidth: overrideStyledVariantValue(size, (s) => s === "sm"),
|
|
2192
2192
|
theme: emphasis === "bold" ? "neutral" : "primary",
|
|
2193
2193
|
...rest,
|
|
2194
2194
|
className: cn("ml-auto", className)
|
|
@@ -2218,18 +2218,9 @@ var StyledBannerSlimContainer = styled(BannerContainer, {
|
|
|
2218
2218
|
}, { enableResponsiveVariants: true });
|
|
2219
2219
|
var BannerSlimContainer = ({ className, ...rest }) => {
|
|
2220
2220
|
const { size } = useBannerContext();
|
|
2221
|
-
const direction =
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
}, [size]);
|
|
2225
|
-
const align = react.useMemo(() => {
|
|
2226
|
-
if (typeof size === "string") return toAlign[size];
|
|
2227
|
-
return "items-start md:items-center";
|
|
2228
|
-
}, [size]);
|
|
2229
|
-
const wrap = react.useMemo(() => {
|
|
2230
|
-
if (typeof size === "string") return toWrap[size];
|
|
2231
|
-
return "flex-wrap md:flex-nowrap";
|
|
2232
|
-
}, [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";
|
|
2233
2224
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledBannerSlimContainer, {
|
|
2234
2225
|
...rest,
|
|
2235
2226
|
sizeWorkaround: size,
|
|
@@ -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,
|
|
@@ -6613,7 +6632,7 @@ var StyledContent$1 = styled(_radix_ui_react_dialog.Content, {
|
|
|
6613
6632
|
}
|
|
6614
6633
|
});
|
|
6615
6634
|
var DrawerContent = ({ children, ...rest }) => {
|
|
6616
|
-
const { position } = react.
|
|
6635
|
+
const { position } = react.use(DrawerContext);
|
|
6617
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, {
|
|
6618
6637
|
base: "grey1",
|
|
6619
6638
|
accent: "primary1",
|
|
@@ -6634,9 +6653,8 @@ var DrawerContent = ({ children, ...rest }) => {
|
|
|
6634
6653
|
//#region src/components/drawer/Drawer.context.tsx
|
|
6635
6654
|
var DrawerContext = react.createContext({ position: "left" });
|
|
6636
6655
|
var DrawerProvider = ({ position = "left", ...rest }) => {
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
value,
|
|
6656
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DrawerContext, {
|
|
6657
|
+
value: react.useMemo(() => ({ position }), [position]),
|
|
6640
6658
|
...rest
|
|
6641
6659
|
});
|
|
6642
6660
|
};
|
|
@@ -6832,13 +6850,14 @@ var Form = (props) => {
|
|
|
6832
6850
|
defaultValues,
|
|
6833
6851
|
mode: validationMode
|
|
6834
6852
|
});
|
|
6853
|
+
const customContextValue = react.useMemo(() => ({
|
|
6854
|
+
appearance,
|
|
6855
|
+
theme
|
|
6856
|
+
}), [appearance, theme]);
|
|
6835
6857
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_hook_form.FormProvider, {
|
|
6836
6858
|
...methods,
|
|
6837
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormCustomContext
|
|
6838
|
-
value:
|
|
6839
|
-
appearance,
|
|
6840
|
-
theme
|
|
6841
|
-
},
|
|
6859
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FormCustomContext, {
|
|
6860
|
+
value: customContextValue,
|
|
6842
6861
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("form", {
|
|
6843
6862
|
"aria-label": "form",
|
|
6844
6863
|
onSubmit: methods.handleSubmit(onSubmit, onError),
|
|
@@ -7081,28 +7100,28 @@ var defaultComponentsMap = {
|
|
|
7081
7100
|
text: MarkdownText,
|
|
7082
7101
|
thematicBreak: MarkdownThematicBreak
|
|
7083
7102
|
};
|
|
7084
|
-
var generateNodeKey = (node) => {
|
|
7103
|
+
var generateNodeKey = (node, index) => {
|
|
7085
7104
|
if (node.position?.start) {
|
|
7086
7105
|
const { line, column, offset } = node.position.start;
|
|
7087
7106
|
return `${node.type}${line}${column}${offset}`;
|
|
7088
7107
|
}
|
|
7089
|
-
return `${node.type}${
|
|
7108
|
+
return `${node.type}${index}`;
|
|
7090
7109
|
};
|
|
7091
7110
|
var MarkdownContent = ({ content, customComponents = {}, className }) => {
|
|
7092
|
-
const AST = (0, mdast_util_from_markdown.
|
|
7093
|
-
extensions: [(0, micromark_extension_directive.
|
|
7094
|
-
mdastExtensions: [mdast_util_directive.
|
|
7111
|
+
const AST = (0, mdast_util_from_markdown.fromMarkdown)(content, {
|
|
7112
|
+
extensions: [(0, micromark_extension_directive.directive)()],
|
|
7113
|
+
mdastExtensions: [(0, mdast_util_directive.directiveFromMarkdown)()]
|
|
7095
7114
|
});
|
|
7096
7115
|
const componentsMap = {
|
|
7097
7116
|
...defaultComponentsMap,
|
|
7098
7117
|
...customComponents
|
|
7099
7118
|
};
|
|
7100
|
-
const handleNode = (node) => {
|
|
7119
|
+
const handleNode = (node, index = 0) => {
|
|
7101
7120
|
const MarkdownComponent = componentsMap[node.type];
|
|
7102
7121
|
return MarkdownComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkdownComponent, {
|
|
7103
7122
|
node,
|
|
7104
7123
|
handleNode
|
|
7105
|
-
}, generateNodeKey(node)) : null;
|
|
7124
|
+
}, generateNodeKey(node, index)) : null;
|
|
7106
7125
|
};
|
|
7107
7126
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMarkdownContent, {
|
|
7108
7127
|
className,
|
|
@@ -7133,7 +7152,7 @@ var colorSchemes$2 = { light: {
|
|
|
7133
7152
|
//#region src/components/navigation/NavigationMenu.context.tsx
|
|
7134
7153
|
var NavigationMenuContext = react.createContext(void 0);
|
|
7135
7154
|
var useNavigationMenuContext = () => {
|
|
7136
|
-
const context = react.
|
|
7155
|
+
const context = react.use(NavigationMenuContext);
|
|
7137
7156
|
if (context === void 0) throw new Error("useNavigationMenuContext must be used within a NavigationMenuContextProvider");
|
|
7138
7157
|
return context;
|
|
7139
7158
|
};
|
|
@@ -7331,10 +7350,10 @@ var ViewportPosition = styled("div", { base: [
|
|
|
7331
7350
|
var NavigationMenuComponent = ({ children, className, ...rest }) => {
|
|
7332
7351
|
const [offset, setOffset] = react.useState();
|
|
7333
7352
|
const [activeItem, setActiveItem] = react.useState();
|
|
7334
|
-
const [listWidth, setListWidth] = react.useState(0);
|
|
7335
7353
|
const listRef = react.useRef(null);
|
|
7336
|
-
react.
|
|
7337
|
-
|
|
7354
|
+
const listWidthRef = react.useRef(0);
|
|
7355
|
+
react.useLayoutEffect(() => {
|
|
7356
|
+
if (listRef.current) listWidthRef.current = listRef.current.offsetWidth;
|
|
7338
7357
|
}, [react.Children.toArray(children).length]);
|
|
7339
7358
|
react.useEffect(() => {
|
|
7340
7359
|
let timer;
|
|
@@ -7343,16 +7362,17 @@ var NavigationMenuComponent = ({ children, className, ...rest }) => {
|
|
|
7343
7362
|
if (timer !== null) clearTimeout(timer);
|
|
7344
7363
|
};
|
|
7345
7364
|
}, [activeItem]);
|
|
7346
|
-
const onNodeUpdate = (trigger, itemValue) => {
|
|
7365
|
+
const onNodeUpdate = react.useCallback((trigger, itemValue) => {
|
|
7366
|
+
const listWidth = listWidthRef.current;
|
|
7347
7367
|
if (trigger && listWidth && activeItem === itemValue) {
|
|
7348
7368
|
const listCenter = listWidth / 2;
|
|
7349
7369
|
const triggerOffsetRight = listWidth - trigger.offsetLeft - trigger.offsetWidth + trigger.offsetWidth / 2;
|
|
7350
7370
|
setOffset(Math.round(listCenter - triggerOffsetRight));
|
|
7351
7371
|
}
|
|
7352
7372
|
return trigger;
|
|
7353
|
-
};
|
|
7354
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuContext
|
|
7355
|
-
value: { onNodeUpdate },
|
|
7373
|
+
}, [activeItem]);
|
|
7374
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuContext, {
|
|
7375
|
+
value: react.useMemo(() => ({ onNodeUpdate }), [onNodeUpdate]),
|
|
7356
7376
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledMenu, {
|
|
7357
7377
|
className: cn(className),
|
|
7358
7378
|
style: colorSchemes$2["light"],
|
|
@@ -7400,11 +7420,11 @@ var NavigationMenuVerticalItem = (props) => /* @__PURE__ */ (0, react_jsx_runtim
|
|
|
7400
7420
|
var NavigationMenuVerticalAccordionContext = react.createContext({});
|
|
7401
7421
|
var NavigationMenuVerticalAccordionProvider = ({ children }) => {
|
|
7402
7422
|
const [triggerRef, setTriggerRef] = useCallbackRef();
|
|
7403
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuVerticalAccordionContext
|
|
7404
|
-
value: {
|
|
7423
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationMenuVerticalAccordionContext, {
|
|
7424
|
+
value: react.useMemo(() => ({
|
|
7405
7425
|
triggerRef,
|
|
7406
7426
|
setTriggerRef
|
|
7407
|
-
},
|
|
7427
|
+
}), [triggerRef, setTriggerRef]),
|
|
7408
7428
|
children
|
|
7409
7429
|
});
|
|
7410
7430
|
};
|
|
@@ -7423,7 +7443,7 @@ var NavigationMenuVerticalList = styled(_radix_ui_react_navigation_menu.List, {
|
|
|
7423
7443
|
//#region src/components/navigation-menu-vertical/NavigationMenuVerticalAccordionContent.tsx
|
|
7424
7444
|
var StyledNavigationMenuVerticalAccordionContent = _radix_ui_react_collapsible.Content;
|
|
7425
7445
|
var NavigationMenuVerticalAccordionContent = ({ children, ...rest }) => {
|
|
7426
|
-
const { triggerRef } = react.
|
|
7446
|
+
const { triggerRef } = react.use(NavigationMenuVerticalAccordionContext);
|
|
7427
7447
|
const handleOnKeydown = (e) => {
|
|
7428
7448
|
if (!triggerRef?.current) return;
|
|
7429
7449
|
if (e.key === "Escape") {
|
|
@@ -7481,7 +7501,7 @@ var NavigationMenuVerticalIcon = (props) => /* @__PURE__ */ (0, react_jsx_runtim
|
|
|
7481
7501
|
//#endregion
|
|
7482
7502
|
//#region src/components/side-bar/SideBar.context.tsx
|
|
7483
7503
|
var SideBarContext = react.createContext({ isExpanded: void 0 });
|
|
7484
|
-
var useSidebarState = () => react.
|
|
7504
|
+
var useSidebarState = () => react.use(SideBarContext);
|
|
7485
7505
|
//#endregion
|
|
7486
7506
|
//#region src/components/navigation-menu-vertical/NavigationMenuVerticalText.tsx
|
|
7487
7507
|
var StyledNavigationMenuVerticalText = styled(Text, {
|
|
@@ -7534,7 +7554,7 @@ var StyledIcon = styled(Icon, { base: [
|
|
|
7534
7554
|
"[[data-state=open]>&]:rotate-180"
|
|
7535
7555
|
] });
|
|
7536
7556
|
var NavigationMenuVerticalAccordionTrigger = ({ children, ...rest }) => {
|
|
7537
|
-
const { setTriggerRef } = react.
|
|
7557
|
+
const { setTriggerRef } = react.use(NavigationMenuVerticalAccordionContext);
|
|
7538
7558
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_navigation_menu.Link, {
|
|
7539
7559
|
asChild: true,
|
|
7540
7560
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledNavigationMenuVerticalAccordionTrigger, {
|
|
@@ -7716,13 +7736,11 @@ var NumberInputContainer = styled("div", {
|
|
|
7716
7736
|
}
|
|
7717
7737
|
});
|
|
7718
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 }) => {
|
|
7719
|
-
const [internalValue, setInternalValue] = react.useState(value
|
|
7720
|
-
|
|
7721
|
-
if (typeof value !== "undefined") setInternalValue(value);
|
|
7722
|
-
}, [value]);
|
|
7739
|
+
const [internalValue, setInternalValue] = react.useState(value ?? defaultValue);
|
|
7740
|
+
const currentValue = value ?? internalValue;
|
|
7723
7741
|
const inputRef = react.useRef(null);
|
|
7724
|
-
|
|
7725
|
-
const iconSize =
|
|
7742
|
+
const composedInputRef = (0, _radix_ui_react_compose_refs.useComposedRefs)(ref, inputRef);
|
|
7743
|
+
const iconSize = getFieldIconSize(size);
|
|
7726
7744
|
const stepperButtonLabels = {
|
|
7727
7745
|
increment: "increment",
|
|
7728
7746
|
decrement: "decrement",
|
|
@@ -7733,8 +7751,8 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7733
7751
|
increment: `Cannot enter values above ${max}`,
|
|
7734
7752
|
...disabledTooltipContentProp
|
|
7735
7753
|
};
|
|
7736
|
-
const isAtMax =
|
|
7737
|
-
const isAtMin =
|
|
7754
|
+
const isAtMax = currentValue >= max;
|
|
7755
|
+
const isAtMin = currentValue <= min;
|
|
7738
7756
|
const clamp = react.useCallback((internalValue) => Math.min(Math.max(internalValue, min), max), [max, min]);
|
|
7739
7757
|
const updateValue = react.useCallback((newValue) => {
|
|
7740
7758
|
onValueChange?.(newValue);
|
|
@@ -7746,19 +7764,19 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7746
7764
|
const increment = react.useCallback(() => {
|
|
7747
7765
|
if (isAtMax || isReadOnly) return;
|
|
7748
7766
|
inputRef?.current?.focus();
|
|
7749
|
-
updateValue(clamp(Number(
|
|
7767
|
+
updateValue(clamp(Number(currentValue) + step));
|
|
7750
7768
|
}, [
|
|
7751
7769
|
clamp,
|
|
7752
7770
|
isAtMax,
|
|
7753
7771
|
isReadOnly,
|
|
7754
7772
|
step,
|
|
7755
7773
|
updateValue,
|
|
7756
|
-
|
|
7774
|
+
currentValue
|
|
7757
7775
|
]);
|
|
7758
7776
|
const decrement = react.useCallback(() => {
|
|
7759
7777
|
if (isAtMin || isReadOnly) return;
|
|
7760
7778
|
inputRef?.current?.focus();
|
|
7761
|
-
updateValue(clamp(Number(
|
|
7779
|
+
updateValue(clamp(Number(currentValue) - step));
|
|
7762
7780
|
}, [
|
|
7763
7781
|
clamp,
|
|
7764
7782
|
isAtMin,
|
|
@@ -7766,7 +7784,7 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7766
7784
|
min,
|
|
7767
7785
|
step,
|
|
7768
7786
|
updateValue,
|
|
7769
|
-
|
|
7787
|
+
currentValue
|
|
7770
7788
|
]);
|
|
7771
7789
|
const onKeyDown = react.useCallback((event) => {
|
|
7772
7790
|
if (event.nativeEvent.isComposing) return;
|
|
@@ -7798,11 +7816,11 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7798
7816
|
min,
|
|
7799
7817
|
max
|
|
7800
7818
|
]);
|
|
7801
|
-
const hasError =
|
|
7819
|
+
const hasError = currentValue < min || currentValue > max;
|
|
7802
7820
|
const { state: externalState, "aria-invalid": externalAriaInvalid, ...restProps } = rest;
|
|
7803
7821
|
const inputProps = {
|
|
7804
7822
|
type: "number",
|
|
7805
|
-
value:
|
|
7823
|
+
value: currentValue,
|
|
7806
7824
|
...restProps,
|
|
7807
7825
|
onChange: onInputChange,
|
|
7808
7826
|
onKeyDown,
|
|
@@ -7822,12 +7840,12 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7822
7840
|
"focus-within:border-2",
|
|
7823
7841
|
"focus-within:border-blue-800"
|
|
7824
7842
|
]),
|
|
7825
|
-
ref:
|
|
7843
|
+
ref: composedInputRef,
|
|
7826
7844
|
readOnly: isReadOnly,
|
|
7827
7845
|
disabled: isDisabled,
|
|
7828
7846
|
"aria-valuemin": min,
|
|
7829
7847
|
"aria-valuemax": max,
|
|
7830
|
-
"aria-valuenow":
|
|
7848
|
+
"aria-valuenow": currentValue,
|
|
7831
7849
|
role: "spinbutton"
|
|
7832
7850
|
};
|
|
7833
7851
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NumberInputContainer, {
|
|
@@ -7868,7 +7886,7 @@ var NumberInput = ({ ref, value, defaultValue = 0, onValueChange, min = 0, max =
|
|
|
7868
7886
|
//#endregion
|
|
7869
7887
|
//#region src/components/number-input-field/NumberInputField.tsx
|
|
7870
7888
|
var NumberInputField = ({ className, defaultValue = 0, hideLabel, value, prompt, description, label, name, validation, onValueChange, appearance, theme, ...rest }) => {
|
|
7871
|
-
const { control } = (0, react_hook_form.useFormContext)();
|
|
7889
|
+
const { control, setValue } = (0, react_hook_form.useFormContext)();
|
|
7872
7890
|
const context = useFormCustomContext();
|
|
7873
7891
|
const { field: { ref, onChange, value: innerValue, name: innerName } } = (0, react_hook_form.useController)({
|
|
7874
7892
|
name,
|
|
@@ -7880,8 +7898,12 @@ var NumberInputField = ({ className, defaultValue = 0, hideLabel, value, prompt,
|
|
|
7880
7898
|
const formAppearance = context?.appearance || appearance;
|
|
7881
7899
|
const formTheme = context?.theme ?? theme;
|
|
7882
7900
|
react.useEffect(() => {
|
|
7883
|
-
if (typeof value !== "undefined")
|
|
7884
|
-
}, [
|
|
7901
|
+
if (typeof value !== "undefined") setValue(name, value, { shouldDirty: false });
|
|
7902
|
+
}, [
|
|
7903
|
+
value,
|
|
7904
|
+
name,
|
|
7905
|
+
setValue
|
|
7906
|
+
]);
|
|
7885
7907
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
|
|
7886
7908
|
className,
|
|
7887
7909
|
description,
|
|
@@ -7990,7 +8012,7 @@ var Fieldset = styled("fieldset", { base: [
|
|
|
7990
8012
|
"min-w-0"
|
|
7991
8013
|
] });
|
|
7992
8014
|
var RadioButtonFieldComponent = ({ children, className, direction = "column", defaultValue, value, description, label, name, validation, onValueChange, ...rest }) => {
|
|
7993
|
-
const { control } = (0, react_hook_form.useFormContext)();
|
|
8015
|
+
const { control, setValue } = (0, react_hook_form.useFormContext)();
|
|
7994
8016
|
const { field: { ref, onChange, value: innerValue } } = (0, react_hook_form.useController)({
|
|
7995
8017
|
name,
|
|
7996
8018
|
control,
|
|
@@ -7999,8 +8021,12 @@ var RadioButtonFieldComponent = ({ children, className, direction = "column", de
|
|
|
7999
8021
|
});
|
|
8000
8022
|
const { error } = useFieldError(name);
|
|
8001
8023
|
react.useEffect(() => {
|
|
8002
|
-
if (typeof value !== "undefined")
|
|
8003
|
-
}, [
|
|
8024
|
+
if (typeof value !== "undefined") setValue(name, value, { shouldDirty: false });
|
|
8025
|
+
}, [
|
|
8026
|
+
value,
|
|
8027
|
+
name,
|
|
8028
|
+
setValue
|
|
8029
|
+
]);
|
|
8004
8030
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Fieldset, {
|
|
8005
8031
|
className,
|
|
8006
8032
|
children: [
|
|
@@ -8176,26 +8202,25 @@ var SectionMessageContext = react.createContext(null);
|
|
|
8176
8202
|
var SectionMessageProvider = ({ theme = "info", children }) => {
|
|
8177
8203
|
const [hasIcon, setHasIcon] = react.useState(false);
|
|
8178
8204
|
const [hasDismiss, setHasDismiss] = react.useState(false);
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
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
|
+
]),
|
|
8194
8219
|
children
|
|
8195
8220
|
});
|
|
8196
8221
|
};
|
|
8197
8222
|
var useSectionMessageContext = () => {
|
|
8198
|
-
const context = react.
|
|
8223
|
+
const context = react.use(SectionMessageContext);
|
|
8199
8224
|
if (!context) throw new Error("useSectionMessageContext must be used within a SectionMessageProvider");
|
|
8200
8225
|
return context;
|
|
8201
8226
|
};
|
|
@@ -8475,7 +8500,7 @@ var SelectMenuContext = react.createContext({
|
|
|
8475
8500
|
size: "md",
|
|
8476
8501
|
theme: "grey"
|
|
8477
8502
|
});
|
|
8478
|
-
var useSelectMenuContext = () => react.
|
|
8503
|
+
var useSelectMenuContext = () => react.use(SelectMenuContext);
|
|
8479
8504
|
//#endregion
|
|
8480
8505
|
//#region src/components/select-menu/SelectMenuContent.tsx
|
|
8481
8506
|
var Content$2 = styled(_radix_ui_react_select.Content, {
|
|
@@ -8698,17 +8723,23 @@ var SelectMenuTrigger = ({ ref, placeholder, children, ...rest }) => {
|
|
|
8698
8723
|
};
|
|
8699
8724
|
//#endregion
|
|
8700
8725
|
//#region src/components/select-menu/SelectMenu.tsx
|
|
8701
|
-
var SelectMenuRoot = ({ size = "md", theme = "grey", state, children, ...rest }) =>
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
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
|
+
};
|
|
8712
8743
|
var SelectMenu = /* @__PURE__ */ Object.assign(SelectMenuRoot, {
|
|
8713
8744
|
Trigger: SelectMenuTrigger,
|
|
8714
8745
|
Content: SelectMenuContent,
|
|
@@ -8869,8 +8900,8 @@ var SideBarComponent = ({ theme, className, children, type = "expandable", offse
|
|
|
8869
8900
|
...touchProps,
|
|
8870
8901
|
ref
|
|
8871
8902
|
} : {};
|
|
8872
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SideBarContext
|
|
8873
|
-
value: { isExpanded },
|
|
8903
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SideBarContext, {
|
|
8904
|
+
value: react.useMemo(() => ({ isExpanded }), [isExpanded]),
|
|
8874
8905
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Theme, {
|
|
8875
8906
|
theme: theme || light$1,
|
|
8876
8907
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$2, {
|
|
@@ -9006,16 +9037,21 @@ var Slider = /* @__PURE__ */ Object.assign(SliderComponent, {
|
|
|
9006
9037
|
//#endregion
|
|
9007
9038
|
//#region src/components/slider-field/SliderField.tsx
|
|
9008
9039
|
var SliderField = ({ className, hideLabel, label, name, defaultValue, value, validation, outputLabel, min = 0, max = 100, steps = [], ...rest }) => {
|
|
9009
|
-
const { control } = (0, react_hook_form.useFormContext)();
|
|
9040
|
+
const { control, setValue } = (0, react_hook_form.useFormContext)();
|
|
9010
9041
|
const { field: { ref, onChange, value: innerValue, name: innerName } } = (0, react_hook_form.useController)({
|
|
9011
9042
|
name,
|
|
9012
9043
|
control,
|
|
9013
9044
|
rules: validation,
|
|
9014
9045
|
defaultValue
|
|
9015
9046
|
});
|
|
9047
|
+
const serializedValue = JSON.stringify(value);
|
|
9016
9048
|
react.useEffect(() => {
|
|
9017
|
-
if (value
|
|
9018
|
-
}, [
|
|
9049
|
+
if (typeof value !== "undefined") setValue(name, value, { shouldDirty: false });
|
|
9050
|
+
}, [
|
|
9051
|
+
serializedValue,
|
|
9052
|
+
name,
|
|
9053
|
+
setValue
|
|
9054
|
+
]);
|
|
9019
9055
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldWrapper, {
|
|
9020
9056
|
className,
|
|
9021
9057
|
fieldId: name,
|
|
@@ -9270,43 +9306,37 @@ var Spacer = styled("div", { base: [
|
|
|
9270
9306
|
Spacer.displayName = "Spacer";
|
|
9271
9307
|
//#endregion
|
|
9272
9308
|
//#region src/components/stepper/Stepper.context.tsx
|
|
9273
|
-
var StepperContext = react.createContext(
|
|
9274
|
-
steps: [],
|
|
9275
|
-
goToPreviousStep: () => null,
|
|
9276
|
-
goToNextStep: () => null,
|
|
9277
|
-
goToStep: () => null,
|
|
9278
|
-
activeStep: 0,
|
|
9279
|
-
viewedSteps: [],
|
|
9280
|
-
allowSkip: false,
|
|
9281
|
-
direction: "horizontal",
|
|
9282
|
-
hideLabels: false,
|
|
9283
|
-
completedSteps: [],
|
|
9284
|
-
showCompletedIcons: false
|
|
9285
|
-
});
|
|
9309
|
+
var StepperContext = react.createContext(null);
|
|
9286
9310
|
var StepperProvider = ({ children, stepCount, allowSkip, onComplete, onStepChange, direction, steps, hideLabels, showCompletedIcons }) => {
|
|
9287
9311
|
const [activeStep, setActiveStep] = react.useState(0);
|
|
9288
9312
|
const [viewedSteps, setviewedSteps] = react.useState([0]);
|
|
9289
9313
|
const [completedSteps, setCompletedSteps] = react.useState([]);
|
|
9290
9314
|
const isControlled = !stepCount;
|
|
9291
|
-
react.
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
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(() => {
|
|
9296
9321
|
const isCompleted = onComplete && activeStep === stepCount - 1;
|
|
9297
9322
|
const isNextStep = activeStep < stepCount - 1;
|
|
9298
9323
|
if (onComplete || isNextStep) setCompletedSteps((prev) => prev.includes(activeStep) ? prev : [...prev, activeStep]);
|
|
9299
9324
|
if (isCompleted) return onComplete?.();
|
|
9300
|
-
if (isNextStep) return
|
|
9301
|
-
}
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
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(() => ({
|
|
9310
9340
|
steps: steps || Array(stepCount).fill(""),
|
|
9311
9341
|
goToPreviousStep: isControlled ? void 0 : goToPreviousStep,
|
|
9312
9342
|
goToNextStep: isControlled ? void 0 : goToNextStep,
|
|
@@ -9318,12 +9348,26 @@ var StepperProvider = ({ children, stepCount, allowSkip, onComplete, onStepChang
|
|
|
9318
9348
|
direction,
|
|
9319
9349
|
hideLabels,
|
|
9320
9350
|
showCompletedIcons
|
|
9321
|
-
},
|
|
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
|
+
]),
|
|
9322
9366
|
children
|
|
9323
9367
|
});
|
|
9324
9368
|
};
|
|
9325
9369
|
var useStepper = () => {
|
|
9326
|
-
const context = react.
|
|
9370
|
+
const context = react.use(StepperContext);
|
|
9327
9371
|
if (!context) throw new Error("Ensure that you wrap any components with the root component Stepper");
|
|
9328
9372
|
return context;
|
|
9329
9373
|
};
|
|
@@ -9709,30 +9753,35 @@ var TabsTrigger = ({ ref, children, ...rest }) => /* @__PURE__ */ (0, react_jsx_
|
|
|
9709
9753
|
});
|
|
9710
9754
|
//#endregion
|
|
9711
9755
|
//#region src/utilities/hooks/useScrollPosition.ts
|
|
9756
|
+
var NO_ELEMENT_SNAPSHOT = {
|
|
9757
|
+
left: 0,
|
|
9758
|
+
top: 0
|
|
9759
|
+
};
|
|
9712
9760
|
var useScrollPosition = ({ element, delay = 500, delayMethod = "throttle" }) => {
|
|
9713
|
-
const
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
const delayMethodFn = (0, react.useMemo)(() => delayMethod === "debounce" ? throttle_debounce.debounce : throttle_debounce.throttle, [delayMethod]);
|
|
9718
|
-
(0, react.useEffect)(() => {
|
|
9719
|
-
if (!element) return;
|
|
9720
|
-
const handleScroll = delayMethodFn(delay, () => {
|
|
9721
|
-
setScrollPosition((prev) => prev.left === element.scrollLeft && prev.top === element.scrollTop ? prev : {
|
|
9722
|
-
left: element.scrollLeft,
|
|
9723
|
-
top: element.scrollTop
|
|
9724
|
-
});
|
|
9725
|
-
});
|
|
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);
|
|
9726
9765
|
element.addEventListener("scroll", handleScroll);
|
|
9727
9766
|
return () => {
|
|
9767
|
+
handleScroll.cancel();
|
|
9728
9768
|
element.removeEventListener("scroll", handleScroll);
|
|
9729
9769
|
};
|
|
9730
9770
|
}, [
|
|
9731
9771
|
element,
|
|
9732
|
-
|
|
9733
|
-
|
|
9772
|
+
delay,
|
|
9773
|
+
delayMethod
|
|
9734
9774
|
]);
|
|
9735
|
-
|
|
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);
|
|
9736
9785
|
};
|
|
9737
9786
|
//#endregion
|
|
9738
9787
|
//#region src/utilities/hooks/useSize.ts
|
|
@@ -10043,7 +10092,7 @@ TileToggleGroup.Item = TileToggleGroupItem;
|
|
|
10043
10092
|
//#region src/components/toast/Toast.context.tsx
|
|
10044
10093
|
var ToastContext = react.createContext(null);
|
|
10045
10094
|
var useToastContext = () => {
|
|
10046
|
-
const context = react.
|
|
10095
|
+
const context = react.use(ToastContext);
|
|
10047
10096
|
if (!context) throw new Error("useToastContext must be used within a ToastProvider");
|
|
10048
10097
|
return context;
|
|
10049
10098
|
};
|
|
@@ -10157,7 +10206,7 @@ var ToastProvider = ({ children, className }) => {
|
|
|
10157
10206
|
"aria-live": toast.ariaProps["aria-live"],
|
|
10158
10207
|
style: { "--offset": `${offset}px` },
|
|
10159
10208
|
className: "top-(--offset)",
|
|
10160
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToastContext
|
|
10209
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToastContext, {
|
|
10161
10210
|
value: toast,
|
|
10162
10211
|
children: typeof children === "function" ? children(toast) : react.isValidElement(children) ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Toast$1, {
|
|
10163
10212
|
className: "w-100",
|
|
@@ -10454,25 +10503,29 @@ var ToggleGroup = {
|
|
|
10454
10503
|
};
|
|
10455
10504
|
//#endregion
|
|
10456
10505
|
//#region src/utilities/hooks/useWindowScrollPosition.ts
|
|
10506
|
+
var SERVER_SNAPSHOT = {
|
|
10507
|
+
x: 0,
|
|
10508
|
+
y: 0
|
|
10509
|
+
};
|
|
10457
10510
|
var useWindowScrollPosition = ({ delay = 500, delayMethod = "throttle" } = {}) => {
|
|
10458
|
-
const
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
});
|
|
10462
|
-
const delayMethodFn = (0, react.useMemo)(() => delayMethod === "debounce" ? throttle_debounce.debounce : throttle_debounce.throttle, [delayMethod]);
|
|
10463
|
-
(0, react.useEffect)(() => {
|
|
10464
|
-
const handleScroll = delayMethodFn(delay, () => {
|
|
10465
|
-
setScrollPosition({
|
|
10466
|
-
x: window.scrollX,
|
|
10467
|
-
y: window.scrollY
|
|
10468
|
-
});
|
|
10469
|
-
});
|
|
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);
|
|
10470
10514
|
window.addEventListener("scroll", handleScroll);
|
|
10471
10515
|
return () => {
|
|
10516
|
+
handleScroll.cancel();
|
|
10472
10517
|
window.removeEventListener("scroll", handleScroll);
|
|
10473
10518
|
};
|
|
10474
|
-
}, [
|
|
10475
|
-
|
|
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);
|
|
10476
10529
|
};
|
|
10477
10530
|
var colorSchemes = { light: {
|
|
10478
10531
|
"--background": "white",
|
|
@@ -10598,8 +10651,6 @@ var Video = ({ ref, id, ratio = 9 / 16, className, ...rest }) => /* @__PURE__ */
|
|
|
10598
10651
|
//#endregion
|
|
10599
10652
|
//#region src/components/keyboard-shortcut/KeyboardShortcut.tsx
|
|
10600
10653
|
var KeyboardShortcut$1 = ({ ref, asChild, config, targetWindow = false, onKeyDown, ...rest }) => {
|
|
10601
|
-
const [targetElRef, setTargetElRef] = useCallbackRefState();
|
|
10602
|
-
react.useImperativeHandle(ref, () => targetElRef);
|
|
10603
10654
|
const handleOnKeydown = react.useCallback((e) => {
|
|
10604
10655
|
config.forEach(({ shortcut, action }) => {
|
|
10605
10656
|
if (Object.entries(shortcut).every(([key, value]) => e[key] === value)) action({
|
|
@@ -10609,15 +10660,21 @@ var KeyboardShortcut$1 = ({ ref, asChild, config, targetWindow = false, onKeyDow
|
|
|
10609
10660
|
});
|
|
10610
10661
|
onKeyDown?.(e);
|
|
10611
10662
|
}, [config, onKeyDown]);
|
|
10663
|
+
const handleOnKeydownRef = react.useRef(handleOnKeydown);
|
|
10664
|
+
react.useLayoutEffect(() => {
|
|
10665
|
+
handleOnKeydownRef.current = handleOnKeydown;
|
|
10666
|
+
});
|
|
10612
10667
|
react.useEffect(() => {
|
|
10613
|
-
if (targetWindow)
|
|
10668
|
+
if (!targetWindow) return;
|
|
10669
|
+
const listener = (e) => handleOnKeydownRef.current(e);
|
|
10670
|
+
window.addEventListener("keydown", listener);
|
|
10614
10671
|
return () => {
|
|
10615
|
-
window.removeEventListener("keydown",
|
|
10672
|
+
window.removeEventListener("keydown", listener);
|
|
10616
10673
|
};
|
|
10617
|
-
}, [targetWindow
|
|
10674
|
+
}, [targetWindow]);
|
|
10618
10675
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "div", {
|
|
10619
10676
|
onKeyDown: targetWindow ? void 0 : handleOnKeydown,
|
|
10620
|
-
ref
|
|
10677
|
+
ref,
|
|
10621
10678
|
...rest
|
|
10622
10679
|
});
|
|
10623
10680
|
};
|
|
@@ -10663,7 +10720,7 @@ var badgeSizeMap = {
|
|
|
10663
10720
|
lg: "sm"
|
|
10664
10721
|
};
|
|
10665
10722
|
var SegmentedControlBadge = ({ className, ...rest }) => {
|
|
10666
|
-
const { size } = react.
|
|
10723
|
+
const { size } = react.use(SegmentedControlContext);
|
|
10667
10724
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
|
|
10668
10725
|
...rest,
|
|
10669
10726
|
size: badgeSizeMap[size],
|
|
@@ -10688,7 +10745,7 @@ var StyledText = styled(Text, {
|
|
|
10688
10745
|
} }
|
|
10689
10746
|
}, { enableResponsiveVariants: true });
|
|
10690
10747
|
var SegmentedControlDescription = (props) => {
|
|
10691
|
-
const { size } = react.
|
|
10748
|
+
const { size } = react.use(SegmentedControlContext);
|
|
10692
10749
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledText, {
|
|
10693
10750
|
...props,
|
|
10694
10751
|
size
|
|
@@ -10705,7 +10762,7 @@ var StyledHeading = styled(Text, {
|
|
|
10705
10762
|
} }
|
|
10706
10763
|
}, { enableResponsiveVariants: true });
|
|
10707
10764
|
var SegmentedControlHeading = (props) => {
|
|
10708
|
-
const { size } = react.
|
|
10765
|
+
const { size } = react.use(SegmentedControlContext);
|
|
10709
10766
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledHeading, {
|
|
10710
10767
|
...props,
|
|
10711
10768
|
size
|
|
@@ -10719,7 +10776,7 @@ var sizeMap = {
|
|
|
10719
10776
|
lg: "md"
|
|
10720
10777
|
};
|
|
10721
10778
|
var SegmentedControlIcon = (props) => {
|
|
10722
|
-
const { size } = react.
|
|
10779
|
+
const { size } = react.use(SegmentedControlContext);
|
|
10723
10780
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
10724
10781
|
...props,
|
|
10725
10782
|
size: sizeMap[size]
|
|
@@ -10787,7 +10844,7 @@ var StyledItem = styled(_radix_ui_react_tabs.Trigger, {
|
|
|
10787
10844
|
}
|
|
10788
10845
|
}, { enableResponsiveVariants: true });
|
|
10789
10846
|
var SegmentedControlItem = ({ ref, children, ...rest }) => {
|
|
10790
|
-
const { size, theme } = react.
|
|
10847
|
+
const { size, theme } = react.use(SegmentedControlContext);
|
|
10791
10848
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledItem, {
|
|
10792
10849
|
...rest,
|
|
10793
10850
|
theme,
|
|
@@ -10828,7 +10885,7 @@ var SelectionIndicator = styled("div", {
|
|
|
10828
10885
|
} }
|
|
10829
10886
|
});
|
|
10830
10887
|
var SegmentedControlItemList = (props) => {
|
|
10831
|
-
const { theme, defaultValue, value } = react.
|
|
10888
|
+
const { theme, defaultValue, value } = react.use(SegmentedControlContext);
|
|
10832
10889
|
const tabsRef = react.useRef([]);
|
|
10833
10890
|
const selectedIndex = react.Children.toArray(props.children).findIndex((child) => child?.props.value === value);
|
|
10834
10891
|
const [indicatorStyles, setIndicatorStyles] = react.useState({
|
|
@@ -10847,26 +10904,28 @@ var SegmentedControlItemList = (props) => {
|
|
|
10847
10904
|
width: Math.round(width)
|
|
10848
10905
|
});
|
|
10849
10906
|
}, [selectedIndex]);
|
|
10907
|
+
const updateIndicatorPositionRef = react.useRef(updateIndicatorPosition);
|
|
10908
|
+
react.useLayoutEffect(() => {
|
|
10909
|
+
updateIndicatorPositionRef.current = updateIndicatorPosition;
|
|
10910
|
+
});
|
|
10911
|
+
const tabCount = react.Children.count(props.children);
|
|
10850
10912
|
react.useEffect(() => {
|
|
10851
|
-
const resizeObserver = new ResizeObserver(
|
|
10852
|
-
|
|
10853
|
-
currentTabs.forEach((tab) => {
|
|
10913
|
+
const resizeObserver = new ResizeObserver(() => updateIndicatorPositionRef.current());
|
|
10914
|
+
tabsRef.current.forEach((tab) => {
|
|
10854
10915
|
if (tab) resizeObserver.observe(tab);
|
|
10855
10916
|
});
|
|
10856
10917
|
return () => {
|
|
10857
|
-
currentTabs.forEach((tab) => {
|
|
10858
|
-
if (tab) resizeObserver.unobserve(tab);
|
|
10859
|
-
});
|
|
10860
10918
|
resizeObserver.disconnect();
|
|
10861
10919
|
};
|
|
10862
|
-
}, [
|
|
10920
|
+
}, [tabCount]);
|
|
10863
10921
|
react.useEffect(() => {
|
|
10864
|
-
|
|
10922
|
+
const handleResize = () => updateIndicatorPositionRef.current();
|
|
10923
|
+
window.addEventListener("resize", handleResize);
|
|
10865
10924
|
return () => {
|
|
10866
|
-
window.removeEventListener("resize",
|
|
10925
|
+
window.removeEventListener("resize", handleResize);
|
|
10867
10926
|
};
|
|
10868
|
-
}, [
|
|
10869
|
-
react.
|
|
10927
|
+
}, []);
|
|
10928
|
+
react.useLayoutEffect(() => {
|
|
10870
10929
|
updateIndicatorPosition();
|
|
10871
10930
|
}, [selectedIndex, updateIndicatorPosition]);
|
|
10872
10931
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledTriggerList, {
|
|
@@ -10883,9 +10942,12 @@ var SegmentedControlItemList = (props) => {
|
|
|
10883
10942
|
setHasInteracted(true);
|
|
10884
10943
|
if (child.props.onClick) child.props.onClick(e);
|
|
10885
10944
|
},
|
|
10886
|
-
ref: (el) => {
|
|
10945
|
+
ref: (0, _radix_ui_react_compose_refs.composeRefs)(child.props.ref, (el) => {
|
|
10887
10946
|
tabsRef.current[index] = el;
|
|
10888
|
-
|
|
10947
|
+
return () => {
|
|
10948
|
+
tabsRef.current[index] = null;
|
|
10949
|
+
};
|
|
10950
|
+
})
|
|
10889
10951
|
});
|
|
10890
10952
|
})]
|
|
10891
10953
|
});
|
|
@@ -10908,24 +10970,20 @@ var SegmentedControlRoot = ({ size, theme = "primary", defaultValue, children, v
|
|
|
10908
10970
|
if (!isControlled) setInternalValue(newValue);
|
|
10909
10971
|
onValueChange?.(newValue);
|
|
10910
10972
|
}, [isControlled, onValueChange]);
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
currentValue
|
|
10926
|
-
]);
|
|
10927
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentedControlContext.Provider, {
|
|
10928
|
-
value: contextValue,
|
|
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
|
+
]),
|
|
10929
10987
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSegmentedControlRoot, {
|
|
10930
10988
|
size,
|
|
10931
10989
|
value: currentValue,
|
|
@@ -10988,11 +11046,11 @@ var FileDrop = ({ children, accept, multiple, onDrop, ...rest }) => {
|
|
|
10988
11046
|
const handleKeyDown = (event) => {
|
|
10989
11047
|
if (["Space", "Enter"].includes(event.key)) fileUploadInputRef.current?.click();
|
|
10990
11048
|
};
|
|
10991
|
-
const value = {
|
|
11049
|
+
const value = react.useMemo(() => ({
|
|
10992
11050
|
isDragging,
|
|
10993
11051
|
files
|
|
10994
|
-
};
|
|
10995
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileDropContext
|
|
11052
|
+
}), [isDragging, files]);
|
|
11053
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileDropContext, {
|
|
10996
11054
|
value,
|
|
10997
11055
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledContainer, {
|
|
10998
11056
|
onDragOver: handleDragOver,
|
|
@@ -11022,10 +11080,7 @@ var FileDrop = ({ children, accept, multiple, onDrop, ...rest }) => {
|
|
|
11022
11080
|
FileDrop.displayName = "FileDrop";
|
|
11023
11081
|
//#endregion
|
|
11024
11082
|
//#region src/components/file-drop/useFileDrop.ts
|
|
11025
|
-
var useFileDrop = () => react.
|
|
11026
|
-
//#endregion
|
|
11027
|
-
//#region src/components/index.ts
|
|
11028
|
-
var Alert = { Provider: AlertProvider };
|
|
11083
|
+
var useFileDrop = () => react.use(FileDropContext);
|
|
11029
11084
|
//#endregion
|
|
11030
11085
|
exports.Accordion = Accordion;
|
|
11031
11086
|
exports.ActionIcon = ActionIcon;
|