@dbcdk/react-components 0.0.96 → 0.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.types.d.ts +3 -0
- package/dist/components/table/components/TableHeader.d.ts +2 -1
- package/dist/index.cjs +12750 -0
- package/dist/index.css +7149 -0
- package/dist/index.js +12641 -79
- package/dist/tanstack.cjs +2674 -0
- package/dist/tanstack.css +1267 -0
- package/dist/tanstack.js +2650 -3
- package/dist/themes/dbc.css +3 -0
- package/dist/themes/forfatterweb.css +2 -0
- package/package.json +11 -10
- package/dist/assets/logo.js +0 -2
- package/dist/components/__stories__/_data/table.d.ts +0 -15
- package/dist/components/__stories__/_data/table.js +0 -55
- package/dist/components/__stories__/_data/tabs.d.ts +0 -9
- package/dist/components/__stories__/_data/tabs.js +0 -31
- package/dist/components/__stories__/story-components/Colors.d.ts +0 -11
- package/dist/components/__stories__/story-components/Colors.js +0 -96
- package/dist/components/__stories__/story-components/Colors.module.css +0 -27
- package/dist/components/__stories__/story-components/ComponentSizes.d.ts +0 -2
- package/dist/components/__stories__/story-components/ComponentSizes.js +0 -26
- package/dist/components/__stories__/story-components/Elevation.d.ts +0 -2
- package/dist/components/__stories__/story-components/Elevation.js +0 -49
- package/dist/components/__stories__/story-components/Flex.d.ts +0 -2
- package/dist/components/__stories__/story-components/Flex.js +0 -177
- package/dist/components/__stories__/story-components/Flex.module.css +0 -317
- package/dist/components/__stories__/story-components/Spacing.d.ts +0 -6
- package/dist/components/__stories__/story-components/Spacing.js +0 -76
- package/dist/components/__stories__/story-components/Spacing.module.css +0 -154
- package/dist/components/accordion/Accordion.js +0 -70
- package/dist/components/accordion/Accordion.module.css +0 -28
- package/dist/components/accordion/components/AccordionRow.js +0 -53
- package/dist/components/accordion/components/AccordionRow.module.css +0 -90
- package/dist/components/alert/Alert.js +0 -17
- package/dist/components/alert/Alert.module.css +0 -98
- package/dist/components/app-header/AppHeader.js +0 -5
- package/dist/components/app-header/AppHeader.module.css +0 -74
- package/dist/components/attribute-chip/AttributeChip.js +0 -5
- package/dist/components/attribute-chip/AttributeChip.module.css +0 -65
- package/dist/components/avatar/Avatar.js +0 -48
- package/dist/components/avatar/Avatar.module.css +0 -91
- package/dist/components/breadcrumbs/Breadcrumbs.js +0 -6
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +0 -80
- package/dist/components/button/Button.js +0 -81
- package/dist/components/button/Button.module.css +0 -249
- package/dist/components/button-select/ButtonSelect.js +0 -7
- package/dist/components/button-select/ButtonSelect.module.css +0 -40
- package/dist/components/card/Card.js +0 -71
- package/dist/components/card/Card.module.css +0 -160
- package/dist/components/card/components/CardMeta.js +0 -26
- package/dist/components/card/components/CardMeta.module.css +0 -55
- package/dist/components/card-container/CardContainer.js +0 -6
- package/dist/components/card-container/CardContainer.module.css +0 -61
- package/dist/components/chip/Chip.js +0 -31
- package/dist/components/chip/Chip.module.css +0 -236
- package/dist/components/circle/Circle.js +0 -5
- package/dist/components/circle/Circle.module.css +0 -128
- package/dist/components/clear-button/ClearButton.js +0 -13
- package/dist/components/clear-button/ClearButton.module.css +0 -26
- package/dist/components/code-block/CodeBlock.js +0 -58
- package/dist/components/code-block/CodeBlock.module.css +0 -124
- package/dist/components/copy-button/CopyButton.js +0 -78
- package/dist/components/copy-button/CopyButton.module.css +0 -22
- package/dist/components/datetime-picker/DateTimePicker.js +0 -403
- package/dist/components/datetime-picker/DateTimePicker.module.css +0 -155
- package/dist/components/datetime-picker/dateTimeHelpers.js +0 -248
- package/dist/components/divider/Divider.js +0 -12
- package/dist/components/filter-field/FilterField.js +0 -191
- package/dist/components/filter-field/FilterField.module.css +0 -379
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +0 -52
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +0 -59
- package/dist/components/forms/checkbox/Checkbox.js +0 -28
- package/dist/components/forms/checkbox/Checkbox.module.css +0 -103
- package/dist/components/forms/checkbox-group/CheckboxGroup.js +0 -75
- package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +0 -115
- package/dist/components/forms/form-select/FormSelect.js +0 -86
- package/dist/components/forms/form-select/FormSelect.module.css +0 -236
- package/dist/components/forms/input/Input.js +0 -77
- package/dist/components/forms/input/Input.module.css +0 -468
- package/dist/components/forms/input-container/InputContainer.js +0 -15
- package/dist/components/forms/input-container/InputContainer.module.css +0 -60
- package/dist/components/forms/multi-select/MultiSelect.js +0 -122
- package/dist/components/forms/radio-buttons/RadioButton.js +0 -26
- package/dist/components/forms/radio-buttons/RadioButtonGroup.js +0 -19
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +0 -118
- package/dist/components/forms/select/Select.js +0 -185
- package/dist/components/forms/select/Select.module.css +0 -32
- package/dist/components/forms/text-area/Textarea.js +0 -47
- package/dist/components/forms/text-area/Textarea.module.css +0 -70
- package/dist/components/forms/typeahead/Typeahead.js +0 -668
- package/dist/components/forms/typeahead/Typeahead.module.css +0 -38
- package/dist/components/grid/Grid.js +0 -23
- package/dist/components/grid/Grid.module.css +0 -35
- package/dist/components/headline/CollapsibleHeadline.js +0 -29
- package/dist/components/headline/Headline.js +0 -26
- package/dist/components/headline/Headline.module.css +0 -185
- package/dist/components/hyperlink/Hyperlink.js +0 -40
- package/dist/components/hyperlink/Hyperlink.module.css +0 -107
- package/dist/components/icon/Icon.js +0 -14
- package/dist/components/icon/Icon.module.css +0 -36
- package/dist/components/interval-select/IntervalSelect.js +0 -99
- package/dist/components/json-viewer/HighlightedText.js +0 -6
- package/dist/components/json-viewer/JsonNode.js +0 -30
- package/dist/components/json-viewer/JsonViewer.js +0 -68
- package/dist/components/json-viewer/JsonViewer.module.css +0 -346
- package/dist/components/json-viewer/types.js +0 -1
- package/dist/components/json-viewer/useClipboardStatus.js +0 -11
- package/dist/components/json-viewer/utils.js +0 -125
- package/dist/components/menu/Menu.js +0 -165
- package/dist/components/menu/Menu.module.css +0 -220
- package/dist/components/meta-bar/MetaBar.js +0 -9
- package/dist/components/meta-bar/MetaBar.module.css +0 -27
- package/dist/components/nav-bar/NavBar.js +0 -29
- package/dist/components/nav-bar/NavBar.module.css +0 -221
- package/dist/components/overlay/fade-overlay/FadeOverlay.js +0 -8
- package/dist/components/overlay/fade-overlay/FadeOverlay.module.css +0 -54
- package/dist/components/overlay/modal/Modal.js +0 -115
- package/dist/components/overlay/modal/Modal.module.css +0 -109
- package/dist/components/overlay/modal/provider/ModalProvider.js +0 -73
- package/dist/components/overlay/side-panel/SidePanel.js +0 -83
- package/dist/components/overlay/side-panel/SidePanel.module.css +0 -177
- package/dist/components/overlay/side-panel/useSidePanel.js +0 -11
- package/dist/components/overlay/tooltip/Tooltip.js +0 -17
- package/dist/components/overlay/tooltip/Tooltip.module.css +0 -104
- package/dist/components/overlay/tooltip/TooltipProvider.js +0 -255
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +0 -118
- package/dist/components/page/Page.js +0 -11
- package/dist/components/page/Page.module.css +0 -89
- package/dist/components/page-layout/PageLayout.js +0 -76
- package/dist/components/page-layout/PageLayout.module.css +0 -236
- package/dist/components/page-layout/components/layout-footer/LayoutFooter.js +0 -27
- package/dist/components/page-layout/components/layout-footer/LayoutFooter.module.css +0 -89
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +0 -14
- package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +0 -84
- package/dist/components/pagination/Pagination.js +0 -56
- package/dist/components/pagination/Pagination.module.css +0 -25
- package/dist/components/panel/Panel.js +0 -7
- package/dist/components/panel/Panel.module.css +0 -29
- package/dist/components/popover/Popover.js +0 -257
- package/dist/components/popover/Popover.module.css +0 -54
- package/dist/components/search-box/SearchBox.js +0 -170
- package/dist/components/search-box/SearchBox.module.css +0 -21
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +0 -48
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +0 -167
- package/dist/components/sidebar/Sidebar.js +0 -6
- package/dist/components/sidebar/components/SidebarItem.js +0 -8
- package/dist/components/sidebar/components/SidebarItem.module.css +0 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +0 -63
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +0 -29
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +0 -153
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +0 -260
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +0 -18
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +0 -106
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +0 -26
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.module.css +0 -20
- package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +0 -30
- package/dist/components/sidebar/providers/SidebarProvider.js +0 -229
- package/dist/components/skeleton-loader/SkeletonLoader.js +0 -73
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +0 -13
- package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -51
- package/dist/components/split-button/SplitButton.js +0 -10
- package/dist/components/split-button/SplitButton.module.css +0 -32
- package/dist/components/split-pane/SplitPane.js +0 -107
- package/dist/components/split-pane/SplitPane.module.css +0 -111
- package/dist/components/split-pane/provider/SplitPaneContext.js +0 -124
- package/dist/components/stack/Stack.js +0 -33
- package/dist/components/stack/Stack.module.css +0 -61
- package/dist/components/state-page/StatePage.js +0 -20
- package/dist/components/state-page/StatePage.module.css +0 -9
- package/dist/components/state-page/empty.js +0 -2
- package/dist/components/state-page/error.js +0 -2
- package/dist/components/state-page/notFound.js +0 -2
- package/dist/components/sticky-footer-layout/StickyFooterLayout.js +0 -64
- package/dist/components/table/Table.js +0 -50
- package/dist/components/table/Table.module.css +0 -536
- package/dist/components/table/Table.types.js +0 -1
- package/dist/components/table/TanstackTable.js +0 -111
- package/dist/components/table/components/TableBody.js +0 -10
- package/dist/components/table/components/TableHeader.js +0 -7
- package/dist/components/table/components/TableHeaderCell.js +0 -24
- package/dist/components/table/components/TableLoadingBody.js +0 -26
- package/dist/components/table/components/TablePagination.js +0 -1
- package/dist/components/table/components/TableRow.js +0 -54
- package/dist/components/table/components/TableSelectionCell.js +0 -16
- package/dist/components/table/components/column-resizer/ColumnResizer.js +0 -5
- package/dist/components/table/components/column-resizer/ColumnResizer.module.css +0 -22
- package/dist/components/table/components/empty-state/EmptyState.js +0 -23
- package/dist/components/table/components/empty-state/EmptyState.module.css +0 -4
- package/dist/components/table/components/table-settings/TableSettings.js +0 -63
- package/dist/components/table/hooks/useTableRowInteractions.js +0 -30
- package/dist/components/table/table.classes.js +0 -23
- package/dist/components/table/table.utils.js +0 -47
- package/dist/components/table/tanstackTable.utils.js +0 -175
- package/dist/components/tabs/Tabs.js +0 -125
- package/dist/components/tabs/Tabs.module.css +0 -233
- package/dist/components/theme-button/ThemeButton.js +0 -23
- package/dist/components/toast/Toast.js +0 -20
- package/dist/components/toast/Toast.module.css +0 -161
- package/dist/components/toast/provider/ToastProvider.js +0 -70
- package/dist/components/user-display/UserDisplay.js +0 -6
- package/dist/components/user-display/UserDisplay.module.css +0 -25
- package/dist/constants/severity.js +0 -24
- package/dist/constants/severity.types.js +0 -1
- package/dist/constants/sizes.js +0 -7
- package/dist/hooks/useDeviceSize.js +0 -32
- package/dist/hooks/useListNavigation.js +0 -234
- package/dist/hooks/usePagination.js +0 -140
- package/dist/hooks/useSorting.js +0 -118
- package/dist/hooks/useTableData.js +0 -45
- package/dist/hooks/useTableSelection.js +0 -164
- package/dist/hooks/useTableSettings.js +0 -71
- package/dist/hooks/useTheme.js +0 -66
- package/dist/hooks/useTimeDuration.js +0 -68
- package/dist/hooks/useViewportFill.js +0 -77
- package/dist/styles/animation.js +0 -5
- package/dist/styles/themes/types.js +0 -1
- package/dist/types/a11y-props.types.js +0 -1
- package/dist/types/sizes.types.js +0 -1
- package/dist/utils/arrays/nested-filtering.js +0 -48
- package/dist/utils/date/formatDate.js +0 -51
- package/dist/utils/localStorage.utils.js +0 -78
- package/dist/utils/text/get-highlighted-segments.js +0 -46
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
.countAdornment {
|
|
2
|
-
white-space: nowrap;
|
|
3
|
-
flex-shrink: 0;
|
|
4
|
-
margin-right: var(--spacing-xxs);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.chipRow {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
gap: 4px;
|
|
11
|
-
flex-wrap: nowrap;
|
|
12
|
-
overflow: hidden;
|
|
13
|
-
min-width: 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.chevronButton {
|
|
17
|
-
display: inline-flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
justify-content: center;
|
|
20
|
-
height: 100%;
|
|
21
|
-
flex-shrink: 0;
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.selectedValues {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-wrap: wrap;
|
|
28
|
-
gap: 8px;
|
|
29
|
-
align-items: flex-start;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.inputWithoutStartPadding {
|
|
33
|
-
padding-inline-start: 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.typeaheadInput {
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import styles from './Grid.module.css';
|
|
3
|
-
const GAP_TOKEN = {
|
|
4
|
-
none: '0',
|
|
5
|
-
xs: 'var(--spacing-xs)',
|
|
6
|
-
sm: 'var(--spacing-sm)',
|
|
7
|
-
md: 'var(--spacing-md)',
|
|
8
|
-
lg: 'var(--spacing-lg)',
|
|
9
|
-
xl: 'var(--spacing-xl)',
|
|
10
|
-
};
|
|
11
|
-
export function Grid({ children, gap = 'md', equalHeight = false, className, style }) {
|
|
12
|
-
return (_jsx("div", { className: [styles.grid, equalHeight && styles.equalHeight, className]
|
|
13
|
-
.filter(Boolean)
|
|
14
|
-
.join(' '), style: { gap: GAP_TOKEN[gap], ...style }, children: children }));
|
|
15
|
-
}
|
|
16
|
-
export function GridItem({ children, base = 12, md, lg, className, style }) {
|
|
17
|
-
return (_jsx("div", { className: [styles.item, className].filter(Boolean).join(' '), style: {
|
|
18
|
-
'--span-base': base,
|
|
19
|
-
...(md != null ? { '--span-md': md } : {}),
|
|
20
|
-
...(lg != null ? { '--span-lg': lg } : {}),
|
|
21
|
-
...style,
|
|
22
|
-
}, children: children }));
|
|
23
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
.grid {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: repeat(12, minmax(0, 1fr));
|
|
4
|
-
align-items: start;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.equalHeight {
|
|
8
|
-
align-items: stretch;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.item {
|
|
12
|
-
grid-column: span var(--span-base, 12);
|
|
13
|
-
min-inline-size: 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.equalHeight .item {
|
|
17
|
-
display: flex;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.equalHeight .item > * {
|
|
21
|
-
flex: 1;
|
|
22
|
-
min-inline-size: 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@media (min-width: 768px) {
|
|
26
|
-
.item {
|
|
27
|
-
grid-column: span var(--span-md, var(--span-base, 12));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@media (min-width: 1200px) {
|
|
32
|
-
.item {
|
|
33
|
-
grid-column: span var(--span-lg, var(--span-md, var(--span-base, 12)));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronDown } from 'lucide-react';
|
|
4
|
-
import { useId, useState } from 'react';
|
|
5
|
-
import { Headline } from './Headline';
|
|
6
|
-
import styles from './Headline.module.css';
|
|
7
|
-
import { Button } from '../button/Button';
|
|
8
|
-
export function CollapsibleHeadline({ header, expanded, onToggle, controls, addition, storageKey, children, size = 2, variant = 'muted', weight = 400, ...headlineProps }) {
|
|
9
|
-
const generatedId = useId();
|
|
10
|
-
const panelId = controls !== null && controls !== void 0 ? controls : generatedId;
|
|
11
|
-
const [internalExpanded, setInternalExpanded] = useState(() => {
|
|
12
|
-
if (!storageKey || typeof window === 'undefined')
|
|
13
|
-
return expanded !== null && expanded !== void 0 ? expanded : true;
|
|
14
|
-
const stored = localStorage.getItem(storageKey);
|
|
15
|
-
return stored !== null ? stored === 'true' : (expanded !== null && expanded !== void 0 ? expanded : true);
|
|
16
|
-
});
|
|
17
|
-
const isExpanded = storageKey ? internalExpanded : (expanded !== null && expanded !== void 0 ? expanded : false);
|
|
18
|
-
const handleToggle = () => {
|
|
19
|
-
if (storageKey) {
|
|
20
|
-
const next = !internalExpanded;
|
|
21
|
-
setInternalExpanded(next);
|
|
22
|
-
localStorage.setItem(storageKey, String(next));
|
|
23
|
-
}
|
|
24
|
-
onToggle === null || onToggle === void 0 ? void 0 : onToggle();
|
|
25
|
-
};
|
|
26
|
-
return (_jsxs("div", { className: styles.collapsibleRoot, children: [_jsxs(Headline, { ...headlineProps, variant: variant, weight: weight, size: size, addition: addition, children: [header, _jsx(Button, { shape: "round", type: "button", variant: "inline", "aria-expanded": isExpanded, "aria-controls": panelId, onClick: handleToggle, children: _jsx(ChevronDown, { "aria-hidden": true, className: [styles.toggleChevron, isExpanded ? styles.toggleChevronExpanded : '']
|
|
27
|
-
.filter(Boolean)
|
|
28
|
-
.join(' ') }) })] }), isExpanded && (_jsx("div", { id: panelId, className: styles.collapsiblePanel, children: children }))] }));
|
|
29
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import styles from './Headline.module.css';
|
|
4
|
-
import { SeverityBgColor } from '../../constants/severity';
|
|
5
|
-
import { Icon } from '../icon/Icon';
|
|
6
|
-
export function Headline({ size = 2, marker, disableMargin, children, severity, weight = 600, subheader, addition, icon, tone, variant, allowWrap = true, }) {
|
|
7
|
-
const Tag = `h${size}`;
|
|
8
|
-
const containerClassName = [styles.headlineContainer, tone ? styles[`tone-${tone}`] : '']
|
|
9
|
-
.filter(Boolean)
|
|
10
|
-
.join(' ');
|
|
11
|
-
const headlineClassName = [
|
|
12
|
-
styles.headline,
|
|
13
|
-
disableMargin ? styles.noMargin : '',
|
|
14
|
-
marker ? styles.marker : '',
|
|
15
|
-
variant === 'muted' ? styles['variant-muted'] : '',
|
|
16
|
-
]
|
|
17
|
-
.filter(Boolean)
|
|
18
|
-
.join(' ');
|
|
19
|
-
const textClassName = [styles.text, allowWrap ? styles.wrap : styles.truncate]
|
|
20
|
-
.filter(Boolean)
|
|
21
|
-
.join(' ');
|
|
22
|
-
return (_jsx("div", { className: containerClassName, children: _jsxs("div", { className: styles.headlineBlock, children: [_jsxs("div", { className: styles.headlineRow, children: [_jsxs(Tag, { style: {
|
|
23
|
-
'--font-weight': weight,
|
|
24
|
-
'--marker-color': severity ? SeverityBgColor[severity] : undefined,
|
|
25
|
-
}, className: headlineClassName, children: [icon || (severity && !marker) ? (_jsx("span", { className: styles.icon, children: _jsx(Icon, { customIcon: icon, severity: severity }) })) : null, _jsx("span", { className: textClassName, children: children })] }), addition ? _jsx("div", { className: styles.addition, children: addition }) : null] }), subheader ? _jsx("div", { className: styles.subheader, children: subheader }) : null] }) }));
|
|
26
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
.headlineContainer {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: flex-start;
|
|
4
|
-
gap: var(--spacing-lg);
|
|
5
|
-
max-width: 100%;
|
|
6
|
-
min-width: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.headlineBlock {
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
flex: 1 1 auto;
|
|
13
|
-
min-width: 0;
|
|
14
|
-
gap: var(--spacing-xxs);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.headlineRow {
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
gap: var(--spacing-lg);
|
|
21
|
-
min-width: 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/* Base headline */
|
|
25
|
-
.headline {
|
|
26
|
-
position: relative;
|
|
27
|
-
display: inline-flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
gap: var(--spacing-xs);
|
|
30
|
-
margin-block: var(--spacing-xs);
|
|
31
|
-
|
|
32
|
-
/* Typography */
|
|
33
|
-
font-weight: var(--font-weight, 600);
|
|
34
|
-
letter-spacing: var(--letter-spacing-tight);
|
|
35
|
-
line-height: var(--line-height-tight);
|
|
36
|
-
color: inherit;
|
|
37
|
-
|
|
38
|
-
/* Behaviour */
|
|
39
|
-
transition: color var(--transition-fast) var(--ease-standard);
|
|
40
|
-
min-width: 0; /* required for truncation inside flex */
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* CollapsibleHeadline wrapper */
|
|
44
|
-
.collapsibleRoot {
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.collapsiblePanel {
|
|
50
|
-
display: contents;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* CollapsibleHeadline toggle button */
|
|
54
|
-
.toggleButton {
|
|
55
|
-
all: unset;
|
|
56
|
-
box-sizing: border-box;
|
|
57
|
-
display: inline-flex;
|
|
58
|
-
align-items: center;
|
|
59
|
-
justify-content: center;
|
|
60
|
-
flex: 0 0 auto;
|
|
61
|
-
padding: var(--spacing-2xs);
|
|
62
|
-
border-radius: var(--border-radius-sm);
|
|
63
|
-
cursor: pointer;
|
|
64
|
-
color: var(--color-fg-subtle);
|
|
65
|
-
transition: color var(--transition-fast) var(--ease-standard);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.toggleButton:hover {
|
|
69
|
-
color: var(--color-fg-default);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.toggleButton:focus-visible {
|
|
73
|
-
outline: none;
|
|
74
|
-
box-shadow: var(--focus-ring);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.toggleChevron {
|
|
78
|
-
display: block;
|
|
79
|
-
width: var(--icon-size-md);
|
|
80
|
-
height: var(--icon-size-md);
|
|
81
|
-
transition: transform var(--transition-normal) var(--ease-standard);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.toggleChevronExpanded {
|
|
85
|
-
transform: rotate(180deg);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/* Variant overrides */
|
|
89
|
-
.variant-muted {
|
|
90
|
-
color: var(--color-fg-subtle);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/* Tone overrides */
|
|
94
|
-
.tone-dark .headline {
|
|
95
|
-
color: var(--color-fg-default);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.tone-light .headline {
|
|
99
|
-
color: var(--color-fg-on-strong);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.noMargin {
|
|
103
|
-
margin: 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* Marker variant */
|
|
107
|
-
.headline.marker {
|
|
108
|
-
padding-inline-start: calc(var(--border-width-medium) + var(--spacing-sm));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.headline.marker::before {
|
|
112
|
-
content: '';
|
|
113
|
-
position: absolute;
|
|
114
|
-
inset-block-start: 50%;
|
|
115
|
-
transform: translateY(-50%);
|
|
116
|
-
block-size: 0.75em;
|
|
117
|
-
inset-inline-start: 0;
|
|
118
|
-
inline-size: var(--border-width-medium);
|
|
119
|
-
background-color: var(--marker-color, var(--color-brand));
|
|
120
|
-
border-radius: var(--border-radius-sm);
|
|
121
|
-
pointer-events: none;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/* Subheader */
|
|
125
|
-
.subheader {
|
|
126
|
-
font-size: var(--font-size-sm);
|
|
127
|
-
margin-block-start: calc(var(--spacing-2xs) * -1);
|
|
128
|
-
color: var(--color-fg-subtle);
|
|
129
|
-
line-height: var(--line-height-normal);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.addition {
|
|
133
|
-
display: flex;
|
|
134
|
-
flex: 1 1 auto;
|
|
135
|
-
min-width: 0;
|
|
136
|
-
align-items: center;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/* Icon */
|
|
140
|
-
.icon {
|
|
141
|
-
flex: 0 0 auto;
|
|
142
|
-
display: inline-flex;
|
|
143
|
-
align-items: center;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/* Text wrapper (allows shrinking inside flex layouts) */
|
|
147
|
-
.text {
|
|
148
|
-
flex: 1 1 auto;
|
|
149
|
-
min-width: 0;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/* Text behaviour */
|
|
153
|
-
.truncate {
|
|
154
|
-
overflow: hidden;
|
|
155
|
-
white-space: nowrap;
|
|
156
|
-
text-overflow: ellipsis;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.wrap {
|
|
160
|
-
white-space: normal;
|
|
161
|
-
overflow: visible;
|
|
162
|
-
display: flex;
|
|
163
|
-
align-items: center;
|
|
164
|
-
gap: var(--spacing-xxs);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
@media (max-width: 767px) {
|
|
168
|
-
.headlineRow {
|
|
169
|
-
flex-direction: column;
|
|
170
|
-
align-items: flex-start;
|
|
171
|
-
gap: var(--spacing-md);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.headlineContainer h1.headline {
|
|
175
|
-
font-size: var(--font-size-xl);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.headlineContainer h2.headline {
|
|
179
|
-
font-size: var(--font-size-lg);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.addition {
|
|
183
|
-
inline-size: 100%;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import styles from './Hyperlink.module.css';
|
|
5
|
-
function cx(...parts) {
|
|
6
|
-
return parts.filter(Boolean).join(' ');
|
|
7
|
-
}
|
|
8
|
-
function renderInner(children, icon) {
|
|
9
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: styles.content, children: children }), icon && _jsx("span", { className: styles.icon, children: icon })] }));
|
|
10
|
-
}
|
|
11
|
-
export function Hyperlink(props) {
|
|
12
|
-
var _a;
|
|
13
|
-
const { children, icon, className, asChild, as = 'a', variant = 'primary', inline = true, ...rest } = props;
|
|
14
|
-
const linkClassName = cx(styles.link, className, variant === 'secondary' ? styles.secondary : styles.primary, inline ? '' : styles.block);
|
|
15
|
-
if (asChild) {
|
|
16
|
-
const child = React.Children.only(children);
|
|
17
|
-
if (!React.isValidElement(child)) {
|
|
18
|
-
throw new Error('Hyperlink with asChild expects a single valid React element as its child.');
|
|
19
|
-
}
|
|
20
|
-
const childProps = (_a = child.props) !== null && _a !== void 0 ? _a : {};
|
|
21
|
-
return React.cloneElement(child, {
|
|
22
|
-
...childProps,
|
|
23
|
-
...rest,
|
|
24
|
-
className: cx(childProps.className, linkClassName),
|
|
25
|
-
children: renderInner(childProps.children, icon),
|
|
26
|
-
onClick: (e) => {
|
|
27
|
-
e.stopPropagation();
|
|
28
|
-
if (childProps.onClick) {
|
|
29
|
-
childProps.onClick(e);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
if (as === 'button') {
|
|
35
|
-
// (Optional) guardrail: avoid accidentally passing href to a button
|
|
36
|
-
// const { href, ...buttonRest } = rest as any
|
|
37
|
-
return (_jsx("button", { type: "button", className: linkClassName, ...rest, children: renderInner(children, icon) }));
|
|
38
|
-
}
|
|
39
|
-
return (_jsx("a", { onClick: e => e.stopPropagation(), className: linkClassName, ...rest, children: renderInner(children, icon) }));
|
|
40
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
.link {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
gap: var(--spacing-xs);
|
|
5
|
-
position: relative;
|
|
6
|
-
background: none;
|
|
7
|
-
border: none;
|
|
8
|
-
padding: 0;
|
|
9
|
-
text-decoration: none;
|
|
10
|
-
font-size: inherit;
|
|
11
|
-
font-family: inherit;
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
color: var(--color-brand);
|
|
14
|
-
line-height: inherit;
|
|
15
|
-
transition:
|
|
16
|
-
color var(--transition-fast) var(--ease-standard),
|
|
17
|
-
transform 60ms ease,
|
|
18
|
-
opacity 60ms ease,
|
|
19
|
-
background-color var(--transition-fast) var(--ease-standard);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.link.secondary {
|
|
23
|
-
color: var(--color-fg-default);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.link:hover {
|
|
27
|
-
color: var(--color-brand);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.link.primary {
|
|
31
|
-
position: relative;
|
|
32
|
-
color: var(--color-brand);
|
|
33
|
-
text-decoration: none;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.link.block {
|
|
37
|
-
background: var(--color-bg-contextual-subtle);
|
|
38
|
-
display: inline-block;
|
|
39
|
-
padding: var(--spacing-xs);
|
|
40
|
-
&:hover {
|
|
41
|
-
background-color: var(--color-bg-contextual);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.link {
|
|
46
|
-
position: relative;
|
|
47
|
-
display: inline-flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
max-width: 100%;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.link {
|
|
53
|
-
position: relative;
|
|
54
|
-
display: inline-flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
max-width: 100%;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.content {
|
|
60
|
-
display: inline-flex;
|
|
61
|
-
align-items: center;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.link::after {
|
|
65
|
-
content: '';
|
|
66
|
-
position: absolute;
|
|
67
|
-
left: 0;
|
|
68
|
-
right: 0;
|
|
69
|
-
bottom: 1px;
|
|
70
|
-
height: 1px;
|
|
71
|
-
background-color: currentColor;
|
|
72
|
-
transform: scaleX(0);
|
|
73
|
-
transform-origin: left;
|
|
74
|
-
transition: transform 100ms ease;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.link:hover::after {
|
|
78
|
-
transform: scaleX(1);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.link:active {
|
|
82
|
-
color: var(--color-link-hover);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.link:active::after {
|
|
86
|
-
transform: scaleX(1);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.link.block:active {
|
|
90
|
-
background-color: var(--color-bg-contextual);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.link:focus-visible {
|
|
94
|
-
outline: 2px solid var(--color-brand);
|
|
95
|
-
outline-offset: 2px;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.icon {
|
|
99
|
-
display: flex;
|
|
100
|
-
align-items: center;
|
|
101
|
-
color: var(--color-brand);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.link svg {
|
|
105
|
-
inline-size: var(--icon-size-sm);
|
|
106
|
-
block-size: var(--icon-size-sm);
|
|
107
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Building2, CircleAlert, CircleCheck, CircleX, Info } from 'lucide-react';
|
|
3
|
-
import styles from './Icon.module.css';
|
|
4
|
-
export const SeverityIcon = {
|
|
5
|
-
neutral: _jsx(CircleCheck, {}),
|
|
6
|
-
success: _jsx(CircleCheck, {}),
|
|
7
|
-
error: _jsx(CircleX, {}),
|
|
8
|
-
info: _jsx(Info, {}),
|
|
9
|
-
warning: _jsx(CircleAlert, {}),
|
|
10
|
-
brand: _jsx(Building2, {}),
|
|
11
|
-
};
|
|
12
|
-
export function Icon({ severity, label, customIcon }) {
|
|
13
|
-
return (_jsxs("div", { className: `${styles.container}`, children: [_jsx("span", { className: `${styles.icon} ${severity ? styles[severity] : ''} dbc-icon`, children: customIcon ? customIcon : severity ? SeverityIcon[severity] : null }), label && _jsx("span", { children: label })] }));
|
|
14
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
vertical-align: middle;
|
|
5
|
-
gap: var(--spacing-xxs);
|
|
6
|
-
color: var(--color-fg-subtle);
|
|
7
|
-
font-size: var(--font-size-sm);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.icon {
|
|
11
|
-
display: flex;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.icon svg {
|
|
15
|
-
height: var(--icon-size-md);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.success {
|
|
19
|
-
color: var(--color-status-success);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.error {
|
|
23
|
-
color: var(--color-status-error);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.warning {
|
|
27
|
-
color: var(--color-status-warning);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.info {
|
|
31
|
-
color: var(--color-status-info);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.brand {
|
|
35
|
-
color: var(--color-fg-on-brand);
|
|
36
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Check } from 'lucide-react';
|
|
4
|
-
import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
5
|
-
import { Button } from '../../components/button/Button';
|
|
6
|
-
import { ClearButton } from '../../components/clear-button/ClearButton';
|
|
7
|
-
import { InputContainer } from '../../components/forms/input-container/InputContainer';
|
|
8
|
-
import { Menu } from '../../components/menu/Menu';
|
|
9
|
-
import { useTooltipTrigger } from '../../components/overlay/tooltip/useTooltipTrigger';
|
|
10
|
-
import { Popover } from '../../components/popover/Popover';
|
|
11
|
-
import { isoFromLocalDate } from '../datetime-picker/dateTimeHelpers';
|
|
12
|
-
export function IntervalSelect({
|
|
13
|
-
// InputContainer props
|
|
14
|
-
label, error, helpText, orientation = 'vertical', labelWidth = '160px', fullWidth = true, required,
|
|
15
|
-
// tooltip
|
|
16
|
-
tooltip, tooltipPlacement = 'right',
|
|
17
|
-
// IntervalSelect props
|
|
18
|
-
id, options, selectedValue, onChange, baseDate, placeholder = 'Vælg interval', size, variant = 'outlined', onClear, dataCy, disabled, }) {
|
|
19
|
-
const generatedId = useId();
|
|
20
|
-
const controlId = id !== null && id !== void 0 ? id : `interval-select-${generatedId}`;
|
|
21
|
-
const describedById = `${controlId}-desc`;
|
|
22
|
-
const listboxId = `${controlId}-listbox`;
|
|
23
|
-
const popoverRef = useRef(null);
|
|
24
|
-
const optionRefs = useRef([]);
|
|
25
|
-
const selectedIndex = useMemo(() => options.findIndex(o => o.minutesAgo === selectedValue), [options, selectedValue]);
|
|
26
|
-
const [activeIndex, setActiveIndex] = useState(selectedIndex >= 0 ? selectedIndex : 0);
|
|
27
|
-
// Focus active option when opened (simple version: always focus when index changes)
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
var _a;
|
|
30
|
-
(_a = optionRefs.current[activeIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
31
|
-
}, [activeIndex]);
|
|
32
|
-
const selected = useMemo(() => { var _a; return (_a = options.find(o => o.minutesAgo === selectedValue)) !== null && _a !== void 0 ? _a : null; }, [options, selectedValue]);
|
|
33
|
-
const tooltipEnabled = Boolean(tooltip);
|
|
34
|
-
const { triggerProps, id: tooltipId } = useTooltipTrigger({
|
|
35
|
-
content: tooltipEnabled ? tooltip : null,
|
|
36
|
-
placement: tooltipPlacement,
|
|
37
|
-
offset: 8,
|
|
38
|
-
});
|
|
39
|
-
const describedBy = (() => {
|
|
40
|
-
const ids = [];
|
|
41
|
-
if (error || helpText)
|
|
42
|
-
ids.push(describedById);
|
|
43
|
-
if (tooltipEnabled)
|
|
44
|
-
ids.push(tooltipId);
|
|
45
|
-
return ids.length ? ids.join(' ') : undefined;
|
|
46
|
-
})();
|
|
47
|
-
const handleCommit = (opt) => {
|
|
48
|
-
var _a;
|
|
49
|
-
const base = baseDate !== null && baseDate !== void 0 ? baseDate : new Date();
|
|
50
|
-
const dateLocal = new Date(base.getTime() - opt.minutesAgo * 60000);
|
|
51
|
-
const isoUtc = isoFromLocalDate(dateLocal);
|
|
52
|
-
onChange(isoUtc, { minutesAgo: opt.minutesAgo, option: opt, dateLocal });
|
|
53
|
-
(_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
54
|
-
};
|
|
55
|
-
const handleKeyDown = (e) => {
|
|
56
|
-
var _a;
|
|
57
|
-
switch (e.key) {
|
|
58
|
-
case 'ArrowDown':
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
setActiveIndex(i => Math.min(i + 1, options.length - 1));
|
|
61
|
-
break;
|
|
62
|
-
case 'ArrowUp':
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
setActiveIndex(i => Math.max(i - 1, 0));
|
|
65
|
-
break;
|
|
66
|
-
case 'Home':
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
setActiveIndex(0);
|
|
69
|
-
break;
|
|
70
|
-
case 'End':
|
|
71
|
-
e.preventDefault();
|
|
72
|
-
setActiveIndex(options.length - 1);
|
|
73
|
-
break;
|
|
74
|
-
case 'Enter':
|
|
75
|
-
case ' ':
|
|
76
|
-
e.preventDefault();
|
|
77
|
-
if (options[activeIndex])
|
|
78
|
-
handleCommit(options[activeIndex]);
|
|
79
|
-
break;
|
|
80
|
-
case 'Escape':
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
(_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
return (_jsxs(InputContainer, { label: label, htmlFor: controlId, fullWidth: fullWidth, error: error, helpText: helpText, orientation: orientation, labelWidth: labelWidth, required: required, children: [_jsx(Popover, { ref: popoverRef, contentId: listboxId, trigger: (onClick, icon, isOpen) => (_jsx(Button, { disabled: disabled, ...(tooltipEnabled ? triggerProps : {}), id: controlId, "data-cy": dataCy !== null && dataCy !== void 0 ? dataCy : 'interval-select-button', onKeyDown: handleKeyDown, fullWidth: fullWidth, variant: variant, onClick: e => {
|
|
87
|
-
// Reset active to selected when opening
|
|
88
|
-
setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
89
|
-
onClick(e);
|
|
90
|
-
}, size: size, type: "button", "aria-haspopup": "listbox", "aria-expanded": !!isOpen, "aria-controls": listboxId, "aria-invalid": Boolean(error) || undefined, "aria-describedby": describedBy, children: _jsxs("span", { className: "dbc-flex dbc-justify-between dbc-items-center dbc-gap-xxs", style: { width: '100%' }, children: [_jsx("span", { className: "dbc-flex dbc-items-center dbc-gap-xxs", children: selected ? selected.label : placeholder }), onClear && selected && _jsx(ClearButton, { onClick: onClear }), icon] }) })), children: _jsx(Menu, { id: listboxId, onKeyDown: handleKeyDown, role: "listbox", children: options.map((opt, index) => {
|
|
91
|
-
const isSelected = opt.minutesAgo === selectedValue;
|
|
92
|
-
const isActive = index === activeIndex;
|
|
93
|
-
return (_jsx(Menu.Item, { active: isActive, selected: isSelected,
|
|
94
|
-
// IMPORTANT: listbox uses role="option"
|
|
95
|
-
itemRole: "option", children: _jsxs("button", { ref: el => {
|
|
96
|
-
optionRefs.current[index] = el;
|
|
97
|
-
}, type: "button", tabIndex: isActive ? 0 : -1, "aria-selected": isSelected, onClick: () => handleCommit(opt), onFocus: () => setActiveIndex(index), style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [_jsx("span", { style: { width: 16, display: 'inline-flex', justifyContent: 'center' }, children: isSelected ? _jsx(Check, {}) : null }), opt.label] }) }, opt.minutesAgo));
|
|
98
|
-
}) }) }), (error || helpText) && (_jsx("span", { id: describedById, style: { display: 'none' }, children: error !== null && error !== void 0 ? error : helpText }))] }));
|
|
99
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from 'react';
|
|
3
|
-
import { getHighlightedSegments } from '../../utils/text/get-highlighted-segments';
|
|
4
|
-
export function HighlightedText({ text, query }) {
|
|
5
|
-
return getHighlightedSegments(text, query).map((segment, index) => segment.matched ? (_jsx("mark", { className: "dbc-highlight", children: segment.text }, `${segment.text}-${index}`)) : (_jsx(Fragment, { children: segment.text }, `${segment.text}-${index}`)));
|
|
6
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Check, ChevronDown, ChevronRight, Copy } from 'lucide-react';
|
|
4
|
-
import { capitalize, formatPrimitive, getNodeId, getPathLabel, getPrimitiveRawValue, getSummary, getValueType, isJsonArray, isJsonObject, } from './utils';
|
|
5
|
-
import { HighlightedText } from './HighlightedText';
|
|
6
|
-
import styles from './JsonViewer.module.css';
|
|
7
|
-
export function JsonNode({ keyName, path, value, depth, defaultExpandedDepth, query, matches, expandedNodeIds, onToggleNode, copiedId, onCopy, }) {
|
|
8
|
-
const nodeId = getNodeId(path);
|
|
9
|
-
const nodeType = getValueType(value);
|
|
10
|
-
const match = matches.get(nodeId);
|
|
11
|
-
const shouldRender = query ? Boolean(match) : true;
|
|
12
|
-
const forceOpen = query ? Boolean(match === null || match === void 0 ? void 0 : match.descendant) : false;
|
|
13
|
-
if (!shouldRender)
|
|
14
|
-
return null;
|
|
15
|
-
if (nodeType !== 'array' && nodeType !== 'object') {
|
|
16
|
-
const primitive = value;
|
|
17
|
-
const valueLabel = formatPrimitive(primitive);
|
|
18
|
-
const rawValue = getPrimitiveRawValue(primitive);
|
|
19
|
-
const copied = copiedId === nodeId;
|
|
20
|
-
return (_jsxs("div", { className: styles.node, style: { ['--json-indent']: depth }, children: [_jsx("div", { className: styles.row, "data-match": (match === null || match === void 0 ? void 0 : match.self) || undefined, children: _jsxs("button", { type: "button", className: styles.valueButton, onClick: () => onCopy(nodeId, rawValue), title: copied ? 'Kopieret' : 'Kopiér værdi', children: [_jsxs("span", { className: styles.rowLabel, children: [keyName !== undefined ? (_jsxs("span", { className: styles.keyChunk, children: [_jsx("span", { className: styles.key, children: _jsx(HighlightedText, { text: keyName, query: query }) }), _jsx("span", { className: styles.punctuation, children: ":" })] })) : (_jsx("span", { className: styles.rootLabel, children: "$" })), _jsx("span", { className: [styles.value, styles[`value${capitalize(nodeType)}`]].join(' '), children: _jsx(HighlightedText, { text: valueLabel, query: query }) })] }), _jsxs("span", { className: styles.copyState, "aria-live": "polite", children: [copied ? _jsx(Check, { "aria-hidden": "true" }) : _jsx(Copy, { "aria-hidden": "true" }), _jsx("span", { children: copied ? 'Kopieret' : 'Kopiér' })] })] }) }), query && !(match === null || match === void 0 ? void 0 : match.self) ? (_jsx("div", { className: styles.pathHint, children: _jsx(HighlightedText, { text: getPathLabel(path), query: query }) })) : null] }));
|
|
21
|
-
}
|
|
22
|
-
const entries = isJsonArray(value)
|
|
23
|
-
? value.map((item, index) => [String(index), item])
|
|
24
|
-
: isJsonObject(value)
|
|
25
|
-
? Object.entries(value)
|
|
26
|
-
: [];
|
|
27
|
-
const summary = getSummary(value);
|
|
28
|
-
const expanded = query || forceOpen ? true : expandedNodeIds.has(nodeId);
|
|
29
|
-
return (_jsxs("div", { className: styles.node, style: { ['--json-indent']: depth }, children: [_jsx("div", { className: styles.row, "data-match": (match === null || match === void 0 ? void 0 : match.self) || undefined, children: _jsxs("button", { type: "button", className: styles.toggle, onClick: () => onToggleNode(nodeId), "aria-expanded": expanded, children: [expanded ? _jsx(ChevronDown, { "aria-hidden": "true" }) : _jsx(ChevronRight, { "aria-hidden": "true" }), _jsxs("span", { className: styles.rowLabel, children: [keyName !== undefined ? (_jsxs("span", { className: styles.keyChunk, children: [_jsx("span", { className: styles.key, children: _jsx(HighlightedText, { text: keyName, query: query }) }), _jsx("span", { className: styles.punctuation, children: ":" })] })) : (_jsx("span", { className: styles.rootLabel, children: "$" })), _jsx("span", { className: styles.bracket, children: isJsonArray(value) ? '[' : '{' }), _jsx("span", { className: styles.summary, children: _jsx(HighlightedText, { text: summary, query: query }) }), _jsx("span", { className: styles.bracket, children: isJsonArray(value) ? ']' : '}' })] })] }) }), query && !(match === null || match === void 0 ? void 0 : match.self) ? (_jsx("div", { className: styles.pathHint, children: _jsx(HighlightedText, { text: getPathLabel(path), query: query }) })) : null, expanded ? (_jsx("div", { className: styles.children, role: depth === 0 ? 'group' : undefined, children: entries.map(([childKey, childValue]) => (_jsx(JsonNode, { keyName: isJsonArray(value) ? `[${childKey}]` : childKey, path: [...path, childKey], value: childValue, depth: depth + 1, defaultExpandedDepth: defaultExpandedDepth, query: query, matches: matches, expandedNodeIds: expandedNodeIds, onToggleNode: onToggleNode, copiedId: copiedId, onCopy: onCopy }, `${nodeId}-${childKey}`))) })) : null] }));
|
|
30
|
-
}
|