@dnb/eufemia 10.38.0 → 10.40.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 (297) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/cjs/components/badge/Badge.js +2 -1
  3. package/cjs/components/badge/Badge.js.map +1 -1
  4. package/cjs/components/badge/style/dnb-badge.css +6 -0
  5. package/cjs/components/badge/style/dnb-badge.min.css +1 -1
  6. package/cjs/components/badge/style/dnb-badge.scss +12 -0
  7. package/cjs/components/button/Button.d.ts +1 -0
  8. package/cjs/components/button/Button.js +5 -2
  9. package/cjs/components/button/Button.js.map +1 -1
  10. package/cjs/components/modal/Modal.js +1 -1
  11. package/cjs/components/modal/Modal.js.map +1 -1
  12. package/cjs/components/modal/types.d.ts +4 -0
  13. package/cjs/components/modal/types.js.map +1 -1
  14. package/cjs/components/table/Table.d.ts +6 -3
  15. package/cjs/components/table/Table.js +6 -2
  16. package/cjs/components/table/Table.js.map +1 -1
  17. package/cjs/components/table/TableClickableHead.d.ts +22 -0
  18. package/cjs/components/table/TableClickableHead.js +116 -0
  19. package/cjs/components/table/TableClickableHead.js.map +1 -0
  20. package/cjs/components/table/TableDocs.js +6 -6
  21. package/cjs/components/table/TableDocs.js.map +1 -1
  22. package/cjs/components/table/TableTr.d.ts +12 -12
  23. package/cjs/components/table/TableTr.js +13 -6
  24. package/cjs/components/table/TableTr.js.map +1 -1
  25. package/cjs/components/table/style/dnb-table.css +61 -61
  26. package/cjs/components/table/style/dnb-table.min.css +1 -1
  27. package/cjs/components/table/style/dnb-table.scss +1 -1
  28. package/cjs/components/table/style/table-accordion.scss +28 -36
  29. package/cjs/components/table/style/table-td.scss +1 -1
  30. package/cjs/components/table/table-accordion/TableAccordionHead.d.ts +0 -1
  31. package/cjs/components/table/table-accordion/TableAccordionHead.js +45 -74
  32. package/cjs/components/table/table-accordion/TableAccordionHead.js.map +1 -1
  33. package/cjs/components/table/table-navigation/TableNavigationHead.d.ts +4 -0
  34. package/cjs/components/table/table-navigation/TableNavigationHead.js +56 -0
  35. package/cjs/components/table/table-navigation/TableNavigationHead.js.map +1 -0
  36. package/cjs/extensions/forms/Field/Number/Number.d.ts +3 -1
  37. package/cjs/extensions/forms/Field/Number/Number.js +6 -2
  38. package/cjs/extensions/forms/Field/Number/Number.js.map +1 -1
  39. package/cjs/extensions/forms/Field/Number/NumberDocs.js +10 -0
  40. package/cjs/extensions/forms/Field/Number/NumberDocs.js.map +1 -1
  41. package/cjs/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +3 -3
  42. package/cjs/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
  43. package/cjs/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js +2 -2
  44. package/cjs/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js.map +1 -1
  45. package/cjs/extensions/forms/Iterate/EditContainer/EditToolbarTools.js +6 -5
  46. package/cjs/extensions/forms/Iterate/EditContainer/EditToolbarTools.js.map +1 -1
  47. package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js +2 -2
  48. package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
  49. package/cjs/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js +3 -3
  50. package/cjs/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js.map +1 -1
  51. package/cjs/extensions/forms/Wizard/EditButton/EditButton.js +2 -2
  52. package/cjs/extensions/forms/Wizard/EditButton/EditButton.js.map +1 -1
  53. package/cjs/extensions/forms/Wizard/NextButton/NextButton.js +2 -2
  54. package/cjs/extensions/forms/Wizard/NextButton/NextButton.js.map +1 -1
  55. package/cjs/extensions/forms/Wizard/PreviousButton/PreviousButton.js +2 -2
  56. package/cjs/extensions/forms/Wizard/PreviousButton/PreviousButton.js.map +1 -1
  57. package/cjs/extensions/forms/constants/locales/en-GB.d.ts +28 -8
  58. package/cjs/extensions/forms/constants/locales/en-GB.js +28 -8
  59. package/cjs/extensions/forms/constants/locales/en-GB.js.map +1 -1
  60. package/cjs/extensions/forms/constants/locales/en-US.d.ts +28 -8
  61. package/cjs/extensions/forms/constants/locales/index.d.ts +56 -16
  62. package/cjs/extensions/forms/constants/locales/nb-NO.d.ts +28 -8
  63. package/cjs/extensions/forms/constants/locales/nb-NO.js +28 -8
  64. package/cjs/extensions/forms/constants/locales/nb-NO.js.map +1 -1
  65. package/cjs/extensions/forms/hooks/DataValueDocs.js +1 -1
  66. package/cjs/extensions/forms/hooks/DataValueDocs.js.map +1 -1
  67. package/cjs/extensions/payment-card/utils/cardProducts.js +7 -7
  68. package/cjs/extensions/payment-card/utils/cardProducts.js.map +1 -1
  69. package/cjs/shared/Eufemia.d.ts +1 -1
  70. package/cjs/shared/Eufemia.js +2 -2
  71. package/cjs/shared/Eufemia.js.map +1 -1
  72. package/cjs/shared/helpers/isAsync.js +5 -1
  73. package/cjs/shared/helpers/isAsync.js.map +1 -1
  74. package/cjs/shared/locales/en-GB.d.ts +1 -0
  75. package/cjs/shared/locales/en-GB.js +2 -1
  76. package/cjs/shared/locales/en-GB.js.map +1 -1
  77. package/cjs/shared/locales/en-US.d.ts +1 -0
  78. package/cjs/shared/locales/index.d.ts +2 -0
  79. package/cjs/shared/locales/nb-NO.d.ts +1 -0
  80. package/cjs/shared/locales/nb-NO.js +2 -1
  81. package/cjs/shared/locales/nb-NO.js.map +1 -1
  82. package/cjs/style/core/scopes.scss +1 -1
  83. package/cjs/style/dnb-ui-basis.css +1 -1
  84. package/cjs/style/dnb-ui-basis.min.css +1 -1
  85. package/cjs/style/dnb-ui-body.css +1 -1
  86. package/cjs/style/dnb-ui-body.min.css +1 -1
  87. package/cjs/style/dnb-ui-components.css +67 -61
  88. package/cjs/style/dnb-ui-components.min.css +2 -2
  89. package/cjs/style/dnb-ui-core.css +1 -1
  90. package/cjs/style/dnb-ui-core.min.css +1 -1
  91. package/cjs/style/themes/theme-eiendom/eiendom-theme-components.css +67 -61
  92. package/cjs/style/themes/theme-eiendom/eiendom-theme-components.min.css +2 -2
  93. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.css +67 -61
  94. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.min.css +2 -2
  95. package/cjs/style/themes/theme-ui/ui-theme-components.css +67 -61
  96. package/cjs/style/themes/theme-ui/ui-theme-components.min.css +2 -2
  97. package/components/badge/Badge.js +2 -1
  98. package/components/badge/Badge.js.map +1 -1
  99. package/components/badge/style/dnb-badge.css +6 -0
  100. package/components/badge/style/dnb-badge.min.css +1 -1
  101. package/components/badge/style/dnb-badge.scss +12 -0
  102. package/components/button/Button.d.ts +1 -0
  103. package/components/button/Button.js +5 -2
  104. package/components/button/Button.js.map +1 -1
  105. package/components/modal/Modal.js +1 -1
  106. package/components/modal/Modal.js.map +1 -1
  107. package/components/modal/types.d.ts +4 -0
  108. package/components/modal/types.js.map +1 -1
  109. package/components/table/Table.d.ts +6 -3
  110. package/components/table/Table.js +6 -2
  111. package/components/table/Table.js.map +1 -1
  112. package/components/table/TableClickableHead.d.ts +22 -0
  113. package/components/table/TableClickableHead.js +103 -0
  114. package/components/table/TableClickableHead.js.map +1 -0
  115. package/components/table/TableDocs.js +6 -6
  116. package/components/table/TableDocs.js.map +1 -1
  117. package/components/table/TableTr.d.ts +12 -12
  118. package/components/table/TableTr.js +13 -6
  119. package/components/table/TableTr.js.map +1 -1
  120. package/components/table/style/dnb-table.css +61 -61
  121. package/components/table/style/dnb-table.min.css +1 -1
  122. package/components/table/style/dnb-table.scss +1 -1
  123. package/components/table/style/table-accordion.scss +28 -36
  124. package/components/table/style/table-td.scss +1 -1
  125. package/components/table/table-accordion/TableAccordionHead.d.ts +0 -1
  126. package/components/table/table-accordion/TableAccordionHead.js +44 -72
  127. package/components/table/table-accordion/TableAccordionHead.js.map +1 -1
  128. package/components/table/table-navigation/TableNavigationHead.d.ts +4 -0
  129. package/components/table/table-navigation/TableNavigationHead.js +48 -0
  130. package/components/table/table-navigation/TableNavigationHead.js.map +1 -0
  131. package/es/components/badge/Badge.js +2 -1
  132. package/es/components/badge/Badge.js.map +1 -1
  133. package/es/components/badge/style/dnb-badge.css +6 -0
  134. package/es/components/badge/style/dnb-badge.min.css +1 -1
  135. package/es/components/badge/style/dnb-badge.scss +12 -0
  136. package/es/components/button/Button.d.ts +1 -0
  137. package/es/components/button/Button.js +5 -2
  138. package/es/components/button/Button.js.map +1 -1
  139. package/es/components/modal/Modal.js +1 -1
  140. package/es/components/modal/Modal.js.map +1 -1
  141. package/es/components/modal/types.d.ts +4 -0
  142. package/es/components/modal/types.js.map +1 -1
  143. package/es/components/table/Table.d.ts +6 -3
  144. package/es/components/table/Table.js +6 -2
  145. package/es/components/table/Table.js.map +1 -1
  146. package/es/components/table/TableClickableHead.d.ts +22 -0
  147. package/es/components/table/TableClickableHead.js +101 -0
  148. package/es/components/table/TableClickableHead.js.map +1 -0
  149. package/es/components/table/TableDocs.js +6 -6
  150. package/es/components/table/TableDocs.js.map +1 -1
  151. package/es/components/table/TableTr.d.ts +12 -12
  152. package/es/components/table/TableTr.js +13 -6
  153. package/es/components/table/TableTr.js.map +1 -1
  154. package/es/components/table/style/dnb-table.css +61 -61
  155. package/es/components/table/style/dnb-table.min.css +1 -1
  156. package/es/components/table/style/dnb-table.scss +1 -1
  157. package/es/components/table/style/table-accordion.scss +28 -36
  158. package/es/components/table/style/table-td.scss +1 -1
  159. package/es/components/table/table-accordion/TableAccordionHead.d.ts +0 -1
  160. package/es/components/table/table-accordion/TableAccordionHead.js +44 -71
  161. package/es/components/table/table-accordion/TableAccordionHead.js.map +1 -1
  162. package/es/components/table/table-navigation/TableNavigationHead.d.ts +4 -0
  163. package/es/components/table/table-navigation/TableNavigationHead.js +48 -0
  164. package/es/components/table/table-navigation/TableNavigationHead.js.map +1 -0
  165. package/es/extensions/forms/Field/Number/Number.d.ts +3 -1
  166. package/es/extensions/forms/Field/Number/Number.js +6 -2
  167. package/es/extensions/forms/Field/Number/Number.js.map +1 -1
  168. package/es/extensions/forms/Field/Number/NumberDocs.js +10 -0
  169. package/es/extensions/forms/Field/Number/NumberDocs.js.map +1 -1
  170. package/es/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +3 -3
  171. package/es/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
  172. package/es/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js +2 -2
  173. package/es/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js.map +1 -1
  174. package/es/extensions/forms/Iterate/EditContainer/EditToolbarTools.js +5 -4
  175. package/es/extensions/forms/Iterate/EditContainer/EditToolbarTools.js.map +1 -1
  176. package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js +2 -2
  177. package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
  178. package/es/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js +3 -3
  179. package/es/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js.map +1 -1
  180. package/es/extensions/forms/Wizard/EditButton/EditButton.js +2 -2
  181. package/es/extensions/forms/Wizard/EditButton/EditButton.js.map +1 -1
  182. package/es/extensions/forms/Wizard/NextButton/NextButton.js +2 -2
  183. package/es/extensions/forms/Wizard/NextButton/NextButton.js.map +1 -1
  184. package/es/extensions/forms/Wizard/PreviousButton/PreviousButton.js +2 -2
  185. package/es/extensions/forms/Wizard/PreviousButton/PreviousButton.js.map +1 -1
  186. package/es/extensions/forms/constants/locales/en-GB.d.ts +28 -8
  187. package/es/extensions/forms/constants/locales/en-GB.js +28 -8
  188. package/es/extensions/forms/constants/locales/en-GB.js.map +1 -1
  189. package/es/extensions/forms/constants/locales/en-US.d.ts +28 -8
  190. package/es/extensions/forms/constants/locales/index.d.ts +56 -16
  191. package/es/extensions/forms/constants/locales/nb-NO.d.ts +28 -8
  192. package/es/extensions/forms/constants/locales/nb-NO.js +28 -8
  193. package/es/extensions/forms/constants/locales/nb-NO.js.map +1 -1
  194. package/es/extensions/forms/hooks/DataValueDocs.js +1 -1
  195. package/es/extensions/forms/hooks/DataValueDocs.js.map +1 -1
  196. package/es/extensions/payment-card/utils/cardProducts.js +7 -7
  197. package/es/extensions/payment-card/utils/cardProducts.js.map +1 -1
  198. package/es/shared/Eufemia.d.ts +1 -1
  199. package/es/shared/Eufemia.js +2 -2
  200. package/es/shared/Eufemia.js.map +1 -1
  201. package/es/shared/helpers/isAsync.js +5 -1
  202. package/es/shared/helpers/isAsync.js.map +1 -1
  203. package/es/shared/locales/en-GB.d.ts +1 -0
  204. package/es/shared/locales/en-GB.js +2 -1
  205. package/es/shared/locales/en-GB.js.map +1 -1
  206. package/es/shared/locales/en-US.d.ts +1 -0
  207. package/es/shared/locales/index.d.ts +2 -0
  208. package/es/shared/locales/nb-NO.d.ts +1 -0
  209. package/es/shared/locales/nb-NO.js +2 -1
  210. package/es/shared/locales/nb-NO.js.map +1 -1
  211. package/es/style/core/scopes.scss +1 -1
  212. package/es/style/dnb-ui-basis.css +1 -1
  213. package/es/style/dnb-ui-basis.min.css +1 -1
  214. package/es/style/dnb-ui-body.css +1 -1
  215. package/es/style/dnb-ui-body.min.css +1 -1
  216. package/es/style/dnb-ui-components.css +67 -61
  217. package/es/style/dnb-ui-components.min.css +2 -2
  218. package/es/style/dnb-ui-core.css +1 -1
  219. package/es/style/dnb-ui-core.min.css +1 -1
  220. package/es/style/themes/theme-eiendom/eiendom-theme-components.css +67 -61
  221. package/es/style/themes/theme-eiendom/eiendom-theme-components.min.css +2 -2
  222. package/es/style/themes/theme-sbanken/sbanken-theme-components.css +67 -61
  223. package/es/style/themes/theme-sbanken/sbanken-theme-components.min.css +2 -2
  224. package/es/style/themes/theme-ui/ui-theme-components.css +67 -61
  225. package/es/style/themes/theme-ui/ui-theme-components.min.css +2 -2
  226. package/esm/dnb-ui-basis.min.mjs +1 -1
  227. package/esm/dnb-ui-components.min.mjs +1 -1
  228. package/esm/dnb-ui-elements.min.mjs +1 -1
  229. package/esm/dnb-ui-extensions.min.mjs +3 -3
  230. package/esm/dnb-ui-lib.min.mjs +1 -1
  231. package/extensions/forms/Field/Number/Number.d.ts +3 -1
  232. package/extensions/forms/Field/Number/Number.js +6 -2
  233. package/extensions/forms/Field/Number/Number.js.map +1 -1
  234. package/extensions/forms/Field/Number/NumberDocs.js +10 -0
  235. package/extensions/forms/Field/Number/NumberDocs.js.map +1 -1
  236. package/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +3 -3
  237. package/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
  238. package/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js +2 -2
  239. package/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js.map +1 -1
  240. package/extensions/forms/Iterate/EditContainer/EditToolbarTools.js +5 -4
  241. package/extensions/forms/Iterate/EditContainer/EditToolbarTools.js.map +1 -1
  242. package/extensions/forms/Iterate/RemoveButton/RemoveButton.js +2 -2
  243. package/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
  244. package/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js +3 -3
  245. package/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js.map +1 -1
  246. package/extensions/forms/Wizard/EditButton/EditButton.js +2 -2
  247. package/extensions/forms/Wizard/EditButton/EditButton.js.map +1 -1
  248. package/extensions/forms/Wizard/NextButton/NextButton.js +2 -2
  249. package/extensions/forms/Wizard/NextButton/NextButton.js.map +1 -1
  250. package/extensions/forms/Wizard/PreviousButton/PreviousButton.js +2 -2
  251. package/extensions/forms/Wizard/PreviousButton/PreviousButton.js.map +1 -1
  252. package/extensions/forms/constants/locales/en-GB.d.ts +28 -8
  253. package/extensions/forms/constants/locales/en-GB.js +28 -8
  254. package/extensions/forms/constants/locales/en-GB.js.map +1 -1
  255. package/extensions/forms/constants/locales/en-US.d.ts +28 -8
  256. package/extensions/forms/constants/locales/index.d.ts +56 -16
  257. package/extensions/forms/constants/locales/nb-NO.d.ts +28 -8
  258. package/extensions/forms/constants/locales/nb-NO.js +28 -8
  259. package/extensions/forms/constants/locales/nb-NO.js.map +1 -1
  260. package/extensions/forms/hooks/DataValueDocs.js +1 -1
  261. package/extensions/forms/hooks/DataValueDocs.js.map +1 -1
  262. package/extensions/payment-card/utils/cardProducts.js +7 -7
  263. package/extensions/payment-card/utils/cardProducts.js.map +1 -1
  264. package/package.json +1 -1
  265. package/shared/Eufemia.d.ts +1 -1
  266. package/shared/Eufemia.js +2 -2
  267. package/shared/Eufemia.js.map +1 -1
  268. package/shared/helpers/isAsync.js +5 -1
  269. package/shared/helpers/isAsync.js.map +1 -1
  270. package/shared/locales/en-GB.d.ts +1 -0
  271. package/shared/locales/en-GB.js +2 -1
  272. package/shared/locales/en-GB.js.map +1 -1
  273. package/shared/locales/en-US.d.ts +1 -0
  274. package/shared/locales/index.d.ts +2 -0
  275. package/shared/locales/nb-NO.d.ts +1 -0
  276. package/shared/locales/nb-NO.js +2 -1
  277. package/shared/locales/nb-NO.js.map +1 -1
  278. package/style/core/scopes.scss +1 -1
  279. package/style/dnb-ui-basis.css +1 -1
  280. package/style/dnb-ui-basis.min.css +1 -1
  281. package/style/dnb-ui-body.css +1 -1
  282. package/style/dnb-ui-body.min.css +1 -1
  283. package/style/dnb-ui-components.css +67 -61
  284. package/style/dnb-ui-components.min.css +2 -2
  285. package/style/dnb-ui-core.css +1 -1
  286. package/style/dnb-ui-core.min.css +1 -1
  287. package/style/themes/theme-eiendom/eiendom-theme-components.css +67 -61
  288. package/style/themes/theme-eiendom/eiendom-theme-components.min.css +2 -2
  289. package/style/themes/theme-sbanken/sbanken-theme-components.css +67 -61
  290. package/style/themes/theme-sbanken/sbanken-theme-components.min.css +2 -2
  291. package/style/themes/theme-ui/ui-theme-components.css +67 -61
  292. package/style/themes/theme-ui/ui-theme-components.min.css +2 -2
  293. package/umd/dnb-ui-basis.min.js +1 -1
  294. package/umd/dnb-ui-components.min.js +1 -1
  295. package/umd/dnb-ui-elements.min.js +1 -1
  296. package/umd/dnb-ui-extensions.min.js +3 -3
  297. package/umd/dnb-ui-lib.min.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/components/modal/types.ts"],"sourcesContent":["import * as React from 'react'\nimport type { CloseButtonProps } from './parts/CloseButton'\nimport type { ButtonProps } from '../button/Button'\nimport type { ModalRootProps } from './ModalRoot'\n\nexport type ReactChildType = React.ReactNode | ((...args: any[]) => any)\n\nexport type ModalFullscreen = 'auto' | boolean\nexport type ModalAlignContent = 'left' | 'center' | 'centered' | 'right'\nexport type ModalContainerPlacement = 'left' | 'right' | 'top' | 'bottom'\nexport type ModalOpenState = 'opened' | 'closed' | boolean\nexport type ModalTriggerVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'signal'\nexport type ModalTriggerIconPosition = 'left' | 'right'\nexport type ModalContentMinWidth = string | number\nexport type ModalContentMaxWidth = string | number\n\nexport interface ModalProps extends ModalRootProps {\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n id?: string\n\n /**\n * Will disable the trigger button.\n */\n disabled?: boolean\n\n /**\n * Forces the modal/drawer to delay the opening. The delay is given in `ms`.\n */\n open_delay?: string | number\n\n /**\n * If set to `true` (boolean or string), then the user can&#39;t close the modal/drawer.\n */\n prevent_close?: boolean\n\n /**\n * Duration of animation open/close in ms. Defaults to 300ms.\n */\n animation_duration?: string | number\n\n /**\n * If set to `true`, no open/close animation will be shown. Defaults to false.\n */\n no_animation?: boolean\n\n /**\n * Use this prop to control the open/close state by setting either: `opened` / `closed` or `true` / `false`.\n */\n open_state?: ModalOpenState\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /**\n * Omits default showing trigger button\n */\n omit_trigger_button?: boolean\n\n /**\n * This event gets triggered once the modal shows up. Returns the modal id: `{ id }`.\n */\n on_open?: ({ id }: { id?: string }) => void\n\n /**\n * This event gets triggered once the modal gets closed. Returns the modal id: `{ id, event, triggeredBy }`.\n */\n on_close?: ({\n id,\n event,\n triggeredBy,\n }: {\n id?: string\n event?: Event\n triggeredBy?: string\n }) => void\n\n /**\n * This event gets triggered once the user tries to close the modal, but `prevent_close` is set to \"true\". Returns a callback `close` you can call to trigger the close mechanism. More details below. Returns the modal id: `{ id, event, close: Method, triggeredBy }`\n */\n on_close_prevent?: ({\n id,\n event,\n triggeredBy,\n close,\n }: {\n id?: string\n event?: Event\n triggeredBy?: string\n close?: (...args: any[]) => any\n }) => void\n\n /**\n * Set a function to call the callback function, once the modal/drawer should open: `open_modal={(open) => open()}`\n */\n open_modal?: (open?: (e: Event) => void, elem?: any) => () => void | void\n\n /**\n * Set a function to call the callback function, once the modal/drawer should close: `close_modal={(close) => close()}`\n */\n close_modal?: (\n close?: (...args: any[]) => void,\n elem?: any\n ) => () => void | void\n\n /**\n * Provide a custom trigger component. Like trigger={<Anchor href=\"/\" />}. It will set the focus on it when the modal/drawer gets closed.\n */\n trigger?: ReactChildType\n\n /**\n * Send along custom HTML attributes or properties to the trigger button.\n */\n trigger_attributes?: TriggerAttributes\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n modal_content?: ReactChildType\n\n /**\n * If true, the drawer will not open in a new DOM but directly in current DOM. Defaults to `false`.\n */\n direct_dom_return?: boolean\n\n /**\n * To get the inner content Element, pass in your own React ref\n */\n content_ref?: React.RefObject<HTMLElement>\n\n /**\n * To get the scroll Element, pass in your own React ref\n */\n scroll_ref?: React.RefObject<HTMLElement>\n}\n\nexport interface ModalContentProps {\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n modal_content?: ReactChildType\n\n /**\n * The content which will appear in the bar, above the header, and side-by-side the close button.\n */\n bar_content?: ReactChildType\n\n /**\n * The content which will appear in the header of the modal/drawer the modal/drawer.\n */\n header_content?: ReactChildType\n hide?: boolean\n\n /**\n * The id used internal for the trigger button and modal component.\n */\n id?: string\n\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n root_id?: string\n\n /**\n * The ID of the trigger component, describing the modal/drawer content. Defaults to the internal `trigger`, so make sure you define the trigger title.\n */\n labelled_by?: string\n\n /**\n * The Modal handles the first focus – automatically. How ever, you can defined a custom focus selector the will be used instead `focus_selector=\".css-selector\"`.\n */\n focus_selector?: string\n\n /**\n * Defines an unique identifier to a modal. Use it in case you have to refer in some way to the modal/drawer content wrapper.\n */\n content_id?: string\n\n /**\n * The modal/drawer title. Displays on the very top of the content.\n */\n title?: React.ReactNode\n\n /**\n * The aria label of the dialog when no labelled_by and no title is given. Defaults to `Vindu`.\n */\n dialog_title?: string\n\n /**\n * If boolean, the close button will not be shown.\n */\n hide_close_button?: boolean\n\n /**\n * Define any valid Eufemia Button property or HTML attribute inside an object.\n */\n close_button_attributes?: CloseButtonProps\n\n /**\n * If set to `false` then the modal/drawer content will be shown without any spacing. Defaults to `true`.\n */\n spacing?: boolean\n\n /**\n * By default the modal/drawer content gets added the core style class `dnb-core-style`. Use `false` to disable this behavior.\n */\n prevent_core_style?: boolean\n animation_duration?: string | number\n\n /**\n * Disable clicking the background overlay to close the modal\n */\n prevent_overlay_close?: boolean\n\n /**\n * If set to `true`, no open/close animation will be shown. Defaults to false.\n */\n no_animation?: boolean\n\n /**\n * Same as `no_animation`, but gets triggered only if the viewport width is less than `40em`. Defaults to false.\n */\n no_animation_on_mobile?: boolean\n\n /**\n * The minimum Modal content width, defined by a CSS width value like `50vw` (50% of the viewport). Be careful on using fixed `min_width` so you don&#39;t break responsiveness. Defaults to `30rem` (average width is set to `60vw`).\n */\n min_width?: ModalContentMinWidth\n\n /**\n * The maximum Modal content width, defined by a CSS width value like `20rem`. Defaults to `60rem` (average width is set to `60vw`).\n */\n max_width?: ModalContentMaxWidth\n\n /**\n * If set to `true` then the modal/drawer content will be shown as fullscreen, without showing the original content behind. Can be set to `false` to omit the auto fullscreen. Defaults to `auto`.\n */\n fullscreen?: ModalFullscreen\n\n /**\n * Define the inner horizontal alignment of the content. Can be set to `left`, `center`, `right` and `centered`. If `centered`, then the content will also be centered vertically. Defaults to `left`.\n */\n align_content?: 'right' | 'left' | 'centered' | 'center'\n\n /**\n * For `drawer` mode only. Defines the placement on what side the Drawer should be opened. Can be set to `left`, `right`, `top` and `bottom`. Defaults to `right`.\n */\n container_placement?: 'left' | 'right' | 'top' | 'bottom'\n\n /**\n * Give the content wrapper a custom class name (maps to `dnb-modal__content`).\n */\n content_class?: string\n\n /**\n * Give the page overlay a custom class name (maps to `dnb-modal__overlay`).\n */\n overlay_class?: string\n\n /**\n * Define an array with HTML class selectors (`['.element-selector']`) which should not get invalidated when the modal opens/closes. Use this in order to let some parts of your site still be accessible by screen readers.\n */\n bypass_invalidation_selectors?: Array<string>\n\n /**\n * For internal usage\n * Will close the modal\n */\n close?: (...args: any[]) => any\n\n /**\n * Give the inner Dialog or Drawer component a className (only works with mode)\n */\n className?: string\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /**\n * The displayed text for the 'close' button. Defaults to `Lukk`.\n */\n close_title?: string\n\n /**\n * Internal\n */\n dialog_role?: 'dialog' | 'alertdialog' | 'region'\n content_ref?: React.RefObject<HTMLElement>\n scroll_ref?: React.RefObject<HTMLElement>\n}\n\nexport type TriggerAttributes = ButtonProps\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/components/modal/types.ts"],"sourcesContent":["import * as React from 'react'\nimport type { CloseButtonProps } from './parts/CloseButton'\nimport type { ButtonProps } from '../button/Button'\nimport type { ModalRootProps } from './ModalRoot'\n\nexport type ReactChildType = React.ReactNode | ((...args: any[]) => any)\n\nexport type ModalFullscreen = 'auto' | boolean\nexport type ModalAlignContent = 'left' | 'center' | 'centered' | 'right'\nexport type ModalContainerPlacement = 'left' | 'right' | 'top' | 'bottom'\nexport type ModalOpenState = 'opened' | 'closed' | boolean\nexport type ModalTriggerVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'signal'\nexport type ModalTriggerIconPosition = 'left' | 'right'\nexport type ModalContentMinWidth = string | number\nexport type ModalContentMaxWidth = string | number\n\nexport interface ModalProps extends ModalRootProps {\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n id?: string\n\n /**\n * Will disable the trigger button.\n */\n disabled?: boolean\n\n /**\n * Forces the modal/drawer to delay the opening. The delay is given in `ms`.\n */\n open_delay?: string | number\n\n /**\n * If set to `true` (boolean or string), then the user can&#39;t close the modal/drawer.\n */\n prevent_close?: boolean\n\n /**\n * Duration of animation open/close in ms. Defaults to 300ms.\n */\n animation_duration?: string | number\n\n /**\n * If set to `true`, no open/close animation will be shown. Defaults to false.\n */\n no_animation?: boolean\n\n /**\n * Use this prop to control the open/close state by setting either: `opened` / `closed` or `true` / `false`.\n */\n open_state?: ModalOpenState\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /**\n * Omits default showing trigger button\n */\n omit_trigger_button?: boolean\n\n /**\n * This event gets triggered once the modal shows up. Returns the modal id: `{ id }`.\n */\n on_open?: ({ id }: { id?: string }) => void\n\n /**\n * This event gets triggered once the modal gets closed. Returns the modal id: `{ id, event, triggeredBy }`.\n */\n on_close?: ({\n id,\n event,\n triggeredBy,\n }: {\n id?: string\n event?: Event\n triggeredBy?: string\n }) => void\n\n /**\n * This event gets triggered once the user tries to close the modal, but `prevent_close` is set to \"true\". Returns a callback `close` you can call to trigger the close mechanism. More details below. Returns the modal id: `{ id, event, close: Method, triggeredBy }`\n */\n on_close_prevent?: ({\n id,\n event,\n triggeredBy,\n close,\n }: {\n id?: string\n event?: Event\n triggeredBy?: string\n close?: (...args: any[]) => any\n }) => void\n\n /**\n * Set a function to call the callback function, once the modal/drawer should open: `open_modal={(open) => open()}`\n */\n open_modal?: (open?: (e: Event) => void, elem?: any) => () => void | void\n\n /**\n * Set a function to call the callback function, once the modal/drawer should close: `close_modal={(close) => close()}`\n */\n close_modal?: (\n close?: (...args: any[]) => void,\n elem?: any\n ) => () => void | void\n\n /**\n * Provide a custom trigger component. Like trigger={<Anchor href=\"/\" />}. It will set the focus on it when the modal/drawer gets closed.\n */\n trigger?: ReactChildType\n\n /**\n * Send along custom HTML attributes or properties to the trigger button.\n */\n trigger_attributes?: TriggerAttributes\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n modal_content?: ReactChildType\n\n /**\n * If true, the drawer will not open in a new DOM but directly in current DOM. Defaults to `false`.\n */\n direct_dom_return?: boolean\n\n /**\n * To get the inner content Element, pass in your own React ref\n */\n content_ref?: React.RefObject<HTMLElement>\n\n /**\n * To get the scroll Element, pass in your own React ref\n */\n scroll_ref?: React.RefObject<HTMLElement>\n}\n\nexport interface ModalContentProps {\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n modal_content?: ReactChildType\n\n /**\n * The content which will appear in the bar, above the header, and side-by-side the close button.\n */\n bar_content?: ReactChildType\n\n /**\n * The content which will appear in the header of the modal/drawer the modal/drawer.\n */\n header_content?: ReactChildType\n hide?: boolean\n\n /**\n * The id used internal for the trigger button and modal component.\n */\n id?: string\n\n /**\n * The id used internal in the modal/drawer root element. Defaults to `root`, so the element id will be `dnb-modal-root`.\n */\n root_id?: string\n\n /**\n * The ID of the trigger component, describing the modal/drawer content. Defaults to the internal `trigger`, so make sure you define the trigger title.\n */\n labelled_by?: string\n\n /**\n * The Modal handles the first focus – automatically. How ever, you can defined a custom focus selector the will be used instead `focus_selector=\".css-selector\"`.\n */\n focus_selector?: string\n\n /**\n * Defines an unique identifier to a modal. Use it in case you have to refer in some way to the modal/drawer content wrapper.\n */\n content_id?: string\n\n /**\n * The modal/drawer title. Displays on the very top of the content.\n */\n title?: React.ReactNode\n\n /**\n * The aria label of the dialog when no labelled_by and no title is given. Defaults to `Vindu`.\n */\n dialog_title?: string\n\n /**\n * If boolean, the close button will not be shown.\n */\n hide_close_button?: boolean\n\n /**\n * Define any valid Eufemia Button property or HTML attribute inside an object.\n */\n close_button_attributes?: CloseButtonProps\n\n /**\n * If set to `false` then the modal/drawer content will be shown without any spacing. Defaults to `true`.\n */\n spacing?: boolean\n\n /**\n * By default the modal/drawer content gets added the core style class `dnb-core-style`. Use `false` to disable this behavior.\n */\n prevent_core_style?: boolean\n animation_duration?: string | number\n\n /**\n * Disable clicking the background overlay to close the modal\n */\n prevent_overlay_close?: boolean\n\n /**\n * If set to `true`, no open/close animation will be shown. Defaults to false.\n */\n no_animation?: boolean\n\n /**\n * Same as `no_animation`, but gets triggered only if the viewport width is less than `40em`. Defaults to false.\n */\n no_animation_on_mobile?: boolean\n\n /**\n * The minimum Modal content width, defined by a CSS width value like `50vw` (50% of the viewport). Be careful on using fixed `min_width` so you don&#39;t break responsiveness. Defaults to `30rem` (average width is set to `60vw`).\n */\n min_width?: ModalContentMinWidth\n\n /**\n * The maximum Modal content width, defined by a CSS width value like `20rem`. Defaults to `60rem` (average width is set to `60vw`).\n */\n max_width?: ModalContentMaxWidth\n\n /**\n * If set to `true` then the modal/drawer content will be shown as fullscreen, without showing the original content behind. Can be set to `false` to omit the auto fullscreen. Defaults to `auto`.\n */\n fullscreen?: ModalFullscreen\n\n /**\n * Define the inner horizontal alignment of the content. Can be set to `left`, `center`, `right` and `centered`. If `centered`, then the content will also be centered vertically. Defaults to `left`.\n */\n align_content?: 'right' | 'left' | 'centered' | 'center'\n\n /**\n * For `drawer` mode only. Defines the placement on what side the Drawer should be opened. Can be set to `left`, `right`, `top` and `bottom`. Defaults to `right`.\n */\n container_placement?: 'left' | 'right' | 'top' | 'bottom'\n\n /**\n * Give the content wrapper a custom class name (maps to `dnb-modal__content`).\n */\n content_class?: string\n\n /**\n * @deprecated – use className instead. Will be removed in v11.\n */\n class?: string\n\n /**\n * Give the page overlay a custom class name (maps to `dnb-modal__overlay`).\n */\n overlay_class?: string\n\n /**\n * Define an array with HTML class selectors (`['.element-selector']`) which should not get invalidated when the modal opens/closes. Use this in order to let some parts of your site still be accessible by screen readers.\n */\n bypass_invalidation_selectors?: Array<string>\n\n /**\n * For internal usage\n * Will close the modal\n */\n close?: (...args: any[]) => any\n\n /**\n * Give the inner Dialog or Drawer component a className (only works with mode)\n */\n className?: string\n\n /**\n * The content which will appear when triggering the modal/drawer.\n */\n children?: ReactChildType\n\n /**\n * The displayed text for the 'close' button. Defaults to `Lukk`.\n */\n close_title?: string\n\n /**\n * Internal\n */\n dialog_role?: 'dialog' | 'alertdialog' | 'region'\n content_ref?: React.RefObject<HTMLElement>\n scroll_ref?: React.RefObject<HTMLElement>\n}\n\nexport type TriggerAttributes = ButtonProps\n"],"mappings":""}
@@ -40,12 +40,15 @@ export type TableProps = {
40
40
  */
41
41
  outline?: boolean;
42
42
  /**
43
- * Set to true if you have one or more rows that contains an accordion content.
44
- * Default: false
43
+ * Defines how the Table should look. Use `accordion` for an accordion-like table. Use `navigation` for a navigation table.
44
+ */
45
+ mode?: 'accordion' | 'navigation';
46
+ /**
47
+ * @deprecated – use mode="accordion" instead. Will be removed in v11.
45
48
  */
46
49
  accordion?: boolean;
47
50
  /**
48
- * Defines where the chevron will be placed.
51
+ * Defines where the chevron will be placed, should only be used together with mode="accordion".
49
52
  * Default: 'start'
50
53
  */
51
54
  accordionChevronPlacement?: 'start' | 'end';
@@ -22,7 +22,7 @@ var _TableScrollView = _interopRequireDefault(require("./TableScrollView"));
22
22
  var _TableContext = require("./TableContext");
23
23
  var _TableStickyHeader = require("./TableStickyHeader");
24
24
  var _TableTr = require("./TableTr");
25
- const _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed", "border", "outline", "accordion", "accordionChevronPlacement", "collapseAllHandleRef"];
25
+ const _excluded = ["className", "children", "size", "skeleton", "variant", "sticky", "stickyOffset", "fixed", "border", "outline", "accordion", "mode", "accordionChevronPlacement", "collapseAllHandleRef"];
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
28
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -56,6 +56,7 @@ const Table = componentProps => {
56
56
  border,
57
57
  outline,
58
58
  accordion,
59
+ mode,
59
60
  accordionChevronPlacement,
60
61
  collapseAllHandleRef
61
62
  } = allProps,
@@ -90,7 +91,10 @@ const Table = componentProps => {
90
91
  allProps: _objectSpread(_objectSpread({}, allProps), context.getTranslation(componentProps).Table)
91
92
  }
92
93
  }, _react.default.createElement("table", _extends({
93
- className: (0, _classnames.default)('dnb-table', spacingClasses, skeletonClasses, className, variant && `dnb-table__variant--${variant}`, size && `dnb-table__size--${size}`, sticky && 'dnb-table--sticky', fixed && 'dnb-table--fixed', border && 'dnb-table--border', outline && 'dnb-table--outline', accordion && 'dnb-table--accordion'),
94
+ className: (0, _classnames.default)('dnb-table', spacingClasses, skeletonClasses, className, variant && `dnb-table__variant--${variant}`, size && `dnb-table__size--${size}`, sticky && 'dnb-table--sticky', fixed && 'dnb-table--fixed', border && 'dnb-table--border', outline && 'dnb-table--outline', accordion && 'dnb-table--accordion', {
95
+ 'accordion': 'dnb-table--accordion',
96
+ 'navigation': 'dnb-table--navigation'
97
+ }[mode]),
94
98
  ref: elementRef
95
99
  }, props), children)));
96
100
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Context","_Provider","_SpacingHelper","_SkeletonHelper","_componentHelper","_TableScrollView","_TableContext","_TableStickyHeader","_TableTr","_excluded","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","_objectSpread","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","defaultProps","size","variant","exports","Table","componentProps","context","React","useContext","Context","allProps","extendPropsWithContext","skeleton","className","children","sticky","stickyOffset","fixed","border","outline","accordion","accordionChevronPlacement","collapseAllHandleRef","props","elementRef","useStickyHeader","trCountRef","rerenderAlias","useHandleOddEven","collapseTrCallbacks","useRef","useEffect","current","callback","skeletonClasses","createSkeletonClass","spacingClasses","createSpacingClasses","validateDOMAttributes","createElement","Boolean","TableContext","Provider","getTranslation","classnames","ref","_supportsSpacingProps","_default","ScrollView"],"sources":["../../../../src/components/table/Table.tsx"],"sourcesContent":["import React, { useEffect } from 'react'\nimport classnames from 'classnames'\nimport Context from '../../shared/Context'\nimport Provider from '../../shared/Provider'\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport { createSkeletonClass } from '../skeleton/SkeletonHelper'\nimport {\n extendPropsWithContext,\n validateDOMAttributes,\n} from '../../shared/component-helper'\nimport ScrollView from './TableScrollView'\nimport { TableContext } from './TableContext'\nimport { useStickyHeader } from './TableStickyHeader'\n\nimport type { StickyTableHeaderProps } from './TableStickyHeader'\nimport type { SkeletonShow } from '../skeleton/Skeleton'\nimport type { LocaleProps, SpacingProps } from '../../shared/types'\nimport { useHandleOddEven } from './TableTr'\n\nexport type TableSizes = 'large' | 'medium' | 'small'\nexport type TableVariants = 'generic'\n\nexport { ScrollView }\n\nexport type TableProps = {\n /**\n * The content of the component.\n */\n children: React.ReactNode\n\n /**\n * Custom className on the component root\n */\n className?: string\n\n /**\n * Skeleton should be applied when loading content\n */\n skeleton?: SkeletonShow\n\n /**\n * The size of the component.\n * Default: large.\n */\n size?: TableSizes\n\n /**\n * The style variant of the component. Currently not implemented.\n * Default: generic.\n */\n variant?: TableVariants\n\n /**\n * Use `true` to show borders between table data cell\n * Default: false\n */\n border?: boolean\n\n /**\n * Use `true` to show a outline border around the table\n * Default: false\n */\n outline?: boolean\n\n /**\n * Set to true if you have one or more rows that contains an accordion content.\n * Default: false\n */\n accordion?: boolean\n\n /**\n * Defines where the chevron will be placed.\n * Default: 'start'\n */\n accordionChevronPlacement?: 'start' | 'end'\n\n /**\n * Defines if the table should behave with a fixed table layout, using: \"table-layout: fixed;\"\n * Default: null.\n */\n fixed?: boolean\n\n /**\n * ref handle to collapse all expanded accordion rows. Send in a ref and use `.current()` to collapse all rows.\n *\n * Default: `undefined`\n */\n collapseAllHandleRef?: React.MutableRefObject<() => void>\n} & StickyTableHeaderProps\n\nexport type TableAllProps = TableProps &\n Omit<React.TableHTMLAttributes<HTMLTableElement>, 'border'> &\n LocaleProps &\n SpacingProps\n\nexport const defaultProps = {\n size: 'large',\n variant: 'generic',\n}\n\nconst Table = (componentProps: TableAllProps) => {\n const context = React.useContext(Context)\n\n const allProps = extendPropsWithContext(\n componentProps,\n defaultProps,\n context?.Table,\n {\n skeleton: context?.skeleton,\n }\n )\n\n const {\n className,\n children,\n size,\n skeleton,\n variant,\n sticky,\n stickyOffset, // eslint-disable-line\n fixed,\n border,\n outline,\n accordion,\n accordionChevronPlacement, // eslint-disable-line\n collapseAllHandleRef,\n ...props\n } = allProps\n\n const { elementRef } = useStickyHeader(allProps)\n const { trCountRef, rerenderAlias } = useHandleOddEven({ children })\n const collapseTrCallbacks = React.useRef<(() => void)[]>([])\n\n useEffect(() => {\n if (collapseAllHandleRef) {\n collapseAllHandleRef.current = () => {\n collapseTrCallbacks.current.forEach((callback) => callback())\n }\n }\n }, [collapseAllHandleRef])\n\n const skeletonClasses = createSkeletonClass('font', skeleton, context)\n const spacingClasses = createSpacingClasses(props)\n\n validateDOMAttributes(allProps, props)\n\n return (\n <Provider skeleton={Boolean(skeleton)}>\n <TableContext.Provider\n value={{\n trCountRef,\n rerenderAlias,\n collapseTrCallbacks,\n allProps: {\n ...allProps,\n ...context.getTranslation(componentProps).Table,\n },\n }}\n >\n <table\n className={classnames(\n 'dnb-table',\n variant && `dnb-table__variant--${variant}`,\n size && `dnb-table__size--${size}`,\n sticky && 'dnb-table--sticky',\n fixed && 'dnb-table--fixed',\n border && 'dnb-table--border',\n outline && 'dnb-table--outline',\n accordion && 'dnb-table--accordion',\n spacingClasses,\n skeletonClasses,\n className\n )}\n ref={elementRef}\n {...props}\n >\n {children}\n </table>\n </TableContext.Provider>\n </Provider>\n )\n}\n\nTable._supportsSpacingProps = true\n\nexport default Table\n\nTable.ScrollView = ScrollView\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAIA,IAAAQ,gBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAV,OAAA;AAKA,IAAAW,QAAA,GAAAX,OAAA;AAA4C,M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CAAA0G,aAAA,UAAAtF,QAAA;IACE4D,SAAS,EAAE,IAAA+B,mBAAU,EACnB,WAAW,EAQXR,cAAc,EACdF,eAAe,EACfrB,SAAS,EATTX,OAAO,IAAK,uBAAsBA,OAAQ,EAAC,EAC3CD,IAAI,IAAK,oBAAmBA,IAAK,EAAC,EAClCc,MAAM,IAAI,mBAAmB,EAC7BE,KAAK,IAAI,kBAAkB,EAC3BC,MAAM,IAAI,mBAAmB,EAC7BC,OAAO,IAAI,oBAAoB,EAC/BC,SAAS,IAAI,sBAIf,CAAE;IACFyB,GAAG,EAAErB;EAAW,GACZD,KAAK,GAERT,QACI,CACc,CACf,CAAC;AAEf,CAAC;AAEDV,KAAK,CAAC0C,qBAAqB,GAAG,IAAI;AAAA,IAAAC,QAAA,GAEnB3C,KAAK;AAAAD,OAAA,CAAAtE,OAAA,GAAAkH,QAAA;AAEpB3C,KAAK,CAAC4C,UAAU,GAAGA,wBAAU"}
1
+ {"version":3,"file":"Table.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Context","_Provider","_SpacingHelper","_SkeletonHelper","_componentHelper","_TableScrollView","_TableContext","_TableStickyHeader","_TableTr","_excluded","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","_objectSpread","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","defaultProps","size","variant","exports","Table","componentProps","context","React","useContext","Context","allProps","extendPropsWithContext","skeleton","className","children","sticky","stickyOffset","fixed","border","outline","accordion","mode","accordionChevronPlacement","collapseAllHandleRef","props","elementRef","useStickyHeader","trCountRef","rerenderAlias","useHandleOddEven","collapseTrCallbacks","useRef","useEffect","current","callback","skeletonClasses","createSkeletonClass","spacingClasses","createSpacingClasses","validateDOMAttributes","createElement","Boolean","TableContext","Provider","getTranslation","classnames","ref","_supportsSpacingProps","_default","ScrollView"],"sources":["../../../../src/components/table/Table.tsx"],"sourcesContent":["import React, { useEffect } from 'react'\nimport classnames from 'classnames'\nimport Context from '../../shared/Context'\nimport Provider from '../../shared/Provider'\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport { createSkeletonClass } from '../skeleton/SkeletonHelper'\nimport {\n extendPropsWithContext,\n validateDOMAttributes,\n} from '../../shared/component-helper'\nimport ScrollView from './TableScrollView'\nimport { TableContext } from './TableContext'\nimport { useStickyHeader } from './TableStickyHeader'\n\nimport type { StickyTableHeaderProps } from './TableStickyHeader'\nimport type { SkeletonShow } from '../skeleton/Skeleton'\nimport type { LocaleProps, SpacingProps } from '../../shared/types'\nimport { useHandleOddEven } from './TableTr'\n\nexport type TableSizes = 'large' | 'medium' | 'small'\nexport type TableVariants = 'generic'\n\nexport { ScrollView }\n\nexport type TableProps = {\n /**\n * The content of the component.\n */\n children: React.ReactNode\n\n /**\n * Custom className on the component root\n */\n className?: string\n\n /**\n * Skeleton should be applied when loading content\n */\n skeleton?: SkeletonShow\n\n /**\n * The size of the component.\n * Default: large.\n */\n size?: TableSizes\n\n /**\n * The style variant of the component. Currently not implemented.\n * Default: generic.\n */\n variant?: TableVariants\n\n /**\n * Use `true` to show borders between table data cell\n * Default: false\n */\n border?: boolean\n\n /**\n * Use `true` to show a outline border around the table\n * Default: false\n */\n outline?: boolean\n\n /**\n * Defines how the Table should look. Use `accordion` for an accordion-like table. Use `navigation` for a navigation table.\n */\n mode?: 'accordion' | 'navigation'\n\n /**\n * @deprecated – use mode=\"accordion\" instead. Will be removed in v11.\n */\n accordion?: boolean\n\n /**\n * Defines where the chevron will be placed, should only be used together with mode=\"accordion\".\n * Default: 'start'\n */\n accordionChevronPlacement?: 'start' | 'end'\n\n /**\n * Defines if the table should behave with a fixed table layout, using: \"table-layout: fixed;\"\n * Default: null.\n */\n fixed?: boolean\n\n /**\n * ref handle to collapse all expanded accordion rows. Send in a ref and use `.current()` to collapse all rows.\n *\n * Default: `undefined`\n */\n collapseAllHandleRef?: React.MutableRefObject<() => void>\n} & StickyTableHeaderProps\n\nexport type TableAllProps = TableProps &\n Omit<React.TableHTMLAttributes<HTMLTableElement>, 'border'> &\n LocaleProps &\n SpacingProps\n\nexport const defaultProps = {\n size: 'large',\n variant: 'generic',\n}\n\nconst Table = (componentProps: TableAllProps) => {\n const context = React.useContext(Context)\n\n const allProps = extendPropsWithContext(\n componentProps,\n defaultProps,\n context?.Table,\n {\n skeleton: context?.skeleton,\n }\n )\n\n const {\n className,\n children,\n size,\n skeleton,\n variant,\n sticky,\n stickyOffset, // eslint-disable-line\n fixed,\n border,\n outline,\n accordion, // Deprecated – can be removed in v11\n mode,\n accordionChevronPlacement, // eslint-disable-line\n collapseAllHandleRef,\n ...props\n } = allProps\n\n const { elementRef } = useStickyHeader(allProps)\n const { trCountRef, rerenderAlias } = useHandleOddEven({ children })\n const collapseTrCallbacks = React.useRef<(() => void)[]>([])\n\n useEffect(() => {\n if (collapseAllHandleRef) {\n collapseAllHandleRef.current = () => {\n collapseTrCallbacks.current.forEach((callback) => callback())\n }\n }\n }, [collapseAllHandleRef])\n\n const skeletonClasses = createSkeletonClass('font', skeleton, context)\n const spacingClasses = createSpacingClasses(props)\n\n validateDOMAttributes(allProps, props)\n\n return (\n <Provider skeleton={Boolean(skeleton)}>\n <TableContext.Provider\n value={{\n trCountRef,\n rerenderAlias,\n collapseTrCallbacks,\n allProps: {\n ...allProps,\n ...context.getTranslation(componentProps).Table,\n },\n }}\n >\n <table\n className={classnames(\n 'dnb-table',\n variant && `dnb-table__variant--${variant}`,\n size && `dnb-table__size--${size}`,\n sticky && 'dnb-table--sticky',\n fixed && 'dnb-table--fixed',\n border && 'dnb-table--border',\n outline && 'dnb-table--outline',\n accordion && 'dnb-table--accordion', // Deprecated – can be removed in v11\n mode === 'accordion' && 'dnb-table--accordion',\n mode === 'navigation' && 'dnb-table--navigation',\n spacingClasses,\n skeletonClasses,\n className\n )}\n ref={elementRef}\n {...props}\n >\n {children}\n </table>\n </TableContext.Provider>\n </Provider>\n )\n}\n\nTable._supportsSpacingProps = true\n\nexport default Table\n\nTable.ScrollView = ScrollView\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAIA,IAAAQ,gBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAV,OAAA;AAKA,IAAAW,QAAA,GAAAX,OAAA;AAA4C,MAAAY,SAAA;AAAA,SAAAV,uBAAAW,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAlB,wBAAAc,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oB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ACFyB,GAAG,EAAErB;EAAW,GACZD,KAAK,GAERV,QACI,CACc,CACf,CAAC;AAEf,CAAC;AAEDV,KAAK,CAAC2C,qBAAqB,GAAG,IAAI;AAAA,IAAAC,QAAA,GAEnB5C,KAAK;AAAAD,OAAA,CAAAtE,OAAA,GAAAmH,QAAA;AAEpB5C,KAAK,CAAC6C,UAAU,GAAGA,wBAAU"}
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import type { TableTrProps } from './TableTr';
3
+ export type TableClickableHeadProps = {
4
+ trIsOpen?: boolean;
5
+ trIsHover?: boolean;
6
+ trHadClick?: boolean;
7
+ clickable: boolean;
8
+ noAnimation?: boolean;
9
+ ariaLabel: string;
10
+ } & TableTrProps & React.TableHTMLAttributes<HTMLTableRowElement>;
11
+ export declare function TableClickableHead(allProps: TableClickableHeadProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function onClickTr(event: React.SyntheticEvent, allowInteractiveElement?: boolean, onClick?: (event: React.SyntheticEvent) => void): void;
13
+ export declare function TableClickableButtonTd(props: {
14
+ trIsOpen?: boolean;
15
+ ariaLabel: string;
16
+ icon: 'chevron_down' | 'chevron_right';
17
+ onClick: (event: React.SyntheticEvent, allowInteractiveElement: boolean) => void;
18
+ }): import("react/jsx-runtime").JSX.Element;
19
+ export declare function TableIconSrTh(props: {
20
+ text: string;
21
+ }): import("react/jsx-runtime").JSX.Element;
22
+ export declare const isTableHead: (children: React.ReactNode[]) => boolean;
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TableClickableButtonTd = TableClickableButtonTd;
7
+ exports.TableClickableHead = TableClickableHead;
8
+ exports.TableIconSrTh = TableIconSrTh;
9
+ exports.isTableHead = void 0;
10
+ exports.onClickTr = onClickTr;
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _keycode = _interopRequireDefault(require("keycode"));
14
+ var _helpers = require("../../shared/helpers");
15
+ var _Button = _interopRequireDefault(require("../button/Button"));
16
+ var _IconPrimary = _interopRequireDefault(require("../icon/IconPrimary"));
17
+ var _TableTh = _interopRequireDefault(require("./TableTh"));
18
+ var _TableTd = _interopRequireDefault(require("./TableTd"));
19
+ var _TableContext = require("./TableContext");
20
+ const _excluded = ["children", "className", "disabled", "onClick", "onOpened", "onClosed", "trIsOpen", "trIsHover", "trHadClick", "clickable", "noAnimation", "onMouseEnter", "onMouseLeave", "onKeyDown", "ariaLabel"];
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
24
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
+ function TableClickableHead(allProps) {
26
+ const {
27
+ children,
28
+ className,
29
+ disabled,
30
+ onClick,
31
+ onOpened,
32
+ onClosed,
33
+ trIsOpen,
34
+ trIsHover,
35
+ trHadClick,
36
+ clickable,
37
+ noAnimation,
38
+ onMouseEnter,
39
+ onMouseLeave,
40
+ onKeyDown,
41
+ ariaLabel
42
+ } = allProps,
43
+ props = _objectWithoutProperties(allProps, _excluded);
44
+ const trParams = !disabled && clickable ? {
45
+ onClick: onClick,
46
+ onMouseEnter: onMouseEnter,
47
+ onMouseLeave: onMouseLeave,
48
+ onKeyDown: onKeydownHandler
49
+ } : {};
50
+ return _react.default.createElement("tr", _extends({
51
+ tabIndex: clickable && !disabled ? 0 : undefined,
52
+ className: (0, _classnames.default)(className, clickable && 'dnb-table__tr--clickable', trIsOpen && 'dnb-table__tr--expanded', disabled && 'dnb-table__tr--disabled', noAnimation && 'dnb-table__tr--no-animation', trIsHover && trHadClick && 'dnb-table__tr--hover')
53
+ }, trParams, props), children);
54
+ function onKeydownHandler(event) {
55
+ switch ((0, _keycode.default)(event.nativeEvent)) {
56
+ case 'space':
57
+ case 'enter':
58
+ {
59
+ const target = event.target;
60
+ if (document.activeElement !== target || target.tagName === 'TR') {
61
+ onKeyDown(event);
62
+ event.preventDefault();
63
+ }
64
+ }
65
+ break;
66
+ }
67
+ }
68
+ }
69
+ function onClickTr(event) {
70
+ let allowInteractiveElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
71
+ let onClick = arguments.length > 2 ? arguments[2] : undefined;
72
+ const target = event.target;
73
+ if ((document.activeElement !== target && target.tagName !== 'INPUT' && target.tagName !== 'LABEL' || allowInteractiveElement) && !(0, _helpers.hasSelectedText)()) {
74
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
75
+ }
76
+ }
77
+ function TableClickableButtonTd(props) {
78
+ var _React$useContext;
79
+ const {
80
+ trIsOpen,
81
+ ariaLabel,
82
+ icon,
83
+ onClick
84
+ } = props;
85
+ const tableContextAllProps = (_React$useContext = _react.default.useContext(_TableContext.TableContext)) === null || _React$useContext === void 0 ? void 0 : _React$useContext.allProps;
86
+ const iconSize = (tableContextAllProps === null || tableContextAllProps === void 0 ? void 0 : tableContextAllProps.size) === 'medium' || (tableContextAllProps === null || tableContextAllProps === void 0 ? void 0 : tableContextAllProps.size) === 'small' ? 'basis' : 'medium';
87
+ return _react.default.createElement(_TableTd.default, {
88
+ className: "dnb-table__td__button-icon"
89
+ }, _react.default.createElement("span", {
90
+ className: "dnb-table__button"
91
+ }, _react.default.createElement(_IconPrimary.default, {
92
+ icon: icon,
93
+ size: iconSize
94
+ }), _react.default.createElement(_Button.default, _extends({
95
+ className: "dnb-sr-only",
96
+ tabIndex: -1,
97
+ "aria-label": ariaLabel,
98
+ "aria-expanded": Boolean(trIsOpen)
99
+ }, trIsOpen != null ? {
100
+ 'aria-expanded': Boolean(trIsOpen)
101
+ } : {}, {
102
+ on_click: event => onClick(event, true)
103
+ }))));
104
+ }
105
+ function TableIconSrTh(props) {
106
+ const {
107
+ text
108
+ } = props;
109
+ return _react.default.createElement(_TableTh.default, {
110
+ "aria-hidden": true,
111
+ className: "dnb-table__th__button-icon"
112
+ }, _react.default.createElement("div", null, text));
113
+ }
114
+ const isTableHead = children => children.some(element => element.type === _TableTh.default);
115
+ exports.isTableHead = isTableHead;
116
+ //# sourceMappingURL=TableClickableHead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableClickableHead.js","names":["_react","_interopRequireDefault","require","_classnames","_keycode","_helpers","_Button","_IconPrimary","_TableTh","_TableTd","_TableContext","_excluded","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","TableClickableHead","allProps","children","className","disabled","onClick","onOpened","onClosed","trIsOpen","trIsHover","trHadClick","clickable","noAnimation","onMouseEnter","onMouseLeave","onKeyDown","ariaLabel","props","trParams","onKeydownHandler","createElement","tabIndex","undefined","classnames","event","keycode","nativeEvent","document","activeElement","tagName","preventDefault","onClickTr","allowInteractiveElement","hasSelectedText","TableClickableButtonTd","_React$useContext","icon","tableContextAllProps","React","useContext","TableContext","iconSize","size","Boolean","on_click","TableIconSrTh","text","isTableHead","some","element","type","Th","exports"],"sources":["../../../../src/components/table/TableClickableHead.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\nimport keycode from 'keycode'\nimport { hasSelectedText } from '../../shared/helpers'\nimport Button from '../button/Button'\nimport IconPrimary from '../icon/IconPrimary'\nimport Th from './TableTh'\nimport Td from './TableTd'\nimport { TableContext } from './TableContext'\nimport type { TableTrProps } from './TableTr'\n\nexport type TableClickableHeadProps = {\n trIsOpen?: boolean\n trIsHover?: boolean\n trHadClick?: boolean\n clickable: boolean\n noAnimation?: boolean\n ariaLabel: string\n} & TableTrProps &\n React.TableHTMLAttributes<HTMLTableRowElement>\n\nexport function TableClickableHead(allProps: TableClickableHeadProps) {\n const {\n children,\n className,\n disabled,\n onClick,\n onOpened,\n onClosed,\n\n trIsOpen,\n trIsHover,\n trHadClick,\n clickable,\n noAnimation,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n ariaLabel,\n ...props\n } = allProps\n\n const trParams =\n !disabled && clickable\n ? {\n onClick: onClick,\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onKeyDown: onKeydownHandler,\n }\n : {}\n\n return (\n <tr\n tabIndex={clickable && !disabled ? 0 : undefined}\n className={classnames(\n className,\n clickable && 'dnb-table__tr--clickable',\n trIsOpen && 'dnb-table__tr--expanded',\n disabled && 'dnb-table__tr--disabled',\n noAnimation && 'dnb-table__tr--no-animation',\n trIsHover && trHadClick && 'dnb-table__tr--hover'\n )}\n {...trParams}\n {...props}\n >\n {children}\n </tr>\n )\n\n function onKeydownHandler(\n event: React.KeyboardEvent<HTMLTableRowElement>\n ) {\n switch (keycode(event.nativeEvent)) {\n case 'space':\n case 'enter':\n {\n const target = event.target as HTMLElement\n if (\n document.activeElement !== target ||\n target.tagName === 'TR'\n ) {\n onKeyDown(event)\n event.preventDefault()\n }\n }\n break\n }\n }\n}\n\nexport function onClickTr(\n event: React.SyntheticEvent,\n allowInteractiveElement = false,\n onClick?: (event: React.SyntheticEvent) => void\n) {\n const target = event.target as HTMLElement\n if (\n /**\n * Do not toggle if user clicked an interactive element (input, button, etc.).\n * Interactive to set activeElement on mouseDown, we we can check against it.\n */\n ((document.activeElement !== target &&\n /**\n * Safari on macOS needs this extra check:\n *\n * > For example, on macOS systems, elements that aren't text input elements are not typically focusable by default.\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement\n */\n target.tagName !== 'INPUT' &&\n target.tagName !== 'LABEL') ||\n allowInteractiveElement) &&\n /**\n * Let the user select text,\n * without triggering the onclick.\n */\n !hasSelectedText()\n ) {\n onClick?.(event)\n }\n}\n\nexport function TableClickableButtonTd(props: {\n trIsOpen?: boolean\n ariaLabel: string\n icon: 'chevron_down' | 'chevron_right'\n onClick: (\n event: React.SyntheticEvent,\n allowInteractiveElement: boolean\n ) => void\n}) {\n const { trIsOpen, ariaLabel, icon, onClick } = props\n\n const tableContextAllProps = React.useContext(TableContext)?.allProps\n const iconSize =\n tableContextAllProps?.size === 'medium' ||\n tableContextAllProps?.size === 'small'\n ? 'basis'\n : 'medium'\n\n return (\n <Td className=\"dnb-table__td__button-icon\">\n <span className=\"dnb-table__button\">\n <IconPrimary icon={icon} size={iconSize} />\n <Button\n className=\"dnb-sr-only\"\n tabIndex={-1}\n aria-label={ariaLabel}\n aria-expanded={Boolean(trIsOpen)}\n {...(trIsOpen != null\n ? { 'aria-expanded': Boolean(trIsOpen) }\n : {})}\n on_click={(event) => onClick(event, true)}\n />\n </span>\n </Td>\n )\n}\n\nexport function TableIconSrTh(props: { text: string }) {\n const { text } = props\n\n return (\n <Th aria-hidden className=\"dnb-table__th__button-icon\">\n <div>{text}</div>\n </Th>\n )\n}\n\nexport const isTableHead = (children: React.ReactNode[]) =>\n children.some((element: React.ReactElement) => element.type === Th)\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAA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GACpDzC,MAAA,CAAAc,OAAA,CAAA4C,aAAA,cAAM0B,IAAU,CACd,CAAC;AAET;AAEO,MAAMC,WAAW,GAAI7C,QAA2B,IACrDA,QAAQ,CAAC8C,IAAI,CAAEC,OAA2B,IAAKA,OAAO,CAACC,IAAI,KAAKC,gBAAE,CAAC;AAAAC,OAAA,CAAAL,WAAA,GAAAA,WAAA"}
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.TrProperties = exports.TrEventProperties = exports.ThProperties = exports.TdProperties = exports.TableProperties = exports.TableEventProperties = void 0;
7
7
  const TableProperties = {
8
- accordion: {
9
- doc: 'Set to true if you have one or more rows that contains an accordion content.',
10
- type: 'boolean',
11
- defaultValue: 'false',
8
+ mode: {
9
+ doc: 'Defines how the Table should look. Use `accordion` for an accordion-like table. Use `navigation` for a navigation table.',
10
+ type: [`'accordion'`, `'navigation'`],
11
+ defaultValue: 'null',
12
12
  status: 'optional'
13
13
  },
14
14
  accordionChevronPlacement: {
15
- doc: 'Defines where the chevron will be placed.',
15
+ doc: 'Defines where the chevron will be placed, should only be used together with mode="accordion".',
16
16
  type: [`'start'`, `'end'`],
17
17
  defaultValue: `'start'`,
18
18
  status: 'optional'
@@ -126,7 +126,7 @@ const TrProperties = {
126
126
  exports.TrProperties = TrProperties;
127
127
  const TrEventProperties = {
128
128
  onClick: {
129
- doc: 'will emit when user clicks/expands the table row. Returns a native click.',
129
+ doc: 'Will emit when user clicks/expands or on keydown space/enter(in mode="accordion" and mode="navigation") in the table row. Returns a native click.',
130
130
  type: '(event) => void',
131
131
  defaultValue: 'undefined',
132
132
  status: 'optional'
@@ -1 +1 @@
1
- {"version":3,"file":"TableDocs.js","names":["TableProperties","accordion","doc","type","defaultValue","status","accordionChevronPlacement","border","outline","sticky","stickyOffset","size","fixed","children","className","skeleton","exports","TableEventProperties","collapseAllHandleRef","TrProperties","variant","noWrap","expanded","disabled","noAnimation","TrEventProperties","onClick","onOpened","onClosed","ThProperties","sortable","active","reversed","TdProperties","noSpacing","spacing"],"sources":["../../../../src/components/table/TableDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../shared/types'\n\nexport const TableProperties: PropertiesTableProps = {\n accordion: {\n doc: 'Set to true if you have one or more rows that contains an accordion content.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n accordionChevronPlacement: {\n doc: 'Defines where the chevron will be placed.',\n type: [`'start'`, `'end'`],\n defaultValue: `'start'`,\n status: 'optional',\n },\n border: {\n doc: 'Use `true` to show borders between table data cells.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n outline: {\n doc: 'Use `true` to show an outline border around the table',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n sticky: {\n doc: \"Use `true` to enable a sticky Table header. Or use `'css-position'` to enable the CSS based scroll behavior.\",\n type: ['boolean', `'css-position'`],\n defaultValue: 'false',\n status: 'optional',\n },\n stickyOffset: {\n doc: 'Defines the offset (top) in `rem` from where the header should start to stick. You may define your app header height here, if you have a sticky header on your page.',\n type: ['string', 'number'],\n defaultValue: 'false',\n status: 'optional',\n },\n size: {\n doc: 'Spacing size inside the table header and data.',\n type: [`'large'`, `'medium'`, `'small'`],\n defaultValue: `'large'`,\n status: 'optional',\n },\n fixed: {\n doc: 'If set to `true`, the table will behave with a fixed table layout, using: `table-layout: fixed;`. Use e.g. CSS `width: 40%` on a table column to define the width.',\n type: 'boolean',\n defaultValue: 'null',\n status: 'optional',\n },\n children: {\n doc: 'The content of the component.',\n type: 'React.ReactNode',\n status: 'required',\n },\n className: {\n doc: 'Custom className on the component root',\n type: 'string',\n defaultValue: 'undefined',\n status: 'optional',\n },\n skeleton: {\n doc: 'If set to `true`, an overlaying skeleton with animation will be shown.',\n type: 'boolean',\n defaultValue: 'undefined',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n}\n\nexport const TableEventProperties: PropertiesTableProps = {\n collapseAllHandleRef: {\n doc: 'ref handle to collapse all expanded accordion rows. Send in a ref and use `.current()` to collapse all rows.',\n type: 'React.MutableRefObject<() => void>',\n defaultValue: 'undefined',\n status: 'optional',\n },\n}\n\nexport const TrProperties: PropertiesTableProps = {\n /**\n * The variant of the tr\n */\n variant: {\n doc: 'Override the automatic variant of the current row. The next row one will continue with the opposite.',\n type: [`'even'`, `'odd'`],\n defaultValue: 'undefined',\n status: 'optional',\n },\n noWrap: {\n doc: 'if set to `true`, the inherited header text will not wrap to new lines.',\n type: 'boolean',\n defaultValue: 'true',\n status: 'optional',\n },\n expanded: {\n doc: 'use `true` to render the `<Tr>` initially as expanded.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n disabled: {\n doc: 'use `true` to disable the `<Tr>` to be accessible as an interactive element.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n noAnimation: {\n doc: 'use `true` to disable the expand/collapse animation.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n children: {\n doc: 'The content of the component.',\n type: 'React.ReactNode',\n status: 'required',\n },\n}\n\nexport const TrEventProperties: PropertiesTableProps = {\n onClick: {\n doc: 'will emit when user clicks/expands the table row. Returns a native click.',\n type: '(event) => void',\n defaultValue: 'undefined',\n status: 'optional',\n },\n onOpened: {\n doc: 'Will emit when table row is expanded. Returns an object with the table row as the target: `{ target }`.',\n type: '({ target }) => void',\n defaultValue: 'undefined',\n status: 'optional',\n },\n onClosed: {\n doc: 'Will emit when table row is closed (after it was open). Returns an object with the table row as the target: `{ target }`.',\n type: '({ target }) => void',\n defaultValue: 'undefined',\n status: 'optional',\n },\n}\n\nexport const ThProperties: PropertiesTableProps = {\n sortable: {\n doc: 'Defines the table header as sortable if set to `true` (ascending).',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n active: {\n doc: 'Defines the sortable column as the current active (ascending).',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n reversed: {\n doc: 'Defines the sortable column as in reversed order (descending).',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n noWrap: {\n doc: 'If set to `true`, the header text will not wrap to new lines.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n children: {\n doc: 'The content of the component.',\n type: 'React.ReactNode',\n defaultValue: 'undefined',\n status: 'optional',\n },\n}\n\nexport const TdProperties: PropertiesTableProps = {\n noSpacing: {\n doc: 'If set to `true`, no padding will be added.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n spacing: {\n doc: 'Set to `horizontal` for padding on left and right side.',\n type: `'horizontal'`,\n defaultValue: 'undefined',\n status: 'optional',\n },\n children: {\n doc: 'The content of the component.',\n type: 'React.ReactNode',\n defaultValue: 'undefined',\n status: 'optional',\n },\n}\n"],"mappings":";;;;;;AAEO,MAAMA,eAAqC,GAAG;EACnDC,SAAS,EAAE;IACTC,GAAG,EAAE,8EAA8E;IACnFC,IAAI,EAAE,SAAS;IACfC,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE;EACV,CAAC;EACDC,yBAAyB,EAAE;IACzBJ,GAAG,EAAE,2CAA2C;IAChDC,IAAI,EAAE,CAAE,SAAQ,EAAG,OAAM,CAAC;IAC1BC,YAAY,EAAG,SAAQ;IACvBC,MAAM,EAAE;EACV,CAAC;EACDE,MAAM,EAAE;IACNL,GAAG,EAAE,sDAAsD;IAC3DC,IAAI,EAAE,SAAS;IACfC,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE;EACV,CAAC;EACDG,OAAO,EAAE;IACPN,GAAG,EAAE,uDAAuD;IAC5DC,IAAI,EAAE,SAAS;IACfC,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE;EACV,CAAC;EACDI,MAAM,EAAE;IACNP,GAAG,EAAE,8GAA8G;IACnHC,IAAI,EAAE,CAAC,SAAS,EAAG,gBAAe,CAAC;IACnCC,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE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ableDocs.js","names":["TableProperties","mode","doc","type","defaultValue","status","accordionChevronPlacement","border","outline","sticky","stickyOffset","size","fixed","children","className","skeleton","exports","TableEventProperties","collapseAllHandleRef","TrProperties","variant","noWrap","expanded","disabled","noAnimation","TrEventProperties","onClick","onOpened","onClosed","ThProperties","sortable","active","reversed","TdProperties","noSpacing","spacing"],"sources":["../../../../src/components/table/TableDocs.ts"],"sourcesContent":["import { PropertiesTableProps } from '../../shared/types'\n\nexport const TableProperties: PropertiesTableProps = {\n mode: {\n doc: 'Defines how the Table should look. Use `accordion` for an accordion-like table. Use `navigation` for a navigation table.',\n type: [`'accordion'`, `'navigation'`],\n defaultValue: 'null',\n status: 'optional',\n },\n accordionChevronPlacement: {\n doc: 'Defines where the chevron will be placed, should only be used together with mode=\"accordion\".',\n type: [`'start'`, `'end'`],\n defaultValue: `'start'`,\n status: 'optional',\n },\n border: {\n doc: 'Use `true` to show borders between table data cells.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n outline: {\n doc: 'Use `true` to show an outline border around the table',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n sticky: {\n doc: \"Use `true` to enable a sticky Table header. Or use `'css-position'` to enable the CSS based scroll behavior.\",\n type: ['boolean', `'css-position'`],\n defaultValue: 'false',\n status: 'optional',\n },\n stickyOffset: {\n doc: 'Defines the offset (top) in `rem` from where the header should start to stick. You may define your app header height here, if you have a sticky header on your page.',\n type: ['string', 'number'],\n defaultValue: 'false',\n status: 'optional',\n },\n size: {\n doc: 'Spacing size inside the table header and data.',\n type: [`'large'`, `'medium'`, `'small'`],\n defaultValue: `'large'`,\n status: 'optional',\n },\n fixed: {\n doc: 'If set to `true`, the table will behave with a fixed table layout, using: `table-layout: fixed;`. Use e.g. CSS `width: 40%` on a table column to define the width.',\n type: 'boolean',\n defaultValue: 'null',\n status: 'optional',\n },\n children: {\n doc: 'The content of the component.',\n type: 'React.ReactNode',\n status: 'required',\n },\n className: {\n doc: 'Custom className on the component root',\n type: 'string',\n defaultValue: 'undefined',\n status: 'optional',\n },\n skeleton: {\n doc: 'If set to `true`, an overlaying skeleton with animation will be shown.',\n type: 'boolean',\n defaultValue: 'undefined',\n status: 'optional',\n },\n '[Space](/uilib/layout/space/properties)': {\n doc: 'Spacing properties like `top` or `bottom` are supported.',\n type: ['string', 'object'],\n status: 'optional',\n },\n}\n\nexport const TableEventProperties: PropertiesTableProps = {\n collapseAllHandleRef: {\n doc: 'ref handle to collapse all expanded accordion rows. Send in a ref and use `.current()` to collapse all rows.',\n type: 'React.MutableRefObject<() => void>',\n defaultValue: 'undefined',\n status: 'optional',\n },\n}\n\nexport const TrProperties: PropertiesTableProps = {\n /**\n * The variant of the tr\n */\n variant: {\n doc: 'Override the automatic variant of the current row. The next row one will continue with the opposite.',\n type: [`'even'`, `'odd'`],\n defaultValue: 'undefined',\n status: 'optional',\n },\n noWrap: {\n doc: 'if set to `true`, the inherited header text will not wrap to new lines.',\n type: 'boolean',\n defaultValue: 'true',\n status: 'optional',\n },\n expanded: {\n doc: 'use `true` to render the `<Tr>` initially as expanded.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n disabled: {\n doc: 'use `true` to disable the `<Tr>` to be accessible as an interactive element.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n noAnimation: {\n doc: 'use `true` to disable the expand/collapse animation.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n children: {\n doc: 'The content of the component.',\n type: 'React.ReactNode',\n status: 'required',\n },\n}\n\nexport const TrEventProperties: PropertiesTableProps = {\n onClick: {\n doc: 'Will emit when user clicks/expands or on keydown space/enter(in mode=\"accordion\" and mode=\"navigation\") in the table row. Returns a native click.',\n type: '(event) => void',\n defaultValue: 'undefined',\n status: 'optional',\n },\n onOpened: {\n doc: 'Will emit when table row is expanded. Returns an object with the table row as the target: `{ target }`.',\n type: '({ target }) => void',\n defaultValue: 'undefined',\n status: 'optional',\n },\n onClosed: {\n doc: 'Will emit when table row is closed (after it was open). Returns an object with the table row as the target: `{ target }`.',\n type: '({ target }) => void',\n defaultValue: 'undefined',\n status: 'optional',\n },\n}\n\nexport const ThProperties: PropertiesTableProps = {\n sortable: {\n doc: 'Defines the table header as sortable if set to `true` (ascending).',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n active: {\n doc: 'Defines the sortable column as the current active (ascending).',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n reversed: {\n doc: 'Defines the sortable column as in reversed order (descending).',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n noWrap: {\n doc: 'If set to `true`, the header text will not wrap to new lines.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n children: {\n doc: 'The content of the component.',\n type: 'React.ReactNode',\n defaultValue: 'undefined',\n status: 'optional',\n },\n}\n\nexport const TdProperties: PropertiesTableProps = {\n noSpacing: {\n doc: 'If set to `true`, no padding will be added.',\n type: 'boolean',\n defaultValue: 'false',\n status: 'optional',\n },\n spacing: {\n doc: 'Set to `horizontal` for padding on left and right side.',\n type: `'horizontal'`,\n defaultValue: 'undefined',\n status: 'optional',\n },\n children: {\n doc: 'The content of the component.',\n type: 'React.ReactNode',\n defaultValue: 'undefined',\n status: 'optional',\n },\n}\n"],"mappings":";;;;;;AAEO,MAAMA,eAAqC,GAAG;EACnDC,IAAI,EAAE;IACJC,GAAG,EAAE,0HAA0H;IAC/HC,IAAI,EAAE,CAAE,aAAY,EAAG,cAAa,CAAC;IACrCC,YAAY,EAAE,MAAM;IACpBC,MAAM,EAAE;EACV,CAAC;EACDC,yBAAyB,EAAE;IACzBJ,GAAG,EAAE,+FAA+F;IACpGC,IAAI,EAAE,CAAE,SAAQ,EAAG,OAAM,CAAC;IAC1BC,YAAY,EAAG,SAAQ;IACvBC,MAAM,EAAE;EACV,CAAC;EACDE,MAAM,EAAE;IACNL,GAAG,EAAE,sDAAsD;IAC3DC,IAAI,EAAE,SAAS;IACfC,YAAY,EAAE,O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,GAAG,EAAE,yDAAyD;IAC9DC,IAAI,EAAG,cAAa;IACpBC,YAAY,EAAE,WAAW;IACzBC,MAAM,EAAE;EACV,CAAC;EACDQ,QAAQ,EAAE;IACRX,GAAG,EAAE,+BAA+B;IACpCC,IAAI,EAAE,iBAAiB;IACvBC,YAAY,EAAE,WAAW;IACzBC,MAAM,EAAE;EACV;AACF,CAAC;AAAAW,OAAA,CAAAiB,YAAA,GAAAA,YAAA"}
@@ -6,43 +6,43 @@ export type TableTrProps = {
6
6
  */
7
7
  variant?: 'even' | 'odd';
8
8
  /**
9
- * If set to true, the inherited header text will not wrap to new lines
9
+ * If set to true, the inherited header text will not wrap to new lines.
10
10
  * Default: false
11
11
  */
12
12
  noWrap?: boolean;
13
13
  /**
14
- * Set true to render the tr initially as expanded
15
- * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table
14
+ * Set true to render the tr initially as expanded.
15
+ * Is part of the accordion feature and needs to be enabled with `mode="accordion"` prop in main Table.
16
16
  * Default: false
17
17
  */
18
18
  expanded?: boolean;
19
19
  /**
20
- * Set true to disable the tr to be accessible as an interactive element
21
- * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table
20
+ * Set true to disable the tr to be accessible as an interactive element.
21
+ * Is part of the accordion feature and needs to be enabled with `mode="accordion"`prop in main Table.
22
22
  * Default: false
23
23
  */
24
24
  disabled?: boolean;
25
25
  /**
26
- * Set to true to skip animation
27
- * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table
26
+ * Set to true to skip animation.
27
+ * Is part of the accordion feature and needs to be enabled with `mode="accordion"` prop in main Table.
28
28
  * Default: false
29
29
  */
30
30
  noAnimation?: boolean;
31
31
  /**
32
- * Will emit when user clicks/expands the table row
33
- * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table
32
+ * Will emit when user clicks/expands or on keydown space/enter(in mode="accordion" and mode="navigation") in the table row.
33
+ * Is part of the mode feature and needs to be enabled with the `mode` prop in main Table.
34
34
  */
35
35
  onClick?: (event: React.SyntheticEvent) => void;
36
36
  /**
37
- * Will emit when table row is expanded
38
- * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table
37
+ * Will emit when table row is expanded.
38
+ * Is part of the accordion feature and needs to be enabled with `mode="accordion"` prop in main Table.
39
39
  */
40
40
  onOpened?: ({ target }: {
41
41
  target: HTMLTableRowElement;
42
42
  }) => void;
43
43
  /**
44
44
  * Will emit when table row is closed (after it was open)
45
- * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table
45
+ * Is part of the accordion feature and needs to be enabled with `mode="accordion"` prop in main Table.
46
46
  */
47
47
  onClosed?: ({ target }: {
48
48
  target: HTMLTableRowElement;
@@ -8,6 +8,7 @@ exports.useHandleOddEven = useHandleOddEven;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _TableAccordionHead = require("./table-accordion/TableAccordionHead");
11
+ var _TableNavigationHead = require("./table-navigation/TableNavigationHead");
11
12
  var _TableAccordionContent = require("./table-accordion/TableAccordionContent");
12
13
  var _TableContext = require("./TableContext");
13
14
  const _excluded = ["variant", "noWrap", "className"],
@@ -17,13 +18,13 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
17
18
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
19
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
19
20
  function Tr(componentProps) {
20
- var _tableContext$allProp;
21
+ var _tableContext$allProp, _tableContext$allProp2, _tableContext$allProp3;
21
22
  const {
22
23
  variant,
23
24
  noWrap,
24
25
  className: _className
25
26
  } = componentProps,
26
- accordionProps = _objectWithoutProperties(componentProps, _excluded);
27
+ restProps = _objectWithoutProperties(componentProps, _excluded);
27
28
  const {
28
29
  currentVariant,
29
30
  isLast,
@@ -33,11 +34,17 @@ function Tr(componentProps) {
33
34
  });
34
35
  const className = (0, _classnames.default)('dnb-table__tr', _className, currentVariant && `dnb-table__tr--${currentVariant}`, isLast && 'dnb-table__tr--last', noWrap && 'dnb-table--no-wrap');
35
36
  const tableContext = _react.default.useContext(_TableContext.TableContext);
36
- if (tableContext !== null && tableContext !== void 0 && (_tableContext$allProp = tableContext.allProps) !== null && _tableContext$allProp !== void 0 && _tableContext$allProp.accordion) {
37
+ const deprecatedAccordionProp = tableContext === null || tableContext === void 0 ? void 0 : (_tableContext$allProp = tableContext.allProps) === null || _tableContext$allProp === void 0 ? void 0 : _tableContext$allProp.accordion;
38
+ if (deprecatedAccordionProp || (tableContext === null || tableContext === void 0 ? void 0 : (_tableContext$allProp2 = tableContext.allProps) === null || _tableContext$allProp2 === void 0 ? void 0 : _tableContext$allProp2.mode) == 'accordion') {
37
39
  return _react.default.createElement(_TableAccordionHead.TableAccordionHead, _extends({
38
40
  count: count,
39
41
  className: className
40
- }, accordionProps));
42
+ }, restProps));
43
+ }
44
+ if ((tableContext === null || tableContext === void 0 ? void 0 : (_tableContext$allProp3 = tableContext.allProps) === null || _tableContext$allProp3 === void 0 ? void 0 : _tableContext$allProp3.mode) == 'navigation') {
45
+ return _react.default.createElement(_TableNavigationHead.TableNavigationHead, _extends({
46
+ className: className
47
+ }, restProps));
41
48
  }
42
49
  const {
43
50
  expanded,
@@ -46,8 +53,8 @@ function Tr(componentProps) {
46
53
  onClick,
47
54
  onOpened,
48
55
  onClosed
49
- } = accordionProps,
50
- trProps = _objectWithoutProperties(accordionProps, _excluded2);
56
+ } = restProps,
57
+ trProps = _objectWithoutProperties(restProps, _excluded2);
51
58
  return _react.default.createElement("tr", _extends({
52
59
  role: "row",
53
60
  className: className
@@ -1 +1 @@
1
- {"version":3,"file":"TableTr.js","names":["_react","_interopRequireDefault","require","_classnames","_TableAccordionHead","_TableAccordionContent","_TableContext","_excluded","_excluded2","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","Tr","componentProps","_tableContext$allProp","variant","noWrap","className","_className","accordionProps","currentVariant","isLast","count","useHandleTrVariant","classnames","tableContext","React","useContext","TableContext","allProps","accordion","createElement","TableAccordionHead","expanded","disabled","noAnimation","onClick","onOpened","onClosed","trProps","role","_ref","countRef","trCountRef","current","increment","setCount","useState","window","useEffect","rerenderAlias","useHandleOddEven","_ref2","children","useRef","setRerenderAlias","isMounted","forceRerender","AccordionContent","TableAccordionContentRow"],"sources":["../../../../src/components/table/TableTr.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\nimport { TableAccordionHead } from './table-accordion/TableAccordionHead'\nimport { TableAccordionContentRow } from './table-accordion/TableAccordionContent'\nimport { TableContext } from './TableContext'\n\nexport type TableTrProps = {\n /**\n * The variant of the tr\n */\n variant?: 'even' | 'odd'\n\n /**\n * If set to true, the inherited header text will not wrap to new lines\n * Default: false\n */\n noWrap?: boolean\n\n /**\n * Set true to render the tr initially as expanded\n * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table\n * Default: false\n */\n expanded?: boolean\n\n /**\n * Set true to disable the tr to be accessible as an interactive element\n * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table\n * Default: false\n */\n disabled?: boolean\n\n /**\n * Set to true to skip animation\n * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table\n * Default: false\n */\n noAnimation?: boolean\n\n /**\n * Will emit when user clicks/expands the table row\n * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table\n */\n onClick?: (event: React.SyntheticEvent) => void\n\n /**\n * Will emit when table row is expanded\n * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table\n */\n onOpened?: ({ target }: { target: HTMLTableRowElement }) => void\n\n /**\n * Will emit when table row is closed (after it was open)\n * Is part of the accordion feature and needs to be enabled with `accordion` prop in main Table\n */\n onClosed?: ({ target }: { target: HTMLTableRowElement }) => void\n\n /**\n * The content of the component.\n */\n children: React.ReactNode\n}\n\nexport default function Tr(\n componentProps: TableTrProps &\n React.TableHTMLAttributes<HTMLTableRowElement>\n) {\n const {\n variant,\n noWrap,\n className: _className,\n ...accordionProps\n } = componentProps\n\n const { currentVariant, isLast, count } = useHandleTrVariant({\n variant,\n })\n\n const className = classnames(\n 'dnb-table__tr',\n currentVariant && `dnb-table__tr--${currentVariant}`,\n isLast && 'dnb-table__tr--last',\n noWrap && 'dnb-table--no-wrap',\n _className\n )\n\n const tableContext = React.useContext(TableContext)\n if (tableContext?.allProps?.accordion) {\n return (\n <TableAccordionHead\n count={count}\n className={className}\n {...accordionProps}\n />\n )\n }\n\n const {\n expanded, // eslint-disable-line @typescript-eslint/no-unused-vars\n disabled, // eslint-disable-line @typescript-eslint/no-unused-vars\n noAnimation, // eslint-disable-line @typescript-eslint/no-unused-vars\n onClick, // eslint-disable-line @typescript-eslint/no-unused-vars\n onOpened, // eslint-disable-line @typescript-eslint/no-unused-vars\n onClosed, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...trProps\n } = accordionProps\n\n return <tr role=\"row\" className={className} {...trProps} />\n}\n\nfunction useHandleTrVariant({ variant }) {\n const tableContext = React.useContext(TableContext)\n\n /**\n * Handle odd/even\n */\n const countRef = tableContext?.trCountRef.current\n const increment = () => {\n if (typeof countRef === 'undefined') {\n return 0\n }\n if (\n !variant ||\n (variant === 'even' && countRef.count % 2 === 1) ||\n (variant === 'odd' && countRef.count % 2 === 0)\n ) {\n countRef.count++\n }\n\n return countRef.count\n }\n\n const [count, setCount] = React.useState(() => {\n // SSR Support\n if (typeof window === 'undefined') {\n return increment()\n }\n })\n\n // StrictMode support\n React.useEffect(() => {\n // SSR will not execute useEffect\n setCount(increment())\n }, [tableContext?.rerenderAlias]) // eslint-disable-line react-hooks/exhaustive-deps\n\n /**\n * Find out the current odd/even when \"accordionContent\" is used.\n * Because we have now an additional \"tr\" element.\n * Then the CSS can't figure out the correct nth element (nth-of-type)\n * and we need to set it manually (nth-child and nth-of-type do not respect classes, so we can't ignore this one).\n */\n let currentVariant = variant\n if (!currentVariant) {\n currentVariant = count % 2 ? 'odd' : 'even'\n }\n const isLast =\n typeof countRef !== 'undefined' && countRef.count === count\n return {\n currentVariant,\n isLast,\n count,\n }\n}\n\n/**\n * Handle odd/even on re-render and React.StrictMode\n */\nexport function useHandleOddEven({ children }) {\n // Create this ref in order to \"auto\" set even/odd class in tr elements\n const trCountRef = React.useRef({ count: 0 })\n\n // When the alias changes, all tr's will rerender and get a new even/odd color\n // This is useful, when one tr gets removed\n const [rerenderAlias, setRerenderAlias] = React.useState({}) // eslint-disable-line no-unused-vars\n\n const isMounted = React.useRef(false)\n React.useEffect(() => {\n if (isMounted.current) {\n forceRerender()\n }\n isMounted.current = true\n }, [children]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { trCountRef, rerenderAlias, setRerenderAlias }\n\n function forceRerender() {\n trCountRef.current.count = 0\n setRerenderAlias({})\n }\n}\n\nTr.AccordionContent = TableAccordionContentRow\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAA6C,MAAAK,SAAA;EAAAC,UAAA;AAAA,SAAAP,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,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AK,KAAKA,KAAK;EAC7D,OAAO;IACLF,cAAc;IACdC,MAAM;IACNC;EACF,CAAC;AACH;AAKO,SAAS6B,gBAAgBA,CAAAC,KAAA,EAAe;EAAA,IAAd;IAAEC;EAAS,CAAC,GAAAD,KAAA;EAE3C,MAAMT,UAAU,GAAGjB,cAAK,CAAC4B,MAAM,CAAC;IAAEhC,KAAK,EAAE;EAAE,CAAC,CAAC;EAI7C,MAAM,CAAC4B,aAAa,EAAEK,gBAAgB,CAAC,GAAG7B,cAAK,CAACqB,QAAQ,CAAC,CAAC,CAAC,CAAC;EAE5D,MAAMS,SAAS,GAAG9B,cAAK,CAAC4B,MAAM,CAAC,KAAK,CAAC;EACrC5B,cAAK,CAACuB,SAAS,CAAC,MAAM;IACpB,IAAIO,SAAS,CAACZ,OAAO,EAAE;MACrBa,aAAa,CAAC,CAAC;IACjB;IACAD,SAAS,CAACZ,OAAO,GAAG,IAAI;EAC1B,CAAC,EAAE,CAACS,QAAQ,CAAC,CAAC;EAEd,OAAO;IAAEV,UAAU;IAAEO,aAAa;IAAEK;EAAiB,CAAC;EAEtD,SAASE,aAAaA,CAAA,EAAG;IACvBd,UAAU,CAACC,OAAO,CAACtB,KAAK,GAAG,CAAC;IAC5BiC,gBAAgB,CAAC,CAAC,CAAC,CAAC;EACtB;AACF;AAEA3C,EAAE,CAAC8C,gBAAgB,GAAGC,+CAAwB"}
1
+ {"version":3,"file":"TableTr.js","names":["_react","_interopRequireDefault","require","_classnames","_TableAccordionHead","_TableNavigationHead","_TableAccordionContent","_TableContext","_excluded","_excluded2","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","Tr","componentProps","_tableContext$allProp","_tableContext$allProp2","_tableContext$allProp3","variant","noWrap","className","_className","restProps","currentVariant","isLast","count","useHandleTrVariant","classnames","tableContext","React","useContext","TableContext","deprecatedAccordionProp","allProps","accordion","mode","createElement","TableAccordionHead","TableNavigationHead","expanded","disabled","noAnimation","onClick","onOpened","onClosed","trProps","role","_ref","countRef","trCountRef","current","increment","setCount","useState","window","useEffect","rerenderAlias","useHandleOddEven","_ref2","children","useRef","setRerenderAlias","isMounted","forceRerender","AccordionContent","TableAccordionContentRow"],"sources":["../../../../src/components/table/TableTr.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\nimport { TableAccordionHead } from './table-accordion/TableAccordionHead'\nimport { TableNavigationHead } from './table-navigation/TableNavigationHead'\nimport { TableAccordionContentRow } from './table-accordion/TableAccordionContent'\nimport { TableContext } from './TableContext'\n\nexport type TableTrProps = {\n /**\n * The variant of the tr\n */\n variant?: 'even' | 'odd'\n\n /**\n * If set to true, the inherited header text will not wrap to new lines.\n * Default: false\n */\n noWrap?: boolean\n\n /**\n * Set true to render the tr initially as expanded.\n * Is part of the accordion feature and needs to be enabled with `mode=\"accordion\"` prop in main Table.\n * Default: false\n */\n expanded?: boolean\n\n /**\n * Set true to disable the tr to be accessible as an interactive element.\n * Is part of the accordion feature and needs to be enabled with `mode=\"accordion\"`prop in main Table.\n * Default: false\n */\n disabled?: boolean\n\n /**\n * Set to true to skip animation.\n * Is part of the accordion feature and needs to be enabled with `mode=\"accordion\"` prop in main Table.\n * Default: false\n */\n noAnimation?: boolean\n\n /**\n * Will emit when user clicks/expands or on keydown space/enter(in mode=\"accordion\" and mode=\"navigation\") in the table row.\n * Is part of the mode feature and needs to be enabled with the `mode` prop in main Table.\n */\n onClick?: (event: React.SyntheticEvent) => void\n\n /**\n * Will emit when table row is expanded.\n * Is part of the accordion feature and needs to be enabled with `mode=\"accordion\"` prop in main Table.\n */\n onOpened?: ({ target }: { target: HTMLTableRowElement }) => void\n\n /**\n * Will emit when table row is closed (after it was open)\n * Is part of the accordion feature and needs to be enabled with `mode=\"accordion\"` prop in main Table.\n */\n onClosed?: ({ target }: { target: HTMLTableRowElement }) => void\n\n /**\n * The content of the component.\n */\n children: React.ReactNode\n}\n\nexport default function Tr(\n componentProps: TableTrProps &\n React.TableHTMLAttributes<HTMLTableRowElement>\n) {\n const {\n variant,\n noWrap,\n className: _className,\n ...restProps\n } = componentProps\n\n const { currentVariant, isLast, count } = useHandleTrVariant({\n variant,\n })\n\n const className = classnames(\n 'dnb-table__tr',\n currentVariant && `dnb-table__tr--${currentVariant}`,\n isLast && 'dnb-table__tr--last',\n noWrap && 'dnb-table--no-wrap',\n _className\n )\n\n const tableContext = React.useContext(TableContext)\n\n // Deprecated – can be removed in v11\n const deprecatedAccordionProp = tableContext?.allProps?.accordion\n\n if (\n deprecatedAccordionProp ||\n tableContext?.allProps?.mode == 'accordion'\n ) {\n return (\n <TableAccordionHead\n count={count}\n className={className}\n {...restProps}\n />\n )\n }\n if (tableContext?.allProps?.mode == 'navigation') {\n return <TableNavigationHead className={className} {...restProps} />\n }\n\n const {\n expanded, // eslint-disable-line @typescript-eslint/no-unused-vars\n disabled, // eslint-disable-line @typescript-eslint/no-unused-vars\n noAnimation, // eslint-disable-line @typescript-eslint/no-unused-vars\n onClick, // eslint-disable-line @typescript-eslint/no-unused-vars\n onOpened, // eslint-disable-line @typescript-eslint/no-unused-vars\n onClosed, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...trProps\n } = restProps\n\n return <tr role=\"row\" className={className} {...trProps} />\n}\n\nfunction useHandleTrVariant({ variant }) {\n const tableContext = React.useContext(TableContext)\n\n /**\n * Handle odd/even\n */\n const countRef = tableContext?.trCountRef.current\n const increment = () => {\n if (typeof countRef === 'undefined') {\n return 0\n }\n if (\n !variant ||\n (variant === 'even' && countRef.count % 2 === 1) ||\n (variant === 'odd' && countRef.count % 2 === 0)\n ) {\n countRef.count++\n }\n\n return countRef.count\n }\n\n const [count, setCount] = React.useState(() => {\n // SSR Support\n if (typeof window === 'undefined') {\n return increment()\n }\n })\n\n // StrictMode support\n React.useEffect(() => {\n // SSR will not execute useEffect\n setCount(increment())\n }, [tableContext?.rerenderAlias]) // eslint-disable-line react-hooks/exhaustive-deps\n\n /**\n * Find out the current odd/even when \"accordionContent\" is used.\n * Because we have now an additional \"tr\" element.\n * Then the CSS can't figure out the correct nth element (nth-of-type)\n * and we need to set it manually (nth-child and nth-of-type do not respect classes, so we can't ignore this one).\n */\n let currentVariant = variant\n if (!currentVariant) {\n currentVariant = count % 2 ? 'odd' : 'even'\n }\n const isLast =\n typeof countRef !== 'undefined' && countRef.count === count\n return {\n currentVariant,\n isLast,\n count,\n }\n}\n\n/**\n * Handle odd/even on re-render and React.StrictMode\n */\nexport function useHandleOddEven({ children }) {\n // Create this ref in order to \"auto\" set even/odd class in tr elements\n const trCountRef = React.useRef({ count: 0 })\n\n // When the alias changes, all tr's will rerender and get a new even/odd color\n // This is useful, when one tr gets removed\n const [rerenderAlias, setRerenderAlias] = React.useState({}) // eslint-disable-line no-unused-vars\n\n const isMounted = React.useRef(false)\n React.useEffect(() => {\n if (isMounted.current) {\n forceRerender()\n }\n isMounted.current = true\n }, [children]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { trCountRef, rerenderAlias, setRerenderAlias }\n\n function forceRerender() {\n trCountRef.current.count = 0\n setRerenderAlias({})\n }\n}\n\nTr.AccordionContent = TableAccordionContentRow\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAA6C,MAAAM,SAAA;EAAAC,UAAA;AAAA,SAAAR,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC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