@postenbring/hedwig-react 0.0.81 → 0.0.83

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 (580) hide show
  1. package/dist/accordion/accordion-content.d.ts +6 -2
  2. package/dist/accordion/accordion-content.d.ts.map +1 -0
  3. package/dist/accordion/accordion-header.d.ts +6 -2
  4. package/dist/accordion/accordion-header.d.ts.map +1 -0
  5. package/dist/accordion/accordion-item.d.ts +24 -3
  6. package/dist/accordion/accordion-item.d.ts.map +1 -0
  7. package/dist/accordion/accordion.d.ts +44 -2
  8. package/dist/accordion/accordion.d.ts.map +1 -0
  9. package/dist/accordion/accordion.js +102 -4
  10. package/dist/accordion/accordion.js.map +1 -1
  11. package/dist/accordion/accordion.mjs +5 -1
  12. package/dist/accordion/context.d.ts +7 -2
  13. package/dist/accordion/context.d.ts.map +1 -0
  14. package/dist/accordion/index.d.ts +9 -9
  15. package/dist/accordion/index.d.ts.map +1 -0
  16. package/dist/accordion/index.js +52 -53
  17. package/dist/accordion/index.js.map +1 -1
  18. package/dist/accordion/index.mjs +7 -7
  19. package/dist/badge/badge.d.ts +21 -5
  20. package/dist/badge/badge.d.ts.map +1 -0
  21. package/dist/badge/index.d.ts +3 -6
  22. package/dist/badge/index.d.ts.map +1 -0
  23. package/dist/box/box.d.ts +50 -4
  24. package/dist/box/box.d.ts.map +1 -0
  25. package/dist/box/box.js +15 -14
  26. package/dist/box/box.js.map +1 -1
  27. package/dist/box/box.mjs +1 -1
  28. package/dist/box/index.d.ts +3 -4
  29. package/dist/box/index.d.ts.map +1 -0
  30. package/dist/box/index.js +16 -19
  31. package/dist/box/index.js.map +1 -1
  32. package/dist/box/index.mjs +4 -5
  33. package/dist/breadcrumbs/breadcrumbs.d.ts +33 -2
  34. package/dist/breadcrumbs/breadcrumbs.d.ts.map +1 -0
  35. package/dist/breadcrumbs/index.d.ts +3 -2
  36. package/dist/breadcrumbs/index.d.ts.map +1 -0
  37. package/dist/button/button.d.ts +33 -3
  38. package/dist/button/button.d.ts.map +1 -0
  39. package/dist/button/index.d.ts +3 -3
  40. package/dist/button/index.d.ts.map +1 -0
  41. package/dist/card/card.d.ts +69 -12
  42. package/dist/card/card.d.ts.map +1 -0
  43. package/dist/card/card.js +17 -6
  44. package/dist/card/card.js.map +1 -1
  45. package/dist/card/card.mjs +1 -1
  46. package/dist/card/index.d.ts +3 -12
  47. package/dist/card/index.d.ts.map +1 -0
  48. package/dist/card/index.js +18 -19
  49. package/dist/card/index.js.map +1 -1
  50. package/dist/card/index.mjs +4 -5
  51. package/dist/{chunk-6R7AXKBR.mjs → chunk-35TXKAUH.mjs} +2 -2
  52. package/dist/chunk-35TXKAUH.mjs.map +1 -0
  53. package/dist/{chunk-XC3UHH2U.mjs → chunk-3WVRY6CC.mjs} +4 -4
  54. package/dist/{chunk-XC3UHH2U.mjs.map → chunk-3WVRY6CC.mjs.map} +1 -1
  55. package/dist/{chunk-67TP3E2D.mjs → chunk-6FBPKLWB.mjs} +3 -3
  56. package/dist/chunk-6FBPKLWB.mjs.map +1 -0
  57. package/dist/chunk-7YWW46R3.mjs +1 -0
  58. package/dist/{chunk-ENKVTAJB.mjs → chunk-AJWSQEDP.mjs} +18 -17
  59. package/dist/chunk-AJWSQEDP.mjs.map +1 -0
  60. package/dist/chunk-ARHJZUZG.mjs +1 -0
  61. package/dist/{chunk-4WQWU5TL.mjs → chunk-AXQCREUJ.mjs} +2 -2
  62. package/dist/chunk-AXQCREUJ.mjs.map +1 -0
  63. package/dist/chunk-BCFV6VOE.mjs +1 -0
  64. package/dist/{chunk-F2C3KZFX.mjs → chunk-BVPSZ3JI.mjs} +2 -2
  65. package/dist/chunk-BVPSZ3JI.mjs.map +1 -0
  66. package/dist/{chunk-7JRS4WEB.mjs → chunk-C34HEQXO.mjs} +33 -29
  67. package/dist/chunk-C34HEQXO.mjs.map +1 -0
  68. package/dist/chunk-CYDWEPFL.mjs +1 -0
  69. package/dist/{chunk-PLXB3TNA.mjs → chunk-D7QPJIUZ.mjs} +5 -5
  70. package/dist/{chunk-PLXB3TNA.mjs.map → chunk-D7QPJIUZ.mjs.map} +1 -1
  71. package/dist/{chunk-GSJPTZT3.mjs → chunk-FC4CEI2V.mjs} +34 -19
  72. package/dist/chunk-FC4CEI2V.mjs.map +1 -0
  73. package/dist/chunk-FYFJ75NX.mjs +1 -0
  74. package/dist/chunk-FYFJ75NX.mjs.map +1 -0
  75. package/dist/chunk-G65EYZFQ.mjs +1 -0
  76. package/dist/chunk-G65EYZFQ.mjs.map +1 -0
  77. package/dist/chunk-H3E546OT.mjs +1 -0
  78. package/dist/chunk-H3E546OT.mjs.map +1 -0
  79. package/dist/chunk-HQVL3ZJ2.mjs +1 -0
  80. package/dist/chunk-HQVL3ZJ2.mjs.map +1 -0
  81. package/dist/{chunk-KPGSRU4I.mjs → chunk-M3Y3XOGC.mjs} +13 -1
  82. package/dist/chunk-M3Y3XOGC.mjs.map +1 -0
  83. package/dist/{chunk-CIHZDFSQ.mjs → chunk-NU6OSFAU.mjs} +20 -9
  84. package/dist/chunk-NU6OSFAU.mjs.map +1 -0
  85. package/dist/{chunk-XUWZ4HGD.mjs → chunk-OGZ2NBMH.mjs} +49 -46
  86. package/dist/chunk-OGZ2NBMH.mjs.map +1 -0
  87. package/dist/{chunk-3MQKXNZ6.mjs → chunk-QZZIOBF4.mjs} +13 -1
  88. package/dist/chunk-QZZIOBF4.mjs.map +1 -0
  89. package/dist/chunk-RC76SXBP.mjs +1 -0
  90. package/dist/chunk-RC76SXBP.mjs.map +1 -0
  91. package/dist/{chunk-TQDUBRCZ.mjs → chunk-SQ63E7KM.mjs} +24 -22
  92. package/dist/chunk-SQ63E7KM.mjs.map +1 -0
  93. package/dist/{chunk-DEX36MFK.mjs → chunk-TDXU2IC6.mjs} +3 -4
  94. package/dist/chunk-TDXU2IC6.mjs.map +1 -0
  95. package/dist/{chunk-ES6ISHOV.mjs → chunk-UP3M3NEZ.mjs} +14 -13
  96. package/dist/{chunk-ES6ISHOV.mjs.map → chunk-UP3M3NEZ.mjs.map} +1 -1
  97. package/dist/chunk-ZKMFJZSH.mjs +1 -0
  98. package/dist/chunk-ZKMFJZSH.mjs.map +1 -0
  99. package/dist/description-list/description-list.d.ts +42 -2
  100. package/dist/description-list/description-list.d.ts.map +1 -0
  101. package/dist/description-list/index.d.ts +3 -2
  102. package/dist/description-list/index.d.ts.map +1 -0
  103. package/dist/footer/footer.d.ts +67 -7
  104. package/dist/footer/footer.d.ts.map +1 -0
  105. package/dist/footer/footer.js +79 -76
  106. package/dist/footer/footer.js.map +1 -1
  107. package/dist/footer/footer.mjs +4 -4
  108. package/dist/footer/index.d.ts +3 -7
  109. package/dist/footer/index.d.ts.map +1 -0
  110. package/dist/footer/index.js +80 -84
  111. package/dist/footer/index.js.map +1 -1
  112. package/dist/footer/index.mjs +7 -8
  113. package/dist/form/checkbox/checkbox.d.ts +28 -2
  114. package/dist/form/checkbox/checkbox.d.ts.map +1 -0
  115. package/dist/form/checkbox/index.d.ts +3 -2
  116. package/dist/form/checkbox/index.d.ts.map +1 -0
  117. package/dist/form/date-picker/date-picker.d.ts +33 -2
  118. package/dist/form/date-picker/date-picker.d.ts.map +1 -0
  119. package/dist/form/date-picker/date-picker.js +1 -1
  120. package/dist/form/date-picker/date-picker.js.map +1 -1
  121. package/dist/form/date-picker/date-picker.mjs +2 -2
  122. package/dist/form/date-picker/index.d.ts +3 -2
  123. package/dist/form/date-picker/index.d.ts.map +1 -0
  124. package/dist/form/date-picker/index.js +1 -1
  125. package/dist/form/date-picker/index.js.map +1 -1
  126. package/dist/form/date-picker/index.mjs +2 -2
  127. package/dist/form/error-message/error-message.d.ts +8 -2
  128. package/dist/form/error-message/error-message.d.ts.map +1 -0
  129. package/dist/form/error-message/index.d.ts +3 -2
  130. package/dist/form/error-message/index.d.ts.map +1 -0
  131. package/dist/form/fieldset/fieldset.d.ts +22 -3
  132. package/dist/form/fieldset/fieldset.d.ts.map +1 -0
  133. package/dist/form/fieldset/index.d.ts +3 -3
  134. package/dist/form/fieldset/index.d.ts.map +1 -0
  135. package/dist/form/index.d.ts +9 -20
  136. package/dist/form/index.d.ts.map +1 -0
  137. package/dist/form/index.js +1 -1
  138. package/dist/form/index.js.map +1 -1
  139. package/dist/form/index.mjs +2 -2
  140. package/dist/form/input/index.d.ts +3 -2
  141. package/dist/form/input/index.d.ts.map +1 -0
  142. package/dist/form/input/input.d.ts +5 -2
  143. package/dist/form/input/input.d.ts.map +1 -0
  144. package/dist/form/input-group/index.d.ts +3 -2
  145. package/dist/form/input-group/index.d.ts.map +1 -0
  146. package/dist/form/input-group/input-group.d.ts +27 -2
  147. package/dist/form/input-group/input-group.d.ts.map +1 -0
  148. package/dist/form/radiobutton/index.d.ts +5 -5
  149. package/dist/form/radiobutton/index.d.ts.map +1 -0
  150. package/dist/form/radiobutton/radiobutton.d.ts +17 -2
  151. package/dist/form/radiobutton/radiobutton.d.ts.map +1 -0
  152. package/dist/form/radiobutton/radiogroup.d.ts +24 -3
  153. package/dist/form/radiobutton/radiogroup.d.ts.map +1 -0
  154. package/dist/form/select/index.d.ts +3 -2
  155. package/dist/form/select/index.d.ts.map +1 -0
  156. package/dist/form/select/select.d.ts +9 -2
  157. package/dist/form/select/select.d.ts.map +1 -0
  158. package/dist/form/textarea/index.d.ts +3 -2
  159. package/dist/form/textarea/index.d.ts.map +1 -0
  160. package/dist/form/textarea/textarea.d.ts +5 -2
  161. package/dist/form/textarea/textarea.d.ts.map +1 -0
  162. package/dist/help-text/help-text.d.ts +51 -1
  163. package/dist/help-text/help-text.d.ts.map +1 -0
  164. package/dist/help-text/help-text.js +17 -20
  165. package/dist/help-text/help-text.js.map +1 -1
  166. package/dist/help-text/help-text.mjs +3 -3
  167. package/dist/help-text/index.d.ts +3 -1
  168. package/dist/help-text/index.d.ts.map +1 -0
  169. package/dist/help-text/index.js +17 -20
  170. package/dist/help-text/index.js.map +1 -1
  171. package/dist/help-text/index.mjs +3 -3
  172. package/dist/index-no-css.d.ts +26 -128
  173. package/dist/index-no-css.d.ts.map +1 -0
  174. package/dist/index-no-css.js +385 -398
  175. package/dist/index-no-css.js.map +1 -1
  176. package/dist/index-no-css.mjs +70 -68
  177. package/dist/index.d.ts +11 -128
  178. package/dist/index.d.ts.map +1 -0
  179. package/dist/index.js +385 -398
  180. package/dist/index.js.map +1 -1
  181. package/dist/index.mjs +70 -68
  182. package/dist/index.mjs.map +1 -1
  183. package/dist/layout/container/container.d.ts +23 -2
  184. package/dist/layout/container/container.d.ts.map +1 -0
  185. package/dist/layout/grid/grid.d.ts +101 -4
  186. package/dist/layout/grid/grid.d.ts.map +1 -0
  187. package/dist/layout/grid/grid.js +11 -10
  188. package/dist/layout/grid/grid.js.map +1 -1
  189. package/dist/layout/grid/grid.mjs +1 -1
  190. package/dist/layout/grid/index.d.ts +3 -4
  191. package/dist/layout/grid/index.d.ts.map +1 -0
  192. package/dist/layout/grid/index.js +12 -15
  193. package/dist/layout/grid/index.js.map +1 -1
  194. package/dist/layout/grid/index.mjs +4 -5
  195. package/dist/layout/index.d.ts +4 -10
  196. package/dist/layout/index.d.ts.map +1 -0
  197. package/dist/layout/index.js +12 -15
  198. package/dist/layout/index.js.map +1 -1
  199. package/dist/layout/index.mjs +4 -5
  200. package/dist/layout/responsive.d.ts +10 -2
  201. package/dist/layout/responsive.d.ts.map +1 -0
  202. package/dist/layout/spacing.d.ts +33 -3
  203. package/dist/layout/spacing.d.ts.map +1 -0
  204. package/dist/layout/stack/index.d.ts +3 -4
  205. package/dist/layout/stack/index.d.ts.map +1 -0
  206. package/dist/layout/stack/stack.d.ts +62 -4
  207. package/dist/layout/stack/stack.d.ts.map +1 -0
  208. package/dist/link/index.d.ts +3 -2
  209. package/dist/link/index.d.ts.map +1 -0
  210. package/dist/link/link.d.ts +20 -2
  211. package/dist/link/link.d.ts.map +1 -0
  212. package/dist/list/index.d.ts +5 -5
  213. package/dist/list/index.d.ts.map +1 -0
  214. package/dist/list/link-list.d.ts +12 -2
  215. package/dist/list/link-list.d.ts.map +1 -0
  216. package/dist/list/list.d.ts +40 -3
  217. package/dist/list/list.d.ts.map +1 -0
  218. package/dist/message/index.d.ts +3 -3
  219. package/dist/message/index.d.ts.map +1 -0
  220. package/dist/message/index.js +36 -38
  221. package/dist/message/index.js.map +1 -1
  222. package/dist/message/index.mjs +5 -6
  223. package/dist/message/message.d.ts +36 -4
  224. package/dist/message/message.d.ts.map +1 -0
  225. package/dist/message/message.js +35 -32
  226. package/dist/message/message.js.map +1 -1
  227. package/dist/message/message.mjs +2 -2
  228. package/dist/modal/index.d.ts +3 -5
  229. package/dist/modal/index.d.ts.map +1 -0
  230. package/dist/modal/index.js +61 -63
  231. package/dist/modal/index.js.map +1 -1
  232. package/dist/modal/index.mjs +6 -7
  233. package/dist/modal/modal.d.ts +81 -5
  234. package/dist/modal/modal.d.ts.map +1 -0
  235. package/dist/modal/modal.js +60 -56
  236. package/dist/modal/modal.js.map +1 -1
  237. package/dist/modal/modal.mjs +3 -3
  238. package/dist/navbar/icons.d.ts +3 -2
  239. package/dist/navbar/icons.d.ts.map +1 -0
  240. package/dist/navbar/index.d.ts +4 -13
  241. package/dist/navbar/index.d.ts.map +1 -0
  242. package/dist/navbar/index.js +145 -146
  243. package/dist/navbar/index.js.map +1 -1
  244. package/dist/navbar/index.mjs +6 -7
  245. package/dist/navbar/navbar-expandable-menu.d.ts +35 -7
  246. package/dist/navbar/navbar-expandable-menu.d.ts.map +1 -0
  247. package/dist/navbar/navbar-expandable-menu.js +1 -1
  248. package/dist/navbar/navbar-expandable-menu.js.map +1 -1
  249. package/dist/navbar/navbar-expandable-menu.mjs +2 -2
  250. package/dist/navbar/navbar.d.ts +130 -9
  251. package/dist/navbar/navbar.d.ts.map +1 -0
  252. package/dist/navbar/navbar.js +237 -28
  253. package/dist/navbar/navbar.js.map +1 -1
  254. package/dist/navbar/navbar.mjs +4 -1
  255. package/dist/show-more/index.d.ts +5 -4
  256. package/dist/show-more/index.d.ts.map +1 -0
  257. package/dist/show-more/index.js +3 -3
  258. package/dist/show-more/index.js.map +1 -1
  259. package/dist/show-more/index.mjs +2 -2
  260. package/dist/show-more/show-more.d.ts +42 -2
  261. package/dist/show-more/show-more.d.ts.map +1 -0
  262. package/dist/skeleton/index.d.ts +3 -2
  263. package/dist/skeleton/index.d.ts.map +1 -0
  264. package/dist/skeleton/skeleton.d.ts +67 -2
  265. package/dist/skeleton/skeleton.d.ts.map +1 -0
  266. package/dist/step-indicator/index.d.ts +3 -1
  267. package/dist/step-indicator/index.d.ts.map +1 -0
  268. package/dist/step-indicator/step-indicator.d.ts +36 -1
  269. package/dist/step-indicator/step-indicator.d.ts.map +1 -0
  270. package/dist/styled-html/index.d.ts +3 -2
  271. package/dist/styled-html/index.d.ts.map +1 -0
  272. package/dist/styled-html/styled-html.d.ts +36 -2
  273. package/dist/styled-html/styled-html.d.ts.map +1 -0
  274. package/dist/table/index.d.ts +3 -1
  275. package/dist/table/index.d.ts.map +1 -0
  276. package/dist/table/table.d.ts +25 -1
  277. package/dist/table/table.d.ts.map +1 -0
  278. package/dist/tabs/context.d.ts +8 -3
  279. package/dist/tabs/context.d.ts.map +1 -0
  280. package/dist/tabs/index.d.ts +7 -10
  281. package/dist/tabs/index.d.ts.map +1 -0
  282. package/dist/tabs/index.js +35 -38
  283. package/dist/tabs/index.js.map +1 -1
  284. package/dist/tabs/index.mjs +6 -6
  285. package/dist/tabs/tabs-content.d.ts +26 -4
  286. package/dist/tabs/tabs-content.d.ts.map +1 -0
  287. package/dist/tabs/tabs-list.d.ts +21 -4
  288. package/dist/tabs/tabs-list.d.ts.map +1 -0
  289. package/dist/tabs/tabs-list.js +1 -1
  290. package/dist/tabs/tabs-list.js.map +1 -1
  291. package/dist/tabs/tabs-list.mjs +2 -2
  292. package/dist/tabs/tabs.d.ts +26 -2
  293. package/dist/tabs/tabs.d.ts.map +1 -0
  294. package/dist/tabs/tabs.js +205 -8
  295. package/dist/tabs/tabs.js.map +1 -1
  296. package/dist/tabs/tabs.mjs +4 -1
  297. package/dist/text/index.d.ts +4 -2
  298. package/dist/text/index.d.ts.map +1 -0
  299. package/dist/text/text.d.ts +58 -2
  300. package/dist/text/text.d.ts.map +1 -0
  301. package/dist/utils/auto-animate-height.d.ts +33 -0
  302. package/dist/utils/auto-animate-height.d.ts.map +1 -0
  303. package/dist/{utilities → utils}/auto-animate-height.js +3 -3
  304. package/dist/utils/auto-animate-height.js.map +1 -0
  305. package/dist/utils/auto-animate-height.mjs +9 -0
  306. package/dist/utils/auto-animate-height.mjs.map +1 -0
  307. package/dist/utils/index.d.ts +4 -0
  308. package/dist/utils/index.d.ts.map +1 -0
  309. package/dist/{utilities → utils}/index.js +81 -11
  310. package/dist/utils/index.js.map +1 -0
  311. package/dist/utils/index.mjs +19 -0
  312. package/dist/utils/index.mjs.map +1 -0
  313. package/dist/utils/utils.d.ts +24 -0
  314. package/dist/utils/utils.d.ts.map +1 -0
  315. package/dist/{utils.js → utils/utils.js} +1 -3
  316. package/dist/utils/utils.js.map +1 -0
  317. package/dist/utils/utils.mjs +14 -0
  318. package/dist/utils/utils.mjs.map +1 -0
  319. package/dist/warning-banner/index.d.ts +3 -2
  320. package/dist/warning-banner/index.d.ts.map +1 -0
  321. package/dist/warning-banner/index.js +16 -19
  322. package/dist/warning-banner/index.js.map +1 -1
  323. package/dist/warning-banner/index.mjs +3 -3
  324. package/dist/warning-banner/warning-banner.d.ts +8 -2
  325. package/dist/warning-banner/warning-banner.d.ts.map +1 -0
  326. package/dist/warning-banner/warning-banner.js +16 -19
  327. package/dist/warning-banner/warning-banner.js.map +1 -1
  328. package/dist/warning-banner/warning-banner.mjs +3 -3
  329. package/package.json +12 -8
  330. package/src/accordion/accordion-content.tsx +31 -0
  331. package/src/accordion/accordion-header.tsx +36 -0
  332. package/src/accordion/accordion-item.tsx +62 -0
  333. package/src/accordion/accordion.stories.tsx +154 -0
  334. package/src/accordion/accordion.tsx +68 -0
  335. package/src/accordion/context.ts +8 -0
  336. package/src/accordion/index.tsx +9 -0
  337. package/src/badge/badge.stories.tsx +44 -0
  338. package/src/badge/badge.tsx +63 -0
  339. package/src/badge/index.tsx +3 -0
  340. package/src/box/box.stories.tsx +112 -0
  341. package/src/box/box.tsx +122 -0
  342. package/src/box/index.tsx +3 -0
  343. package/src/breadcrumbs/breadcrumbs.stories.tsx +50 -0
  344. package/src/breadcrumbs/breadcrumbs.tsx +47 -0
  345. package/src/breadcrumbs/index.tsx +3 -0
  346. package/src/button/button.stories.tsx +104 -0
  347. package/src/button/button.tsx +87 -0
  348. package/src/button/index.tsx +3 -0
  349. package/src/card/card.stories.tsx +82 -0
  350. package/src/card/card.tsx +222 -0
  351. package/src/card/index.tsx +14 -0
  352. package/src/description-list/description-list.stories.tsx +95 -0
  353. package/src/description-list/description-list.tsx +61 -0
  354. package/src/description-list/index.tsx +2 -0
  355. package/src/footer/footer.tsx +169 -0
  356. package/src/footer/index.tsx +9 -0
  357. package/src/form/checkbox/checkbox.stories.tsx +104 -0
  358. package/src/form/checkbox/checkbox.tsx +82 -0
  359. package/src/form/checkbox/index.tsx +2 -0
  360. package/src/form/date-picker/date-picker.stories.tsx +27 -0
  361. package/src/form/date-picker/date-picker.tsx +85 -0
  362. package/src/form/date-picker/index.tsx +2 -0
  363. package/src/form/error-message/error-message.stories.tsx +19 -0
  364. package/src/form/error-message/error-message.tsx +25 -0
  365. package/src/form/error-message/index.tsx +2 -0
  366. package/src/form/fieldset/fieldset.stories.tsx +86 -0
  367. package/src/form/fieldset/fieldset.tsx +64 -0
  368. package/src/form/fieldset/index.tsx +2 -0
  369. package/src/form/index.tsx +8 -0
  370. package/src/form/input/index.tsx +2 -0
  371. package/src/form/input/input.stories.tsx +166 -0
  372. package/src/form/input/input.tsx +30 -0
  373. package/src/form/input-group/index.tsx +2 -0
  374. package/src/form/input-group/input-group.tsx +106 -0
  375. package/src/form/radiobutton/index.tsx +4 -0
  376. package/src/form/radiobutton/radiobutton.stories.tsx +93 -0
  377. package/src/form/radiobutton/radiobutton.tsx +85 -0
  378. package/src/form/radiobutton/radiogroup.stories.tsx +39 -0
  379. package/src/form/radiobutton/radiogroup.tsx +52 -0
  380. package/src/form/select/index.tsx +2 -0
  381. package/src/form/select/select.stories.tsx +93 -0
  382. package/src/form/select/select.tsx +33 -0
  383. package/src/form/textarea/index.tsx +2 -0
  384. package/src/form/textarea/textarea.stories.tsx +106 -0
  385. package/src/form/textarea/textarea.tsx +33 -0
  386. package/src/help-text/help-text.tsx +98 -0
  387. package/src/help-text/index.ts +2 -0
  388. package/src/index-no-css.tsx +25 -0
  389. package/src/index.tsx +11 -0
  390. package/src/layout/container/container.stories.tsx +62 -0
  391. package/src/layout/container/container.tsx +47 -0
  392. package/src/layout/grid/grid.tsx +163 -0
  393. package/src/layout/grid/index.tsx +3 -0
  394. package/src/layout/index.tsx +3 -0
  395. package/src/layout/responsive.ts +26 -0
  396. package/src/layout/spacing.ts +37 -0
  397. package/src/layout/stack/index.tsx +2 -0
  398. package/src/layout/stack/stack.tsx +128 -0
  399. package/src/link/index.tsx +3 -0
  400. package/src/link/link.stories.tsx +64 -0
  401. package/src/link/link.tsx +46 -0
  402. package/src/list/index.tsx +5 -0
  403. package/src/list/link-list.stories.tsx +38 -0
  404. package/src/list/link-list.tsx +26 -0
  405. package/src/list/list.stories.tsx +71 -0
  406. package/src/list/list.tsx +65 -0
  407. package/src/message/index.tsx +2 -0
  408. package/src/message/message.stories.tsx +93 -0
  409. package/src/message/message.tsx +89 -0
  410. package/src/modal/index.tsx +3 -0
  411. package/src/modal/modal.stories.tsx +147 -0
  412. package/src/modal/modal.tsx +199 -0
  413. package/src/navbar/icons.tsx +21 -0
  414. package/src/navbar/index.tsx +18 -0
  415. package/src/navbar/navbar-expandable-menu.tsx +176 -0
  416. package/src/navbar/navbar.stories.tsx +99 -0
  417. package/src/navbar/navbar.tsx +264 -0
  418. package/src/show-more/index.ts +5 -0
  419. package/src/show-more/show-more.stories.tsx +119 -0
  420. package/src/show-more/show-more.tsx +66 -0
  421. package/src/skeleton/index.ts +2 -0
  422. package/src/skeleton/skeleton.stories.tsx +152 -0
  423. package/src/skeleton/skeleton.tsx +114 -0
  424. package/src/step-indicator/index.ts +2 -0
  425. package/src/step-indicator/step-indicator.stories.tsx +50 -0
  426. package/src/step-indicator/step-indicator.tsx +116 -0
  427. package/src/styled-html/index.ts +2 -0
  428. package/src/styled-html/styled-html.stories.tsx +189 -0
  429. package/src/styled-html/styled-html.tsx +59 -0
  430. package/src/table/index.ts +2 -0
  431. package/src/table/table.tsx +59 -0
  432. package/src/tabs/context.ts +18 -0
  433. package/src/tabs/index.tsx +7 -0
  434. package/src/tabs/tabs-content.tsx +62 -0
  435. package/src/tabs/tabs-list.tsx +129 -0
  436. package/src/tabs/tabs.stories.tsx +138 -0
  437. package/src/tabs/tabs.tsx +50 -0
  438. package/src/text/index.tsx +4 -0
  439. package/src/text/text.stories.tsx +112 -0
  440. package/src/text/text.tsx +129 -0
  441. package/src/utils/auto-animate-height.tsx +139 -0
  442. package/src/utils/index.ts +4 -0
  443. package/src/utils/utils.ts +110 -0
  444. package/src/warning-banner/index.tsx +2 -0
  445. package/src/warning-banner/warning-banner.stories.tsx +43 -0
  446. package/src/warning-banner/warning-banner.tsx +79 -0
  447. package/dist/_tsup-dts-rollup.d.mts +0 -2600
  448. package/dist/_tsup-dts-rollup.d.ts +0 -2600
  449. package/dist/accordion/accordion-content.d.mts +0 -2
  450. package/dist/accordion/accordion-header.d.mts +0 -2
  451. package/dist/accordion/accordion-item.d.mts +0 -3
  452. package/dist/accordion/accordion.d.mts +0 -2
  453. package/dist/accordion/context.d.mts +0 -2
  454. package/dist/accordion/index.d.mts +0 -9
  455. package/dist/badge/badge.d.mts +0 -5
  456. package/dist/badge/index.d.mts +0 -6
  457. package/dist/box/box.d.mts +0 -4
  458. package/dist/box/index.d.mts +0 -4
  459. package/dist/breadcrumbs/breadcrumbs.d.mts +0 -2
  460. package/dist/breadcrumbs/index.d.mts +0 -2
  461. package/dist/button/button.d.mts +0 -3
  462. package/dist/button/index.d.mts +0 -3
  463. package/dist/card/card.d.mts +0 -12
  464. package/dist/card/index.d.mts +0 -12
  465. package/dist/chunk-3MQKXNZ6.mjs.map +0 -1
  466. package/dist/chunk-3NDUE23B.mjs +0 -19
  467. package/dist/chunk-3NDUE23B.mjs.map +0 -1
  468. package/dist/chunk-3NL3TOZF.mjs +0 -13
  469. package/dist/chunk-3NL3TOZF.mjs.map +0 -1
  470. package/dist/chunk-3ZFEUABU.mjs +0 -23
  471. package/dist/chunk-3ZFEUABU.mjs.map +0 -1
  472. package/dist/chunk-4WQWU5TL.mjs.map +0 -1
  473. package/dist/chunk-67TP3E2D.mjs.map +0 -1
  474. package/dist/chunk-6R7AXKBR.mjs.map +0 -1
  475. package/dist/chunk-722MZPXO.mjs +0 -13
  476. package/dist/chunk-722MZPXO.mjs.map +0 -1
  477. package/dist/chunk-7JRS4WEB.mjs.map +0 -1
  478. package/dist/chunk-CIHZDFSQ.mjs.map +0 -1
  479. package/dist/chunk-CYEYGPRH.mjs +0 -17
  480. package/dist/chunk-CYEYGPRH.mjs.map +0 -1
  481. package/dist/chunk-DEX36MFK.mjs.map +0 -1
  482. package/dist/chunk-DZNH5JHY.mjs +0 -1
  483. package/dist/chunk-ENKVTAJB.mjs.map +0 -1
  484. package/dist/chunk-F2C3KZFX.mjs.map +0 -1
  485. package/dist/chunk-GSJPTZT3.mjs.map +0 -1
  486. package/dist/chunk-IJAX6APL.mjs +0 -23
  487. package/dist/chunk-IJAX6APL.mjs.map +0 -1
  488. package/dist/chunk-IKJJWKXM.mjs +0 -15
  489. package/dist/chunk-IKJJWKXM.mjs.map +0 -1
  490. package/dist/chunk-KPGSRU4I.mjs.map +0 -1
  491. package/dist/chunk-PT5H3QV6.mjs +0 -29
  492. package/dist/chunk-PT5H3QV6.mjs.map +0 -1
  493. package/dist/chunk-TQDUBRCZ.mjs.map +0 -1
  494. package/dist/chunk-V6UKKHKD.mjs +0 -33
  495. package/dist/chunk-V6UKKHKD.mjs.map +0 -1
  496. package/dist/chunk-XUWZ4HGD.mjs.map +0 -1
  497. package/dist/description-list/description-list.d.mts +0 -2
  498. package/dist/description-list/index.d.mts +0 -2
  499. package/dist/footer/footer.d.mts +0 -7
  500. package/dist/footer/index.d.mts +0 -7
  501. package/dist/form/checkbox/checkbox.d.mts +0 -2
  502. package/dist/form/checkbox/index.d.mts +0 -2
  503. package/dist/form/date-picker/date-picker.d.mts +0 -2
  504. package/dist/form/date-picker/index.d.mts +0 -2
  505. package/dist/form/error-message/error-message.d.mts +0 -2
  506. package/dist/form/error-message/index.d.mts +0 -2
  507. package/dist/form/fieldset/fieldset.d.mts +0 -3
  508. package/dist/form/fieldset/index.d.mts +0 -3
  509. package/dist/form/index.d.mts +0 -20
  510. package/dist/form/input/index.d.mts +0 -2
  511. package/dist/form/input/input.d.mts +0 -2
  512. package/dist/form/input-group/index.d.mts +0 -2
  513. package/dist/form/input-group/input-group.d.mts +0 -2
  514. package/dist/form/radiobutton/index.d.mts +0 -5
  515. package/dist/form/radiobutton/radiobutton.d.mts +0 -2
  516. package/dist/form/radiobutton/radiogroup.d.mts +0 -3
  517. package/dist/form/select/index.d.mts +0 -2
  518. package/dist/form/select/select.d.mts +0 -2
  519. package/dist/form/textarea/index.d.mts +0 -2
  520. package/dist/form/textarea/textarea.d.mts +0 -2
  521. package/dist/help-text/help-text.d.mts +0 -1
  522. package/dist/help-text/index.d.mts +0 -1
  523. package/dist/index-no-css.d.mts +0 -128
  524. package/dist/index.d.mts +0 -128
  525. package/dist/layout/container/container.d.mts +0 -2
  526. package/dist/layout/grid/grid.d.mts +0 -4
  527. package/dist/layout/grid/index.d.mts +0 -4
  528. package/dist/layout/index.d.mts +0 -10
  529. package/dist/layout/responsive.d.mts +0 -2
  530. package/dist/layout/spacing.d.mts +0 -3
  531. package/dist/layout/stack/index.d.mts +0 -4
  532. package/dist/layout/stack/stack.d.mts +0 -4
  533. package/dist/link/index.d.mts +0 -2
  534. package/dist/link/link.d.mts +0 -2
  535. package/dist/list/index.d.mts +0 -5
  536. package/dist/list/link-list.d.mts +0 -2
  537. package/dist/list/list.d.mts +0 -3
  538. package/dist/message/index.d.mts +0 -3
  539. package/dist/message/message.d.mts +0 -4
  540. package/dist/modal/index.d.mts +0 -5
  541. package/dist/modal/modal.d.mts +0 -5
  542. package/dist/navbar/icons.d.mts +0 -2
  543. package/dist/navbar/index.d.mts +0 -13
  544. package/dist/navbar/navbar-expandable-menu.d.mts +0 -7
  545. package/dist/navbar/navbar.d.mts +0 -9
  546. package/dist/show-more/index.d.mts +0 -4
  547. package/dist/show-more/show-more.d.mts +0 -2
  548. package/dist/skeleton/index.d.mts +0 -2
  549. package/dist/skeleton/skeleton.d.mts +0 -2
  550. package/dist/step-indicator/index.d.mts +0 -1
  551. package/dist/step-indicator/step-indicator.d.mts +0 -1
  552. package/dist/styled-html/index.d.mts +0 -2
  553. package/dist/styled-html/styled-html.d.mts +0 -2
  554. package/dist/table/index.d.mts +0 -1
  555. package/dist/table/table.d.mts +0 -1
  556. package/dist/tabs/context.d.mts +0 -3
  557. package/dist/tabs/index.d.mts +0 -10
  558. package/dist/tabs/tabs-content.d.mts +0 -4
  559. package/dist/tabs/tabs-list.d.mts +0 -4
  560. package/dist/tabs/tabs.d.mts +0 -2
  561. package/dist/text/index.d.mts +0 -2
  562. package/dist/text/text.d.mts +0 -2
  563. package/dist/utilities/auto-animate-height.d.mts +0 -2
  564. package/dist/utilities/auto-animate-height.d.ts +0 -2
  565. package/dist/utilities/auto-animate-height.js.map +0 -1
  566. package/dist/utilities/auto-animate-height.mjs +0 -9
  567. package/dist/utilities/index.d.mts +0 -2
  568. package/dist/utilities/index.d.ts +0 -2
  569. package/dist/utilities/index.js.map +0 -1
  570. package/dist/utilities/index.mjs +0 -10
  571. package/dist/utils.d.mts +0 -5
  572. package/dist/utils.d.ts +0 -5
  573. package/dist/utils.js.map +0 -1
  574. package/dist/utils.mjs +0 -16
  575. package/dist/warning-banner/index.d.mts +0 -2
  576. package/dist/warning-banner/warning-banner.d.mts +0 -2
  577. /package/dist/{chunk-DZNH5JHY.mjs.map → chunk-7YWW46R3.mjs.map} +0 -0
  578. /package/dist/{utilities/auto-animate-height.mjs.map → chunk-ARHJZUZG.mjs.map} +0 -0
  579. /package/dist/{utilities/index.mjs.map → chunk-BCFV6VOE.mjs.map} +0 -0
  580. /package/dist/{utils.mjs.map → chunk-CYDWEPFL.mjs.map} +0 -0
@@ -0,0 +1,154 @@
1
+ /* eslint-disable import/no-extraneous-dependencies -- storybook story */
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { useState } from "react";
4
+ import { Link } from "../link";
5
+ import { UnorderedList } from "../list";
6
+ import { Accordion } from ".";
7
+
8
+ const meta: Meta<typeof Accordion> = {
9
+ title: "Accordion",
10
+ component: Accordion,
11
+ args: {
12
+ children: (
13
+ <>
14
+ <Accordion.Item>
15
+ <Accordion.Header>Professional accordion title</Accordion.Header>
16
+ <Accordion.Content>
17
+ This is the simplest form of accordion body. Can be extensive.
18
+ </Accordion.Content>
19
+ </Accordion.Item>
20
+ <Accordion.Item>
21
+ <Accordion.Header>Yet another POAT with &laquo;advanced&raquo; content</Accordion.Header>
22
+ <Accordion.Content>
23
+ <h4>Hello</h4>
24
+ <div>
25
+ <p>
26
+ This is some really, really exciting stuff with{" "}
27
+ <Link href="https://www.posten.no">a link</Link> and all sorts of things like a
28
+ list, even!
29
+ </p>
30
+ <UnorderedList>
31
+ <li>Unordered</li>
32
+ <li>Like</li>
33
+ <li>You have</li>
34
+ <li>Never seen</li>
35
+ </UnorderedList>
36
+ </div>
37
+ </Accordion.Content>
38
+ </Accordion.Item>
39
+ </>
40
+ ),
41
+ },
42
+ };
43
+
44
+ type Story = StoryObj<typeof Accordion>;
45
+
46
+ export const MultipleItems: Story = {
47
+ name: "Multiple items",
48
+ };
49
+
50
+ export const JustOneItem: Story = {
51
+ name: "Just one item",
52
+ args: {
53
+ children: (
54
+ <Accordion.Item>
55
+ <Accordion.Header>Professional accordion title</Accordion.Header>
56
+ <Accordion.Content>
57
+ This is the simplest form of accordion body. Can be extensive.
58
+ </Accordion.Content>
59
+ </Accordion.Item>
60
+ ),
61
+ },
62
+ };
63
+
64
+ export const NoIndent: Story = {
65
+ args: {
66
+ indent: false,
67
+ children: (
68
+ <Accordion.Item>
69
+ <Accordion.Header>Professional accordion title</Accordion.Header>
70
+ <Accordion.Content>
71
+ This is the simplest form of accordion body. Can be extensive.
72
+ </Accordion.Content>
73
+ </Accordion.Item>
74
+ ),
75
+ },
76
+ };
77
+
78
+ export const DefaultOpen: Story = {
79
+ args: {
80
+ children: (
81
+ <>
82
+ <Accordion.Item defaultOpen>
83
+ <Accordion.Header>Professional accordion title</Accordion.Header>
84
+ <Accordion.Content>
85
+ This is the simplest form of accordion body. Can be extensive.
86
+ </Accordion.Content>
87
+ </Accordion.Item>
88
+ <Accordion.Item>
89
+ <Accordion.Header>Professional accordion title</Accordion.Header>
90
+ <Accordion.Content>
91
+ This is the simplest form of accordion body. Can be extensive.
92
+ </Accordion.Content>
93
+ </Accordion.Item>
94
+ </>
95
+ ),
96
+ },
97
+ };
98
+
99
+ export const SingleAccordion: Story = {
100
+ name: "Only one open at the same time",
101
+ render: () => {
102
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- it's ok
103
+ const [state, setState] = useState({ one: false, two: false, three: false });
104
+ function toggle(key: keyof typeof state) {
105
+ setState((prev) => {
106
+ return {
107
+ one: key === "one" ? !prev.one : false,
108
+ two: key === "two" ? !prev.two : false,
109
+ three: key === "three" ? !prev.three : false,
110
+ };
111
+ });
112
+ }
113
+
114
+ return (
115
+ <Accordion>
116
+ <Accordion.Item
117
+ onOpenChange={() => {
118
+ toggle("one");
119
+ }}
120
+ open={state.one}
121
+ >
122
+ <Accordion.Header>One</Accordion.Header>
123
+ <Accordion.Content>
124
+ Lorum ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisl eget
125
+ </Accordion.Content>
126
+ </Accordion.Item>
127
+ <Accordion.Item
128
+ onOpenChange={() => {
129
+ toggle("two");
130
+ }}
131
+ open={state.two}
132
+ >
133
+ <Accordion.Header>Two</Accordion.Header>
134
+ <Accordion.Content>
135
+ Lorum ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisl eget
136
+ </Accordion.Content>
137
+ </Accordion.Item>
138
+ <Accordion.Item
139
+ onOpenChange={() => {
140
+ toggle("three");
141
+ }}
142
+ open={state.three}
143
+ >
144
+ <Accordion.Header>Three</Accordion.Header>
145
+ <Accordion.Content>
146
+ Lorum ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisl eget
147
+ </Accordion.Content>
148
+ </Accordion.Item>
149
+ </Accordion>
150
+ );
151
+ },
152
+ };
153
+
154
+ export default meta;
@@ -0,0 +1,68 @@
1
+ import type { ReactElement } from "react";
2
+ import { forwardRef } from "react";
3
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
4
+ import { AccordionItem, type AccordionItemProps } from "./accordion-item";
5
+ import { AccordionHeader } from "./accordion-header";
6
+ import { AccordionContent } from "./accordion-content";
7
+
8
+ export interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ /**
10
+ * Accepts type of <AccordionItem/>
11
+ */
12
+ children: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];
13
+
14
+ /**
15
+ * Adds padding to the left of the accordion
16
+ */
17
+ indent?: boolean;
18
+ }
19
+
20
+ /**
21
+ * Displays collapsible content sections
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * <Accordion>
26
+ * <Accordion.Item defaultOpen>
27
+ * <Accordion.Header>Item one</Accordion.Header>
28
+ * <Accordion.Content>
29
+ * Some content
30
+ * </Accordion.Content>
31
+ * </Accordion.Item>
32
+ * <Accordion.Item>
33
+ * <Accordion.Header>Item two</Accordion.Header>
34
+ * <Accordion.Content>
35
+ * Some more content
36
+ * </Accordion.Content>
37
+ * </Accordion.Item>
38
+ * </Accordion>
39
+ * ```
40
+ */
41
+ export const Accordion = forwardRef<HTMLDivElement, AccordionProps>(
42
+ ({ children, className, indent = true, ...rest }, ref) => {
43
+ return (
44
+ <div
45
+ {...rest}
46
+ className={clsx(
47
+ "hds-accordion",
48
+ !indent && "hds-accordion--no-indent",
49
+ className as undefined,
50
+ )}
51
+ ref={ref}
52
+ >
53
+ {children}
54
+ </div>
55
+ );
56
+ },
57
+ ) as AccordionType;
58
+ Accordion.displayName = "Accordion";
59
+
60
+ Accordion.Item = AccordionItem;
61
+ Accordion.Header = AccordionHeader;
62
+ Accordion.Content = AccordionContent;
63
+
64
+ type AccordionType = ReturnType<typeof forwardRef<HTMLDivElement, AccordionProps>> & {
65
+ Item: typeof AccordionItem;
66
+ Header: typeof AccordionHeader;
67
+ Content: typeof AccordionContent;
68
+ };
@@ -0,0 +1,8 @@
1
+ import { createContext } from "react";
2
+
3
+ export interface AccordionItemContextProps {
4
+ open: boolean;
5
+ setOpen: (open: boolean) => void;
6
+ }
7
+
8
+ export const AccordionItemContext = createContext<AccordionItemContextProps | null>(null);
@@ -0,0 +1,9 @@
1
+ export { Accordion } from "./accordion";
2
+ export { AccordionItem } from "./accordion-item";
3
+ export { AccordionHeader } from "./accordion-header";
4
+ export { AccordionContent } from "./accordion-content";
5
+
6
+ export type * from "./accordion";
7
+ export type * from "./accordion-item";
8
+ export type * from "./accordion-header";
9
+ export type * from "./accordion-content";
@@ -0,0 +1,44 @@
1
+ /* eslint-disable import/no-extraneous-dependencies -- storybook story */
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Box } from "../box";
4
+ import { Badge, DarkBadge, WhiteBadge, WarningBadge } from ".";
5
+
6
+ const meta: Meta<typeof Badge> = {
7
+ title: "Badge",
8
+ component: Badge,
9
+ };
10
+
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof Badge>;
14
+
15
+ export const Lighter: Story = {
16
+ args: {
17
+ children: "Default badge",
18
+ },
19
+ };
20
+
21
+ export const Dark: Story = {
22
+ args: {
23
+ children: "Dark badge",
24
+ },
25
+ render: (props) => <DarkBadge {...props} />,
26
+ };
27
+
28
+ export const White: Story = {
29
+ args: {
30
+ children: "White badge",
31
+ },
32
+ render: (props) => (
33
+ <Box>
34
+ <WhiteBadge {...props} />
35
+ </Box>
36
+ ),
37
+ };
38
+
39
+ export const Warning: Story = {
40
+ args: {
41
+ children: "Warning badge",
42
+ },
43
+ render: (props) => <WarningBadge {...props} />,
44
+ };
@@ -0,0 +1,63 @@
1
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { forwardRef } from "react";
4
+
5
+ export interface BadgeProps extends React.AnchorHTMLAttributes<HTMLSpanElement> {
6
+ children: React.ReactNode;
7
+
8
+ /**
9
+ * Font size of the badge
10
+ *
11
+ * @default "small"
12
+ */
13
+ size?: "small" | "smaller";
14
+
15
+ /**
16
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
17
+ *
18
+ * @default false
19
+ */
20
+ asChild?: boolean;
21
+ }
22
+
23
+ const Badge = forwardRef<
24
+ HTMLSpanElement,
25
+ BadgeProps & { variant: "lighter" | "dark" | "white" | "warning" }
26
+ >(({ children, asChild, variant, size = "small", className, ...rest }, ref) => {
27
+ const Component = asChild ? Slot : "span";
28
+ return (
29
+ <Component
30
+ ref={ref}
31
+ className={clsx(
32
+ "hds-badge",
33
+ `hds-badge--${size}`,
34
+ `hds-badge--${variant}`,
35
+ className as undefined,
36
+ )}
37
+ {...rest}
38
+ >
39
+ {children}
40
+ </Component>
41
+ );
42
+ });
43
+ Badge.displayName = "Badge";
44
+
45
+ export const LighterBadge = forwardRef<HTMLSpanElement, BadgeProps>((props, ref) => {
46
+ return <Badge {...props} ref={ref} variant="lighter" />;
47
+ });
48
+ LighterBadge.displayName = "LighterBadge";
49
+
50
+ export const DarkBadge = forwardRef<HTMLSpanElement, BadgeProps>((props, ref) => {
51
+ return <Badge {...props} ref={ref} variant="dark" />;
52
+ });
53
+ DarkBadge.displayName = "DarkBadge";
54
+
55
+ export const WhiteBadge = forwardRef<HTMLSpanElement, BadgeProps>((props, ref) => {
56
+ return <Badge {...props} ref={ref} variant="white" />;
57
+ });
58
+ WhiteBadge.displayName = "WhiteBadge";
59
+
60
+ export const WarningBadge = forwardRef<HTMLSpanElement, BadgeProps>((props, ref) => {
61
+ return <Badge {...props} ref={ref} variant="warning" />;
62
+ });
63
+ WarningBadge.displayName = "WarningBadge";
@@ -0,0 +1,3 @@
1
+ export { LighterBadge as Badge, DarkBadge, WarningBadge, WhiteBadge } from "./badge";
2
+
3
+ export type * from "./badge";
@@ -0,0 +1,112 @@
1
+ /* eslint-disable import/no-extraneous-dependencies -- storybook story */
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { useState } from "react";
4
+ import { Text } from "../text";
5
+ import { Link } from "../link";
6
+ import { Box } from ".";
7
+
8
+ const meta: Meta<typeof Box> = {
9
+ title: "Box",
10
+ component: Box,
11
+ args: {
12
+ closeable: false,
13
+ children: (
14
+ <>
15
+ <Text variant="h3-title" as="h2">
16
+ Box content
17
+ </Text>
18
+ <Text _unstableSpacing>
19
+ This is some body copy in a box, but you can basically add anything you want in here.
20
+ </Text>
21
+ <Link href="#a-link-for-whatever-reason">A link for whatever reason</Link>
22
+ </>
23
+ ),
24
+ },
25
+ argTypes: {
26
+ variant: {
27
+ options: ["light-grey", "lighter", "white", "warning"],
28
+ control: {
29
+ type: "radio",
30
+ },
31
+ },
32
+ },
33
+ };
34
+
35
+ export default meta;
36
+
37
+ type Story = StoryObj<typeof Box>;
38
+ export const LightGreyBox: Story = {
39
+ args: {
40
+ variant: "light-grey",
41
+ },
42
+ };
43
+
44
+ export const LighterBox: Story = {
45
+ args: {
46
+ closeable: true,
47
+ variant: "lighter",
48
+ },
49
+ };
50
+
51
+ export const WhiteBox: Story = {
52
+ args: {
53
+ closeable: true,
54
+ variant: "white",
55
+ },
56
+ };
57
+
58
+ export const WarningBox: Story = {
59
+ args: {
60
+ closeable: true,
61
+ variant: "warning",
62
+ },
63
+ };
64
+
65
+ export const AreYouSureDialog: Story = {
66
+ args: {
67
+ closeable: true,
68
+ variant: "warning",
69
+ // eslint-disable-next-line no-alert -- Storybook story
70
+ onClose: () => window.confirm("Are you sure you want to close?"),
71
+ },
72
+ };
73
+
74
+ export const Custom: Story = {
75
+ render: function CustomBox() {
76
+ const [closeTimer, setCloseTimer] = useState<number | null>(null);
77
+ function countDownFrom(seconds: number) {
78
+ if (seconds > 0) {
79
+ setCloseTimer(seconds);
80
+ window.setTimeout(() => {
81
+ countDownFrom(seconds - 1);
82
+ }, 1000);
83
+ } else {
84
+ setCloseTimer(0);
85
+ }
86
+ }
87
+
88
+ // Choosing to not render the box at all instead of hiding it with CSS
89
+ if (closeTimer === 0) {
90
+ // eslint-disable-next-line react/jsx-no-useless-fragment -- Typescript did not like it when I returned null in a story
91
+ return <></>;
92
+ }
93
+
94
+ return (
95
+ <Box variant="lighter">
96
+ {/* Choosing to render the close button manually */}
97
+ <Box.CloseButton
98
+ onClick={() => {
99
+ closeTimer === null && countDownFrom(5);
100
+ }}
101
+ />
102
+ <Text variant="h3-title" as="h2">
103
+ A customomized box
104
+ {closeTimer !== null && ` - closing in ${closeTimer} seconds`}
105
+ </Text>
106
+ <Text _unstableSpacing>
107
+ With a custom close button, and a custom content. The content can be anything you like.
108
+ </Text>
109
+ </Box>
110
+ );
111
+ },
112
+ };
@@ -0,0 +1,122 @@
1
+ import { forwardRef, useCallback, useState } from "react";
2
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
3
+ import { Slot, Slottable } from "@radix-ui/react-slot";
4
+
5
+ export type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, "children">;
6
+ export const BoxCloseButton = forwardRef<HTMLButtonElement, BoxCloseButtonProps>(
7
+ ({ className, ...rest }, ref) => {
8
+ return (
9
+ <button
10
+ className={clsx("hds-box__close-button", className as undefined)}
11
+ ref={ref}
12
+ type="button"
13
+ {...rest}
14
+ />
15
+ );
16
+ },
17
+ );
18
+ BoxCloseButton.displayName = "Box.CloseButton";
19
+
20
+ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
21
+ children?: React.ReactNode;
22
+
23
+ /**
24
+ * Color variant of the box
25
+ *
26
+ * @default "light-grey"
27
+ */
28
+ variant?: "light-grey" | "lighter" | "white" | "warning";
29
+
30
+ /**
31
+ * If `true`, a close button will be shown.
32
+ * Use when you want to control the close button using the BoxCloseButton component.
33
+ *
34
+ * @default false
35
+ */
36
+ closeable?: boolean;
37
+
38
+ /**
39
+ * Callback fired when the component requests to be closed.
40
+ * If not set, the component will be closed without any user interaction.
41
+ *
42
+ * If set, and the handler returns non-true value, the component will not be closed.
43
+ * Use this if you want to control the closing of the component, using the `closed` prop
44
+ *
45
+ * If set, and the handler returns the true, the component will be closed.
46
+ * Use this with `window.confirm()` to ask the user to confirm closing the component.
47
+ */
48
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- It's fine, I want to have the boolean in the type
49
+ onClose?: () => boolean | unknown;
50
+
51
+ /**
52
+ * If `true`, the box will be closed and hidden from view
53
+ */
54
+ closed?: boolean;
55
+
56
+ /**
57
+ * Props applied to the close button element.
58
+ */
59
+ closeButtonProps?: BoxCloseButtonProps;
60
+
61
+ /**
62
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
63
+ *
64
+ * @default false
65
+ */
66
+ asChild?: boolean;
67
+ }
68
+
69
+ export const Box = forwardRef<HTMLDivElement, BoxProps>(
70
+ (
71
+ {
72
+ asChild,
73
+ variant,
74
+ closeable = false,
75
+ onClose: onCloseProp,
76
+ closed: closedProp,
77
+ closeButtonProps,
78
+ children,
79
+ className,
80
+ ...rest
81
+ },
82
+ ref,
83
+ ) => {
84
+ const [closedState, setClosedState] = useState(false);
85
+ const onClose = useCallback(() => {
86
+ if (onCloseProp) {
87
+ const result = onCloseProp();
88
+ if (result === true) {
89
+ setClosedState(true);
90
+ }
91
+ } else {
92
+ setClosedState(true);
93
+ }
94
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better
95
+ }, []);
96
+ const closed = closedProp ?? closedState;
97
+ const Component = asChild ? Slot : "div";
98
+
99
+ return (
100
+ <Component
101
+ className={clsx(
102
+ "hds-box",
103
+ variant && `hds-box--${variant}`,
104
+ { "hds-box--closed": closed },
105
+ className as undefined,
106
+ )}
107
+ ref={ref}
108
+ {...rest}
109
+ >
110
+ {closeable ? <BoxCloseButton onClick={onClose} {...closeButtonProps} /> : null}
111
+ <Slottable>{children}</Slottable>
112
+ </Component>
113
+ );
114
+ },
115
+ ) as BoxType;
116
+ Box.displayName = "Box";
117
+
118
+ Box.CloseButton = BoxCloseButton;
119
+
120
+ type BoxType = ReturnType<typeof forwardRef<HTMLDivElement, BoxProps>> & {
121
+ CloseButton: typeof BoxCloseButton;
122
+ };
@@ -0,0 +1,3 @@
1
+ export { Box, BoxCloseButton } from "./box";
2
+
3
+ export type * from "./box";
@@ -0,0 +1,50 @@
1
+ /* eslint-disable import/no-extraneous-dependencies -- storybook story */
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Link } from "../link";
4
+ import { Breadcrumbs } from ".";
5
+
6
+ const meta: Meta<typeof Breadcrumbs> = {
7
+ title: "Breadcrumbs",
8
+ component: Breadcrumbs,
9
+ args: {
10
+ children: (
11
+ <>
12
+ <li>
13
+ <Link href="https://www.posten.no">Home</Link>
14
+ </li>
15
+ <li>
16
+ <Link href="https://www.posten.no">Somewhere</Link>
17
+ </li>
18
+ <li>
19
+ <Link href="https://www.posten.no">Deep inside</Link>
20
+ </li>
21
+ <li>
22
+ <Link href="https://www.posten.no">Posten dot no</Link>
23
+ </li>
24
+ <li>You will find this page</li>
25
+ </>
26
+ ),
27
+ },
28
+ };
29
+
30
+ export default meta;
31
+
32
+ type Story = StoryObj<typeof Breadcrumbs>;
33
+
34
+ export const Default: Story = {};
35
+
36
+ /**
37
+ * You should have at minimum two levels in your hierarchy to use breadcrumbs.
38
+ */
39
+ export const TwoElements: Story = {
40
+ args: {
41
+ children: (
42
+ <>
43
+ <li>
44
+ <Link href="https://www.posten.no">Track letters and parcels</Link>
45
+ </li>
46
+ <li>Shipment from SOMEONE YOU KNOW</li>
47
+ </>
48
+ ),
49
+ },
50
+ };
@@ -0,0 +1,47 @@
1
+ import { forwardRef, type HTMLAttributes, type ReactElement, type ReactNode } from "react";
2
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
3
+
4
+ export interface BreadcrumbsProps extends HTMLAttributes<HTMLOListElement> {
5
+ children: ReactNode | ReactElement<HTMLLIElement> | ReactElement<HTMLLIElement>[];
6
+
7
+ /**
8
+ * Props passed to the `ol` html element
9
+ */
10
+ olProps?: HTMLAttributes<HTMLElement>;
11
+ }
12
+
13
+ /**
14
+ * A breadcrumbs navigation menu
15
+ *
16
+ * @example
17
+ *
18
+ * ```tsx
19
+ * <Breadcrumbs data-testid="breadcrumbs">
20
+ * <li><Link href="../">Previous page</Link></li>
21
+ * <li aria-current="page">Current page</li>
22
+ * </Breadcrumbs>
23
+ * ```
24
+ *
25
+ * Outputs this html structure
26
+ *
27
+ * ```html
28
+ * <nav data-testid="breadcrumbs">
29
+ * <ol>
30
+ * <li><a href="../">Previous page</a></li>
31
+ * <li aria-current="page">Current page</li>
32
+ * </ol>
33
+ * </nav>
34
+ * ```
35
+ */
36
+ export const Breadcrumbs = forwardRef<HTMLDivElement, BreadcrumbsProps>(
37
+ ({ olProps, children, ...rest }, ref) => {
38
+ return (
39
+ <nav ref={ref} {...rest}>
40
+ <ol {...olProps} className={clsx("hds-breadcrumbs", olProps?.className as undefined)}>
41
+ {children}
42
+ </ol>
43
+ </nav>
44
+ );
45
+ },
46
+ );
47
+ Breadcrumbs.displayName = "Breadcrumbs";
@@ -0,0 +1,3 @@
1
+ export { Breadcrumbs } from "./breadcrumbs";
2
+
3
+ export type * from "./breadcrumbs";