@helsenorge/designsystem-react 15.7.2 → 16.1.0

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 (326) hide show
  1. package/lib/Button.js +2 -2
  2. package/lib/Button.js.map +1 -1
  3. package/lib/CHANGELOG.md +2664 -997
  4. package/lib/Close.js +1 -1
  5. package/lib/Close.js.map +1 -1
  6. package/lib/Drawer.js +3 -4
  7. package/lib/Drawer.js.map +1 -1
  8. package/lib/DrawerNavigation.js +1 -0
  9. package/lib/DrawerNavigation.js.map +1 -1
  10. package/lib/Duolist.js +5 -1
  11. package/lib/Duolist.js.map +1 -1
  12. package/lib/ElementHeader.js.map +1 -1
  13. package/lib/Expander.js +1 -0
  14. package/lib/Expander.js.map +1 -1
  15. package/lib/FilterLinkList.js +1 -1
  16. package/lib/FilterLinkList.js.map +1 -1
  17. package/lib/FormGroup.js +3 -3
  18. package/lib/FormGroup.js.map +1 -1
  19. package/lib/HelpDetails.js +1 -1
  20. package/lib/HelpTriggerIcon.js +2 -2
  21. package/lib/HelpTriggerIcon.js.map +1 -1
  22. package/lib/HelpTriggerStandalone.js +1 -1
  23. package/lib/HelpTriggerStandalone.js.map +1 -1
  24. package/lib/HorizontalScroll.js +6 -10
  25. package/lib/HorizontalScroll.js.map +1 -1
  26. package/lib/LazyIcon.js +1 -0
  27. package/lib/LazyIcon.js.map +1 -1
  28. package/lib/LazyIllustration.js +2 -0
  29. package/lib/LazyIllustration.js.map +1 -1
  30. package/lib/LinkList.js +10 -10
  31. package/lib/LinkList.js.map +1 -1
  32. package/lib/ListEditMode.js +1 -1
  33. package/lib/ListEditMode.js.map +1 -1
  34. package/lib/PopOver.js +2 -2
  35. package/lib/PopOver.js.map +1 -1
  36. package/lib/Radio.js +65 -55
  37. package/lib/Radio.js.map +1 -1
  38. package/lib/Radio2.js +74 -0
  39. package/lib/Radio2.js.map +1 -0
  40. package/lib/RadioMarker.js +2 -2
  41. package/lib/RadioMarker.js.map +1 -1
  42. package/lib/StackedCellContent.js +15 -0
  43. package/lib/StackedCellContent.js.map +1 -0
  44. package/lib/TabList.js +5 -5
  45. package/lib/TabList.js.map +1 -1
  46. package/lib/TabPanel.js +1 -0
  47. package/lib/TabPanel.js.map +1 -1
  48. package/lib/TableContext.js +26 -0
  49. package/lib/TableContext.js.map +1 -0
  50. package/lib/Toggle.js +2 -2
  51. package/lib/Toggle.js.map +1 -1
  52. package/lib/UNSAFE_TableBody.js +22 -0
  53. package/lib/UNSAFE_TableBody.js.map +1 -0
  54. package/lib/UNSAFE_TableCell.js +26 -0
  55. package/lib/UNSAFE_TableCell.js.map +1 -0
  56. package/lib/UNSAFE_TableDetail.js +17 -0
  57. package/lib/UNSAFE_TableDetail.js.map +1 -0
  58. package/lib/UNSAFE_TableExpandedRow.js +46 -0
  59. package/lib/UNSAFE_TableExpandedRow.js.map +1 -0
  60. package/lib/UNSAFE_TableHead.js +25 -0
  61. package/lib/UNSAFE_TableHead.js.map +1 -0
  62. package/lib/UNSAFE_TableHeadCell.js +182 -0
  63. package/lib/UNSAFE_TableHeadCell.js.map +1 -0
  64. package/lib/UNSAFE_TableRow.js +130 -0
  65. package/lib/UNSAFE_TableRow.js.map +1 -0
  66. package/lib/VisualRadio.js +1 -1
  67. package/lib/VisualRadio.js.map +1 -1
  68. package/lib/__mocks__/ResizeObserver.js +4 -1
  69. package/lib/__mocks__/ResizeObserver.js.map +1 -1
  70. package/lib/components/AnchorLink/styles.module.scss +3 -4
  71. package/lib/components/ArticleTeaser/styles.module.scss +12 -12
  72. package/lib/components/Button/Button.d.ts +1 -1
  73. package/lib/components/Button/styles.module.scss +111 -60
  74. package/lib/components/Button/styles.module.scss.d.ts +1 -1
  75. package/lib/components/Checkbox/CheckboxMarker/styles.module.scss +6 -6
  76. package/lib/components/Chip/styles.module.scss +2 -3
  77. package/lib/components/Close/styles.module.scss +2 -3
  78. package/lib/components/DictionaryTrigger/index.js +26 -1
  79. package/lib/{DictionaryTrigger.js.map → components/DictionaryTrigger/index.js.map} +1 -1
  80. package/lib/components/DictionaryTrigger/styles.module.scss +6 -8
  81. package/lib/components/Drawer/Drawer.d.ts +0 -4
  82. package/lib/components/Drawer/DrawerBackButton.module.scss +1 -2
  83. package/lib/components/Drawer/styles.module.scss +6 -3
  84. package/lib/components/Dropdown/SingleSelect/styles.module.scss +0 -2
  85. package/lib/components/Dropdown/index.js +9 -17
  86. package/lib/components/Dropdown/index.js.map +1 -1
  87. package/lib/components/Dropdown/styles.module.scss +12 -14
  88. package/lib/components/Duolist/Duolist.d.ts +14 -2
  89. package/lib/components/Duolist/styles.module.scss +28 -8
  90. package/lib/components/Duolist/styles.module.scss.d.ts +3 -0
  91. package/lib/components/ElementHeader/ElementHeader.d.ts +1 -1
  92. package/lib/components/ElementHeader/styles.module.scss +1 -1
  93. package/lib/components/EmptyState/styles.module.scss +1 -2
  94. package/lib/components/ErrorWrapper/styles.module.scss +3 -3
  95. package/lib/components/Expander/styles.module.scss +0 -2
  96. package/lib/components/Expander/styles.module.scss.d.ts +1 -1
  97. package/lib/components/ExpanderHierarchy/index.js +1 -0
  98. package/lib/components/ExpanderHierarchy/index.js.map +1 -1
  99. package/lib/components/ExpanderList/index.js +21 -19
  100. package/lib/components/ExpanderList/index.js.map +1 -1
  101. package/lib/components/ExpanderList/styles.module.scss +11 -11
  102. package/lib/components/FavoriteButton/index.js +3 -3
  103. package/lib/components/FavoriteButton/index.js.map +1 -1
  104. package/lib/components/FavoriteButton/styles.module.scss +0 -1
  105. package/lib/components/Filter/FilterButton/styles.module.scss +5 -6
  106. package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss +0 -1
  107. package/lib/components/Filter/FilterDrawer/styles.module.scss +0 -1
  108. package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss +5 -6
  109. package/lib/components/Filter/FilterOverviewSearch/styles.module.scss +1 -4
  110. package/lib/components/Filter/FilterSearch/styles.module.scss +14 -15
  111. package/lib/components/Filter/FilterSort/styles.module.scss +1 -2
  112. package/lib/components/Filter/FilterStateWrapper/styles.module.scss +0 -2
  113. package/lib/components/Filter/LoaderSpinner/styles.module.scss +2 -4
  114. package/lib/components/FormFieldTag/styles.module.scss +0 -1
  115. package/lib/components/FormGroup/styles.module.scss +0 -1
  116. package/lib/components/HelpBubble/styles.module.scss +0 -1
  117. package/lib/components/HelpDetails/styles.module.scss +2 -4
  118. package/lib/components/HelpDrawer/styles.module.scss +1 -2
  119. package/lib/components/HelpPanel/HelpPanel.d.ts +2 -2
  120. package/lib/components/HelpPanel/index.js +1 -17
  121. package/lib/components/HelpPanel/index.js.map +1 -1
  122. package/lib/components/HelpPanel/styles.module.scss +2 -22
  123. package/lib/components/HelpPanel/styles.module.scss.d.ts +0 -4
  124. package/lib/components/HelpTeaser/styles.module.scss +7 -9
  125. package/lib/components/HelpTriggerIcon/HelpTriggerIcon.d.ts +2 -2
  126. package/lib/components/HelpTriggerIcon/styles.module.scss +20 -22
  127. package/lib/components/HelpTriggerIcon/styles.module.scss.d.ts +1 -1
  128. package/lib/components/HelpTriggerInline/styles.module.scss +3 -5
  129. package/lib/components/HelpTriggerStandalone/styles.module.scss +3 -5
  130. package/lib/components/HighlightPanel/styles.module.scss +2 -3
  131. package/lib/components/HorizontalScroll/HorizontalScroll.d.ts +0 -4
  132. package/lib/components/HorizontalScroll/styles.module.scss +1 -4
  133. package/lib/components/HorizontalScroll/styles.module.scss.d.ts +0 -1
  134. package/lib/components/Icons/AdditionalIconInformation.d.ts +4 -0
  135. package/lib/components/Icons/AdditionalIconInformation.js +14 -10
  136. package/lib/components/Icons/AdditionalIconInformation.js.map +1 -1
  137. package/lib/components/Icons/HistoryDocument.js +6 -7
  138. package/lib/components/Icons/HistoryDocument.js.map +1 -1
  139. package/lib/components/Icons/IconNames.d.ts +1 -1
  140. package/lib/components/Icons/IconNames.js +1 -0
  141. package/lib/components/Icons/IconNames.js.map +1 -1
  142. package/lib/components/Icons/YesNo.d.ts +3 -0
  143. package/lib/components/Icons/YesNo.js +53 -0
  144. package/lib/components/Icons/YesNo.js.map +1 -0
  145. package/lib/components/Illustrations/IllustrationNames.d.ts +1 -1
  146. package/lib/components/Illustrations/IllustrationNames.js +2 -0
  147. package/lib/components/Illustrations/IllustrationNames.js.map +1 -1
  148. package/lib/components/Illustrations/MoveAway.d.ts +11 -0
  149. package/lib/components/Illustrations/MoveAway.js +18 -0
  150. package/lib/components/Illustrations/MoveAway.js.map +1 -0
  151. package/lib/components/Illustrations/MoveAwayMedium.d.ts +3 -0
  152. package/lib/components/Illustrations/MoveAwayMedium.js +114 -0
  153. package/lib/components/Illustrations/MoveAwayMedium.js.map +1 -0
  154. package/lib/components/InfoTeaser/styles.module.scss +6 -8
  155. package/lib/components/Label/styles.module.scss +1 -1
  156. package/lib/components/LinkList/LinkList.d.ts +1 -1
  157. package/lib/components/LinkList/styles.module.scss +9 -11
  158. package/lib/components/LinkList/styles.module.scss.d.ts +1 -1
  159. package/lib/components/ListEditMode/styles.module.scss +5 -7
  160. package/lib/components/Loader/Loader.d.ts +1 -1
  161. package/lib/components/Loader/index.js +4 -4
  162. package/lib/components/Loader/index.js.map +1 -1
  163. package/lib/components/Loader/styles.module.scss +7 -7
  164. package/lib/components/Loader/styles.module.scss.d.ts +3 -3
  165. package/lib/components/Modal/constants.d.ts +1 -1
  166. package/lib/components/Modal/index.js +6 -3
  167. package/lib/components/Modal/index.js.map +1 -1
  168. package/lib/components/Modal/styles.module.scss +14 -19
  169. package/lib/components/Modal/styles.module.scss.d.ts +2 -3
  170. package/lib/components/Panel/index.js +1 -1
  171. package/lib/components/Panel/index.js.map +1 -1
  172. package/lib/components/Panel/styles.module.scss +15 -16
  173. package/lib/components/Panel/styles.module.scss.d.ts +1 -1
  174. package/lib/components/PopMenu/PopMenu.d.ts +4 -0
  175. package/lib/components/PopMenu/index.js +10 -5
  176. package/lib/components/PopMenu/index.js.map +1 -1
  177. package/lib/components/PopOver/styles.module.scss +1 -3
  178. package/lib/components/Progressbar/Progressbar.d.ts +1 -1
  179. package/lib/components/Progressbar/constants.d.ts +1 -1
  180. package/lib/components/Progressbar/index.js +4 -4
  181. package/lib/components/Progressbar/index.js.map +1 -1
  182. package/lib/components/Radio/Radio.d.ts +28 -0
  183. package/lib/components/Radio/index.d.ts +3 -0
  184. package/lib/components/Radio/index.js +7 -0
  185. package/lib/components/Radio/index.js.map +1 -0
  186. package/lib/components/{RadioButton → Radio}/styles.module.scss +8 -9
  187. package/lib/components/Radio/styles.module.scss.d.ts +26 -0
  188. package/lib/components/ServiceMessage/styles.module.scss +20 -22
  189. package/lib/components/Slider/styles.module.scss +1 -2
  190. package/lib/components/StatusDot/styles.module.scss +4 -5
  191. package/lib/components/StickyNote/index.js +2 -2
  192. package/lib/components/StickyNote/index.js.map +1 -1
  193. package/lib/components/StickyNote/styles.module.scss +9 -10
  194. package/lib/components/Table/index.js +0 -1
  195. package/lib/components/Table/index.js.map +1 -1
  196. package/lib/components/Tabs/TabList/styles.module.scss +20 -18
  197. package/lib/components/Tabs/TabPanel/styles.module.scss +2 -3
  198. package/lib/components/Tabs/styles.module.scss +0 -1
  199. package/lib/components/Tag/styles.module.scss +0 -1
  200. package/lib/components/Tile/styles.module.scss +5 -7
  201. package/lib/components/Toast/styles.module.scss +0 -1
  202. package/lib/components/Toggle/styles.module.scss +9 -10
  203. package/lib/components/UNSAFE_Table/StackedCellContent.d.ts +9 -0
  204. package/lib/components/UNSAFE_Table/TableCaption.d.ts +10 -0
  205. package/lib/components/UNSAFE_Table/TableContext.d.ts +22 -0
  206. package/lib/components/UNSAFE_Table/UNSAFE_Table.d.ts +37 -0
  207. package/lib/components/UNSAFE_Table/UNSAFE_TableBody/UNSAFE_TableBody.d.ts +10 -0
  208. package/lib/components/UNSAFE_Table/UNSAFE_TableBody/index.d.ts +3 -0
  209. package/lib/components/UNSAFE_Table/UNSAFE_TableBody/index.js +2 -0
  210. package/lib/components/UNSAFE_Table/UNSAFE_TableCell/UNSAFE_TableCell.d.ts +15 -0
  211. package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.d.ts +3 -0
  212. package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.js +7 -0
  213. package/lib/components/UNSAFE_Table/UNSAFE_TableCell/index.js.map +1 -0
  214. package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/UNSAFE_TableDetail.d.ts +12 -0
  215. package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.d.ts +3 -0
  216. package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.js +7 -0
  217. package/lib/components/UNSAFE_Table/UNSAFE_TableDetail/index.js.map +1 -0
  218. package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/UNSAFE_TableExpandedRow.d.ts +17 -0
  219. package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.d.ts +3 -0
  220. package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.js +7 -0
  221. package/lib/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.js.map +1 -0
  222. package/lib/components/UNSAFE_Table/UNSAFE_TableExpanderCell/UNSAFE_TableExpanderCellMobile.d.ts +4 -0
  223. package/lib/components/UNSAFE_Table/UNSAFE_TableHead/UNSAFE_TableHead.d.ts +8 -0
  224. package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.d.ts +3 -0
  225. package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.js +7 -0
  226. package/lib/components/UNSAFE_Table/UNSAFE_TableHead/index.js.map +1 -0
  227. package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/UNSAFE_TableHeadCell.d.ts +15 -0
  228. package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/index.d.ts +3 -0
  229. package/lib/components/UNSAFE_Table/UNSAFE_TableHeadCell/index.js +2 -0
  230. package/lib/components/UNSAFE_Table/UNSAFE_TablePopMenuCell/UNSAFE_TablePopMenuCell.d.ts +8 -0
  231. package/lib/components/UNSAFE_Table/UNSAFE_TableRow/UNSAFE_TableRow.d.ts +20 -0
  232. package/lib/components/UNSAFE_Table/UNSAFE_TableRow/index.d.ts +3 -0
  233. package/lib/components/UNSAFE_Table/UNSAFE_TableRow/index.js +2 -0
  234. package/lib/components/UNSAFE_Table/constants.d.ts +29 -0
  235. package/lib/components/UNSAFE_Table/index.d.ts +19 -0
  236. package/lib/components/UNSAFE_Table/index.js +182 -0
  237. package/lib/components/UNSAFE_Table/index.js.map +1 -0
  238. package/lib/components/UNSAFE_Table/resourceHelper.d.ts +3 -0
  239. package/lib/components/UNSAFE_Table/styles.module.scss +621 -0
  240. package/lib/components/UNSAFE_Table/styles.module.scss.d.ts +62 -0
  241. package/lib/components/UNSAFE_Table/useTableExpandedRows.d.ts +12 -0
  242. package/lib/components/UNSAFE_Table/useTableShowMore.d.ts +25 -0
  243. package/lib/components/UNSAFE_Table/utils.d.ts +47 -0
  244. package/lib/components/Validation/index.js +2 -2
  245. package/lib/components/Validation/index.js.map +1 -1
  246. package/lib/components/VisualCheckboxCloud/Checkbox/styles.module.scss +0 -2
  247. package/lib/components/VisualCheckboxCloud/styles.module.scss +0 -1
  248. package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss +0 -2
  249. package/lib/components/VisualCheckboxGroup/styles.module.scss +0 -1
  250. package/lib/components/VisualContentgroupWithImage/styles.module.scss +0 -1
  251. package/lib/components/VisualRadioCloud/Radio/index.js +1 -1
  252. package/lib/components/VisualRadioCloud/Radio/styles.module.scss +0 -2
  253. package/lib/components/VisualRadioCloud/index.js +1 -1
  254. package/lib/components/VisualRadioCloud/styles.module.scss +0 -1
  255. package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss +0 -2
  256. package/lib/components/VisualRadioGroup/styles.module.scss +0 -1
  257. package/lib/constants.d.ts +2 -3
  258. package/lib/constants.js +2 -3
  259. package/lib/constants.js.map +1 -1
  260. package/lib/constants3.js +42 -0
  261. package/lib/constants3.js.map +1 -0
  262. package/lib/floating-ui.react.js +3 -460
  263. package/lib/floating-ui.react.js.map +1 -1
  264. package/lib/hooks/useDismissablePopover.d.ts +20 -0
  265. package/lib/hooks/useDismissablePopover.js +66 -0
  266. package/lib/hooks/useDismissablePopover.js.map +1 -0
  267. package/lib/hooks/useOutsideEvent.d.ts +3 -0
  268. package/lib/hooks/useOutsideEvent.js +24 -3
  269. package/lib/hooks/useOutsideEvent.js.map +1 -1
  270. package/lib/hooks/useReturnFocusOnClose.d.ts +7 -0
  271. package/lib/hooks/useReturnFocusOnClose.js +22 -0
  272. package/lib/hooks/useReturnFocusOnClose.js.map +1 -0
  273. package/lib/hooks/useSort.d.ts +88 -0
  274. package/lib/hooks/useSort.js +91 -0
  275. package/lib/hooks/useSort.js.map +1 -0
  276. package/lib/hooks/useSort.test.js +11739 -0
  277. package/lib/hooks/useSort.test.js.map +1 -0
  278. package/lib/hooks/useSynchronousResizeObserver.d.ts +11 -0
  279. package/lib/hooks/useSynchronousResizeObserver.js +29 -0
  280. package/lib/hooks/useSynchronousResizeObserver.js.map +1 -0
  281. package/lib/index.d.ts +2 -0
  282. package/lib/index.js +3 -1
  283. package/lib/resources/HN.Designsystem.Table.nb-NO.json.d.ts +9 -0
  284. package/lib/resources/Resources.d.ts +19 -0
  285. package/lib/rolldown-runtime.js +33 -0
  286. package/lib/scss/_font-mixins.scss +28 -1
  287. package/lib/scss/_visual-form.scss +47 -47
  288. package/lib/scss/helsenorge.scss +1 -0
  289. package/lib/scss/supernova/styles/colors.css +177 -122
  290. package/lib/scss/supernova/styles/typography.css +58 -51
  291. package/lib/scss/supernova-legacy/index.css +2 -0
  292. package/lib/scss/supernova-legacy/styles/legacy-colors.css +111 -0
  293. package/lib/scss/typography.module.scss +8 -0
  294. package/lib/scss/typography.module.scss.d.ts +2 -0
  295. package/lib/scss/typography.stories.tsx +8 -0
  296. package/lib/utils/formSpacing.js +3 -3
  297. package/lib/utils/formSpacing.js.map +1 -1
  298. package/lib/utils/uuid.js +1 -12
  299. package/lib/utils/uuid.js.map +1 -1
  300. package/package.json +61 -15
  301. package/scss/_font-mixins.scss +28 -1
  302. package/scss/_visual-form.scss +47 -47
  303. package/scss/helsenorge.scss +1 -0
  304. package/scss/supernova/styles/colors.css +177 -122
  305. package/scss/supernova/styles/typography.css +58 -51
  306. package/scss/supernova-legacy/index.css +2 -0
  307. package/scss/supernova-legacy/styles/legacy-colors.css +111 -0
  308. package/scss/typography.module.scss +8 -0
  309. package/scss/typography.module.scss.d.ts +2 -0
  310. package/scss/typography.stories.tsx +8 -0
  311. package/lib/DictionaryTrigger.js +0 -27
  312. package/lib/RadioButton.js +0 -84
  313. package/lib/RadioButton.js.map +0 -1
  314. package/lib/components/HelpTooltip/HelpTooltip.d.ts +0 -12
  315. package/lib/components/HelpTooltip/index.d.ts +0 -3
  316. package/lib/components/HelpTooltip/index.js +0 -48
  317. package/lib/components/HelpTooltip/index.js.map +0 -1
  318. package/lib/components/RadioButton/RadioButton.d.ts +0 -28
  319. package/lib/components/RadioButton/index.d.ts +0 -3
  320. package/lib/components/RadioButton/index.js +0 -7
  321. package/lib/components/RadioButton/index.js.map +0 -1
  322. package/lib/components/RadioButton/styles.module.scss.d.ts +0 -26
  323. package/lib/designsystem-react.css +0 -273
  324. /package/lib/components/{RadioButton → Radio}/RadioMarker/RadioMarker.d.ts +0 -0
  325. /package/lib/components/{RadioButton → Radio}/RadioMarker/styles.module.scss +0 -0
  326. /package/lib/components/{RadioButton → Radio}/RadioMarker/styles.module.scss.d.ts +0 -0
@@ -3,7 +3,6 @@
3
3
  @use '../../scss/font-settings' as font-settings;
4
4
  @use '../../scss/font-mixins' as fonts;
5
5
  @use '../../scss/breakpoints' as breakpoints;
6
- @import '../../scss/supernova/styles/colors.css';
7
6
 
8
7
  .toggle-container {
9
8
  $toggle-container: &;
@@ -92,7 +91,7 @@
92
91
  word-break: break-all;
93
92
 
94
93
  &--checked {
95
- color: var(--color-action-text-onlight);
94
+ color: var(--color-action-text-dark-normal);
96
95
  }
97
96
 
98
97
  #{$toggle-container}--disabled & {
@@ -118,12 +117,12 @@
118
117
  display: inline-block;
119
118
  width: 2.75rem;
120
119
  height: 1.75rem;
121
- background-color: var(--color-base-background-white);
120
+ background-color: var(--color-base-background-light);
122
121
  border-radius: 60px;
123
- border: 2px solid var(--color-base-border-onlight-emphasized);
122
+ border: 2px solid var(--color-base-emphasized-border-dark);
124
123
 
125
124
  #{$toggle-container}--disabled & {
126
- color: var(--color-disabled-border);
125
+ color: var(--color-disabled-border-dark);
127
126
  border-style: dashed;
128
127
  }
129
128
 
@@ -142,7 +141,7 @@
142
141
  height: 1.125rem;
143
142
  left: 3px;
144
143
  bottom: 3px;
145
- background-color: var(--brandcolor-neutral-dark);
144
+ background-color: var(--brand-color-neutral-dark);
146
145
  border-radius: 50%;
147
146
  display: flex;
148
147
  align-items: center;
@@ -154,7 +153,7 @@
154
153
 
155
154
  &__icon {
156
155
  opacity: 0;
157
- stroke: var(--color-action-graphics-onlight);
156
+ stroke: var(--color-action-graphics-dark-normal);
158
157
 
159
158
  #{$toggle-container}--disabled & {
160
159
  stroke: var(--core-color-white);
@@ -170,8 +169,8 @@
170
169
  height: 0;
171
170
 
172
171
  &:focus-visible + .toggle-container__toggle {
173
- border-color: var(--color-action-border-onlight-focus);
174
- outline: 2px solid var(--color-action-border-onlight-focus);
172
+ border-color: var(--color-action-border-dark-focus);
173
+ outline: 2px solid var(--color-action-border-dark-focus);
175
174
 
176
175
  &::after {
177
176
  content: '';
@@ -179,7 +178,7 @@
179
178
  width: 100%;
180
179
  height: 100%;
181
180
  border-radius: 60px;
182
- border: 1px solid var(--color-action-border-ondark-focus);
181
+ border: 1px solid var(--color-action-border-light-focus);
183
182
  }
184
183
  }
185
184
  }
@@ -0,0 +1,9 @@
1
+ interface StackedCellContentProps {
2
+ /** Heading shown before the content in the stack variant */
3
+ headingText?: string;
4
+ /** The content */
5
+ children?: React.ReactNode;
6
+ }
7
+ /** Heading + content as rendered in a stacked cell. Shared by UNSAFE_TableCell and UNSAFE_TableDetail. */
8
+ export declare const StackedCellContent: React.FC<StackedCellContentProps>;
9
+ export default StackedCellContent;
@@ -0,0 +1,10 @@
1
+ export interface TableCaptionProps {
2
+ /** Unique ID. Can be used with aria-labelledby, e.g. for the scroll container. */
3
+ id?: string;
4
+ /** Adds custom classes to the element. */
5
+ className?: string;
6
+ /** Sets the content of the caption. */
7
+ children: React.ReactNode;
8
+ }
9
+ export declare const TableCaption: React.FC<TableCaptionProps>;
10
+ export default TableCaption;
@@ -0,0 +1,22 @@
1
+ import { HNDesignsystemTable } from '../../resources/Resources';
2
+ import { ResponsiveTableVariant, TableColors, TableSizes } from './constants';
3
+ export interface TableContextValue {
4
+ /** Resolved responsive variant for the current breakpoint. */
5
+ variant: keyof typeof ResponsiveTableVariant;
6
+ /** Header category for styling. */
7
+ color: TableColors;
8
+ /** For display with less space. */
9
+ size: TableSizes;
10
+ /** Whether zebra stripes are enabled. Applied by UNSAFE_TableBody, which can also override it. */
11
+ zebraStripes: boolean;
12
+ /** Indexes of the columns marked with hideBehindExpander on their UNSAFE_TableHeadCell. */
13
+ hiddenColumns: number[];
14
+ /** Text of each column's UNSAFE_TableHeadCell, used as the default heading of cells in the stack variant. */
15
+ headingTexts: string[];
16
+ /** Resource texts of the Table. */
17
+ resources: HNDesignsystemTable;
18
+ }
19
+ /** Table-wide configuration provided by UNSAFE_Table. */
20
+ export declare const TableContext: import('react').Context<TableContextValue>;
21
+ /** Heading of the column a cell belongs to. Provided per cell by UNSAFE_TableRow. */
22
+ export declare const CellHeadingContext: import('react').Context<string>;
@@ -0,0 +1,37 @@
1
+ import { HNDesignsystemTable } from '../../resources/Resources';
2
+ import { ResponsiveTableVariant, TableColors, TableSizes } from './constants';
3
+ import { Breakpoint } from '../../hooks/useBreakpoint';
4
+ export interface BreakpointConfig {
5
+ /** Breakpoint at which responsive behaviour will be applied. The table component uses a "desktop first" approach. */
6
+ breakpoint: keyof typeof Breakpoint;
7
+ /** Desired behaviour on this breakpoint and all smaller screens. */
8
+ variant: keyof typeof ResponsiveTableVariant;
9
+ /** If variant is horizontallscroll, use a fallback instead of device is not a touch device. */
10
+ fallbackVariant?: keyof typeof ResponsiveTableVariant;
11
+ }
12
+ export interface UNSAFE_TableProps extends Omit<React.ComponentPropsWithoutRef<'table'>, 'style'> {
13
+ /** Customize how the table behaves on various screen widths */
14
+ breakpointConfig?: BreakpointConfig | BreakpointConfig[];
15
+ /** Description of the table for screen readers. Rendered as a visually hidden caption and used to label the scroll container. */
16
+ caption: string;
17
+ /** Sets the content of the table. Use TableHead and UNSAFE_TableBody */
18
+ children: React.ReactNode;
19
+ /** Adds custom classes to the element. */
20
+ className?: string;
21
+ /** Header category for styling. Default: normal */
22
+ color?: TableColors;
23
+ /** Unique ID */
24
+ id?: string;
25
+ /** Resources for component */
26
+ resources?: Partial<HNDesignsystemTable>;
27
+ /** For display with less space. Discouraged to use together with interactive elements. */
28
+ size?: TableSizes;
29
+ /** Width of the head column in percentage in the stack variant. When not set, the column follows the widest heading in the table, but wraps (minimum 30%) when the content needs the space. */
30
+ stackHeadWidth?: number;
31
+ /** Id used for testing */
32
+ testId?: string;
33
+ /** Applies zebra stripes to every other row. Default: false */
34
+ zebraStripes?: boolean;
35
+ }
36
+ export declare const UNSAFE_Table: React.FC<UNSAFE_TableProps>;
37
+ export default UNSAFE_Table;
@@ -0,0 +1,10 @@
1
+ export interface Props extends Omit<React.ComponentPropsWithoutRef<'tbody'>, 'style'> {
2
+ /** Adds custom classes to the element. */
3
+ className?: string;
4
+ /** Sets the content of the table body. Use TableRows */
5
+ children?: React.ReactNode;
6
+ /** Applies zebra stripes to every other row. Overrides the value from UNSAFE_Table. */
7
+ zebraStripes?: boolean;
8
+ }
9
+ export declare const UNSAFE_TableBody: React.FC<Props>;
10
+ export default UNSAFE_TableBody;
@@ -0,0 +1,3 @@
1
+ import { default as UNSAFE_TableBody } from './UNSAFE_TableBody';
2
+ export * from './UNSAFE_TableBody';
3
+ export default UNSAFE_TableBody;
@@ -0,0 +1,2 @@
1
+ import { n as UNSAFE_TableBody, t as UNSAFE_TableBody_default } from "../../../UNSAFE_TableBody.js";
2
+ export { UNSAFE_TableBody, UNSAFE_TableBody_default as default };
@@ -0,0 +1,15 @@
1
+ import { TextAlign } from '../constants';
2
+ export interface Props extends Omit<React.ComponentPropsWithoutRef<'td'>, 'style'> {
3
+ /** text align in cell */
4
+ textAlign?: TextAlign;
5
+ /** nowrap for white space */
6
+ nowrap?: boolean;
7
+ /** Adds custom classes to the element. */
8
+ className?: string;
9
+ /** Sets the content of the table cell */
10
+ children?: React.ReactNode;
11
+ /** For test purposes */
12
+ testId?: string;
13
+ }
14
+ export declare const UNSAFE_TableCell: React.FC<Props>;
15
+ export default UNSAFE_TableCell;
@@ -0,0 +1,3 @@
1
+ import { default as UNSAFE_TableCell } from './UNSAFE_TableCell';
2
+ export * from './UNSAFE_TableCell';
3
+ export default UNSAFE_TableCell;
@@ -0,0 +1,7 @@
1
+ import { t as UNSAFE_TableCell } from "../../../UNSAFE_TableCell.js";
2
+ //#region src/components/UNSAFE_Table/UNSAFE_TableCell/index.ts
3
+ var UNSAFE_TableCell_default = UNSAFE_TableCell;
4
+ //#endregion
5
+ export { UNSAFE_TableCell, UNSAFE_TableCell_default as default };
6
+
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/UNSAFE_Table/UNSAFE_TableCell/index.ts"],"sourcesContent":["import UNSAFE_TableCell from './UNSAFE_TableCell';\nexport * from './UNSAFE_TableCell';\nexport default UNSAFE_TableCell;\n"],"mappings":";;AAEA,IAAA,2BAAe"}
@@ -0,0 +1,12 @@
1
+ export interface Props {
2
+ /** Heading shown before the content */
3
+ headingText: string;
4
+ /** Adds custom classes to the element. */
5
+ className?: string;
6
+ /** The content, typically the value of a column hidden with hideBehindExpander */
7
+ children?: React.ReactNode;
8
+ /** Sets the data-testid attribute. */
9
+ testId?: string;
10
+ }
11
+ export declare const UNSAFE_TableDetail: React.FC<Props>;
12
+ export default UNSAFE_TableDetail;
@@ -0,0 +1,3 @@
1
+ import { default as UNSAFE_TableDetail } from './UNSAFE_TableDetail';
2
+ export * from './UNSAFE_TableDetail';
3
+ export default UNSAFE_TableDetail;
@@ -0,0 +1,7 @@
1
+ import { t as UNSAFE_TableDetail } from "../../../UNSAFE_TableDetail.js";
2
+ //#region src/components/UNSAFE_Table/UNSAFE_TableDetail/index.ts
3
+ var UNSAFE_TableDetail_default = UNSAFE_TableDetail;
4
+ //#endregion
5
+ export { UNSAFE_TableDetail, UNSAFE_TableDetail_default as default };
6
+
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/UNSAFE_Table/UNSAFE_TableDetail/index.ts"],"sourcesContent":["import UNSAFE_TableDetail from './UNSAFE_TableDetail';\nexport * from './UNSAFE_TableDetail';\nexport default UNSAFE_TableDetail;\n"],"mappings":";;AAEA,IAAA,6BAAe"}
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ export interface Props {
3
+ /** Row is expanded. */
4
+ expanded: boolean;
5
+ /** When hide button inside expanded row is clicked. */
6
+ toggleClick: () => void;
7
+ /** Adds custom classes to the element. */
8
+ className?: string;
9
+ /** Sets the content of the expanded row. */
10
+ children: React.ReactNode;
11
+ /** Only display the expanded row in the stack variant. */
12
+ stackOnly?: boolean;
13
+ /** Row id. For use with aria-controls. */
14
+ id?: string;
15
+ }
16
+ export declare const UNSAFE_TableExpandedRow: ({ expanded, toggleClick, children, className, stackOnly, id }: Props) => React.JSX.Element;
17
+ export default UNSAFE_TableExpandedRow;
@@ -0,0 +1,3 @@
1
+ import { default as UNSAFE_TableExpandedRow } from './UNSAFE_TableExpandedRow';
2
+ export * from './UNSAFE_TableExpandedRow';
3
+ export default UNSAFE_TableExpandedRow;
@@ -0,0 +1,7 @@
1
+ import { t as UNSAFE_TableExpandedRow } from "../../../UNSAFE_TableExpandedRow.js";
2
+ //#region src/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.ts
3
+ var UNSAFE_TableExpandedRow_default = UNSAFE_TableExpandedRow;
4
+ //#endregion
5
+ export { UNSAFE_TableExpandedRow, UNSAFE_TableExpandedRow_default as default };
6
+
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/UNSAFE_Table/UNSAFE_TableExpandedRow/index.ts"],"sourcesContent":["import UNSAFE_TableExpandedRow from './UNSAFE_TableExpandedRow';\nexport * from './UNSAFE_TableExpandedRow';\nexport default UNSAFE_TableExpandedRow;\n"],"mappings":";;AAEA,IAAA,kCAAe"}
@@ -0,0 +1,4 @@
1
+ import { Props } from '../UNSAFE_TableRow/UNSAFE_TableRow';
2
+ type UNSAFE_TableExpanderCellMobileProps = Pick<Props, 'expanded' | 'onClick' | 'expandableRowId'>;
3
+ declare const UNSAFE_TableExpanderCellMobile: React.FC<UNSAFE_TableExpanderCellMobileProps>;
4
+ export default UNSAFE_TableExpanderCellMobile;
@@ -0,0 +1,8 @@
1
+ export interface Props extends Omit<React.ComponentPropsWithoutRef<'thead'>, 'style'> {
2
+ /** Adds custom classes to the element. */
3
+ className?: string;
4
+ /** Sets the content of the thead. Add table rows */
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const UNSAFE_TableHead: React.FC<Props>;
8
+ export default UNSAFE_TableHead;
@@ -0,0 +1,3 @@
1
+ import { default as UNSAFE_TableHead } from './UNSAFE_TableHead';
2
+ export * from './UNSAFE_TableHead';
3
+ export default UNSAFE_TableHead;
@@ -0,0 +1,7 @@
1
+ import { t as UNSAFE_TableHead } from "../../../UNSAFE_TableHead.js";
2
+ //#region src/components/UNSAFE_Table/UNSAFE_TableHead/index.ts
3
+ var UNSAFE_TableHead_default = UNSAFE_TableHead;
4
+ //#endregion
5
+ export { UNSAFE_TableHead, UNSAFE_TableHead_default as default };
6
+
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/UNSAFE_Table/UNSAFE_TableHead/index.ts"],"sourcesContent":["import UNSAFE_TableHead from './UNSAFE_TableHead';\nexport * from './UNSAFE_TableHead';\nexport default UNSAFE_TableHead;\n"],"mappings":";;AAEA,IAAA,2BAAe"}
@@ -0,0 +1,15 @@
1
+ import { SortDirection } from '../constants';
2
+ export interface Props extends Omit<React.ComponentPropsWithoutRef<'th'>, 'style'> {
3
+ /** Sort direction */
4
+ sortDir?: SortDirection;
5
+ /** Adds custom classes to the element. */
6
+ className?: string;
7
+ /** Sets the content of the td element. */
8
+ children?: React.ReactNode;
9
+ /** Sets the width of the column, e.g. '10rem', '25%' or a number of pixels. Ignored in the stack variant. */
10
+ width?: string | number;
11
+ /** In the stack variant, hides the cells of this column and shows the column heading + content in an automatically rendered expanded row. */
12
+ hideBehindExpander?: boolean;
13
+ }
14
+ export declare const UNSAFE_TableHeadCell: React.FC<Props>;
15
+ export default UNSAFE_TableHeadCell;
@@ -0,0 +1,3 @@
1
+ import { default as UNSAFE_TableHeadCell } from './UNSAFE_TableHeadCell';
2
+ export * from './UNSAFE_TableHeadCell';
3
+ export default UNSAFE_TableHeadCell;
@@ -0,0 +1,2 @@
1
+ import { n as UNSAFE_TableHeadCell, t as UNSAFE_TableHeadCell_default } from "../../../UNSAFE_TableHeadCell.js";
2
+ export { UNSAFE_TableHeadCell, UNSAFE_TableHeadCell_default as default };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { PopMenuProps } from '../../PopMenu';
3
+ export interface UNSAFE_TablePopMenuCellProps {
4
+ /** PopMenu shown inside the cell. Fills the entire cell. */
5
+ children: React.ReactElement<PopMenuProps>;
6
+ }
7
+ declare const UNSAFE_TablePopMenuCell: React.FC<UNSAFE_TablePopMenuCellProps>;
8
+ export default UNSAFE_TablePopMenuCell;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ import { PopMenuProps } from '../../PopMenu';
3
+ export interface Props extends Omit<React.ComponentPropsWithoutRef<'tr'>, 'style'> {
4
+ /** Content to be rendered in an expandable row. Make sure to add an empty TableHeadCell to the beginning of the Table. This content renders below the column content with hideBehindExpander set in the stack variant. */
5
+ expandedContent?: React.ReactNode;
6
+ /** Sets if expanded row is expanded */
7
+ expanded?: boolean;
8
+ /** Id of the expanded row this row controls. For use with aria-controls on the expander button. */
9
+ expandableRowId?: string;
10
+ /** When hide/show button for expanded row is clicked. */
11
+ onClick?: () => void;
12
+ /** Adds custom classes to the element. */
13
+ className?: string;
14
+ /** Sets the cells of the table row element. */
15
+ children?: React.ReactNode;
16
+ /** PopMenu rendered in an extra cell as the last cell in the row. Fills the entire cell. Outside the stack variant labelText is hidden and used as aria-label instead. */
17
+ popMenu?: React.ReactElement<PopMenuProps>;
18
+ }
19
+ export declare const UNSAFE_TableRow: React.FC<Props>;
20
+ export default UNSAFE_TableRow;
@@ -0,0 +1,3 @@
1
+ import { default as UNSAFE_TableRow } from './UNSAFE_TableRow';
2
+ export * from './UNSAFE_TableRow';
3
+ export default UNSAFE_TableRow;
@@ -0,0 +1,2 @@
1
+ import { n as UNSAFE_TableRow, t as UNSAFE_TableRow_default } from "../../../UNSAFE_TableRow.js";
2
+ export { UNSAFE_TableRow, UNSAFE_TableRow_default as default };
@@ -0,0 +1,29 @@
1
+ import { BreakpointConfig } from './UNSAFE_Table';
2
+ export declare enum SortDirection {
3
+ asc = "asc",
4
+ desc = "desc"
5
+ }
6
+ export declare enum TableColors {
7
+ normal = "normal",
8
+ transparent = "transparent"
9
+ }
10
+ export declare enum TextAlign {
11
+ left = "left",
12
+ center = "center",
13
+ right = "right"
14
+ }
15
+ export declare enum ResponsiveTableVariant {
16
+ /** Normal table grid */
17
+ normal = "normal",
18
+ /** Collapse to two columns. */
19
+ stack = "stack",
20
+ /** Overflow parent container to the left and right while remaining centered horizontally. */
21
+ centeredoverflow = "centeredoverflow",
22
+ /** Show horizontal scrollbar when table is too big for the screen. */
23
+ horizontalscroll = "horizontalscroll"
24
+ }
25
+ export declare enum TableSizes {
26
+ normal = "normal",
27
+ compact = "compact"
28
+ }
29
+ export declare const defaultConfig: BreakpointConfig[];
@@ -0,0 +1,19 @@
1
+ export { TableCaption } from './TableCaption';
2
+ export * from './UNSAFE_Table';
3
+ export * from './TableCaption';
4
+ export * from './useTableExpandedRows';
5
+ export * from './useTableShowMore';
6
+ export * from '../../hooks/useSort';
7
+ export { UNSAFE_TableRow } from './UNSAFE_TableRow';
8
+ export type { Props as UNSAFE_TableRowProps } from './UNSAFE_TableRow';
9
+ export { UNSAFE_TableCell } from './UNSAFE_TableCell';
10
+ export type { Props as UNSAFE_TableCellProps } from './UNSAFE_TableCell';
11
+ export { UNSAFE_TableBody } from './UNSAFE_TableBody';
12
+ export type { Props as UNSAFE_TableBodyProps } from './UNSAFE_TableBody';
13
+ export { UNSAFE_TableHeadCell } from './UNSAFE_TableHeadCell';
14
+ export type { Props as UNSAFE_TableHeadCellProps } from './UNSAFE_TableHeadCell';
15
+ export { UNSAFE_TableHead } from './UNSAFE_TableHead';
16
+ export type { Props as UNSAFE_TableHeadProps } from './UNSAFE_TableHead';
17
+ export { SortDirection, TableColors, TableSizes, TextAlign, ResponsiveTableVariant, defaultConfig } from './constants';
18
+ export type { BreakpointConfig } from './UNSAFE_Table';
19
+ export { UNSAFE_Table as default } from './UNSAFE_Table';
@@ -0,0 +1,182 @@
1
+ import { LanguageLocales } from "../../constants.js";
2
+ import { useLanguage } from "../../hooks/useLanguage.js";
3
+ import { useBreakpoint } from "../../hooks/useBreakpoint.js";
4
+ import { useLayoutEvent } from "../../hooks/useLayoutEvent.js";
5
+ import { t as HorizontalScroll_default } from "../../HorizontalScroll.js";
6
+ import { a as TextAlign, i as TableSizes, n as SortDirection, o as defaultConfig, r as TableColors, t as ResponsiveTableVariant } from "../../constants3.js";
7
+ import { n as TableContext, r as HN_Designsystem_Table_nb_NO_default } from "../../TableContext.js";
8
+ import { t as UNSAFE_TableHead } from "../../UNSAFE_TableHead.js";
9
+ import { a as getCenteredOverflowTableStyle, c as getHiddenColumns, i as getBreakpointClass, l as omitProps, n as UNSAFE_TableHeadCell, o as getColumnHeadingTexts, r as getAvailableWidth, s as getCurrentConfig } from "../../UNSAFE_TableHeadCell.js";
10
+ import { useSynchronousResizeObserver } from "../../hooks/useSynchronousResizeObserver.js";
11
+ import { useSort } from "../../hooks/useSort.js";
12
+ import { t as UNSAFE_TableCell } from "../../UNSAFE_TableCell.js";
13
+ import { n as UNSAFE_TableRow } from "../../UNSAFE_TableRow.js";
14
+ import "./UNSAFE_TableCell/index.js";
15
+ import { n as UNSAFE_TableBody } from "../../UNSAFE_TableBody.js";
16
+ import "./UNSAFE_TableHead/index.js";
17
+ import classNames from "classnames";
18
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
19
+ import { jsx, jsxs } from "react/jsx-runtime";
20
+ import styles from "./styles.module.scss";
21
+ //#region src/components/UNSAFE_Table/TableCaption.tsx
22
+ var TableCaption = ({ id, className, children }) => /* @__PURE__ */ jsx("caption", {
23
+ id,
24
+ className: classNames(styles["table-caption"], className),
25
+ children
26
+ });
27
+ //#endregion
28
+ //#region src/components/UNSAFE_Table/resourceHelper.ts
29
+ var getResources = (language) => {
30
+ switch (language) {
31
+ case LanguageLocales.NORWEGIAN:
32
+ default: return HN_Designsystem_Table_nb_NO_default;
33
+ }
34
+ };
35
+ //#endregion
36
+ //#region src/components/UNSAFE_Table/UNSAFE_Table.tsx
37
+ var UNSAFE_Table = ({ breakpointConfig = defaultConfig, caption, children, className, color, id, resources, size = TableSizes.normal, stackHeadWidth, testId, zebraStripes = false, ...rest }) => {
38
+ const captionElementId = useId();
39
+ const [tableWidth, setTableWidth] = useState(0);
40
+ const [parentWidth, setParentWidth] = useState(0);
41
+ const [windowWidth, setWindowWidth] = useState(document.documentElement.clientWidth || window.innerWidth);
42
+ const tableRef = useRef(null);
43
+ const breakpoint = useBreakpoint();
44
+ const { language } = useLanguage(LanguageLocales.NORWEGIAN);
45
+ const mergedResources = {
46
+ ...getResources(language),
47
+ ...resources
48
+ };
49
+ const currentConfig = useMemo(() => getCurrentConfig(breakpointConfig, breakpoint, tableWidth, windowWidth), [
50
+ breakpointConfig,
51
+ breakpoint,
52
+ tableWidth,
53
+ windowWidth
54
+ ]);
55
+ useSynchronousResizeObserver(tableRef, (tableElement, parentElement) => {
56
+ if (currentConfig?.variant !== ResponsiveTableVariant.stack) setTableWidth(tableElement.getBoundingClientRect().width);
57
+ const parentStyle = getComputedStyle(parentElement);
58
+ const horizontalSpacing = [
59
+ parentStyle.paddingLeft,
60
+ parentStyle.paddingRight,
61
+ parentStyle.borderLeftWidth,
62
+ parentStyle.borderRightWidth
63
+ ].reduce((total, value) => total + (Number.parseFloat(value) || 0), 0);
64
+ setParentWidth(Math.max(0, parentElement.getBoundingClientRect().width - horizontalSpacing));
65
+ setWindowWidth(getAvailableWidth(parentElement));
66
+ }, [currentConfig?.variant]);
67
+ useLayoutEvent(() => {
68
+ if (tableRef.current?.parentElement) setWindowWidth(getAvailableWidth(tableRef.current.parentElement));
69
+ }, ["resize"], 100);
70
+ const tableStyle = currentConfig?.variant === ResponsiveTableVariant.centeredoverflow || stackHeadWidth !== void 0 ? {
71
+ ...currentConfig?.variant === ResponsiveTableVariant.centeredoverflow ? getCenteredOverflowTableStyle(parentWidth, tableWidth) : void 0,
72
+ ...stackHeadWidth !== void 0 ? { "--table-stack-columns": `${stackHeadWidth}% minmax(0, 1fr)` } : void 0
73
+ } : void 0;
74
+ const breakpointClass = getBreakpointClass(currentConfig);
75
+ const tableClass = classNames(styles.table, breakpointClass, className);
76
+ const domRest = omitProps(rest, [
77
+ "breakpoint",
78
+ "variant",
79
+ "fallbackVariant",
80
+ "headerCategory"
81
+ ]);
82
+ const hiddenColumns = useMemo(() => getHiddenColumns(children), [children]);
83
+ const headingTexts = useMemo(() => getColumnHeadingTexts(children), [children]);
84
+ const tableContext = useMemo(() => ({
85
+ variant: currentConfig?.variant ?? ResponsiveTableVariant.normal,
86
+ color: color ?? TableColors.normal,
87
+ size,
88
+ zebraStripes,
89
+ hiddenColumns,
90
+ headingTexts,
91
+ resources: mergedResources
92
+ }), [
93
+ currentConfig?.variant,
94
+ color,
95
+ size,
96
+ zebraStripes,
97
+ hiddenColumns,
98
+ headingTexts
99
+ ]);
100
+ const table = /* @__PURE__ */ jsxs("table", {
101
+ className: tableClass,
102
+ id,
103
+ "data-testid": testId,
104
+ ref: tableRef,
105
+ style: tableStyle,
106
+ ...domRest,
107
+ children: [/* @__PURE__ */ jsx(TableCaption, {
108
+ id: captionElementId,
109
+ children: caption
110
+ }), children]
111
+ });
112
+ return /* @__PURE__ */ jsx(TableContext.Provider, {
113
+ value: tableContext,
114
+ children: currentConfig?.variant === ResponsiveTableVariant.horizontalscroll ? /* @__PURE__ */ jsx(HorizontalScroll_default, {
115
+ testId: "horizontal-scroll",
116
+ "aria-labelledby": captionElementId,
117
+ children: table
118
+ }) : table
119
+ });
120
+ };
121
+ //#endregion
122
+ //#region src/components/UNSAFE_Table/useTableExpandedRows.ts
123
+ /** Expanded state per row for tables with expandable rows (UNSAFE_TableRow expandedContent/hideBehindExpander). */
124
+ var useTableExpandedRows = () => {
125
+ const [expandedRows, setExpandedRows] = useState({});
126
+ const isExpanded = (rowKey) => !!expandedRows[rowKey];
127
+ const toggleExpanded = (rowKey) => {
128
+ setExpandedRows((prev) => ({
129
+ ...prev,
130
+ [rowKey]: !prev[rowKey]
131
+ }));
132
+ };
133
+ const collapseAll = () => {
134
+ setExpandedRows({});
135
+ };
136
+ return {
137
+ expandedRows,
138
+ isExpanded,
139
+ toggleExpanded,
140
+ collapseAll
141
+ };
142
+ };
143
+ //#endregion
144
+ //#region src/components/UNSAFE_Table/useTableShowMore.ts
145
+ /** Progressive disclosure ("show more") of table rows, with focus management when the show more button disappears. */
146
+ var useTableShowMore = ({ data, pageSize }) => {
147
+ const [visibleCount, setVisibleCount] = useState(pageSize);
148
+ const [newRowsStartIndex, setNewRowsStartIndex] = useState();
149
+ const firstNewRowRef = useRef(null);
150
+ const shouldFocusNewRow = useRef(false);
151
+ const visibleData = useMemo(() => visibleCount === void 0 ? data : data.slice(0, visibleCount), [data, visibleCount]);
152
+ const hasMore = visibleCount !== void 0 && visibleCount < data.length;
153
+ const showMore = () => {
154
+ if (visibleCount === void 0 || pageSize === void 0) return;
155
+ const newCount = Math.min(visibleCount + pageSize, data.length);
156
+ shouldFocusNewRow.current = newCount >= data.length;
157
+ setNewRowsStartIndex(visibleCount);
158
+ setVisibleCount(newCount);
159
+ };
160
+ useEffect(() => {
161
+ if (shouldFocusNewRow.current) {
162
+ shouldFocusNewRow.current = false;
163
+ firstNewRowRef.current?.focus();
164
+ }
165
+ }, [visibleCount]);
166
+ const reset = () => {
167
+ setVisibleCount(pageSize);
168
+ setNewRowsStartIndex(void 0);
169
+ };
170
+ return {
171
+ visibleData,
172
+ hasMore,
173
+ showMore,
174
+ reset,
175
+ newRowsStartIndex,
176
+ firstNewRowRef
177
+ };
178
+ };
179
+ //#endregion
180
+ export { ResponsiveTableVariant, SortDirection, TableCaption, TableColors, TableSizes, TextAlign, UNSAFE_Table, UNSAFE_Table as default, UNSAFE_TableBody, UNSAFE_TableCell, UNSAFE_TableHead, UNSAFE_TableHeadCell, UNSAFE_TableRow, defaultConfig, useSort, useTableExpandedRows, useTableShowMore };
181
+
182
+ //# sourceMappingURL=index.js.map