@dbcdk/react-components 0.0.3 → 0.0.5
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.cjs +10 -10
- package/dist/assets/logo.js +10 -10
- package/dist/components/__stories__/story-components/Colors.cjs +159 -0
- package/dist/components/__stories__/story-components/Colors.d.ts +10 -0
- package/dist/components/__stories__/story-components/Colors.js +151 -0
- package/dist/components/__stories__/story-components/Colors.module.css +27 -0
- package/dist/components/__stories__/story-components/Spacing.cjs +190 -0
- package/dist/components/__stories__/story-components/Spacing.d.ts +1 -0
- package/dist/components/__stories__/story-components/Spacing.js +184 -0
- package/dist/components/__stories__/story-components/Spacing.module.css +154 -0
- package/dist/components/app-header/AppHeader.module.css +10 -15
- package/dist/components/attribute-chip/AttributeChip.cjs +22 -0
- package/dist/components/attribute-chip/AttributeChip.d.ts +8 -0
- package/dist/components/attribute-chip/AttributeChip.js +16 -0
- package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
- package/dist/components/avatar/Avatar.cjs +38 -4
- package/dist/components/avatar/Avatar.d.ts +4 -2
- package/dist/components/avatar/Avatar.js +39 -5
- package/dist/components/avatar/Avatar.module.css +27 -0
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +1 -2
- package/dist/components/breadcrumbs/Breadcrumbs.js +1 -2
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +19 -22
- package/dist/components/button/Button.cjs +20 -12
- package/dist/components/button/Button.d.ts +4 -1
- package/dist/components/button/Button.js +20 -12
- package/dist/components/button/Button.module.css +118 -55
- package/dist/components/card/Card.cjs +53 -13
- package/dist/components/card/Card.d.ts +21 -6
- package/dist/components/card/Card.js +54 -14
- package/dist/components/card/Card.module.css +148 -44
- package/dist/components/card-container/CardContainer.cjs +6 -5
- package/dist/components/card-container/CardContainer.d.ts +5 -2
- package/dist/components/card-container/CardContainer.js +6 -5
- package/dist/components/card-container/CardContainer.module.css +40 -0
- package/dist/components/checkbox/Checkbox.cjs +3 -4
- package/dist/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.js +3 -4
- package/dist/components/checkbox/Checkbox.module.css +10 -10
- package/dist/components/chip/Chip.cjs +2 -1
- package/dist/components/chip/Chip.d.ts +2 -1
- package/dist/components/chip/Chip.js +2 -1
- package/dist/components/chip/Chip.module.css +42 -27
- package/dist/components/circle/Circle.module.css +11 -11
- package/dist/components/clear-button/ClearButton.cjs +3 -3
- package/dist/components/clear-button/ClearButton.js +3 -3
- package/dist/components/clear-button/ClearButton.module.css +8 -7
- package/dist/components/code-block/CodeBlock.cjs +18 -0
- package/dist/components/code-block/CodeBlock.d.ts +6 -0
- package/dist/components/code-block/CodeBlock.js +12 -0
- package/dist/components/code-block/CodeBlock.module.css +60 -0
- package/dist/components/copy-button/CopyButton.cjs +35 -0
- package/dist/components/copy-button/CopyButton.d.ts +9 -0
- package/dist/components/copy-button/CopyButton.js +29 -0
- package/dist/components/copy-button/CopyButton.module.css +6 -0
- package/dist/components/datetime-picker/DateTimePicker.cjs +504 -0
- package/dist/components/datetime-picker/DateTimePicker.d.ts +39 -0
- package/dist/components/datetime-picker/DateTimePicker.js +498 -0
- package/dist/components/datetime-picker/DateTimePicker.module.css +144 -0
- package/dist/components/filter-field/FilterField.cjs +34 -19
- package/dist/components/filter-field/FilterField.d.ts +2 -2
- package/dist/components/filter-field/FilterField.js +35 -20
- package/dist/components/filter-field/FilterField.module.css +14 -20
- package/dist/components/headline/Headline.cjs +10 -4
- package/dist/components/headline/Headline.d.ts +9 -1
- package/dist/components/headline/Headline.js +10 -4
- package/dist/components/headline/Headline.module.css +32 -7
- package/dist/components/icon/Icon.module.css +10 -9
- package/dist/components/input/Input.cjs +60 -19
- package/dist/components/input/Input.d.ts +7 -2
- package/dist/components/input/Input.js +60 -19
- package/dist/components/input/Input.module.css +90 -43
- package/dist/components/link/Link.cjs +46 -0
- package/dist/components/link/Link.d.ts +9 -0
- package/dist/components/link/Link.js +21 -0
- package/dist/components/link/Link.module.css +32 -0
- package/dist/components/menu/Menu.module.css +10 -32
- package/dist/components/meta-bar/MetaBar.cjs +29 -0
- package/dist/components/meta-bar/MetaBar.d.ts +11 -0
- package/dist/components/meta-bar/MetaBar.js +22 -0
- package/dist/components/meta-bar/MetaBar.module.css +12 -0
- package/dist/components/modal/Modal.cjs +134 -0
- package/dist/components/modal/Modal.d.ts +21 -0
- package/dist/components/modal/Modal.js +128 -0
- package/dist/components/modal/Modal.module.css +66 -0
- package/dist/components/modal/provider/ModalProvider.cjs +80 -0
- package/dist/components/modal/provider/ModalProvider.d.ts +21 -0
- package/dist/components/modal/provider/ModalProvider.js +77 -0
- package/dist/components/multi-select/MultiSelect.cjs +12 -1
- package/dist/components/multi-select/MultiSelect.js +12 -1
- package/dist/components/nav-bar/NavBar.module.css +11 -16
- package/dist/components/page/Page.module.css +2 -2
- package/dist/components/page-layout/PageLayout.cjs +5 -22
- package/dist/components/page-layout/PageLayout.d.ts +1 -8
- package/dist/components/page-layout/PageLayout.js +5 -22
- package/dist/components/page-layout/PageLayout.module.css +4 -80
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.cjs +32 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.d.ts +11 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +25 -0
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +84 -0
- package/dist/components/pagination/Pagination.cjs +83 -67
- package/dist/components/pagination/Pagination.d.ts +3 -1
- package/dist/components/pagination/Pagination.js +84 -68
- package/dist/components/pagination/Pagination.module.css +11 -3
- package/dist/components/panel/Panel.module.css +5 -7
- package/dist/components/popover/Popover.cjs +25 -8
- package/dist/components/popover/Popover.d.ts +2 -1
- package/dist/components/popover/Popover.js +25 -8
- package/dist/components/popover/Popover.module.css +4 -6
- package/dist/components/search-box/SearchBox.cjs +50 -37
- package/dist/components/search-box/SearchBox.d.ts +10 -7
- package/dist/components/search-box/SearchBox.js +50 -37
- package/dist/components/search-box/SearchBox.module.css +0 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +12 -6
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +12 -6
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +5 -1
- package/dist/components/select/Select.cjs +82 -13
- package/dist/components/select/Select.d.ts +2 -1
- package/dist/components/select/Select.js +83 -14
- package/dist/components/sidebar/Sidebar.cjs +3 -30
- package/dist/components/sidebar/Sidebar.d.ts +2 -1
- package/dist/components/sidebar/Sidebar.js +4 -26
- package/dist/components/sidebar/components/SidebarItem.cjs +3 -1
- package/dist/components/sidebar/components/SidebarItem.js +3 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +40 -14
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +3 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +40 -14
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +9 -38
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +50 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +8 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +43 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +155 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +16 -9
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +2 -1
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +16 -9
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +25 -12
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +2 -1
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +1 -1
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +2 -1
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +29 -2
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +25 -2
- package/dist/components/sidebar/providers/SidebarProvider.cjs +108 -10
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +7 -3
- package/dist/components/sidebar/providers/SidebarProvider.js +109 -11
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +1 -1
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +1 -1
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -12
- package/dist/components/split-pane/SplitPane.cjs +123 -0
- package/dist/components/split-pane/SplitPane.d.ts +34 -0
- package/dist/components/split-pane/SplitPane.js +114 -0
- package/dist/components/split-pane/SplitPane.module.css +106 -0
- package/dist/components/split-pane/provider/SplitPaneContext.cjs +87 -0
- package/dist/components/split-pane/provider/SplitPaneContext.d.ts +23 -0
- package/dist/components/split-pane/provider/SplitPaneContext.js +79 -0
- package/dist/components/table/Table.cjs +180 -112
- package/dist/components/table/Table.d.ts +22 -6
- package/dist/components/table/Table.js +181 -113
- package/dist/components/table/Table.module.css +74 -47
- package/dist/components/table/components/empty-state/EmptyState.cjs +52 -0
- package/dist/components/table/components/empty-state/EmptyState.d.ts +40 -0
- package/dist/components/table/components/empty-state/EmptyState.js +46 -0
- package/dist/components/table/components/empty-state/EmptyState.module.css +16 -0
- package/dist/components/table/components/table-settings/TableSettings.cjs +32 -0
- package/dist/components/table/components/table-settings/TableSettings.d.ts +7 -0
- package/dist/components/table/components/table-settings/TableSettings.js +30 -0
- package/dist/{tanstack.cjs → components/table/tanstack.cjs} +61 -99
- package/dist/components/table/tanstack.d.ts +14 -0
- package/dist/{tanstack.js → components/table/tanstack.js} +61 -99
- package/dist/components/tabs/Tabs.cjs +33 -17
- package/dist/components/tabs/Tabs.d.ts +6 -3
- package/dist/components/tabs/Tabs.js +33 -17
- package/dist/components/tabs/Tabs.module.css +9 -9
- package/dist/components/toast/Toast.cjs +47 -0
- package/dist/components/toast/Toast.d.ts +14 -0
- package/dist/components/toast/Toast.js +41 -0
- package/dist/components/toast/Toast.module.css +101 -0
- package/dist/components/toast/provider/ToastProvider.cjs +98 -0
- package/dist/components/toast/provider/ToastProvider.d.ts +23 -0
- package/dist/components/toast/provider/ToastProvider.js +91 -0
- package/dist/components/tooltip/Tooltip.cjs +134 -29
- package/dist/components/tooltip/Tooltip.js +135 -30
- package/dist/components/tooltip/Tooltip.module.css +25 -43
- package/dist/components/user-display/UserDisplay.module.css +2 -2
- package/dist/constants/severity.cjs +12 -12
- package/dist/constants/severity.js +12 -12
- package/dist/constants/sizes.cjs +1 -0
- package/dist/constants/sizes.d.ts +1 -1
- package/dist/constants/sizes.js +1 -0
- package/dist/hooks/usePagination.cjs +88 -0
- package/dist/hooks/usePagination.d.ts +33 -0
- package/dist/hooks/usePagination.js +86 -0
- package/dist/hooks/useSorting.cjs +118 -0
- package/dist/hooks/useSorting.d.ts +49 -0
- package/dist/hooks/useSorting.js +116 -0
- package/dist/hooks/useTableData.cjs +52 -0
- package/dist/hooks/useTableData.d.ts +40 -0
- package/dist/hooks/useTableData.js +50 -0
- package/dist/hooks/useTableSelection.cjs +130 -0
- package/dist/hooks/useTableSelection.d.ts +25 -0
- package/dist/hooks/useTableSelection.js +128 -0
- package/dist/hooks/useTableSettings.cjs +28 -0
- package/dist/hooks/useTableSettings.d.ts +7 -0
- package/dist/hooks/useTableSettings.js +26 -0
- package/dist/hooks/useTimeDuration.cjs +39 -0
- package/dist/hooks/useTimeDuration.d.ts +22 -0
- package/dist/hooks/useTimeDuration.js +37 -0
- package/dist/hooks/useViewportFill.js +1 -1
- package/dist/index.cjs +119 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/dist/src/styles/styles.css +101 -8
- package/dist/styles/css-helper-classes/flex.css +97 -0
- package/dist/styles/css-helper-classes/typography.css +7 -0
- package/dist/styles/styles.css +101 -8
- package/dist/styles/themes/dbc/dark.css +206 -99
- package/dist/styles/themes/dbc/light.css +183 -89
- package/dist/types/sizes.types.d.ts +2 -2
- package/package.json +17 -11
- package/dist/components/data-summary/DataSummary.cjs +0 -49
- package/dist/components/data-summary/DataSummary.d.ts +0 -19
- package/dist/components/data-summary/DataSummary.js +0 -43
- package/dist/components/data-summary/DataSummary.module.css +0 -51
- package/dist/components/sidebar/Sidebar.module.css +0 -66
- package/dist/tanstack.d.ts +0 -25
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef, useState, useRef, useEffect, useMemo } from 'react';
|
|
3
3
|
import { Search } from 'lucide-react';
|
|
4
|
-
import { Input } from '
|
|
5
|
-
import { Menu } from '
|
|
6
|
-
import { Popover } from '
|
|
7
|
-
import { Button } from '
|
|
8
|
-
import { SkeletonLoaderItem } from '
|
|
4
|
+
import { Input } from '@/components/input/Input';
|
|
5
|
+
import { Menu } from '@/components/menu/Menu';
|
|
6
|
+
import { Popover } from '@/components/popover/Popover';
|
|
7
|
+
import { Button } from '@/components/button/Button';
|
|
8
|
+
import { SkeletonLoaderItem } from '@/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem';
|
|
9
9
|
import styles from './SearchBox.module.css';
|
|
10
10
|
|
|
11
|
-
const SearchBox = forwardRef(function
|
|
12
|
-
|
|
11
|
+
const SearchBox = forwardRef(function SearchBoxInner({
|
|
12
|
+
inputWidth,
|
|
13
13
|
inputSize,
|
|
14
14
|
variant,
|
|
15
15
|
result,
|
|
@@ -26,9 +26,12 @@ const SearchBox = forwardRef(function SearchBox2({
|
|
|
26
26
|
loading,
|
|
27
27
|
enableHotkey = true,
|
|
28
28
|
onButtonClick,
|
|
29
|
+
value,
|
|
30
|
+
onChange,
|
|
29
31
|
...rest
|
|
30
32
|
}, ref) {
|
|
31
|
-
const
|
|
33
|
+
const isControlled = value !== void 0;
|
|
34
|
+
const [draft, setDraft] = useState(() => isControlled ? String(value != null ? value : "") : "");
|
|
32
35
|
const [searchQuery, setSearchQuery] = useState("");
|
|
33
36
|
const popoverRef = useRef(null);
|
|
34
37
|
const internalInputRef = useRef(null);
|
|
@@ -39,18 +42,24 @@ const SearchBox = forwardRef(function SearchBox2({
|
|
|
39
42
|
ref.current = internalInputRef.current;
|
|
40
43
|
}
|
|
41
44
|
}, [ref]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!isControlled) return;
|
|
47
|
+
const next = String(value != null ? value : "");
|
|
48
|
+
if (next !== draft) setDraft(next);
|
|
49
|
+
}, [value]);
|
|
42
50
|
useEffect(() => {
|
|
43
51
|
if (!onSearch) return;
|
|
44
|
-
if (debounce) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, debounceMs);
|
|
49
|
-
return () => clearTimeout(handler);
|
|
50
|
-
} else {
|
|
51
|
-
onSearch(query);
|
|
52
|
+
if (!debounce) {
|
|
53
|
+
setSearchQuery(draft);
|
|
54
|
+
onSearch(draft);
|
|
55
|
+
return;
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
const handler = setTimeout(() => {
|
|
58
|
+
setSearchQuery(draft);
|
|
59
|
+
onSearch(draft);
|
|
60
|
+
}, debounceMs);
|
|
61
|
+
return () => clearTimeout(handler);
|
|
62
|
+
}, [draft, onSearch, debounce, debounceMs]);
|
|
54
63
|
useEffect(() => {
|
|
55
64
|
function handleKeyDown(event) {
|
|
56
65
|
var _a;
|
|
@@ -65,7 +74,8 @@ const SearchBox = forwardRef(function SearchBox2({
|
|
|
65
74
|
}
|
|
66
75
|
}, [enableHotkey]);
|
|
67
76
|
const handleChange = (e) => {
|
|
68
|
-
|
|
77
|
+
setDraft(e.target.value);
|
|
78
|
+
onChange == null ? void 0 : onChange(e);
|
|
69
79
|
};
|
|
70
80
|
function handleSelect(item) {
|
|
71
81
|
onSelect == null ? void 0 : onSelect(item);
|
|
@@ -73,12 +83,15 @@ const SearchBox = forwardRef(function SearchBox2({
|
|
|
73
83
|
}
|
|
74
84
|
function reset() {
|
|
75
85
|
var _a;
|
|
76
|
-
|
|
86
|
+
setDraft("");
|
|
77
87
|
setSearchQuery("");
|
|
78
88
|
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
79
89
|
}
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
const inputProps = {
|
|
91
|
+
...rest,
|
|
92
|
+
value: draft,
|
|
93
|
+
onChange: handleChange
|
|
94
|
+
};
|
|
82
95
|
const inputField = useMemo(() => {
|
|
83
96
|
var _a;
|
|
84
97
|
if (displayPopover) {
|
|
@@ -93,30 +106,30 @@ const SearchBox = forwardRef(function SearchBox2({
|
|
|
93
106
|
Input,
|
|
94
107
|
{
|
|
95
108
|
ref: internalInputRef,
|
|
96
|
-
onInput: handleChange,
|
|
97
109
|
onFocusCapture: event,
|
|
98
110
|
onClick: event,
|
|
99
|
-
minWidth:
|
|
111
|
+
minWidth: inputWidth != null ? inputWidth : "300px",
|
|
112
|
+
width: inputWidth != null ? inputWidth : "300px",
|
|
100
113
|
icon: /* @__PURE__ */ jsx(Search, {}),
|
|
101
114
|
inputSize,
|
|
102
|
-
|
|
115
|
+
variant,
|
|
116
|
+
...inputProps,
|
|
103
117
|
placeholder: (_a2 = rest.placeholder) != null ? _a2 : "Indtast s\xF8geord"
|
|
104
118
|
}
|
|
105
119
|
);
|
|
106
120
|
},
|
|
107
|
-
children: (result == null ? void 0 : result.length) ? /* @__PURE__ */ jsx(Menu, { children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsx("tbody", { children: result.map((item, index) => /* @__PURE__ */ jsx("tr", { onClick: () => handleSelect(item), role: "button", tabIndex: 0, children: resultKeys == null ? void 0 : resultKeys.map((key) => {
|
|
108
|
-
const
|
|
121
|
+
children: resultTemplate ? resultTemplate : (result == null ? void 0 : result.length) ? /* @__PURE__ */ jsx(Menu, { children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsx("tbody", { children: result.map((item, index) => /* @__PURE__ */ jsx("tr", { onClick: () => handleSelect(item), role: "button", tabIndex: 0, children: resultKeys == null ? void 0 : resultKeys.map((key) => {
|
|
122
|
+
const raw = item[key];
|
|
123
|
+
const cell = raw != null ? String(raw) : "";
|
|
109
124
|
return /* @__PURE__ */ jsx(
|
|
110
125
|
"td",
|
|
111
126
|
{
|
|
112
|
-
style: {
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
children: String(item[key])
|
|
127
|
+
style: { whiteSpace: cell.length < 10 ? "nowrap" : void 0 },
|
|
128
|
+
children: cell
|
|
116
129
|
},
|
|
117
|
-
|
|
130
|
+
key
|
|
118
131
|
);
|
|
119
|
-
}) }, index)) }) }) }) : !searchQuery && !loading ? initialTemplate || /* @__PURE__ */ jsx("div", { className: styles.resultContainer, children: "Indtast s\xF8geord" }) : loading ? /* @__PURE__ */ jsx("table", { style: { width: "100%" }, children: /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: 5 }).map((_, index) => /* @__PURE__ */ jsx("tr", { children: resultKeys == null ? void 0 : resultKeys.map((key) => /* @__PURE__ */ jsx("td", { style: { padding: "8px" }, children: /* @__PURE__ */ jsx(SkeletonLoaderItem, { height: 20, width: "100%" }) },
|
|
132
|
+
}) }, index)) }) }) }) : !searchQuery && !loading ? initialTemplate || /* @__PURE__ */ jsx("div", { className: styles.resultContainer, children: "Indtast s\xF8geord" }) : loading ? /* @__PURE__ */ jsx("table", { style: { width: "100%" }, children: /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: 5 }).map((_, index) => /* @__PURE__ */ jsx("tr", { children: resultKeys == null ? void 0 : resultKeys.map((key) => /* @__PURE__ */ jsx("td", { style: { padding: "8px" }, children: /* @__PURE__ */ jsx(SkeletonLoaderItem, { height: 20, width: "100%" }) }, key)) }, index)) }) }) : /* @__PURE__ */ jsx("div", { className: styles.resultContainer, children: noResultText })
|
|
120
133
|
}
|
|
121
134
|
);
|
|
122
135
|
}
|
|
@@ -124,12 +137,11 @@ const SearchBox = forwardRef(function SearchBox2({
|
|
|
124
137
|
Input,
|
|
125
138
|
{
|
|
126
139
|
ref: internalInputRef,
|
|
127
|
-
onInput: handleChange,
|
|
128
140
|
icon: /* @__PURE__ */ jsx(Search, {}),
|
|
129
|
-
minWidth:
|
|
141
|
+
minWidth: inputWidth != null ? inputWidth : "300px",
|
|
130
142
|
inputSize,
|
|
131
143
|
variant,
|
|
132
|
-
...
|
|
144
|
+
...inputProps,
|
|
133
145
|
placeholder: (_a = rest.placeholder) != null ? _a : "Indtast s\xF8geord"
|
|
134
146
|
}
|
|
135
147
|
);
|
|
@@ -142,10 +154,11 @@ const SearchBox = forwardRef(function SearchBox2({
|
|
|
142
154
|
initialTemplate,
|
|
143
155
|
searchQuery,
|
|
144
156
|
loading,
|
|
145
|
-
|
|
157
|
+
inputWidth,
|
|
146
158
|
inputSize,
|
|
147
159
|
variant,
|
|
148
|
-
|
|
160
|
+
inputProps,
|
|
161
|
+
rest.placeholder
|
|
149
162
|
]);
|
|
150
163
|
return onButtonClick ? /* @__PURE__ */ jsxs("div", { className: styles.withButton, children: [
|
|
151
164
|
inputField,
|
|
@@ -17,12 +17,11 @@ const SegmentedProgressBar = ({
|
|
|
17
17
|
centerLabel,
|
|
18
18
|
height,
|
|
19
19
|
rounded = true,
|
|
20
|
-
trackColor = "var(--color-
|
|
20
|
+
trackColor = "var(--color-neutral)",
|
|
21
21
|
tooltipPlacement = "top",
|
|
22
22
|
className,
|
|
23
23
|
...aria
|
|
24
24
|
}) => {
|
|
25
|
-
var _a;
|
|
26
25
|
const sum = segments.reduce((acc, s) => acc + (s.value || 0), 0);
|
|
27
26
|
const effectiveTotal = total != null ? total : sum;
|
|
28
27
|
const safeTotal = Math.max(effectiveTotal, 1e-4);
|
|
@@ -38,6 +37,7 @@ const SegmentedProgressBar = ({
|
|
|
38
37
|
return base.join("/");
|
|
39
38
|
})();
|
|
40
39
|
const rootClass = [styles__default.default.container, className].filter(Boolean).join(" ");
|
|
40
|
+
const filteredSergments = computedSegments == null ? void 0 : computedSegments.filter((x) => x.value > 0);
|
|
41
41
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
42
|
"div",
|
|
43
43
|
{
|
|
@@ -57,9 +57,9 @@ const SegmentedProgressBar = ({
|
|
|
57
57
|
background: trackColor
|
|
58
58
|
},
|
|
59
59
|
children: [
|
|
60
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.segmentsContainer, children:
|
|
61
|
-
var
|
|
62
|
-
const bg = (_b = seg.color) != null ? _b : severity.SeverityBgColor[(
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.segmentsContainer, children: filteredSergments == null ? void 0 : filteredSergments.map((seg, i) => {
|
|
61
|
+
var _a, _b, _c, _d, _e;
|
|
62
|
+
const bg = (_b = seg.color) != null ? _b : severity.SeverityBgColor[(_a = seg.severity) != null ? _a : "neutral"];
|
|
63
63
|
const fg = severity.SeverityTextColor[(_c = seg.severity) != null ? _c : "neutral"];
|
|
64
64
|
const tooltipText = typeof seg.label !== "undefined" ? seg.label : String((_d = seg.value) != null ? _d : 0);
|
|
65
65
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -86,7 +86,13 @@ const SegmentedProgressBar = ({
|
|
|
86
86
|
`${i}`
|
|
87
87
|
);
|
|
88
88
|
}) }),
|
|
89
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
className: `${styles__default.default.progressCenter} ${(filteredSergments == null ? void 0 : filteredSergments.length) === 0 ? styles__default.default.emptySegments : ""}`,
|
|
93
|
+
children: centerLabel ? typeof centerLabel === "function" ? centerLabel(pctFilled) : centerLabel : autoNumbers
|
|
94
|
+
}
|
|
95
|
+
)
|
|
90
96
|
]
|
|
91
97
|
}
|
|
92
98
|
)
|
|
@@ -11,12 +11,11 @@ const SegmentedProgressBar = ({
|
|
|
11
11
|
centerLabel,
|
|
12
12
|
height,
|
|
13
13
|
rounded = true,
|
|
14
|
-
trackColor = "var(--color-
|
|
14
|
+
trackColor = "var(--color-neutral)",
|
|
15
15
|
tooltipPlacement = "top",
|
|
16
16
|
className,
|
|
17
17
|
...aria
|
|
18
18
|
}) => {
|
|
19
|
-
var _a;
|
|
20
19
|
const sum = segments.reduce((acc, s) => acc + (s.value || 0), 0);
|
|
21
20
|
const effectiveTotal = total != null ? total : sum;
|
|
22
21
|
const safeTotal = Math.max(effectiveTotal, 1e-4);
|
|
@@ -32,6 +31,7 @@ const SegmentedProgressBar = ({
|
|
|
32
31
|
return base.join("/");
|
|
33
32
|
})();
|
|
34
33
|
const rootClass = [styles.container, className].filter(Boolean).join(" ");
|
|
34
|
+
const filteredSergments = computedSegments == null ? void 0 : computedSegments.filter((x) => x.value > 0);
|
|
35
35
|
return /* @__PURE__ */ jsx(
|
|
36
36
|
"div",
|
|
37
37
|
{
|
|
@@ -51,9 +51,9 @@ const SegmentedProgressBar = ({
|
|
|
51
51
|
background: trackColor
|
|
52
52
|
},
|
|
53
53
|
children: [
|
|
54
|
-
/* @__PURE__ */ jsx("span", { className: styles.segmentsContainer, children:
|
|
55
|
-
var
|
|
56
|
-
const bg = (_b = seg.color) != null ? _b : SeverityBgColor[(
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: styles.segmentsContainer, children: filteredSergments == null ? void 0 : filteredSergments.map((seg, i) => {
|
|
55
|
+
var _a, _b, _c, _d, _e;
|
|
56
|
+
const bg = (_b = seg.color) != null ? _b : SeverityBgColor[(_a = seg.severity) != null ? _a : "neutral"];
|
|
57
57
|
const fg = SeverityTextColor[(_c = seg.severity) != null ? _c : "neutral"];
|
|
58
58
|
const tooltipText = typeof seg.label !== "undefined" ? seg.label : String((_d = seg.value) != null ? _d : 0);
|
|
59
59
|
return /* @__PURE__ */ jsx(
|
|
@@ -80,7 +80,13 @@ const SegmentedProgressBar = ({
|
|
|
80
80
|
`${i}`
|
|
81
81
|
);
|
|
82
82
|
}) }),
|
|
83
|
-
/* @__PURE__ */ jsx(
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: `${styles.progressCenter} ${(filteredSergments == null ? void 0 : filteredSergments.length) === 0 ? styles.emptySegments : ""}`,
|
|
87
|
+
children: centerLabel ? typeof centerLabel === "function" ? centerLabel(pctFilled) : centerLabel : autoNumbers
|
|
88
|
+
}
|
|
89
|
+
)
|
|
84
90
|
]
|
|
85
91
|
}
|
|
86
92
|
)
|
|
@@ -24,11 +24,15 @@
|
|
|
24
24
|
display: flex;
|
|
25
25
|
align-items: center;
|
|
26
26
|
justify-content: center;
|
|
27
|
-
color: var(--color-
|
|
27
|
+
color: var(--color-fg-on-strong);
|
|
28
28
|
font-size: inherit;
|
|
29
29
|
pointer-events: none;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.emptySegments.progressCenter {
|
|
33
|
+
color: unset;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
.segmentWrapper,
|
|
33
37
|
.segmentsContainer {
|
|
34
38
|
display: flex;
|
|
@@ -15,31 +15,100 @@ function Select({
|
|
|
15
15
|
placeholder = "V\xE6lg",
|
|
16
16
|
size,
|
|
17
17
|
variant = "outlined",
|
|
18
|
-
onClear
|
|
18
|
+
onClear,
|
|
19
|
+
fullWidth = false
|
|
19
20
|
}) {
|
|
20
|
-
const
|
|
21
|
+
const popoverRef = react.useRef(null);
|
|
22
|
+
const optionRefs = react.useRef([]);
|
|
23
|
+
const selectedIndex = options.findIndex((o) => o.value === selectedValue);
|
|
24
|
+
const [activeIndex, setActiveIndex] = react.useState(selectedIndex >= 0 ? selectedIndex : 0);
|
|
25
|
+
react.useEffect(() => {
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = optionRefs.current[activeIndex]) == null ? void 0 : _a.focus();
|
|
28
|
+
}, [activeIndex]);
|
|
29
|
+
const handleKeyDown = (e) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
switch (e.key) {
|
|
32
|
+
case "ArrowDown": {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
setActiveIndex((i) => Math.min(i + 1, options.length - 1));
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case "ArrowUp": {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
setActiveIndex((i) => Math.max(i - 1, 0));
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case "Enter":
|
|
43
|
+
case " ": {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
const opt = options[activeIndex];
|
|
46
|
+
if (opt) {
|
|
47
|
+
onChange(opt.value);
|
|
48
|
+
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case "Escape": {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
(_b = popoverRef.current) == null ? void 0 : _b.close();
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
21
59
|
const selected = options.find((o) => o.value === selectedValue);
|
|
22
60
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
23
61
|
Popover.Popover,
|
|
24
62
|
{
|
|
25
|
-
ref,
|
|
26
|
-
trigger: (onClick, icon) => /* @__PURE__ */ jsxRuntime.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
63
|
+
ref: popoverRef,
|
|
64
|
+
trigger: (onClick, icon) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
Button.Button,
|
|
66
|
+
{
|
|
67
|
+
onKeyDown: handleKeyDown,
|
|
68
|
+
fullWidth,
|
|
69
|
+
variant,
|
|
70
|
+
onClick: (e) => {
|
|
71
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
72
|
+
onClick(e);
|
|
73
|
+
},
|
|
74
|
+
size,
|
|
75
|
+
type: "button",
|
|
76
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
77
|
+
"span",
|
|
78
|
+
{
|
|
79
|
+
className: "dbc-flex dbc-justify-between dbc-items-center dbc-gap-xxs",
|
|
80
|
+
style: { width: "100%" },
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: selected ? selected.label : placeholder }),
|
|
83
|
+
onClear && selected && /* @__PURE__ */ jsxRuntime.jsx(ClearButton.ClearButton, { onClick: onClear }),
|
|
84
|
+
icon
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu, { onKeyDown: handleKeyDown, children: options.map((opt, index) => {
|
|
91
|
+
const isSelected = opt.value === selectedValue;
|
|
92
|
+
const isActive = index === activeIndex;
|
|
93
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Item, { active: isActive, "aria-selected": isSelected, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
34
94
|
"button",
|
|
35
95
|
{
|
|
96
|
+
ref: (el) => optionRefs.current[index] = el,
|
|
97
|
+
type: "button",
|
|
98
|
+
tabIndex: isActive ? 0 : -1,
|
|
36
99
|
onClick: () => {
|
|
37
100
|
var _a;
|
|
38
101
|
onChange(opt.value);
|
|
39
|
-
(_a =
|
|
102
|
+
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
103
|
+
},
|
|
104
|
+
onFocus: () => setActiveIndex(index),
|
|
105
|
+
style: {
|
|
106
|
+
display: "flex",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
width: "100%"
|
|
40
109
|
},
|
|
41
110
|
children: [
|
|
42
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { width: 16, display: "inline-flex", justifyContent: "center" }, children:
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { width: 16, display: "inline-flex", justifyContent: "center" }, children: isSelected ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}) : null }),
|
|
43
112
|
opt.label
|
|
44
113
|
]
|
|
45
114
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonVariant } from '../button/Button';
|
|
2
2
|
import { MultiselectOption } from '../filter-field/FilterField';
|
|
3
|
-
export declare function Select({ options, selectedValue, onChange, placeholder, size, variant, onClear, }: {
|
|
3
|
+
export declare function Select({ options, selectedValue, onChange, placeholder, size, variant, onClear, fullWidth, }: {
|
|
4
4
|
options: MultiselectOption[];
|
|
5
5
|
selectedValue: string | null;
|
|
6
6
|
onChange: (value: string) => void;
|
|
@@ -8,4 +8,5 @@ export declare function Select({ options, selectedValue, onChange, placeholder,
|
|
|
8
8
|
size?: 'sm' | 'md' | 'lg';
|
|
9
9
|
variant?: ButtonVariant;
|
|
10
10
|
onClear?: () => void;
|
|
11
|
+
fullWidth?: boolean;
|
|
11
12
|
}): React.ReactNode;
|
|
@@ -4,7 +4,7 @@ import { Menu } from '../menu/Menu';
|
|
|
4
4
|
import { Popover } from '../popover/Popover';
|
|
5
5
|
import { Button } from '../button/Button';
|
|
6
6
|
import { ClearButton } from '../clear-button/ClearButton';
|
|
7
|
-
import { useRef } from 'react';
|
|
7
|
+
import { useRef, useState, useEffect } from 'react';
|
|
8
8
|
|
|
9
9
|
function Select({
|
|
10
10
|
options,
|
|
@@ -13,31 +13,100 @@ function Select({
|
|
|
13
13
|
placeholder = "V\xE6lg",
|
|
14
14
|
size,
|
|
15
15
|
variant = "outlined",
|
|
16
|
-
onClear
|
|
16
|
+
onClear,
|
|
17
|
+
fullWidth = false
|
|
17
18
|
}) {
|
|
18
|
-
const
|
|
19
|
+
const popoverRef = useRef(null);
|
|
20
|
+
const optionRefs = useRef([]);
|
|
21
|
+
const selectedIndex = options.findIndex((o) => o.value === selectedValue);
|
|
22
|
+
const [activeIndex, setActiveIndex] = useState(selectedIndex >= 0 ? selectedIndex : 0);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
var _a;
|
|
25
|
+
(_a = optionRefs.current[activeIndex]) == null ? void 0 : _a.focus();
|
|
26
|
+
}, [activeIndex]);
|
|
27
|
+
const handleKeyDown = (e) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
switch (e.key) {
|
|
30
|
+
case "ArrowDown": {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
setActiveIndex((i) => Math.min(i + 1, options.length - 1));
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case "ArrowUp": {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
setActiveIndex((i) => Math.max(i - 1, 0));
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "Enter":
|
|
41
|
+
case " ": {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
const opt = options[activeIndex];
|
|
44
|
+
if (opt) {
|
|
45
|
+
onChange(opt.value);
|
|
46
|
+
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case "Escape": {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
(_b = popoverRef.current) == null ? void 0 : _b.close();
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
19
57
|
const selected = options.find((o) => o.value === selectedValue);
|
|
20
58
|
return /* @__PURE__ */ jsx(
|
|
21
59
|
Popover,
|
|
22
60
|
{
|
|
23
|
-
ref,
|
|
24
|
-
trigger: (onClick, icon) => /* @__PURE__ */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
61
|
+
ref: popoverRef,
|
|
62
|
+
trigger: (onClick, icon) => /* @__PURE__ */ jsx(
|
|
63
|
+
Button,
|
|
64
|
+
{
|
|
65
|
+
onKeyDown: handleKeyDown,
|
|
66
|
+
fullWidth,
|
|
67
|
+
variant,
|
|
68
|
+
onClick: (e) => {
|
|
69
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
70
|
+
onClick(e);
|
|
71
|
+
},
|
|
72
|
+
size,
|
|
73
|
+
type: "button",
|
|
74
|
+
children: /* @__PURE__ */ jsxs(
|
|
75
|
+
"span",
|
|
76
|
+
{
|
|
77
|
+
className: "dbc-flex dbc-justify-between dbc-items-center dbc-gap-xxs",
|
|
78
|
+
style: { width: "100%" },
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsx("span", { children: selected ? selected.label : placeholder }),
|
|
81
|
+
onClear && selected && /* @__PURE__ */ jsx(ClearButton, { onClick: onClear }),
|
|
82
|
+
icon
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
children: /* @__PURE__ */ jsx(Menu, { onKeyDown: handleKeyDown, children: options.map((opt, index) => {
|
|
89
|
+
const isSelected = opt.value === selectedValue;
|
|
90
|
+
const isActive = index === activeIndex;
|
|
91
|
+
return /* @__PURE__ */ jsx(Menu.Item, { active: isActive, "aria-selected": isSelected, children: /* @__PURE__ */ jsxs(
|
|
32
92
|
"button",
|
|
33
93
|
{
|
|
94
|
+
ref: (el) => optionRefs.current[index] = el,
|
|
95
|
+
type: "button",
|
|
96
|
+
tabIndex: isActive ? 0 : -1,
|
|
34
97
|
onClick: () => {
|
|
35
98
|
var _a;
|
|
36
99
|
onChange(opt.value);
|
|
37
|
-
(_a =
|
|
100
|
+
(_a = popoverRef.current) == null ? void 0 : _a.close();
|
|
101
|
+
},
|
|
102
|
+
onFocus: () => setActiveIndex(index),
|
|
103
|
+
style: {
|
|
104
|
+
display: "flex",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
width: "100%"
|
|
38
107
|
},
|
|
39
108
|
children: [
|
|
40
|
-
/* @__PURE__ */ jsx("span", { style: { width: 16, display: "inline-flex", justifyContent: "center" }, children:
|
|
109
|
+
/* @__PURE__ */ jsx("span", { style: { width: 16, display: "inline-flex", justifyContent: "center" }, children: isSelected ? /* @__PURE__ */ jsx(Check, {}) : null }),
|
|
41
110
|
opt.label
|
|
42
111
|
]
|
|
43
112
|
}
|
|
@@ -1,38 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var styles = require('./Sidebar.module.css');
|
|
5
|
-
var Headline = require('../headline/Headline');
|
|
6
|
-
var SidenavFiltering = require('./components/sidenav-filteirng/SidenavFiltering');
|
|
7
4
|
var SidebarProvider = require('./providers/SidebarProvider');
|
|
8
|
-
var
|
|
9
|
-
var logo = require('../../assets/logo');
|
|
5
|
+
var SidebarContainer = require('./components/sidebar-container/SidebarContainer');
|
|
10
6
|
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
14
|
-
var SidenavFiltering__default = /*#__PURE__*/_interopDefault(SidenavFiltering);
|
|
15
|
-
|
|
16
|
-
function Sidebar({
|
|
17
|
-
collapsed,
|
|
18
|
-
items,
|
|
19
|
-
logo: logo$1,
|
|
20
|
-
productName,
|
|
21
|
-
productLogo,
|
|
22
|
-
activeLink
|
|
23
|
-
}) {
|
|
24
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.container, children: [
|
|
25
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.header, children: [
|
|
26
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.logo, children: logo$1 != null ? logo$1 : /* @__PURE__ */ jsxRuntime.jsx(logo.Logo, {}) }),
|
|
27
|
-
productName && /* @__PURE__ */ jsxRuntime.jsx(Headline.Headline, { disableMargin: true, children: productName }),
|
|
28
|
-
productLogo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.productLogo, children: productLogo })
|
|
29
|
-
] }),
|
|
30
|
-
/* @__PURE__ */ jsxRuntime.jsx(SidebarProvider.SidebarProvider, { items, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.content, children: [
|
|
31
|
-
/* @__PURE__ */ jsxRuntime.jsx(SidenavFiltering__default.default, {}),
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.links, children: /* @__PURE__ */ jsxRuntime.jsx(SidebarItems.SidebarItems, { activeLink }) })
|
|
33
|
-
] }) }),
|
|
34
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.footer })
|
|
35
|
-
] });
|
|
7
|
+
function Sidebar({ items, productLogo, activeLink }) {
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarProvider.SidebarProvider, { items, children: /* @__PURE__ */ jsxRuntime.jsx(SidebarContainer.SidebarContainer, { productLogo, activeLink }) });
|
|
36
9
|
}
|
|
37
10
|
|
|
38
11
|
exports.Sidebar = Sidebar;
|
|
@@ -2,11 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { NavBarItem } from '../nav-bar/NavBar';
|
|
3
3
|
interface SidebarProps {
|
|
4
4
|
collapsed?: boolean;
|
|
5
|
+
onCollapseChange?: (collapsed: boolean) => void;
|
|
5
6
|
items: NavBarItem[];
|
|
6
7
|
logo?: React.ReactNode;
|
|
7
8
|
productName?: string;
|
|
8
9
|
productLogo?: React.ReactNode;
|
|
9
10
|
activeLink?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare function Sidebar({
|
|
12
|
+
export declare function Sidebar({ items, productLogo, activeLink }: SidebarProps): JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import styles from './Sidebar.module.css';
|
|
3
|
-
import { Headline } from '../headline/Headline';
|
|
4
|
-
import SidenavFiltering from './components/sidenav-filteirng/SidenavFiltering';
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
2
|
import { SidebarProvider } from './providers/SidebarProvider';
|
|
6
|
-
import {
|
|
7
|
-
import { Logo } from '../../assets/logo';
|
|
3
|
+
import { SidebarContainer } from './components/sidebar-container/SidebarContainer';
|
|
8
4
|
|
|
9
|
-
function Sidebar({
|
|
10
|
-
|
|
11
|
-
items,
|
|
12
|
-
logo,
|
|
13
|
-
productName,
|
|
14
|
-
productLogo,
|
|
15
|
-
activeLink
|
|
16
|
-
}) {
|
|
17
|
-
return /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
|
|
18
|
-
/* @__PURE__ */ jsxs("div", { className: styles.header, children: [
|
|
19
|
-
/* @__PURE__ */ jsx("div", { className: styles.logo, children: logo != null ? logo : /* @__PURE__ */ jsx(Logo, {}) }),
|
|
20
|
-
productName && /* @__PURE__ */ jsx(Headline, { disableMargin: true, children: productName }),
|
|
21
|
-
productLogo && /* @__PURE__ */ jsx("div", { className: styles.productLogo, children: productLogo })
|
|
22
|
-
] }),
|
|
23
|
-
/* @__PURE__ */ jsx(SidebarProvider, { items, children: /* @__PURE__ */ jsxs("div", { className: styles.content, children: [
|
|
24
|
-
/* @__PURE__ */ jsx(SidenavFiltering, {}),
|
|
25
|
-
/* @__PURE__ */ jsx("div", { className: styles.links, children: /* @__PURE__ */ jsx(SidebarItems, { activeLink }) })
|
|
26
|
-
] }) }),
|
|
27
|
-
/* @__PURE__ */ jsx("div", { className: styles.footer })
|
|
28
|
-
] });
|
|
5
|
+
function Sidebar({ items, productLogo, activeLink }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(SidebarProvider, { items, children: /* @__PURE__ */ jsx(SidebarContainer, { productLogo, activeLink }) });
|
|
29
7
|
}
|
|
30
8
|
|
|
31
9
|
export { Sidebar };
|
|
@@ -9,7 +9,9 @@ function SidebarItem({
|
|
|
9
9
|
icon,
|
|
10
10
|
href
|
|
11
11
|
}) {
|
|
12
|
-
if (!Component)
|
|
12
|
+
if (!Component) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
13
15
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarItemContent.SidebarItemContent, { icon, label, href }) });
|
|
14
16
|
}
|
|
15
17
|
|