@dbcdk/react-components 0.0.5 → 0.0.7

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.
Files changed (276) hide show
  1. package/dist/assets/logo.js +2 -85
  2. package/dist/components/__stories__/_data/table.d.ts +15 -0
  3. package/dist/components/__stories__/_data/table.js +49 -0
  4. package/dist/components/__stories__/story-components/Colors.d.ts +2 -1
  5. package/dist/components/__stories__/story-components/Colors.js +87 -142
  6. package/dist/components/__stories__/story-components/Spacing.d.ts +1 -0
  7. package/dist/components/__stories__/story-components/Spacing.js +58 -166
  8. package/dist/components/app-header/AppHeader.d.ts +4 -3
  9. package/dist/components/app-header/AppHeader.js +3 -6
  10. package/dist/components/attribute-chip/AttributeChip.d.ts +1 -0
  11. package/dist/components/attribute-chip/AttributeChip.js +3 -14
  12. package/dist/components/avatar/Avatar.d.ts +2 -2
  13. package/dist/components/avatar/Avatar.js +37 -71
  14. package/dist/components/breadcrumbs/Breadcrumbs.d.ts +4 -4
  15. package/dist/components/breadcrumbs/Breadcrumbs.js +4 -13
  16. package/dist/components/button/Button.d.ts +3 -2
  17. package/dist/components/button/Button.js +54 -56
  18. package/dist/components/button/Button.module.css +1 -1
  19. package/dist/components/card/Card.d.ts +8 -7
  20. package/dist/components/card/Card.js +19 -60
  21. package/dist/components/card-container/CardContainer.d.ts +3 -3
  22. package/dist/components/card-container/CardContainer.js +4 -16
  23. package/dist/components/chip/Chip.d.ts +6 -5
  24. package/dist/components/chip/Chip.js +14 -38
  25. package/dist/components/chip/Chip.module.css +9 -1
  26. package/dist/components/circle/Circle.d.ts +3 -2
  27. package/dist/components/circle/Circle.js +3 -10
  28. package/dist/components/clear-button/ClearButton.d.ts +2 -1
  29. package/dist/components/clear-button/ClearButton.js +6 -17
  30. package/dist/components/code-block/CodeBlock.d.ts +1 -0
  31. package/dist/components/code-block/CodeBlock.js +4 -10
  32. package/dist/components/copy-button/CopyButton.d.ts +4 -3
  33. package/dist/components/copy-button/CopyButton.js +19 -26
  34. package/dist/components/datetime-picker/DateTimePicker.d.ts +8 -5
  35. package/dist/components/datetime-picker/DateTimePicker.js +262 -475
  36. package/dist/components/datetime-picker/dateTimeHelpers.d.ts +13 -0
  37. package/dist/components/datetime-picker/dateTimeHelpers.js +119 -0
  38. package/dist/components/filter-field/FilterField.d.ts +5 -2
  39. package/dist/components/filter-field/FilterField.js +130 -173
  40. package/dist/components/filter-field/FilterField.module.css +21 -5
  41. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +36 -0
  42. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +53 -0
  43. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +60 -0
  44. package/dist/components/forms/checkbox/Checkbox.d.ts +31 -0
  45. package/dist/components/forms/checkbox/Checkbox.js +27 -0
  46. package/dist/components/{checkbox → forms/checkbox}/Checkbox.module.css +0 -1
  47. package/dist/components/forms/checkbox-group/CheckboxGroup.d.ts +47 -0
  48. package/dist/components/forms/checkbox-group/CheckboxGroup.js +75 -0
  49. package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +115 -0
  50. package/dist/components/{input → forms/input}/Input.d.ts +9 -5
  51. package/dist/components/forms/input/Input.js +70 -0
  52. package/dist/components/{input → forms/input}/Input.module.css +1 -0
  53. package/dist/components/forms/input-container/InputContainer.d.ts +15 -0
  54. package/dist/components/forms/input-container/InputContainer.js +15 -0
  55. package/dist/components/forms/input-container/InputContainer.module.css +34 -0
  56. package/dist/components/forms/multi-select/MultiSelect.d.ts +20 -0
  57. package/dist/components/forms/multi-select/MultiSelect.js +19 -0
  58. package/dist/components/forms/select/Select.d.ts +21 -0
  59. package/dist/components/forms/select/Select.js +94 -0
  60. package/dist/components/forms/text-area/Textarea.d.ts +17 -0
  61. package/dist/components/forms/text-area/Textarea.js +33 -0
  62. package/dist/components/forms/text-area/Textarea.module.css +26 -0
  63. package/dist/components/headline/Headline.js +18 -43
  64. package/dist/components/{link/Link.d.ts → hyperlink/Hyperlink.d.ts} +2 -2
  65. package/dist/components/hyperlink/Hyperlink.js +11 -0
  66. package/dist/components/{link/Link.module.css → hyperlink/Hyperlink.module.css} +5 -14
  67. package/dist/components/icon/Icon.d.ts +4 -3
  68. package/dist/components/icon/Icon.js +11 -17
  69. package/dist/components/interval-select/IntervalSelect.d.ts +30 -0
  70. package/dist/components/interval-select/IntervalSelect.js +82 -0
  71. package/dist/components/menu/Menu.js +25 -67
  72. package/dist/components/meta-bar/MetaBar.d.ts +4 -4
  73. package/dist/components/meta-bar/MetaBar.js +7 -20
  74. package/dist/components/nav-bar/NavBar.d.ts +5 -5
  75. package/dist/components/nav-bar/NavBar.js +15 -45
  76. package/dist/components/{modal → overlay/modal}/Modal.d.ts +4 -2
  77. package/dist/components/overlay/modal/Modal.js +92 -0
  78. package/dist/components/{modal → overlay/modal}/provider/ModalProvider.d.ts +0 -1
  79. package/dist/components/overlay/modal/provider/ModalProvider.js +70 -0
  80. package/dist/components/overlay/side-panel/SidePanel.d.ts +16 -0
  81. package/dist/components/overlay/side-panel/SidePanel.js +10 -0
  82. package/dist/components/overlay/side-panel/SidePanel.module.css +56 -0
  83. package/dist/components/overlay/side-panel/useSidePanel.d.ts +5 -0
  84. package/dist/components/overlay/side-panel/useSidePanel.js +11 -0
  85. package/dist/components/overlay/tooltip/Tooltip.d.ts +13 -0
  86. package/dist/components/overlay/tooltip/Tooltip.js +17 -0
  87. package/dist/components/overlay/tooltip/Tooltip.module.css +106 -0
  88. package/dist/components/overlay/tooltip/TooltipProvider.d.ts +20 -0
  89. package/dist/components/overlay/tooltip/TooltipProvider.js +244 -0
  90. package/dist/components/overlay/tooltip/useTooltipTrigger.d.ts +24 -0
  91. package/dist/components/overlay/tooltip/useTooltipTrigger.js +108 -0
  92. package/dist/components/page/Page.d.ts +7 -6
  93. package/dist/components/page/Page.js +4 -21
  94. package/dist/components/page-layout/PageLayout.d.ts +11 -12
  95. package/dist/components/page-layout/PageLayout.js +35 -71
  96. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +4 -22
  97. package/dist/components/pagination/Pagination.d.ts +2 -1
  98. package/dist/components/pagination/Pagination.js +38 -121
  99. package/dist/components/panel/Panel.d.ts +4 -3
  100. package/dist/components/panel/Panel.js +5 -10
  101. package/dist/components/popover/Popover.d.ts +1 -0
  102. package/dist/components/popover/Popover.js +116 -141
  103. package/dist/components/search-box/SearchBox.d.ts +2 -2
  104. package/dist/components/search-box/SearchBox.js +112 -162
  105. package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +1 -1
  106. package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +47 -94
  107. package/dist/components/sidebar/Sidebar.d.ts +1 -0
  108. package/dist/components/sidebar/Sidebar.js +5 -7
  109. package/dist/components/sidebar/components/SidebarItem.js +6 -14
  110. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +1 -1
  111. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +48 -88
  112. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +3 -2
  113. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +11 -41
  114. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +1 -0
  115. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +4 -25
  116. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +9 -23
  117. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +19 -40
  118. package/dist/components/sidebar/providers/SidebarProvider.d.ts +2 -1
  119. package/dist/components/sidebar/providers/SidebarProvider.js +182 -165
  120. package/dist/components/skeleton-loader/SkeletonLoader.js +68 -266
  121. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +11 -34
  122. package/dist/components/split-button/SplitButton.d.ts +7 -5
  123. package/dist/components/split-button/SplitButton.js +4 -27
  124. package/dist/components/split-pane/SplitPane.js +69 -105
  125. package/dist/components/split-pane/provider/SplitPaneContext.js +77 -71
  126. package/dist/components/table/Table.d.ts +9 -7
  127. package/dist/components/table/Table.js +115 -238
  128. package/dist/components/table/Table.module.css +5 -1
  129. package/dist/components/table/components/column-resizer/ColumnResizer.js +4 -15
  130. package/dist/components/table/components/empty-state/EmptyState.d.ts +6 -5
  131. package/dist/components/table/components/empty-state/EmptyState.js +22 -41
  132. package/dist/components/table/components/table-settings/TableSettings.d.ts +2 -1
  133. package/dist/components/table/components/table-settings/TableSettings.js +9 -27
  134. package/dist/components/table/tanstack.d.ts +1 -1
  135. package/dist/components/table/tanstack.js +154 -160
  136. package/dist/components/tabs/Tabs.d.ts +1 -0
  137. package/dist/components/tabs/Tabs.js +32 -81
  138. package/dist/components/toast/Toast.d.ts +1 -1
  139. package/dist/components/toast/Toast.js +4 -37
  140. package/dist/components/toast/Toast.module.css +1 -0
  141. package/dist/components/toast/provider/ToastProvider.d.ts +1 -1
  142. package/dist/components/toast/provider/ToastProvider.js +60 -87
  143. package/dist/components/user-display/UserDisplay.d.ts +2 -1
  144. package/dist/components/user-display/UserDisplay.js +4 -20
  145. package/dist/constants/severity.d.ts +1 -1
  146. package/dist/constants/severity.js +14 -16
  147. package/dist/constants/severity.types.d.ts +1 -1
  148. package/dist/constants/severity.types.js +1 -1
  149. package/dist/constants/sizes.js +6 -8
  150. package/dist/hooks/usePagination.d.ts +1 -1
  151. package/dist/hooks/usePagination.js +75 -82
  152. package/dist/hooks/useSorting.js +112 -110
  153. package/dist/hooks/useTableData.d.ts +1 -1
  154. package/dist/hooks/useTableData.js +42 -47
  155. package/dist/hooks/useTableSelection.js +121 -121
  156. package/dist/hooks/useTableSettings.js +23 -25
  157. package/dist/hooks/useTheme.d.ts +3 -7
  158. package/dist/hooks/useTheme.js +52 -47
  159. package/dist/hooks/useTimeDuration.d.ts +2 -2
  160. package/dist/hooks/useTimeDuration.js +33 -34
  161. package/dist/hooks/useViewportFill.d.ts +3 -2
  162. package/dist/hooks/useViewportFill.js +55 -48
  163. package/dist/index.d.ts +17 -8
  164. package/dist/index.js +18 -8
  165. package/dist/src/styles/styles.css +3 -3
  166. package/dist/styles/css-helper-classes/flex.css +4 -0
  167. package/dist/styles/styles.css +3 -3
  168. package/dist/styles/themes/dbc/dark.css +1 -1
  169. package/dist/styles/themes/dbc/light.css +2 -1
  170. package/dist/styles/themes/forfatterweb/light.css +1 -1
  171. package/dist/styles/themes/types.js +1 -1
  172. package/dist/types/a11y-props.types.d.ts +5 -5
  173. package/dist/types/a11y-props.types.js +1 -1
  174. package/dist/types/sizes.types.js +1 -1
  175. package/dist/utils/arrays/nested-filtering.js +43 -33
  176. package/dist/utils/date/formatDate.js +25 -16
  177. package/package.json +18 -9
  178. package/dist/assets/logo.cjs +0 -87
  179. package/dist/components/__stories__/story-components/Colors.cjs +0 -159
  180. package/dist/components/__stories__/story-components/Spacing.cjs +0 -190
  181. package/dist/components/app-header/AppHeader.cjs +0 -14
  182. package/dist/components/attribute-chip/AttributeChip.cjs +0 -22
  183. package/dist/components/avatar/Avatar.cjs +0 -101
  184. package/dist/components/breadcrumbs/Breadcrumbs.cjs +0 -22
  185. package/dist/components/button/Button.cjs +0 -87
  186. package/dist/components/card/Card.cjs +0 -69
  187. package/dist/components/card-container/CardContainer.cjs +0 -24
  188. package/dist/components/checkbox/Checkbox.cjs +0 -42
  189. package/dist/components/checkbox/Checkbox.d.ts +0 -12
  190. package/dist/components/checkbox/Checkbox.js +0 -36
  191. package/dist/components/chip/Chip.cjs +0 -50
  192. package/dist/components/circle/Circle.cjs +0 -18
  193. package/dist/components/clear-button/ClearButton.cjs +0 -26
  194. package/dist/components/code-block/CodeBlock.cjs +0 -18
  195. package/dist/components/copy-button/CopyButton.cjs +0 -35
  196. package/dist/components/datetime-picker/DateTimePicker.cjs +0 -504
  197. package/dist/components/filter-field/FilterField.cjs +0 -189
  198. package/dist/components/headline/Headline.cjs +0 -53
  199. package/dist/components/icon/Icon.cjs +0 -27
  200. package/dist/components/input/Input.cjs +0 -89
  201. package/dist/components/input/Input.js +0 -83
  202. package/dist/components/link/Link.cjs +0 -46
  203. package/dist/components/link/Link.js +0 -21
  204. package/dist/components/menu/Menu.cjs +0 -96
  205. package/dist/components/meta-bar/MetaBar.cjs +0 -29
  206. package/dist/components/modal/Modal.cjs +0 -134
  207. package/dist/components/modal/Modal.js +0 -128
  208. package/dist/components/modal/provider/ModalProvider.cjs +0 -80
  209. package/dist/components/modal/provider/ModalProvider.js +0 -77
  210. package/dist/components/multi-select/MultiSelect.cjs +0 -59
  211. package/dist/components/multi-select/MultiSelect.d.ts +0 -18
  212. package/dist/components/multi-select/MultiSelect.js +0 -57
  213. package/dist/components/nav-bar/NavBar.cjs +0 -55
  214. package/dist/components/page/Page.cjs +0 -30
  215. package/dist/components/page-layout/PageLayout.cjs +0 -84
  216. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.cjs +0 -32
  217. package/dist/components/pagination/Pagination.cjs +0 -133
  218. package/dist/components/panel/Panel.cjs +0 -18
  219. package/dist/components/popover/Popover.cjs +0 -149
  220. package/dist/components/search-box/SearchBox.cjs +0 -175
  221. package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +0 -103
  222. package/dist/components/select/Select.cjs +0 -121
  223. package/dist/components/select/Select.d.ts +0 -12
  224. package/dist/components/select/Select.js +0 -119
  225. package/dist/components/sidebar/Sidebar.cjs +0 -11
  226. package/dist/components/sidebar/components/SidebarItem.cjs +0 -18
  227. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +0 -100
  228. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +0 -50
  229. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +0 -34
  230. package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +0 -29
  231. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +0 -52
  232. package/dist/components/sidebar/providers/SidebarProvider.cjs +0 -179
  233. package/dist/components/skeleton-loader/SkeletonLoader.cjs +0 -270
  234. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +0 -42
  235. package/dist/components/split-button/SplitButton.cjs +0 -37
  236. package/dist/components/split-pane/SplitPane.cjs +0 -123
  237. package/dist/components/split-pane/provider/SplitPaneContext.cjs +0 -87
  238. package/dist/components/table/Table.cjs +0 -249
  239. package/dist/components/table/components/column-resizer/ColumnResizer.cjs +0 -22
  240. package/dist/components/table/components/empty-state/EmptyState.cjs +0 -52
  241. package/dist/components/table/components/table-settings/TableSettings.cjs +0 -32
  242. package/dist/components/table/tanstack.cjs +0 -193
  243. package/dist/components/tabs/Tabs.cjs +0 -90
  244. package/dist/components/text-area/Textarea.cjs +0 -62
  245. package/dist/components/text-area/Textarea.d.ts +0 -14
  246. package/dist/components/text-area/Textarea.js +0 -56
  247. package/dist/components/text-area/Textarea.module.css +0 -3
  248. package/dist/components/toast/Toast.cjs +0 -47
  249. package/dist/components/toast/provider/ToastProvider.cjs +0 -98
  250. package/dist/components/tooltip/Tooltip.cjs +0 -183
  251. package/dist/components/tooltip/Tooltip.d.ts +0 -11
  252. package/dist/components/tooltip/Tooltip.js +0 -177
  253. package/dist/components/tooltip/Tooltip.module.css +0 -66
  254. package/dist/components/user-display/UserDisplay.cjs +0 -28
  255. package/dist/constants/severity.cjs +0 -21
  256. package/dist/constants/severity.types.cjs +0 -2
  257. package/dist/constants/sizes.cjs +0 -11
  258. package/dist/hooks/usePagination.cjs +0 -88
  259. package/dist/hooks/useSorting.cjs +0 -118
  260. package/dist/hooks/useTableData.cjs +0 -52
  261. package/dist/hooks/useTableSelection.cjs +0 -130
  262. package/dist/hooks/useTableSettings.cjs +0 -28
  263. package/dist/hooks/useTheme.cjs +0 -58
  264. package/dist/hooks/useTimeDuration.cjs +0 -39
  265. package/dist/hooks/useViewportFill.cjs +0 -52
  266. package/dist/index.cjs +0 -383
  267. package/dist/styles/themes/types.cjs +0 -2
  268. package/dist/types/a11y-props.types.cjs +0 -2
  269. package/dist/types/assets.d.cjs +0 -2
  270. package/dist/types/assets.d.js +0 -1
  271. package/dist/types/css.d.cjs +0 -2
  272. package/dist/types/css.d.js +0 -1
  273. package/dist/types/sizes.types.cjs +0 -2
  274. package/dist/utils/arrays/nested-filtering.cjs +0 -40
  275. package/dist/utils/date/formatDate.cjs +0 -19
  276. /package/dist/components/{modal → overlay/modal}/Modal.module.css +0 -0
@@ -0,0 +1,94 @@
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, useRef, useState } from 'react';
5
+ import { useTooltipTrigger } from '../../../components/overlay/tooltip/useTooltipTrigger';
6
+ import { Button } from '../../button/Button';
7
+ import { ClearButton } from '../../clear-button/ClearButton';
8
+ import { Menu } from '../../menu/Menu';
9
+ import { Popover } from '../../popover/Popover';
10
+ import { InputContainer } from '../input-container/InputContainer';
11
+ export function Select({
12
+ // InputContainer props
13
+ label, error, helpText, orientation = 'vertical', labelWidth = '120px', fullWidth = true, required,
14
+ // ✅ tooltip props
15
+ tooltip, tooltipPlacement = 'right',
16
+ // Select props
17
+ id, options, selectedValue, onChange, placeholder = 'Vælg', size, variant = 'outlined', onClear, datakey, dataCy, }) {
18
+ const generatedId = useId();
19
+ const controlId = id !== null && id !== void 0 ? id : `select-${generatedId}`;
20
+ const describedById = `${controlId}-desc`;
21
+ const popoverRef = useRef(null);
22
+ const optionRefs = useRef([]);
23
+ const selectedIndex = options.findIndex(o => o.value === selectedValue);
24
+ const [activeIndex, setActiveIndex] = useState(selectedIndex >= 0 ? selectedIndex : 0);
25
+ useEffect(() => {
26
+ var _a;
27
+ (_a = optionRefs.current[activeIndex]) === null || _a === void 0 ? 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 || _a === void 0 ? void 0 : _a.close();
49
+ }
50
+ break;
51
+ }
52
+ case 'Escape': {
53
+ e.preventDefault();
54
+ (_b = popoverRef.current) === null || _b === void 0 ? void 0 : _b.close();
55
+ break;
56
+ }
57
+ }
58
+ };
59
+ const selected = options.find(o => o.value === selectedValue);
60
+ // Tooltip trigger props (anchor to the Button)
61
+ const tooltipEnabled = Boolean(tooltip);
62
+ const { triggerProps, id: tooltipId } = useTooltipTrigger({
63
+ content: tooltipEnabled ? tooltip : null,
64
+ placement: tooltipPlacement,
65
+ offset: 8,
66
+ });
67
+ // If you want BOTH tooltip + error/helpText describedby:
68
+ // merge describedby ids (keeping existing describedById)
69
+ const describedBy = (() => {
70
+ const ids = [];
71
+ if (error || helpText)
72
+ ids.push(describedById);
73
+ if (tooltipEnabled)
74
+ ids.push(tooltipId);
75
+ return ids.length ? ids.join(' ') : undefined;
76
+ })();
77
+ return (_jsxs(InputContainer, { label: label, htmlFor: controlId, fullWidth: fullWidth, error: error, helpText: helpText, orientation: orientation, labelWidth: labelWidth, required: required, children: [_jsx(Popover, { ref: popoverRef, trigger: (onClick, icon) => (_jsx(Button
78
+ // IMPORTANT: keep triggerProps last for events, but let our aria-describedby win
79
+ // We'll spread triggerProps and then override aria-describedby to include both.
80
+ , { ...(tooltipEnabled ? triggerProps : {}), id: controlId, "data-cy": dataCy !== null && dataCy !== void 0 ? dataCy : 'select-button', onKeyDown: handleKeyDown, fullWidth: fullWidth, variant: variant, onClick: e => {
81
+ setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
82
+ onClick(e);
83
+ }, size: size, type: "button", "aria-haspopup": "listbox", "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", { children: selected ? selected.label : placeholder }), onClear && selected && _jsx(ClearButton, { onClick: onClear }), icon] }) })), children: _jsx(Menu, { onKeyDown: handleKeyDown, role: "listbox", children: options.map((opt, index) => {
84
+ const isSelected = typeof opt.value === 'object' && typeof selectedValue === 'object' && datakey
85
+ ? (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue[datakey]) === opt.value[datakey]
86
+ : opt.value === selectedValue;
87
+ const isActive = index === activeIndex;
88
+ return (_jsx(Menu.Item, { active: isActive, "aria-selected": isSelected, children: _jsxs("button", { ref: el => (optionRefs.current[index] = el), type: "button", tabIndex: isActive ? 0 : -1, onClick: () => {
89
+ var _a;
90
+ onChange(opt.value);
91
+ (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.close();
92
+ }, 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] }) }, String(opt.value)));
93
+ }) }) }), (error || helpText) && (_jsx("span", { id: describedById, style: { display: 'none' }, children: error !== null && error !== void 0 ? error : helpText }))] }));
94
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { InputContainerProps } from '../input-container/InputContainer';
3
+ export type TextareaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'onChange' | 'disabled'> & Omit<InputContainerProps, 'children' | 'htmlFor' | 'tooltip' | 'tooltipPlacement'> & {
4
+ value: string;
5
+ inputChanged: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
6
+ disabled?: boolean;
7
+ loading?: React.ReactNode;
8
+ rows?: number;
9
+ showCount?: boolean;
10
+ tooltip?: React.ReactNode;
11
+ tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';
12
+ showTooltip?: boolean;
13
+ adjustHeight?: boolean;
14
+ placeholder?: string;
15
+ id?: string;
16
+ };
17
+ export declare const Textarea: React.FC<TextareaProps>;
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useCallback, useId, useMemo } from 'react';
4
+ import { useTooltipTrigger } from '../../../components/overlay/tooltip/useTooltipTrigger';
5
+ import styles from './Textarea.module.css';
6
+ import { InputContainer } from '../input-container/InputContainer';
7
+ export const Textarea = function Textarea({ value, inputChanged, disabled, rows = 3, showCount, tooltip, tooltipPlacement = 'right', showTooltip, placeholder, adjustHeight, id,
8
+ // InputContainer props
9
+ label, error, helpText, orientation = 'horizontal', labelWidth = '120px', fullWidth = false, required,
10
+ // Native textarea props
11
+ className, ...rest }) {
12
+ const generatedId = useId();
13
+ const textareaId = id !== null && id !== void 0 ? id : `textarea-${generatedId}`;
14
+ const onInput = useCallback((e) => {
15
+ const textarea = e.currentTarget;
16
+ if (adjustHeight) {
17
+ textarea.style.height = 'auto';
18
+ textarea.style.height = `${textarea.scrollHeight}px`;
19
+ }
20
+ inputChanged(e);
21
+ }, [inputChanged, adjustHeight]);
22
+ const inputField = useMemo(() => (_jsx("textarea", { ...rest, id: textareaId, className: [styles.textarea, className].filter(Boolean).join(' '), placeholder: placeholder, rows: rows, value: value, onChange: onInput, disabled: disabled, "aria-invalid": Boolean(error) || undefined })), [rest, textareaId, className, placeholder, rows, value, onInput, disabled, error]);
23
+ // Enable tooltip if tooltip exists, and if showTooltip is either true or undefined.
24
+ // (So you can deprecate showTooltip later without breaking callers.)
25
+ const tooltipEnabled = Boolean(tooltip) && (showTooltip !== null && showTooltip !== void 0 ? showTooltip : true);
26
+ const { triggerProps } = useTooltipTrigger({
27
+ content: tooltipEnabled ? tooltip : null,
28
+ placement: tooltipPlacement,
29
+ offset: 8,
30
+ });
31
+ return (_jsx(InputContainer, { label: label, htmlFor: textareaId, error: error, helpText: helpText, helpTextAddition: showCount ? `${value === null || value === void 0 ? void 0 : value.length} tegn i denne boks` : undefined, orientation: orientation, labelWidth: labelWidth, fullWidth: fullWidth, required: required, children: _jsx("div", { className: styles.container, children: _jsx("div", { ...(tooltipEnabled ? triggerProps : {}), children: inputField }) }) }));
32
+ };
33
+ Textarea.displayName = 'Textarea';
@@ -0,0 +1,26 @@
1
+ .container {
2
+ flex-grow: 1;
3
+ }
4
+ .container textarea {
5
+ width: 100%;
6
+ padding: var(--spacing-xs);
7
+ border: var(--border-width-thin) solid var(--color-border-default);
8
+ border-radius: var(--border-radius-sm);
9
+ font-family: var(--font-family);
10
+ }
11
+
12
+ .internalCount {
13
+ text-align: right;
14
+ font-size: var(--font-size-sm);
15
+ color: var(--color-fg-subtle);
16
+ }
17
+
18
+ .container textarea:hover {
19
+ border-color: var(--color-border-strong);
20
+ }
21
+
22
+ .container textarea:focus-visible {
23
+ outline: none;
24
+ border-color: var(--color-border-selected);
25
+ box-shadow: var(--focus-ring);
26
+ }
@@ -1,47 +1,22 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import styles from './Headline.module.css';
3
4
  import { SeverityBgColor } from '../../constants/severity';
4
5
  import { Icon } from '../icon/Icon';
5
-
6
- function Headline({
7
- size = 2,
8
- marker,
9
- disableMargin,
10
- children,
11
- severity,
12
- weight = 600,
13
- subHeadline,
14
- addition,
15
- icon,
16
- tone
17
- }) {
18
- const Tag = `h${size}`;
19
- const containerClassName = [styles.headlineContainer, tone ? styles[`tone-${tone}`] : ""].filter(Boolean).join(" ");
20
- const headlineClassName = [
21
- styles.headline,
22
- disableMargin ? styles.noMargin : "",
23
- marker ? styles.marker : ""
24
- ].filter(Boolean).join(" ");
25
- return /* @__PURE__ */ jsxs(Fragment, { children: [
26
- /* @__PURE__ */ jsxs("div", { className: containerClassName, children: [
27
- /* @__PURE__ */ jsxs(
28
- Tag,
29
- {
30
- style: {
31
- "--font-weight": weight,
32
- "--marker-color": severity ? SeverityBgColor[severity] : void 0
33
- },
34
- className: headlineClassName,
35
- children: [
36
- icon || severity && !marker ? /* @__PURE__ */ jsx(Icon, { customIcon: icon, severity }) : null,
37
- children
38
- ]
39
- }
40
- ),
41
- addition
42
- ] }),
43
- subHeadline && /* @__PURE__ */ jsx("div", { className: styles.subHeadline, children: subHeadline })
44
- ] });
6
+ export function Headline({ size = 2, marker, disableMargin, children, severity, weight = 600, subHeadline, addition, icon, tone, }) {
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
+ ]
16
+ .filter(Boolean)
17
+ .join(' ');
18
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: containerClassName, children: [_jsxs(Tag, { style: {
19
+ '--font-weight': weight,
20
+ '--marker-color': severity ? SeverityBgColor[severity] : undefined,
21
+ }, className: headlineClassName, children: [icon || (severity && !marker) ? _jsx(Icon, { customIcon: icon, severity: severity }) : null, children] }), addition] }), subHeadline && _jsx("div", { className: styles.subHeadline, children: subHeadline })] }));
45
22
  }
46
-
47
- export { Headline };
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- interface LinkProps {
2
+ interface HyperlinkProps {
3
3
  component: React.ReactElement;
4
4
  className?: string;
5
5
  icon?: React.ReactNode;
6
6
  disableIcon?: boolean;
7
7
  }
8
- export declare function Link({ component, icon, disableIcon }: LinkProps): React.ReactElement;
8
+ export declare function Hyperlink({ component, icon }: HyperlinkProps): React.ReactElement;
9
9
  export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import styles from './Hyperlink.module.css';
4
+ export function Hyperlink({ component, icon }) {
5
+ const originalProps = component.props;
6
+ return React.cloneElement(component, {
7
+ ...originalProps,
8
+ className: styles.link,
9
+ onClick: (e) => e.stopPropagation(),
10
+ }, _jsxs(_Fragment, { children: [_jsx("span", { className: styles.content, children: originalProps.children }), icon && _jsx("span", { className: styles.icon, children: icon })] }));
11
+ }
@@ -3,11 +3,14 @@
3
3
  gap: var(--spacing-xs);
4
4
  position: relative;
5
5
  text-decoration: none;
6
- font-weight: bold;
7
- color: inherit;
6
+ color: var(--color-brand);
8
7
  font-size: inherit;
9
8
  }
10
9
 
10
+ .link:hover {
11
+ text-decoration: underline;
12
+ }
13
+
11
14
  .icon {
12
15
  display: flex;
13
16
  align-items: center;
@@ -18,15 +21,3 @@
18
21
  inline-size: var(--icon-size-sm);
19
22
  block-size: var(--icon-size-sm);
20
23
  }
21
-
22
- .link::after {
23
- content: '';
24
- display: block;
25
- height: var(--border-width-medium);
26
- background-color: var(--color-brand);
27
- width: 100%;
28
- align-self: flex-end;
29
- position: absolute;
30
- left: 0;
31
- bottom: calc(var(--spacing-xxs) * -1);
32
- }
@@ -1,8 +1,9 @@
1
- import { Severity } from '@/constants/severity.types';
2
- export declare const SeverityIcon: Record<Severity, React.ReactNode>;
1
+ import type { ReactNode, JSX } from 'react';
2
+ import { Severity } from '../../constants/severity.types';
3
+ export declare const SeverityIcon: Record<Severity, ReactNode>;
3
4
  interface IconProps {
4
5
  severity?: Severity;
5
- customIcon?: React.ReactNode;
6
+ customIcon?: ReactNode;
6
7
  label?: string;
7
8
  }
8
9
  export declare function Icon({ severity, label, customIcon }: IconProps): JSX.Element;
@@ -1,20 +1,14 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Building2, CircleAlert, Info, CircleX, CircleCheck } from 'lucide-react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Building2, CircleAlert, CircleCheck, CircleX, Info } from 'lucide-react';
3
3
  import styles from './Icon.module.css';
4
-
5
- const SeverityIcon = {
6
- neutral: /* @__PURE__ */ jsx(CircleCheck, {}),
7
- success: /* @__PURE__ */ jsx(CircleCheck, {}),
8
- error: /* @__PURE__ */ jsx(CircleX, {}),
9
- info: /* @__PURE__ */ jsx(Info, {}),
10
- warning: /* @__PURE__ */ jsx(CircleAlert, {}),
11
- brand: /* @__PURE__ */ jsx(Building2, {})
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, {}),
12
11
  };
13
- function Icon({ severity, label, customIcon }) {
14
- return /* @__PURE__ */ jsxs("div", { className: `${styles.container}`, children: [
15
- /* @__PURE__ */ jsx("span", { className: `${styles.icon} ${severity ? styles[severity] : ""} dbc-icon`, children: customIcon ? customIcon : severity ? SeverityIcon[severity] : null }),
16
- label && /* @__PURE__ */ jsx("span", { children: label })
17
- ] });
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 })] }));
18
14
  }
19
-
20
- export { Icon, SeverityIcon };
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { ButtonVariant } from '../../components/button/Button';
3
+ import { InputContainer } from '../../components/forms/input-container/InputContainer';
4
+ type InputContainerProps = React.ComponentProps<typeof InputContainer>;
5
+ export type IntervalOption = {
6
+ label: string;
7
+ /** How many minutes back from baseDate (default: now). */
8
+ minutesAgo: number;
9
+ };
10
+ export type IntervalSelectValue = number | null;
11
+ export type IntervalSelectProps = Omit<InputContainerProps, 'children' | 'htmlFor' | 'tooltip' | 'tooltipPlacement'> & {
12
+ id?: string;
13
+ options: IntervalOption[];
14
+ selectedValue: IntervalSelectValue;
15
+ onChange: (date: Date, meta: {
16
+ minutesAgo: number;
17
+ option: IntervalOption;
18
+ }) => void;
19
+ /** Base date for the calculation; defaults to "now". */
20
+ baseDate?: Date;
21
+ placeholder?: string;
22
+ size?: 'sm' | 'md' | 'lg';
23
+ variant?: ButtonVariant;
24
+ onClear?: () => void;
25
+ dataCy?: string;
26
+ tooltip?: React.ReactNode;
27
+ tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';
28
+ };
29
+ export declare function IntervalSelect({ label, error, helpText, orientation, labelWidth, fullWidth, required, tooltip, tooltipPlacement, id, options, selectedValue, onChange, baseDate, placeholder, size, variant, onClear, dataCy, }: IntervalSelectProps): React.ReactNode;
30
+ export {};
@@ -0,0 +1,82 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Check, Clock } 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
+ export function IntervalSelect({
12
+ // InputContainer props
13
+ label, error, helpText, orientation = 'vertical', labelWidth = '120px', fullWidth = true, required,
14
+ // tooltip
15
+ tooltip, tooltipPlacement = 'right',
16
+ // IntervalSelect props
17
+ id, options, selectedValue, onChange, baseDate, placeholder = 'Vælg interval', size, variant = 'outlined', onClear, dataCy, }) {
18
+ const generatedId = useId();
19
+ const controlId = id !== null && id !== void 0 ? id : `interval-select-${generatedId}`;
20
+ const describedById = `${controlId}-desc`;
21
+ const popoverRef = useRef(null);
22
+ const optionRefs = useRef([]);
23
+ const selectedIndex = useMemo(() => options.findIndex(o => o.minutesAgo === selectedValue), [options, selectedValue]);
24
+ const [activeIndex, setActiveIndex] = useState(selectedIndex >= 0 ? selectedIndex : 0);
25
+ useEffect(() => {
26
+ var _a;
27
+ (_a = optionRefs.current[activeIndex]) === null || _a === void 0 ? void 0 : _a.focus();
28
+ }, [activeIndex]);
29
+ const selected = useMemo(() => { var _a; return (_a = options.find(o => o.minutesAgo === selectedValue)) !== null && _a !== void 0 ? _a : null; }, [options, selectedValue]);
30
+ const tooltipEnabled = Boolean(tooltip);
31
+ const { triggerProps, id: tooltipId } = useTooltipTrigger({
32
+ content: tooltipEnabled ? tooltip : null,
33
+ placement: tooltipPlacement,
34
+ offset: 8,
35
+ });
36
+ const describedBy = (() => {
37
+ const ids = [];
38
+ if (error || helpText)
39
+ ids.push(describedById);
40
+ if (tooltipEnabled)
41
+ ids.push(tooltipId);
42
+ return ids.length ? ids.join(' ') : undefined;
43
+ })();
44
+ const handleCommit = (opt) => {
45
+ var _a;
46
+ const base = baseDate !== null && baseDate !== void 0 ? baseDate : new Date();
47
+ const dt = new Date(base.getTime() - opt.minutesAgo * 60000);
48
+ onChange(dt, { minutesAgo: opt.minutesAgo, option: opt });
49
+ (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.close();
50
+ };
51
+ const handleKeyDown = (e) => {
52
+ var _a;
53
+ switch (e.key) {
54
+ case 'ArrowDown':
55
+ e.preventDefault();
56
+ setActiveIndex(i => Math.min(i + 1, options.length - 1));
57
+ break;
58
+ case 'ArrowUp':
59
+ e.preventDefault();
60
+ setActiveIndex(i => Math.max(i - 1, 0));
61
+ break;
62
+ case 'Enter':
63
+ case ' ':
64
+ e.preventDefault();
65
+ if (options[activeIndex])
66
+ handleCommit(options[activeIndex]);
67
+ break;
68
+ case 'Escape':
69
+ e.preventDefault();
70
+ (_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.close();
71
+ break;
72
+ }
73
+ };
74
+ return (_jsxs(InputContainer, { label: label, htmlFor: controlId, fullWidth: fullWidth, error: error, helpText: helpText, orientation: orientation, labelWidth: labelWidth, required: required, children: [_jsx(Popover, { ref: popoverRef, trigger: (onClick, icon) => (_jsx(Button, { ...(tooltipEnabled ? triggerProps : {}), id: controlId, "data-cy": dataCy !== null && dataCy !== void 0 ? dataCy : 'interval-select-button', onKeyDown: handleKeyDown, fullWidth: fullWidth, variant: variant, onClick: e => {
75
+ setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
76
+ onClick(e);
77
+ }, size: size, type: "button", "aria-haspopup": "listbox", "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: [_jsxs("span", { className: "dbc-flex dbc-items-center dbc-gap-xxs", children: [_jsx(Clock, { size: 14 }), selected ? selected.label : placeholder] }), onClear && selected && _jsx(ClearButton, { onClick: onClear }), icon] }) })), children: _jsx(Menu, { onKeyDown: handleKeyDown, role: "listbox", children: options.map((opt, index) => {
78
+ const isSelected = opt.minutesAgo === selectedValue;
79
+ const isActive = index === activeIndex;
80
+ return (_jsx(Menu.Item, { active: isActive, "aria-selected": isSelected, children: _jsxs("button", { ref: el => (optionRefs.current[index] = el), type: "button", tabIndex: isActive ? 0 : -1, 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));
81
+ }) }) }), (error || helpText) && (_jsx("span", { id: describedById, style: { display: 'none' }, children: error !== null && error !== void 0 ? error : helpText }))] }));
82
+ }
@@ -1,71 +1,29 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import * as React from 'react';
3
4
  import styles from './Menu.module.css';
4
-
5
- const MenuBase = React.forwardRef(
6
- ({ children, className, ...props }, ref) => /* @__PURE__ */ jsx(
7
- "ul",
8
- {
9
- ref,
10
- role: "menu",
11
- className: [styles.container, className].filter(Boolean).join(" "),
12
- ...props,
13
- children
14
- }
15
- )
16
- );
17
- MenuBase.displayName = "Menu";
18
- const isInteractiveEl = (el) => React.isValidElement(el) && (typeof el.type === "string" ? el.type === "a" || el.type === "button" : true);
19
- const MenuItem = React.forwardRef(
20
- ({ children, active, disabled, className, ...liProps }, ref) => {
5
+ const MenuBase = React.forwardRef(({ children, className, ...props }, ref) => (_jsx("ul", { ref: ref, role: "menu", className: [styles.container, className].filter(Boolean).join(' '), ...props, children: children })));
6
+ MenuBase.displayName = 'Menu';
7
+ const isInteractiveEl = (el) => React.isValidElement(el) &&
8
+ (typeof el.type === 'string' ? el.type === 'a' || el.type === 'button' : true); // allow custom/Next Link components
9
+ const MenuItem = React.forwardRef(({ children, active, disabled, className, ...liProps }, ref) => {
10
+ // If child is interactive (a/button/NextLink), clone it and style it.
21
11
  if (isInteractiveEl(children)) {
22
- const child = children;
23
- const childClass = [styles.item, active ? styles.active : ""].filter(Boolean).join(" ");
24
- return /* @__PURE__ */ jsx(
25
- "li",
26
- {
27
- ref,
28
- role: "none",
29
- className: [styles.row, className].filter(Boolean).join(" "),
30
- ...liProps,
31
- children: React.cloneElement(child, {
32
- role: "menuitem",
33
- tabIndex: -1,
34
- "aria-selected": active || void 0,
35
- "aria-disabled": disabled || void 0,
36
- className: [child.props.className, styles.interactive, childClass].filter(Boolean).join(" ")
37
- })
38
- }
39
- );
12
+ const child = children;
13
+ const childClass = [styles.item, active ? styles.active : ''].filter(Boolean).join(' ');
14
+ return (_jsx("li", { ref: ref, role: "none", className: [styles.row, className].filter(Boolean).join(' '), ...liProps, children: React.cloneElement(child, {
15
+ role: 'menuitem',
16
+ tabIndex: -1,
17
+ 'aria-selected': active || undefined,
18
+ 'aria-disabled': disabled || undefined,
19
+ className: [child.props.className, styles.interactive, childClass]
20
+ .filter(Boolean)
21
+ .join(' '),
22
+ }) }));
40
23
  }
41
- return /* @__PURE__ */ jsx(
42
- "li",
43
- {
44
- ref,
45
- role: "none",
46
- className: [styles.row, className].filter(Boolean).join(" "),
47
- ...liProps,
48
- children: /* @__PURE__ */ jsx(
49
- "button",
50
- {
51
- role: "menuitem",
52
- tabIndex: -1,
53
- "aria-selected": active || void 0,
54
- "aria-disabled": disabled || void 0,
55
- className: [styles.interactive, styles.item, active ? styles.active : ""].filter(Boolean).join(" "),
56
- type: "button",
57
- disabled,
58
- children
59
- }
60
- )
61
- }
62
- );
63
- }
64
- );
65
- MenuItem.displayName = "Menu.Item";
66
- const Menu = Object.assign(
67
- MenuBase,
68
- { Item: MenuItem }
69
- );
70
-
71
- export { Menu };
24
+ return (_jsx("li", { ref: ref, role: "none", className: [styles.row, className].filter(Boolean).join(' '), ...liProps, children: _jsx("button", { role: "menuitem", tabIndex: -1, "aria-selected": active || undefined, "aria-disabled": disabled || undefined, className: [styles.interactive, styles.item, active ? styles.active : '']
25
+ .filter(Boolean)
26
+ .join(' '), type: "button", disabled: disabled, children: children }) }));
27
+ });
28
+ MenuItem.displayName = 'Menu.Item';
29
+ export const Menu = Object.assign(MenuBase, { Item: MenuItem });
@@ -1,11 +1,11 @@
1
- import React from 'react';
1
+ import { type ReactNode, type JSX } from 'react';
2
2
  export interface MetaItem {
3
- label?: React.ReactNode;
4
- value: React.ReactNode;
3
+ label?: ReactNode;
4
+ value: ReactNode;
5
5
  }
6
6
  interface MetaBarProps {
7
7
  items: MetaItem[];
8
- separator?: React.ReactNode;
8
+ separator?: ReactNode;
9
9
  }
10
10
  export declare function MetaBar({ items, separator }: MetaBarProps): JSX.Element | null;
11
11
  export {};
@@ -1,22 +1,9 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import React from 'react';
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
3
3
  import styles from './MetaBar.module.css';
4
-
5
- function MetaBar({ items, separator = "\u2022" }) {
6
- const visibleItems = items.filter(
7
- (item) => item.value !== null && item.value !== void 0 && item.value !== ""
8
- );
9
- if (visibleItems.length === 0) return null;
10
- return /* @__PURE__ */ jsx("div", { className: styles.meta, children: visibleItems.map((item, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
11
- /* @__PURE__ */ jsxs("span", { children: [
12
- item.label && /* @__PURE__ */ jsxs("span", { children: [
13
- item.label,
14
- ": "
15
- ] }),
16
- /* @__PURE__ */ jsx("span", { children: item.value })
17
- ] }),
18
- index < visibleItems.length - 1 && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: styles.dot, children: separator })
19
- ] }, index)) });
4
+ export function MetaBar({ items, separator = '•' }) {
5
+ const visibleItems = items.filter(item => item.value !== null && item.value !== undefined && item.value !== '');
6
+ if (visibleItems.length === 0)
7
+ return null;
8
+ return (_jsx("div", { className: styles.meta, children: visibleItems.map((item, index) => (_jsxs(Fragment, { children: [_jsxs("span", { children: [item.label && _jsxs("span", { children: [item.label, ": "] }), _jsx("span", { children: item.value })] }), index < visibleItems.length - 1 && (_jsx("span", { "aria-hidden": "true", className: styles.dot, children: separator }))] }, index))) }));
20
9
  }
21
-
22
- export { MetaBar };
@@ -1,8 +1,8 @@
1
- import * as React from 'react';
1
+ import type { ElementType, ReactNode, JSX } from 'react';
2
2
  export type NavBarItem = {
3
- component?: React.ElementType<any>;
3
+ component?: ElementType<any>;
4
4
  label: string;
5
- icon?: React.ReactNode;
5
+ icon?: ReactNode;
6
6
  active?: boolean;
7
7
  external?: boolean;
8
8
  enabled?: boolean;
@@ -11,10 +11,10 @@ export type NavBarItem = {
11
11
  children?: NavBarItem[];
12
12
  };
13
13
  interface NavBarProps {
14
- logo?: React.ReactNode;
14
+ logo?: ReactNode;
15
15
  items: NavBarItem[];
16
16
  productName?: string;
17
- addition?: React.ReactNode;
17
+ addition?: ReactNode;
18
18
  }
19
19
  export declare function NavBar({ logo, items, productName, addition }: NavBarProps): JSX.Element;
20
20
  export {};