@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,60 @@
1
+ /* ChipMultiToggle.module.css */
2
+
3
+ .wrapper {
4
+ display: flex;
5
+ align-items: center;
6
+ flex-wrap: wrap;
7
+
8
+ /* use theme spacing tokens */
9
+ gap: var(--spacing-xs);
10
+ }
11
+
12
+ .fullWidth {
13
+ width: 100%;
14
+ }
15
+
16
+ .label {
17
+ font-weight: var(--font-weight-medium);
18
+
19
+ /* theme uses --color-fg-muted / --color-fg-subtle (not --color-text-muted) */
20
+ color: var(--color-fg-muted);
21
+
22
+ white-space: nowrap;
23
+ line-height: var(--line-height-tight);
24
+ font-size: var(--font-size-sm);
25
+ }
26
+
27
+ .container {
28
+ display: flex;
29
+ flex-wrap: wrap;
30
+ align-items: center;
31
+
32
+ /* use theme spacing token */
33
+ gap: var(--spacing-xxs);
34
+ }
35
+
36
+ .chipButton {
37
+ padding: 0;
38
+ border: 0;
39
+ background: transparent;
40
+ cursor: pointer;
41
+
42
+ /* avoid default button styles on some browsers */
43
+ font: inherit;
44
+ color: inherit;
45
+ }
46
+
47
+ .chipButton:disabled {
48
+ cursor: not-allowed;
49
+
50
+ /* align with theme disabled */
51
+ opacity: 1;
52
+ color: var(--color-disabled-fg);
53
+ }
54
+
55
+ /* Focus ring should use theme focus tokens */
56
+ .chipButton:focus-visible {
57
+ outline: none;
58
+ box-shadow: var(--focus-ring);
59
+ border-radius: var(--border-radius-rounded);
60
+ }
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import type { JSX } from 'react';
3
+ type Variant = 'default' | 'primary' | 'outlined';
4
+ type Size = 'sm' | 'md' | 'lg';
5
+ interface CheckboxProps {
6
+ checked?: boolean;
7
+ onChange?: (checked: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
8
+ variant?: Variant;
9
+ disabled?: boolean;
10
+ /** Text shown next to the box (per-item label) */
11
+ label?: string;
12
+ size?: Size;
13
+ containerLabel?: string;
14
+ error?: string;
15
+ helpText?: string;
16
+ orientation?: 'vertical' | 'horizontal';
17
+ labelWidth?: string;
18
+ fullWidth?: boolean;
19
+ required?: boolean;
20
+ /**
21
+ * If true, do NOT wrap with InputContainer.
22
+ * Use this inside CheckboxGroup (so you don't get group-form layout per item).
23
+ */
24
+ noContainer?: boolean;
25
+ /** Optional id for accessibility (label htmlFor) */
26
+ id?: string;
27
+ /** Data attributes pass-through */
28
+ 'data-cy'?: string;
29
+ }
30
+ export declare function Checkbox({ checked: controlled, onChange, variant, disabled, label, size, containerLabel, error, helpText, orientation, labelWidth, fullWidth, required, noContainer, id, 'data-cy': dataCy, }: CheckboxProps): JSX.Element;
31
+ export {};
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Check } from 'lucide-react';
4
+ import { useId, useState } from 'react';
5
+ import styles from './Checkbox.module.css';
6
+ import { InputContainer } from '../input-container/InputContainer';
7
+ export function Checkbox({ checked: controlled, onChange, variant = 'outlined', disabled, label, size = 'md', containerLabel, error, helpText, orientation = 'horizontal', labelWidth = '120px', fullWidth = false, required = false, noContainer = false, id, 'data-cy': dataCy, }) {
8
+ const [internal, setInternal] = useState(false);
9
+ const isChecked = controlled !== null && controlled !== void 0 ? controlled : internal;
10
+ const generatedId = useId();
11
+ const controlId = id !== null && id !== void 0 ? id : `checkbox-${generatedId}`;
12
+ const toggle = (e) => {
13
+ if (disabled)
14
+ return;
15
+ const value = !isChecked;
16
+ setInternal(value);
17
+ onChange === null || onChange === void 0 ? void 0 : onChange(value, e);
18
+ };
19
+ const content = (_jsxs("span", { className: styles.container, "data-cy": dataCy, children: [_jsx("button", { id: controlId, disabled: disabled, type: "button", role: "checkbox", "aria-checked": isChecked, "aria-disabled": disabled || undefined, "aria-invalid": Boolean(error) || undefined, onClick: toggle, className: [styles.checkbox, isChecked ? styles.checked : '', styles[variant], styles[size]]
20
+ .filter(Boolean)
21
+ .join(' '), children: isChecked && _jsx(Check, { className: styles.icon }) }), label && (_jsx("label", { className: styles.label, htmlFor: controlId, children: label }))] }));
22
+ // For CheckboxGroup use-case
23
+ if (noContainer || (!containerLabel && !error))
24
+ return content;
25
+ // Standalone form field use-case
26
+ return (_jsx(InputContainer, { label: containerLabel, htmlFor: controlId, error: error, helpText: helpText, orientation: orientation, labelWidth: labelWidth, fullWidth: fullWidth, required: required, children: content }));
27
+ }
@@ -1,7 +1,6 @@
1
1
  .container {
2
2
  display: inline-flex;
3
3
  align-items: center;
4
- justify-content: center;
5
4
  gap: var(--spacing-sm);
6
5
  vertical-align: middle;
7
6
  line-height: 0;
@@ -0,0 +1,47 @@
1
+ import type { JSX } from 'react';
2
+ type Variant = 'default' | 'primary' | 'outlined';
3
+ type Size = 'sm' | 'md' | 'lg';
4
+ export interface CheckboxGroupOption {
5
+ label: string;
6
+ value: string;
7
+ disabled?: boolean;
8
+ }
9
+ interface CheckboxGroupProps {
10
+ /** Label shown before the checkboxes (e.g. "Fejlede i:") */
11
+ label?: string;
12
+ options: CheckboxGroupOption[];
13
+ selectedValues: string[];
14
+ /**
15
+ * Called with the NEXT selectedValues array (so parent can just setState(next)).
16
+ */
17
+ onChange: (nextSelectedValues: string[]) => void;
18
+ /** Optional: called when a single value was toggled */
19
+ onToggle?: (toggledValue: string, isSelected: boolean) => void;
20
+ /** Pass-through styling */
21
+ variant?: Variant;
22
+ size?: Size;
23
+ /** Layout */
24
+ wrap?: boolean;
25
+ fullWidth?: boolean;
26
+ disabled?: boolean;
27
+ /**
28
+ * Renders a compact container row suitable for toolbars:
29
+ * [Label] [Checkboxes...] [Action]
30
+ */
31
+ contained?: boolean;
32
+ /**
33
+ * Right-side action that keeps the same width:
34
+ * - When NOT all enabled options are selected => shows "Alle" and selects all on click
35
+ * - When ALL enabled options are selected => shows "Ryd" and deselects all on click
36
+ */
37
+ actionLabels?: {
38
+ clear?: string;
39
+ all?: string;
40
+ };
41
+ /** Optional hook when action is clicked */
42
+ onActionClick?: (mode: 'clear' | 'all') => void;
43
+ /** Data attributes pass-through */
44
+ 'data-cy'?: string;
45
+ }
46
+ export declare function CheckboxGroup({ label, options, selectedValues, onChange, onToggle, variant, size, wrap, fullWidth, disabled, contained, actionLabels, onActionClick, 'data-cy': dataCy, }: CheckboxGroupProps): JSX.Element;
47
+ export {};
@@ -0,0 +1,75 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from 'react';
4
+ import styles from './CheckboxGroup.module.css';
5
+ import { Checkbox } from '../checkbox/Checkbox';
6
+ export function CheckboxGroup({ label, options, selectedValues, onChange, onToggle, variant = 'outlined', size = 'md', wrap = false, fullWidth = false, disabled = false, contained = true, actionLabels = { clear: 'Ryd', all: 'Alle' }, onActionClick, 'data-cy': dataCy, }) {
7
+ var _a, _b;
8
+ const selectedSet = useMemo(() => new Set(selectedValues), [selectedValues]);
9
+ const enabledValues = useMemo(() => options.filter(o => !(disabled || o.disabled)).map(o => o.value), [options, disabled]);
10
+ const allEnabledSelected = enabledValues.length > 0 && enabledValues.every(v => selectedSet.has(v));
11
+ const toggleValue = (value) => {
12
+ if (disabled)
13
+ return;
14
+ const next = new Set(selectedSet);
15
+ const willSelect = !next.has(value);
16
+ if (willSelect)
17
+ next.add(value);
18
+ else
19
+ next.delete(value);
20
+ onChange(Array.from(next));
21
+ onToggle === null || onToggle === void 0 ? void 0 : onToggle(value, willSelect);
22
+ };
23
+ const selectAll = () => {
24
+ if (disabled)
25
+ return;
26
+ if (enabledValues.length === 0)
27
+ return;
28
+ onChange([...enabledValues]);
29
+ onToggle === null || onToggle === void 0 ? void 0 : onToggle('__select_all__', true);
30
+ };
31
+ const deselectAll = () => {
32
+ if (disabled)
33
+ return;
34
+ onChange([]);
35
+ onToggle === null || onToggle === void 0 ? void 0 : onToggle('__deselect_all__', false);
36
+ };
37
+ const handleAction = () => {
38
+ if (disabled)
39
+ return;
40
+ if (enabledValues.length === 0)
41
+ return;
42
+ if (allEnabledSelected) {
43
+ // currently all -> "Ryd" clears all
44
+ deselectAll();
45
+ onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick('clear');
46
+ }
47
+ else {
48
+ // not all -> "Alle" selects all
49
+ selectAll();
50
+ onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick('all');
51
+ }
52
+ };
53
+ const wrapperClassName = [
54
+ styles.wrapper,
55
+ fullWidth ? styles.fullWidth : '',
56
+ contained ? styles.contained : styles.plain,
57
+ styles[size],
58
+ ]
59
+ .filter(Boolean)
60
+ .join(' ');
61
+ const itemsClassName = [styles.items, wrap ? styles.wrap : styles.noWrap].join(' ');
62
+ // Prevent UI jump by reserving width equal to the longer label.
63
+ const allText = (_a = actionLabels.all) !== null && _a !== void 0 ? _a : 'Alle';
64
+ const clearText = (_b = actionLabels.clear) !== null && _b !== void 0 ? _b : 'Ryd';
65
+ const actionMinWidth = `${Math.max(allText.length, clearText.length)}ch`;
66
+ return (_jsxs("div", { className: wrapperClassName, "data-cy": dataCy, style: { ['--checkboxgroup-action-min-width']: actionMinWidth }, children: [label && _jsx("span", { className: styles.groupLabel, children: label }), _jsx("div", { className: itemsClassName, role: "group", "aria-label": label, children: options.map(opt => {
67
+ const isChecked = selectedSet.has(opt.value);
68
+ const isDisabled = disabled || !!opt.disabled;
69
+ return (_jsx(Checkbox, { label: opt.label, checked: isChecked, disabled: isDisabled, variant: variant, size: size, onChange: () => {
70
+ if (isDisabled)
71
+ return;
72
+ toggleValue(opt.value);
73
+ }, noContainer: true }, opt.value));
74
+ }) }), _jsx("button", { type: "button", className: styles.actionButton, onClick: handleAction, disabled: disabled || enabledValues.length === 0, "aria-disabled": disabled || enabledValues.length === 0, children: _jsx("span", { className: styles.actionText, "data-mode": allEnabledSelected ? 'clear' : 'all', children: allEnabledSelected ? clearText : allText }) })] }));
75
+ }
@@ -0,0 +1,115 @@
1
+ .wrapper {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: var(--spacing-xs);
5
+ flex-direction: row; /* keep on one line */
6
+ }
7
+
8
+ .fullWidth {
9
+ width: 100%;
10
+ }
11
+
12
+ /* Heights aligned with other controls */
13
+ .xs {
14
+ min-height: var(--component-size-xs);
15
+ }
16
+
17
+ .sm {
18
+ min-height: var(--component-size-sm);
19
+ }
20
+
21
+ .md {
22
+ min-height: var(--component-size-md);
23
+ }
24
+
25
+ .lg {
26
+ min-height: var(--component-size-lg);
27
+ }
28
+
29
+ /* Subtle container (lightweight) */
30
+ .contained {
31
+ padding: 0 var(--spacing-xs);
32
+ border: var(--border-width-thin) solid var(--color-border-subtle);
33
+ border-radius: var(--border-radius-md);
34
+ background: var(--color-bg-surface);
35
+ }
36
+
37
+ .plain {
38
+ padding: 0;
39
+ border: 0;
40
+ background: transparent;
41
+ }
42
+
43
+ .groupLabel {
44
+ font-weight: var(--font-weight-medium);
45
+ color: var(--color-fg-muted);
46
+ white-space: nowrap;
47
+ font-size: var(--font-size-sm);
48
+ line-height: var(--line-height-tight);
49
+ }
50
+
51
+ .items {
52
+ display: flex;
53
+ align-items: center;
54
+ gap: var(--spacing-xs);
55
+ flex: 1 1 auto;
56
+ min-width: 0;
57
+ }
58
+
59
+ .wrap {
60
+ flex-wrap: wrap;
61
+ }
62
+
63
+ .noWrap {
64
+ flex-wrap: nowrap;
65
+ }
66
+
67
+ /* Right action */
68
+ .actionButton {
69
+ appearance: none;
70
+ border: none;
71
+ background: transparent;
72
+ padding: 0;
73
+ margin-left: auto;
74
+ cursor: pointer;
75
+
76
+ display: inline-flex;
77
+ align-items: center;
78
+
79
+ height: 100%;
80
+ }
81
+
82
+ .actionButton:disabled {
83
+ cursor: not-allowed;
84
+ }
85
+
86
+ .actionText {
87
+ display: inline-block;
88
+ font-size: var(--font-size-sm);
89
+ line-height: var(--line-height-tight);
90
+ font-weight: var(--font-weight-medium);
91
+ white-space: nowrap;
92
+ text-align: right;
93
+
94
+ min-width: var(--checkboxgroup-action-min-width, 4ch);
95
+ color: var(--color-link);
96
+ }
97
+
98
+ .actionText[data-mode='all'] {
99
+ color: var(--color-link);
100
+ }
101
+
102
+ .actionText[data-mode='clear'] {
103
+ color: var(--color-link);
104
+ }
105
+
106
+ .actionButton:not(:disabled):hover .actionText {
107
+ color: var(--color-link-hover);
108
+ text-decoration: underline;
109
+ }
110
+
111
+ .actionButton:focus-visible {
112
+ outline: 2px solid var(--color-border-strong);
113
+ outline-offset: 3px;
114
+ border-radius: var(--border-radius-rounded);
115
+ }
@@ -1,18 +1,22 @@
1
1
  import * as React from 'react';
2
- import type { Size } from '../../types/sizes.types';
2
+ import type { Size } from '../../../types/sizes.types';
3
+ import type { InputContainerProps } from '../input-container/InputContainer';
3
4
  export type InputVariant = 'outlined' | 'filled' | 'standalone';
4
- export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
5
- label?: string;
5
+ export type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'width'> & Omit<InputContainerProps, 'children' | 'htmlFor' | 'tooltip' | 'tooltipPlacement'> & {
6
6
  icon?: React.ReactNode;
7
7
  autoFocus?: boolean;
8
8
  minWidth?: string | number;
9
9
  width?: string | number;
10
- fullWidth?: boolean;
11
10
  inputSize?: Size;
12
11
  variant?: InputVariant;
13
12
  onClear?: () => void;
14
13
  onButtonClick?: () => void;
15
14
  buttonLabel?: string;
16
15
  buttonIcon?: React.ReactNode;
17
- }
16
+ tooltip?: React.ReactNode;
17
+ tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';
18
+ };
19
+ /**
20
+ * Explicit exported type annotation is required with --isolatedDeclarations.
21
+ */
18
22
  export declare const Input: React.ForwardRefExoticComponent<React.PropsWithoutRef<InputProps> & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,70 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef, useEffect, useId, useRef } from 'react';
4
+ import { Button } from '../../../components/button/Button';
5
+ import { ClearButton } from '../../../components/clear-button/ClearButton';
6
+ import { useTooltipTrigger } from '../../../components/overlay/tooltip/useTooltipTrigger';
7
+ import styles from '../input/Input.module.css';
8
+ import { InputContainer } from '../input-container/InputContainer';
9
+ function mergeRefs(...refs) {
10
+ return (node) => {
11
+ for (const ref of refs) {
12
+ if (!ref)
13
+ continue;
14
+ if (typeof ref === 'function')
15
+ ref(node);
16
+ else
17
+ ref.current = node;
18
+ }
19
+ };
20
+ }
21
+ /**
22
+ * Explicit exported type annotation is required with --isolatedDeclarations.
23
+ */
24
+ export const Input = forwardRef(function Input({
25
+ // InputContainer props
26
+ label, error, helpText, orientation = 'horizontal', labelWidth = '120px', fullWidth = false, required,
27
+ // ✅ Input-level tooltip props
28
+ tooltip, tooltipPlacement = 'right',
29
+ // Input-only props
30
+ icon, autoFocus, minWidth, width, inputSize = 'md', variant = 'outlined', onClear, onButtonClick, buttonLabel, buttonIcon,
31
+ // Native input props
32
+ id, style, className, ...inputProps }, ref) {
33
+ const inputRef = useRef(null);
34
+ const reactId = useId();
35
+ const inputId = id !== null && id !== void 0 ? id : `input-${reactId}`;
36
+ useEffect(() => {
37
+ var _a;
38
+ if (autoFocus)
39
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
40
+ }, [autoFocus]);
41
+ const hasButton = Boolean(onButtonClick || buttonLabel || buttonIcon);
42
+ const rootStyle = {
43
+ ...(style !== null && style !== void 0 ? style : {}),
44
+ ...(minWidth ? { ['--input-min-width']: minWidth } : null),
45
+ ...(width ? { ['--input-width']: width } : null),
46
+ };
47
+ // Anchor tooltip to the stable "field" wrapper (input + icon + clear button)
48
+ const { triggerProps } = useTooltipTrigger({
49
+ content: tooltip,
50
+ placement: tooltipPlacement,
51
+ offset: 8,
52
+ });
53
+ return (_jsx(InputContainer, { label: label, htmlFor: inputId, fullWidth: fullWidth, error: error, helpText: helpText, orientation: orientation, labelWidth: labelWidth, required: required, children: _jsxs("div", { style: rootStyle, className: [
54
+ styles.container,
55
+ fullWidth ? styles.fullWidth : '',
56
+ onClear ? styles.withClear : '',
57
+ hasButton ? styles.withButton : '',
58
+ className !== null && className !== void 0 ? className : '',
59
+ ]
60
+ .filter(Boolean)
61
+ .join(' '), children: [_jsxs("div", { className: styles.field, ...(tooltip ? triggerProps : {}), children: [icon && _jsx("span", { className: styles.icon, children: icon }), _jsx("input", { ...inputProps, id: inputId, ref: mergeRefs(inputRef, ref), className: [
62
+ styles.input,
63
+ icon ? styles.inputWithIcon : '',
64
+ inputSize ? styles[inputSize] : '',
65
+ styles[variant],
66
+ ]
67
+ .filter(Boolean)
68
+ .join(' ') }), onClear && inputProps.value && _jsx(ClearButton, { onClick: onClear, absolute: true })] }), hasButton && (_jsxs(Button, { onClick: onButtonClick, className: styles.trailingButton, type: "button", children: [buttonIcon !== null && buttonIcon !== void 0 ? buttonIcon : null, buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : null] }))] }) }));
69
+ });
70
+ Input.displayName = 'Input';
@@ -73,6 +73,7 @@
73
73
  .input:hover {
74
74
  border-color: var(--color-border-strong);
75
75
  }
76
+
76
77
  .input:focus-visible {
77
78
  outline: none;
78
79
  border-color: var(--color-border-selected);
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export interface InputContainerProps {
3
+ label?: string;
4
+ htmlFor?: string;
5
+ error?: string;
6
+ helpText?: string;
7
+ helpTextAddition?: string;
8
+ fullWidth?: boolean;
9
+ required?: boolean;
10
+ children: React.ReactNode;
11
+ orientation?: 'vertical' | 'horizontal';
12
+ labelWidth?: string;
13
+ labelAlignment?: 'top' | 'center';
14
+ }
15
+ export declare function InputContainer({ label, htmlFor, error, helpText, helpTextAddition, fullWidth, required, children, orientation, labelWidth, }: InputContainerProps): React.ReactElement;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styles from './InputContainer.module.css';
3
+ export function InputContainer({ label, htmlFor, error, helpText, helpTextAddition, fullWidth = false, required = false, children, orientation = 'horizontal', labelWidth = '120px', }) {
4
+ const message = error !== null && error !== void 0 ? error : helpText;
5
+ const messageClass = error ? styles.errorText : styles.helpText;
6
+ const renderLabel = label && (_jsxs("label", { className: styles.label, htmlFor: htmlFor, children: [label, required && _jsx("span", { className: styles.required, children: " *" })] }));
7
+ const renderMessageRow = (message || helpTextAddition) && (_jsxs("div", { className: `${messageClass} ${styles.messageRow}`, children: [_jsx("span", { children: message }), helpTextAddition && _jsx("span", { className: styles.helpTextAddition, children: helpTextAddition })] }));
8
+ if (orientation === 'vertical') {
9
+ return (_jsxs("div", { className: "dbc-flex dbc-flex-column dbc-gap-xs", style: { width: fullWidth ? '100%' : undefined }, children: [renderLabel, children, renderMessageRow] }));
10
+ }
11
+ return (_jsx("div", { className: styles.inputContainer, style: {
12
+ '--label-width': labelWidth,
13
+ width: fullWidth ? '100%' : undefined,
14
+ }, children: _jsxs("div", { className: `${styles.horizontal} dbc-flex dbc-flex-column dbc-gap-xs`, children: [_jsxs("div", { className: `${styles.labelContainer} dbc-flex dbc-items-center dbc-gap-xs`, children: [renderLabel, children] }), renderMessageRow] }) }));
15
+ }
@@ -0,0 +1,34 @@
1
+ .horizontal {
2
+ --gap: var(--spacing-sm);
3
+ }
4
+
5
+ .labelContainer {
6
+ gap: var(--gap);
7
+ }
8
+
9
+ .horizontal .errorText,
10
+ .horizontal .helpText {
11
+ margin-left: calc(var(--label-width) + var(--gap));
12
+ }
13
+
14
+ .helpText {
15
+ color: var(--color-fg-subtle);
16
+ font-size: var(--font-size-sm);
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: space-between;
20
+ }
21
+
22
+ .horizontal label {
23
+ width: var(--label-width);
24
+ }
25
+
26
+ .errorText {
27
+ color: var(--color-status-error);
28
+ font-size: var(--font-size-sm);
29
+ }
30
+
31
+ .required {
32
+ color: var(--color-status-error);
33
+ font-weight: bold;
34
+ }
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ import { ButtonVariant } from '../../../components/button/Button';
3
+ export interface MultiselectOption<T> {
4
+ label: string;
5
+ value: T;
6
+ icon?: ReactNode;
7
+ }
8
+ interface MultiSelectProps<T> {
9
+ options: MultiselectOption<T>[];
10
+ selectedValues: T[];
11
+ onChange: (selectedValue: T) => void;
12
+ placeholder?: string;
13
+ children?: ReactNode;
14
+ variant?: ButtonVariant;
15
+ size?: 'sm' | 'md' | 'lg';
16
+ onClear?: () => void;
17
+ dataCy?: string;
18
+ }
19
+ export declare function MultiSelect<T extends string | number>({ options, selectedValues, onChange, children, variant, size, onClear, dataCy, }: MultiSelectProps<T>): ReactNode;
20
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check, Square } from 'lucide-react';
3
+ import { Button } from '../../../components/button/Button';
4
+ import { Chip } from '../../../components/chip/Chip';
5
+ import { ClearButton } from '../../../components/clear-button/ClearButton';
6
+ import { Menu } from '../../../components/menu/Menu';
7
+ import { Popover } from '../../../components/popover/Popover';
8
+ export function MultiSelect({ options, selectedValues = [], onChange, children, variant = 'outlined', size = 'md', onClear, dataCy, }) {
9
+ return (_jsx(Popover, { dataCy: dataCy, trigger: (onClick, icon) => (_jsxs(Button, { variant: variant, onClick: onClick, size: size, children: [_jsxs("span", { children: [children || 'Vælg', ' ', selectedValues.length > 0 ? (_jsx(Chip, { size: "sm", severity: "info", children: `${selectedValues.length}` })) : null] }), onClear && selectedValues.length > 0 && _jsx(ClearButton, { onClick: onClear }), icon] })), children: _jsx(Menu, { children: options.map(option => (_jsx(Menu.Item, { active: selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.includes(option.value), children: _jsxs("button", { onClick: () => {
10
+ onChange(option.value);
11
+ }, children: [_jsx("span", { style: {
12
+ pointerEvents: 'none',
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ color: !(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.includes(option.value))
16
+ ? 'var(--color-border-strong)'
17
+ : 'inherit',
18
+ }, children: (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.includes(option.value)) ? _jsx(Check, {}) : _jsx(Square, {}) }), option.label] }) }, option.value))) }) }));
19
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { ButtonVariant } from '../../button/Button';
3
+ import { InputContainer } from '../input-container/InputContainer';
4
+ import { MultiselectOption } from '../multi-select/MultiSelect';
5
+ type InputContainerProps = React.ComponentProps<typeof InputContainer>;
6
+ export type SelectProps<T> = Omit<InputContainerProps, 'children' | 'htmlFor' | 'tooltip' | 'tooltipPlacement'> & {
7
+ id?: string;
8
+ options: MultiselectOption<T>[];
9
+ selectedValue: T | null;
10
+ onChange: (value: T) => void;
11
+ placeholder?: string;
12
+ size?: 'sm' | 'md' | 'lg';
13
+ variant?: ButtonVariant;
14
+ onClear?: () => void;
15
+ datakey?: string;
16
+ dataCy?: string;
17
+ tooltip?: React.ReactNode;
18
+ tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';
19
+ };
20
+ export declare function Select<T extends string | number | Record<string, any>>({ label, error, helpText, orientation, labelWidth, fullWidth, required, tooltip, tooltipPlacement, id, options, selectedValue, onChange, placeholder, size, variant, onClear, datakey, dataCy, }: SelectProps<T>): React.ReactNode;
21
+ export {};