@postenbring/hedwig-react 0.0.80 → 0.0.82

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 (528) 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-content.js +1 -1
  4. package/dist/accordion/accordion-content.js.map +1 -1
  5. package/dist/accordion/accordion-content.mjs +1 -1
  6. package/dist/accordion/accordion-header.d.ts +6 -2
  7. package/dist/accordion/accordion-header.d.ts.map +1 -0
  8. package/dist/accordion/accordion-item.d.ts +24 -3
  9. package/dist/accordion/accordion-item.d.ts.map +1 -0
  10. package/dist/accordion/accordion.d.ts +44 -2
  11. package/dist/accordion/accordion.d.ts.map +1 -0
  12. package/dist/accordion/accordion.js +102 -4
  13. package/dist/accordion/accordion.js.map +1 -1
  14. package/dist/accordion/accordion.mjs +5 -1
  15. package/dist/accordion/context.d.ts +7 -2
  16. package/dist/accordion/context.d.ts.map +1 -0
  17. package/dist/accordion/index.d.ts +9 -9
  18. package/dist/accordion/index.d.ts.map +1 -0
  19. package/dist/accordion/index.js +53 -54
  20. package/dist/accordion/index.js.map +1 -1
  21. package/dist/accordion/index.mjs +8 -8
  22. package/dist/badge/badge.d.ts +21 -5
  23. package/dist/badge/badge.d.ts.map +1 -0
  24. package/dist/badge/index.d.ts +3 -6
  25. package/dist/badge/index.d.ts.map +1 -0
  26. package/dist/box/box.d.ts +50 -4
  27. package/dist/box/box.d.ts.map +1 -0
  28. package/dist/box/box.js +15 -14
  29. package/dist/box/box.js.map +1 -1
  30. package/dist/box/box.mjs +1 -1
  31. package/dist/box/index.d.ts +3 -4
  32. package/dist/box/index.d.ts.map +1 -0
  33. package/dist/box/index.js +16 -19
  34. package/dist/box/index.js.map +1 -1
  35. package/dist/box/index.mjs +4 -5
  36. package/dist/breadcrumbs/breadcrumbs.d.ts +33 -2
  37. package/dist/breadcrumbs/breadcrumbs.d.ts.map +1 -0
  38. package/dist/breadcrumbs/index.d.ts +3 -2
  39. package/dist/breadcrumbs/index.d.ts.map +1 -0
  40. package/dist/button/button.d.ts +33 -3
  41. package/dist/button/button.d.ts.map +1 -0
  42. package/dist/button/index.d.ts +3 -3
  43. package/dist/button/index.d.ts.map +1 -0
  44. package/dist/card/card.d.ts +69 -12
  45. package/dist/card/card.d.ts.map +1 -0
  46. package/dist/card/card.js +17 -6
  47. package/dist/card/card.js.map +1 -1
  48. package/dist/card/card.mjs +1 -1
  49. package/dist/card/index.d.ts +3 -12
  50. package/dist/card/index.d.ts.map +1 -0
  51. package/dist/card/index.js +18 -19
  52. package/dist/card/index.js.map +1 -1
  53. package/dist/card/index.mjs +4 -5
  54. package/dist/{chunk-XC3UHH2U.mjs → chunk-3WVRY6CC.mjs} +4 -4
  55. package/dist/{chunk-XC3UHH2U.mjs.map → chunk-3WVRY6CC.mjs.map} +1 -1
  56. package/dist/{chunk-GSJPTZT3.mjs → chunk-6AGDK5V3.mjs} +34 -19
  57. package/dist/chunk-6AGDK5V3.mjs.map +1 -0
  58. package/dist/{chunk-3MQKXNZ6.mjs → chunk-7UD72WOC.mjs} +13 -1
  59. package/dist/chunk-7UD72WOC.mjs.map +1 -0
  60. package/dist/chunk-7YWW46R3.mjs +1 -0
  61. package/dist/chunk-7YWW46R3.mjs.map +1 -0
  62. package/dist/{chunk-ENKVTAJB.mjs → chunk-AJWSQEDP.mjs} +18 -17
  63. package/dist/chunk-AJWSQEDP.mjs.map +1 -0
  64. package/dist/chunk-ARHJZUZG.mjs +1 -0
  65. package/dist/chunk-ARHJZUZG.mjs.map +1 -0
  66. package/dist/chunk-BCFV6VOE.mjs +1 -0
  67. package/dist/chunk-BCFV6VOE.mjs.map +1 -0
  68. package/dist/{chunk-GXYUJ5MA.mjs → chunk-C34HEQXO.mjs} +33 -29
  69. package/dist/chunk-C34HEQXO.mjs.map +1 -0
  70. package/dist/{chunk-PLXB3TNA.mjs → chunk-D7QPJIUZ.mjs} +5 -5
  71. package/dist/{chunk-PLXB3TNA.mjs.map → chunk-D7QPJIUZ.mjs.map} +1 -1
  72. package/dist/chunk-FYFJ75NX.mjs +1 -0
  73. package/dist/chunk-FYFJ75NX.mjs.map +1 -0
  74. package/dist/chunk-G65EYZFQ.mjs +1 -0
  75. package/dist/chunk-G65EYZFQ.mjs.map +1 -0
  76. package/dist/{chunk-2UWPZNXC.mjs → chunk-GLAEI3SD.mjs} +2 -2
  77. package/dist/{chunk-2UWPZNXC.mjs.map → chunk-GLAEI3SD.mjs.map} +1 -1
  78. package/dist/chunk-H3E546OT.mjs +1 -0
  79. package/dist/chunk-H3E546OT.mjs.map +1 -0
  80. package/dist/chunk-HQVL3ZJ2.mjs +1 -0
  81. package/dist/chunk-HQVL3ZJ2.mjs.map +1 -0
  82. package/dist/{chunk-XUWZ4HGD.mjs → chunk-LCJSUBCZ.mjs} +48 -45
  83. package/dist/chunk-LCJSUBCZ.mjs.map +1 -0
  84. package/dist/{chunk-KPGSRU4I.mjs → chunk-M3Y3XOGC.mjs} +13 -1
  85. package/dist/chunk-M3Y3XOGC.mjs.map +1 -0
  86. package/dist/{chunk-CIHZDFSQ.mjs → chunk-NU6OSFAU.mjs} +20 -9
  87. package/dist/chunk-NU6OSFAU.mjs.map +1 -0
  88. package/dist/chunk-RC76SXBP.mjs +1 -0
  89. package/dist/chunk-RC76SXBP.mjs.map +1 -0
  90. package/dist/{chunk-TQDUBRCZ.mjs → chunk-SQ63E7KM.mjs} +24 -22
  91. package/dist/chunk-SQ63E7KM.mjs.map +1 -0
  92. package/dist/{chunk-ES6ISHOV.mjs → chunk-UP3M3NEZ.mjs} +14 -13
  93. package/dist/{chunk-ES6ISHOV.mjs.map → chunk-UP3M3NEZ.mjs.map} +1 -1
  94. package/dist/chunk-ZKMFJZSH.mjs +1 -0
  95. package/dist/chunk-ZKMFJZSH.mjs.map +1 -0
  96. package/dist/description-list/description-list.d.ts +42 -2
  97. package/dist/description-list/description-list.d.ts.map +1 -0
  98. package/dist/description-list/index.d.ts +3 -2
  99. package/dist/description-list/index.d.ts.map +1 -0
  100. package/dist/footer/footer.d.ts +67 -7
  101. package/dist/footer/footer.d.ts.map +1 -0
  102. package/dist/footer/footer.js +80 -77
  103. package/dist/footer/footer.js.map +1 -1
  104. package/dist/footer/footer.mjs +5 -5
  105. package/dist/footer/index.d.ts +3 -7
  106. package/dist/footer/index.d.ts.map +1 -0
  107. package/dist/footer/index.js +81 -85
  108. package/dist/footer/index.js.map +1 -1
  109. package/dist/footer/index.mjs +8 -9
  110. package/dist/form/checkbox/checkbox.d.ts +28 -2
  111. package/dist/form/checkbox/checkbox.d.ts.map +1 -0
  112. package/dist/form/checkbox/index.d.ts +3 -2
  113. package/dist/form/checkbox/index.d.ts.map +1 -0
  114. package/dist/form/date-picker/date-picker.d.ts +33 -2
  115. package/dist/form/date-picker/date-picker.d.ts.map +1 -0
  116. package/dist/form/date-picker/index.d.ts +3 -2
  117. package/dist/form/date-picker/index.d.ts.map +1 -0
  118. package/dist/form/error-message/error-message.d.ts +8 -2
  119. package/dist/form/error-message/error-message.d.ts.map +1 -0
  120. package/dist/form/error-message/index.d.ts +3 -2
  121. package/dist/form/error-message/index.d.ts.map +1 -0
  122. package/dist/form/fieldset/fieldset.d.ts +22 -3
  123. package/dist/form/fieldset/fieldset.d.ts.map +1 -0
  124. package/dist/form/fieldset/index.d.ts +3 -3
  125. package/dist/form/fieldset/index.d.ts.map +1 -0
  126. package/dist/form/index.d.ts +9 -20
  127. package/dist/form/index.d.ts.map +1 -0
  128. package/dist/form/input/index.d.ts +3 -2
  129. package/dist/form/input/index.d.ts.map +1 -0
  130. package/dist/form/input/input.d.ts +5 -2
  131. package/dist/form/input/input.d.ts.map +1 -0
  132. package/dist/form/input-group/index.d.ts +3 -2
  133. package/dist/form/input-group/index.d.ts.map +1 -0
  134. package/dist/form/input-group/input-group.d.ts +27 -2
  135. package/dist/form/input-group/input-group.d.ts.map +1 -0
  136. package/dist/form/radiobutton/index.d.ts +5 -5
  137. package/dist/form/radiobutton/index.d.ts.map +1 -0
  138. package/dist/form/radiobutton/radiobutton.d.ts +17 -2
  139. package/dist/form/radiobutton/radiobutton.d.ts.map +1 -0
  140. package/dist/form/radiobutton/radiogroup.d.ts +24 -3
  141. package/dist/form/radiobutton/radiogroup.d.ts.map +1 -0
  142. package/dist/form/select/index.d.ts +3 -2
  143. package/dist/form/select/index.d.ts.map +1 -0
  144. package/dist/form/select/select.d.ts +9 -2
  145. package/dist/form/select/select.d.ts.map +1 -0
  146. package/dist/form/textarea/index.d.ts +3 -2
  147. package/dist/form/textarea/index.d.ts.map +1 -0
  148. package/dist/form/textarea/textarea.d.ts +5 -2
  149. package/dist/form/textarea/textarea.d.ts.map +1 -0
  150. package/dist/help-text/help-text.d.ts +51 -1
  151. package/dist/help-text/help-text.d.ts.map +1 -0
  152. package/dist/help-text/help-text.js +17 -20
  153. package/dist/help-text/help-text.js.map +1 -1
  154. package/dist/help-text/help-text.mjs +3 -3
  155. package/dist/help-text/index.d.ts +3 -1
  156. package/dist/help-text/index.d.ts.map +1 -0
  157. package/dist/help-text/index.js +17 -20
  158. package/dist/help-text/index.js.map +1 -1
  159. package/dist/help-text/index.mjs +3 -3
  160. package/dist/index-no-css.d.ts +26 -128
  161. package/dist/index-no-css.d.ts.map +1 -0
  162. package/dist/index-no-css.js +373 -394
  163. package/dist/index-no-css.js.map +1 -1
  164. package/dist/index-no-css.mjs +50 -57
  165. package/dist/index.d.ts +11 -128
  166. package/dist/index.d.ts.map +1 -0
  167. package/dist/index.js +373 -394
  168. package/dist/index.js.map +1 -1
  169. package/dist/index.mjs +50 -57
  170. package/dist/index.mjs.map +1 -1
  171. package/dist/layout/container/container.d.ts +23 -2
  172. package/dist/layout/container/container.d.ts.map +1 -0
  173. package/dist/layout/grid/grid.d.ts +101 -4
  174. package/dist/layout/grid/grid.d.ts.map +1 -0
  175. package/dist/layout/grid/grid.js +11 -10
  176. package/dist/layout/grid/grid.js.map +1 -1
  177. package/dist/layout/grid/grid.mjs +1 -1
  178. package/dist/layout/grid/index.d.ts +3 -4
  179. package/dist/layout/grid/index.d.ts.map +1 -0
  180. package/dist/layout/grid/index.js +12 -15
  181. package/dist/layout/grid/index.js.map +1 -1
  182. package/dist/layout/grid/index.mjs +4 -5
  183. package/dist/layout/index.d.ts +4 -10
  184. package/dist/layout/index.d.ts.map +1 -0
  185. package/dist/layout/index.js +12 -15
  186. package/dist/layout/index.js.map +1 -1
  187. package/dist/layout/index.mjs +4 -5
  188. package/dist/layout/responsive.d.ts +10 -2
  189. package/dist/layout/responsive.d.ts.map +1 -0
  190. package/dist/layout/spacing.d.ts +33 -3
  191. package/dist/layout/spacing.d.ts.map +1 -0
  192. package/dist/layout/stack/index.d.ts +3 -4
  193. package/dist/layout/stack/index.d.ts.map +1 -0
  194. package/dist/layout/stack/stack.d.ts +62 -4
  195. package/dist/layout/stack/stack.d.ts.map +1 -0
  196. package/dist/link/index.d.ts +3 -2
  197. package/dist/link/index.d.ts.map +1 -0
  198. package/dist/link/link.d.ts +20 -2
  199. package/dist/link/link.d.ts.map +1 -0
  200. package/dist/list/index.d.ts +5 -5
  201. package/dist/list/index.d.ts.map +1 -0
  202. package/dist/list/link-list.d.ts +12 -2
  203. package/dist/list/link-list.d.ts.map +1 -0
  204. package/dist/list/list.d.ts +40 -3
  205. package/dist/list/list.d.ts.map +1 -0
  206. package/dist/message/index.d.ts +3 -3
  207. package/dist/message/index.d.ts.map +1 -0
  208. package/dist/message/index.js +36 -38
  209. package/dist/message/index.js.map +1 -1
  210. package/dist/message/index.mjs +5 -6
  211. package/dist/message/message.d.ts +36 -4
  212. package/dist/message/message.d.ts.map +1 -0
  213. package/dist/message/message.js +35 -32
  214. package/dist/message/message.js.map +1 -1
  215. package/dist/message/message.mjs +2 -2
  216. package/dist/modal/index.d.ts +3 -5
  217. package/dist/modal/index.d.ts.map +1 -0
  218. package/dist/modal/index.js +60 -62
  219. package/dist/modal/index.js.map +1 -1
  220. package/dist/modal/index.mjs +5 -6
  221. package/dist/modal/modal.d.ts +81 -5
  222. package/dist/modal/modal.d.ts.map +1 -0
  223. package/dist/modal/modal.js +59 -55
  224. package/dist/modal/modal.js.map +1 -1
  225. package/dist/modal/modal.mjs +2 -2
  226. package/dist/navbar/icons.d.ts +3 -2
  227. package/dist/navbar/icons.d.ts.map +1 -0
  228. package/dist/navbar/index.d.ts +4 -13
  229. package/dist/navbar/index.d.ts.map +1 -0
  230. package/dist/navbar/index.js +144 -145
  231. package/dist/navbar/index.js.map +1 -1
  232. package/dist/navbar/index.mjs +4 -5
  233. package/dist/navbar/navbar-expandable-menu.d.ts +35 -7
  234. package/dist/navbar/navbar-expandable-menu.d.ts.map +1 -0
  235. package/dist/navbar/navbar.d.ts +130 -9
  236. package/dist/navbar/navbar.d.ts.map +1 -0
  237. package/dist/navbar/navbar.js +237 -28
  238. package/dist/navbar/navbar.js.map +1 -1
  239. package/dist/navbar/navbar.mjs +4 -1
  240. package/dist/show-more/index.d.ts +5 -4
  241. package/dist/show-more/index.d.ts.map +1 -0
  242. package/dist/show-more/show-more.d.ts +42 -2
  243. package/dist/show-more/show-more.d.ts.map +1 -0
  244. package/dist/skeleton/index.d.ts +3 -2
  245. package/dist/skeleton/index.d.ts.map +1 -0
  246. package/dist/skeleton/skeleton.d.ts +67 -2
  247. package/dist/skeleton/skeleton.d.ts.map +1 -0
  248. package/dist/step-indicator/index.d.ts +3 -1
  249. package/dist/step-indicator/index.d.ts.map +1 -0
  250. package/dist/step-indicator/step-indicator.d.ts +36 -1
  251. package/dist/step-indicator/step-indicator.d.ts.map +1 -0
  252. package/dist/styled-html/index.d.ts +3 -2
  253. package/dist/styled-html/index.d.ts.map +1 -0
  254. package/dist/styled-html/styled-html.d.ts +36 -2
  255. package/dist/styled-html/styled-html.d.ts.map +1 -0
  256. package/dist/table/index.d.ts +3 -1
  257. package/dist/table/index.d.ts.map +1 -0
  258. package/dist/table/table.d.ts +25 -1
  259. package/dist/table/table.d.ts.map +1 -0
  260. package/dist/tabs/context.d.ts +8 -3
  261. package/dist/tabs/context.d.ts.map +1 -0
  262. package/dist/tabs/index.d.ts +7 -10
  263. package/dist/tabs/index.d.ts.map +1 -0
  264. package/dist/tabs/index.js +34 -37
  265. package/dist/tabs/index.js.map +1 -1
  266. package/dist/tabs/index.mjs +4 -4
  267. package/dist/tabs/tabs-content.d.ts +26 -4
  268. package/dist/tabs/tabs-content.d.ts.map +1 -0
  269. package/dist/tabs/tabs-list.d.ts +21 -4
  270. package/dist/tabs/tabs-list.d.ts.map +1 -0
  271. package/dist/tabs/tabs.d.ts +26 -2
  272. package/dist/tabs/tabs.d.ts.map +1 -0
  273. package/dist/tabs/tabs.js +205 -8
  274. package/dist/tabs/tabs.js.map +1 -1
  275. package/dist/tabs/tabs.mjs +4 -1
  276. package/dist/text/index.d.ts +4 -2
  277. package/dist/text/index.d.ts.map +1 -0
  278. package/dist/text/text.d.ts +58 -2
  279. package/dist/text/text.d.ts.map +1 -0
  280. package/dist/utilities/auto-animate-height.d.ts +33 -2
  281. package/dist/utilities/auto-animate-height.d.ts.map +1 -0
  282. package/dist/utilities/index.d.ts +3 -2
  283. package/dist/utilities/index.d.ts.map +1 -0
  284. package/dist/utils.d.ts +28 -5
  285. package/dist/utils.d.ts.map +1 -0
  286. package/dist/warning-banner/index.d.ts +3 -2
  287. package/dist/warning-banner/index.d.ts.map +1 -0
  288. package/dist/warning-banner/index.js +16 -19
  289. package/dist/warning-banner/index.js.map +1 -1
  290. package/dist/warning-banner/index.mjs +3 -3
  291. package/dist/warning-banner/warning-banner.d.ts +8 -2
  292. package/dist/warning-banner/warning-banner.d.ts.map +1 -0
  293. package/dist/warning-banner/warning-banner.js +16 -19
  294. package/dist/warning-banner/warning-banner.js.map +1 -1
  295. package/dist/warning-banner/warning-banner.mjs +3 -3
  296. package/package.json +11 -7
  297. package/src/accordion/accordion-content.tsx +31 -0
  298. package/src/accordion/accordion-header.tsx +36 -0
  299. package/src/accordion/accordion-item.tsx +62 -0
  300. package/src/accordion/accordion.stories.tsx +154 -0
  301. package/src/accordion/accordion.tsx +68 -0
  302. package/src/accordion/context.ts +8 -0
  303. package/src/accordion/index.tsx +9 -0
  304. package/src/badge/badge.stories.tsx +44 -0
  305. package/src/badge/badge.tsx +63 -0
  306. package/src/badge/index.tsx +3 -0
  307. package/src/box/box.stories.tsx +112 -0
  308. package/src/box/box.tsx +122 -0
  309. package/src/box/index.tsx +3 -0
  310. package/src/breadcrumbs/breadcrumbs.stories.tsx +50 -0
  311. package/src/breadcrumbs/breadcrumbs.tsx +47 -0
  312. package/src/breadcrumbs/index.tsx +3 -0
  313. package/src/button/button.stories.tsx +104 -0
  314. package/src/button/button.tsx +87 -0
  315. package/src/button/index.tsx +3 -0
  316. package/src/card/card.stories.tsx +82 -0
  317. package/src/card/card.tsx +222 -0
  318. package/src/card/index.tsx +14 -0
  319. package/src/description-list/description-list.stories.tsx +95 -0
  320. package/src/description-list/description-list.tsx +61 -0
  321. package/src/description-list/index.tsx +2 -0
  322. package/src/footer/footer.tsx +169 -0
  323. package/src/footer/index.tsx +9 -0
  324. package/src/form/checkbox/checkbox.stories.tsx +104 -0
  325. package/src/form/checkbox/checkbox.tsx +82 -0
  326. package/src/form/checkbox/index.tsx +2 -0
  327. package/src/form/date-picker/date-picker.stories.tsx +27 -0
  328. package/src/form/date-picker/date-picker.tsx +85 -0
  329. package/src/form/date-picker/index.tsx +2 -0
  330. package/src/form/error-message/error-message.stories.tsx +19 -0
  331. package/src/form/error-message/error-message.tsx +25 -0
  332. package/src/form/error-message/index.tsx +2 -0
  333. package/src/form/fieldset/fieldset.stories.tsx +86 -0
  334. package/src/form/fieldset/fieldset.tsx +64 -0
  335. package/src/form/fieldset/index.tsx +2 -0
  336. package/src/form/index.tsx +8 -0
  337. package/src/form/input/index.tsx +2 -0
  338. package/src/form/input/input.stories.tsx +166 -0
  339. package/src/form/input/input.tsx +30 -0
  340. package/src/form/input-group/index.tsx +2 -0
  341. package/src/form/input-group/input-group.tsx +106 -0
  342. package/src/form/radiobutton/index.tsx +4 -0
  343. package/src/form/radiobutton/radiobutton.stories.tsx +93 -0
  344. package/src/form/radiobutton/radiobutton.tsx +85 -0
  345. package/src/form/radiobutton/radiogroup.stories.tsx +39 -0
  346. package/src/form/radiobutton/radiogroup.tsx +52 -0
  347. package/src/form/select/index.tsx +2 -0
  348. package/src/form/select/select.stories.tsx +93 -0
  349. package/src/form/select/select.tsx +33 -0
  350. package/src/form/textarea/index.tsx +2 -0
  351. package/src/form/textarea/textarea.stories.tsx +106 -0
  352. package/src/form/textarea/textarea.tsx +33 -0
  353. package/src/help-text/help-text.tsx +98 -0
  354. package/src/help-text/index.ts +2 -0
  355. package/src/index-no-css.tsx +25 -0
  356. package/src/index.tsx +11 -0
  357. package/src/layout/container/container.stories.tsx +62 -0
  358. package/src/layout/container/container.tsx +47 -0
  359. package/src/layout/grid/grid.tsx +163 -0
  360. package/src/layout/grid/index.tsx +3 -0
  361. package/src/layout/index.tsx +3 -0
  362. package/src/layout/responsive.ts +26 -0
  363. package/src/layout/spacing.ts +37 -0
  364. package/src/layout/stack/index.tsx +2 -0
  365. package/src/layout/stack/stack.tsx +128 -0
  366. package/src/link/index.tsx +3 -0
  367. package/src/link/link.stories.tsx +64 -0
  368. package/src/link/link.tsx +46 -0
  369. package/src/list/index.tsx +5 -0
  370. package/src/list/link-list.stories.tsx +38 -0
  371. package/src/list/link-list.tsx +26 -0
  372. package/src/list/list.stories.tsx +71 -0
  373. package/src/list/list.tsx +65 -0
  374. package/src/message/index.tsx +2 -0
  375. package/src/message/message.stories.tsx +93 -0
  376. package/src/message/message.tsx +89 -0
  377. package/src/modal/index.tsx +3 -0
  378. package/src/modal/modal.stories.tsx +147 -0
  379. package/src/modal/modal.tsx +199 -0
  380. package/src/navbar/icons.tsx +21 -0
  381. package/src/navbar/index.tsx +18 -0
  382. package/src/navbar/navbar-expandable-menu.tsx +176 -0
  383. package/src/navbar/navbar.stories.tsx +99 -0
  384. package/src/navbar/navbar.tsx +264 -0
  385. package/src/show-more/index.ts +5 -0
  386. package/src/show-more/show-more.stories.tsx +119 -0
  387. package/src/show-more/show-more.tsx +66 -0
  388. package/src/skeleton/index.ts +2 -0
  389. package/src/skeleton/skeleton.stories.tsx +152 -0
  390. package/src/skeleton/skeleton.tsx +114 -0
  391. package/src/step-indicator/index.ts +2 -0
  392. package/src/step-indicator/step-indicator.stories.tsx +50 -0
  393. package/src/step-indicator/step-indicator.tsx +116 -0
  394. package/src/styled-html/index.ts +2 -0
  395. package/src/styled-html/styled-html.stories.tsx +189 -0
  396. package/src/styled-html/styled-html.tsx +59 -0
  397. package/src/table/index.ts +2 -0
  398. package/src/table/table.tsx +59 -0
  399. package/src/tabs/context.ts +18 -0
  400. package/src/tabs/index.tsx +7 -0
  401. package/src/tabs/tabs-content.tsx +62 -0
  402. package/src/tabs/tabs-list.tsx +129 -0
  403. package/src/tabs/tabs.stories.tsx +138 -0
  404. package/src/tabs/tabs.tsx +50 -0
  405. package/src/text/index.tsx +4 -0
  406. package/src/text/text.stories.tsx +112 -0
  407. package/src/text/text.tsx +129 -0
  408. package/src/utilities/auto-animate-height.tsx +139 -0
  409. package/src/utilities/index.ts +2 -0
  410. package/src/utils.ts +110 -0
  411. package/src/warning-banner/index.tsx +2 -0
  412. package/src/warning-banner/warning-banner.stories.tsx +43 -0
  413. package/src/warning-banner/warning-banner.tsx +79 -0
  414. package/dist/_tsup-dts-rollup.d.mts +0 -2600
  415. package/dist/_tsup-dts-rollup.d.ts +0 -2600
  416. package/dist/accordion/accordion-content.d.mts +0 -2
  417. package/dist/accordion/accordion-header.d.mts +0 -2
  418. package/dist/accordion/accordion-item.d.mts +0 -3
  419. package/dist/accordion/accordion.d.mts +0 -2
  420. package/dist/accordion/context.d.mts +0 -2
  421. package/dist/accordion/index.d.mts +0 -9
  422. package/dist/badge/badge.d.mts +0 -5
  423. package/dist/badge/index.d.mts +0 -6
  424. package/dist/box/box.d.mts +0 -4
  425. package/dist/box/index.d.mts +0 -4
  426. package/dist/breadcrumbs/breadcrumbs.d.mts +0 -2
  427. package/dist/breadcrumbs/index.d.mts +0 -2
  428. package/dist/button/button.d.mts +0 -3
  429. package/dist/button/index.d.mts +0 -3
  430. package/dist/card/card.d.mts +0 -12
  431. package/dist/card/index.d.mts +0 -12
  432. package/dist/chunk-3MQKXNZ6.mjs.map +0 -1
  433. package/dist/chunk-3NL3TOZF.mjs +0 -13
  434. package/dist/chunk-3NL3TOZF.mjs.map +0 -1
  435. package/dist/chunk-722MZPXO.mjs +0 -13
  436. package/dist/chunk-722MZPXO.mjs.map +0 -1
  437. package/dist/chunk-CIHZDFSQ.mjs.map +0 -1
  438. package/dist/chunk-CYEYGPRH.mjs +0 -17
  439. package/dist/chunk-CYEYGPRH.mjs.map +0 -1
  440. package/dist/chunk-ENKVTAJB.mjs.map +0 -1
  441. package/dist/chunk-GSJPTZT3.mjs.map +0 -1
  442. package/dist/chunk-GXYUJ5MA.mjs.map +0 -1
  443. package/dist/chunk-HBSDJAFF.mjs +0 -23
  444. package/dist/chunk-HBSDJAFF.mjs.map +0 -1
  445. package/dist/chunk-IJAX6APL.mjs +0 -23
  446. package/dist/chunk-IJAX6APL.mjs.map +0 -1
  447. package/dist/chunk-IKJJWKXM.mjs +0 -15
  448. package/dist/chunk-IKJJWKXM.mjs.map +0 -1
  449. package/dist/chunk-KPGSRU4I.mjs.map +0 -1
  450. package/dist/chunk-MKVI42QR.mjs +0 -19
  451. package/dist/chunk-MKVI42QR.mjs.map +0 -1
  452. package/dist/chunk-PT5H3QV6.mjs +0 -29
  453. package/dist/chunk-PT5H3QV6.mjs.map +0 -1
  454. package/dist/chunk-TQDUBRCZ.mjs.map +0 -1
  455. package/dist/chunk-V6UKKHKD.mjs +0 -33
  456. package/dist/chunk-V6UKKHKD.mjs.map +0 -1
  457. package/dist/chunk-XUWZ4HGD.mjs.map +0 -1
  458. package/dist/description-list/description-list.d.mts +0 -2
  459. package/dist/description-list/index.d.mts +0 -2
  460. package/dist/footer/footer.d.mts +0 -7
  461. package/dist/footer/index.d.mts +0 -7
  462. package/dist/form/checkbox/checkbox.d.mts +0 -2
  463. package/dist/form/checkbox/index.d.mts +0 -2
  464. package/dist/form/date-picker/date-picker.d.mts +0 -2
  465. package/dist/form/date-picker/index.d.mts +0 -2
  466. package/dist/form/error-message/error-message.d.mts +0 -2
  467. package/dist/form/error-message/index.d.mts +0 -2
  468. package/dist/form/fieldset/fieldset.d.mts +0 -3
  469. package/dist/form/fieldset/index.d.mts +0 -3
  470. package/dist/form/index.d.mts +0 -20
  471. package/dist/form/input/index.d.mts +0 -2
  472. package/dist/form/input/input.d.mts +0 -2
  473. package/dist/form/input-group/index.d.mts +0 -2
  474. package/dist/form/input-group/input-group.d.mts +0 -2
  475. package/dist/form/radiobutton/index.d.mts +0 -5
  476. package/dist/form/radiobutton/radiobutton.d.mts +0 -2
  477. package/dist/form/radiobutton/radiogroup.d.mts +0 -3
  478. package/dist/form/select/index.d.mts +0 -2
  479. package/dist/form/select/select.d.mts +0 -2
  480. package/dist/form/textarea/index.d.mts +0 -2
  481. package/dist/form/textarea/textarea.d.mts +0 -2
  482. package/dist/help-text/help-text.d.mts +0 -1
  483. package/dist/help-text/index.d.mts +0 -1
  484. package/dist/index-no-css.d.mts +0 -128
  485. package/dist/index.d.mts +0 -128
  486. package/dist/layout/container/container.d.mts +0 -2
  487. package/dist/layout/grid/grid.d.mts +0 -4
  488. package/dist/layout/grid/index.d.mts +0 -4
  489. package/dist/layout/index.d.mts +0 -10
  490. package/dist/layout/responsive.d.mts +0 -2
  491. package/dist/layout/spacing.d.mts +0 -3
  492. package/dist/layout/stack/index.d.mts +0 -4
  493. package/dist/layout/stack/stack.d.mts +0 -4
  494. package/dist/link/index.d.mts +0 -2
  495. package/dist/link/link.d.mts +0 -2
  496. package/dist/list/index.d.mts +0 -5
  497. package/dist/list/link-list.d.mts +0 -2
  498. package/dist/list/list.d.mts +0 -3
  499. package/dist/message/index.d.mts +0 -3
  500. package/dist/message/message.d.mts +0 -4
  501. package/dist/modal/index.d.mts +0 -5
  502. package/dist/modal/modal.d.mts +0 -5
  503. package/dist/navbar/icons.d.mts +0 -2
  504. package/dist/navbar/index.d.mts +0 -13
  505. package/dist/navbar/navbar-expandable-menu.d.mts +0 -7
  506. package/dist/navbar/navbar.d.mts +0 -9
  507. package/dist/show-more/index.d.mts +0 -4
  508. package/dist/show-more/show-more.d.mts +0 -2
  509. package/dist/skeleton/index.d.mts +0 -2
  510. package/dist/skeleton/skeleton.d.mts +0 -2
  511. package/dist/step-indicator/index.d.mts +0 -1
  512. package/dist/step-indicator/step-indicator.d.mts +0 -1
  513. package/dist/styled-html/index.d.mts +0 -2
  514. package/dist/styled-html/styled-html.d.mts +0 -2
  515. package/dist/table/index.d.mts +0 -1
  516. package/dist/table/table.d.mts +0 -1
  517. package/dist/tabs/context.d.mts +0 -3
  518. package/dist/tabs/index.d.mts +0 -10
  519. package/dist/tabs/tabs-content.d.mts +0 -4
  520. package/dist/tabs/tabs-list.d.mts +0 -4
  521. package/dist/tabs/tabs.d.mts +0 -2
  522. package/dist/text/index.d.mts +0 -2
  523. package/dist/text/text.d.mts +0 -2
  524. package/dist/utilities/auto-animate-height.d.mts +0 -2
  525. package/dist/utilities/index.d.mts +0 -2
  526. package/dist/utils.d.mts +0 -5
  527. package/dist/warning-banner/index.d.mts +0 -2
  528. package/dist/warning-banner/warning-banner.d.mts +0 -2
@@ -0,0 +1,98 @@
1
+ import * as Popover from "@radix-ui/react-popover";
2
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
3
+ import { forwardRef } from "react";
4
+ import { Box } from "../box";
5
+
6
+ interface HelpTextProps extends React.HTMLAttributes<HTMLButtonElement> {
7
+ className?: string;
8
+
9
+ /**
10
+ * The content of the help text, often a word or phrase that could use some explanation
11
+ */
12
+ children: React.ReactNode;
13
+
14
+ /**
15
+ * The help text that will be shown when the user clicks the trigger
16
+ */
17
+ helpText: React.ReactNode;
18
+
19
+ /**
20
+ * The title of the help text. Used by screen readers and if the user hover over the help text
21
+ */
22
+ title?: string;
23
+
24
+ /**
25
+ * Props for the `Box` that contains the help text
26
+ */
27
+ boxProps?: React.ComponentProps<typeof Box>;
28
+
29
+ /**
30
+ * The side of the trigger the popover should be attached to
31
+ *
32
+ * @default "top"
33
+ */
34
+ side?: "top" | "right" | "bottom" | "left";
35
+
36
+ /**
37
+ * The alignment of the popover content
38
+ *
39
+ * @default "start"
40
+ */
41
+ align?: "center" | "end" | "start";
42
+ }
43
+
44
+ /**
45
+ * Show a help text for a word or phrase when clicked
46
+ *
47
+ * Useful for providing explanations for domain-specific terms, acronyms or phrases that could do with further elaboration
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * <p>
52
+ * En annen avgjørende faktor for avgifter er om nettbutikken er registrert i{" "}
53
+ * <HelpText helpText={`VOEC er en forkortelse for "VAT on E-commerce" (mva. på e-handel).`}>
54
+ * VOEC
55
+ * </HelpText>
56
+ * </p>
57
+ * ```
58
+ */
59
+ export const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
60
+ (
61
+ { children, className, helpText, title, side = "top", align = "start", boxProps, ...rest },
62
+ ref,
63
+ ) => {
64
+ return (
65
+ // NOTE: Using radix's [Popover component](https://www.radix-ui.com/primitives/docs/components/popover)
66
+ // In the future we can use the native popover api, but as of writing, though all browsers support it
67
+ // it's not far enough back to be used in production
68
+ // https://caniuse.com/mdn-html_elements_input_popovertarget
69
+ <Popover.Root>
70
+ <Popover.Trigger asChild>
71
+ <button
72
+ ref={ref}
73
+ className={clsx("hds-help-text-button", className as undefined)}
74
+ title={title}
75
+ type="button"
76
+ {...rest}
77
+ >
78
+ {children}
79
+ </button>
80
+ </Popover.Trigger>
81
+ <Popover.Portal>
82
+ <Popover.Content asChild side={side} align={align}>
83
+ <Box
84
+ {...boxProps}
85
+ className={clsx("hds-help-text-box", boxProps?.className as undefined)}
86
+ >
87
+ <Popover.Close asChild>
88
+ <Box.CloseButton />
89
+ </Popover.Close>
90
+ {helpText}
91
+ </Box>
92
+ </Popover.Content>
93
+ </Popover.Portal>
94
+ </Popover.Root>
95
+ );
96
+ },
97
+ );
98
+ HelpText.displayName = "HelpText";
@@ -0,0 +1,2 @@
1
+ export { HelpText } from "./help-text";
2
+ export type * from "./help-text";
@@ -0,0 +1,25 @@
1
+ export * from "./accordion";
2
+ export * from "./badge";
3
+ export * from "./box";
4
+ export * from "./breadcrumbs";
5
+ export * from "./button";
6
+ export * from "./card";
7
+ export * from "./description-list";
8
+ export * from "./form";
9
+ export * from "./footer";
10
+ export * from "./help-text";
11
+ export * from "./layout";
12
+ export * from "./link";
13
+ export * from "./list";
14
+ export * from "./message";
15
+ export * from "./modal";
16
+ export * from "./navbar";
17
+ export * from "./show-more";
18
+ export * from "./skeleton";
19
+ export * from "./step-indicator";
20
+ export * from "./styled-html";
21
+ export * from "./table";
22
+ export * from "./tabs";
23
+ export * from "./text";
24
+ export * from "./utilities";
25
+ export * from "./warning-banner";
package/src/index.tsx ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Import the hedwig css file, so the consumers don't have to. Plug and play.
3
+ *
4
+ * NOTE: Importing the full path, not just the package name.
5
+ * For some reason vite did not include the css during development when this file only imported the package name.
6
+ *
7
+ * Consumers using the `@postenbring/hedwig-css` package directly should only need to import the package without a path.
8
+ */
9
+ import "@postenbring/hedwig-css/dist/index.css";
10
+
11
+ export * from "./index-no-css";
@@ -0,0 +1,62 @@
1
+ /* eslint-disable import/no-extraneous-dependencies -- storybook story */
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { useState, useEffect, useRef, useId } from "react";
4
+ import { Container } from "..";
5
+
6
+ const meta: Meta<typeof Container> = {
7
+ title: "Layout/Container",
8
+ component: Container,
9
+ render: (args) => (
10
+ <Container {...args} style={{ background: "var(--hds-ui-colors-warning-yellow)" }}>
11
+ <div style={{ background: "var(--hds-ui-colors-warning-yellow-light-fill)" }}>
12
+ <Widths />
13
+ </div>
14
+ </Container>
15
+ ),
16
+ };
17
+
18
+ export default meta;
19
+
20
+ type Story = StoryObj<typeof Container>;
21
+
22
+ export const Default: Story = {};
23
+
24
+ export const Slim: Story = {
25
+ args: {
26
+ variant: "slim",
27
+ },
28
+ };
29
+
30
+ function Widths() {
31
+ const id = useId().replace(":", "").replace(":", "");
32
+ const [windowWidth, setWindowWidth] = useState(window.innerWidth);
33
+ const [containerWidth, setContainerWidth] = useState(0);
34
+ const [innerWidth, setInnerWidth] = useState(0);
35
+ const ref = useRef<HTMLDivElement>(null);
36
+ useEffect(() => {
37
+ const handleResize = () => {
38
+ setWindowWidth(window.innerWidth);
39
+ const container = document.querySelector(`.hds-container:has(#${id})`);
40
+ if (container !== null) {
41
+ setContainerWidth(container.getBoundingClientRect().width);
42
+ }
43
+ if (ref.current !== null) {
44
+ setInnerWidth(ref.current.getBoundingClientRect().width);
45
+ }
46
+ };
47
+
48
+ handleResize();
49
+ window.addEventListener("resize", handleResize);
50
+ return () => {
51
+ window.removeEventListener("resize", handleResize);
52
+ };
53
+ }, [id]);
54
+
55
+ return (
56
+ <div id={id} ref={ref}>
57
+ <p>Window width: {windowWidth}</p>
58
+ <p>Container width: {containerWidth}</p>
59
+ <p>Inner width: {innerWidth}</p>
60
+ </div>
61
+ );
62
+ }
@@ -0,0 +1,47 @@
1
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import type { HTMLAttributes, ReactNode } from "react";
4
+ import { forwardRef } from "react";
5
+
6
+ export interface ContainerProps extends HTMLAttributes<HTMLDivElement> {
7
+ variant?: "default" | "slim";
8
+ children: ReactNode;
9
+
10
+ /**
11
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
12
+ *
13
+ * @default false
14
+ */
15
+ asChild?: boolean;
16
+
17
+ /**
18
+ * Convienence prop to change the rendered element.
19
+ *
20
+ * Use {@link ContainerProps.asChild} if you need more control of the rendered element.
21
+ */
22
+ as?: "div" | "section" | "aside" | "main" | "article" | "header" | "footer";
23
+ }
24
+
25
+ /**
26
+ * Container is a layout component that is used to wrap content.
27
+ * It ensures a max-width and minimum spacing on the sides.
28
+ */
29
+ export const Container = forwardRef<HTMLDivElement, ContainerProps>(
30
+ ({ as: Tag = "div", asChild, className, children, variant, ...rest }, ref) => {
31
+ const Component = asChild ? Slot : Tag;
32
+ return (
33
+ <Component
34
+ {...rest}
35
+ className={clsx(
36
+ "hds-container",
37
+ { "hds-container--slim": variant === "slim" },
38
+ className as undefined,
39
+ )}
40
+ ref={ref}
41
+ >
42
+ {children}
43
+ </Component>
44
+ );
45
+ },
46
+ );
47
+ Container.displayName = "Container";
@@ -0,0 +1,163 @@
1
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { forwardRef } from "react";
4
+ import { getResponsiveProps, type ResponsiveProp } from "../responsive";
5
+ import { type SpacingSizes, type ResponsiveSpacingSizes, getSpacingVariable } from "../spacing";
6
+
7
+ export interface GridItemProps extends React.HTMLAttributes<HTMLDivElement> {
8
+ children: React.ReactNode;
9
+
10
+ /**
11
+ * Column span for the grid item
12
+ *
13
+ * `default` is `12`
14
+ */
15
+ span?: ResponsiveProp<1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12>;
16
+
17
+ /**
18
+ * Center the grid item horizontally
19
+ *
20
+ * Offsets the start position of the grid item relative to it's span so that it appears centered.
21
+ *
22
+ * assumes a span of 2, 4, 6, 8, or 10
23
+ *
24
+ * a span of `12` is 100% width and centering has no effect
25
+ *
26
+ * `default` is `false`
27
+ */
28
+ center?: ResponsiveProp<boolean>;
29
+
30
+ /**
31
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
32
+ */
33
+ asChild?: boolean;
34
+ }
35
+
36
+ /**
37
+ * 🚧 Grid.Item
38
+ *
39
+ * Use as the direct child of a `Grid` to override `span` and `center` for individual items.
40
+ */
41
+ export const GridItem = forwardRef<HTMLDivElement, GridItemProps>(
42
+ ({ children, asChild, className, span, center, style: _style, ...rest }, ref) => {
43
+ const Component = asChild ? Slot : "div";
44
+ const style: React.CSSProperties = {
45
+ ..._style,
46
+ ...getResponsiveProps("--hds-grid-item-span", span),
47
+ ...getResponsiveProps("--hds-grid-item-center", center, (value) => (value ? "1" : "0")),
48
+ };
49
+ return (
50
+ <Component
51
+ style={style}
52
+ className={clsx("hds-grid__item", className as undefined)}
53
+ ref={ref}
54
+ {...rest}
55
+ >
56
+ {children}
57
+ </Component>
58
+ );
59
+ },
60
+ );
61
+ GridItem.displayName = "Grid.Item";
62
+
63
+ export interface GridProps extends React.HTMLAttributes<HTMLDivElement> {
64
+ children: React.ReactNode;
65
+
66
+ /**
67
+ * Space between grid items. Both horizontal and vertical.
68
+ *
69
+ * Use the responsive shorthand `12-16` to jump a level at the `large` breakpoint.
70
+ *
71
+ * Or use the responsive object `{ initial: 40, large: 64 }` to set different values at different breakpoints.
72
+ *
73
+ * Use `gapX` and `gapY` to set different values for horizontal and vertical spacing.
74
+ */
75
+ gap?: ResponsiveProp<SpacingSizes> | ResponsiveSpacingSizes;
76
+
77
+ /**
78
+ * Space between grid items horizontally
79
+ */
80
+ gapX?: ResponsiveProp<SpacingSizes> | ResponsiveSpacingSizes;
81
+
82
+ /**
83
+ * Space between grid items vertically
84
+ */
85
+ gapY?: ResponsiveProp<SpacingSizes> | ResponsiveSpacingSizes;
86
+
87
+ /**
88
+ * Column span for the grid items
89
+ *
90
+ * `default` is `12`
91
+ */
92
+ span?: ResponsiveProp<1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12>;
93
+
94
+ /**
95
+ * Center grid items horizontally
96
+ *
97
+ * Offsets the start position of the grid items relative to their span so that it appears centered.
98
+ *
99
+ * assumes a span of 2, 4, 6, 8, or 10
100
+ *
101
+ * a span of `12` is 100% width and centering has no effect
102
+ *
103
+ * `default` is `false`
104
+ */
105
+ center?: ResponsiveProp<boolean>;
106
+
107
+ /**
108
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
109
+ *
110
+ * @default false
111
+ */
112
+ asChild?: boolean;
113
+ }
114
+
115
+ /**
116
+ * A simple opionated abstraction over CSS Grid.
117
+ *
118
+ * The grid is always a 12 column grid.
119
+ *
120
+ * @example
121
+ * ```tsx
122
+ * <Grid gap="12-16" span={{ small: 6 }}>
123
+ * <div>6/12</div>
124
+ * <div>6/12</div>
125
+ * <Grid.Item span={{ small: 12 }}>12/12</Grid.Item>
126
+ * <div>6/12</div>
127
+ * <div>6/12</div>
128
+ * </Grid>
129
+ * ```
130
+ */
131
+ export const Grid = forwardRef<HTMLDivElement, GridProps>(
132
+ (
133
+ { children, asChild, className, span, center, style: _style, gap, gapX, gapY, ...rest },
134
+ ref,
135
+ ) => {
136
+ const Component = asChild ? Slot : "div";
137
+ const style: React.CSSProperties = {
138
+ ..._style,
139
+ ...getResponsiveProps("--hds-grid-gap", gap, getSpacingVariable),
140
+ ...getResponsiveProps("--hds-grid-gap-x", gapX, getSpacingVariable),
141
+ ...getResponsiveProps("--hds-grid-gap-y", gapY, getSpacingVariable),
142
+ ...getResponsiveProps("--hds-grid-span", span),
143
+ ...getResponsiveProps("--hds-grid-center", center, (value) => (value ? "1" : "0")),
144
+ };
145
+ return (
146
+ <Component
147
+ style={style}
148
+ className={clsx("hds-grid", className as undefined)}
149
+ ref={ref}
150
+ {...rest}
151
+ >
152
+ {children}
153
+ </Component>
154
+ );
155
+ },
156
+ ) as GridType;
157
+ Grid.displayName = "Grid";
158
+
159
+ type GridType = ReturnType<typeof forwardRef<HTMLDivElement, GridProps>> & {
160
+ Item: typeof GridItem;
161
+ };
162
+
163
+ Grid.Item = GridItem;
@@ -0,0 +1,3 @@
1
+ export { Grid, GridItem } from "./grid";
2
+
3
+ export type * from "./grid";
@@ -0,0 +1,3 @@
1
+ export * from "./container/container";
2
+ export * from "./grid";
3
+ export * from "./stack";
@@ -0,0 +1,26 @@
1
+ type Breakpoints = "initial" | "small" | "medium" | "large" | "xlarge";
2
+
3
+ type ResponsiveValues<T> = {
4
+ [Breakpoint in Breakpoints]?: T;
5
+ };
6
+
7
+ export type ResponsiveProp<T> = T | ResponsiveValues<T>;
8
+
9
+ export function getResponsiveProps<T>(
10
+ variable: `--hds-${string}`,
11
+ inputValues?: ResponsiveProp<T>,
12
+ valueTransformer: (value: T) => string = (value) => String(value),
13
+ ) {
14
+ if (!inputValues) return {};
15
+
16
+ if (typeof inputValues !== "object") {
17
+ return { [`${variable}-initial`]: valueTransformer(inputValues) };
18
+ }
19
+
20
+ const result: Record<string, string> = {};
21
+ for (const [key, value] of Object.entries(inputValues as ResponsiveValues<T>)) {
22
+ result[`${variable}-${key}`] = valueTransformer(value);
23
+ }
24
+
25
+ return result;
26
+ }
@@ -0,0 +1,37 @@
1
+ // TODO: Get from tokens package
2
+ // For now it's fine, since it's still in this monorepo
3
+ const spacingSizes = {
4
+ "4": "4",
5
+ "8": "8",
6
+ "12": "12",
7
+ "16": "16",
8
+ "20": "20",
9
+ "24": "24",
10
+ "32": "32",
11
+ "40": "40",
12
+ "48": "48",
13
+ "64": "64",
14
+ "80": "80",
15
+ "120": "120",
16
+ } as const;
17
+ export type SpacingSizes = keyof typeof spacingSizes;
18
+
19
+ const responsiveSpacingSizes = {
20
+ "4-8": "4-8",
21
+ "8-12": "8-12",
22
+ "12-16": "12-16",
23
+ "16-20": "16-20",
24
+ "20-24": "20-24",
25
+ "24-32": "24-32",
26
+ "32-40": "32-40",
27
+ "40-48": "40-48",
28
+ "48-64": "48-64",
29
+ "64-80": "64-80",
30
+ "80-120": "80-120",
31
+ "120-160": "120-160",
32
+ } as const;
33
+ export type ResponsiveSpacingSizes = keyof typeof responsiveSpacingSizes;
34
+
35
+ export function getSpacingVariable(size: SpacingSizes | ResponsiveSpacingSizes) {
36
+ return `var(--hds-spacing-${size})`;
37
+ }
@@ -0,0 +1,2 @@
1
+ export { Stack, HStack, VStack } from "./stack";
2
+ export type * from "./stack";
@@ -0,0 +1,128 @@
1
+ import * as React from "react";
2
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
3
+ import { forwardRef } from "react";
4
+ import { Slot } from "@radix-ui/react-slot";
5
+ import { getSpacingVariable, type ResponsiveSpacingSizes, type SpacingSizes } from "../spacing";
6
+ import { getResponsiveProps, type ResponsiveProp } from "../responsive";
7
+
8
+ type CSSPropertiesWithVar = React.CSSProperties & {
9
+ "--hds-stack-gap"?: string;
10
+ "--hds-stack-direction"?: string;
11
+ "--hds-stack-wrap"?: string;
12
+ "--hds-stack-align"?: string;
13
+ "--hds-stack-justify"?: string;
14
+ };
15
+
16
+ export interface StackProps extends React.HTMLAttributes<HTMLDivElement> {
17
+ children: React.ReactNode;
18
+
19
+ /**
20
+ * Space between items. Both horizontal and vertical.
21
+ *
22
+ * Use the responsive shorthand `12-16` to jump a level at the `large` breakpoint.
23
+ *
24
+ * Or use the responsive object `{ initial: 40, large: 64 }` to set different values at different breakpoints.
25
+ *
26
+ * Use `gapX` and `gapY` to set different values for horizontal and vertical spacing.
27
+ */
28
+ gap?: ResponsiveProp<SpacingSizes> | ResponsiveSpacingSizes;
29
+
30
+ /**
31
+ * Space between items horizontally
32
+ */
33
+ gapX?: ResponsiveProp<SpacingSizes> | ResponsiveSpacingSizes;
34
+
35
+ /**
36
+ * Space between items vertically
37
+ */
38
+ gapY?: ResponsiveProp<SpacingSizes> | ResponsiveSpacingSizes;
39
+
40
+ direction?: ResponsiveProp<React.CSSProperties["flexDirection"]>;
41
+ wrap?: ResponsiveProp<boolean>;
42
+ align?: ResponsiveProp<React.CSSProperties["alignItems"]>;
43
+ justify?: ResponsiveProp<React.CSSProperties["justifyContent"]>;
44
+
45
+ /**
46
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
47
+ *
48
+ * @default false
49
+ */
50
+ asChild?: boolean;
51
+ }
52
+
53
+ /**
54
+ * 🚨 WORK IN PROGRESS 🚨
55
+ *
56
+ * TODO
57
+ * - [ ] Add more examples
58
+ * - [ ] Document usage
59
+ * - [ ] Document props
60
+ */
61
+ export const Stack = forwardRef<HTMLDivElement, StackProps>(
62
+ (
63
+ {
64
+ children,
65
+ asChild,
66
+ className,
67
+ style: _style,
68
+ gap,
69
+ gapX,
70
+ gapY,
71
+ direction,
72
+ wrap,
73
+ align,
74
+ justify,
75
+ ...rest
76
+ },
77
+ ref,
78
+ ) => {
79
+ const Component = asChild ? Slot : "div";
80
+ const style: CSSPropertiesWithVar = {
81
+ ..._style,
82
+ ...getResponsiveProps("--hds-stack-gap", gap, getSpacingVariable),
83
+ ...getResponsiveProps("--hds-stack-gap-x", gapX, getSpacingVariable),
84
+ ...getResponsiveProps("--hds-stack-gap-y", gapY, getSpacingVariable),
85
+ ...getResponsiveProps("--hds-stack-direction", direction),
86
+ ...getResponsiveProps("--hds-stack-wrap", wrap, (value) => (value ? "wrap" : "nowrap")),
87
+ ...getResponsiveProps("--hds-stack-align", align),
88
+ ...getResponsiveProps("--hds-stack-justify", justify),
89
+ };
90
+ return (
91
+ <Component
92
+ style={style}
93
+ className={clsx("hds-stack", className as undefined)}
94
+ ref={ref}
95
+ {...rest}
96
+ >
97
+ {children}
98
+ </Component>
99
+ );
100
+ },
101
+ );
102
+ Stack.displayName = "Stack";
103
+
104
+ /**
105
+ * 🚨 WORK IN PROGRESS 🚨
106
+ *
107
+ * TODO
108
+ * - [ ] Add more examples
109
+ * - [ ] Document usage
110
+ * - [ ] Document props
111
+ */
112
+ export const HStack = forwardRef<HTMLDivElement, Omit<StackProps, "direction">>((props, ref) => {
113
+ return <Stack ref={ref} {...props} direction="row" />;
114
+ });
115
+ HStack.displayName = "HStack";
116
+
117
+ /**
118
+ * 🚨 WORK IN PROGRESS 🚨
119
+ *
120
+ * TODO
121
+ * - [ ] Add more examples
122
+ * - [ ] Document usage
123
+ * - [ ] Document props
124
+ */
125
+ export const VStack = forwardRef<HTMLDivElement, Omit<StackProps, "direction">>((props, ref) => {
126
+ return <Stack ref={ref} {...props} direction="column" />;
127
+ });
128
+ VStack.displayName = "VStack";
@@ -0,0 +1,3 @@
1
+ export { Link } from "./link";
2
+
3
+ export type * from "./link";
@@ -0,0 +1,64 @@
1
+ /* eslint-disable import/no-extraneous-dependencies -- storybook story */
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Link } from ".";
4
+
5
+ const meta: Meta<typeof Link> = {
6
+ title: "Link",
7
+ component: Link,
8
+
9
+ args: {
10
+ children: "Link",
11
+ href: "https://www.posten.no/",
12
+ onClick: (e) => {
13
+ e.preventDefault();
14
+ // eslint-disable-next-line no-alert -- Storybook Demo
15
+ alert("Hello");
16
+ },
17
+ },
18
+
19
+ // Hide onClick from the auto generated table
20
+ argTypes: {
21
+ onClick: {
22
+ table: {
23
+ disable: true,
24
+ },
25
+ },
26
+ },
27
+ };
28
+
29
+ export default meta;
30
+
31
+ type Story = StoryObj<typeof Link>;
32
+
33
+ export const Underline: Story = {};
34
+ export const Solid: Story = {
35
+ args: {
36
+ variant: "solid",
37
+ },
38
+ };
39
+ export const Inverted: Story = {
40
+ args: {
41
+ variant: "inverted",
42
+ },
43
+ parameters: {
44
+ backgrounds: { default: "dark" },
45
+ },
46
+ };
47
+ export const NoUnderline: Story = {
48
+ args: {
49
+ variant: "no-underline",
50
+ },
51
+ };
52
+
53
+ export const ButtonAsLink: Story = {
54
+ name: "Button as a link",
55
+ args: {
56
+ asChild: true,
57
+ children: <button type="button">Les mer</button>,
58
+ href: undefined,
59
+ onClick: () => {
60
+ // eslint-disable-next-line no-alert -- Story
61
+ alert(`Hello world`);
62
+ },
63
+ },
64
+ };