@dbcdk/react-components 0.0.5 → 0.0.6

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 (272) 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 +364 -459
  36. package/dist/components/filter-field/FilterField.d.ts +5 -2
  37. package/dist/components/filter-field/FilterField.js +130 -173
  38. package/dist/components/filter-field/FilterField.module.css +21 -5
  39. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +36 -0
  40. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +53 -0
  41. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +60 -0
  42. package/dist/components/forms/checkbox/Checkbox.d.ts +31 -0
  43. package/dist/components/forms/checkbox/Checkbox.js +27 -0
  44. package/dist/components/{checkbox → forms/checkbox}/Checkbox.module.css +0 -1
  45. package/dist/components/forms/checkbox-group/CheckboxGroup.d.ts +47 -0
  46. package/dist/components/forms/checkbox-group/CheckboxGroup.js +75 -0
  47. package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +115 -0
  48. package/dist/components/{input → forms/input}/Input.d.ts +9 -5
  49. package/dist/components/forms/input/Input.js +70 -0
  50. package/dist/components/{input → forms/input}/Input.module.css +1 -0
  51. package/dist/components/forms/input-container/InputContainer.d.ts +15 -0
  52. package/dist/components/forms/input-container/InputContainer.js +15 -0
  53. package/dist/components/forms/input-container/InputContainer.module.css +34 -0
  54. package/dist/components/forms/multi-select/MultiSelect.d.ts +20 -0
  55. package/dist/components/forms/multi-select/MultiSelect.js +19 -0
  56. package/dist/components/forms/select/Select.d.ts +21 -0
  57. package/dist/components/forms/select/Select.js +94 -0
  58. package/dist/components/forms/text-area/Textarea.d.ts +17 -0
  59. package/dist/components/forms/text-area/Textarea.js +33 -0
  60. package/dist/components/forms/text-area/Textarea.module.css +26 -0
  61. package/dist/components/headline/Headline.js +18 -43
  62. package/dist/components/{link/Link.d.ts → hyperlink/Hyperlink.d.ts} +2 -2
  63. package/dist/components/hyperlink/Hyperlink.js +11 -0
  64. package/dist/components/{link/Link.module.css → hyperlink/Hyperlink.module.css} +5 -14
  65. package/dist/components/icon/Icon.d.ts +4 -3
  66. package/dist/components/icon/Icon.js +11 -17
  67. package/dist/components/menu/Menu.js +25 -67
  68. package/dist/components/meta-bar/MetaBar.d.ts +4 -4
  69. package/dist/components/meta-bar/MetaBar.js +7 -20
  70. package/dist/components/nav-bar/NavBar.d.ts +5 -5
  71. package/dist/components/nav-bar/NavBar.js +15 -45
  72. package/dist/components/{modal → overlay/modal}/Modal.d.ts +4 -2
  73. package/dist/components/overlay/modal/Modal.js +92 -0
  74. package/dist/components/{modal → overlay/modal}/provider/ModalProvider.d.ts +0 -1
  75. package/dist/components/overlay/modal/provider/ModalProvider.js +70 -0
  76. package/dist/components/overlay/side-panel/SidePanel.d.ts +16 -0
  77. package/dist/components/overlay/side-panel/SidePanel.js +10 -0
  78. package/dist/components/overlay/side-panel/SidePanel.module.css +56 -0
  79. package/dist/components/overlay/side-panel/useSidePanel.d.ts +5 -0
  80. package/dist/components/overlay/side-panel/useSidePanel.js +11 -0
  81. package/dist/components/overlay/tooltip/Tooltip.d.ts +13 -0
  82. package/dist/components/overlay/tooltip/Tooltip.js +17 -0
  83. package/dist/components/overlay/tooltip/Tooltip.module.css +106 -0
  84. package/dist/components/overlay/tooltip/TooltipProvider.d.ts +20 -0
  85. package/dist/components/overlay/tooltip/TooltipProvider.js +244 -0
  86. package/dist/components/overlay/tooltip/useTooltipTrigger.d.ts +24 -0
  87. package/dist/components/overlay/tooltip/useTooltipTrigger.js +108 -0
  88. package/dist/components/page/Page.d.ts +7 -6
  89. package/dist/components/page/Page.js +4 -21
  90. package/dist/components/page-layout/PageLayout.d.ts +11 -12
  91. package/dist/components/page-layout/PageLayout.js +35 -71
  92. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +4 -22
  93. package/dist/components/pagination/Pagination.d.ts +2 -1
  94. package/dist/components/pagination/Pagination.js +38 -121
  95. package/dist/components/panel/Panel.d.ts +4 -3
  96. package/dist/components/panel/Panel.js +5 -10
  97. package/dist/components/popover/Popover.d.ts +1 -0
  98. package/dist/components/popover/Popover.js +116 -141
  99. package/dist/components/search-box/SearchBox.d.ts +2 -2
  100. package/dist/components/search-box/SearchBox.js +112 -162
  101. package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +1 -1
  102. package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +47 -94
  103. package/dist/components/sidebar/Sidebar.d.ts +1 -0
  104. package/dist/components/sidebar/Sidebar.js +5 -7
  105. package/dist/components/sidebar/components/SidebarItem.js +6 -14
  106. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +1 -1
  107. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +48 -88
  108. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +3 -2
  109. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +11 -41
  110. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +1 -0
  111. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +4 -25
  112. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +9 -23
  113. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +19 -40
  114. package/dist/components/sidebar/providers/SidebarProvider.d.ts +2 -1
  115. package/dist/components/sidebar/providers/SidebarProvider.js +182 -165
  116. package/dist/components/skeleton-loader/SkeletonLoader.js +68 -266
  117. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +11 -34
  118. package/dist/components/split-button/SplitButton.d.ts +7 -5
  119. package/dist/components/split-button/SplitButton.js +4 -27
  120. package/dist/components/split-pane/SplitPane.js +69 -105
  121. package/dist/components/split-pane/provider/SplitPaneContext.js +77 -71
  122. package/dist/components/table/Table.d.ts +9 -7
  123. package/dist/components/table/Table.js +115 -238
  124. package/dist/components/table/Table.module.css +5 -1
  125. package/dist/components/table/components/column-resizer/ColumnResizer.js +4 -15
  126. package/dist/components/table/components/empty-state/EmptyState.d.ts +6 -5
  127. package/dist/components/table/components/empty-state/EmptyState.js +22 -41
  128. package/dist/components/table/components/table-settings/TableSettings.d.ts +2 -1
  129. package/dist/components/table/components/table-settings/TableSettings.js +9 -27
  130. package/dist/components/table/tanstack.d.ts +1 -1
  131. package/dist/components/table/tanstack.js +154 -160
  132. package/dist/components/tabs/Tabs.d.ts +1 -0
  133. package/dist/components/tabs/Tabs.js +32 -81
  134. package/dist/components/toast/Toast.d.ts +1 -1
  135. package/dist/components/toast/Toast.js +4 -37
  136. package/dist/components/toast/Toast.module.css +1 -0
  137. package/dist/components/toast/provider/ToastProvider.d.ts +1 -1
  138. package/dist/components/toast/provider/ToastProvider.js +60 -87
  139. package/dist/components/user-display/UserDisplay.d.ts +2 -1
  140. package/dist/components/user-display/UserDisplay.js +4 -20
  141. package/dist/constants/severity.d.ts +1 -1
  142. package/dist/constants/severity.js +14 -16
  143. package/dist/constants/severity.types.d.ts +1 -1
  144. package/dist/constants/severity.types.js +1 -1
  145. package/dist/constants/sizes.js +6 -8
  146. package/dist/hooks/usePagination.d.ts +1 -1
  147. package/dist/hooks/usePagination.js +75 -82
  148. package/dist/hooks/useSorting.js +112 -110
  149. package/dist/hooks/useTableData.d.ts +1 -1
  150. package/dist/hooks/useTableData.js +42 -47
  151. package/dist/hooks/useTableSelection.js +121 -121
  152. package/dist/hooks/useTableSettings.js +23 -25
  153. package/dist/hooks/useTheme.d.ts +3 -7
  154. package/dist/hooks/useTheme.js +52 -47
  155. package/dist/hooks/useTimeDuration.d.ts +2 -2
  156. package/dist/hooks/useTimeDuration.js +33 -34
  157. package/dist/hooks/useViewportFill.d.ts +3 -2
  158. package/dist/hooks/useViewportFill.js +55 -48
  159. package/dist/index.d.ts +17 -8
  160. package/dist/index.js +18 -8
  161. package/dist/src/styles/styles.css +3 -3
  162. package/dist/styles/css-helper-classes/flex.css +4 -0
  163. package/dist/styles/styles.css +3 -3
  164. package/dist/styles/themes/dbc/dark.css +1 -1
  165. package/dist/styles/themes/dbc/light.css +2 -1
  166. package/dist/styles/themes/forfatterweb/light.css +1 -1
  167. package/dist/styles/themes/types.js +1 -1
  168. package/dist/types/a11y-props.types.d.ts +5 -5
  169. package/dist/types/a11y-props.types.js +1 -1
  170. package/dist/types/sizes.types.js +1 -1
  171. package/dist/utils/arrays/nested-filtering.js +43 -33
  172. package/dist/utils/date/formatDate.js +25 -16
  173. package/package.json +18 -9
  174. package/dist/assets/logo.cjs +0 -87
  175. package/dist/components/__stories__/story-components/Colors.cjs +0 -159
  176. package/dist/components/__stories__/story-components/Spacing.cjs +0 -190
  177. package/dist/components/app-header/AppHeader.cjs +0 -14
  178. package/dist/components/attribute-chip/AttributeChip.cjs +0 -22
  179. package/dist/components/avatar/Avatar.cjs +0 -101
  180. package/dist/components/breadcrumbs/Breadcrumbs.cjs +0 -22
  181. package/dist/components/button/Button.cjs +0 -87
  182. package/dist/components/card/Card.cjs +0 -69
  183. package/dist/components/card-container/CardContainer.cjs +0 -24
  184. package/dist/components/checkbox/Checkbox.cjs +0 -42
  185. package/dist/components/checkbox/Checkbox.d.ts +0 -12
  186. package/dist/components/checkbox/Checkbox.js +0 -36
  187. package/dist/components/chip/Chip.cjs +0 -50
  188. package/dist/components/circle/Circle.cjs +0 -18
  189. package/dist/components/clear-button/ClearButton.cjs +0 -26
  190. package/dist/components/code-block/CodeBlock.cjs +0 -18
  191. package/dist/components/copy-button/CopyButton.cjs +0 -35
  192. package/dist/components/datetime-picker/DateTimePicker.cjs +0 -504
  193. package/dist/components/filter-field/FilterField.cjs +0 -189
  194. package/dist/components/headline/Headline.cjs +0 -53
  195. package/dist/components/icon/Icon.cjs +0 -27
  196. package/dist/components/input/Input.cjs +0 -89
  197. package/dist/components/input/Input.js +0 -83
  198. package/dist/components/link/Link.cjs +0 -46
  199. package/dist/components/link/Link.js +0 -21
  200. package/dist/components/menu/Menu.cjs +0 -96
  201. package/dist/components/meta-bar/MetaBar.cjs +0 -29
  202. package/dist/components/modal/Modal.cjs +0 -134
  203. package/dist/components/modal/Modal.js +0 -128
  204. package/dist/components/modal/provider/ModalProvider.cjs +0 -80
  205. package/dist/components/modal/provider/ModalProvider.js +0 -77
  206. package/dist/components/multi-select/MultiSelect.cjs +0 -59
  207. package/dist/components/multi-select/MultiSelect.d.ts +0 -18
  208. package/dist/components/multi-select/MultiSelect.js +0 -57
  209. package/dist/components/nav-bar/NavBar.cjs +0 -55
  210. package/dist/components/page/Page.cjs +0 -30
  211. package/dist/components/page-layout/PageLayout.cjs +0 -84
  212. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.cjs +0 -32
  213. package/dist/components/pagination/Pagination.cjs +0 -133
  214. package/dist/components/panel/Panel.cjs +0 -18
  215. package/dist/components/popover/Popover.cjs +0 -149
  216. package/dist/components/search-box/SearchBox.cjs +0 -175
  217. package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +0 -103
  218. package/dist/components/select/Select.cjs +0 -121
  219. package/dist/components/select/Select.d.ts +0 -12
  220. package/dist/components/select/Select.js +0 -119
  221. package/dist/components/sidebar/Sidebar.cjs +0 -11
  222. package/dist/components/sidebar/components/SidebarItem.cjs +0 -18
  223. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +0 -100
  224. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +0 -50
  225. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +0 -34
  226. package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +0 -29
  227. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +0 -52
  228. package/dist/components/sidebar/providers/SidebarProvider.cjs +0 -179
  229. package/dist/components/skeleton-loader/SkeletonLoader.cjs +0 -270
  230. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +0 -42
  231. package/dist/components/split-button/SplitButton.cjs +0 -37
  232. package/dist/components/split-pane/SplitPane.cjs +0 -123
  233. package/dist/components/split-pane/provider/SplitPaneContext.cjs +0 -87
  234. package/dist/components/table/Table.cjs +0 -249
  235. package/dist/components/table/components/column-resizer/ColumnResizer.cjs +0 -22
  236. package/dist/components/table/components/empty-state/EmptyState.cjs +0 -52
  237. package/dist/components/table/components/table-settings/TableSettings.cjs +0 -32
  238. package/dist/components/table/tanstack.cjs +0 -193
  239. package/dist/components/tabs/Tabs.cjs +0 -90
  240. package/dist/components/text-area/Textarea.cjs +0 -62
  241. package/dist/components/text-area/Textarea.d.ts +0 -14
  242. package/dist/components/text-area/Textarea.js +0 -56
  243. package/dist/components/text-area/Textarea.module.css +0 -3
  244. package/dist/components/toast/Toast.cjs +0 -47
  245. package/dist/components/toast/provider/ToastProvider.cjs +0 -98
  246. package/dist/components/tooltip/Tooltip.cjs +0 -183
  247. package/dist/components/tooltip/Tooltip.d.ts +0 -11
  248. package/dist/components/tooltip/Tooltip.js +0 -177
  249. package/dist/components/tooltip/Tooltip.module.css +0 -66
  250. package/dist/components/user-display/UserDisplay.cjs +0 -28
  251. package/dist/constants/severity.cjs +0 -21
  252. package/dist/constants/severity.types.cjs +0 -2
  253. package/dist/constants/sizes.cjs +0 -11
  254. package/dist/hooks/usePagination.cjs +0 -88
  255. package/dist/hooks/useSorting.cjs +0 -118
  256. package/dist/hooks/useTableData.cjs +0 -52
  257. package/dist/hooks/useTableSelection.cjs +0 -130
  258. package/dist/hooks/useTableSettings.cjs +0 -28
  259. package/dist/hooks/useTheme.cjs +0 -58
  260. package/dist/hooks/useTimeDuration.cjs +0 -39
  261. package/dist/hooks/useViewportFill.cjs +0 -52
  262. package/dist/index.cjs +0 -383
  263. package/dist/styles/themes/types.cjs +0 -2
  264. package/dist/types/a11y-props.types.cjs +0 -2
  265. package/dist/types/assets.d.cjs +0 -2
  266. package/dist/types/assets.d.js +0 -1
  267. package/dist/types/css.d.cjs +0 -2
  268. package/dist/types/css.d.js +0 -1
  269. package/dist/types/sizes.types.cjs +0 -2
  270. package/dist/utils/arrays/nested-filtering.cjs +0 -40
  271. package/dist/utils/date/formatDate.cjs +0 -19
  272. /package/dist/components/{modal → overlay/modal}/Modal.module.css +0 -0
@@ -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 {};
@@ -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
+ }