@dbcdk/react-components 0.0.5 → 0.0.6
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/assets/logo.js +2 -85
- package/dist/components/__stories__/_data/table.d.ts +15 -0
- package/dist/components/__stories__/_data/table.js +49 -0
- package/dist/components/__stories__/story-components/Colors.d.ts +2 -1
- package/dist/components/__stories__/story-components/Colors.js +87 -142
- package/dist/components/__stories__/story-components/Spacing.d.ts +1 -0
- package/dist/components/__stories__/story-components/Spacing.js +58 -166
- package/dist/components/app-header/AppHeader.d.ts +4 -3
- package/dist/components/app-header/AppHeader.js +3 -6
- package/dist/components/attribute-chip/AttributeChip.d.ts +1 -0
- package/dist/components/attribute-chip/AttributeChip.js +3 -14
- package/dist/components/avatar/Avatar.d.ts +2 -2
- package/dist/components/avatar/Avatar.js +37 -71
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/components/breadcrumbs/Breadcrumbs.js +4 -13
- package/dist/components/button/Button.d.ts +3 -2
- package/dist/components/button/Button.js +54 -56
- package/dist/components/button/Button.module.css +1 -1
- package/dist/components/card/Card.d.ts +8 -7
- package/dist/components/card/Card.js +19 -60
- package/dist/components/card-container/CardContainer.d.ts +3 -3
- package/dist/components/card-container/CardContainer.js +4 -16
- package/dist/components/chip/Chip.d.ts +6 -5
- package/dist/components/chip/Chip.js +14 -38
- package/dist/components/chip/Chip.module.css +9 -1
- package/dist/components/circle/Circle.d.ts +3 -2
- package/dist/components/circle/Circle.js +3 -10
- package/dist/components/clear-button/ClearButton.d.ts +2 -1
- package/dist/components/clear-button/ClearButton.js +6 -17
- package/dist/components/code-block/CodeBlock.d.ts +1 -0
- package/dist/components/code-block/CodeBlock.js +4 -10
- package/dist/components/copy-button/CopyButton.d.ts +4 -3
- package/dist/components/copy-button/CopyButton.js +19 -26
- package/dist/components/datetime-picker/DateTimePicker.d.ts +8 -5
- package/dist/components/datetime-picker/DateTimePicker.js +364 -459
- package/dist/components/filter-field/FilterField.d.ts +5 -2
- package/dist/components/filter-field/FilterField.js +130 -173
- package/dist/components/filter-field/FilterField.module.css +21 -5
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +36 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +53 -0
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +60 -0
- package/dist/components/forms/checkbox/Checkbox.d.ts +31 -0
- package/dist/components/forms/checkbox/Checkbox.js +27 -0
- package/dist/components/{checkbox → forms/checkbox}/Checkbox.module.css +0 -1
- package/dist/components/forms/checkbox-group/CheckboxGroup.d.ts +47 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.js +75 -0
- package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +115 -0
- package/dist/components/{input → forms/input}/Input.d.ts +9 -5
- package/dist/components/forms/input/Input.js +70 -0
- package/dist/components/{input → forms/input}/Input.module.css +1 -0
- package/dist/components/forms/input-container/InputContainer.d.ts +15 -0
- package/dist/components/forms/input-container/InputContainer.js +15 -0
- package/dist/components/forms/input-container/InputContainer.module.css +34 -0
- package/dist/components/forms/multi-select/MultiSelect.d.ts +20 -0
- package/dist/components/forms/multi-select/MultiSelect.js +19 -0
- package/dist/components/forms/select/Select.d.ts +21 -0
- package/dist/components/forms/select/Select.js +94 -0
- package/dist/components/forms/text-area/Textarea.d.ts +17 -0
- package/dist/components/forms/text-area/Textarea.js +33 -0
- package/dist/components/forms/text-area/Textarea.module.css +26 -0
- package/dist/components/headline/Headline.js +18 -43
- package/dist/components/{link/Link.d.ts → hyperlink/Hyperlink.d.ts} +2 -2
- package/dist/components/hyperlink/Hyperlink.js +11 -0
- package/dist/components/{link/Link.module.css → hyperlink/Hyperlink.module.css} +5 -14
- package/dist/components/icon/Icon.d.ts +4 -3
- package/dist/components/icon/Icon.js +11 -17
- package/dist/components/menu/Menu.js +25 -67
- package/dist/components/meta-bar/MetaBar.d.ts +4 -4
- package/dist/components/meta-bar/MetaBar.js +7 -20
- package/dist/components/nav-bar/NavBar.d.ts +5 -5
- package/dist/components/nav-bar/NavBar.js +15 -45
- package/dist/components/{modal → overlay/modal}/Modal.d.ts +4 -2
- package/dist/components/overlay/modal/Modal.js +92 -0
- package/dist/components/{modal → overlay/modal}/provider/ModalProvider.d.ts +0 -1
- package/dist/components/overlay/modal/provider/ModalProvider.js +70 -0
- package/dist/components/overlay/side-panel/SidePanel.d.ts +16 -0
- package/dist/components/overlay/side-panel/SidePanel.js +10 -0
- package/dist/components/overlay/side-panel/SidePanel.module.css +56 -0
- package/dist/components/overlay/side-panel/useSidePanel.d.ts +5 -0
- package/dist/components/overlay/side-panel/useSidePanel.js +11 -0
- package/dist/components/overlay/tooltip/Tooltip.d.ts +13 -0
- package/dist/components/overlay/tooltip/Tooltip.js +17 -0
- package/dist/components/overlay/tooltip/Tooltip.module.css +106 -0
- package/dist/components/overlay/tooltip/TooltipProvider.d.ts +20 -0
- package/dist/components/overlay/tooltip/TooltipProvider.js +244 -0
- package/dist/components/overlay/tooltip/useTooltipTrigger.d.ts +24 -0
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +108 -0
- package/dist/components/page/Page.d.ts +7 -6
- package/dist/components/page/Page.js +4 -21
- package/dist/components/page-layout/PageLayout.d.ts +11 -12
- package/dist/components/page-layout/PageLayout.js +35 -71
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +4 -22
- package/dist/components/pagination/Pagination.d.ts +2 -1
- package/dist/components/pagination/Pagination.js +38 -121
- package/dist/components/panel/Panel.d.ts +4 -3
- package/dist/components/panel/Panel.js +5 -10
- package/dist/components/popover/Popover.d.ts +1 -0
- package/dist/components/popover/Popover.js +116 -141
- package/dist/components/search-box/SearchBox.d.ts +2 -2
- package/dist/components/search-box/SearchBox.js +112 -162
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +1 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +47 -94
- package/dist/components/sidebar/Sidebar.d.ts +1 -0
- package/dist/components/sidebar/Sidebar.js +5 -7
- package/dist/components/sidebar/components/SidebarItem.js +6 -14
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +1 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +48 -88
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +3 -2
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +11 -41
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +1 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +4 -25
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +9 -23
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +19 -40
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +2 -1
- package/dist/components/sidebar/providers/SidebarProvider.js +182 -165
- package/dist/components/skeleton-loader/SkeletonLoader.js +68 -266
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +11 -34
- package/dist/components/split-button/SplitButton.d.ts +7 -5
- package/dist/components/split-button/SplitButton.js +4 -27
- package/dist/components/split-pane/SplitPane.js +69 -105
- package/dist/components/split-pane/provider/SplitPaneContext.js +77 -71
- package/dist/components/table/Table.d.ts +9 -7
- package/dist/components/table/Table.js +115 -238
- package/dist/components/table/Table.module.css +5 -1
- package/dist/components/table/components/column-resizer/ColumnResizer.js +4 -15
- package/dist/components/table/components/empty-state/EmptyState.d.ts +6 -5
- package/dist/components/table/components/empty-state/EmptyState.js +22 -41
- package/dist/components/table/components/table-settings/TableSettings.d.ts +2 -1
- package/dist/components/table/components/table-settings/TableSettings.js +9 -27
- package/dist/components/table/tanstack.d.ts +1 -1
- package/dist/components/table/tanstack.js +154 -160
- package/dist/components/tabs/Tabs.d.ts +1 -0
- package/dist/components/tabs/Tabs.js +32 -81
- package/dist/components/toast/Toast.d.ts +1 -1
- package/dist/components/toast/Toast.js +4 -37
- package/dist/components/toast/Toast.module.css +1 -0
- package/dist/components/toast/provider/ToastProvider.d.ts +1 -1
- package/dist/components/toast/provider/ToastProvider.js +60 -87
- package/dist/components/user-display/UserDisplay.d.ts +2 -1
- package/dist/components/user-display/UserDisplay.js +4 -20
- package/dist/constants/severity.d.ts +1 -1
- package/dist/constants/severity.js +14 -16
- package/dist/constants/severity.types.d.ts +1 -1
- package/dist/constants/severity.types.js +1 -1
- package/dist/constants/sizes.js +6 -8
- package/dist/hooks/usePagination.d.ts +1 -1
- package/dist/hooks/usePagination.js +75 -82
- package/dist/hooks/useSorting.js +112 -110
- package/dist/hooks/useTableData.d.ts +1 -1
- package/dist/hooks/useTableData.js +42 -47
- package/dist/hooks/useTableSelection.js +121 -121
- package/dist/hooks/useTableSettings.js +23 -25
- package/dist/hooks/useTheme.d.ts +3 -7
- package/dist/hooks/useTheme.js +52 -47
- package/dist/hooks/useTimeDuration.d.ts +2 -2
- package/dist/hooks/useTimeDuration.js +33 -34
- package/dist/hooks/useViewportFill.d.ts +3 -2
- package/dist/hooks/useViewportFill.js +55 -48
- package/dist/index.d.ts +17 -8
- package/dist/index.js +18 -8
- package/dist/src/styles/styles.css +3 -3
- package/dist/styles/css-helper-classes/flex.css +4 -0
- package/dist/styles/styles.css +3 -3
- package/dist/styles/themes/dbc/dark.css +1 -1
- package/dist/styles/themes/dbc/light.css +2 -1
- package/dist/styles/themes/forfatterweb/light.css +1 -1
- package/dist/styles/themes/types.js +1 -1
- package/dist/types/a11y-props.types.d.ts +5 -5
- package/dist/types/a11y-props.types.js +1 -1
- package/dist/types/sizes.types.js +1 -1
- package/dist/utils/arrays/nested-filtering.js +43 -33
- package/dist/utils/date/formatDate.js +25 -16
- package/package.json +18 -9
- package/dist/assets/logo.cjs +0 -87
- package/dist/components/__stories__/story-components/Colors.cjs +0 -159
- package/dist/components/__stories__/story-components/Spacing.cjs +0 -190
- package/dist/components/app-header/AppHeader.cjs +0 -14
- package/dist/components/attribute-chip/AttributeChip.cjs +0 -22
- package/dist/components/avatar/Avatar.cjs +0 -101
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +0 -22
- package/dist/components/button/Button.cjs +0 -87
- package/dist/components/card/Card.cjs +0 -69
- package/dist/components/card-container/CardContainer.cjs +0 -24
- package/dist/components/checkbox/Checkbox.cjs +0 -42
- package/dist/components/checkbox/Checkbox.d.ts +0 -12
- package/dist/components/checkbox/Checkbox.js +0 -36
- package/dist/components/chip/Chip.cjs +0 -50
- package/dist/components/circle/Circle.cjs +0 -18
- package/dist/components/clear-button/ClearButton.cjs +0 -26
- package/dist/components/code-block/CodeBlock.cjs +0 -18
- package/dist/components/copy-button/CopyButton.cjs +0 -35
- package/dist/components/datetime-picker/DateTimePicker.cjs +0 -504
- package/dist/components/filter-field/FilterField.cjs +0 -189
- package/dist/components/headline/Headline.cjs +0 -53
- package/dist/components/icon/Icon.cjs +0 -27
- package/dist/components/input/Input.cjs +0 -89
- package/dist/components/input/Input.js +0 -83
- package/dist/components/link/Link.cjs +0 -46
- package/dist/components/link/Link.js +0 -21
- package/dist/components/menu/Menu.cjs +0 -96
- package/dist/components/meta-bar/MetaBar.cjs +0 -29
- package/dist/components/modal/Modal.cjs +0 -134
- package/dist/components/modal/Modal.js +0 -128
- package/dist/components/modal/provider/ModalProvider.cjs +0 -80
- package/dist/components/modal/provider/ModalProvider.js +0 -77
- package/dist/components/multi-select/MultiSelect.cjs +0 -59
- package/dist/components/multi-select/MultiSelect.d.ts +0 -18
- package/dist/components/multi-select/MultiSelect.js +0 -57
- package/dist/components/nav-bar/NavBar.cjs +0 -55
- package/dist/components/page/Page.cjs +0 -30
- package/dist/components/page-layout/PageLayout.cjs +0 -84
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.cjs +0 -32
- package/dist/components/pagination/Pagination.cjs +0 -133
- package/dist/components/panel/Panel.cjs +0 -18
- package/dist/components/popover/Popover.cjs +0 -149
- package/dist/components/search-box/SearchBox.cjs +0 -175
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +0 -103
- package/dist/components/select/Select.cjs +0 -121
- package/dist/components/select/Select.d.ts +0 -12
- package/dist/components/select/Select.js +0 -119
- package/dist/components/sidebar/Sidebar.cjs +0 -11
- package/dist/components/sidebar/components/SidebarItem.cjs +0 -18
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +0 -100
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +0 -50
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +0 -34
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +0 -29
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +0 -52
- package/dist/components/sidebar/providers/SidebarProvider.cjs +0 -179
- package/dist/components/skeleton-loader/SkeletonLoader.cjs +0 -270
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +0 -42
- package/dist/components/split-button/SplitButton.cjs +0 -37
- package/dist/components/split-pane/SplitPane.cjs +0 -123
- package/dist/components/split-pane/provider/SplitPaneContext.cjs +0 -87
- package/dist/components/table/Table.cjs +0 -249
- package/dist/components/table/components/column-resizer/ColumnResizer.cjs +0 -22
- package/dist/components/table/components/empty-state/EmptyState.cjs +0 -52
- package/dist/components/table/components/table-settings/TableSettings.cjs +0 -32
- package/dist/components/table/tanstack.cjs +0 -193
- package/dist/components/tabs/Tabs.cjs +0 -90
- package/dist/components/text-area/Textarea.cjs +0 -62
- package/dist/components/text-area/Textarea.d.ts +0 -14
- package/dist/components/text-area/Textarea.js +0 -56
- package/dist/components/text-area/Textarea.module.css +0 -3
- package/dist/components/toast/Toast.cjs +0 -47
- package/dist/components/toast/provider/ToastProvider.cjs +0 -98
- package/dist/components/tooltip/Tooltip.cjs +0 -183
- package/dist/components/tooltip/Tooltip.d.ts +0 -11
- package/dist/components/tooltip/Tooltip.js +0 -177
- package/dist/components/tooltip/Tooltip.module.css +0 -66
- package/dist/components/user-display/UserDisplay.cjs +0 -28
- package/dist/constants/severity.cjs +0 -21
- package/dist/constants/severity.types.cjs +0 -2
- package/dist/constants/sizes.cjs +0 -11
- package/dist/hooks/usePagination.cjs +0 -88
- package/dist/hooks/useSorting.cjs +0 -118
- package/dist/hooks/useTableData.cjs +0 -52
- package/dist/hooks/useTableSelection.cjs +0 -130
- package/dist/hooks/useTableSettings.cjs +0 -28
- package/dist/hooks/useTheme.cjs +0 -58
- package/dist/hooks/useTimeDuration.cjs +0 -39
- package/dist/hooks/useViewportFill.cjs +0 -52
- package/dist/index.cjs +0 -383
- package/dist/styles/themes/types.cjs +0 -2
- package/dist/types/a11y-props.types.cjs +0 -2
- package/dist/types/assets.d.cjs +0 -2
- package/dist/types/assets.d.js +0 -1
- package/dist/types/css.d.cjs +0 -2
- package/dist/types/css.d.js +0 -1
- package/dist/types/sizes.types.cjs +0 -2
- package/dist/utils/arrays/nested-filtering.cjs +0 -40
- package/dist/utils/date/formatDate.cjs +0 -19
- /package/dist/components/{modal → overlay/modal}/Modal.module.css +0 -0
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
|
-
var nestedFiltering = require('../../../utils/arrays/nested-filtering');
|
|
6
|
-
|
|
7
|
-
const findParentItem = (navItem, items, prevPath) => {
|
|
8
|
-
var _a;
|
|
9
|
-
for (const currentItem of items) {
|
|
10
|
-
let path = prevPath || `.${currentItem.href}`;
|
|
11
|
-
if ((_a = currentItem.children) == null ? void 0 : _a.some((child) => (child == null ? void 0 : child.href) === navItem)) {
|
|
12
|
-
return path;
|
|
13
|
-
} else if (currentItem.children) {
|
|
14
|
-
path = findParentItem(navItem, currentItem.children, path);
|
|
15
|
-
if (path) {
|
|
16
|
-
return path;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return "";
|
|
21
|
-
};
|
|
22
|
-
const SidebarContext = react.createContext({
|
|
23
|
-
defaultExpanded: null,
|
|
24
|
-
expandedItems: /* @__PURE__ */ new Set(),
|
|
25
|
-
activeQuery: "",
|
|
26
|
-
areItemsCollapsed: false,
|
|
27
|
-
setActiveQuery: () => {
|
|
28
|
-
},
|
|
29
|
-
triggerExpandAll: () => {
|
|
30
|
-
},
|
|
31
|
-
setItemsCollapsed: () => {
|
|
32
|
-
},
|
|
33
|
-
resetExpandAll: () => {
|
|
34
|
-
},
|
|
35
|
-
activeLink: "",
|
|
36
|
-
setActiveLink: () => {
|
|
37
|
-
},
|
|
38
|
-
isSidebarCollapsed: false,
|
|
39
|
-
handleSidebarCollapseChange: () => {
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
const SIDEBAR_COLLAPSED_STORAGE_KEY = "sidebar-is-collapsed";
|
|
43
|
-
const SIDEBAR_BREAKPOINT = 1024;
|
|
44
|
-
const getBreakpoint = (width) => width < SIDEBAR_BREAKPOINT ? "small" : "large";
|
|
45
|
-
function SidebarProvider({
|
|
46
|
-
children,
|
|
47
|
-
items,
|
|
48
|
-
initialCollapsed = false,
|
|
49
|
-
initialSidebarCollapsed
|
|
50
|
-
}) {
|
|
51
|
-
const [defaultExpanded, setDefaultExpanded] = react.useState(null);
|
|
52
|
-
const [activeQuery, setActiveQuery] = react.useState("");
|
|
53
|
-
const [areItemsCollapsed, setItemsCollapsed] = react.useState(initialCollapsed);
|
|
54
|
-
const [activeHref, setActiveHref] = react.useState("");
|
|
55
|
-
const [expandedItems, setExpandedItems] = react.useState(/* @__PURE__ */ new Set());
|
|
56
|
-
const [isSidebarCollapsed, setSidebarCollapsed] = react.useState(
|
|
57
|
-
initialSidebarCollapsed != null ? initialSidebarCollapsed : false
|
|
58
|
-
);
|
|
59
|
-
const [breakpoint, setBreakpoint] = react.useState(null);
|
|
60
|
-
const hasExplicitInitialSidebarCollapsed = initialSidebarCollapsed !== void 0;
|
|
61
|
-
const triggerExpandAll = react.useCallback(() => setDefaultExpanded(true), []);
|
|
62
|
-
const resetExpandAll = react.useCallback(() => setDefaultExpanded(null), []);
|
|
63
|
-
const setActiveLink = react.useCallback((href) => setActiveHref(href), []);
|
|
64
|
-
react.useEffect(() => {
|
|
65
|
-
const path = findParentItem(activeHref, items);
|
|
66
|
-
setExpandedItems(new Set(path.split(".").filter(Boolean)));
|
|
67
|
-
}, [activeHref]);
|
|
68
|
-
const filteredItems = react.useMemo(() => {
|
|
69
|
-
return activeQuery ? nestedFiltering.nestedFiltering(items, {
|
|
70
|
-
keys: ["label", "tags"],
|
|
71
|
-
includeParents: true,
|
|
72
|
-
mode: "OR",
|
|
73
|
-
query: activeQuery
|
|
74
|
-
}) : items;
|
|
75
|
-
}, [items, activeQuery]);
|
|
76
|
-
react.useEffect(() => {
|
|
77
|
-
if (activeQuery) {
|
|
78
|
-
triggerExpandAll();
|
|
79
|
-
}
|
|
80
|
-
}, [activeQuery, triggerExpandAll]);
|
|
81
|
-
react.useEffect(() => {
|
|
82
|
-
if (typeof window === "undefined") return;
|
|
83
|
-
const currentBreakpoint = getBreakpoint(window.innerWidth);
|
|
84
|
-
setBreakpoint(currentBreakpoint);
|
|
85
|
-
if (hasExplicitInitialSidebarCollapsed) {
|
|
86
|
-
const value2 = initialSidebarCollapsed != null ? initialSidebarCollapsed : false;
|
|
87
|
-
setSidebarCollapsed(value2);
|
|
88
|
-
try {
|
|
89
|
-
window.localStorage.setItem(SIDEBAR_COLLAPSED_STORAGE_KEY, JSON.stringify(value2));
|
|
90
|
-
} catch {
|
|
91
|
-
}
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
const stored = window.localStorage.getItem(SIDEBAR_COLLAPSED_STORAGE_KEY);
|
|
96
|
-
if (stored !== null) {
|
|
97
|
-
const parsed = JSON.parse(stored);
|
|
98
|
-
setSidebarCollapsed(Boolean(parsed));
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
} catch {
|
|
102
|
-
}
|
|
103
|
-
const defaultCollapsed = currentBreakpoint === "small";
|
|
104
|
-
setSidebarCollapsed(defaultCollapsed);
|
|
105
|
-
}, [hasExplicitInitialSidebarCollapsed, initialSidebarCollapsed]);
|
|
106
|
-
const persistCollapsed = react.useCallback((collapsed) => {
|
|
107
|
-
if (typeof window === "undefined") return;
|
|
108
|
-
try {
|
|
109
|
-
window.localStorage.setItem(SIDEBAR_COLLAPSED_STORAGE_KEY, JSON.stringify(collapsed));
|
|
110
|
-
} catch {
|
|
111
|
-
}
|
|
112
|
-
}, []);
|
|
113
|
-
const handleSidebarCollapseChange = react.useCallback(
|
|
114
|
-
(collapsed) => {
|
|
115
|
-
setSidebarCollapsed(collapsed);
|
|
116
|
-
persistCollapsed(collapsed);
|
|
117
|
-
},
|
|
118
|
-
[persistCollapsed]
|
|
119
|
-
);
|
|
120
|
-
react.useEffect(() => {
|
|
121
|
-
if (typeof window === "undefined") return;
|
|
122
|
-
const onResize = () => {
|
|
123
|
-
const nextBreakpoint = getBreakpoint(window.innerWidth);
|
|
124
|
-
setBreakpoint((prev) => {
|
|
125
|
-
if (prev === null) {
|
|
126
|
-
return nextBreakpoint;
|
|
127
|
-
}
|
|
128
|
-
if (prev === nextBreakpoint) {
|
|
129
|
-
return prev;
|
|
130
|
-
}
|
|
131
|
-
const autoCollapsed = nextBreakpoint === "small";
|
|
132
|
-
setSidebarCollapsed(autoCollapsed);
|
|
133
|
-
persistCollapsed(autoCollapsed);
|
|
134
|
-
return nextBreakpoint;
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
window.addEventListener("resize", onResize);
|
|
138
|
-
return () => window.removeEventListener("resize", onResize);
|
|
139
|
-
}, [persistCollapsed]);
|
|
140
|
-
const value = react.useMemo(
|
|
141
|
-
() => ({
|
|
142
|
-
defaultExpanded,
|
|
143
|
-
expandedItems,
|
|
144
|
-
filteredItems,
|
|
145
|
-
activeQuery,
|
|
146
|
-
areItemsCollapsed,
|
|
147
|
-
setActiveQuery,
|
|
148
|
-
triggerExpandAll,
|
|
149
|
-
resetExpandAll,
|
|
150
|
-
setItemsCollapsed,
|
|
151
|
-
activeLink: activeHref,
|
|
152
|
-
setActiveLink,
|
|
153
|
-
isSidebarCollapsed,
|
|
154
|
-
handleSidebarCollapseChange
|
|
155
|
-
}),
|
|
156
|
-
[
|
|
157
|
-
defaultExpanded,
|
|
158
|
-
expandedItems,
|
|
159
|
-
filteredItems,
|
|
160
|
-
activeQuery,
|
|
161
|
-
areItemsCollapsed,
|
|
162
|
-
setActiveQuery,
|
|
163
|
-
triggerExpandAll,
|
|
164
|
-
resetExpandAll,
|
|
165
|
-
setItemsCollapsed,
|
|
166
|
-
activeHref,
|
|
167
|
-
setActiveLink,
|
|
168
|
-
isSidebarCollapsed,
|
|
169
|
-
handleSidebarCollapseChange
|
|
170
|
-
]
|
|
171
|
-
);
|
|
172
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value, children });
|
|
173
|
-
}
|
|
174
|
-
function useSidebar() {
|
|
175
|
-
return react.useContext(SidebarContext);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
exports.SidebarProvider = SidebarProvider;
|
|
179
|
-
exports.useSidebar = useSidebar;
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var SkeletonLoaderItem = require('./skeleton-loader-item/SkeletonLoaderItem');
|
|
5
|
-
|
|
6
|
-
function SkeletonLoader({
|
|
7
|
-
type,
|
|
8
|
-
rows = 3,
|
|
9
|
-
columns = 3,
|
|
10
|
-
variant = "default",
|
|
11
|
-
speedSec = 3
|
|
12
|
-
}) {
|
|
13
|
-
const line = (width, height = 14, radius = 6) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
15
|
-
{
|
|
16
|
-
width,
|
|
17
|
-
height,
|
|
18
|
-
radius,
|
|
19
|
-
variant,
|
|
20
|
-
speedSec
|
|
21
|
-
},
|
|
22
|
-
`${String(width)}-${height}-${String(radius)}-${Math.random()}`
|
|
23
|
-
);
|
|
24
|
-
const pills = (count) => Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
25
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
26
|
-
{
|
|
27
|
-
width: 80 + i % 3 * 30,
|
|
28
|
-
height: 30,
|
|
29
|
-
radius: 6,
|
|
30
|
-
variant,
|
|
31
|
-
speedSec,
|
|
32
|
-
ariaLabel: "Loading filter"
|
|
33
|
-
},
|
|
34
|
-
`pill-${i}`
|
|
35
|
-
));
|
|
36
|
-
const textBlock = (count) => Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
38
|
-
{
|
|
39
|
-
width: i === count - 1 ? "60%" : `${90 - i % 3 * 10}%`,
|
|
40
|
-
height: 12,
|
|
41
|
-
radius: 4,
|
|
42
|
-
variant,
|
|
43
|
-
speedSec,
|
|
44
|
-
ariaLabel: "Loading text line"
|
|
45
|
-
},
|
|
46
|
-
`text-${i}`
|
|
47
|
-
));
|
|
48
|
-
const tableHeaderRow = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
-
"div",
|
|
50
|
-
{
|
|
51
|
-
style: {
|
|
52
|
-
display: "grid",
|
|
53
|
-
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
54
|
-
gap: 12,
|
|
55
|
-
alignItems: "center",
|
|
56
|
-
width: "100%"
|
|
57
|
-
},
|
|
58
|
-
children: Array.from({ length: columns }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
60
|
-
{
|
|
61
|
-
height: 20,
|
|
62
|
-
width: "90%",
|
|
63
|
-
radius: 6,
|
|
64
|
-
variant,
|
|
65
|
-
speedSec,
|
|
66
|
-
ariaLabel: "Loading table header"
|
|
67
|
-
},
|
|
68
|
-
`thead-${i}`
|
|
69
|
-
))
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
const tableBodyRow = (rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
style: {
|
|
76
|
-
display: "grid",
|
|
77
|
-
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
78
|
-
gap: 12,
|
|
79
|
-
alignItems: "center",
|
|
80
|
-
width: "100%"
|
|
81
|
-
},
|
|
82
|
-
children: Array.from({ length: columns }).map((_, colIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
84
|
-
{
|
|
85
|
-
height: 20,
|
|
86
|
-
width: colIndex % 3 === 0 ? "93%" : colIndex % 3 === 1 ? "98%" : "90%",
|
|
87
|
-
radius: 4,
|
|
88
|
-
variant,
|
|
89
|
-
speedSec,
|
|
90
|
-
ariaLabel: "Loading table cell"
|
|
91
|
-
},
|
|
92
|
-
`tcell-${rowIndex}-${colIndex}`
|
|
93
|
-
))
|
|
94
|
-
},
|
|
95
|
-
`trow-${rowIndex}`
|
|
96
|
-
);
|
|
97
|
-
const getSkeletonItems = () => {
|
|
98
|
-
switch (type) {
|
|
99
|
-
case "button": {
|
|
100
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
style: {
|
|
104
|
-
display: "flex",
|
|
105
|
-
gap: 12,
|
|
106
|
-
alignItems: "center",
|
|
107
|
-
justifyContent: "flex-start",
|
|
108
|
-
width: "100%",
|
|
109
|
-
flexWrap: "wrap"
|
|
110
|
-
},
|
|
111
|
-
children: [
|
|
112
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
113
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
114
|
-
{
|
|
115
|
-
width: 120,
|
|
116
|
-
height: 40,
|
|
117
|
-
radius: 8,
|
|
118
|
-
variant,
|
|
119
|
-
speedSec,
|
|
120
|
-
ariaLabel: "Loading button"
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
125
|
-
{
|
|
126
|
-
width: 96,
|
|
127
|
-
height: 40,
|
|
128
|
-
radius: 8,
|
|
129
|
-
variant,
|
|
130
|
-
speedSec,
|
|
131
|
-
ariaLabel: "Loading button"
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
case "card": {
|
|
139
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
140
|
-
"div",
|
|
141
|
-
{
|
|
142
|
-
style: {
|
|
143
|
-
display: "flex",
|
|
144
|
-
flexDirection: "column",
|
|
145
|
-
gap: 12,
|
|
146
|
-
width: "100%"
|
|
147
|
-
},
|
|
148
|
-
children: [
|
|
149
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
150
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
151
|
-
{
|
|
152
|
-
width: "100%",
|
|
153
|
-
height: 160,
|
|
154
|
-
radius: 12,
|
|
155
|
-
variant,
|
|
156
|
-
speedSec,
|
|
157
|
-
ariaLabel: "Loading card media"
|
|
158
|
-
}
|
|
159
|
-
),
|
|
160
|
-
line("60%", 16, 6),
|
|
161
|
-
textBlock(3),
|
|
162
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 12, justifyContent: "flex-start" }, children: [
|
|
163
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
165
|
-
{
|
|
166
|
-
width: 100,
|
|
167
|
-
height: 30,
|
|
168
|
-
variant,
|
|
169
|
-
speedSec,
|
|
170
|
-
ariaLabel: "Loading action"
|
|
171
|
-
}
|
|
172
|
-
),
|
|
173
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
174
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
175
|
-
{
|
|
176
|
-
width: 72,
|
|
177
|
-
height: 30,
|
|
178
|
-
variant,
|
|
179
|
-
speedSec,
|
|
180
|
-
ariaLabel: "Loading action"
|
|
181
|
-
}
|
|
182
|
-
)
|
|
183
|
-
] })
|
|
184
|
-
]
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
case "avatar": {
|
|
189
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
190
|
-
"div",
|
|
191
|
-
{
|
|
192
|
-
style: {
|
|
193
|
-
display: "flex",
|
|
194
|
-
gap: 12,
|
|
195
|
-
alignItems: "center",
|
|
196
|
-
width: "100%"
|
|
197
|
-
},
|
|
198
|
-
children: [
|
|
199
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
200
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
201
|
-
{
|
|
202
|
-
width: 48,
|
|
203
|
-
height: 48,
|
|
204
|
-
radius: "50%",
|
|
205
|
-
variant,
|
|
206
|
-
speedSec,
|
|
207
|
-
ariaLabel: "Loading avatar"
|
|
208
|
-
}
|
|
209
|
-
),
|
|
210
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8, flex: 1 }, children: [
|
|
211
|
-
line("40%", 14),
|
|
212
|
-
line("25%", 12)
|
|
213
|
-
] })
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
case "text": {
|
|
219
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 10, width: "100%" }, children: textBlock(rows) });
|
|
220
|
-
}
|
|
221
|
-
case "table": {
|
|
222
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12, width: "100%" }, children: [
|
|
223
|
-
tableHeaderRow(),
|
|
224
|
-
Array.from({ length: rows }).map((_, r) => tableBodyRow(r))
|
|
225
|
-
] });
|
|
226
|
-
}
|
|
227
|
-
case "filterbar": {
|
|
228
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
229
|
-
"div",
|
|
230
|
-
{
|
|
231
|
-
style: {
|
|
232
|
-
display: "flex",
|
|
233
|
-
alignItems: "center",
|
|
234
|
-
justifyContent: "space-between",
|
|
235
|
-
gap: 12,
|
|
236
|
-
flexWrap: "wrap",
|
|
237
|
-
width: "100%"
|
|
238
|
-
},
|
|
239
|
-
children: [
|
|
240
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: 12, flexWrap: "wrap" }, children: pills(columns) }),
|
|
241
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
242
|
-
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
243
|
-
{
|
|
244
|
-
width: 240,
|
|
245
|
-
height: 30,
|
|
246
|
-
variant,
|
|
247
|
-
speedSec,
|
|
248
|
-
ariaLabel: "Loading"
|
|
249
|
-
}
|
|
250
|
-
)
|
|
251
|
-
]
|
|
252
|
-
}
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
default:
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
260
|
-
"div",
|
|
261
|
-
{
|
|
262
|
-
role: "status",
|
|
263
|
-
"aria-label": "Loading content",
|
|
264
|
-
style: { display: "flex", flexDirection: "column", gap: 16, width: "100%" },
|
|
265
|
-
children: getSkeletonItems()
|
|
266
|
-
}
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
exports.SkeletonLoader = SkeletonLoader;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var styles = require('./SkeletonLoaderItem.module.css');
|
|
5
|
-
|
|
6
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
9
|
-
|
|
10
|
-
function SkeletonLoaderItem({
|
|
11
|
-
height = 14,
|
|
12
|
-
width = "100%",
|
|
13
|
-
radius = 6,
|
|
14
|
-
speedSec = 3,
|
|
15
|
-
ariaLabel = "Loading",
|
|
16
|
-
variant = "default"
|
|
17
|
-
}) {
|
|
18
|
-
const h = typeof height === "number" ? `${height}px` : height;
|
|
19
|
-
const w = typeof width === "number" ? `${width}px` : width;
|
|
20
|
-
const r = typeof radius === "number" ? `${radius}px` : radius;
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
22
|
-
"div",
|
|
23
|
-
{
|
|
24
|
-
className: `${styles__default.default.skeletonLoader} ${styles__default.default[variant]}`,
|
|
25
|
-
role: "status",
|
|
26
|
-
"aria-label": ariaLabel,
|
|
27
|
-
"aria-live": "polite",
|
|
28
|
-
style: {
|
|
29
|
-
["--h"]: h,
|
|
30
|
-
["--r"]: r,
|
|
31
|
-
["--speed"]: `${speedSec}s`,
|
|
32
|
-
["--width"]: w
|
|
33
|
-
},
|
|
34
|
-
children: [
|
|
35
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.bar, "aria-hidden": "true" }),
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "srOnly", children: "Loading\u2026" })
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
exports.SkeletonLoaderItem = SkeletonLoaderItem;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var Button = require('../button/Button');
|
|
5
|
-
var Menu = require('../menu/Menu');
|
|
6
|
-
var Popover = require('../popover/Popover');
|
|
7
|
-
var styles = require('./SplitButton.module.css');
|
|
8
|
-
|
|
9
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
|
|
11
|
-
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
12
|
-
|
|
13
|
-
function SplitButton({
|
|
14
|
-
children,
|
|
15
|
-
options,
|
|
16
|
-
onClick,
|
|
17
|
-
icon
|
|
18
|
-
}) {
|
|
19
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.container, style: { display: "inline-flex", alignItems: "center" }, children: [
|
|
20
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Button.Button, { onClick, children: [
|
|
21
|
-
icon,
|
|
22
|
-
children
|
|
23
|
-
] }),
|
|
24
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25
|
-
Popover.Popover,
|
|
26
|
-
{
|
|
27
|
-
trigger: (onClick2, icon2) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.triggerContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { onClick: onClick2, children: icon2 }) }),
|
|
28
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu, { children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Item, { active: option.active, children: /* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: option.onClick, children: [
|
|
29
|
-
option.icon,
|
|
30
|
-
option.label
|
|
31
|
-
] }) }, option.label)) })
|
|
32
|
-
}
|
|
33
|
-
)
|
|
34
|
-
] });
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
exports.SplitButton = SplitButton;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
|
-
var styles = require('./SplitPane.module.css');
|
|
6
|
-
var SplitPaneContext = require('./provider/SplitPaneContext');
|
|
7
|
-
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
11
|
-
|
|
12
|
-
function clamp(n, min, max) {
|
|
13
|
-
return Math.max(min, Math.min(max, n));
|
|
14
|
-
}
|
|
15
|
-
function SplitPane({
|
|
16
|
-
children,
|
|
17
|
-
initialPrimarySize = 300,
|
|
18
|
-
minPrimarySize = 160,
|
|
19
|
-
minSecondarySize = 160,
|
|
20
|
-
direction = "horizontal",
|
|
21
|
-
showDivider = "hover",
|
|
22
|
-
gutterSize = 8,
|
|
23
|
-
storageKey
|
|
24
|
-
}) {
|
|
25
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
-
SplitPaneContext.SplitPaneProvider,
|
|
27
|
-
{
|
|
28
|
-
direction,
|
|
29
|
-
initialPrimarySize,
|
|
30
|
-
minPrimarySize,
|
|
31
|
-
minSecondarySize,
|
|
32
|
-
storageKey,
|
|
33
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SplitPaneContainer, { showDivider, gutterSize, children })
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
function SplitPaneContainer({
|
|
38
|
-
children,
|
|
39
|
-
showDivider,
|
|
40
|
-
gutterSize
|
|
41
|
-
}) {
|
|
42
|
-
const { direction, primarySize, containerRef } = SplitPaneContext.useSplitPaneContext();
|
|
43
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
44
|
-
"div",
|
|
45
|
-
{
|
|
46
|
-
ref: containerRef,
|
|
47
|
-
className: styles__default.default.container,
|
|
48
|
-
"data-direction": direction,
|
|
49
|
-
"data-divider": showDivider,
|
|
50
|
-
style: {
|
|
51
|
-
"--split-pane-primary-size": `${primarySize}px`,
|
|
52
|
-
"--split-pane-gutter": `${gutterSize}px`
|
|
53
|
-
},
|
|
54
|
-
children
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
function SplitPanePrimary({ children }) {
|
|
59
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.primary, children });
|
|
60
|
-
}
|
|
61
|
-
function SplitPaneGutter() {
|
|
62
|
-
const { direction, primarySize, setPrimarySize, minPrimarySize, minSecondarySize, containerRef } = SplitPaneContext.useSplitPaneContext();
|
|
63
|
-
const isDraggingRef = react.useRef(false);
|
|
64
|
-
const startPosRef = react.useRef(0);
|
|
65
|
-
const startSizeRef = react.useRef(primarySize);
|
|
66
|
-
react.useEffect(() => {
|
|
67
|
-
if (!window) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const onMove = (e) => {
|
|
71
|
-
if (!isDraggingRef.current) return;
|
|
72
|
-
const el = containerRef.current;
|
|
73
|
-
if (!el) return;
|
|
74
|
-
const rect = el.getBoundingClientRect();
|
|
75
|
-
const total = direction === "horizontal" ? rect.width : rect.height;
|
|
76
|
-
const clientPos = direction === "horizontal" ? e.clientX : e.clientY;
|
|
77
|
-
const delta = clientPos - startPosRef.current;
|
|
78
|
-
const next = startSizeRef.current + delta;
|
|
79
|
-
const maxPrimary = Math.max(minPrimarySize, total - minSecondarySize);
|
|
80
|
-
setPrimarySize(clamp(next, minPrimarySize, maxPrimary));
|
|
81
|
-
};
|
|
82
|
-
const onUp = () => {
|
|
83
|
-
if (!isDraggingRef.current) return;
|
|
84
|
-
isDraggingRef.current = false;
|
|
85
|
-
document.body.style.cursor = "";
|
|
86
|
-
document.body.style.userSelect = "";
|
|
87
|
-
};
|
|
88
|
-
window.addEventListener("mousemove", onMove);
|
|
89
|
-
window.addEventListener("mouseup", onUp);
|
|
90
|
-
return () => {
|
|
91
|
-
if (window) {
|
|
92
|
-
window.removeEventListener("mousemove", onMove);
|
|
93
|
-
window.removeEventListener("mouseup", onUp);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}, [containerRef, direction, minPrimarySize, minSecondarySize, setPrimarySize]);
|
|
97
|
-
const handleMouseDown = (event) => {
|
|
98
|
-
isDraggingRef.current = true;
|
|
99
|
-
startPosRef.current = direction === "horizontal" ? event.clientX : event.clientY;
|
|
100
|
-
startSizeRef.current = primarySize;
|
|
101
|
-
document.body.style.cursor = direction === "horizontal" ? "col-resize" : "row-resize";
|
|
102
|
-
document.body.style.userSelect = "none";
|
|
103
|
-
};
|
|
104
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.gutter, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
-
"span",
|
|
106
|
-
{
|
|
107
|
-
className: styles__default.default.resizer,
|
|
108
|
-
onMouseDown: handleMouseDown,
|
|
109
|
-
role: "separator",
|
|
110
|
-
"aria-orientation": direction === "horizontal" ? "vertical" : "horizontal",
|
|
111
|
-
"aria-valuenow": Math.round(primarySize),
|
|
112
|
-
tabIndex: 0
|
|
113
|
-
}
|
|
114
|
-
) });
|
|
115
|
-
}
|
|
116
|
-
function SplitPaneSecondary({ children }) {
|
|
117
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.secondary, children });
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
exports.SplitPane = SplitPane;
|
|
121
|
-
exports.SplitPaneGutter = SplitPaneGutter;
|
|
122
|
-
exports.SplitPanePrimary = SplitPanePrimary;
|
|
123
|
-
exports.SplitPaneSecondary = SplitPaneSecondary;
|