@postenbring/hedwig-react 0.0.81 → 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.
- package/dist/accordion/accordion-content.d.ts +6 -2
- package/dist/accordion/accordion-content.d.ts.map +1 -0
- package/dist/accordion/accordion-header.d.ts +6 -2
- package/dist/accordion/accordion-header.d.ts.map +1 -0
- package/dist/accordion/accordion-item.d.ts +24 -3
- package/dist/accordion/accordion-item.d.ts.map +1 -0
- package/dist/accordion/accordion.d.ts +44 -2
- package/dist/accordion/accordion.d.ts.map +1 -0
- package/dist/accordion/accordion.js +102 -4
- package/dist/accordion/accordion.js.map +1 -1
- package/dist/accordion/accordion.mjs +5 -1
- package/dist/accordion/context.d.ts +7 -2
- package/dist/accordion/context.d.ts.map +1 -0
- package/dist/accordion/index.d.ts +9 -9
- package/dist/accordion/index.d.ts.map +1 -0
- package/dist/accordion/index.js +52 -53
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +7 -7
- package/dist/badge/badge.d.ts +21 -5
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/index.d.ts +3 -6
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/box/box.d.ts +50 -4
- package/dist/box/box.d.ts.map +1 -0
- package/dist/box/box.js +15 -14
- package/dist/box/box.js.map +1 -1
- package/dist/box/box.mjs +1 -1
- package/dist/box/index.d.ts +3 -4
- package/dist/box/index.d.ts.map +1 -0
- package/dist/box/index.js +16 -19
- package/dist/box/index.js.map +1 -1
- package/dist/box/index.mjs +4 -5
- package/dist/breadcrumbs/breadcrumbs.d.ts +33 -2
- package/dist/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/breadcrumbs/index.d.ts +3 -2
- package/dist/breadcrumbs/index.d.ts.map +1 -0
- package/dist/button/button.d.ts +33 -3
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/index.d.ts +3 -3
- package/dist/button/index.d.ts.map +1 -0
- package/dist/card/card.d.ts +69 -12
- package/dist/card/card.d.ts.map +1 -0
- package/dist/card/card.js +17 -6
- package/dist/card/card.js.map +1 -1
- package/dist/card/card.mjs +1 -1
- package/dist/card/index.d.ts +3 -12
- package/dist/card/index.d.ts.map +1 -0
- package/dist/card/index.js +18 -19
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs +4 -5
- package/dist/{chunk-XC3UHH2U.mjs → chunk-3WVRY6CC.mjs} +4 -4
- package/dist/{chunk-XC3UHH2U.mjs.map → chunk-3WVRY6CC.mjs.map} +1 -1
- package/dist/{chunk-GSJPTZT3.mjs → chunk-6AGDK5V3.mjs} +34 -19
- package/dist/chunk-6AGDK5V3.mjs.map +1 -0
- package/dist/{chunk-3MQKXNZ6.mjs → chunk-7UD72WOC.mjs} +13 -1
- package/dist/chunk-7UD72WOC.mjs.map +1 -0
- package/dist/chunk-7YWW46R3.mjs +1 -0
- package/dist/chunk-7YWW46R3.mjs.map +1 -0
- package/dist/{chunk-ENKVTAJB.mjs → chunk-AJWSQEDP.mjs} +18 -17
- package/dist/chunk-AJWSQEDP.mjs.map +1 -0
- package/dist/chunk-ARHJZUZG.mjs +1 -0
- package/dist/chunk-ARHJZUZG.mjs.map +1 -0
- package/dist/chunk-BCFV6VOE.mjs +1 -0
- package/dist/chunk-BCFV6VOE.mjs.map +1 -0
- package/dist/{chunk-7JRS4WEB.mjs → chunk-C34HEQXO.mjs} +33 -29
- package/dist/chunk-C34HEQXO.mjs.map +1 -0
- package/dist/{chunk-PLXB3TNA.mjs → chunk-D7QPJIUZ.mjs} +5 -5
- package/dist/{chunk-PLXB3TNA.mjs.map → chunk-D7QPJIUZ.mjs.map} +1 -1
- package/dist/chunk-FYFJ75NX.mjs +1 -0
- package/dist/chunk-FYFJ75NX.mjs.map +1 -0
- package/dist/chunk-G65EYZFQ.mjs +1 -0
- package/dist/chunk-G65EYZFQ.mjs.map +1 -0
- package/dist/chunk-H3E546OT.mjs +1 -0
- package/dist/chunk-H3E546OT.mjs.map +1 -0
- package/dist/chunk-HQVL3ZJ2.mjs +1 -0
- package/dist/chunk-HQVL3ZJ2.mjs.map +1 -0
- package/dist/{chunk-XUWZ4HGD.mjs → chunk-LCJSUBCZ.mjs} +48 -45
- package/dist/chunk-LCJSUBCZ.mjs.map +1 -0
- package/dist/{chunk-KPGSRU4I.mjs → chunk-M3Y3XOGC.mjs} +13 -1
- package/dist/chunk-M3Y3XOGC.mjs.map +1 -0
- package/dist/{chunk-CIHZDFSQ.mjs → chunk-NU6OSFAU.mjs} +20 -9
- package/dist/chunk-NU6OSFAU.mjs.map +1 -0
- package/dist/chunk-RC76SXBP.mjs +1 -0
- package/dist/chunk-RC76SXBP.mjs.map +1 -0
- package/dist/{chunk-TQDUBRCZ.mjs → chunk-SQ63E7KM.mjs} +24 -22
- package/dist/chunk-SQ63E7KM.mjs.map +1 -0
- package/dist/{chunk-ES6ISHOV.mjs → chunk-UP3M3NEZ.mjs} +14 -13
- package/dist/{chunk-ES6ISHOV.mjs.map → chunk-UP3M3NEZ.mjs.map} +1 -1
- package/dist/chunk-ZKMFJZSH.mjs +1 -0
- package/dist/chunk-ZKMFJZSH.mjs.map +1 -0
- package/dist/description-list/description-list.d.ts +42 -2
- package/dist/description-list/description-list.d.ts.map +1 -0
- package/dist/description-list/index.d.ts +3 -2
- package/dist/description-list/index.d.ts.map +1 -0
- package/dist/footer/footer.d.ts +67 -7
- package/dist/footer/footer.d.ts.map +1 -0
- package/dist/footer/footer.js +79 -76
- package/dist/footer/footer.js.map +1 -1
- package/dist/footer/footer.mjs +4 -4
- package/dist/footer/index.d.ts +3 -7
- package/dist/footer/index.d.ts.map +1 -0
- package/dist/footer/index.js +80 -84
- package/dist/footer/index.js.map +1 -1
- package/dist/footer/index.mjs +7 -8
- package/dist/form/checkbox/checkbox.d.ts +28 -2
- package/dist/form/checkbox/checkbox.d.ts.map +1 -0
- package/dist/form/checkbox/index.d.ts +3 -2
- package/dist/form/checkbox/index.d.ts.map +1 -0
- package/dist/form/date-picker/date-picker.d.ts +33 -2
- package/dist/form/date-picker/date-picker.d.ts.map +1 -0
- package/dist/form/date-picker/index.d.ts +3 -2
- package/dist/form/date-picker/index.d.ts.map +1 -0
- package/dist/form/error-message/error-message.d.ts +8 -2
- package/dist/form/error-message/error-message.d.ts.map +1 -0
- package/dist/form/error-message/index.d.ts +3 -2
- package/dist/form/error-message/index.d.ts.map +1 -0
- package/dist/form/fieldset/fieldset.d.ts +22 -3
- package/dist/form/fieldset/fieldset.d.ts.map +1 -0
- package/dist/form/fieldset/index.d.ts +3 -3
- package/dist/form/fieldset/index.d.ts.map +1 -0
- package/dist/form/index.d.ts +9 -20
- package/dist/form/index.d.ts.map +1 -0
- package/dist/form/input/index.d.ts +3 -2
- package/dist/form/input/index.d.ts.map +1 -0
- package/dist/form/input/input.d.ts +5 -2
- package/dist/form/input/input.d.ts.map +1 -0
- package/dist/form/input-group/index.d.ts +3 -2
- package/dist/form/input-group/index.d.ts.map +1 -0
- package/dist/form/input-group/input-group.d.ts +27 -2
- package/dist/form/input-group/input-group.d.ts.map +1 -0
- package/dist/form/radiobutton/index.d.ts +5 -5
- package/dist/form/radiobutton/index.d.ts.map +1 -0
- package/dist/form/radiobutton/radiobutton.d.ts +17 -2
- package/dist/form/radiobutton/radiobutton.d.ts.map +1 -0
- package/dist/form/radiobutton/radiogroup.d.ts +24 -3
- package/dist/form/radiobutton/radiogroup.d.ts.map +1 -0
- package/dist/form/select/index.d.ts +3 -2
- package/dist/form/select/index.d.ts.map +1 -0
- package/dist/form/select/select.d.ts +9 -2
- package/dist/form/select/select.d.ts.map +1 -0
- package/dist/form/textarea/index.d.ts +3 -2
- package/dist/form/textarea/index.d.ts.map +1 -0
- package/dist/form/textarea/textarea.d.ts +5 -2
- package/dist/form/textarea/textarea.d.ts.map +1 -0
- package/dist/help-text/help-text.d.ts +51 -1
- package/dist/help-text/help-text.d.ts.map +1 -0
- package/dist/help-text/help-text.js +17 -20
- package/dist/help-text/help-text.js.map +1 -1
- package/dist/help-text/help-text.mjs +3 -3
- package/dist/help-text/index.d.ts +3 -1
- package/dist/help-text/index.d.ts.map +1 -0
- package/dist/help-text/index.js +17 -20
- package/dist/help-text/index.js.map +1 -1
- package/dist/help-text/index.mjs +3 -3
- package/dist/index-no-css.d.ts +26 -128
- package/dist/index-no-css.d.ts.map +1 -0
- package/dist/index-no-css.js +372 -393
- package/dist/index-no-css.js.map +1 -1
- package/dist/index-no-css.mjs +50 -57
- package/dist/index.d.ts +11 -128
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +372 -393
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -57
- package/dist/index.mjs.map +1 -1
- package/dist/layout/container/container.d.ts +23 -2
- package/dist/layout/container/container.d.ts.map +1 -0
- package/dist/layout/grid/grid.d.ts +101 -4
- package/dist/layout/grid/grid.d.ts.map +1 -0
- package/dist/layout/grid/grid.js +11 -10
- package/dist/layout/grid/grid.js.map +1 -1
- package/dist/layout/grid/grid.mjs +1 -1
- package/dist/layout/grid/index.d.ts +3 -4
- package/dist/layout/grid/index.d.ts.map +1 -0
- package/dist/layout/grid/index.js +12 -15
- package/dist/layout/grid/index.js.map +1 -1
- package/dist/layout/grid/index.mjs +4 -5
- package/dist/layout/index.d.ts +4 -10
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +12 -15
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/index.mjs +4 -5
- package/dist/layout/responsive.d.ts +10 -2
- package/dist/layout/responsive.d.ts.map +1 -0
- package/dist/layout/spacing.d.ts +33 -3
- package/dist/layout/spacing.d.ts.map +1 -0
- package/dist/layout/stack/index.d.ts +3 -4
- package/dist/layout/stack/index.d.ts.map +1 -0
- package/dist/layout/stack/stack.d.ts +62 -4
- package/dist/layout/stack/stack.d.ts.map +1 -0
- package/dist/link/index.d.ts +3 -2
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/link.d.ts +20 -2
- package/dist/link/link.d.ts.map +1 -0
- package/dist/list/index.d.ts +5 -5
- package/dist/list/index.d.ts.map +1 -0
- package/dist/list/link-list.d.ts +12 -2
- package/dist/list/link-list.d.ts.map +1 -0
- package/dist/list/list.d.ts +40 -3
- package/dist/list/list.d.ts.map +1 -0
- package/dist/message/index.d.ts +3 -3
- package/dist/message/index.d.ts.map +1 -0
- package/dist/message/index.js +36 -38
- package/dist/message/index.js.map +1 -1
- package/dist/message/index.mjs +5 -6
- package/dist/message/message.d.ts +36 -4
- package/dist/message/message.d.ts.map +1 -0
- package/dist/message/message.js +35 -32
- package/dist/message/message.js.map +1 -1
- package/dist/message/message.mjs +2 -2
- package/dist/modal/index.d.ts +3 -5
- package/dist/modal/index.d.ts.map +1 -0
- package/dist/modal/index.js +60 -62
- package/dist/modal/index.js.map +1 -1
- package/dist/modal/index.mjs +5 -6
- package/dist/modal/modal.d.ts +81 -5
- package/dist/modal/modal.d.ts.map +1 -0
- package/dist/modal/modal.js +59 -55
- package/dist/modal/modal.js.map +1 -1
- package/dist/modal/modal.mjs +2 -2
- package/dist/navbar/icons.d.ts +3 -2
- package/dist/navbar/icons.d.ts.map +1 -0
- package/dist/navbar/index.d.ts +4 -13
- package/dist/navbar/index.d.ts.map +1 -0
- package/dist/navbar/index.js +144 -145
- package/dist/navbar/index.js.map +1 -1
- package/dist/navbar/index.mjs +4 -5
- package/dist/navbar/navbar-expandable-menu.d.ts +35 -7
- package/dist/navbar/navbar-expandable-menu.d.ts.map +1 -0
- package/dist/navbar/navbar.d.ts +130 -9
- package/dist/navbar/navbar.d.ts.map +1 -0
- package/dist/navbar/navbar.js +237 -28
- package/dist/navbar/navbar.js.map +1 -1
- package/dist/navbar/navbar.mjs +4 -1
- package/dist/show-more/index.d.ts +5 -4
- package/dist/show-more/index.d.ts.map +1 -0
- package/dist/show-more/show-more.d.ts +42 -2
- package/dist/show-more/show-more.d.ts.map +1 -0
- package/dist/skeleton/index.d.ts +3 -2
- package/dist/skeleton/index.d.ts.map +1 -0
- package/dist/skeleton/skeleton.d.ts +67 -2
- package/dist/skeleton/skeleton.d.ts.map +1 -0
- package/dist/step-indicator/index.d.ts +3 -1
- package/dist/step-indicator/index.d.ts.map +1 -0
- package/dist/step-indicator/step-indicator.d.ts +36 -1
- package/dist/step-indicator/step-indicator.d.ts.map +1 -0
- package/dist/styled-html/index.d.ts +3 -2
- package/dist/styled-html/index.d.ts.map +1 -0
- package/dist/styled-html/styled-html.d.ts +36 -2
- package/dist/styled-html/styled-html.d.ts.map +1 -0
- package/dist/table/index.d.ts +3 -1
- package/dist/table/index.d.ts.map +1 -0
- package/dist/table/table.d.ts +25 -1
- package/dist/table/table.d.ts.map +1 -0
- package/dist/tabs/context.d.ts +8 -3
- package/dist/tabs/context.d.ts.map +1 -0
- package/dist/tabs/index.d.ts +7 -10
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/tabs/index.js +34 -37
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +4 -4
- package/dist/tabs/tabs-content.d.ts +26 -4
- package/dist/tabs/tabs-content.d.ts.map +1 -0
- package/dist/tabs/tabs-list.d.ts +21 -4
- package/dist/tabs/tabs-list.d.ts.map +1 -0
- package/dist/tabs/tabs.d.ts +26 -2
- package/dist/tabs/tabs.d.ts.map +1 -0
- package/dist/tabs/tabs.js +205 -8
- package/dist/tabs/tabs.js.map +1 -1
- package/dist/tabs/tabs.mjs +4 -1
- package/dist/text/index.d.ts +4 -2
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/text.d.ts +58 -2
- package/dist/text/text.d.ts.map +1 -0
- package/dist/utilities/auto-animate-height.d.ts +33 -2
- package/dist/utilities/auto-animate-height.d.ts.map +1 -0
- package/dist/utilities/index.d.ts +3 -2
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utils.d.ts +28 -5
- package/dist/utils.d.ts.map +1 -0
- package/dist/warning-banner/index.d.ts +3 -2
- package/dist/warning-banner/index.d.ts.map +1 -0
- package/dist/warning-banner/index.js +16 -19
- package/dist/warning-banner/index.js.map +1 -1
- package/dist/warning-banner/index.mjs +3 -3
- package/dist/warning-banner/warning-banner.d.ts +8 -2
- package/dist/warning-banner/warning-banner.d.ts.map +1 -0
- package/dist/warning-banner/warning-banner.js +16 -19
- package/dist/warning-banner/warning-banner.js.map +1 -1
- package/dist/warning-banner/warning-banner.mjs +3 -3
- package/package.json +9 -5
- package/src/accordion/accordion-content.tsx +31 -0
- package/src/accordion/accordion-header.tsx +36 -0
- package/src/accordion/accordion-item.tsx +62 -0
- package/src/accordion/accordion.stories.tsx +154 -0
- package/src/accordion/accordion.tsx +68 -0
- package/src/accordion/context.ts +8 -0
- package/src/accordion/index.tsx +9 -0
- package/src/badge/badge.stories.tsx +44 -0
- package/src/badge/badge.tsx +63 -0
- package/src/badge/index.tsx +3 -0
- package/src/box/box.stories.tsx +112 -0
- package/src/box/box.tsx +122 -0
- package/src/box/index.tsx +3 -0
- package/src/breadcrumbs/breadcrumbs.stories.tsx +50 -0
- package/src/breadcrumbs/breadcrumbs.tsx +47 -0
- package/src/breadcrumbs/index.tsx +3 -0
- package/src/button/button.stories.tsx +104 -0
- package/src/button/button.tsx +87 -0
- package/src/button/index.tsx +3 -0
- package/src/card/card.stories.tsx +82 -0
- package/src/card/card.tsx +222 -0
- package/src/card/index.tsx +14 -0
- package/src/description-list/description-list.stories.tsx +95 -0
- package/src/description-list/description-list.tsx +61 -0
- package/src/description-list/index.tsx +2 -0
- package/src/footer/footer.tsx +169 -0
- package/src/footer/index.tsx +9 -0
- package/src/form/checkbox/checkbox.stories.tsx +104 -0
- package/src/form/checkbox/checkbox.tsx +82 -0
- package/src/form/checkbox/index.tsx +2 -0
- package/src/form/date-picker/date-picker.stories.tsx +27 -0
- package/src/form/date-picker/date-picker.tsx +85 -0
- package/src/form/date-picker/index.tsx +2 -0
- package/src/form/error-message/error-message.stories.tsx +19 -0
- package/src/form/error-message/error-message.tsx +25 -0
- package/src/form/error-message/index.tsx +2 -0
- package/src/form/fieldset/fieldset.stories.tsx +86 -0
- package/src/form/fieldset/fieldset.tsx +64 -0
- package/src/form/fieldset/index.tsx +2 -0
- package/src/form/index.tsx +8 -0
- package/src/form/input/index.tsx +2 -0
- package/src/form/input/input.stories.tsx +166 -0
- package/src/form/input/input.tsx +30 -0
- package/src/form/input-group/index.tsx +2 -0
- package/src/form/input-group/input-group.tsx +106 -0
- package/src/form/radiobutton/index.tsx +4 -0
- package/src/form/radiobutton/radiobutton.stories.tsx +93 -0
- package/src/form/radiobutton/radiobutton.tsx +85 -0
- package/src/form/radiobutton/radiogroup.stories.tsx +39 -0
- package/src/form/radiobutton/radiogroup.tsx +52 -0
- package/src/form/select/index.tsx +2 -0
- package/src/form/select/select.stories.tsx +93 -0
- package/src/form/select/select.tsx +33 -0
- package/src/form/textarea/index.tsx +2 -0
- package/src/form/textarea/textarea.stories.tsx +106 -0
- package/src/form/textarea/textarea.tsx +33 -0
- package/src/help-text/help-text.tsx +98 -0
- package/src/help-text/index.ts +2 -0
- package/src/index-no-css.tsx +25 -0
- package/src/index.tsx +11 -0
- package/src/layout/container/container.stories.tsx +62 -0
- package/src/layout/container/container.tsx +47 -0
- package/src/layout/grid/grid.tsx +163 -0
- package/src/layout/grid/index.tsx +3 -0
- package/src/layout/index.tsx +3 -0
- package/src/layout/responsive.ts +26 -0
- package/src/layout/spacing.ts +37 -0
- package/src/layout/stack/index.tsx +2 -0
- package/src/layout/stack/stack.tsx +128 -0
- package/src/link/index.tsx +3 -0
- package/src/link/link.stories.tsx +64 -0
- package/src/link/link.tsx +46 -0
- package/src/list/index.tsx +5 -0
- package/src/list/link-list.stories.tsx +38 -0
- package/src/list/link-list.tsx +26 -0
- package/src/list/list.stories.tsx +71 -0
- package/src/list/list.tsx +65 -0
- package/src/message/index.tsx +2 -0
- package/src/message/message.stories.tsx +93 -0
- package/src/message/message.tsx +89 -0
- package/src/modal/index.tsx +3 -0
- package/src/modal/modal.stories.tsx +147 -0
- package/src/modal/modal.tsx +199 -0
- package/src/navbar/icons.tsx +21 -0
- package/src/navbar/index.tsx +18 -0
- package/src/navbar/navbar-expandable-menu.tsx +176 -0
- package/src/navbar/navbar.stories.tsx +99 -0
- package/src/navbar/navbar.tsx +264 -0
- package/src/show-more/index.ts +5 -0
- package/src/show-more/show-more.stories.tsx +119 -0
- package/src/show-more/show-more.tsx +66 -0
- package/src/skeleton/index.ts +2 -0
- package/src/skeleton/skeleton.stories.tsx +152 -0
- package/src/skeleton/skeleton.tsx +114 -0
- package/src/step-indicator/index.ts +2 -0
- package/src/step-indicator/step-indicator.stories.tsx +50 -0
- package/src/step-indicator/step-indicator.tsx +116 -0
- package/src/styled-html/index.ts +2 -0
- package/src/styled-html/styled-html.stories.tsx +189 -0
- package/src/styled-html/styled-html.tsx +59 -0
- package/src/table/index.ts +2 -0
- package/src/table/table.tsx +59 -0
- package/src/tabs/context.ts +18 -0
- package/src/tabs/index.tsx +7 -0
- package/src/tabs/tabs-content.tsx +62 -0
- package/src/tabs/tabs-list.tsx +129 -0
- package/src/tabs/tabs.stories.tsx +138 -0
- package/src/tabs/tabs.tsx +50 -0
- package/src/text/index.tsx +4 -0
- package/src/text/text.stories.tsx +112 -0
- package/src/text/text.tsx +129 -0
- package/src/utilities/auto-animate-height.tsx +139 -0
- package/src/utilities/index.ts +2 -0
- package/src/utils.ts +110 -0
- package/src/warning-banner/index.tsx +2 -0
- package/src/warning-banner/warning-banner.stories.tsx +43 -0
- package/src/warning-banner/warning-banner.tsx +79 -0
- package/dist/_tsup-dts-rollup.d.mts +0 -2600
- package/dist/_tsup-dts-rollup.d.ts +0 -2600
- package/dist/accordion/accordion-content.d.mts +0 -2
- package/dist/accordion/accordion-header.d.mts +0 -2
- package/dist/accordion/accordion-item.d.mts +0 -3
- package/dist/accordion/accordion.d.mts +0 -2
- package/dist/accordion/context.d.mts +0 -2
- package/dist/accordion/index.d.mts +0 -9
- package/dist/badge/badge.d.mts +0 -5
- package/dist/badge/index.d.mts +0 -6
- package/dist/box/box.d.mts +0 -4
- package/dist/box/index.d.mts +0 -4
- package/dist/breadcrumbs/breadcrumbs.d.mts +0 -2
- package/dist/breadcrumbs/index.d.mts +0 -2
- package/dist/button/button.d.mts +0 -3
- package/dist/button/index.d.mts +0 -3
- package/dist/card/card.d.mts +0 -12
- package/dist/card/index.d.mts +0 -12
- package/dist/chunk-3MQKXNZ6.mjs.map +0 -1
- package/dist/chunk-3NDUE23B.mjs +0 -19
- package/dist/chunk-3NDUE23B.mjs.map +0 -1
- package/dist/chunk-3NL3TOZF.mjs +0 -13
- package/dist/chunk-3NL3TOZF.mjs.map +0 -1
- package/dist/chunk-3ZFEUABU.mjs +0 -23
- package/dist/chunk-3ZFEUABU.mjs.map +0 -1
- package/dist/chunk-722MZPXO.mjs +0 -13
- package/dist/chunk-722MZPXO.mjs.map +0 -1
- package/dist/chunk-7JRS4WEB.mjs.map +0 -1
- package/dist/chunk-CIHZDFSQ.mjs.map +0 -1
- package/dist/chunk-CYEYGPRH.mjs +0 -17
- package/dist/chunk-CYEYGPRH.mjs.map +0 -1
- package/dist/chunk-ENKVTAJB.mjs.map +0 -1
- package/dist/chunk-GSJPTZT3.mjs.map +0 -1
- package/dist/chunk-IJAX6APL.mjs +0 -23
- package/dist/chunk-IJAX6APL.mjs.map +0 -1
- package/dist/chunk-IKJJWKXM.mjs +0 -15
- package/dist/chunk-IKJJWKXM.mjs.map +0 -1
- package/dist/chunk-KPGSRU4I.mjs.map +0 -1
- package/dist/chunk-PT5H3QV6.mjs +0 -29
- package/dist/chunk-PT5H3QV6.mjs.map +0 -1
- package/dist/chunk-TQDUBRCZ.mjs.map +0 -1
- package/dist/chunk-V6UKKHKD.mjs +0 -33
- package/dist/chunk-V6UKKHKD.mjs.map +0 -1
- package/dist/chunk-XUWZ4HGD.mjs.map +0 -1
- package/dist/description-list/description-list.d.mts +0 -2
- package/dist/description-list/index.d.mts +0 -2
- package/dist/footer/footer.d.mts +0 -7
- package/dist/footer/index.d.mts +0 -7
- package/dist/form/checkbox/checkbox.d.mts +0 -2
- package/dist/form/checkbox/index.d.mts +0 -2
- package/dist/form/date-picker/date-picker.d.mts +0 -2
- package/dist/form/date-picker/index.d.mts +0 -2
- package/dist/form/error-message/error-message.d.mts +0 -2
- package/dist/form/error-message/index.d.mts +0 -2
- package/dist/form/fieldset/fieldset.d.mts +0 -3
- package/dist/form/fieldset/index.d.mts +0 -3
- package/dist/form/index.d.mts +0 -20
- package/dist/form/input/index.d.mts +0 -2
- package/dist/form/input/input.d.mts +0 -2
- package/dist/form/input-group/index.d.mts +0 -2
- package/dist/form/input-group/input-group.d.mts +0 -2
- package/dist/form/radiobutton/index.d.mts +0 -5
- package/dist/form/radiobutton/radiobutton.d.mts +0 -2
- package/dist/form/radiobutton/radiogroup.d.mts +0 -3
- package/dist/form/select/index.d.mts +0 -2
- package/dist/form/select/select.d.mts +0 -2
- package/dist/form/textarea/index.d.mts +0 -2
- package/dist/form/textarea/textarea.d.mts +0 -2
- package/dist/help-text/help-text.d.mts +0 -1
- package/dist/help-text/index.d.mts +0 -1
- package/dist/index-no-css.d.mts +0 -128
- package/dist/index.d.mts +0 -128
- package/dist/layout/container/container.d.mts +0 -2
- package/dist/layout/grid/grid.d.mts +0 -4
- package/dist/layout/grid/index.d.mts +0 -4
- package/dist/layout/index.d.mts +0 -10
- package/dist/layout/responsive.d.mts +0 -2
- package/dist/layout/spacing.d.mts +0 -3
- package/dist/layout/stack/index.d.mts +0 -4
- package/dist/layout/stack/stack.d.mts +0 -4
- package/dist/link/index.d.mts +0 -2
- package/dist/link/link.d.mts +0 -2
- package/dist/list/index.d.mts +0 -5
- package/dist/list/link-list.d.mts +0 -2
- package/dist/list/list.d.mts +0 -3
- package/dist/message/index.d.mts +0 -3
- package/dist/message/message.d.mts +0 -4
- package/dist/modal/index.d.mts +0 -5
- package/dist/modal/modal.d.mts +0 -5
- package/dist/navbar/icons.d.mts +0 -2
- package/dist/navbar/index.d.mts +0 -13
- package/dist/navbar/navbar-expandable-menu.d.mts +0 -7
- package/dist/navbar/navbar.d.mts +0 -9
- package/dist/show-more/index.d.mts +0 -4
- package/dist/show-more/show-more.d.mts +0 -2
- package/dist/skeleton/index.d.mts +0 -2
- package/dist/skeleton/skeleton.d.mts +0 -2
- package/dist/step-indicator/index.d.mts +0 -1
- package/dist/step-indicator/step-indicator.d.mts +0 -1
- package/dist/styled-html/index.d.mts +0 -2
- package/dist/styled-html/styled-html.d.mts +0 -2
- package/dist/table/index.d.mts +0 -1
- package/dist/table/table.d.mts +0 -1
- package/dist/tabs/context.d.mts +0 -3
- package/dist/tabs/index.d.mts +0 -10
- package/dist/tabs/tabs-content.d.mts +0 -4
- package/dist/tabs/tabs-list.d.mts +0 -4
- package/dist/tabs/tabs.d.mts +0 -2
- package/dist/text/index.d.mts +0 -2
- package/dist/text/text.d.mts +0 -2
- package/dist/utilities/auto-animate-height.d.mts +0 -2
- package/dist/utilities/index.d.mts +0 -2
- package/dist/utils.d.mts +0 -5
- package/dist/warning-banner/index.d.mts +0 -2
- 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,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,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,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,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
|
+
};
|