@dbcdk/react-components 0.0.1 → 0.0.3
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 +87 -0
- package/dist/assets/logo.d.ts +2 -0
- package/dist/assets/logo.js +85 -0
- package/dist/components/app-header/AppHeader.cjs +14 -0
- package/dist/components/app-header/AppHeader.d.ts +5 -0
- package/dist/components/app-header/AppHeader.js +8 -0
- package/dist/components/app-header/AppHeader.module.css +73 -0
- package/dist/components/avatar/Avatar.cjs +67 -0
- package/dist/components/avatar/Avatar.d.ts +15 -0
- package/dist/components/avatar/Avatar.js +42 -0
- package/dist/components/avatar/Avatar.module.css +43 -0
- package/dist/components/breadcrumbs/Breadcrumbs.cjs +23 -0
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +12 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js +16 -0
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +84 -0
- package/dist/components/button/Button.cjs +79 -0
- package/dist/components/button/Button.d.ts +13 -0
- package/dist/components/button/Button.js +54 -0
- package/dist/components/button/Button.module.css +156 -0
- package/dist/components/card/Card.cjs +29 -0
- package/dist/components/card/Card.d.ts +11 -0
- package/dist/components/card/Card.js +23 -0
- package/dist/components/card/Card.module.css +69 -0
- package/dist/components/card-container/CardContainer.cjs +23 -0
- package/dist/components/card-container/CardContainer.d.ts +8 -0
- package/dist/components/card-container/CardContainer.js +17 -0
- package/dist/components/card-container/CardContainer.module.css +18 -0
- package/dist/components/checkbox/Checkbox.cjs +43 -0
- package/dist/components/checkbox/Checkbox.d.ts +12 -0
- package/dist/components/checkbox/Checkbox.js +37 -0
- package/dist/components/checkbox/Checkbox.module.css +63 -0
- package/dist/components/chip/Chip.cjs +49 -0
- package/dist/components/chip/Chip.d.ts +13 -0
- package/dist/components/chip/Chip.js +43 -0
- package/dist/components/chip/Chip.module.css +97 -0
- package/dist/components/circle/Circle.cjs +18 -0
- package/dist/components/circle/Circle.d.ts +8 -0
- package/dist/components/circle/Circle.js +12 -0
- package/dist/components/circle/Circle.module.css +62 -0
- package/dist/components/clear-button/ClearButton.cjs +26 -0
- package/dist/components/clear-button/ClearButton.d.ts +6 -0
- package/dist/components/clear-button/ClearButton.js +20 -0
- package/dist/components/clear-button/ClearButton.module.css +16 -0
- package/dist/components/data-summary/DataSummary.cjs +49 -0
- package/dist/components/data-summary/DataSummary.d.ts +19 -0
- package/dist/components/data-summary/DataSummary.js +43 -0
- package/dist/components/data-summary/DataSummary.module.css +51 -0
- package/dist/components/filter-field/FilterField.cjs +174 -0
- package/dist/components/filter-field/FilterField.d.ts +28 -0
- package/dist/components/filter-field/FilterField.js +167 -0
- package/dist/components/filter-field/FilterField.module.css +109 -0
- package/dist/components/headline/Headline.cjs +47 -0
- package/dist/components/headline/Headline.d.ts +14 -0
- package/dist/components/headline/Headline.js +41 -0
- package/dist/components/headline/Headline.module.css +35 -0
- package/dist/components/icon/Icon.cjs +27 -0
- package/dist/components/icon/Icon.d.ts +9 -0
- package/dist/components/icon/Icon.js +20 -0
- package/dist/components/icon/Icon.module.css +34 -0
- package/dist/components/input/Input.cjs +48 -0
- package/dist/components/input/Input.d.ts +13 -0
- package/dist/components/input/Input.js +42 -0
- package/dist/components/input/Input.module.css +112 -0
- package/dist/components/menu/Menu.cjs +96 -0
- package/dist/components/menu/Menu.d.ts +12 -0
- package/dist/components/menu/Menu.js +71 -0
- package/dist/components/menu/Menu.module.css +95 -0
- package/dist/components/multi-select/MultiSelect.cjs +48 -0
- package/dist/components/multi-select/MultiSelect.d.ts +18 -0
- package/dist/components/multi-select/MultiSelect.js +46 -0
- package/dist/components/nav-bar/NavBar.cjs +55 -0
- package/dist/components/nav-bar/NavBar.d.ts +20 -0
- package/dist/components/nav-bar/NavBar.js +49 -0
- package/dist/components/nav-bar/NavBar.module.css +101 -0
- package/dist/components/page/Page.cjs +30 -0
- package/dist/components/page/Page.d.ts +13 -0
- package/dist/components/page/Page.js +24 -0
- package/dist/components/page/Page.module.css +26 -0
- package/dist/components/page-layout/PageLayout.cjs +101 -0
- package/dist/components/page-layout/PageLayout.d.ts +35 -0
- package/dist/components/page-layout/PageLayout.js +95 -0
- package/dist/components/page-layout/PageLayout.module.css +142 -0
- package/dist/components/pagination/Pagination.cjs +117 -0
- package/dist/components/pagination/Pagination.d.ts +17 -0
- package/dist/components/pagination/Pagination.js +111 -0
- package/dist/components/pagination/Pagination.module.css +17 -0
- package/dist/components/panel/Panel.cjs +18 -0
- package/dist/components/panel/Panel.d.ts +10 -0
- package/dist/components/panel/Panel.js +12 -0
- package/dist/components/panel/Panel.module.css +29 -0
- package/dist/components/popover/Popover.cjs +132 -0
- package/dist/components/popover/Popover.d.ts +15 -0
- package/dist/components/popover/Popover.js +126 -0
- package/dist/components/popover/Popover.module.css +25 -0
- package/dist/components/search-box/SearchBox.cjs +162 -0
- package/dist/components/search-box/SearchBox.d.ts +22 -0
- package/dist/components/search-box/SearchBox.js +156 -0
- package/dist/components/search-box/SearchBox.module.css +20 -0
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +97 -0
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +24 -0
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +91 -0
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +55 -0
- package/dist/components/select/Select.cjs +52 -0
- package/dist/components/select/Select.d.ts +11 -0
- package/dist/components/select/Select.js +50 -0
- package/dist/components/sidebar/Sidebar.cjs +38 -0
- package/dist/components/sidebar/Sidebar.d.ts +12 -0
- package/dist/components/sidebar/Sidebar.js +31 -0
- package/dist/components/sidebar/Sidebar.module.css +66 -0
- package/dist/components/sidebar/components/SidebarItem.cjs +16 -0
- package/dist/components/sidebar/components/SidebarItem.d.ts +9 -0
- package/dist/components/sidebar/components/SidebarItem.js +14 -0
- package/dist/components/sidebar/components/SidebarItem.module.css +0 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +74 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +9 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +68 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +61 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +27 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +8 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +21 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +62 -0
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +28 -0
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +4 -0
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +26 -0
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +25 -0
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.d.ts +3 -0
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +23 -0
- package/dist/components/sidebar/providers/SidebarProvider.cjs +81 -0
- package/dist/components/sidebar/providers/SidebarProvider.d.ts +24 -0
- package/dist/components/sidebar/providers/SidebarProvider.js +78 -0
- package/dist/components/skeleton-loader/SkeletonLoader.cjs +270 -0
- package/dist/components/skeleton-loader/SkeletonLoader.d.ts +9 -0
- package/dist/components/skeleton-loader/SkeletonLoader.js +268 -0
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +42 -0
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.d.ts +11 -0
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +36 -0
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +63 -0
- package/dist/components/split-button/SplitButton.cjs +37 -0
- package/dist/components/split-button/SplitButton.d.ts +14 -0
- package/dist/components/split-button/SplitButton.js +31 -0
- package/dist/components/split-button/SplitButton.module.css +32 -0
- package/dist/components/table/Table.cjs +181 -0
- package/dist/components/table/Table.d.ts +45 -0
- package/dist/components/table/Table.js +175 -0
- package/dist/components/table/Table.module.css +143 -0
- package/dist/components/table/components/column-resizer/ColumnResizer.cjs +22 -0
- package/dist/components/table/components/column-resizer/ColumnResizer.d.ts +7 -0
- package/dist/components/table/components/column-resizer/ColumnResizer.js +16 -0
- package/dist/components/table/components/column-resizer/ColumnResizer.module.css +13 -0
- package/dist/components/tabs/Tabs.cjs +74 -0
- package/dist/components/tabs/Tabs.d.ts +18 -0
- package/dist/components/tabs/Tabs.js +68 -0
- package/dist/components/tabs/Tabs.module.css +113 -0
- package/dist/components/text-area/Textarea.cjs +62 -0
- package/dist/components/text-area/Textarea.d.ts +14 -0
- package/dist/components/text-area/Textarea.js +56 -0
- package/dist/components/text-area/Textarea.module.css +3 -0
- package/dist/components/tooltip/Tooltip.cjs +78 -0
- package/dist/components/tooltip/Tooltip.d.ts +11 -0
- package/dist/components/tooltip/Tooltip.js +72 -0
- package/dist/components/tooltip/Tooltip.module.css +84 -0
- package/dist/components/user-display/UserDisplay.cjs +28 -0
- package/dist/components/user-display/UserDisplay.d.ts +9 -0
- package/dist/components/user-display/UserDisplay.js +22 -0
- package/dist/components/user-display/UserDisplay.module.css +25 -0
- package/dist/constants/severity.cjs +21 -0
- package/dist/constants/severity.d.ts +3 -0
- package/dist/constants/severity.js +18 -0
- package/dist/constants/severity.types.cjs +2 -0
- package/dist/constants/severity.types.d.ts +1 -0
- package/dist/constants/severity.types.js +1 -0
- package/dist/constants/sizes.cjs +10 -0
- package/dist/constants/sizes.d.ts +2 -0
- package/dist/constants/sizes.js +8 -0
- package/dist/hooks/useTheme.cjs +58 -0
- package/dist/hooks/useTheme.d.ts +9 -0
- package/dist/hooks/useTheme.js +55 -0
- package/dist/hooks/useViewportFill.cjs +52 -0
- package/dist/hooks/useViewportFill.d.ts +15 -0
- package/dist/hooks/useViewportFill.js +50 -0
- package/dist/index.cjs +264 -2
- package/dist/index.d.ts +37 -12
- package/dist/index.js +37 -2
- package/dist/src/styles/styles.css +124 -0
- package/dist/styles/css-helper-classes/spacing.css +291 -0
- package/dist/styles/fonts/Roboto/OFL.txt +93 -0
- package/dist/styles/fonts/Roboto/README.txt +118 -0
- package/dist/styles/fonts/Roboto/Roboto-Black.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Bold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ExtraBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ExtraBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ExtraLight.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ExtraLightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Italic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Light.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-SemiBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-SemiBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-Thin.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Black.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-BlackItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Bold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-BoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ExtraBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ExtraBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ExtraLight.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ExtraLightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Italic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Light.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-LightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Medium.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-MediumItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Regular.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-SemiBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-SemiBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-Thin.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_Condensed-ThinItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Black.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-BlackItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Bold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-BoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ExtraBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ExtraBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ExtraLight.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ExtraLightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Italic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Light.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-LightItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Medium.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-MediumItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Regular.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-SemiBold.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-SemiBoldItalic.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-Thin.ttf +0 -0
- package/dist/styles/fonts/Roboto/Roboto_SemiCondensed-ThinItalic.ttf +0 -0
- package/dist/styles/fonts/Tajawal/OFL.txt +93 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Black.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Bold.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-ExtraBold.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-ExtraLight.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Light.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Medium.ttf +0 -0
- package/dist/styles/fonts/Tajawal/Tajawal-Regular.ttf +0 -0
- package/dist/styles/styles.css +124 -0
- package/dist/styles/themes/dbc/dark.css +240 -0
- package/dist/styles/themes/dbc/light.css +245 -0
- package/dist/styles/themes/forfatterweb/light.css +104 -0
- package/dist/styles/themes/types.cjs +2 -0
- package/dist/styles/themes/types.d.ts +16 -0
- package/dist/styles/themes/types.js +1 -0
- package/dist/tanstack.cjs +231 -0
- package/dist/tanstack.d.ts +25 -0
- package/dist/tanstack.js +206 -0
- package/dist/types/a11y-props.types.cjs +2 -0
- package/dist/types/a11y-props.types.d.ts +8 -0
- package/dist/types/a11y-props.types.js +1 -0
- package/dist/types/assets.d.cjs +2 -0
- package/dist/types/assets.d.js +1 -0
- package/dist/types/css.d.cjs +2 -0
- package/dist/types/css.d.js +1 -0
- package/dist/types/sizes.types.cjs +2 -0
- package/dist/types/sizes.types.d.ts +2 -0
- package/dist/types/sizes.types.js +1 -0
- package/dist/utils/arrays/nested-filtering.cjs +40 -0
- package/dist/utils/arrays/nested-filtering.d.ts +9 -0
- package/dist/utils/arrays/nested-filtering.js +38 -0
- package/dist/utils/date/formatDate.cjs +19 -0
- package/dist/utils/date/formatDate.d.ts +12 -0
- package/dist/utils/date/formatDate.js +17 -0
- package/package.json +67 -20
- package/dist/index.cjs.map +0 -1
- package/dist/index.css +0 -2
- package/dist/index.css.map +0 -1
- package/dist/index.d.cts +0 -12
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { SeverityBgColor, SeverityTextColor } from '../../constants/severity';
|
|
3
|
+
import { Tooltip } from '../tooltip/Tooltip';
|
|
4
|
+
import styles from './SegmentedProgressBar.module.css';
|
|
5
|
+
|
|
6
|
+
const SegmentedProgressBar = ({
|
|
7
|
+
segments,
|
|
8
|
+
total,
|
|
9
|
+
showRemainder = true,
|
|
10
|
+
remainderSeverity = "neutral",
|
|
11
|
+
centerLabel,
|
|
12
|
+
height,
|
|
13
|
+
rounded = true,
|
|
14
|
+
trackColor = "var(--color-secondary)",
|
|
15
|
+
tooltipPlacement = "top",
|
|
16
|
+
className,
|
|
17
|
+
...aria
|
|
18
|
+
}) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const sum = segments.reduce((acc, s) => acc + (s.value || 0), 0);
|
|
21
|
+
const effectiveTotal = total != null ? total : sum;
|
|
22
|
+
const safeTotal = Math.max(effectiveTotal, 1e-4);
|
|
23
|
+
const remainder = Math.max(effectiveTotal - sum, 0);
|
|
24
|
+
const pctFilled = Math.min(100, Math.max(0, Math.min(sum, effectiveTotal) / safeTotal * 100));
|
|
25
|
+
const computedSegments = [
|
|
26
|
+
...segments,
|
|
27
|
+
...showRemainder && remainder > 0 ? [{ value: remainder, severity: remainderSeverity }] : []
|
|
28
|
+
];
|
|
29
|
+
const autoNumbers = (() => {
|
|
30
|
+
const base = segments.map((s) => s.value || 0);
|
|
31
|
+
if (showRemainder) base.push(remainder);
|
|
32
|
+
return base.join("/");
|
|
33
|
+
})();
|
|
34
|
+
const rootClass = [styles.container, className].filter(Boolean).join(" ");
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: rootClass,
|
|
39
|
+
role: "progressbar",
|
|
40
|
+
"aria-valuemin": 0,
|
|
41
|
+
"aria-valuemax": effectiveTotal,
|
|
42
|
+
"aria-valuenow": Math.min(sum, effectiveTotal),
|
|
43
|
+
...aria,
|
|
44
|
+
children: /* @__PURE__ */ jsxs(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: styles.progressBar,
|
|
48
|
+
style: {
|
|
49
|
+
height: height ? `${height}px` : `var(--component-size-xs)`,
|
|
50
|
+
borderRadius: rounded ? `var(--border-radius-rounded)` : `var(--border-radius-none)`,
|
|
51
|
+
background: trackColor
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: styles.segmentsContainer, children: (_a = computedSegments == null ? void 0 : computedSegments.filter((x) => x.value > 0)) == null ? void 0 : _a.map((seg, i) => {
|
|
55
|
+
var _a2, _b, _c, _d, _e;
|
|
56
|
+
const bg = (_b = seg.color) != null ? _b : SeverityBgColor[(_a2 = seg.severity) != null ? _a2 : "neutral"];
|
|
57
|
+
const fg = SeverityTextColor[(_c = seg.severity) != null ? _c : "neutral"];
|
|
58
|
+
const tooltipText = typeof seg.label !== "undefined" ? seg.label : String((_d = seg.value) != null ? _d : 0);
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
Tooltip,
|
|
61
|
+
{
|
|
62
|
+
content: tooltipText,
|
|
63
|
+
placement: tooltipPlacement,
|
|
64
|
+
className: styles.segmentWrapper,
|
|
65
|
+
style: {
|
|
66
|
+
flex: `${Math.max(seg.value || 0, 0)} 0 0`,
|
|
67
|
+
height: "100%",
|
|
68
|
+
minWidth: "2px"
|
|
69
|
+
},
|
|
70
|
+
children: /* @__PURE__ */ jsx(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
className: styles.progressSegment,
|
|
74
|
+
"data-index": i,
|
|
75
|
+
"data-severity": (_e = seg.severity) != null ? _e : "neutral",
|
|
76
|
+
style: { background: bg, color: fg }
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
},
|
|
80
|
+
`${i}`
|
|
81
|
+
);
|
|
82
|
+
}) }),
|
|
83
|
+
/* @__PURE__ */ jsx("div", { className: styles.progressCenter, children: centerLabel ? typeof centerLabel === "function" ? centerLabel(pctFilled) : centerLabel : autoNumbers })
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { SegmentedProgressBar };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.progressBar {
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 100%;
|
|
10
|
+
display: flex;
|
|
11
|
+
border-radius: var(--border-radius-default);
|
|
12
|
+
background: var(--opac-bg-default);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.progressSegment {
|
|
16
|
+
height: 100%;
|
|
17
|
+
flex: 1 1 auto;
|
|
18
|
+
min-width: 2px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.progressCenter {
|
|
22
|
+
position: absolute;
|
|
23
|
+
inset: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
color: var(--color-text-inverse);
|
|
28
|
+
font-size: inherit;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.segmentWrapper,
|
|
33
|
+
.segmentsContainer {
|
|
34
|
+
display: flex;
|
|
35
|
+
height: 100%;
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.segmentWrapper:first-of-type .progressSegment {
|
|
40
|
+
border-top-left-radius: var(--border-radius-rounded);
|
|
41
|
+
border-bottom-left-radius: var(--border-radius-rounded);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.segmentWrapper:last-of-type .progressSegment {
|
|
45
|
+
border-top-right-radius: var(--border-radius-rounded);
|
|
46
|
+
border-bottom-right-radius: var(--border-radius-rounded);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media (prefers-reduced-motion: reduce) {
|
|
50
|
+
.progressBar,
|
|
51
|
+
.progressSegment,
|
|
52
|
+
.progressCenter {
|
|
53
|
+
transition: none;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var lucideReact = require('lucide-react');
|
|
5
|
+
var Menu = require('../menu/Menu');
|
|
6
|
+
var Popover = require('../popover/Popover');
|
|
7
|
+
var Button = require('../button/Button');
|
|
8
|
+
var ClearButton = require('../clear-button/ClearButton');
|
|
9
|
+
var react = require('react');
|
|
10
|
+
|
|
11
|
+
function Select({
|
|
12
|
+
options,
|
|
13
|
+
selectedValue,
|
|
14
|
+
onChange,
|
|
15
|
+
placeholder = "V\xE6lg",
|
|
16
|
+
size,
|
|
17
|
+
variant = "outlined",
|
|
18
|
+
onClear
|
|
19
|
+
}) {
|
|
20
|
+
const ref = react.useRef(null);
|
|
21
|
+
const selected = options.find((o) => o.value === selectedValue);
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
23
|
+
Popover.Popover,
|
|
24
|
+
{
|
|
25
|
+
ref,
|
|
26
|
+
trigger: (onClick, icon) => /* @__PURE__ */ jsxRuntime.jsxs(Button.Button, { variant, onClick, size, children: [
|
|
27
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: selected ? selected.label : placeholder }),
|
|
28
|
+
onClear && selected && /* @__PURE__ */ jsxRuntime.jsx(ClearButton.ClearButton, { onClick: onClear }),
|
|
29
|
+
icon
|
|
30
|
+
] }),
|
|
31
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu, { children: options.map((opt) => {
|
|
32
|
+
const isActive = opt.value === selectedValue;
|
|
33
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Item, { active: isActive, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
34
|
+
"button",
|
|
35
|
+
{
|
|
36
|
+
onClick: () => {
|
|
37
|
+
var _a;
|
|
38
|
+
onChange(opt.value);
|
|
39
|
+
(_a = ref.current) == null ? void 0 : _a.close();
|
|
40
|
+
},
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { width: 16, display: "inline-flex", justifyContent: "center" }, children: isActive ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}) : null }),
|
|
43
|
+
opt.label
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
) }, opt.value);
|
|
47
|
+
}) })
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
exports.Select = Select;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ButtonVariant } from '../button/Button';
|
|
2
|
+
import { MultiselectOption } from '../filter-field/FilterField';
|
|
3
|
+
export declare function Select({ options, selectedValue, onChange, placeholder, size, variant, onClear, }: {
|
|
4
|
+
options: MultiselectOption[];
|
|
5
|
+
selectedValue: string | null;
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg';
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
onClear?: () => void;
|
|
11
|
+
}): React.ReactNode;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Check } from 'lucide-react';
|
|
3
|
+
import { Menu } from '../menu/Menu';
|
|
4
|
+
import { Popover } from '../popover/Popover';
|
|
5
|
+
import { Button } from '../button/Button';
|
|
6
|
+
import { ClearButton } from '../clear-button/ClearButton';
|
|
7
|
+
import { useRef } from 'react';
|
|
8
|
+
|
|
9
|
+
function Select({
|
|
10
|
+
options,
|
|
11
|
+
selectedValue,
|
|
12
|
+
onChange,
|
|
13
|
+
placeholder = "V\xE6lg",
|
|
14
|
+
size,
|
|
15
|
+
variant = "outlined",
|
|
16
|
+
onClear
|
|
17
|
+
}) {
|
|
18
|
+
const ref = useRef(null);
|
|
19
|
+
const selected = options.find((o) => o.value === selectedValue);
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
Popover,
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
trigger: (onClick, icon) => /* @__PURE__ */ jsxs(Button, { variant, onClick, size, children: [
|
|
25
|
+
/* @__PURE__ */ jsx("span", { children: selected ? selected.label : placeholder }),
|
|
26
|
+
onClear && selected && /* @__PURE__ */ jsx(ClearButton, { onClick: onClear }),
|
|
27
|
+
icon
|
|
28
|
+
] }),
|
|
29
|
+
children: /* @__PURE__ */ jsx(Menu, { children: options.map((opt) => {
|
|
30
|
+
const isActive = opt.value === selectedValue;
|
|
31
|
+
return /* @__PURE__ */ jsx(Menu.Item, { active: isActive, children: /* @__PURE__ */ jsxs(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
onClick: () => {
|
|
35
|
+
var _a;
|
|
36
|
+
onChange(opt.value);
|
|
37
|
+
(_a = ref.current) == null ? void 0 : _a.close();
|
|
38
|
+
},
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx("span", { style: { width: 16, display: "inline-flex", justifyContent: "center" }, children: isActive ? /* @__PURE__ */ jsx(Check, {}) : null }),
|
|
41
|
+
opt.label
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
) }, opt.value);
|
|
45
|
+
}) })
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { Select };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
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
|
+
var SidebarProvider = require('./providers/SidebarProvider');
|
|
8
|
+
var SidebarItems = require('./components/sidebar-items/SidebarItems');
|
|
9
|
+
var logo = require('../../assets/logo');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
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
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.Sidebar = Sidebar;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavBarItem } from '../nav-bar/NavBar';
|
|
3
|
+
interface SidebarProps {
|
|
4
|
+
collapsed?: boolean;
|
|
5
|
+
items: NavBarItem[];
|
|
6
|
+
logo?: React.ReactNode;
|
|
7
|
+
productName?: string;
|
|
8
|
+
productLogo?: React.ReactNode;
|
|
9
|
+
activeLink?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function Sidebar({ collapsed, items, logo, productName, productLogo, activeLink, }: SidebarProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import styles from './Sidebar.module.css';
|
|
3
|
+
import { Headline } from '../headline/Headline';
|
|
4
|
+
import SidenavFiltering from './components/sidenav-filteirng/SidenavFiltering';
|
|
5
|
+
import { SidebarProvider } from './providers/SidebarProvider';
|
|
6
|
+
import { SidebarItems } from './components/sidebar-items/SidebarItems';
|
|
7
|
+
import { Logo } from '../../assets/logo';
|
|
8
|
+
|
|
9
|
+
function Sidebar({
|
|
10
|
+
collapsed,
|
|
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
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Sidebar };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
flex-shrink: 1;
|
|
3
|
+
height: 100%;
|
|
4
|
+
overflow: auto;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: var(--spacing-lg);
|
|
8
|
+
width: 240px;
|
|
9
|
+
inline-size: 240px;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
|
|
12
|
+
border-inline-end: var(--border-width-thin) solid var(--color-border);
|
|
13
|
+
padding: var(--spacing-lg) var(--spacing-md);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.container a {
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
color: inherit;
|
|
19
|
+
}
|
|
20
|
+
.container button {
|
|
21
|
+
background: none;
|
|
22
|
+
border: 0;
|
|
23
|
+
font-size: inherit;
|
|
24
|
+
display: flex;
|
|
25
|
+
padding: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.container a:focus-visible,
|
|
29
|
+
.container button:focus-visible {
|
|
30
|
+
outline: none;
|
|
31
|
+
box-shadow: var(--focus-ring);
|
|
32
|
+
}
|
|
33
|
+
.links {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-grow: 1;
|
|
36
|
+
overflow: auto;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
font-size: var(--font-size-sm);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.header {
|
|
42
|
+
flex: 0 0 auto;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: var(--spacing-sm);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.logo img,
|
|
49
|
+
.logo svg {
|
|
50
|
+
max-inline-size: 50px;
|
|
51
|
+
block-size: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.content {
|
|
55
|
+
flex: 1 1 auto;
|
|
56
|
+
overflow-y: auto;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
position: relative;
|
|
60
|
+
width: 100%;
|
|
61
|
+
gap: var(--spacing-lg);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.footer {
|
|
65
|
+
flex: 0 0 auto;
|
|
66
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var SidebarItemContent = require('./sidebar-item-content/SidebarItemContent');
|
|
5
|
+
|
|
6
|
+
function SidebarItem({
|
|
7
|
+
component: Component,
|
|
8
|
+
label,
|
|
9
|
+
icon,
|
|
10
|
+
href
|
|
11
|
+
}) {
|
|
12
|
+
if (!Component) return null;
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarItemContent.SidebarItemContent, { icon, label, href }) });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.SidebarItem = SidebarItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SidebarItemProps {
|
|
3
|
+
component?: React.ElementType;
|
|
4
|
+
label: string;
|
|
5
|
+
icon: React.ReactNode;
|
|
6
|
+
href?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function SidebarItem({ component: Component, label, icon, href, }: SidebarItemProps): React.ReactNode;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SidebarItemContent } from './sidebar-item-content/SidebarItemContent';
|
|
3
|
+
|
|
4
|
+
function SidebarItem({
|
|
5
|
+
component: Component,
|
|
6
|
+
label,
|
|
7
|
+
icon,
|
|
8
|
+
href
|
|
9
|
+
}) {
|
|
10
|
+
if (!Component) return null;
|
|
11
|
+
return /* @__PURE__ */ jsx(Component, { children: /* @__PURE__ */ jsx(SidebarItemContent, { icon, label, href }) });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { SidebarItem };
|
|
File without changes
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var SidebarItemContent = require('../sidebar-item-content/SidebarItemContent');
|
|
6
|
+
var lucideReact = require('lucide-react');
|
|
7
|
+
var styles = require('./ExpandableSidebarItem.module.css');
|
|
8
|
+
var SidebarProvider = require('../../providers/SidebarProvider');
|
|
9
|
+
var SidebarItem = require('../SidebarItem');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
14
|
+
|
|
15
|
+
function ExpandableSidebarItem({
|
|
16
|
+
items,
|
|
17
|
+
label,
|
|
18
|
+
icon,
|
|
19
|
+
href
|
|
20
|
+
}) {
|
|
21
|
+
const { defaultExpanded, resetExpandAll, activeLink } = SidebarProvider.useSidebar();
|
|
22
|
+
const [expanded, setExpanded] = react.useState(false);
|
|
23
|
+
const [closing, setClosing] = react.useState(false);
|
|
24
|
+
const [ready, setReady] = react.useState(false);
|
|
25
|
+
react.useEffect(() => {
|
|
26
|
+
setReady(true);
|
|
27
|
+
}, []);
|
|
28
|
+
react.useEffect(() => {
|
|
29
|
+
if (defaultExpanded === null) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setExpanded(defaultExpanded);
|
|
33
|
+
}, [defaultExpanded]);
|
|
34
|
+
const handleAnimationEnd = react.useCallback(() => {
|
|
35
|
+
if (ready) {
|
|
36
|
+
setExpanded(!closing);
|
|
37
|
+
setClosing(false);
|
|
38
|
+
}
|
|
39
|
+
}, [closing, ready]);
|
|
40
|
+
const toggleAccordion = react.useCallback(() => {
|
|
41
|
+
resetExpandAll();
|
|
42
|
+
if (!expanded) {
|
|
43
|
+
setExpanded(true);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
setClosing(true);
|
|
47
|
+
}, [expanded]);
|
|
48
|
+
if (!items) return null;
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default.container} ${expanded ? styles__default.default.expanded : ""}`, children: [
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: toggleAccordion, className: styles__default.default.button, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
51
|
+
SidebarItemContent.SidebarItemContent,
|
|
52
|
+
{
|
|
53
|
+
icon,
|
|
54
|
+
label,
|
|
55
|
+
suffixIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
lucideReact.ChevronDown,
|
|
57
|
+
{
|
|
58
|
+
className: `${styles__default.default.chevron} ${expanded ? styles__default.default.chevronExpanded : ""}`
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
) }),
|
|
63
|
+
expanded && /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
onAnimationEnd: handleAnimationEnd,
|
|
67
|
+
className: `${styles__default.default.childrenContainer} ${closing ? "animate--collapse" : ""} ${expanded ? "animate--expand" : "visually-hidden"}`,
|
|
68
|
+
children: items.map(({ component: Component, label: label2, icon: icon2, href: href2 }, id) => /* @__PURE__ */ jsxRuntime.jsx(SidebarItem.SidebarItem, { component: Component, label: label2, icon: icon2, href: href2 }, id))
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.ExpandableSidebarItem = ExpandableSidebarItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NavBarItem } from '@/components/nav-bar/NavBar';
|
|
2
|
+
interface ExpandableSidebarItemProps {
|
|
3
|
+
items: NavBarItem[];
|
|
4
|
+
label: string;
|
|
5
|
+
icon: React.ReactNode;
|
|
6
|
+
href?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function ExpandableSidebarItem({ items, label, icon, href, }: ExpandableSidebarItemProps): React.ReactNode;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import { SidebarItemContent } from '../sidebar-item-content/SidebarItemContent';
|
|
4
|
+
import { ChevronDown } from 'lucide-react';
|
|
5
|
+
import styles from './ExpandableSidebarItem.module.css';
|
|
6
|
+
import { useSidebar } from '../../providers/SidebarProvider';
|
|
7
|
+
import { SidebarItem } from '../SidebarItem';
|
|
8
|
+
|
|
9
|
+
function ExpandableSidebarItem({
|
|
10
|
+
items,
|
|
11
|
+
label,
|
|
12
|
+
icon,
|
|
13
|
+
href
|
|
14
|
+
}) {
|
|
15
|
+
const { defaultExpanded, resetExpandAll, activeLink } = useSidebar();
|
|
16
|
+
const [expanded, setExpanded] = useState(false);
|
|
17
|
+
const [closing, setClosing] = useState(false);
|
|
18
|
+
const [ready, setReady] = useState(false);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setReady(true);
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (defaultExpanded === null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setExpanded(defaultExpanded);
|
|
27
|
+
}, [defaultExpanded]);
|
|
28
|
+
const handleAnimationEnd = useCallback(() => {
|
|
29
|
+
if (ready) {
|
|
30
|
+
setExpanded(!closing);
|
|
31
|
+
setClosing(false);
|
|
32
|
+
}
|
|
33
|
+
}, [closing, ready]);
|
|
34
|
+
const toggleAccordion = useCallback(() => {
|
|
35
|
+
resetExpandAll();
|
|
36
|
+
if (!expanded) {
|
|
37
|
+
setExpanded(true);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
setClosing(true);
|
|
41
|
+
}, [expanded]);
|
|
42
|
+
if (!items) return null;
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", { className: `${styles.container} ${expanded ? styles.expanded : ""}`, children: [
|
|
44
|
+
/* @__PURE__ */ jsx("button", { onClick: toggleAccordion, className: styles.button, children: /* @__PURE__ */ jsx(
|
|
45
|
+
SidebarItemContent,
|
|
46
|
+
{
|
|
47
|
+
icon,
|
|
48
|
+
label,
|
|
49
|
+
suffixIcon: /* @__PURE__ */ jsx(
|
|
50
|
+
ChevronDown,
|
|
51
|
+
{
|
|
52
|
+
className: `${styles.chevron} ${expanded ? styles.chevronExpanded : ""}`
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
) }),
|
|
57
|
+
expanded && /* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
onAnimationEnd: handleAnimationEnd,
|
|
61
|
+
className: `${styles.childrenContainer} ${closing ? "animate--collapse" : ""} ${expanded ? "animate--expand" : "visually-hidden"}`,
|
|
62
|
+
children: items.map(({ component: Component, label: label2, icon: icon2, href: href2 }, id) => /* @__PURE__ */ jsx(SidebarItem, { component: Component, label: label2, icon: icon2, href: href2 }, id))
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { ExpandableSidebarItem };
|
package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
color: var(--color-text);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
position: relative;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
border-radius: var(--border-radius-default);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.container.expanded {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.childrenContainer {
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
|
|
18
|
+
/* --width: 2px;
|
|
19
|
+
--color: var(--opac-bg-default); */
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* .childrenContainer::after {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.childrenContainer > * {
|
|
26
|
+
position: relative;
|
|
27
|
+
&::before {
|
|
28
|
+
content: '';
|
|
29
|
+
position: absolute;
|
|
30
|
+
bottom: top;
|
|
31
|
+
background-color: var(--color);
|
|
32
|
+
left: 0;
|
|
33
|
+
height: 100%;
|
|
34
|
+
width: var(--width);
|
|
35
|
+
left: var(--icon-size);
|
|
36
|
+
transform: translateX(-50%);
|
|
37
|
+
}
|
|
38
|
+
&:last-of-type {
|
|
39
|
+
&::before {
|
|
40
|
+
height: calc(50% + var(--width));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
&::after {
|
|
44
|
+
content: '';
|
|
45
|
+
position: absolute;
|
|
46
|
+
bottom: 50%;
|
|
47
|
+
background-color: var(--color);
|
|
48
|
+
height: var(--width);
|
|
49
|
+
width: calc(var(--icon-size) / 2 + 5px);
|
|
50
|
+
left: calc(var(--icon-size) + var(--width) / 2);
|
|
51
|
+
transform: translateY(100%);
|
|
52
|
+
}
|
|
53
|
+
} */
|
|
54
|
+
|
|
55
|
+
.chevron {
|
|
56
|
+
transition: transform 0.3s ease;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.chevronExpanded {
|
|
60
|
+
transform: rotate(180deg);
|
|
61
|
+
}
|