@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
@@ -1,184 +1,76 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CopyButton } from '../../../components/copy-button/CopyButton';
3
+ import { Headline } from '../../../components/headline/Headline';
2
4
  import styles from './Spacing.module.css';
3
- import { Headline } from '@/components/headline/Headline';
4
- import { CopyButton } from '@/components/copy-button/CopyButton';
5
-
6
- const SIZES = ["xxs", "xs", "sm", "md", "lg", "xl", "2xl"];
7
- const AXES = ["all", "block", "inline", "top", "bottom", "start", "end"];
5
+ const SIZES = ['xxs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'];
6
+ const AXES = ['all', 'block', 'inline', 'top', 'bottom', 'start', 'end'];
7
+ // Theme spacing values (px) to show in headers
8
8
  const SIZE_PX = {
9
- xxs: "4px",
10
- xs: "8px",
11
- sm: "12px",
12
- md: "16px",
13
- lg: "24px",
14
- xl: "32px",
15
- "2xl": "48px"
9
+ xxs: '4px',
10
+ xs: '8px',
11
+ sm: '12px',
12
+ md: '16px',
13
+ lg: '24px',
14
+ xl: '32px',
15
+ '2xl': '48px',
16
16
  };
17
+ // map axis -> class fragment for each kind
17
18
  const CLASS_PARTS = {
18
- padding: {
19
- all: "p",
20
- block: "py",
21
- inline: "px",
22
- top: "pt",
23
- bottom: "pb",
24
- start: "ps",
25
- end: "pe"
26
- },
27
- margin: {
28
- all: "m",
29
- block: "my",
30
- inline: "mx",
31
- top: "mt",
32
- bottom: "mb",
33
- start: "ms",
34
- end: "me"
35
- }
19
+ padding: {
20
+ all: 'p',
21
+ block: 'py',
22
+ inline: 'px',
23
+ top: 'pt',
24
+ bottom: 'pb',
25
+ start: 'ps',
26
+ end: 'pe',
27
+ },
28
+ margin: {
29
+ all: 'm',
30
+ block: 'my',
31
+ inline: 'mx',
32
+ top: 'mt',
33
+ bottom: 'mb',
34
+ start: 'ms',
35
+ end: 'me',
36
+ },
36
37
  };
37
- const HAS_SINGLE_SIDE_FOR = (size) => size !== "2xl";
38
+ // Single-side helpers only go up to xl
39
+ const HAS_SINGLE_SIDE_FOR = (size) => size !== '2xl';
38
40
  function makeClass(kind, axis, size) {
39
- if ((axis === "top" || axis === "bottom" || axis === "start" || axis === "end") && !HAS_SINGLE_SIDE_FOR(size)) {
40
- return null;
41
- }
42
- const part = CLASS_PARTS[kind][axis];
43
- return `dbc-${part}-${size}`;
41
+ if ((axis === 'top' || axis === 'bottom' || axis === 'start' || axis === 'end') &&
42
+ !HAS_SINGLE_SIDE_FOR(size)) {
43
+ return null;
44
+ }
45
+ const part = CLASS_PARTS[kind][axis];
46
+ return `dbc-${part}-${size}`;
44
47
  }
45
48
  function Code({ children }) {
46
- return /* @__PURE__ */ jsx("code", { className: styles.code, children });
49
+ return _jsx("code", { className: styles.code, children: children });
47
50
  }
48
- const ContentBlock = ({ helperClass }) => /* @__PURE__ */ jsxs(
49
- "div",
50
- {
51
- className: `${styles.contentBlock} dbc-flex dbc-gap-xxs dbc-justify-center ${helperClass} dbc-items-center`,
52
- children: [
53
- helperClass,
54
- " ",
55
- /* @__PURE__ */ jsx(CopyButton, { text: helperClass, variant: "inline", size: "sm" })
56
- ]
57
- }
58
- );
51
+ const ContentBlock = ({ helperClass }) => (_jsxs("div", { className: `${styles.contentBlock} dbc-flex dbc-gap-xxs dbc-justify-center ${helperClass} dbc-items-center`, children: [helperClass, " ", _jsx(CopyButton, { text: helperClass, variant: "inline", size: "sm" })] }));
59
52
  function PaddingPreview({ cls }) {
60
- return /* @__PURE__ */ jsx("div", { className: `${styles.paddingPreview} ${cls}`, children: /* @__PURE__ */ jsx(ContentBlock, { helperClass: cls }) });
53
+ return (_jsx("div", { className: `${styles.paddingPreview} ${cls}`, children: _jsx(ContentBlock, { helperClass: cls }) }));
61
54
  }
62
55
  function MarginPreview({ cls }) {
63
- return /* @__PURE__ */ jsx("div", { className: styles.marginCanvas, children: /* @__PURE__ */ jsx("div", { className: `${styles.marginBlock} ${cls}`, children: /* @__PURE__ */ jsx(ContentBlock, { helperClass: cls }) }) });
56
+ return (_jsx("div", { className: styles.marginCanvas, children: _jsx("div", { className: `${styles.marginBlock} ${cls}`, children: _jsx(ContentBlock, { helperClass: cls }) }) }));
64
57
  }
65
58
  function Cell({ kind, axis, size }) {
66
- const cls = makeClass(kind, axis, size);
67
- if (!cls) return /* @__PURE__ */ jsx("div", { className: styles.unavailable, children: "\u2014" });
68
- return /* @__PURE__ */ jsx("div", { className: styles.cellInner, children: /* @__PURE__ */ jsx("div", { className: styles.cellPreview, children: kind === "padding" ? /* @__PURE__ */ jsx(PaddingPreview, { cls }) : /* @__PURE__ */ jsx(MarginPreview, { cls }) }) });
59
+ const cls = makeClass(kind, axis, size);
60
+ if (!cls)
61
+ return _jsx("div", { className: styles.unavailable, children: "\u2014" });
62
+ return (_jsx("div", { className: styles.cellInner, children: _jsx("div", { className: styles.cellPreview, children: kind === 'padding' ? _jsx(PaddingPreview, { cls: cls }) : _jsx(MarginPreview, { cls: cls }) }) }));
69
63
  }
70
64
  function Grid({ kind, title, severity }) {
71
- return /* @__PURE__ */ jsxs("section", { className: styles.section, children: [
72
- /* @__PURE__ */ jsx(Headline, { marker: true, severity, disableMargin: true, size: 2, children: title }),
73
- /* @__PURE__ */ jsx("div", { className: styles.tableContainer, children: /* @__PURE__ */ jsxs("table", { className: styles.table, children: [
74
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
75
- /* @__PURE__ */ jsx("th", { className: styles.axisCol, children: "Axis" }),
76
- SIZES.map((size) => /* @__PURE__ */ jsxs("th", { className: styles.sizeHead, children: [
77
- size,
78
- " ",
79
- /* @__PURE__ */ jsxs("span", { className: styles.sizePx, children: [
80
- "(",
81
- SIZE_PX[size],
82
- ")"
83
- ] })
84
- ] }, size))
85
- ] }) }),
86
- /* @__PURE__ */ jsx("tbody", { children: AXES.map((axis) => /* @__PURE__ */ jsxs("tr", { children: [
87
- /* @__PURE__ */ jsx("th", { className: styles.axisHead, children: axis }),
88
- SIZES.map((size) => /* @__PURE__ */ jsx("td", { className: styles.cell, children: /* @__PURE__ */ jsx(Cell, { kind, axis, size }) }, size))
89
- ] }, axis)) })
90
- ] }) })
91
- ] });
65
+ return (_jsxs("section", { className: styles.section, children: [_jsx(Headline, { marker: true, severity: severity, disableMargin: true, size: 2, children: title }), _jsx("div", { className: styles.tableContainer, children: _jsxs("table", { className: styles.table, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: styles.axisCol, children: "Axis" }), SIZES.map(size => (_jsxs("th", { className: styles.sizeHead, children: [size, " ", _jsxs("span", { className: styles.sizePx, children: ["(", SIZE_PX[size], ")"] })] }, size)))] }) }), _jsx("tbody", { children: AXES.map(axis => (_jsxs("tr", { children: [_jsx("th", { className: styles.axisHead, children: axis }), SIZES.map(size => (_jsx("td", { className: styles.cell, children: _jsx(Cell, { kind: kind, axis: axis, size: size }) }, size)))] }, axis))) })] }) })] }));
92
66
  }
93
- function Spacing() {
94
- return /* @__PURE__ */ jsxs(
95
- "div",
96
- {
97
- className: styles.container,
98
- style: {
99
- ["--pad-indicator"]: "var(--color-bg-info)",
100
- ["--pad-border"]: "var(--color-info)",
101
- ["--margin-indicator"]: "var(--color-bg-warning)",
102
- ["--margin-border"]: "var(--color-warning)",
103
- ["--dot-pad"]: "var(--color-bg-selected)",
104
- ["--dot-mar"]: "var(--opac-bg-default)"
105
- },
106
- children: [
107
- /* @__PURE__ */ jsx("header", { className: styles.header, children: /* @__PURE__ */ jsx(Headline, { disableMargin: true, children: "Spacing helpers" }) }),
108
- /* @__PURE__ */ jsxs("section", { className: styles.intro, children: [
109
- /* @__PURE__ */ jsx("h2", { className: styles.h2, children: "Naming Convention" }),
110
- /* @__PURE__ */ jsxs("p", { className: styles.paragraph, children: [
111
- "Spacing helpers follow a simple ",
112
- /* @__PURE__ */ jsx("strong", { children: "prefix\u2013axis\u2013size" }),
113
- " pattern:"
114
- ] }),
115
- /* @__PURE__ */ jsx("div", { className: styles.example, children: /* @__PURE__ */ jsx(Code, { children: "dbc-[prefix][axis?]-[size]" }) }),
116
- /* @__PURE__ */ jsxs("ul", { className: styles.list, children: [
117
- /* @__PURE__ */ jsxs("li", { children: [
118
- /* @__PURE__ */ jsx("strong", { children: "Prefix" }),
119
- ": ",
120
- /* @__PURE__ */ jsx(Code, { children: "p" }),
121
- " for ",
122
- /* @__PURE__ */ jsx("em", { children: "padding" }),
123
- ", ",
124
- /* @__PURE__ */ jsx(Code, { children: "m" }),
125
- " for",
126
- " ",
127
- /* @__PURE__ */ jsx("em", { children: "margin" }),
128
- "."
129
- ] }),
130
- /* @__PURE__ */ jsxs("li", { children: [
131
- /* @__PURE__ */ jsx("strong", { children: "Axis" }),
132
- " (optional): ",
133
- /* @__PURE__ */ jsx(Code, { children: "x" }),
134
- " = inline (left + right), ",
135
- /* @__PURE__ */ jsx(Code, { children: "y" }),
136
- " ",
137
- "= block (top + bottom), or single sides ",
138
- /* @__PURE__ */ jsx(Code, { children: "t" }),
139
- " / ",
140
- /* @__PURE__ */ jsx(Code, { children: "b" }),
141
- " / ",
142
- /* @__PURE__ */ jsx(Code, { children: "s" }),
143
- " ",
144
- "/ ",
145
- /* @__PURE__ */ jsx(Code, { children: "e" }),
146
- "."
147
- ] }),
148
- /* @__PURE__ */ jsxs("li", { children: [
149
- /* @__PURE__ */ jsx("strong", { children: "Size" }),
150
- ": one of ",
151
- /* @__PURE__ */ jsx(Code, { children: "xxs" }),
152
- ", ",
153
- /* @__PURE__ */ jsx(Code, { children: "xs" }),
154
- ", ",
155
- /* @__PURE__ */ jsx(Code, { children: "sm" }),
156
- ",",
157
- " ",
158
- /* @__PURE__ */ jsx(Code, { children: "md" }),
159
- ", ",
160
- /* @__PURE__ */ jsx(Code, { children: "lg" }),
161
- ", ",
162
- /* @__PURE__ */ jsx(Code, { children: "xl" }),
163
- ", ",
164
- /* @__PURE__ */ jsx(Code, { children: "2xl" }),
165
- "."
166
- ] })
167
- ] }),
168
- /* @__PURE__ */ jsxs("p", { className: styles.paragraph, children: [
169
- "For example: ",
170
- /* @__PURE__ */ jsx(Code, { children: "dbc-px-md" }),
171
- " adds medium horizontal padding, while",
172
- " ",
173
- /* @__PURE__ */ jsx(Code, { children: "dbc-mt-lg" }),
174
- " adds a large top margin."
175
- ] })
176
- ] }),
177
- /* @__PURE__ */ jsx(Grid, { kind: "padding", title: "Padding", severity: "info" }),
178
- /* @__PURE__ */ jsx(Grid, { kind: "margin", title: "Margin", severity: "warning" })
179
- ]
180
- }
181
- );
67
+ export function Spacing() {
68
+ return (_jsxs("div", { className: styles.container, style: {
69
+ ['--pad-indicator']: 'var(--color-bg-info)',
70
+ ['--pad-border']: 'var(--color-info)',
71
+ ['--margin-indicator']: 'var(--color-bg-warning)',
72
+ ['--margin-border']: 'var(--color-warning)',
73
+ ['--dot-pad']: 'var(--color-bg-selected)',
74
+ ['--dot-mar']: 'var(--opac-bg-default)',
75
+ }, children: [_jsx("header", { className: styles.header, children: _jsx(Headline, { disableMargin: true, children: "Spacing helpers" }) }), _jsxs("section", { className: styles.intro, children: [_jsx("h2", { className: styles.h2, children: "Naming Convention" }), _jsxs("p", { className: styles.paragraph, children: ["Spacing helpers follow a simple ", _jsx("strong", { children: "prefix\u2013axis\u2013size" }), " pattern:"] }), _jsx("div", { className: styles.example, children: _jsx(Code, { children: "dbc-[prefix][axis?]-[size]" }) }), _jsxs("ul", { className: styles.list, children: [_jsxs("li", { children: [_jsx("strong", { children: "Prefix" }), ": ", _jsx(Code, { children: "p" }), " for ", _jsx("em", { children: "padding" }), ", ", _jsx(Code, { children: "m" }), " for", ' ', _jsx("em", { children: "margin" }), "."] }), _jsxs("li", { children: [_jsx("strong", { children: "Axis" }), " (optional): ", _jsx(Code, { children: "x" }), " = inline (left + right), ", _jsx(Code, { children: "y" }), ' ', "= block (top + bottom), or single sides ", _jsx(Code, { children: "t" }), " / ", _jsx(Code, { children: "b" }), " / ", _jsx(Code, { children: "s" }), ' ', "/ ", _jsx(Code, { children: "e" }), "."] }), _jsxs("li", { children: [_jsx("strong", { children: "Size" }), ": one of ", _jsx(Code, { children: "xxs" }), ", ", _jsx(Code, { children: "xs" }), ", ", _jsx(Code, { children: "sm" }), ",", ' ', _jsx(Code, { children: "md" }), ", ", _jsx(Code, { children: "lg" }), ", ", _jsx(Code, { children: "xl" }), ", ", _jsx(Code, { children: "2xl" }), "."] })] }), _jsxs("p", { className: styles.paragraph, children: ["For example: ", _jsx(Code, { children: "dbc-px-md" }), " adds medium horizontal padding, while", ' ', _jsx(Code, { children: "dbc-mt-lg" }), " adds a large top margin."] })] }), _jsx(Grid, { kind: "padding", title: "Padding", severity: "info" }), _jsx(Grid, { kind: "margin", title: "Margin", severity: "warning" })] }));
182
76
  }
183
-
184
- export { Spacing };
@@ -1,5 +1,6 @@
1
- interface AppHeader {
2
- children: React.ReactNode;
1
+ import type { ReactNode, JSX } from 'react';
2
+ interface AppHeaderProps {
3
+ children: ReactNode;
3
4
  }
4
- export declare function AppHeader({ children }: AppHeader): JSX.Element;
5
+ export declare function AppHeader({ children }: AppHeaderProps): JSX.Element;
5
6
  export {};
@@ -1,8 +1,5 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import styles from './AppHeader.module.css';
3
-
4
- function AppHeader({ children }) {
5
- return /* @__PURE__ */ jsx("header", { children: /* @__PURE__ */ jsx("div", { className: styles.container, children }) });
3
+ export function AppHeader({ children }) {
4
+ return (_jsx("header", { children: _jsx("div", { className: styles.container, children: children }) }));
6
5
  }
7
-
8
- export { AppHeader };
@@ -1,3 +1,4 @@
1
+ import type { JSX } from 'react';
1
2
  interface AttributeChipProps {
2
3
  label: string;
3
4
  value: string | number | boolean;
@@ -1,16 +1,5 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import styles from './AttributeChip.module.css';
3
-
4
- function AttributeChip({
5
- label,
6
- value,
7
- size = "md",
8
- loading
9
- }) {
10
- return /* @__PURE__ */ jsxs("div", { className: `${styles.container} ${styles[size]}`, "aria-busy": loading, children: [
11
- /* @__PURE__ */ jsx("span", { className: styles.label, children: label }),
12
- /* @__PURE__ */ jsx("span", { className: styles.value, children: loading ? "\u2014" : value == null ? void 0 : value.toString() })
13
- ] });
3
+ export function AttributeChip({ label, value, size = 'md', loading, }) {
4
+ return (_jsxs("div", { className: `${styles.container} ${styles[size]}`, "aria-busy": loading, children: [_jsx("span", { className: styles.label, children: label }), _jsx("span", { className: styles.value, children: loading ? '—' : value === null || value === void 0 ? void 0 : value.toString() })] }));
14
5
  }
15
-
16
- export { AttributeChip };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import type { ButtonHTMLAttributes } from 'react';
3
- import type { Size } from '../../types/sizes.types';
2
+ import type { ButtonHTMLAttributes, JSX } from 'react';
4
3
  import type { Severity } from '../../constants/severity.types';
4
+ import type { Size } from '../../types/sizes.types';
5
5
  interface AvatarProps extends Partial<ButtonHTMLAttributes<HTMLButtonElement>> {
6
6
  image?: React.ReactNode;
7
7
  imgSrc?: string;
@@ -1,76 +1,42 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import styles from './Avatar.module.css';
4
+ import { SeverityBgColor, SeverityTextColor } from '../../constants/severity';
4
5
  import { sizes } from '../../constants/sizes';
5
- import { SeverityTextColor, SeverityBgColor } from '../../constants/severity';
6
-
7
- function Avatar({
8
- image,
9
- imgSrc,
10
- imgAlt,
11
- fullName,
12
- color = "brand",
13
- button,
14
- size = "md",
15
- className,
16
- fullWidth = false,
17
- photographerCredit,
18
- ...rest
19
- }) {
20
- const text = fullName ? fullName.trim().split(/\s+/).map((name) => name.charAt(0)).join("").toUpperCase() : "";
21
- const styleVars = {
22
- "--bg": SeverityBgColor[color],
23
- "--text": SeverityTextColor[color],
24
- "--size": fullWidth ? "100%" : sizes[size]
25
- };
26
- const pathId = React.useId();
27
- const renderImage = () => {
28
- if (image) {
29
- if (React.isValidElement(image)) {
30
- const mergedClass = [image.props.className, styles.image].filter(Boolean).join(" ");
31
- return React.cloneElement(image, { className: mergedClass });
32
- }
33
- return /* @__PURE__ */ jsx("span", { className: styles.imageSlot, children: image });
34
- }
35
- if (imgSrc) {
36
- return /* @__PURE__ */ jsx("img", { className: styles.image, src: imgSrc, alt: imgAlt });
37
- }
38
- return /* @__PURE__ */ jsx("span", { className: styles.avatar, "aria-hidden": "true", children: text });
39
- };
40
- if (button) {
41
- return /* @__PURE__ */ jsx(
42
- "button",
43
- {
44
- type: "button",
45
- ...rest,
46
- className: [styles.container, styles.button, className].filter(Boolean).join(" "),
47
- style: styleVars,
48
- children: renderImage()
49
- }
50
- );
51
- }
52
- return /* @__PURE__ */ jsxs("div", { className: [styles.wrapper, className].filter(Boolean).join(" "), style: styleVars, children: [
53
- /* @__PURE__ */ jsx("div", { className: styles.container, children: renderImage() }),
54
- photographerCredit && /* @__PURE__ */ jsxs(
55
- "svg",
56
- {
57
- className: styles.creditText,
58
- viewBox: "0 0 100 100",
59
- "aria-hidden": "true",
60
- focusable: "false",
61
- children: [
62
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(
63
- "path",
64
- {
65
- id: pathId,
66
- d: "\n M 50, 50\n m -42, 0\n a 42,42 0 1,1 84,0\n a 42,42 0 1,1 -84,0\n "
6
+ export function Avatar({ image, imgSrc, imgAlt, fullName, color = 'brand', button, size = 'md', className, fullWidth = false, photographerCredit, ...rest }) {
7
+ const text = fullName
8
+ ? fullName
9
+ .trim()
10
+ .split(/\s+/)
11
+ .map(name => name.charAt(0))
12
+ .join('')
13
+ .toUpperCase()
14
+ : '';
15
+ const styleVars = {
16
+ '--bg': SeverityBgColor[color],
17
+ '--text': SeverityTextColor[color],
18
+ '--size': fullWidth ? '100%' : sizes[size],
19
+ };
20
+ // Unique id per component instance so multiple avatars don't clash
21
+ const pathId = React.useId();
22
+ const renderImage = () => {
23
+ if (image) {
24
+ // If it's a valid React element, merge our className; otherwise render as-is
25
+ if (React.isValidElement(image)) {
26
+ const mergedClass = [image.props.className, styles.image].filter(Boolean).join(' ');
27
+ return React.cloneElement(image, { className: mergedClass });
67
28
  }
68
- ) }),
69
- /* @__PURE__ */ jsx("text", { children: /* @__PURE__ */ jsx("textPath", { xlinkHref: `#${pathId}`, startOffset: "50%", textAnchor: "middle", children: photographerCredit }) })
70
- ]
71
- }
72
- )
73
- ] });
29
+ return _jsx("span", { className: styles.imageSlot, children: image });
30
+ }
31
+ if (imgSrc) {
32
+ return _jsx("img", { className: styles.image, src: imgSrc, alt: imgAlt });
33
+ }
34
+ return (_jsx("span", { className: styles.avatar, "aria-hidden": "true", children: text }));
35
+ };
36
+ // Keep button behavior as before (no circular credit)
37
+ if (button) {
38
+ return (_jsx("button", { type: "button", ...rest, className: [styles.container, styles.button, className].filter(Boolean).join(' '), style: styleVars, children: renderImage() }));
39
+ }
40
+ // Non-button: wrapper to overlay circular credit SVG
41
+ return (_jsxs("div", { className: [styles.wrapper, className].filter(Boolean).join(' '), style: styleVars, children: [_jsx("div", { className: styles.container, children: renderImage() }), photographerCredit && (_jsxs("svg", { className: styles.creditText, viewBox: "0 0 100 100", "aria-hidden": "true", focusable: "false", children: [_jsx("defs", { children: _jsx("path", { id: pathId, d: "\n M 50, 50\n m -42, 0\n a 42,42 0 1,1 84,0\n a 42,42 0 1,1 -84,0\n " }) }), _jsx("text", { children: _jsx("textPath", { xlinkHref: `#${pathId}`, startOffset: "50%", textAnchor: "middle", children: photographerCredit }) })] }))] }));
74
42
  }
75
-
76
- export { Avatar };
@@ -1,12 +1,12 @@
1
- import React from 'react';
1
+ import type { ReactNode, HTMLAttributes, JSX } from 'react';
2
2
  export interface BreadcrumbItem {
3
- label: string | React.ReactNode;
3
+ label: string | ReactNode;
4
4
  onClick?: () => void;
5
- icon?: React.ReactNode;
5
+ icon?: ReactNode;
6
6
  disabled?: boolean;
7
7
  hidden?: boolean;
8
8
  }
9
9
  export interface BreadcrumbsProps {
10
10
  items: BreadcrumbItem[];
11
11
  }
12
- export declare function Breadcrumbs({ items }: BreadcrumbsProps): JSX.Element;
12
+ export declare function Breadcrumbs({ items, ...navProps }: BreadcrumbsProps & HTMLAttributes<HTMLElement>): JSX.Element;
@@ -1,15 +1,6 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
2
3
  import styles from './Breadcrumbs.module.css';
3
- import React from 'react';
4
-
5
- function Breadcrumbs({ items }) {
6
- return /* @__PURE__ */ jsx("nav", { className: styles.breadcrumbs, "aria-label": "breadcrumb", children: /* @__PURE__ */ jsx("ul", { children: items.map((item, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
7
- /* @__PURE__ */ jsxs("li", { children: [
8
- item.icon && item.icon,
9
- item.onClick ? /* @__PURE__ */ jsx("button", { onClick: item.onClick, children: item.label }) : /* @__PURE__ */ jsx("span", { children: item.label })
10
- ] }),
11
- index < items.length - 1 && /* @__PURE__ */ jsx("span", { className: styles.separator, children: "/" })
12
- ] }, `breadcrumbItem-${item.label}-${index}`)) }) });
4
+ export function Breadcrumbs({ items, ...navProps }) {
5
+ return (_jsx("nav", { className: styles.breadcrumbs, "aria-label": "breadcrumb", ...navProps, children: _jsx("ul", { children: items.map((item, index) => (_jsxs(Fragment, { children: [_jsxs("li", { children: [item.icon && item.icon, item.onClick ? (_jsx("button", { onClick: item.onClick, children: item.label })) : (_jsx("span", { children: item.label }))] }), index < items.length - 1 && _jsx("span", { className: styles.separator, children: "/" })] }, `breadcrumbItem-${item.label}-${index}`))) }) }));
13
6
  }
14
-
15
- export { Breadcrumbs };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Size } from '@/types/sizes.types';
2
+ import type { Size } from '../../types/sizes.types';
3
3
  export type ButtonVariant = 'primary' | 'secondary' | 'outlined' | 'default' | 'inline' | 'success' | 'danger';
4
4
  export type ButtonSize = Exclude<Size, 'xl'>;
5
5
  export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
@@ -10,7 +10,8 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
10
10
  loading?: boolean;
11
11
  active?: boolean;
12
12
  spinIcon?: boolean;
13
- tooltip?: string;
13
+ tooltip?: React.ReactNode;
14
+ tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left';
14
15
  isLink?: boolean;
15
16
  }
16
17
  export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,62 +1,60 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { LoaderCircle } from 'lucide-react';
2
4
  import * as React from 'react';
5
+ import { useTooltipTrigger } from '../../components/overlay/tooltip/useTooltipTrigger';
3
6
  import styles from './Button.module.css';
4
- import { LoaderCircle } from 'lucide-react';
5
- import { Tooltip } from '../tooltip/Tooltip';
6
-
7
7
  function cx(...parts) {
8
- return parts.filter(Boolean).join(" ");
8
+ return parts.filter(Boolean).join(' ');
9
+ }
10
+ function mergeRefs(...refs) {
11
+ return (node) => {
12
+ for (const ref of refs) {
13
+ if (!ref)
14
+ continue;
15
+ if (typeof ref === 'function')
16
+ ref(node);
17
+ else
18
+ ref.current = node;
19
+ }
20
+ };
9
21
  }
10
- const Button = React.forwardRef(function Button2({
11
- variant = "outlined",
12
- size = "md",
13
- fullWidth,
14
- icon,
15
- children,
16
- loading,
17
- active,
18
- spinIcon,
19
- tooltip,
20
- isLink,
21
- ...rest
22
- }, ref) {
23
- const { className: userClassName, ...buttonProps } = rest;
24
- const computedClassName = cx(
25
- styles.button,
26
- styles[variant],
27
- styles[size],
28
- fullWidth ? styles.fullWidth : "",
29
- active ? styles.active : "",
30
- loading ? styles.loading : "",
31
- isLink ? styles.link : "",
32
- userClassName
33
- );
34
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
35
- icon && /* @__PURE__ */ jsx("span", { className: cx(styles.icon, spinIcon ? "spin" : ""), children: icon }),
36
- children,
37
- loading && /* @__PURE__ */ jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsx(LoaderCircle, {}) })
38
- ] });
39
- let buttonEl;
40
- if (isLink && React.isValidElement(children)) {
41
- const childClassName = typeof children.props.className === "string" ? children.props.className : "";
42
- buttonEl = React.cloneElement(children, {
43
- ...buttonProps,
44
- ref,
45
- className: cx(childClassName, computedClassName),
46
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
47
- icon && /* @__PURE__ */ jsx("span", { className: cx(styles.icon, spinIcon ? "spin" : ""), children: icon }),
48
- children.props.children,
49
- loading && /* @__PURE__ */ jsx("span", { style: { display: "flex", opacity: 0.5 }, className: "spin", children: /* @__PURE__ */ jsx(LoaderCircle, {}) })
50
- ] })
22
+ export const Button = React.forwardRef(function Button({ variant = 'outlined', size = 'md', fullWidth, icon, children, loading, active, spinIcon, tooltip, tooltipPlacement = 'top', isLink, type = 'button', ...rest }, ref) {
23
+ const { className: userClassName, ...buttonProps } = rest;
24
+ const computedClassName = cx(styles.button, styles[variant], styles[size], fullWidth ? styles.fullWidth : '', active ? styles.active : '', loading ? styles.loading : '', isLink ? styles.link : '', userClassName);
25
+ const tooltipEnabled = Boolean(tooltip);
26
+ // Tooltip anchored to the actual clickable element (button or link element)
27
+ const { triggerProps, id: tooltipId } = useTooltipTrigger({
28
+ content: tooltipEnabled ? tooltip : null,
29
+ placement: tooltipPlacement,
30
+ offset: 8,
51
31
  });
52
- } else {
53
- buttonEl = /* @__PURE__ */ jsx("button", { ref, className: computedClassName, ...buttonProps, children: content });
54
- }
55
- if (tooltip) {
56
- return /* @__PURE__ */ jsx(Tooltip, { content: tooltip, children: buttonEl });
57
- }
58
- return buttonEl;
32
+ // Merge aria-describedby (button may already have one)
33
+ const describedBy = (() => {
34
+ const existing = typeof buttonProps['aria-describedby'] === 'string'
35
+ ? buttonProps['aria-describedby']
36
+ : '';
37
+ const ids = [existing, tooltipEnabled ? tooltipId : ''].filter(Boolean);
38
+ return ids.length ? ids.join(' ') : undefined;
39
+ })();
40
+ const content = (_jsxs(_Fragment, { children: [icon && _jsx("span", { className: cx(styles.icon, spinIcon ? 'spin' : ''), children: icon }), children, loading && (_jsx("span", { style: { display: 'flex', opacity: 0.5 }, className: "spin", children: _jsx(LoaderCircle, {}) }))] }));
41
+ let buttonEl;
42
+ if (isLink && React.isValidElement(children)) {
43
+ // If this is a link-style button, we need to attach tooltip handlers + ref to the child.
44
+ const childClassName = typeof children.props.className === 'string' ? children.props.className : '';
45
+ const childRef = children.ref;
46
+ buttonEl = React.cloneElement(children, {
47
+ ...buttonProps,
48
+ ref: mergeRefs(childRef, ref),
49
+ className: cx(childClassName, computedClassName),
50
+ ...(tooltipEnabled ? triggerProps : {}),
51
+ 'aria-describedby': describedBy,
52
+ children: (_jsxs(_Fragment, { children: [icon && _jsx("span", { className: cx(styles.icon, spinIcon ? 'spin' : ''), children: icon }), children.props.children, loading && (_jsx("span", { style: { display: 'flex', opacity: 0.5 }, className: "spin", children: _jsx(LoaderCircle, {}) }))] })),
53
+ });
54
+ }
55
+ else {
56
+ buttonEl = (_jsx("button", { className: computedClassName, type: type, ...buttonProps, ...(tooltipEnabled ? triggerProps : {}), "aria-describedby": describedBy, children: content }));
57
+ }
58
+ return buttonEl;
59
59
  });
60
- Button.displayName = "Button";
61
-
62
- export { Button };
60
+ Button.displayName = 'Button';
@@ -45,7 +45,7 @@
45
45
  cursor: not-allowed;
46
46
  pointer-events: none;
47
47
  background-color: var(--color-disabled-bg);
48
- border-color: var(--color-disabled-border);
48
+ border-color: transparent;
49
49
  color: var(--color-disabled-fg);
50
50
  }
51
51