@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,268 +1,70 @@
|
|
|
1
|
-
import { jsx, jsxs } from
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SkeletonLoaderItem } from './skeleton-loader-item/SkeletonLoaderItem';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const tableBodyRow = (rowIndex) => /* @__PURE__ */ jsx(
|
|
71
|
-
"div",
|
|
72
|
-
{
|
|
73
|
-
style: {
|
|
74
|
-
display: "grid",
|
|
75
|
-
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
76
|
-
gap: 12,
|
|
77
|
-
alignItems: "center",
|
|
78
|
-
width: "100%"
|
|
79
|
-
},
|
|
80
|
-
children: Array.from({ length: columns }).map((_, colIndex) => /* @__PURE__ */ jsx(
|
|
81
|
-
SkeletonLoaderItem,
|
|
82
|
-
{
|
|
83
|
-
height: 20,
|
|
84
|
-
width: colIndex % 3 === 0 ? "93%" : colIndex % 3 === 1 ? "98%" : "90%",
|
|
85
|
-
radius: 4,
|
|
86
|
-
variant,
|
|
87
|
-
speedSec,
|
|
88
|
-
ariaLabel: "Loading table cell"
|
|
89
|
-
},
|
|
90
|
-
`tcell-${rowIndex}-${colIndex}`
|
|
91
|
-
))
|
|
92
|
-
},
|
|
93
|
-
`trow-${rowIndex}`
|
|
94
|
-
);
|
|
95
|
-
const getSkeletonItems = () => {
|
|
96
|
-
switch (type) {
|
|
97
|
-
case "button": {
|
|
98
|
-
return /* @__PURE__ */ jsxs(
|
|
99
|
-
"div",
|
|
100
|
-
{
|
|
101
|
-
style: {
|
|
102
|
-
display: "flex",
|
|
103
|
-
gap: 12,
|
|
104
|
-
alignItems: "center",
|
|
105
|
-
justifyContent: "flex-start",
|
|
106
|
-
width: "100%",
|
|
107
|
-
flexWrap: "wrap"
|
|
108
|
-
},
|
|
109
|
-
children: [
|
|
110
|
-
/* @__PURE__ */ jsx(
|
|
111
|
-
SkeletonLoaderItem,
|
|
112
|
-
{
|
|
113
|
-
width: 120,
|
|
114
|
-
height: 40,
|
|
115
|
-
radius: 8,
|
|
116
|
-
variant,
|
|
117
|
-
speedSec,
|
|
118
|
-
ariaLabel: "Loading button"
|
|
119
|
-
}
|
|
120
|
-
),
|
|
121
|
-
/* @__PURE__ */ jsx(
|
|
122
|
-
SkeletonLoaderItem,
|
|
123
|
-
{
|
|
124
|
-
width: 96,
|
|
125
|
-
height: 40,
|
|
126
|
-
radius: 8,
|
|
127
|
-
variant,
|
|
128
|
-
speedSec,
|
|
129
|
-
ariaLabel: "Loading button"
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
case "card": {
|
|
137
|
-
return /* @__PURE__ */ jsxs(
|
|
138
|
-
"div",
|
|
139
|
-
{
|
|
140
|
-
style: {
|
|
141
|
-
display: "flex",
|
|
142
|
-
flexDirection: "column",
|
|
143
|
-
gap: 12,
|
|
144
|
-
width: "100%"
|
|
145
|
-
},
|
|
146
|
-
children: [
|
|
147
|
-
/* @__PURE__ */ jsx(
|
|
148
|
-
SkeletonLoaderItem,
|
|
149
|
-
{
|
|
150
|
-
width: "100%",
|
|
151
|
-
height: 160,
|
|
152
|
-
radius: 12,
|
|
153
|
-
variant,
|
|
154
|
-
speedSec,
|
|
155
|
-
ariaLabel: "Loading card media"
|
|
156
|
-
}
|
|
157
|
-
),
|
|
158
|
-
line("60%", 16, 6),
|
|
159
|
-
textBlock(3),
|
|
160
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 12, justifyContent: "flex-start" }, children: [
|
|
161
|
-
/* @__PURE__ */ jsx(
|
|
162
|
-
SkeletonLoaderItem,
|
|
163
|
-
{
|
|
164
|
-
width: 100,
|
|
165
|
-
height: 30,
|
|
166
|
-
variant,
|
|
167
|
-
speedSec,
|
|
168
|
-
ariaLabel: "Loading action"
|
|
169
|
-
}
|
|
170
|
-
),
|
|
171
|
-
/* @__PURE__ */ jsx(
|
|
172
|
-
SkeletonLoaderItem,
|
|
173
|
-
{
|
|
174
|
-
width: 72,
|
|
175
|
-
height: 30,
|
|
176
|
-
variant,
|
|
177
|
-
speedSec,
|
|
178
|
-
ariaLabel: "Loading action"
|
|
179
|
-
}
|
|
180
|
-
)
|
|
181
|
-
] })
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
case "avatar": {
|
|
187
|
-
return /* @__PURE__ */ jsxs(
|
|
188
|
-
"div",
|
|
189
|
-
{
|
|
190
|
-
style: {
|
|
191
|
-
display: "flex",
|
|
192
|
-
gap: 12,
|
|
193
|
-
alignItems: "center",
|
|
194
|
-
width: "100%"
|
|
195
|
-
},
|
|
196
|
-
children: [
|
|
197
|
-
/* @__PURE__ */ jsx(
|
|
198
|
-
SkeletonLoaderItem,
|
|
199
|
-
{
|
|
200
|
-
width: 48,
|
|
201
|
-
height: 48,
|
|
202
|
-
radius: "50%",
|
|
203
|
-
variant,
|
|
204
|
-
speedSec,
|
|
205
|
-
ariaLabel: "Loading avatar"
|
|
206
|
-
}
|
|
207
|
-
),
|
|
208
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8, flex: 1 }, children: [
|
|
209
|
-
line("40%", 14),
|
|
210
|
-
line("25%", 12)
|
|
211
|
-
] })
|
|
212
|
-
]
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
case "text": {
|
|
217
|
-
return /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 10, width: "100%" }, children: textBlock(rows) });
|
|
218
|
-
}
|
|
219
|
-
case "table": {
|
|
220
|
-
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12, width: "100%" }, children: [
|
|
221
|
-
tableHeaderRow(),
|
|
222
|
-
Array.from({ length: rows }).map((_, r) => tableBodyRow(r))
|
|
223
|
-
] });
|
|
224
|
-
}
|
|
225
|
-
case "filterbar": {
|
|
226
|
-
return /* @__PURE__ */ jsxs(
|
|
227
|
-
"div",
|
|
228
|
-
{
|
|
229
|
-
style: {
|
|
230
|
-
display: "flex",
|
|
231
|
-
alignItems: "center",
|
|
232
|
-
justifyContent: "space-between",
|
|
233
|
-
gap: 12,
|
|
234
|
-
flexWrap: "wrap",
|
|
235
|
-
width: "100%"
|
|
236
|
-
},
|
|
237
|
-
children: [
|
|
238
|
-
/* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 12, flexWrap: "wrap" }, children: pills(columns) }),
|
|
239
|
-
/* @__PURE__ */ jsx(
|
|
240
|
-
SkeletonLoaderItem,
|
|
241
|
-
{
|
|
242
|
-
width: 240,
|
|
243
|
-
height: 30,
|
|
244
|
-
variant,
|
|
245
|
-
speedSec,
|
|
246
|
-
ariaLabel: "Loading"
|
|
247
|
-
}
|
|
248
|
-
)
|
|
249
|
-
]
|
|
250
|
-
}
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
default:
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
return /* @__PURE__ */ jsx(
|
|
258
|
-
"div",
|
|
259
|
-
{
|
|
260
|
-
role: "status",
|
|
261
|
-
"aria-label": "Loading content",
|
|
262
|
-
style: { display: "flex", flexDirection: "column", gap: 16, width: "100%" },
|
|
263
|
-
children: getSkeletonItems()
|
|
264
|
-
}
|
|
265
|
-
);
|
|
3
|
+
export function SkeletonLoader({ type, rows = 3, columns = 3, variant = 'default', speedSec = 3, }) {
|
|
4
|
+
const line = (width, height = 14, radius = 6) => (_jsx(SkeletonLoaderItem, { width: width, height: height, radius: radius, variant: variant, speedSec: speedSec }, `${String(width)}-${height}-${String(radius)}-${Math.random()}`));
|
|
5
|
+
const pills = (count) => Array.from({ length: count }).map((_, i) => (_jsx(SkeletonLoaderItem, { width: 80 + (i % 3) * 30, height: 30, radius: 6, variant: variant, speedSec: speedSec, ariaLabel: "Loading filter" }, `pill-${i}`)));
|
|
6
|
+
const textBlock = (count) => Array.from({ length: count }).map((_, i) => (_jsx(SkeletonLoaderItem, { width: i === count - 1 ? '60%' : `${90 - (i % 3) * 10}%`, height: 12, radius: 4, variant: variant, speedSec: speedSec, ariaLabel: "Loading text line" }, `text-${i}`)));
|
|
7
|
+
const tableHeaderRow = () => (_jsx("div", { style: {
|
|
8
|
+
display: 'grid',
|
|
9
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
10
|
+
gap: 12,
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
width: '100%',
|
|
13
|
+
}, children: Array.from({ length: columns }).map((_, i) => (_jsx(SkeletonLoaderItem, { height: 20, width: "90%", radius: 6, variant: variant, speedSec: speedSec, ariaLabel: "Loading table header" }, `thead-${i}`))) }));
|
|
14
|
+
const tableBodyRow = (rowIndex) => (_jsx("div", { style: {
|
|
15
|
+
display: 'grid',
|
|
16
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
17
|
+
gap: 12,
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
width: '100%',
|
|
20
|
+
}, children: Array.from({ length: columns }).map((_, colIndex) => (_jsx(SkeletonLoaderItem, { height: 20, width: colIndex % 3 === 0 ? '93%' : colIndex % 3 === 1 ? '98%' : '90%', radius: 4, variant: variant, speedSec: speedSec, ariaLabel: "Loading table cell" }, `tcell-${rowIndex}-${colIndex}`))) }, `trow-${rowIndex}`));
|
|
21
|
+
const getSkeletonItems = () => {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case 'button': {
|
|
24
|
+
return (_jsxs("div", { style: {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
gap: 12,
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'flex-start',
|
|
29
|
+
width: '100%',
|
|
30
|
+
flexWrap: 'wrap',
|
|
31
|
+
}, children: [_jsx(SkeletonLoaderItem, { width: 120, height: 40, radius: 8, variant: variant, speedSec: speedSec, ariaLabel: "Loading button" }), _jsx(SkeletonLoaderItem, { width: 96, height: 40, radius: 8, variant: variant, speedSec: speedSec, ariaLabel: "Loading button" })] }));
|
|
32
|
+
}
|
|
33
|
+
case 'card': {
|
|
34
|
+
return (_jsxs("div", { style: {
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: 'column',
|
|
37
|
+
gap: 12,
|
|
38
|
+
width: '100%',
|
|
39
|
+
}, children: [_jsx(SkeletonLoaderItem, { width: "100%", height: 160, radius: 12, variant: variant, speedSec: speedSec, ariaLabel: "Loading card media" }), line('60%', 16, 6), textBlock(3), _jsxs("div", { style: { display: 'flex', gap: 12, justifyContent: 'flex-start' }, children: [_jsx(SkeletonLoaderItem, { width: 100, height: 30, variant: variant, speedSec: speedSec, ariaLabel: "Loading action" }), _jsx(SkeletonLoaderItem, { width: 72, height: 30, variant: variant, speedSec: speedSec, ariaLabel: "Loading action" })] })] }));
|
|
40
|
+
}
|
|
41
|
+
case 'avatar': {
|
|
42
|
+
return (_jsxs("div", { style: {
|
|
43
|
+
display: 'flex',
|
|
44
|
+
gap: 12,
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
width: '100%',
|
|
47
|
+
}, children: [_jsx(SkeletonLoaderItem, { width: 48, height: 48, radius: "50%", variant: variant, speedSec: speedSec, ariaLabel: "Loading avatar" }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 8, flex: 1 }, children: [line('40%', 14), line('25%', 12)] })] }));
|
|
48
|
+
}
|
|
49
|
+
case 'text': {
|
|
50
|
+
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10, width: '100%' }, children: textBlock(rows) }));
|
|
51
|
+
}
|
|
52
|
+
case 'table': {
|
|
53
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 12, width: '100%' }, children: [tableHeaderRow(), Array.from({ length: rows }).map((_, r) => tableBodyRow(r))] }));
|
|
54
|
+
}
|
|
55
|
+
case 'filterbar': {
|
|
56
|
+
return (_jsxs("div", { style: {
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
justifyContent: 'space-between',
|
|
60
|
+
gap: 12,
|
|
61
|
+
flexWrap: 'wrap',
|
|
62
|
+
width: '100%',
|
|
63
|
+
}, children: [_jsx("div", { style: { display: 'flex', gap: 12, flexWrap: 'wrap' }, children: pills(columns) }), _jsx(SkeletonLoaderItem, { width: 240, height: 30, variant: variant, speedSec: speedSec, ariaLabel: "Loading" })] }));
|
|
64
|
+
}
|
|
65
|
+
default:
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return (_jsx("div", { role: "status", "aria-label": "Loading content", style: { display: 'flex', flexDirection: 'column', gap: 16, width: '100%' }, children: getSkeletonItems() }));
|
|
266
70
|
}
|
|
267
|
-
|
|
268
|
-
export { SkeletonLoader };
|
|
@@ -1,36 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styles from './SkeletonLoaderItem.module.css';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const w = typeof width === "number" ? `${width}px` : width;
|
|
14
|
-
const r = typeof radius === "number" ? `${radius}px` : radius;
|
|
15
|
-
return /* @__PURE__ */ jsxs(
|
|
16
|
-
"div",
|
|
17
|
-
{
|
|
18
|
-
className: `${styles.skeletonLoader} ${styles[variant]}`,
|
|
19
|
-
role: "status",
|
|
20
|
-
"aria-label": ariaLabel,
|
|
21
|
-
"aria-live": "polite",
|
|
22
|
-
style: {
|
|
23
|
-
["--h"]: h,
|
|
24
|
-
["--r"]: r,
|
|
25
|
-
["--speed"]: `${speedSec}s`,
|
|
26
|
-
["--width"]: w
|
|
27
|
-
},
|
|
28
|
-
children: [
|
|
29
|
-
/* @__PURE__ */ jsx("span", { className: styles.bar, "aria-hidden": "true" }),
|
|
30
|
-
/* @__PURE__ */ jsx("span", { className: "srOnly", children: "Loading\u2026" })
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
);
|
|
3
|
+
export function SkeletonLoaderItem({ height = 14, width = '100%', radius = 6, speedSec = 3, ariaLabel = 'Loading', variant = 'default', }) {
|
|
4
|
+
const h = typeof height === 'number' ? `${height}px` : height;
|
|
5
|
+
const w = typeof width === 'number' ? `${width}px` : width;
|
|
6
|
+
const r = typeof radius === 'number' ? `${radius}px` : radius;
|
|
7
|
+
return (_jsxs("div", { className: `${styles.skeletonLoader} ${styles[variant]}`, role: "status", "aria-label": ariaLabel, "aria-live": "polite", style: {
|
|
8
|
+
['--h']: h,
|
|
9
|
+
['--r']: r,
|
|
10
|
+
['--speed']: `${speedSec}s`,
|
|
11
|
+
['--width']: w,
|
|
12
|
+
}, children: [_jsx("span", { className: styles.bar, "aria-hidden": "true" }), _jsx("span", { className: "srOnly", children: "Loading\u2026" })] }));
|
|
34
13
|
}
|
|
35
|
-
|
|
36
|
-
export { SkeletonLoaderItem };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Button } from '../button/Button';
|
|
1
3
|
interface SplitButtonItem {
|
|
2
4
|
label?: string;
|
|
3
5
|
onClick: () => void;
|
|
4
|
-
icon?:
|
|
6
|
+
icon?: ReactNode;
|
|
5
7
|
active?: boolean;
|
|
6
8
|
}
|
|
7
|
-
interface SplitButtonProps {
|
|
9
|
+
interface SplitButtonProps extends ComponentProps<typeof Button> {
|
|
8
10
|
onClick?: () => void;
|
|
9
|
-
icon?:
|
|
11
|
+
icon?: ReactNode;
|
|
10
12
|
options: SplitButtonItem[];
|
|
11
|
-
children?:
|
|
13
|
+
children?: ReactNode;
|
|
12
14
|
}
|
|
13
|
-
export declare function SplitButton({ children, options, onClick, icon, }: SplitButtonProps):
|
|
15
|
+
export declare function SplitButton({ children, options, onClick, icon, ...rest }: SplitButtonProps): ReactNode;
|
|
14
16
|
export {};
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
import { jsxs, jsx } from
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styles from './SplitButton.module.css';
|
|
2
3
|
import { Button } from '../button/Button';
|
|
3
4
|
import { Menu } from '../menu/Menu';
|
|
4
5
|
import { Popover } from '../popover/Popover';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function SplitButton({
|
|
8
|
-
children,
|
|
9
|
-
options,
|
|
10
|
-
onClick,
|
|
11
|
-
icon
|
|
12
|
-
}) {
|
|
13
|
-
return /* @__PURE__ */ jsxs("div", { className: styles.container, style: { display: "inline-flex", alignItems: "center" }, children: [
|
|
14
|
-
/* @__PURE__ */ jsxs(Button, { onClick, children: [
|
|
15
|
-
icon,
|
|
16
|
-
children
|
|
17
|
-
] }),
|
|
18
|
-
/* @__PURE__ */ jsx(
|
|
19
|
-
Popover,
|
|
20
|
-
{
|
|
21
|
-
trigger: (onClick2, icon2) => /* @__PURE__ */ jsx("span", { className: styles.triggerContainer, children: /* @__PURE__ */ jsx(Button, { onClick: onClick2, children: icon2 }) }),
|
|
22
|
-
children: /* @__PURE__ */ jsx(Menu, { children: options.map((option) => /* @__PURE__ */ jsx(Menu.Item, { active: option.active, children: /* @__PURE__ */ jsxs("button", { onClick: option.onClick, children: [
|
|
23
|
-
option.icon,
|
|
24
|
-
option.label
|
|
25
|
-
] }) }, option.label)) })
|
|
26
|
-
}
|
|
27
|
-
)
|
|
28
|
-
] });
|
|
6
|
+
export function SplitButton({ children, options, onClick, icon, ...rest }) {
|
|
7
|
+
return (_jsxs("div", { className: styles.container, style: { display: 'inline-flex', alignItems: 'center' }, children: [_jsxs(Button, { ...rest, onClick: onClick, children: [icon, children] }), _jsx(Popover, { trigger: (handleClick, icon) => (_jsx("span", { className: styles.triggerContainer, children: _jsx(Button, { ...rest, onClick: handleClick, children: icon }) })), children: _jsx(Menu, { children: options.map(option => (_jsx(Menu.Item, { active: option.active, children: _jsxs("button", { onClick: option.onClick, children: [option.icon, option.label] }) }, option.label))) }) })] }));
|
|
29
8
|
}
|
|
30
|
-
|
|
31
|
-
export { SplitButton };
|
|
@@ -1,114 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
4
|
import { SplitPaneProvider, useSplitPaneContext } from './provider/SplitPaneContext';
|
|
5
|
-
|
|
5
|
+
import styles from './SplitPane.module.css';
|
|
6
6
|
function clamp(n, min, max) {
|
|
7
|
-
|
|
7
|
+
return Math.max(min, Math.min(max, n));
|
|
8
8
|
}
|
|
9
|
-
function SplitPane({
|
|
10
|
-
|
|
11
|
-
initialPrimarySize = 300,
|
|
12
|
-
minPrimarySize = 160,
|
|
13
|
-
minSecondarySize = 160,
|
|
14
|
-
direction = "horizontal",
|
|
15
|
-
showDivider = "hover",
|
|
16
|
-
gutterSize = 8,
|
|
17
|
-
storageKey
|
|
18
|
-
}) {
|
|
19
|
-
return /* @__PURE__ */ jsx(
|
|
20
|
-
SplitPaneProvider,
|
|
21
|
-
{
|
|
22
|
-
direction,
|
|
23
|
-
initialPrimarySize,
|
|
24
|
-
minPrimarySize,
|
|
25
|
-
minSecondarySize,
|
|
26
|
-
storageKey,
|
|
27
|
-
children: /* @__PURE__ */ jsx(SplitPaneContainer, { showDivider, gutterSize, children })
|
|
28
|
-
}
|
|
29
|
-
);
|
|
9
|
+
export function SplitPane({ children, initialPrimarySize = 300, minPrimarySize = 160, minSecondarySize = 160, direction = 'horizontal', showDivider = 'hover', gutterSize = 8, storageKey, }) {
|
|
10
|
+
return (_jsx(SplitPaneProvider, { direction: direction, initialPrimarySize: initialPrimarySize, minPrimarySize: minPrimarySize, minSecondarySize: minSecondarySize, storageKey: storageKey, children: _jsx(SplitPaneContainer, { showDivider: showDivider, gutterSize: gutterSize, children: children }) }));
|
|
30
11
|
}
|
|
31
|
-
function SplitPaneContainer({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return /* @__PURE__ */ jsx(
|
|
38
|
-
"div",
|
|
39
|
-
{
|
|
40
|
-
ref: containerRef,
|
|
41
|
-
className: styles.container,
|
|
42
|
-
"data-direction": direction,
|
|
43
|
-
"data-divider": showDivider,
|
|
44
|
-
style: {
|
|
45
|
-
"--split-pane-primary-size": `${primarySize}px`,
|
|
46
|
-
"--split-pane-gutter": `${gutterSize}px`
|
|
47
|
-
},
|
|
48
|
-
children
|
|
49
|
-
}
|
|
50
|
-
);
|
|
12
|
+
function SplitPaneContainer({ children, showDivider, gutterSize, }) {
|
|
13
|
+
const { direction, primarySize, containerRef } = useSplitPaneContext();
|
|
14
|
+
return (_jsx("div", { ref: containerRef, className: styles.container, "data-direction": direction, "data-divider": showDivider, style: {
|
|
15
|
+
'--split-pane-primary-size': `${primarySize}px`,
|
|
16
|
+
'--split-pane-gutter': `${gutterSize}px`,
|
|
17
|
+
}, children: children }));
|
|
51
18
|
}
|
|
52
|
-
|
|
53
|
-
|
|
19
|
+
/**
|
|
20
|
+
* IMPORTANT:
|
|
21
|
+
* This component now renders ONLY the primary content (scrollable).
|
|
22
|
+
* The resizer lives in a dedicated <SplitPaneGutter /> so it never overlaps scrollbars.
|
|
23
|
+
*/
|
|
24
|
+
export function SplitPanePrimary({ children }) {
|
|
25
|
+
return _jsx("div", { className: styles.primary, children: children });
|
|
54
26
|
}
|
|
55
|
-
function SplitPaneGutter() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
window.
|
|
87
|
-
window.
|
|
88
|
-
|
|
27
|
+
export function SplitPaneGutter() {
|
|
28
|
+
const { direction, primarySize, setPrimarySize, minPrimarySize, minSecondarySize, containerRef } = useSplitPaneContext();
|
|
29
|
+
const isDraggingRef = useRef(false);
|
|
30
|
+
const startPosRef = useRef(0);
|
|
31
|
+
const startSizeRef = useRef(primarySize);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!window) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const onMove = (e) => {
|
|
37
|
+
if (!isDraggingRef.current)
|
|
38
|
+
return;
|
|
39
|
+
const el = containerRef.current;
|
|
40
|
+
if (!el)
|
|
41
|
+
return;
|
|
42
|
+
const rect = el.getBoundingClientRect();
|
|
43
|
+
const total = direction === 'horizontal' ? rect.width : rect.height;
|
|
44
|
+
const clientPos = direction === 'horizontal' ? e.clientX : e.clientY;
|
|
45
|
+
const delta = clientPos - startPosRef.current;
|
|
46
|
+
// Note: total includes gutter. That's fine because max clamps against secondary min.
|
|
47
|
+
const next = startSizeRef.current + delta;
|
|
48
|
+
const maxPrimary = Math.max(minPrimarySize, total - minSecondarySize);
|
|
49
|
+
setPrimarySize(clamp(next, minPrimarySize, maxPrimary));
|
|
50
|
+
};
|
|
51
|
+
const onUp = () => {
|
|
52
|
+
if (!isDraggingRef.current)
|
|
53
|
+
return;
|
|
54
|
+
isDraggingRef.current = false;
|
|
55
|
+
document.body.style.cursor = '';
|
|
56
|
+
document.body.style.userSelect = '';
|
|
57
|
+
};
|
|
58
|
+
window.addEventListener('mousemove', onMove);
|
|
59
|
+
window.addEventListener('mouseup', onUp);
|
|
60
|
+
return () => {
|
|
61
|
+
if (window) {
|
|
62
|
+
window.removeEventListener('mousemove', onMove);
|
|
63
|
+
window.removeEventListener('mouseup', onUp);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}, [containerRef, direction, minPrimarySize, minSecondarySize, setPrimarySize]);
|
|
67
|
+
const handleMouseDown = (event) => {
|
|
68
|
+
isDraggingRef.current = true;
|
|
69
|
+
startPosRef.current = direction === 'horizontal' ? event.clientX : event.clientY;
|
|
70
|
+
startSizeRef.current = primarySize;
|
|
71
|
+
document.body.style.cursor = direction === 'horizontal' ? 'col-resize' : 'row-resize';
|
|
72
|
+
document.body.style.userSelect = 'none';
|
|
89
73
|
};
|
|
90
|
-
|
|
91
|
-
const handleMouseDown = (event) => {
|
|
92
|
-
isDraggingRef.current = true;
|
|
93
|
-
startPosRef.current = direction === "horizontal" ? event.clientX : event.clientY;
|
|
94
|
-
startSizeRef.current = primarySize;
|
|
95
|
-
document.body.style.cursor = direction === "horizontal" ? "col-resize" : "row-resize";
|
|
96
|
-
document.body.style.userSelect = "none";
|
|
97
|
-
};
|
|
98
|
-
return /* @__PURE__ */ jsx("div", { className: styles.gutter, "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
99
|
-
"span",
|
|
100
|
-
{
|
|
101
|
-
className: styles.resizer,
|
|
102
|
-
onMouseDown: handleMouseDown,
|
|
103
|
-
role: "separator",
|
|
104
|
-
"aria-orientation": direction === "horizontal" ? "vertical" : "horizontal",
|
|
105
|
-
"aria-valuenow": Math.round(primarySize),
|
|
106
|
-
tabIndex: 0
|
|
107
|
-
}
|
|
108
|
-
) });
|
|
74
|
+
return (_jsx("div", { className: styles.gutter, "aria-hidden": "true", children: _jsx("span", { className: styles.resizer, onMouseDown: handleMouseDown, role: "separator", "aria-orientation": direction === 'horizontal' ? 'vertical' : 'horizontal', "aria-valuenow": Math.round(primarySize), tabIndex: 0 }) }));
|
|
109
75
|
}
|
|
110
|
-
function SplitPaneSecondary({ children }) {
|
|
111
|
-
|
|
76
|
+
export function SplitPaneSecondary({ children }) {
|
|
77
|
+
return _jsx("div", { className: styles.secondary, children: children });
|
|
112
78
|
}
|
|
113
|
-
|
|
114
|
-
export { SplitPane, SplitPaneGutter, SplitPanePrimary, SplitPaneSecondary };
|