@postenbring/hedwig-react 0.0.86 → 0.0.88
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.mjs +2 -2
- package/dist/accordion/accordion-header.mjs +2 -2
- package/dist/accordion/accordion-item.mjs +2 -2
- package/dist/accordion/accordion.mjs +5 -5
- package/dist/accordion/context.mjs +1 -1
- package/dist/accordion/index.mjs +5 -5
- package/dist/badge/badge.d.ts +7 -3
- package/dist/badge/badge.d.ts.map +1 -1
- package/dist/badge/badge.js.map +1 -1
- package/dist/badge/badge.mjs +2 -2
- package/dist/badge/index.js.map +1 -1
- package/dist/badge/index.mjs +2 -2
- package/dist/blockquote/blockquote.d.ts +29 -0
- package/dist/blockquote/blockquote.d.ts.map +1 -0
- package/dist/blockquote/blockquote.js +83 -0
- package/dist/blockquote/blockquote.js.map +1 -0
- package/dist/blockquote/blockquote.mjs +8 -0
- package/dist/blockquote/index.d.ts +3 -0
- package/dist/blockquote/index.d.ts.map +1 -0
- package/dist/blockquote/index.js +85 -0
- package/dist/blockquote/index.js.map +1 -0
- package/dist/blockquote/index.mjs +9 -0
- package/dist/box/box.mjs +2 -2
- package/dist/box/index.mjs +2 -2
- package/dist/breadcrumbs/breadcrumbs.mjs +2 -2
- package/dist/breadcrumbs/index.mjs +2 -2
- package/dist/button/button.mjs +2 -2
- package/dist/button/index.mjs +2 -2
- package/dist/card/card.mjs +2 -2
- package/dist/card/index.mjs +2 -2
- package/dist/{chunk-CCVZAHYA.mjs → chunk-35QRZSEV.mjs} +2 -2
- package/dist/chunk-3H7S7C3S.mjs +37 -0
- package/dist/chunk-3H7S7C3S.mjs.map +1 -0
- package/dist/{chunk-AJWSQEDP.mjs → chunk-3OGHJOJF.mjs} +2 -2
- package/dist/{chunk-USXU6ULZ.mjs → chunk-4QZR2H72.mjs} +2 -2
- package/dist/{chunk-FB5GEZNH.mjs → chunk-5UGT7L7R.mjs} +3 -3
- package/dist/{chunk-XFODQH3I.mjs → chunk-6BXKRPR3.mjs} +3 -3
- package/dist/{chunk-IHZ2MRF6.mjs → chunk-6VKQ6IRG.mjs} +8 -12
- package/dist/{chunk-IHZ2MRF6.mjs.map → chunk-6VKQ6IRG.mjs.map} +1 -1
- package/dist/{chunk-EVUKWONG.mjs → chunk-6ZO2TMOX.mjs} +3 -3
- package/dist/{chunk-F4STR6SD.mjs → chunk-7ROE6ADK.mjs} +2 -3
- package/dist/{chunk-F4STR6SD.mjs.map → chunk-7ROE6ADK.mjs.map} +1 -1
- package/dist/{chunk-YSFZCRWS.mjs → chunk-A42PXOVR.mjs} +2 -2
- package/dist/{chunk-6MR5XZOX.mjs → chunk-AYCHNAU7.mjs} +2 -2
- package/dist/{chunk-NU6OSFAU.mjs → chunk-AZ6X4L5C.mjs} +2 -2
- package/dist/{chunk-SQ63E7KM.mjs → chunk-BHQ46L2O.mjs} +3 -3
- package/dist/{chunk-HMATZX4A.mjs → chunk-C7ZTOZP3.mjs} +2 -2
- package/dist/{chunk-RZZDMBB7.mjs → chunk-CC5QWW52.mjs} +2 -2
- package/dist/{chunk-B6L7IFDX.mjs → chunk-CXX4SXJG.mjs} +5 -5
- package/dist/{chunk-GGQB2WWD.mjs → chunk-DMOMTRIY.mjs} +2 -2
- package/dist/{chunk-KI6WRKZY.mjs → chunk-EAFQ3XQU.mjs} +4 -4
- package/dist/{chunk-I3ZIMS72.mjs → chunk-EGW3RCXD.mjs} +3 -3
- package/dist/chunk-EGW3RCXD.mjs.map +1 -0
- package/dist/{chunk-L4YBHIS3.mjs → chunk-EMQB6JIS.mjs} +2 -2
- package/dist/{chunk-SKVM7G76.mjs → chunk-EZVEYJOX.mjs} +2 -2
- package/dist/{chunk-AXKJB47E.mjs → chunk-FUIKSOJF.mjs} +3 -3
- package/dist/{chunk-TDXU2IC6.mjs → chunk-ILFK3VKS.mjs} +7 -12
- package/dist/{chunk-TDXU2IC6.mjs.map → chunk-ILFK3VKS.mjs.map} +1 -1
- package/dist/{chunk-AXQCREUJ.mjs → chunk-J5SCUELT.mjs} +4 -5
- package/dist/{chunk-AXQCREUJ.mjs.map → chunk-J5SCUELT.mjs.map} +1 -1
- package/dist/{chunk-LG7QWKFP.mjs → chunk-JQGB77SS.mjs} +3 -3
- package/dist/chunk-JQGB77SS.mjs.map +1 -0
- package/dist/{chunk-UB2R7TCG.mjs → chunk-JUHJZLH2.mjs} +2 -2
- package/dist/chunk-JYN2QSN2.mjs +36 -0
- package/dist/chunk-JYN2QSN2.mjs.map +1 -0
- package/dist/{chunk-VCQIR53Y.mjs → chunk-JZXZYEPG.mjs} +2 -2
- package/dist/{chunk-6FBPKLWB.mjs → chunk-KCEWKQ4W.mjs} +8 -13
- package/dist/{chunk-6FBPKLWB.mjs.map → chunk-KCEWKQ4W.mjs.map} +1 -1
- package/dist/chunk-KFDS3IPB.mjs +1 -0
- package/dist/{chunk-DEZVONZD.mjs → chunk-KNGG6M2I.mjs} +4 -4
- package/dist/{chunk-WHMIHTPC.mjs → chunk-LGEGXOPU.mjs} +2 -2
- package/dist/{chunk-OIC2CPID.mjs → chunk-M7MG7ZQT.mjs} +4 -4
- package/dist/{chunk-HJYS664B.mjs → chunk-MYVC3HMO.mjs} +2 -2
- package/dist/{chunk-WPCWXROV.mjs → chunk-NIYDN3Y3.mjs} +3 -3
- package/dist/{chunk-GQUFERB2.mjs → chunk-OXZOGFNV.mjs} +2 -2
- package/dist/chunk-OXZOGFNV.mjs.map +1 -0
- package/dist/{chunk-GRWLX5BC.mjs → chunk-ROQH67YP.mjs} +5 -5
- package/dist/{chunk-GGNMBB3K.mjs → chunk-S3QSGJX2.mjs} +3 -3
- package/dist/{chunk-UP3M3NEZ.mjs → chunk-TC5PD4TA.mjs} +3 -3
- package/dist/{chunk-O4HIHUMD.mjs → chunk-UL2V2Z5B.mjs} +15 -17
- package/dist/chunk-UL2V2Z5B.mjs.map +1 -0
- package/dist/{chunk-MJ2DZH3N.mjs → chunk-VYS2QNTL.mjs} +2 -2
- package/dist/{chunk-JF3HBGAA.mjs → chunk-WLESNP6Z.mjs} +2 -2
- package/dist/{chunk-BVPSZ3JI.mjs → chunk-WUPLEZEY.mjs} +4 -4
- package/dist/chunk-XAFNJELJ.mjs +1 -0
- package/dist/{chunk-5UJ3LEKK.mjs → chunk-XQBJ75VD.mjs} +2 -2
- package/dist/{chunk-R4SQKVDQ.mjs → chunk-YOSPWY5K.mjs} +1 -1
- package/dist/{chunk-GJO7Z2YL.mjs → chunk-YS7HBWOI.mjs} +5 -4
- package/dist/chunk-YS7HBWOI.mjs.map +1 -0
- package/dist/{chunk-D7QPJIUZ.mjs → chunk-YZDURLEY.mjs} +3 -3
- package/dist/{chunk-COEZA7WA.mjs → chunk-Z2ZCM4BE.mjs} +3 -3
- package/dist/{chunk-EMI7NAO2.mjs → chunk-ZOZPWP3N.mjs} +2 -2
- package/dist/description-list/description-list.mjs +2 -2
- package/dist/description-list/index.mjs +2 -2
- package/dist/footer/footer.mjs +9 -9
- package/dist/footer/index.mjs +9 -9
- package/dist/form/checkbox/checkbox.js.map +1 -1
- package/dist/form/checkbox/checkbox.mjs +4 -4
- package/dist/form/checkbox/index.js.map +1 -1
- package/dist/form/checkbox/index.mjs +4 -4
- package/dist/form/date-picker/date-picker.mjs +5 -5
- package/dist/form/date-picker/index.mjs +5 -5
- package/dist/form/error-message/error-message.mjs +2 -2
- package/dist/form/error-message/index.mjs +2 -2
- package/dist/form/fieldset/fieldset.d.ts +2 -2
- package/dist/form/fieldset/fieldset.js.map +1 -1
- package/dist/form/fieldset/fieldset.mjs +3 -3
- package/dist/form/fieldset/index.js.map +1 -1
- package/dist/form/fieldset/index.mjs +3 -3
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +15 -16
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +23 -23
- package/dist/form/input/index.mjs +4 -4
- package/dist/form/input/input.mjs +4 -4
- package/dist/form/input-group/index.mjs +3 -3
- package/dist/form/input-group/input-group.mjs +3 -3
- package/dist/form/radio-button/index.d.ts +5 -0
- package/dist/form/radio-button/index.d.ts.map +1 -0
- package/dist/form/{radiobutton → radio-button}/index.js +19 -20
- package/dist/form/radio-button/index.js.map +1 -0
- package/dist/form/radio-button/index.mjs +19 -0
- package/dist/form/radio-button/index.mjs.map +1 -0
- package/dist/form/{radiobutton/radiobutton.d.ts → radio-button/radio-button.d.ts} +6 -6
- package/dist/form/radio-button/radio-button.d.ts.map +1 -0
- package/dist/form/{radiobutton/radiobutton.js → radio-button/radio-button.js} +19 -20
- package/dist/form/radio-button/radio-button.js.map +1 -0
- package/dist/form/radio-button/radio-button.mjs +13 -0
- package/dist/form/radio-button/radio-button.mjs.map +1 -0
- package/dist/form/{radiobutton/radiogroup.d.ts → radio-button/radio-group.d.ts} +7 -7
- package/dist/form/radio-button/radio-group.d.ts.map +1 -0
- package/dist/form/{radiobutton/radiogroup.js → radio-button/radio-group.js} +7 -6
- package/dist/form/radio-button/radio-group.js.map +1 -0
- package/dist/form/radio-button/radio-group.mjs +14 -0
- package/dist/form/radio-button/radio-group.mjs.map +1 -0
- package/dist/form/select/index.mjs +4 -4
- package/dist/form/select/select.mjs +4 -4
- package/dist/form/textarea/index.mjs +4 -4
- package/dist/form/textarea/textarea.mjs +4 -4
- package/dist/help-text/help-text.mjs +3 -3
- package/dist/help-text/index.mjs +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +557 -535
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -81
- package/dist/layout/container/container.mjs +2 -2
- package/dist/layout/grid/grid.js +1 -2
- package/dist/layout/grid/grid.js.map +1 -1
- package/dist/layout/grid/grid.mjs +3 -3
- package/dist/layout/grid/index.js +1 -2
- package/dist/layout/grid/index.js.map +1 -1
- package/dist/layout/grid/index.mjs +3 -3
- package/dist/layout/index.js +1 -2
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/index.mjs +5 -5
- package/dist/layout/responsive.js +1 -2
- package/dist/layout/responsive.js.map +1 -1
- package/dist/layout/responsive.mjs +2 -2
- package/dist/layout/spacing.mjs +1 -1
- package/dist/layout/stack/index.js +1 -2
- package/dist/layout/stack/index.js.map +1 -1
- package/dist/layout/stack/index.mjs +3 -3
- package/dist/layout/stack/stack.js +1 -2
- package/dist/layout/stack/stack.js.map +1 -1
- package/dist/layout/stack/stack.mjs +3 -3
- package/dist/link/index.mjs +2 -2
- package/dist/link/link.mjs +2 -2
- package/dist/list/index.mjs +3 -3
- package/dist/list/link-list.mjs +3 -3
- package/dist/list/list.mjs +2 -2
- package/dist/message/index.mjs +3 -3
- package/dist/message/message.mjs +3 -3
- package/dist/modal/index.js +4 -8
- package/dist/modal/index.js.map +1 -1
- package/dist/modal/index.mjs +4 -4
- package/dist/modal/modal.js +4 -8
- package/dist/modal/modal.js.map +1 -1
- package/dist/modal/modal.mjs +4 -4
- package/dist/navbar/icons.d.ts.map +1 -1
- package/dist/navbar/icons.js +16 -5
- package/dist/navbar/icons.js.map +1 -1
- package/dist/navbar/icons.mjs +2 -2
- package/dist/navbar/index.js +22 -16
- package/dist/navbar/index.js.map +1 -1
- package/dist/navbar/index.mjs +5 -5
- package/dist/navbar/navbar-expandable-menu.js +22 -16
- package/dist/navbar/navbar-expandable-menu.js.map +1 -1
- package/dist/navbar/navbar-expandable-menu.mjs +4 -4
- package/dist/navbar/navbar.js +22 -16
- package/dist/navbar/navbar.js.map +1 -1
- package/dist/navbar/navbar.mjs +5 -5
- package/dist/show-more/index.mjs +2 -2
- package/dist/show-more/show-more.mjs +2 -2
- package/dist/skeleton/index.mjs +2 -2
- package/dist/skeleton/skeleton.mjs +2 -2
- package/dist/step-indicator/index.mjs +2 -2
- package/dist/step-indicator/step-indicator.mjs +2 -2
- package/dist/styled-html/index.js +1 -1
- package/dist/styled-html/index.js.map +1 -1
- package/dist/styled-html/index.mjs +2 -2
- package/dist/styled-html/styled-html.d.ts +9 -1
- package/dist/styled-html/styled-html.d.ts.map +1 -1
- package/dist/styled-html/styled-html.js +1 -1
- package/dist/styled-html/styled-html.js.map +1 -1
- package/dist/styled-html/styled-html.mjs +2 -2
- package/dist/table/index.mjs +2 -2
- package/dist/table/table.mjs +2 -2
- package/dist/tabs/context.mjs +1 -1
- package/dist/tabs/index.js +1 -2
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +5 -5
- package/dist/tabs/tabs-content.mjs +2 -2
- package/dist/tabs/tabs-list.js +1 -2
- package/dist/tabs/tabs-list.js.map +1 -1
- package/dist/tabs/tabs-list.mjs +3 -3
- package/dist/tabs/tabs.js +1 -2
- package/dist/tabs/tabs.js.map +1 -1
- package/dist/tabs/tabs.mjs +5 -5
- package/dist/text/index.mjs +2 -2
- package/dist/text/text.mjs +2 -2
- package/dist/utils/auto-animate-height.js +5 -10
- package/dist/utils/auto-animate-height.js.map +1 -1
- package/dist/utils/auto-animate-height.mjs +3 -3
- package/dist/utils/index.js +11 -21
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +3 -3
- package/dist/utils/utils.js +6 -11
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/utils.mjs +2 -2
- package/dist/warning-banner/index.mjs +2 -2
- package/dist/warning-banner/warning-banner.mjs +2 -2
- package/package.json +3 -3
- package/src/accordion/accordion.stories.tsx +7 -113
- package/src/badge/badge.stories.tsx +1 -30
- package/src/badge/badge.tsx +7 -3
- package/src/blockquote/blockquote.stories.tsx +21 -0
- package/src/blockquote/blockquote.tsx +52 -0
- package/src/blockquote/index.tsx +3 -0
- package/src/box/box.stories.tsx +13 -84
- package/src/breadcrumbs/breadcrumbs.stories.tsx +7 -22
- package/src/button/button.stories.tsx +1 -85
- package/src/card/card.stories.tsx +1 -42
- package/src/description-list/description-list.stories.tsx +5 -71
- package/src/form/checkbox/checkbox.stories.tsx +4 -80
- package/src/form/date-picker/date-picker.stories.tsx +7 -7
- package/src/form/error-message/error-message.stories.tsx +2 -2
- package/src/form/fieldset/fieldset.stories.tsx +1 -58
- package/src/form/fieldset/fieldset.tsx +2 -2
- package/src/form/index.tsx +1 -1
- package/src/form/input/input.stories.tsx +1 -142
- package/src/form/radio-button/index.tsx +4 -0
- package/src/form/radio-button/radio-button.stories.tsx +25 -0
- package/src/form/{radiobutton/radiobutton.tsx → radio-button/radio-button.tsx} +13 -13
- package/src/form/{radiobutton/radiogroup.stories.tsx → radio-button/radio-group.stories.tsx} +8 -9
- package/src/form/{radiobutton/radiogroup.tsx → radio-button/radio-group.tsx} +7 -6
- package/src/form/select/select.stories.tsx +1 -61
- package/src/form/textarea/textarea.stories.tsx +4 -85
- package/src/help-text/help-text.stories.tsx +19 -0
- package/src/index.ts +1 -0
- package/src/layout/container/container.stories.tsx +17 -14
- package/src/layout/grid/grid.stories.tsx +27 -0
- package/src/layout/stack/stack.stories.tsx +27 -0
- package/src/link/link.stories.tsx +7 -38
- package/src/list/link-list.stories.tsx +24 -27
- package/src/list/list.stories.tsx +10 -48
- package/src/message/message.stories.tsx +7 -65
- package/src/modal/modal.stories.tsx +1 -103
- package/src/navbar/icons.tsx +10 -3
- package/src/navbar/navbar.stories.tsx +22 -62
- package/src/show-more/show-more.stories.tsx +2 -98
- package/src/skeleton/skeleton.stories.tsx +2 -126
- package/src/step-indicator/step-indicator.stories.tsx +1 -31
- package/src/styled-html/styled-html.stories.tsx +21 -155
- package/src/styled-html/styled-html.tsx +12 -2
- package/src/table/table.stories.tsx +42 -0
- package/src/tabs/tabs.stories.tsx +7 -114
- package/src/text/text.stories.tsx +17 -83
- package/src/warning-banner/warning-banner.stories.tsx +1 -23
- package/dist/chunk-2KX7VFN2.mjs +0 -1
- package/dist/chunk-GJO7Z2YL.mjs.map +0 -1
- package/dist/chunk-GQUFERB2.mjs.map +0 -1
- package/dist/chunk-I3ZIMS72.mjs.map +0 -1
- package/dist/chunk-LG7QWKFP.mjs.map +0 -1
- package/dist/chunk-MOU6WBT2.mjs +0 -26
- package/dist/chunk-MOU6WBT2.mjs.map +0 -1
- package/dist/chunk-O4HIHUMD.mjs.map +0 -1
- package/dist/form/radiobutton/index.d.ts +0 -5
- package/dist/form/radiobutton/index.d.ts.map +0 -1
- package/dist/form/radiobutton/index.js.map +0 -1
- package/dist/form/radiobutton/index.mjs +0 -19
- package/dist/form/radiobutton/radiobutton.d.ts.map +0 -1
- package/dist/form/radiobutton/radiobutton.js.map +0 -1
- package/dist/form/radiobutton/radiobutton.mjs +0 -13
- package/dist/form/radiobutton/radiogroup.d.ts.map +0 -1
- package/dist/form/radiobutton/radiogroup.js.map +0 -1
- package/dist/form/radiobutton/radiogroup.mjs +0 -14
- package/src/form/radiobutton/index.tsx +0 -4
- package/src/form/radiobutton/radiobutton.stories.tsx +0 -93
- /package/dist/{chunk-2KX7VFN2.mjs.map → blockquote/blockquote.mjs.map} +0 -0
- /package/dist/{form/radiobutton → blockquote}/index.mjs.map +0 -0
- /package/dist/{chunk-CCVZAHYA.mjs.map → chunk-35QRZSEV.mjs.map} +0 -0
- /package/dist/{chunk-AJWSQEDP.mjs.map → chunk-3OGHJOJF.mjs.map} +0 -0
- /package/dist/{chunk-USXU6ULZ.mjs.map → chunk-4QZR2H72.mjs.map} +0 -0
- /package/dist/{chunk-FB5GEZNH.mjs.map → chunk-5UGT7L7R.mjs.map} +0 -0
- /package/dist/{chunk-XFODQH3I.mjs.map → chunk-6BXKRPR3.mjs.map} +0 -0
- /package/dist/{chunk-EVUKWONG.mjs.map → chunk-6ZO2TMOX.mjs.map} +0 -0
- /package/dist/{chunk-YSFZCRWS.mjs.map → chunk-A42PXOVR.mjs.map} +0 -0
- /package/dist/{chunk-6MR5XZOX.mjs.map → chunk-AYCHNAU7.mjs.map} +0 -0
- /package/dist/{chunk-NU6OSFAU.mjs.map → chunk-AZ6X4L5C.mjs.map} +0 -0
- /package/dist/{chunk-SQ63E7KM.mjs.map → chunk-BHQ46L2O.mjs.map} +0 -0
- /package/dist/{chunk-HMATZX4A.mjs.map → chunk-C7ZTOZP3.mjs.map} +0 -0
- /package/dist/{chunk-RZZDMBB7.mjs.map → chunk-CC5QWW52.mjs.map} +0 -0
- /package/dist/{chunk-B6L7IFDX.mjs.map → chunk-CXX4SXJG.mjs.map} +0 -0
- /package/dist/{chunk-GGQB2WWD.mjs.map → chunk-DMOMTRIY.mjs.map} +0 -0
- /package/dist/{chunk-KI6WRKZY.mjs.map → chunk-EAFQ3XQU.mjs.map} +0 -0
- /package/dist/{chunk-L4YBHIS3.mjs.map → chunk-EMQB6JIS.mjs.map} +0 -0
- /package/dist/{chunk-SKVM7G76.mjs.map → chunk-EZVEYJOX.mjs.map} +0 -0
- /package/dist/{chunk-AXKJB47E.mjs.map → chunk-FUIKSOJF.mjs.map} +0 -0
- /package/dist/{chunk-UB2R7TCG.mjs.map → chunk-JUHJZLH2.mjs.map} +0 -0
- /package/dist/{chunk-VCQIR53Y.mjs.map → chunk-JZXZYEPG.mjs.map} +0 -0
- /package/dist/{chunk-R4SQKVDQ.mjs.map → chunk-KFDS3IPB.mjs.map} +0 -0
- /package/dist/{chunk-DEZVONZD.mjs.map → chunk-KNGG6M2I.mjs.map} +0 -0
- /package/dist/{chunk-WHMIHTPC.mjs.map → chunk-LGEGXOPU.mjs.map} +0 -0
- /package/dist/{chunk-OIC2CPID.mjs.map → chunk-M7MG7ZQT.mjs.map} +0 -0
- /package/dist/{chunk-HJYS664B.mjs.map → chunk-MYVC3HMO.mjs.map} +0 -0
- /package/dist/{chunk-WPCWXROV.mjs.map → chunk-NIYDN3Y3.mjs.map} +0 -0
- /package/dist/{chunk-GRWLX5BC.mjs.map → chunk-ROQH67YP.mjs.map} +0 -0
- /package/dist/{chunk-GGNMBB3K.mjs.map → chunk-S3QSGJX2.mjs.map} +0 -0
- /package/dist/{chunk-UP3M3NEZ.mjs.map → chunk-TC5PD4TA.mjs.map} +0 -0
- /package/dist/{chunk-MJ2DZH3N.mjs.map → chunk-VYS2QNTL.mjs.map} +0 -0
- /package/dist/{chunk-JF3HBGAA.mjs.map → chunk-WLESNP6Z.mjs.map} +0 -0
- /package/dist/{chunk-BVPSZ3JI.mjs.map → chunk-WUPLEZEY.mjs.map} +0 -0
- /package/dist/{form/radiobutton/radiobutton.mjs.map → chunk-XAFNJELJ.mjs.map} +0 -0
- /package/dist/{chunk-5UJ3LEKK.mjs.map → chunk-XQBJ75VD.mjs.map} +0 -0
- /package/dist/{form/radiobutton/radiogroup.mjs.map → chunk-YOSPWY5K.mjs.map} +0 -0
- /package/dist/{chunk-D7QPJIUZ.mjs.map → chunk-YZDURLEY.mjs.map} +0 -0
- /package/dist/{chunk-COEZA7WA.mjs.map → chunk-Z2ZCM4BE.mjs.map} +0 -0
- /package/dist/{chunk-EMI7NAO2.mjs.map → chunk-ZOZPWP3N.mjs.map} +0 -0
package/dist/utils/index.js
CHANGED
|
@@ -122,20 +122,15 @@ function useHydrated() {
|
|
|
122
122
|
}
|
|
123
123
|
function focusTrap(element) {
|
|
124
124
|
var _a, _b;
|
|
125
|
-
if (element === document.body)
|
|
126
|
-
|
|
127
|
-
};
|
|
125
|
+
if (element === document.body) return () => {
|
|
126
|
+
};
|
|
128
127
|
let inertElements = [];
|
|
129
128
|
for (let el = element; el; el = el.parentElement) {
|
|
130
|
-
if (el === document.body)
|
|
131
|
-
break;
|
|
129
|
+
if (el === document.body) break;
|
|
132
130
|
for (const sibling of (_b = (_a = el.parentElement) == null ? void 0 : _a.children) != null ? _b : []) {
|
|
133
|
-
if (sibling === el)
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
continue;
|
|
137
|
-
if (sibling.hasAttribute("inert"))
|
|
138
|
-
continue;
|
|
131
|
+
if (sibling === el) continue;
|
|
132
|
+
if (!(sibling instanceof HTMLElement)) continue;
|
|
133
|
+
if (sibling.hasAttribute("inert")) continue;
|
|
139
134
|
sibling.setAttribute("inert", "true");
|
|
140
135
|
inertElements.push(sibling);
|
|
141
136
|
}
|
|
@@ -181,19 +176,15 @@ var AutoAnimateHeight = (0, import_react2.forwardRef)(
|
|
|
181
176
|
);
|
|
182
177
|
(0, import_react2.useEffect)(() => {
|
|
183
178
|
var _a3;
|
|
184
|
-
if (!rootRef.current)
|
|
185
|
-
|
|
186
|
-
if (
|
|
187
|
-
return;
|
|
188
|
-
if (document.body.scrollHeight === 0)
|
|
189
|
-
return;
|
|
179
|
+
if (!rootRef.current) return;
|
|
180
|
+
if (!measurementRef.current) return;
|
|
181
|
+
if (document.body.scrollHeight === 0) return;
|
|
190
182
|
const currentMeasurement = measurementRef.current;
|
|
191
183
|
const { height: newHeight } = currentMeasurement.getBoundingClientRect();
|
|
192
184
|
let previouslyObservedHeight = newHeight;
|
|
193
185
|
const resizeObserver = new ResizeObserver(() => {
|
|
194
186
|
const { height: resizedHeight } = currentMeasurement.getBoundingClientRect();
|
|
195
|
-
if (resizedHeight === previouslyObservedHeight)
|
|
196
|
-
return;
|
|
187
|
+
if (resizedHeight === previouslyObservedHeight) return;
|
|
197
188
|
previouslyObservedHeight = resizedHeight;
|
|
198
189
|
setHeight({ height: resizedHeight, shouldAnimate: false });
|
|
199
190
|
});
|
|
@@ -208,8 +199,7 @@ var AutoAnimateHeight = (0, import_react2.forwardRef)(
|
|
|
208
199
|
}
|
|
209
200
|
const currentRoot = rootRef.current;
|
|
210
201
|
function onTransitionEndHandler(e) {
|
|
211
|
-
if (e.propertyName !== "height")
|
|
212
|
-
return;
|
|
202
|
+
if (e.propertyName !== "height") return;
|
|
213
203
|
setClonedChildren(nextClonedChildren);
|
|
214
204
|
}
|
|
215
205
|
currentRoot.addEventListener("transitionend", onTransitionEndHandler);
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/utils.ts","../../src/utils/auto-animate-height.tsx"],"sourcesContent":["export * from \"./utils\";\n\nexport { AutoAnimateHeight } from \"./auto-animate-height\";\nexport type * from \"./auto-animate-height\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n","import { cloneElement, forwardRef, useEffect, useRef, useState } from \"react\";\nimport { useMergeRefs } from \"./utils\";\n\nexport interface AutoAnimateHeightProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Time of the animation, using the hedwig animation tokens\n * quick: 0.1s\n * normal: 0.3s\n * slow: 0.7s\n *\n * default is \"quick\"\n */\n animationDuration?: \"quick\" | \"normal\" | \"slow\";\n\n /**\n * Callback fired when animiation transition ends\n * Use this to do effects after resizing is done, e.g. scrolling to the element\n * using `element.scrollIntoView()`\n */\n onTransitionEnd?: () => void;\n\n /**\n * Which hedwig easing function to use, default is \"normal\"\n */\n animationEasing?: \"in\" | \"out\" | \"normal\";\n children: React.ReactNode;\n style?: React.CSSProperties;\n}\n\n/**\n * Helper component to animate the height of the children when they change\n * It's done by rendering two versions of the passed children,\n * one hidden to measure the height and one visible to only changes after the height is measured.\n *\n * **IMPORTANT** Do not pass any components with effects (like data fetching), as they will trigger twice.\n */\nexport const AutoAnimateHeight = forwardRef<HTMLDivElement, AutoAnimateHeightProps>(\n (\n {\n children,\n style,\n animationDuration = \"quick\",\n animationEasing = \"normal\",\n onTransitionEnd,\n ...rest\n },\n ref,\n ) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([rootRef, ref]);\n const measurementRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<{ height: number; shouldAnimate: boolean } | undefined>(\n undefined,\n );\n const [clonedChildren, setClonedChildren] = useState<React.ReactNode>(() =>\n cloneElement(<>{children}</>, {}),\n );\n\n useEffect(() => {\n if (!rootRef.current) return;\n if (!measurementRef.current) return;\n if (document.body.scrollHeight === 0) return;\n const currentMeasurement = measurementRef.current;\n const { height: newHeight } = currentMeasurement.getBoundingClientRect();\n\n // Listen for resize events on the measurement element\n // Keep the children in sync with the height\n // But don't animate it.\n let previouslyObservedHeight = newHeight;\n const resizeObserver = new ResizeObserver(() => {\n const { height: resizedHeight } = currentMeasurement.getBoundingClientRect();\n if (resizedHeight === previouslyObservedHeight) return;\n previouslyObservedHeight = resizedHeight;\n setHeight({ height: resizedHeight, shouldAnimate: false });\n });\n resizeObserver.observe(currentMeasurement); // This is cleaned up down below in the return functions\n\n // Set the new height when children changes\n setHeight({ height: newHeight, shouldAnimate: true });\n\n // Update children\n const nextClonedChildren = cloneElement(<>{children}</>, {});\n\n // When increasing in height update immediately so the new content is shown during the animation\n if (newHeight >= (height?.height ?? 0)) {\n setClonedChildren(nextClonedChildren);\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n // When decreasing in height, wait until the animation is done so that we don't get a sudden flash of empty content\n const currentRoot = rootRef.current;\n function onTransitionEndHandler(e: TransitionEvent) {\n if (e.propertyName !== \"height\") return;\n setClonedChildren(nextClonedChildren);\n }\n currentRoot.addEventListener(\"transitionend\", onTransitionEndHandler);\n return () => {\n resizeObserver.disconnect();\n currentRoot.removeEventListener(\"transitionend\", onTransitionEndHandler);\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, [children]);\n\n return (\n <div\n ref={mergedRef}\n onTransitionEnd={onTransitionEnd}\n style={{\n position: \"relative\",\n overflow: \"hidden\",\n height: height?.height ?? measurementRef.current?.getBoundingClientRect().height,\n transitionProperty: height?.shouldAnimate ? \"height\" : \"none\",\n transitionDuration: `var(--hds-micro-animation-duration-${animationDuration})`,\n transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})`,\n willChange: \"height\",\n ...style,\n }}\n {...rest}\n >\n <div\n aria-hidden\n ref={measurementRef}\n style={{\n position: \"absolute\",\n visibility: \"hidden\",\n pointerEvents: \"none\",\n }}\n >\n {children}\n </div>\n {clonedChildren}\n </div>\n );\n },\n);\nAutoAnimateHeight.displayName = \"AutoAnimateHeight\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,mBAAiD;AAM1C,SAAS,aACd,MACoC;AACpC,SAAa,cAAQ,MAAM;AACzB,QAAI,KAAK,MAAM,CAAC,QAAQ,QAAQ,IAAI,GAAG;AACrC,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,UAAU;AAChB,WAAK,QAAQ,CAAC,QAAQ;AACpB,YAAI,OAAO,QAAQ,YAAY;AAC7B,cAAI,KAAK;AAAA,QACX,WAAW,QAAQ,MAAM;AACvB,UAAC,IAAgD,UAAU;AAAA,QAC7D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAEF,GAAG,IAAI;AACT;AAEO,SAAS,UACd,KACmC;AACnC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAiB,CAAC;AAC5C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAiB,CAAC;AAC9C,QAAM,mBAAe,0BAAY,MAAM;AAjCzC;AAkCI,SAAI,2BAAK,aAAY,MAAM;AACzB,gBAAS,sCAAK,YAAL,mBAAc,gBAAd,YAA6B,CAAC;AACvC,iBAAU,sCAAK,YAAL,mBAAc,iBAAd,YAA8B,CAAC;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AACR,8BAAU,MAAM;AACd,WAAO,iBAAiB,QAAQ,YAAY;AAC5C,WAAO,iBAAiB,UAAU,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AsB;AACpE,aAAO,MAAM;AACX,uBAAe,WAAW;AAC1B,oBAAY,oBAAoB,iBAAiB,sBAAsB;AAAA,MACzE;AAAA,IAGF,GAAG,CAAC,QAAQ,CAAC;AAEb,WACE;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA,OAAO;AAAA,UACL,UAAU;AAAA,UACV,UAAU;AAAA,UACV,SAAQC,MAAA,iCAAQ,WAAR,OAAAA,OAAkBD,MAAA,eAAe,YAAf,gBAAAA,IAAwB,wBAAwB;AAAA,UAC1E,qBAAoB,iCAAQ,iBAAgB,WAAW;AAAA,UACvD,oBAAoB,sCAAsC,iBAAiB;AAAA,UAC3E,0BAA0B,oCAAoC,eAAe;AAAA,UAC7E,YAAY;AAAA,WACT;AAAA,SAED,OAbL;AAAA,QAeC;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,cACX,KAAK;AAAA,cACL,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,YAAY;AAAA,gBACZ,eAAe;AAAA,cACjB;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,kBAAkB,cAAc;","names":["import_react","_a","_b"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/utils.ts","../../src/utils/auto-animate-height.tsx"],"sourcesContent":["export * from \"./utils\";\n\nexport { AutoAnimateHeight } from \"./auto-animate-height\";\nexport type * from \"./auto-animate-height\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n","import { cloneElement, forwardRef, useEffect, useRef, useState } from \"react\";\nimport { useMergeRefs } from \"./utils\";\n\nexport interface AutoAnimateHeightProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Time of the animation, using the hedwig animation tokens\n * quick: 0.1s\n * normal: 0.3s\n * slow: 0.7s\n *\n * default is \"quick\"\n */\n animationDuration?: \"quick\" | \"normal\" | \"slow\";\n\n /**\n * Callback fired when animiation transition ends\n * Use this to do effects after resizing is done, e.g. scrolling to the element\n * using `element.scrollIntoView()`\n */\n onTransitionEnd?: () => void;\n\n /**\n * Which hedwig easing function to use, default is \"normal\"\n */\n animationEasing?: \"in\" | \"out\" | \"normal\";\n children: React.ReactNode;\n style?: React.CSSProperties;\n}\n\n/**\n * Helper component to animate the height of the children when they change\n * It's done by rendering two versions of the passed children,\n * one hidden to measure the height and one visible to only changes after the height is measured.\n *\n * **IMPORTANT** Do not pass any components with effects (like data fetching), as they will trigger twice.\n */\nexport const AutoAnimateHeight = forwardRef<HTMLDivElement, AutoAnimateHeightProps>(\n (\n {\n children,\n style,\n animationDuration = \"quick\",\n animationEasing = \"normal\",\n onTransitionEnd,\n ...rest\n },\n ref,\n ) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([rootRef, ref]);\n const measurementRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<{ height: number; shouldAnimate: boolean } | undefined>(\n undefined,\n );\n const [clonedChildren, setClonedChildren] = useState<React.ReactNode>(() =>\n cloneElement(<>{children}</>, {}),\n );\n\n useEffect(() => {\n if (!rootRef.current) return;\n if (!measurementRef.current) return;\n if (document.body.scrollHeight === 0) return;\n const currentMeasurement = measurementRef.current;\n const { height: newHeight } = currentMeasurement.getBoundingClientRect();\n\n // Listen for resize events on the measurement element\n // Keep the children in sync with the height\n // But don't animate it.\n let previouslyObservedHeight = newHeight;\n const resizeObserver = new ResizeObserver(() => {\n const { height: resizedHeight } = currentMeasurement.getBoundingClientRect();\n if (resizedHeight === previouslyObservedHeight) return;\n previouslyObservedHeight = resizedHeight;\n setHeight({ height: resizedHeight, shouldAnimate: false });\n });\n resizeObserver.observe(currentMeasurement); // This is cleaned up down below in the return functions\n\n // Set the new height when children changes\n setHeight({ height: newHeight, shouldAnimate: true });\n\n // Update children\n const nextClonedChildren = cloneElement(<>{children}</>, {});\n\n // When increasing in height update immediately so the new content is shown during the animation\n if (newHeight >= (height?.height ?? 0)) {\n setClonedChildren(nextClonedChildren);\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n // When decreasing in height, wait until the animation is done so that we don't get a sudden flash of empty content\n const currentRoot = rootRef.current;\n function onTransitionEndHandler(e: TransitionEvent) {\n if (e.propertyName !== \"height\") return;\n setClonedChildren(nextClonedChildren);\n }\n currentRoot.addEventListener(\"transitionend\", onTransitionEndHandler);\n return () => {\n resizeObserver.disconnect();\n currentRoot.removeEventListener(\"transitionend\", onTransitionEndHandler);\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, [children]);\n\n return (\n <div\n ref={mergedRef}\n onTransitionEnd={onTransitionEnd}\n style={{\n position: \"relative\",\n overflow: \"hidden\",\n height: height?.height ?? measurementRef.current?.getBoundingClientRect().height,\n transitionProperty: height?.shouldAnimate ? \"height\" : \"none\",\n transitionDuration: `var(--hds-micro-animation-duration-${animationDuration})`,\n transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})`,\n willChange: \"height\",\n ...style,\n }}\n {...rest}\n >\n <div\n aria-hidden\n ref={measurementRef}\n style={{\n position: \"absolute\",\n visibility: \"hidden\",\n pointerEvents: \"none\",\n }}\n >\n {children}\n </div>\n {clonedChildren}\n </div>\n );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AA,UACV,UAAU;AAAA,UACV,SAAQC,MAAA,iCAAQ,WAAR,OAAAA,OAAkBD,MAAA,eAAe,YAAf,gBAAAA,IAAwB,wBAAwB;AAAA,UAC1E,qBAAoB,iCAAQ,iBAAgB,WAAW;AAAA,UACvD,oBAAoB,sCAAsC,iBAAiB;AAAA,UAC3E,0BAA0B,oCAAoC,eAAe;AAAA,UAC7E,YAAY;AAAA,WACT;AAAA,SAED,OAbL;AAAA,QAeC;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,cACX,KAAK;AAAA,cACL,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,YAAY;AAAA,gBACZ,eAAe;AAAA,cACjB;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,kBAAkB,cAAc;","names":["import_react","_a","_b"]}
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "../chunk-CYDWEPFL.mjs";
|
|
2
2
|
import {
|
|
3
3
|
AutoAnimateHeight
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-KCEWKQ4W.mjs";
|
|
5
5
|
import {
|
|
6
6
|
focusTrap,
|
|
7
7
|
useHydrated,
|
|
8
8
|
useMergeRefs,
|
|
9
9
|
useResize
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-ILFK3VKS.mjs";
|
|
11
|
+
import "../chunk-YOSPWY5K.mjs";
|
|
12
12
|
export {
|
|
13
13
|
AutoAnimateHeight,
|
|
14
14
|
focusTrap,
|
package/dist/utils/utils.js
CHANGED
|
@@ -90,20 +90,15 @@ function useHydrated() {
|
|
|
90
90
|
}
|
|
91
91
|
function focusTrap(element) {
|
|
92
92
|
var _a, _b;
|
|
93
|
-
if (element === document.body)
|
|
94
|
-
|
|
95
|
-
};
|
|
93
|
+
if (element === document.body) return () => {
|
|
94
|
+
};
|
|
96
95
|
let inertElements = [];
|
|
97
96
|
for (let el = element; el; el = el.parentElement) {
|
|
98
|
-
if (el === document.body)
|
|
99
|
-
break;
|
|
97
|
+
if (el === document.body) break;
|
|
100
98
|
for (const sibling of (_b = (_a = el.parentElement) == null ? void 0 : _a.children) != null ? _b : []) {
|
|
101
|
-
if (sibling === el)
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
continue;
|
|
105
|
-
if (sibling.hasAttribute("inert"))
|
|
106
|
-
continue;
|
|
99
|
+
if (sibling === el) continue;
|
|
100
|
+
if (!(sibling instanceof HTMLElement)) continue;
|
|
101
|
+
if (sibling.hasAttribute("inert")) continue;
|
|
107
102
|
sibling.setAttribute("inert", "true");
|
|
108
103
|
inertElements.push(sibling);
|
|
109
104
|
}
|
package/dist/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,mBAAiD;AAM1C,SAAS,aACd,MACoC;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{"version":3,"sources":["../../src/utils/utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,mBAAiD;AAM1C,SAAS,aACd,MACoC;AACpC,SAAa,cAAQ,MAAM;AACzB,QAAI,KAAK,MAAM,CAAC,QAAQ,QAAQ,IAAI,GAAG;AACrC,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,UAAU;AAChB,WAAK,QAAQ,CAAC,QAAQ;AACpB,YAAI,OAAO,QAAQ,YAAY;AAC7B,cAAI,KAAK;AAAA,QACX,WAAW,QAAQ,MAAM;AACvB,UAAC,IAAgD,UAAU;AAAA,QAC7D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAEF,GAAG,IAAI;AACT;AAEO,SAAS,UACd,KACmC;AACnC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAiB,CAAC;AAC5C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAiB,CAAC;AAC9C,QAAM,mBAAe,0BAAY,MAAM;AAjCzC;AAkCI,SAAI,2BAAK,aAAY,MAAM;AACzB,g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[]}
|
package/dist/utils/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postenbring/hedwig-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.88",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@types/react-dom": "^18.3.0",
|
|
18
18
|
"react": "^18.3.1",
|
|
19
19
|
"react-dom": "18.3.1",
|
|
20
|
-
"tsup": "^8.0
|
|
20
|
+
"tsup": "^8.1.0",
|
|
21
21
|
"typescript": "^5.4.5",
|
|
22
22
|
"eslint-config-custom": "0.0.1",
|
|
23
23
|
"hedwig-tsconfig": "0.0.0"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@radix-ui/react-popover": "1.0.7",
|
|
33
33
|
"@radix-ui/react-slot": "1.0.2",
|
|
34
|
-
"@postenbring/hedwig-css": "0.0.
|
|
34
|
+
"@postenbring/hedwig-css": "0.0.73"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies -- storybook story */
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { useState } from "react";
|
|
4
3
|
import { Link } from "../link";
|
|
5
4
|
import { UnorderedList } from "../list";
|
|
6
5
|
import { Accordion } from ".";
|
|
@@ -8,6 +7,13 @@ import { Accordion } from ".";
|
|
|
8
7
|
const meta: Meta<typeof Accordion> = {
|
|
9
8
|
title: "Accordion",
|
|
10
9
|
component: Accordion,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof Accordion>;
|
|
15
|
+
|
|
16
|
+
export const Preview: Story = {
|
|
11
17
|
args: {
|
|
12
18
|
children: (
|
|
13
19
|
<>
|
|
@@ -40,115 +46,3 @@ const meta: Meta<typeof Accordion> = {
|
|
|
40
46
|
),
|
|
41
47
|
},
|
|
42
48
|
};
|
|
43
|
-
|
|
44
|
-
type Story = StoryObj<typeof Accordion>;
|
|
45
|
-
|
|
46
|
-
export const MultipleItems: Story = {
|
|
47
|
-
name: "Multiple items",
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const JustOneItem: Story = {
|
|
51
|
-
name: "Just one item",
|
|
52
|
-
args: {
|
|
53
|
-
children: (
|
|
54
|
-
<Accordion.Item>
|
|
55
|
-
<Accordion.Header>Professional accordion title</Accordion.Header>
|
|
56
|
-
<Accordion.Content>
|
|
57
|
-
This is the simplest form of accordion body. Can be extensive.
|
|
58
|
-
</Accordion.Content>
|
|
59
|
-
</Accordion.Item>
|
|
60
|
-
),
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const NoIndent: Story = {
|
|
65
|
-
args: {
|
|
66
|
-
indent: false,
|
|
67
|
-
children: (
|
|
68
|
-
<Accordion.Item>
|
|
69
|
-
<Accordion.Header>Professional accordion title</Accordion.Header>
|
|
70
|
-
<Accordion.Content>
|
|
71
|
-
This is the simplest form of accordion body. Can be extensive.
|
|
72
|
-
</Accordion.Content>
|
|
73
|
-
</Accordion.Item>
|
|
74
|
-
),
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const DefaultOpen: Story = {
|
|
79
|
-
args: {
|
|
80
|
-
children: (
|
|
81
|
-
<>
|
|
82
|
-
<Accordion.Item defaultOpen>
|
|
83
|
-
<Accordion.Header>Professional accordion title</Accordion.Header>
|
|
84
|
-
<Accordion.Content>
|
|
85
|
-
This is the simplest form of accordion body. Can be extensive.
|
|
86
|
-
</Accordion.Content>
|
|
87
|
-
</Accordion.Item>
|
|
88
|
-
<Accordion.Item>
|
|
89
|
-
<Accordion.Header>Professional accordion title</Accordion.Header>
|
|
90
|
-
<Accordion.Content>
|
|
91
|
-
This is the simplest form of accordion body. Can be extensive.
|
|
92
|
-
</Accordion.Content>
|
|
93
|
-
</Accordion.Item>
|
|
94
|
-
</>
|
|
95
|
-
),
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const SingleAccordion: Story = {
|
|
100
|
-
name: "Only one open at the same time",
|
|
101
|
-
render: () => {
|
|
102
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- it's ok
|
|
103
|
-
const [state, setState] = useState({ one: false, two: false, three: false });
|
|
104
|
-
function toggle(key: keyof typeof state) {
|
|
105
|
-
setState((prev) => {
|
|
106
|
-
return {
|
|
107
|
-
one: key === "one" ? !prev.one : false,
|
|
108
|
-
two: key === "two" ? !prev.two : false,
|
|
109
|
-
three: key === "three" ? !prev.three : false,
|
|
110
|
-
};
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<Accordion>
|
|
116
|
-
<Accordion.Item
|
|
117
|
-
onOpenChange={() => {
|
|
118
|
-
toggle("one");
|
|
119
|
-
}}
|
|
120
|
-
open={state.one}
|
|
121
|
-
>
|
|
122
|
-
<Accordion.Header>One</Accordion.Header>
|
|
123
|
-
<Accordion.Content>
|
|
124
|
-
Lorum ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisl eget
|
|
125
|
-
</Accordion.Content>
|
|
126
|
-
</Accordion.Item>
|
|
127
|
-
<Accordion.Item
|
|
128
|
-
onOpenChange={() => {
|
|
129
|
-
toggle("two");
|
|
130
|
-
}}
|
|
131
|
-
open={state.two}
|
|
132
|
-
>
|
|
133
|
-
<Accordion.Header>Two</Accordion.Header>
|
|
134
|
-
<Accordion.Content>
|
|
135
|
-
Lorum ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisl eget
|
|
136
|
-
</Accordion.Content>
|
|
137
|
-
</Accordion.Item>
|
|
138
|
-
<Accordion.Item
|
|
139
|
-
onOpenChange={() => {
|
|
140
|
-
toggle("three");
|
|
141
|
-
}}
|
|
142
|
-
open={state.three}
|
|
143
|
-
>
|
|
144
|
-
<Accordion.Header>Three</Accordion.Header>
|
|
145
|
-
<Accordion.Content>
|
|
146
|
-
Lorum ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, nisl eget
|
|
147
|
-
</Accordion.Content>
|
|
148
|
-
</Accordion.Item>
|
|
149
|
-
</Accordion>
|
|
150
|
-
);
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export default meta;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies -- storybook story */
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
-
import { Box } from "../box";
|
|
4
3
|
import { Badge } from ".";
|
|
5
4
|
|
|
6
5
|
const meta: Meta<typeof Badge> = {
|
|
@@ -10,37 +9,9 @@ const meta: Meta<typeof Badge> = {
|
|
|
10
9
|
|
|
11
10
|
export default meta;
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export const Lighter: Story = {
|
|
12
|
+
export const Preview: StoryObj<typeof Badge> = {
|
|
16
13
|
args: {
|
|
17
14
|
variant: "lighter",
|
|
18
15
|
children: "Default badge",
|
|
19
16
|
},
|
|
20
17
|
};
|
|
21
|
-
|
|
22
|
-
export const Dark: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
variant: "dark",
|
|
25
|
-
children: "Dark badge",
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const White: Story = {
|
|
30
|
-
args: {
|
|
31
|
-
variant: "white",
|
|
32
|
-
children: "White badge",
|
|
33
|
-
},
|
|
34
|
-
render: (props) => (
|
|
35
|
-
<Box>
|
|
36
|
-
<Badge {...props} />
|
|
37
|
-
</Box>
|
|
38
|
-
),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const Warning: Story = {
|
|
42
|
-
args: {
|
|
43
|
-
variant: "warning",
|
|
44
|
-
children: "Warning badge",
|
|
45
|
-
},
|
|
46
|
-
};
|
package/src/badge/badge.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
|
|
5
|
-
export interface BadgeProps extends React.
|
|
5
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -10,7 +10,7 @@ export interface BadgeProps extends React.AnchorHTMLAttributes<HTMLSpanElement>
|
|
|
10
10
|
*
|
|
11
11
|
* @default "lighter"
|
|
12
12
|
*/
|
|
13
|
-
variant?: "lighter" | "
|
|
13
|
+
variant?: "lighter" | "darker" | "white" | "warning";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Font size of the badge
|
|
@@ -31,7 +31,11 @@ export interface BadgeProps extends React.AnchorHTMLAttributes<HTMLSpanElement>
|
|
|
31
31
|
* Badges are used to label, categorize or organize items using keywords to describe them.
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
|
-
*
|
|
34
|
+
*
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Badge variant="darker">Darker</Badge>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
35
39
|
*/
|
|
36
40
|
export const Badge = forwardRef<HTMLSpanElement, BadgeProps>(
|
|
37
41
|
({ children, asChild, variant = "lighter", size = "small", className, ...rest }, ref) => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies -- storybook story */
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Blockquote } from ".";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Blockquote> = {
|
|
6
|
+
title: "Blockquote",
|
|
7
|
+
component: Blockquote,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
|
|
12
|
+
export const Preview: StoryObj<typeof Blockquote> = {
|
|
13
|
+
args: {
|
|
14
|
+
children: (
|
|
15
|
+
<>
|
|
16
|
+
<p>... but they’ll never take our freedom!</p>
|
|
17
|
+
<footer>William Wallace</footer>
|
|
18
|
+
</>
|
|
19
|
+
),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
|
|
5
|
+
export interface BlockquoteProps extends React.HTMLAttributes<HTMLQuoteElement> {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The quote style
|
|
10
|
+
*
|
|
11
|
+
* @default "default"
|
|
12
|
+
*/
|
|
13
|
+
variant?: "default" | "norwegian";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
asChild?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @example
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Blockquote>
|
|
28
|
+
* <p>... but they’ll never take our freedom!</p>
|
|
29
|
+
* <footer>William Wallace</footer>
|
|
30
|
+
* </Blockquote>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export const Blockquote = forwardRef<HTMLQuoteElement, BlockquoteProps>(
|
|
35
|
+
({ children, asChild, className, variant, ...rest }, ref) => {
|
|
36
|
+
const Component = asChild ? Slot : "blockquote";
|
|
37
|
+
return (
|
|
38
|
+
<Component
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={clsx(
|
|
41
|
+
"hds-blockquote",
|
|
42
|
+
variant === "norwegian" && `hds-blockquote--norwegian`,
|
|
43
|
+
className as undefined,
|
|
44
|
+
)}
|
|
45
|
+
{...rest}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</Component>
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
Blockquote.displayName = "Blockquote";
|