@dbcdk/react-components 0.0.4 → 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 (299) 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 +11 -0
  5. package/dist/components/__stories__/story-components/Colors.js +96 -0
  6. package/dist/components/__stories__/story-components/Colors.module.css +27 -0
  7. package/dist/components/__stories__/story-components/Spacing.d.ts +2 -0
  8. package/dist/components/__stories__/story-components/Spacing.js +76 -0
  9. package/dist/components/__stories__/story-components/Spacing.module.css +154 -0
  10. package/dist/components/app-header/AppHeader.d.ts +4 -3
  11. package/dist/components/app-header/AppHeader.js +3 -6
  12. package/dist/components/app-header/AppHeader.module.css +10 -15
  13. package/dist/components/attribute-chip/AttributeChip.d.ts +9 -0
  14. package/dist/components/attribute-chip/AttributeChip.js +5 -0
  15. package/dist/components/attribute-chip/AttributeChip.module.css +65 -0
  16. package/dist/components/avatar/Avatar.d.ts +5 -3
  17. package/dist/components/avatar/Avatar.js +37 -37
  18. package/dist/components/avatar/Avatar.module.css +27 -0
  19. package/dist/components/breadcrumbs/Breadcrumbs.d.ts +4 -4
  20. package/dist/components/breadcrumbs/Breadcrumbs.js +4 -14
  21. package/dist/components/breadcrumbs/Breadcrumbs.module.css +19 -22
  22. package/dist/components/button/Button.d.ts +6 -2
  23. package/dist/components/button/Button.js +56 -50
  24. package/dist/components/button/Button.module.css +119 -56
  25. package/dist/components/card/Card.d.ts +23 -7
  26. package/dist/components/card/Card.js +20 -21
  27. package/dist/components/card/Card.module.css +148 -44
  28. package/dist/components/card-container/CardContainer.d.ts +6 -3
  29. package/dist/components/card-container/CardContainer.js +4 -15
  30. package/dist/components/card-container/CardContainer.module.css +40 -0
  31. package/dist/components/chip/Chip.d.ts +7 -5
  32. package/dist/components/chip/Chip.js +14 -37
  33. package/dist/components/chip/Chip.module.css +50 -27
  34. package/dist/components/circle/Circle.d.ts +3 -2
  35. package/dist/components/circle/Circle.js +3 -10
  36. package/dist/components/circle/Circle.module.css +11 -11
  37. package/dist/components/clear-button/ClearButton.d.ts +2 -1
  38. package/dist/components/clear-button/ClearButton.js +6 -17
  39. package/dist/components/clear-button/ClearButton.module.css +8 -7
  40. package/dist/components/code-block/CodeBlock.d.ts +7 -0
  41. package/dist/components/code-block/CodeBlock.js +6 -0
  42. package/dist/components/code-block/CodeBlock.module.css +60 -0
  43. package/dist/components/copy-button/CopyButton.d.ts +10 -0
  44. package/dist/components/copy-button/CopyButton.js +22 -0
  45. package/dist/components/copy-button/CopyButton.module.css +6 -0
  46. package/dist/components/datetime-picker/DateTimePicker.d.ts +42 -0
  47. package/dist/components/datetime-picker/DateTimePicker.js +403 -0
  48. package/dist/components/datetime-picker/DateTimePicker.module.css +144 -0
  49. package/dist/components/filter-field/FilterField.d.ts +6 -3
  50. package/dist/components/filter-field/FilterField.js +130 -158
  51. package/dist/components/filter-field/FilterField.module.css +35 -25
  52. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +36 -0
  53. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +53 -0
  54. package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +60 -0
  55. package/dist/components/forms/checkbox/Checkbox.d.ts +31 -0
  56. package/dist/components/forms/checkbox/Checkbox.js +27 -0
  57. package/dist/components/{checkbox → forms/checkbox}/Checkbox.module.css +10 -11
  58. package/dist/components/forms/checkbox-group/CheckboxGroup.d.ts +47 -0
  59. package/dist/components/forms/checkbox-group/CheckboxGroup.js +75 -0
  60. package/dist/components/forms/checkbox-group/CheckboxGroup.module.css +115 -0
  61. package/dist/components/forms/input/Input.d.ts +22 -0
  62. package/dist/components/forms/input/Input.js +70 -0
  63. package/dist/components/forms/input/Input.module.css +160 -0
  64. package/dist/components/forms/input-container/InputContainer.d.ts +15 -0
  65. package/dist/components/forms/input-container/InputContainer.js +15 -0
  66. package/dist/components/forms/input-container/InputContainer.module.css +34 -0
  67. package/dist/components/forms/multi-select/MultiSelect.d.ts +20 -0
  68. package/dist/components/forms/multi-select/MultiSelect.js +19 -0
  69. package/dist/components/forms/select/Select.d.ts +21 -0
  70. package/dist/components/forms/select/Select.js +94 -0
  71. package/dist/components/forms/text-area/Textarea.d.ts +17 -0
  72. package/dist/components/forms/text-area/Textarea.js +33 -0
  73. package/dist/components/forms/text-area/Textarea.module.css +26 -0
  74. package/dist/components/headline/Headline.d.ts +9 -1
  75. package/dist/components/headline/Headline.js +18 -37
  76. package/dist/components/headline/Headline.module.css +32 -7
  77. package/dist/components/hyperlink/Hyperlink.d.ts +9 -0
  78. package/dist/components/hyperlink/Hyperlink.js +11 -0
  79. package/dist/components/hyperlink/Hyperlink.module.css +23 -0
  80. package/dist/components/icon/Icon.d.ts +4 -3
  81. package/dist/components/icon/Icon.js +11 -17
  82. package/dist/components/icon/Icon.module.css +10 -9
  83. package/dist/components/menu/Menu.js +25 -67
  84. package/dist/components/menu/Menu.module.css +10 -32
  85. package/dist/components/meta-bar/MetaBar.d.ts +11 -0
  86. package/dist/components/meta-bar/MetaBar.js +9 -0
  87. package/dist/components/meta-bar/MetaBar.module.css +12 -0
  88. package/dist/components/nav-bar/NavBar.d.ts +5 -5
  89. package/dist/components/nav-bar/NavBar.js +15 -45
  90. package/dist/components/nav-bar/NavBar.module.css +11 -16
  91. package/dist/components/overlay/modal/Modal.d.ts +23 -0
  92. package/dist/components/overlay/modal/Modal.js +92 -0
  93. package/dist/components/overlay/modal/Modal.module.css +66 -0
  94. package/dist/components/overlay/modal/provider/ModalProvider.d.ts +20 -0
  95. package/dist/components/overlay/modal/provider/ModalProvider.js +70 -0
  96. package/dist/components/overlay/side-panel/SidePanel.d.ts +16 -0
  97. package/dist/components/overlay/side-panel/SidePanel.js +10 -0
  98. package/dist/components/overlay/side-panel/SidePanel.module.css +56 -0
  99. package/dist/components/overlay/side-panel/useSidePanel.d.ts +5 -0
  100. package/dist/components/overlay/side-panel/useSidePanel.js +11 -0
  101. package/dist/components/overlay/tooltip/Tooltip.d.ts +13 -0
  102. package/dist/components/overlay/tooltip/Tooltip.js +17 -0
  103. package/dist/components/overlay/tooltip/Tooltip.module.css +106 -0
  104. package/dist/components/overlay/tooltip/TooltipProvider.d.ts +20 -0
  105. package/dist/components/overlay/tooltip/TooltipProvider.js +244 -0
  106. package/dist/components/overlay/tooltip/useTooltipTrigger.d.ts +24 -0
  107. package/dist/components/overlay/tooltip/useTooltipTrigger.js +108 -0
  108. package/dist/components/page/Page.d.ts +7 -6
  109. package/dist/components/page/Page.js +4 -21
  110. package/dist/components/page/Page.module.css +2 -2
  111. package/dist/components/page-layout/PageLayout.d.ts +12 -20
  112. package/dist/components/page-layout/PageLayout.js +35 -88
  113. package/dist/components/page-layout/PageLayout.module.css +4 -80
  114. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.d.ts +11 -0
  115. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.js +7 -0
  116. package/dist/components/page-layout/components/page-layout-hero/PageLayoutHero.module.css +84 -0
  117. package/dist/components/pagination/Pagination.d.ts +4 -1
  118. package/dist/components/pagination/Pagination.js +38 -105
  119. package/dist/components/pagination/Pagination.module.css +11 -3
  120. package/dist/components/panel/Panel.d.ts +4 -3
  121. package/dist/components/panel/Panel.js +5 -10
  122. package/dist/components/panel/Panel.module.css +5 -7
  123. package/dist/components/popover/Popover.d.ts +3 -1
  124. package/dist/components/popover/Popover.js +116 -124
  125. package/dist/components/popover/Popover.module.css +4 -6
  126. package/dist/components/search-box/SearchBox.d.ts +11 -8
  127. package/dist/components/search-box/SearchBox.js +112 -149
  128. package/dist/components/search-box/SearchBox.module.css +0 -1
  129. package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +1 -1
  130. package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +47 -88
  131. package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +5 -1
  132. package/dist/components/sidebar/Sidebar.d.ts +3 -1
  133. package/dist/components/sidebar/Sidebar.js +5 -29
  134. package/dist/components/sidebar/components/SidebarItem.js +6 -12
  135. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +4 -2
  136. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +48 -62
  137. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +9 -38
  138. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +9 -0
  139. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +13 -0
  140. package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +155 -0
  141. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +3 -1
  142. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +4 -18
  143. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +25 -12
  144. package/dist/components/sidebar/components/sidebar-items/SidebarItems.d.ts +1 -1
  145. package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +9 -22
  146. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.js +20 -18
  147. package/dist/components/sidebar/providers/SidebarProvider.d.ts +9 -4
  148. package/dist/components/sidebar/providers/SidebarProvider.js +188 -73
  149. package/dist/components/skeleton-loader/SkeletonLoader.js +68 -266
  150. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.js +11 -34
  151. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.module.css +0 -12
  152. package/dist/components/split-button/SplitButton.d.ts +7 -5
  153. package/dist/components/split-button/SplitButton.js +4 -27
  154. package/dist/components/split-pane/SplitPane.d.ts +34 -0
  155. package/dist/components/split-pane/SplitPane.js +78 -0
  156. package/dist/components/split-pane/SplitPane.module.css +106 -0
  157. package/dist/components/split-pane/provider/SplitPaneContext.d.ts +23 -0
  158. package/dist/components/split-pane/provider/SplitPaneContext.js +85 -0
  159. package/dist/components/table/Table.d.ts +28 -10
  160. package/dist/components/table/Table.js +117 -172
  161. package/dist/components/table/Table.module.css +78 -47
  162. package/dist/components/table/components/column-resizer/ColumnResizer.js +4 -15
  163. package/dist/components/table/components/empty-state/EmptyState.d.ts +41 -0
  164. package/dist/components/table/components/empty-state/EmptyState.js +27 -0
  165. package/dist/components/table/components/empty-state/EmptyState.module.css +16 -0
  166. package/dist/components/table/components/table-settings/TableSettings.d.ts +8 -0
  167. package/dist/components/table/components/table-settings/TableSettings.js +12 -0
  168. package/dist/components/table/tanstack.d.ts +14 -0
  169. package/dist/components/table/tanstack.js +162 -0
  170. package/dist/components/tabs/Tabs.d.ts +7 -3
  171. package/dist/components/tabs/Tabs.js +32 -65
  172. package/dist/components/tabs/Tabs.module.css +9 -9
  173. package/dist/components/toast/Toast.d.ts +14 -0
  174. package/dist/components/toast/Toast.js +8 -0
  175. package/dist/components/toast/Toast.module.css +102 -0
  176. package/dist/components/toast/provider/ToastProvider.d.ts +23 -0
  177. package/dist/components/toast/provider/ToastProvider.js +64 -0
  178. package/dist/components/user-display/UserDisplay.d.ts +2 -1
  179. package/dist/components/user-display/UserDisplay.js +4 -20
  180. package/dist/components/user-display/UserDisplay.module.css +2 -2
  181. package/dist/constants/severity.d.ts +1 -1
  182. package/dist/constants/severity.js +14 -16
  183. package/dist/constants/severity.types.d.ts +1 -1
  184. package/dist/constants/severity.types.js +1 -1
  185. package/dist/constants/sizes.d.ts +1 -1
  186. package/dist/constants/sizes.js +6 -7
  187. package/dist/hooks/usePagination.d.ts +33 -0
  188. package/dist/hooks/usePagination.js +79 -0
  189. package/dist/hooks/useSorting.d.ts +49 -0
  190. package/dist/hooks/useSorting.js +118 -0
  191. package/dist/hooks/useTableData.d.ts +40 -0
  192. package/dist/hooks/useTableData.js +45 -0
  193. package/dist/hooks/useTableSelection.d.ts +25 -0
  194. package/dist/hooks/useTableSelection.js +128 -0
  195. package/dist/hooks/useTableSettings.d.ts +7 -0
  196. package/dist/hooks/useTableSettings.js +24 -0
  197. package/dist/hooks/useTheme.d.ts +3 -7
  198. package/dist/hooks/useTheme.js +52 -47
  199. package/dist/hooks/useTimeDuration.d.ts +22 -0
  200. package/dist/hooks/useTimeDuration.js +36 -0
  201. package/dist/hooks/useViewportFill.d.ts +3 -2
  202. package/dist/hooks/useViewportFill.js +55 -48
  203. package/dist/index.d.ts +32 -6
  204. package/dist/index.js +33 -6
  205. package/dist/src/styles/styles.css +101 -8
  206. package/dist/styles/css-helper-classes/flex.css +101 -0
  207. package/dist/styles/css-helper-classes/typography.css +7 -0
  208. package/dist/styles/styles.css +101 -8
  209. package/dist/styles/themes/dbc/dark.css +207 -100
  210. package/dist/styles/themes/dbc/light.css +185 -90
  211. package/dist/styles/themes/forfatterweb/light.css +1 -1
  212. package/dist/styles/themes/types.js +1 -1
  213. package/dist/types/a11y-props.types.d.ts +5 -5
  214. package/dist/types/a11y-props.types.js +1 -1
  215. package/dist/types/sizes.types.d.ts +2 -2
  216. package/dist/types/sizes.types.js +1 -1
  217. package/dist/utils/arrays/nested-filtering.js +43 -33
  218. package/dist/utils/date/formatDate.js +25 -16
  219. package/package.json +33 -18
  220. package/dist/assets/logo.cjs +0 -87
  221. package/dist/components/app-header/AppHeader.cjs +0 -14
  222. package/dist/components/avatar/Avatar.cjs +0 -67
  223. package/dist/components/breadcrumbs/Breadcrumbs.cjs +0 -23
  224. package/dist/components/button/Button.cjs +0 -79
  225. package/dist/components/card/Card.cjs +0 -29
  226. package/dist/components/card-container/CardContainer.cjs +0 -23
  227. package/dist/components/checkbox/Checkbox.cjs +0 -43
  228. package/dist/components/checkbox/Checkbox.d.ts +0 -12
  229. package/dist/components/checkbox/Checkbox.js +0 -37
  230. package/dist/components/chip/Chip.cjs +0 -49
  231. package/dist/components/circle/Circle.cjs +0 -18
  232. package/dist/components/clear-button/ClearButton.cjs +0 -26
  233. package/dist/components/data-summary/DataSummary.cjs +0 -49
  234. package/dist/components/data-summary/DataSummary.d.ts +0 -19
  235. package/dist/components/data-summary/DataSummary.js +0 -43
  236. package/dist/components/data-summary/DataSummary.module.css +0 -51
  237. package/dist/components/filter-field/FilterField.cjs +0 -174
  238. package/dist/components/headline/Headline.cjs +0 -47
  239. package/dist/components/icon/Icon.cjs +0 -27
  240. package/dist/components/input/Input.cjs +0 -48
  241. package/dist/components/input/Input.d.ts +0 -13
  242. package/dist/components/input/Input.js +0 -42
  243. package/dist/components/input/Input.module.css +0 -112
  244. package/dist/components/menu/Menu.cjs +0 -96
  245. package/dist/components/multi-select/MultiSelect.cjs +0 -48
  246. package/dist/components/multi-select/MultiSelect.d.ts +0 -18
  247. package/dist/components/multi-select/MultiSelect.js +0 -46
  248. package/dist/components/nav-bar/NavBar.cjs +0 -55
  249. package/dist/components/page/Page.cjs +0 -30
  250. package/dist/components/page-layout/PageLayout.cjs +0 -101
  251. package/dist/components/pagination/Pagination.cjs +0 -117
  252. package/dist/components/panel/Panel.cjs +0 -18
  253. package/dist/components/popover/Popover.cjs +0 -132
  254. package/dist/components/search-box/SearchBox.cjs +0 -162
  255. package/dist/components/segmented-progress-bar/SegmentedProgressBar.cjs +0 -97
  256. package/dist/components/select/Select.cjs +0 -52
  257. package/dist/components/select/Select.d.ts +0 -11
  258. package/dist/components/select/Select.js +0 -50
  259. package/dist/components/sidebar/Sidebar.cjs +0 -38
  260. package/dist/components/sidebar/Sidebar.module.css +0 -66
  261. package/dist/components/sidebar/components/SidebarItem.cjs +0 -16
  262. package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +0 -74
  263. package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +0 -27
  264. package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +0 -28
  265. package/dist/components/sidebar/components/sidenav-filteirng/SidenavFiltering.cjs +0 -25
  266. package/dist/components/sidebar/providers/SidebarProvider.cjs +0 -81
  267. package/dist/components/skeleton-loader/SkeletonLoader.cjs +0 -270
  268. package/dist/components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem.cjs +0 -42
  269. package/dist/components/split-button/SplitButton.cjs +0 -37
  270. package/dist/components/table/Table.cjs +0 -181
  271. package/dist/components/table/components/column-resizer/ColumnResizer.cjs +0 -22
  272. package/dist/components/tabs/Tabs.cjs +0 -74
  273. package/dist/components/text-area/Textarea.cjs +0 -62
  274. package/dist/components/text-area/Textarea.d.ts +0 -14
  275. package/dist/components/text-area/Textarea.js +0 -56
  276. package/dist/components/text-area/Textarea.module.css +0 -3
  277. package/dist/components/tooltip/Tooltip.cjs +0 -78
  278. package/dist/components/tooltip/Tooltip.d.ts +0 -11
  279. package/dist/components/tooltip/Tooltip.js +0 -72
  280. package/dist/components/tooltip/Tooltip.module.css +0 -84
  281. package/dist/components/user-display/UserDisplay.cjs +0 -28
  282. package/dist/constants/severity.cjs +0 -21
  283. package/dist/constants/severity.types.cjs +0 -2
  284. package/dist/constants/sizes.cjs +0 -10
  285. package/dist/hooks/useTheme.cjs +0 -58
  286. package/dist/hooks/useViewportFill.cjs +0 -52
  287. package/dist/index.cjs +0 -264
  288. package/dist/styles/themes/types.cjs +0 -2
  289. package/dist/tanstack.cjs +0 -231
  290. package/dist/tanstack.d.ts +0 -25
  291. package/dist/tanstack.js +0 -206
  292. package/dist/types/a11y-props.types.cjs +0 -2
  293. package/dist/types/assets.d.cjs +0 -2
  294. package/dist/types/assets.d.js +0 -1
  295. package/dist/types/css.d.cjs +0 -2
  296. package/dist/types/css.d.js +0 -1
  297. package/dist/types/sizes.types.cjs +0 -2
  298. package/dist/utils/arrays/nested-filtering.cjs +0 -40
  299. package/dist/utils/date/formatDate.cjs +0 -19
@@ -9,7 +9,7 @@
9
9
  /* ========== Filled variant ========== */
10
10
  .tabs.filled .tab.active {
11
11
  background: var(--opac-bg-brand);
12
- color: var(--color-primary);
12
+ color: var(--color-brand);
13
13
  border: var(--border-width-thin) solid var(--opac-bg-dark);
14
14
  border-block-end: 0;
15
15
  }
@@ -23,7 +23,7 @@
23
23
  }
24
24
  .tabs.filled .tab {
25
25
  border: var(--border-width-thin) solid transparent;
26
- color: var(--color-text-muted);
26
+ color: var(--color-fg-muted);
27
27
  font-size: var(--font-size-sm);
28
28
  z-index: 3;
29
29
  transition:
@@ -33,11 +33,11 @@
33
33
  border-start-end-radius: var(--border-radius-default);
34
34
  }
35
35
  .tabs.filled .tab:not(.active):hover {
36
- color: var(--color-primary);
36
+ color: var(--color-brand);
37
37
  }
38
38
  .tabs.filled .tabContent {
39
39
  border: var(--border-width-thin) solid var(--opac-bg-dark);
40
- background: var(--color-background);
40
+ background: var(--color-bg-surface);
41
41
  padding: var(--spacing-lg);
42
42
  flex-grow: 1;
43
43
  overflow: auto;
@@ -45,7 +45,7 @@
45
45
 
46
46
  /* ========== Panel style variant ========== */
47
47
  .panelStyle .tabList {
48
- border: var(--border-width-thin) solid var(--color-border);
48
+ border: var(--border-width-thin) solid var(--color-border-default);
49
49
  border-block-end: 0;
50
50
  }
51
51
  .panelStyle .tab.active {
@@ -90,10 +90,10 @@
90
90
  display: flex;
91
91
  flex-direction: column;
92
92
  border-radius: 0;
93
- border-block-end: 2px solid var(--color-border);
93
+ border-block-end: 2px solid var(--color-border-default);
94
94
  }
95
95
  .tab.active {
96
- border-block-end-color: var(--color-primary);
96
+ border-block-end-color: var(--color-brand);
97
97
  }
98
98
 
99
99
  .tab .icon {
@@ -101,8 +101,8 @@
101
101
  color: inherit;
102
102
  }
103
103
  .tab .icon svg {
104
- inline-size: var(--icon-size);
105
- block-size: var(--icon-size);
104
+ inline-size: var(--icon-size-md);
105
+ block-size: var(--icon-size-md);
106
106
  }
107
107
 
108
108
  .headerContainer {
@@ -0,0 +1,14 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Severity } from '../../constants/severity.types';
3
+ export type ToastActionConfig = {
4
+ label: string;
5
+ onClick?: () => void;
6
+ };
7
+ export type ToastProps = {
8
+ title?: ReactNode;
9
+ message?: ReactNode;
10
+ severity: Severity;
11
+ action?: ToastActionConfig;
12
+ onClose?: () => void;
13
+ };
14
+ export declare function Toast({ title, message, severity, action, onClose, }: ToastProps): React.ReactNode;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { X } from 'lucide-react';
3
+ import styles from './Toast.module.css';
4
+ import { Button } from '../button/Button';
5
+ import { Headline } from '../headline/Headline';
6
+ export function Toast({ title, message, severity = 'info', action, onClose, }) {
7
+ return (_jsxs("div", { className: `${styles.toast} ${styles[severity]}`, role: "status", children: [_jsxs("div", { className: styles.content, children: [_jsx(Headline, { size: 4, severity: title ? severity : undefined, disableMargin: true, addition: onClose && (_jsx("div", { style: { marginLeft: 'auto' }, children: _jsx(Button, { type: "button", variant: "inline", "aria-label": "Dismiss notification", onClick: onClose, children: _jsx(X, { className: styles.closeIcon, "aria-hidden": "true" }) }) })), children: title }), message && _jsx("div", { className: styles.message, children: message })] }), _jsx("div", { className: styles.actions, children: action && (_jsx(Button, { type: "button", variant: "primary", onClick: action.onClick, children: action.label })) })] }));
8
+ }
@@ -0,0 +1,102 @@
1
+ .container {
2
+ position: fixed;
3
+ inset-inline-end: var(--spacing-lg);
4
+ inset-block-start: var(--spacing-lg);
5
+ display: flex;
6
+ flex-direction: column;
7
+ gap: var(--spacing-xs);
8
+ z-index: var(--z-toast);
9
+ min-width: 280px;
10
+ word-break: break-word;
11
+ }
12
+
13
+ @media (max-width: var(--bp-sm)) {
14
+ .container {
15
+ inset-inline: var(--spacing-md);
16
+ inset-block-end: var(--spacing-md);
17
+ }
18
+ }
19
+
20
+ .toast {
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: var(--spacing-xs);
24
+ padding: var(--spacing-xs) var(--spacing-md);
25
+ border-radius: var(--border-radius-md);
26
+ box-shadow: var(--shadow-md);
27
+ background-color: var(--color-bg-surface);
28
+ border: var(--border-width-thin) solid var(--color-border-default);
29
+ font-family: var(--font-family);
30
+ max-width: 360px;
31
+ animation: toast-enter var(--transition-normal) var(--ease-standard);
32
+ border-left-width: var(--border-width-thick);
33
+ }
34
+
35
+ .info {
36
+ border-left-color: var(--color-status-info-border);
37
+ }
38
+
39
+ .success {
40
+ border-left-color: var(--color-status-success-border);
41
+ }
42
+
43
+ .warning {
44
+ border-left-color: var(--color-status-warning-border);
45
+ }
46
+
47
+ .error {
48
+ border-left-color: var(--color-status-error-border);
49
+ }
50
+
51
+ .iconContainer {
52
+ display: inline-flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ }
56
+
57
+ .icon {
58
+ width: var(--icon-size-md);
59
+ height: var(--icon-size-md);
60
+ }
61
+
62
+ .content {
63
+ flex: 1;
64
+ min-width: 0;
65
+ display: flex;
66
+ flex-direction: column;
67
+ gap: var(--spacing-xs);
68
+ }
69
+
70
+ .title {
71
+ font-size: var(--font-size-sm);
72
+ font-weight: var(--font-weight-semibold);
73
+ line-height: var(--line-height-tight);
74
+ }
75
+
76
+ .message {
77
+ font-size: var(--font-size-sm);
78
+ line-height: var(--line-height-normal);
79
+ }
80
+
81
+ .actions {
82
+ display: flex;
83
+ justify-content: flex-end;
84
+ gap: var(--spacing-xs);
85
+ }
86
+
87
+ .closeIcon {
88
+ width: var(--icon-size-sm);
89
+ height: var(--icon-size-sm);
90
+ }
91
+
92
+ /* Simple enter animation */
93
+ @keyframes toast-enter {
94
+ from {
95
+ opacity: 0;
96
+ transform: translateY(6px);
97
+ }
98
+ to {
99
+ opacity: 1;
100
+ transform: translateY(0);
101
+ }
102
+ }
@@ -0,0 +1,23 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Severity } from '../../../constants/severity.types';
3
+ import { ToastActionConfig } from '../Toast';
4
+ export type ToastConfig = {
5
+ id?: string;
6
+ title?: ReactNode;
7
+ message?: ReactNode;
8
+ severity?: Severity;
9
+ action?: ToastActionConfig;
10
+ duration?: number;
11
+ };
12
+ type ToastContextValue = {
13
+ showToast: (config: ToastConfig) => string;
14
+ hideToast: (id: string) => void;
15
+ clearToasts: () => void;
16
+ };
17
+ type ToastProviderProps = {
18
+ children: ReactNode;
19
+ defaultDuration?: number;
20
+ };
21
+ export declare function ToastProvider({ children, defaultDuration, }: ToastProviderProps): React.ReactNode;
22
+ export declare function useToast(): ToastContextValue;
23
+ export {};
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useState, useRef, useEffect, } from 'react';
3
+ import { Toast } from '../Toast';
4
+ import styles from '../Toast.module.css';
5
+ const ToastContext = createContext(undefined);
6
+ export function ToastProvider({ children, defaultDuration = 4000, }) {
7
+ const [toasts, setToasts] = useState([]);
8
+ const timeouts = useRef(new Map());
9
+ const clearTimeoutForId = (id) => {
10
+ const timeoutId = timeouts.current.get(id);
11
+ if (timeoutId) {
12
+ window.clearTimeout(timeoutId);
13
+ timeouts.current.delete(id);
14
+ }
15
+ };
16
+ const hideToast = useCallback((id) => {
17
+ clearTimeoutForId(id);
18
+ setToasts(prev => prev.filter(t => t.id !== id));
19
+ }, []);
20
+ const scheduleAutoDismiss = useCallback((toast) => {
21
+ var _a;
22
+ const duration = (_a = toast.duration) !== null && _a !== void 0 ? _a : defaultDuration;
23
+ if (!duration || duration <= 0)
24
+ return;
25
+ clearTimeoutForId(toast.id);
26
+ const timeoutId = window.setTimeout(() => {
27
+ hideToast(toast.id);
28
+ }, duration);
29
+ timeouts.current.set(toast.id, timeoutId);
30
+ }, [defaultDuration, hideToast]);
31
+ const showToast = useCallback((config) => {
32
+ var _a, _b, _c;
33
+ const id = (_c = (_a = config.id) !== null && _a !== void 0 ? _a : (_b = crypto.randomUUID) === null || _b === void 0 ? void 0 : _b.call(crypto)) !== null && _c !== void 0 ? _c : `${Date.now()}-${Math.random()}`;
34
+ const toast = { ...config, id };
35
+ setToasts(prev => [...prev, toast]);
36
+ scheduleAutoDismiss(toast);
37
+ return id;
38
+ }, [scheduleAutoDismiss]);
39
+ const clearToasts = useCallback(() => {
40
+ toasts.forEach(t => clearTimeoutForId(t.id));
41
+ setToasts([]);
42
+ }, [toasts]);
43
+ useEffect(() => () => {
44
+ toasts.forEach(t => clearTimeoutForId(t.id));
45
+ }, [toasts]);
46
+ return (_jsxs(ToastContext.Provider, { value: { showToast, hideToast, clearToasts }, children: [children, toasts.length > 0 && (_jsx("div", { className: styles.container, "aria-live": "polite", "aria-atomic": "false", children: toasts.map(toast => {
47
+ var _a;
48
+ return (_jsx(Toast, { title: toast.title, message: toast.message, severity: (_a = toast.severity) !== null && _a !== void 0 ? _a : 'info', action: toast.action && {
49
+ label: toast.action.label,
50
+ onClick: () => {
51
+ var _a, _b;
52
+ (_b = (_a = toast.action) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
53
+ hideToast(toast.id);
54
+ },
55
+ }, onClose: () => hideToast(toast.id) }, toast.id));
56
+ }) }))] }));
57
+ }
58
+ export function useToast() {
59
+ const ctx = useContext(ToastContext);
60
+ if (!ctx) {
61
+ throw new Error('useToast must be used within a ToastProvider');
62
+ }
63
+ return ctx;
64
+ }
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  interface UserDisplayProps {
2
3
  id?: string;
3
4
  name?: string;
@@ -5,5 +6,5 @@ interface UserDisplayProps {
5
6
  role?: string;
6
7
  avatarUrl?: string;
7
8
  }
8
- export declare function UserDisplay({ id, name, email, role, avatarUrl, }: UserDisplayProps): React.ReactNode;
9
+ export declare function UserDisplay({ name, email, role, avatarUrl }: UserDisplayProps): ReactNode;
9
10
  export {};
@@ -1,22 +1,6 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { Avatar } from '../avatar/Avatar';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import styles from './UserDisplay.module.css';
4
-
5
- function UserDisplay({
6
- id,
7
- name,
8
- email,
9
- role,
10
- avatarUrl
11
- }) {
12
- return /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
13
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Avatar, { imgSrc: avatarUrl, imgAlt: name, fullName: name, size: "xl" }) }),
14
- /* @__PURE__ */ jsxs("div", { className: styles.userInfo, children: [
15
- /* @__PURE__ */ jsx("h4", { children: name }),
16
- /* @__PURE__ */ jsx("p", { children: email }),
17
- /* @__PURE__ */ jsx("p", { children: role })
18
- ] })
19
- ] });
3
+ import { Avatar } from '../avatar/Avatar';
4
+ export function UserDisplay({ name, email, role, avatarUrl }) {
5
+ return (_jsxs("div", { className: styles.container, children: [_jsx("div", { children: _jsx(Avatar, { imgSrc: avatarUrl, imgAlt: name, fullName: name, size: "xl" }) }), _jsxs("div", { className: styles.userInfo, children: [_jsx("h4", { children: name }), _jsx("p", { children: email }), _jsx("p", { children: role })] })] }));
20
6
  }
21
-
22
- export { UserDisplay };
@@ -12,11 +12,11 @@
12
12
  justify-content: center;
13
13
  padding: var(--spacing-sm);
14
14
  flex-grow: 0;
15
- color: var(--color-text-muted);
15
+ color: var(--color-fg-muted);
16
16
  }
17
17
 
18
18
  .userInfo h4 {
19
- color: var(--color-text);
19
+ color: var(--color-fg-default);
20
20
  margin: 0;
21
21
  }
22
22
 
@@ -1,3 +1,3 @@
1
- import type { Severity } from '@/constants/severity.types';
1
+ import type { Severity } from '../constants/severity.types';
2
2
  export declare const SeverityBgColor: Record<Severity, string>;
3
3
  export declare const SeverityTextColor: Record<Severity, string>;
@@ -1,18 +1,16 @@
1
- const SeverityBgColor = {
2
- neutral: "var(--color-secondary)",
3
- brand: "var(--color-primary)",
4
- success: "var(--color-success)",
5
- error: "var(--color-error)",
6
- info: "var(--color-info)",
7
- warning: "var(--color-warning)"
1
+ export const SeverityBgColor = {
2
+ neutral: 'var(--color-neutral-strong)',
3
+ brand: 'var(--color-brand)',
4
+ success: 'var(--color-status-success)',
5
+ error: 'var(--color-status-error)',
6
+ info: 'var(--color-status-info)',
7
+ warning: 'var(--color-status-warning)',
8
8
  };
9
- const SeverityTextColor = {
10
- neutral: "var(--color-text-inverse)",
11
- brand: "var(--color-text-on-primary)",
12
- success: "var(--color-text-inverse)",
13
- error: "var(--color-text-inverse)",
14
- info: "var(--color-text-inverse)",
15
- warning: "var(--color-text-inverse)"
9
+ export const SeverityTextColor = {
10
+ neutral: 'var(--color-neutral-strong-fg)',
11
+ brand: 'var(--color-fg-on-brand)',
12
+ success: 'var(--color-status-success-fg)',
13
+ error: 'var(--color-status-error-fg)',
14
+ info: 'var(--color-status-info-fg)',
15
+ warning: 'var(--color-status-warning-fg)',
16
16
  };
17
-
18
- export { SeverityBgColor, SeverityTextColor };
@@ -1 +1 @@
1
- export type Severity = "neutral" | "brand" | "success" | "error" | "info" | "warning";
1
+ export type Severity = 'neutral' | 'brand' | 'success' | 'error' | 'info' | 'warning';
@@ -1 +1 @@
1
-
1
+ export {};
@@ -1,2 +1,2 @@
1
- import type { Size, SizeVariable } from "../types/sizes.types";
1
+ import type { Size, SizeVariable } from '../types/sizes.types';
2
2
  export declare const sizes: Record<Size, SizeVariable>;
@@ -1,8 +1,7 @@
1
- const sizes = {
2
- sm: "var(--component-size-sm)",
3
- md: "var(--component-size-md)",
4
- lg: "var(--component-size-lg)",
5
- xl: "var(--component-size-xl)"
1
+ export const sizes = {
2
+ xs: 'var(--component-size-xs)',
3
+ sm: 'var(--component-size-sm)',
4
+ md: 'var(--component-size-md)',
5
+ lg: 'var(--component-size-lg)',
6
+ xl: 'var(--component-size-xl)',
6
7
  };
7
-
8
- export { sizes };
@@ -0,0 +1,33 @@
1
+ import type { PageChangeEvent } from '../components/pagination/Pagination';
2
+ export type PaginationState = {
3
+ skip: number;
4
+ take: number;
5
+ };
6
+ export interface UsePaginationProps<T> {
7
+ data?: readonly T[];
8
+ /**
9
+ * Default/initial state. If you pass `state`, these are ignored.
10
+ */
11
+ skip?: number;
12
+ take?: number;
13
+ /**
14
+ * Controlled mode: if provided, the hook will not keep its own state.
15
+ */
16
+ state?: PaginationState;
17
+ onStateChange?: (next: PaginationState) => void;
18
+ /**
19
+ * When true, page index resets to 0 whenever `data` reference changes.
20
+ * Useful after filtering/sorting changes upstream.
21
+ */
22
+ resetOnDataChange?: boolean;
23
+ }
24
+ export interface UsePaginationResult<T> {
25
+ paginatedData: T[];
26
+ paginationState: PaginationState;
27
+ onPageChange: (pageEvent: PageChangeEvent) => void;
28
+ setPagination: (next: PaginationState) => void;
29
+ resetPage: () => void;
30
+ page: number;
31
+ totalCount: number;
32
+ }
33
+ export declare function usePagination<T>({ data, skip, take, state, onStateChange, resetOnDataChange, }: UsePaginationProps<T>): UsePaginationResult<T>;
@@ -0,0 +1,79 @@
1
+ 'use client';
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
+ function clamp(n, min, max) {
4
+ return Math.max(min, Math.min(max, n));
5
+ }
6
+ export function usePagination({ data = [], skip = 0, take = 10, state, onStateChange, resetOnDataChange = false, }) {
7
+ const isControlled = state != null;
8
+ const [uncontrolled, setUncontrolled] = useState(() => ({
9
+ skip: Math.max(0, skip),
10
+ take: Math.max(1, take),
11
+ }));
12
+ // Keep initial props in sync ONLY for uncontrolled if props change.
13
+ // (For controlled, parent owns state.)
14
+ const didInitRef = useRef(false);
15
+ useEffect(() => {
16
+ if (isControlled)
17
+ return;
18
+ if (!didInitRef.current) {
19
+ didInitRef.current = true;
20
+ return;
21
+ }
22
+ setUncontrolled(prev => ({
23
+ skip: prev.skip,
24
+ take: Math.max(1, take),
25
+ }));
26
+ }, [isControlled, take]);
27
+ const paginationState = (isControlled ? state : uncontrolled);
28
+ const totalCount = data.length;
29
+ const safeTake = Math.max(1, paginationState.take);
30
+ const maxSkip = Math.max(0, totalCount === 0 ? 0 : Math.floor((totalCount - 1) / safeTake) * safeTake);
31
+ const safeSkip = clamp(Math.max(0, paginationState.skip), 0, maxSkip);
32
+ const setPagination = useCallback((next) => {
33
+ const normalized = {
34
+ take: Math.max(1, next.take),
35
+ skip: Math.max(0, next.skip),
36
+ };
37
+ if (isControlled)
38
+ onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange(normalized);
39
+ else
40
+ setUncontrolled(normalized);
41
+ }, [isControlled, onStateChange]);
42
+ const onPageChange = useCallback((pageEvent) => {
43
+ const nextTake = Math.max(1, pageEvent.take);
44
+ const nextSkip = Math.max(0, (pageEvent.page - 1) * nextTake);
45
+ setPagination({ skip: nextSkip, take: nextTake });
46
+ }, [setPagination]);
47
+ const resetPage = useCallback(() => {
48
+ setPagination({ skip: 0, take: safeTake });
49
+ }, [setPagination, safeTake]);
50
+ // Optional: reset page when data reference changes (after sort/filter).
51
+ useEffect(() => {
52
+ if (!resetOnDataChange)
53
+ return;
54
+ resetPage();
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
+ }, [resetOnDataChange, data]);
57
+ const paginatedData = useMemo(() => {
58
+ // Use safeSkip to avoid slicing past end if data shrinks.
59
+ return data.slice(safeSkip, safeSkip + safeTake);
60
+ }, [data, safeSkip, safeTake]);
61
+ const page = useMemo(() => Math.floor(safeSkip / safeTake) + 1, [safeSkip, safeTake]);
62
+ // If uncontrolled and data shrinks such that skip becomes invalid, clamp it once.
63
+ useEffect(() => {
64
+ if (isControlled)
65
+ return;
66
+ if (safeSkip !== paginationState.skip) {
67
+ setUncontrolled(prev => ({ ...prev, skip: safeSkip }));
68
+ }
69
+ }, [isControlled, safeSkip, paginationState.skip]);
70
+ return {
71
+ paginatedData,
72
+ paginationState: { skip: safeSkip, take: safeTake },
73
+ onPageChange,
74
+ setPagination,
75
+ resetPage,
76
+ page,
77
+ totalCount,
78
+ };
79
+ }
@@ -0,0 +1,49 @@
1
+ export type SortDirection = 'asc' | 'desc' | null;
2
+ export type SortState<T> = {
3
+ sortBy: keyof T | null;
4
+ sortDirection: SortDirection;
5
+ };
6
+ export type SortEvent<T> = Partial<SortState<T>>;
7
+ export type ColumnComparators<T> = Partial<Record<keyof T, (a: T, b: T, direction: Exclude<SortDirection, null>) => number>>;
8
+ export interface UseSortingProps<T> {
9
+ data?: readonly T[];
10
+ /**
11
+ * Default/initial state. If you pass `state`, these are ignored.
12
+ */
13
+ sortBy?: keyof T | null;
14
+ sortDirection?: SortDirection;
15
+ /**
16
+ * Controlled mode: if provided, hook will not keep its own state.
17
+ */
18
+ state?: SortState<T>;
19
+ onStateChange?: (next: SortState<T>) => void;
20
+ /**
21
+ * Optional per-column comparator.
22
+ * If absent, falls back to default compare on the field value.
23
+ */
24
+ columnComparators?: ColumnComparators<T>;
25
+ /**
26
+ * How to handle null/undefined values when using the default comparator:
27
+ * - "first": nulls come first
28
+ * - "last": nulls come last
29
+ */
30
+ nulls?: 'first' | 'last';
31
+ /**
32
+ * If true, toggling a column cycles: asc -> desc -> null
33
+ * If false, cycles: asc -> desc -> asc ...
34
+ */
35
+ allowUnsort?: boolean;
36
+ /**
37
+ * When true, resets sorting when data reference changes.
38
+ * (Most people want to keep sort; default false.)
39
+ */
40
+ resetOnDataChange?: boolean;
41
+ }
42
+ export interface UseSortingResult<T> {
43
+ sortedData: T[];
44
+ sortState: SortState<T>;
45
+ onSortChange: (e: SortEvent<T>) => void;
46
+ setSort: (next: SortState<T>) => void;
47
+ clearSort: () => void;
48
+ }
49
+ export declare function useSorting<T extends Record<string, any>>({ data, sortBy, sortDirection, state, onStateChange, columnComparators, nulls, allowUnsort, resetOnDataChange, }: UseSortingProps<T>): UseSortingResult<T>;