@postenbring/hedwig-react 0.0.0-bugfix-example-darkmode-20260303122409 → 0.0.0-bump-nodejs-24-20260909105147
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.js.map +1 -1
- package/dist/accordion/accordion-content.mjs +3 -3
- package/dist/accordion/accordion.js.map +1 -1
- package/dist/accordion/accordion.mjs +4 -4
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +4 -4
- package/dist/blockquote/blockquote.d.ts +4 -11
- package/dist/blockquote/blockquote.d.ts.map +1 -1
- package/dist/blockquote/blockquote.js.map +1 -1
- package/dist/blockquote/blockquote.mjs +1 -1
- package/dist/blockquote/index.js.map +1 -1
- package/dist/blockquote/index.mjs +1 -1
- package/dist/button/button.d.ts +5 -2
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js.map +1 -1
- package/dist/button/button.mjs +1 -1
- package/dist/button/index.js.map +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/card/card.d.ts +1 -1
- package/dist/card/card.js +1 -1
- package/dist/card/card.js.map +1 -1
- package/dist/card/card.mjs +1 -1
- package/dist/card/index.js +1 -1
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs +1 -1
- package/dist/{chunk-77M2ZTP7.mjs → chunk-3V4GFS46.mjs} +11 -1
- package/dist/chunk-3V4GFS46.mjs.map +1 -0
- package/dist/{chunk-TYCGAA35.mjs → chunk-45Q2TCH6.mjs} +1 -1
- package/dist/chunk-45Q2TCH6.mjs.map +1 -0
- package/dist/chunk-5J5LYE6Z.mjs +1 -0
- package/dist/chunk-5M6MEYM7.mjs +1 -0
- package/dist/chunk-62VLFCXX.mjs +64 -0
- package/dist/chunk-62VLFCXX.mjs.map +1 -0
- package/dist/chunk-6D5VE3DW.mjs +44 -0
- package/dist/chunk-6D5VE3DW.mjs.map +1 -0
- package/dist/chunk-CAIGPMDS.mjs +1 -0
- package/dist/chunk-CAIGPMDS.mjs.map +1 -0
- package/dist/chunk-CD4LCDK3.mjs +27 -0
- package/dist/chunk-CD4LCDK3.mjs.map +1 -0
- package/dist/chunk-CSIXGT7P.mjs +1 -0
- package/dist/chunk-CSIXGT7P.mjs.map +1 -0
- package/dist/chunk-D2XZT2RA.mjs +17 -0
- package/dist/chunk-D2XZT2RA.mjs.map +1 -0
- package/dist/{chunk-6OJINZ37.mjs → chunk-DMRQEQQK.mjs} +28 -10
- package/dist/chunk-DMRQEQQK.mjs.map +1 -0
- package/dist/{chunk-HEDGKRGC.mjs → chunk-DOW6EHBI.mjs} +6 -32
- package/dist/chunk-DOW6EHBI.mjs.map +1 -0
- package/dist/chunk-F23MNQCK.mjs +28 -0
- package/dist/chunk-F23MNQCK.mjs.map +1 -0
- package/dist/{chunk-5RXT5GLF.mjs → chunk-F6QJWZJX.mjs} +2 -2
- package/dist/chunk-FTVKPZCX.mjs +37 -0
- package/dist/chunk-FTVKPZCX.mjs.map +1 -0
- package/dist/{chunk-NUP7ZBVE.mjs → chunk-GICUX46A.mjs} +2 -2
- package/dist/chunk-HA3LRSDK.mjs +21 -0
- package/dist/chunk-HA3LRSDK.mjs.map +1 -0
- package/dist/{chunk-W6CFPK2C.mjs → chunk-HOLFVKXQ.mjs} +3 -2
- package/dist/chunk-HOLFVKXQ.mjs.map +1 -0
- package/dist/chunk-JGQTAIEP.mjs +67 -0
- package/dist/chunk-JGQTAIEP.mjs.map +1 -0
- package/dist/chunk-JGYPZ7ET.mjs +103 -0
- package/dist/chunk-JGYPZ7ET.mjs.map +1 -0
- package/dist/{chunk-GYI4NCUY.mjs → chunk-KPNAC2WN.mjs} +2 -2
- package/dist/{chunk-F7MLQ6JI.mjs → chunk-NAXSP4VU.mjs} +12 -3
- package/dist/{chunk-F7MLQ6JI.mjs.map → chunk-NAXSP4VU.mjs.map} +1 -1
- package/dist/{chunk-JYN2QSN2.mjs → chunk-NZB6BBFT.mjs} +1 -1
- package/dist/chunk-NZB6BBFT.mjs.map +1 -0
- package/dist/{chunk-R6MQFVHE.mjs → chunk-O55OTMJ5.mjs} +2 -2
- package/dist/chunk-OQD4GKOS.mjs +65 -0
- package/dist/chunk-OQD4GKOS.mjs.map +1 -0
- package/dist/{chunk-YNGU3V4J.mjs → chunk-QDG2QLFV.mjs} +3 -3
- package/dist/{chunk-E6OOFTRQ.mjs → chunk-QER35NXN.mjs} +14 -8
- package/dist/chunk-QER35NXN.mjs.map +1 -0
- package/dist/chunk-QOIBRXYT.mjs +113 -0
- package/dist/chunk-QOIBRXYT.mjs.map +1 -0
- package/dist/{chunk-B6T36QDV.mjs → chunk-QTC4ATZD.mjs} +2 -2
- package/dist/{chunk-J35DWEJX.mjs → chunk-RGZSYJFL.mjs} +14 -5
- package/dist/chunk-RGZSYJFL.mjs.map +1 -0
- package/dist/chunk-RJ763KDH.mjs +21 -0
- package/dist/chunk-RJ763KDH.mjs.map +1 -0
- package/dist/{chunk-AGIY7SFP.mjs → chunk-SO7TS4TS.mjs} +2 -2
- package/dist/{chunk-BFM6UZGI.mjs → chunk-TTDR3NZL.mjs} +2 -2
- package/dist/chunk-TTDR3NZL.mjs.map +1 -0
- package/dist/{chunk-LHIG6RW7.mjs → chunk-VNH7CZJ4.mjs} +5 -13
- package/dist/chunk-VNH7CZJ4.mjs.map +1 -0
- package/dist/{chunk-HBGFFKP3.mjs → chunk-WVCJV74B.mjs} +2 -2
- package/dist/chunk-XSID7YR7.mjs +1 -0
- package/dist/chunk-XSID7YR7.mjs.map +1 -0
- package/dist/{chunk-EDPWJWQO.mjs → chunk-YQT2TN3U.mjs} +2 -2
- package/dist/footer/footer.js.map +1 -1
- package/dist/footer/footer.mjs +6 -6
- package/dist/footer/index.js.map +1 -1
- package/dist/footer/index.mjs +6 -6
- package/dist/form/checkbox/checkbox.d.ts +10 -1
- package/dist/form/checkbox/checkbox.d.ts.map +1 -1
- package/dist/form/checkbox/checkbox.js +170 -71
- package/dist/form/checkbox/checkbox.js.map +1 -1
- package/dist/form/checkbox/checkbox.mjs +11 -4
- package/dist/form/checkbox/index.js +170 -71
- package/dist/form/checkbox/index.js.map +1 -1
- package/dist/form/checkbox/index.mjs +11 -4
- package/dist/form/date-picker/date-picker.d.ts.map +1 -1
- package/dist/form/date-picker/date-picker.js +76 -46
- package/dist/form/date-picker/date-picker.js.map +1 -1
- package/dist/form/date-picker/date-picker.mjs +8 -4
- package/dist/form/date-picker/index.js +76 -46
- package/dist/form/date-picker/index.js.map +1 -1
- package/dist/form/date-picker/index.mjs +8 -4
- package/dist/form/error-message/error-message.d.ts +2 -0
- package/dist/form/error-message/error-message.d.ts.map +1 -1
- package/dist/form/error-message/error-message.js +18 -8
- package/dist/form/error-message/error-message.js.map +1 -1
- package/dist/form/error-message/error-message.mjs +3 -1
- package/dist/form/error-message/index.js +18 -8
- package/dist/form/error-message/index.js.map +1 -1
- package/dist/form/error-message/index.mjs +3 -1
- package/dist/form/error-summary/error-summary.d.ts.map +1 -1
- package/dist/form/error-summary/error-summary.js +10 -1
- package/dist/form/error-summary/error-summary.js.map +1 -1
- package/dist/form/error-summary/error-summary.mjs +3 -3
- package/dist/form/error-summary/index.js +10 -1
- package/dist/form/error-summary/index.js.map +1 -1
- package/dist/form/error-summary/index.mjs +3 -3
- package/dist/form/fieldset/fieldset-description.d.ts +12 -0
- package/dist/form/fieldset/fieldset-description.d.ts.map +1 -0
- package/dist/form/fieldset/fieldset-description.js +51 -0
- package/dist/form/fieldset/fieldset-description.js.map +1 -0
- package/dist/form/fieldset/fieldset-description.mjs +8 -0
- package/dist/form/fieldset/fieldset-description.mjs.map +1 -0
- package/dist/form/fieldset/fieldset-legend.d.ts +9 -0
- package/dist/form/fieldset/fieldset-legend.d.ts.map +1 -0
- package/dist/form/fieldset/fieldset-legend.js +72 -0
- package/dist/form/fieldset/fieldset-legend.js.map +1 -0
- package/dist/form/fieldset/fieldset-legend.mjs +8 -0
- package/dist/form/fieldset/fieldset-legend.mjs.map +1 -0
- package/dist/form/fieldset/fieldset.d.ts +30 -6
- package/dist/form/fieldset/fieldset.d.ts.map +1 -1
- package/dist/form/fieldset/fieldset.js +110 -35
- package/dist/form/fieldset/fieldset.js.map +1 -1
- package/dist/form/fieldset/fieldset.mjs +9 -2
- package/dist/form/fieldset/index.d.ts +2 -0
- package/dist/form/fieldset/index.d.ts.map +1 -1
- package/dist/form/fieldset/index.js +114 -35
- package/dist/form/fieldset/index.js.map +1 -1
- package/dist/form/fieldset/index.mjs +16 -3
- package/dist/form/index.d.ts +3 -0
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +550 -260
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +57 -24
- package/dist/form/input/index.js +103 -39
- package/dist/form/input/index.js.map +1 -1
- package/dist/form/input/index.mjs +8 -3
- package/dist/form/input/input.d.ts.map +1 -1
- package/dist/form/input/input.js +103 -39
- package/dist/form/input/input.js.map +1 -1
- package/dist/form/input/input.mjs +8 -3
- package/dist/form/input-group/index.js +59 -23
- package/dist/form/input-group/index.js.map +1 -1
- package/dist/form/input-group/index.mjs +7 -2
- package/dist/form/input-group/input-group.d.ts +9 -1
- package/dist/form/input-group/input-group.d.ts.map +1 -1
- package/dist/form/input-group/input-group.js +59 -23
- package/dist/form/input-group/input-group.js.map +1 -1
- package/dist/form/input-group/input-group.mjs +7 -2
- package/dist/form/radio-button/index.js +139 -86
- package/dist/form/radio-button/index.js.map +1 -1
- package/dist/form/radio-button/index.mjs +12 -5
- package/dist/form/radio-button/radio-button.d.ts +2 -10
- package/dist/form/radio-button/radio-button.d.ts.map +1 -1
- package/dist/form/radio-button/radio-button.js +139 -86
- package/dist/form/radio-button/radio-button.js.map +1 -1
- package/dist/form/radio-button/radio-button.mjs +12 -5
- package/dist/form/radio-button/radio-group.d.ts +11 -13
- package/dist/form/radio-button/radio-group.d.ts.map +1 -1
- package/dist/form/radio-button/radio-group.js +123 -48
- package/dist/form/radio-button/radio-group.js.map +1 -1
- package/dist/form/radio-button/radio-group.mjs +11 -4
- package/dist/form/search-wrapper/index.d.ts +3 -0
- package/dist/form/search-wrapper/index.d.ts.map +1 -0
- package/dist/form/search-wrapper/index.js +68 -0
- package/dist/form/search-wrapper/index.js.map +1 -0
- package/dist/form/search-wrapper/index.mjs +9 -0
- package/dist/form/search-wrapper/index.mjs.map +1 -0
- package/dist/form/search-wrapper/search-wrapper.d.ts +6 -0
- package/dist/form/search-wrapper/search-wrapper.d.ts.map +1 -0
- package/dist/form/search-wrapper/search-wrapper.js +66 -0
- package/dist/form/search-wrapper/search-wrapper.js.map +1 -0
- package/dist/form/search-wrapper/search-wrapper.mjs +8 -0
- package/dist/form/search-wrapper/search-wrapper.mjs.map +1 -0
- package/dist/form/select/index.js +105 -38
- package/dist/form/select/index.js.map +1 -1
- package/dist/form/select/index.mjs +8 -3
- package/dist/form/select/select.d.ts.map +1 -1
- package/dist/form/select/select.js +105 -38
- package/dist/form/select/select.js.map +1 -1
- package/dist/form/select/select.mjs +8 -3
- package/dist/form/suggestions/index.d.ts +7 -0
- package/dist/form/suggestions/index.d.ts.map +1 -0
- package/dist/form/suggestions/index.js +131 -0
- package/dist/form/suggestions/index.js.map +1 -0
- package/dist/form/suggestions/index.mjs +19 -0
- package/dist/form/suggestions/index.mjs.map +1 -0
- package/dist/form/suggestions/suggestions-item.d.ts +45 -0
- package/dist/form/suggestions/suggestions-item.d.ts.map +1 -0
- package/dist/form/suggestions/suggestions-item.js +83 -0
- package/dist/form/suggestions/suggestions-item.js.map +1 -0
- package/dist/form/suggestions/suggestions-item.mjs +10 -0
- package/dist/form/suggestions/suggestions-item.mjs.map +1 -0
- package/dist/form/suggestions/suggestions-wrapper.d.ts +41 -0
- package/dist/form/suggestions/suggestions-wrapper.d.ts.map +1 -0
- package/dist/form/suggestions/suggestions-wrapper.js +66 -0
- package/dist/form/suggestions/suggestions-wrapper.js.map +1 -0
- package/dist/form/suggestions/suggestions-wrapper.mjs +8 -0
- package/dist/form/suggestions/suggestions-wrapper.mjs.map +1 -0
- package/dist/form/suggestions/suggestions.d.ts +57 -0
- package/dist/form/suggestions/suggestions.d.ts.map +1 -0
- package/dist/form/suggestions/suggestions.js +123 -0
- package/dist/form/suggestions/suggestions.js.map +1 -0
- package/dist/form/suggestions/suggestions.mjs +10 -0
- package/dist/form/suggestions/suggestions.mjs.map +1 -0
- package/dist/form/textarea/index.js +92 -27
- package/dist/form/textarea/index.js.map +1 -1
- package/dist/form/textarea/index.mjs +8 -3
- package/dist/form/textarea/textarea.d.ts.map +1 -1
- package/dist/form/textarea/textarea.js +92 -27
- package/dist/form/textarea/textarea.js.map +1 -1
- package/dist/form/textarea/textarea.mjs +8 -3
- package/dist/form/validation-message/index.d.ts +3 -0
- package/dist/form/validation-message/index.d.ts.map +1 -0
- package/dist/form/validation-message/index.js +75 -0
- package/dist/form/validation-message/index.js.map +1 -0
- package/dist/form/validation-message/index.mjs +9 -0
- package/dist/form/validation-message/index.mjs.map +1 -0
- package/dist/form/validation-message/validation-message.d.ts +6 -0
- package/dist/form/validation-message/validation-message.d.ts.map +1 -0
- package/dist/form/validation-message/validation-message.js +73 -0
- package/dist/form/validation-message/validation-message.js.map +1 -0
- package/dist/form/validation-message/validation-message.mjs +8 -0
- package/dist/form/validation-message/validation-message.mjs.map +1 -0
- package/dist/index.js +798 -505
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -55
- package/dist/layout/index.mjs +7 -7
- package/dist/modal/index.js.map +1 -1
- package/dist/modal/index.mjs +2 -2
- package/dist/modal/modal.js.map +1 -1
- package/dist/modal/modal.mjs +2 -2
- package/dist/navbar/index.js +1 -0
- package/dist/navbar/index.js.map +1 -1
- package/dist/navbar/index.mjs +3 -3
- package/dist/navbar/navbar-expandable-menu.d.ts.map +1 -1
- package/dist/navbar/navbar-expandable-menu.js +1 -0
- package/dist/navbar/navbar-expandable-menu.js.map +1 -1
- package/dist/navbar/navbar-expandable-menu.mjs +2 -2
- package/dist/navbar/navbar.js +1 -0
- package/dist/navbar/navbar.js.map +1 -1
- package/dist/navbar/navbar.mjs +3 -3
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs +3 -3
- package/dist/skeleton/skeleton.js.map +1 -1
- package/dist/skeleton/skeleton.mjs +3 -3
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +3 -3
- package/dist/tabs/tabs-list.js.map +1 -1
- package/dist/tabs/tabs-list.mjs +2 -2
- package/dist/tabs/tabs.js.map +1 -1
- package/dist/tabs/tabs.mjs +3 -3
- package/dist/utils/auto-animate-height.js.map +1 -1
- package/dist/utils/auto-animate-height.mjs +2 -2
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +4 -2
- package/dist/utils/utils.d.ts +4 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +11 -0
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/utils.mjs +3 -1
- package/package.json +7 -7
- package/src/accordion/accordion.stories.tsx +13 -20
- package/src/alert/alert.stories.tsx +1 -1
- package/src/badge/badge.stories.tsx +1 -1
- package/src/blockquote/blockquote.stories.tsx +1 -1
- package/src/blockquote/blockquote.tsx +4 -12
- package/src/box/box.stories.tsx +1 -1
- package/src/breadcrumbs/breadcrumbs.stories.tsx +1 -1
- package/src/button/button.stories.tsx +1 -1
- package/src/button/button.tsx +6 -2
- package/src/button-list/button-list.stories.tsx +1 -1
- package/src/card/card.stories.tsx +10 -9
- package/src/card/card.tsx +2 -2
- package/src/description-list/description-list.stories.tsx +1 -1
- package/src/figure/figure.stories.tsx +1 -1
- package/src/form/checkbox/checkbox.stories.tsx +1 -1
- package/src/form/checkbox/checkbox.tsx +32 -11
- package/src/form/date-picker/date-picker.stories.tsx +1 -1
- package/src/form/date-picker/date-picker.tsx +7 -1
- package/src/form/error-message/error-message.tsx +8 -14
- package/src/form/error-summary/error-summary.stories.tsx +1 -1
- package/src/form/error-summary/error-summary.tsx +6 -1
- package/src/form/fieldset/fieldset-description.tsx +17 -0
- package/src/form/fieldset/fieldset-legend.tsx +22 -0
- package/src/form/fieldset/fieldset.stories.tsx +3 -2
- package/src/form/fieldset/fieldset.tsx +95 -26
- package/src/form/fieldset/index.tsx +2 -0
- package/src/form/index.tsx +3 -0
- package/src/form/input/input.stories.tsx +1 -1
- package/src/form/input/input.tsx +23 -8
- package/src/form/input-group/input-group.tsx +32 -15
- package/src/form/radio-button/radio-button.stories.tsx +1 -2
- package/src/form/radio-button/radio-button.tsx +8 -34
- package/src/form/radio-button/radio-group.stories.tsx +1 -1
- package/src/form/radio-button/radio-group.tsx +20 -19
- package/src/form/search-wrapper/index.tsx +2 -0
- package/src/form/search-wrapper/search-wrapper.stories.tsx +34 -0
- package/src/form/search-wrapper/search-wrapper.tsx +14 -0
- package/src/form/select/select.stories.tsx +1 -1
- package/src/form/select/select.tsx +25 -8
- package/src/form/suggestions/index.tsx +6 -0
- package/src/form/suggestions/suggestions-item.tsx +70 -0
- package/src/form/suggestions/suggestions-wrapper.tsx +50 -0
- package/src/form/suggestions/suggestions.tsx +89 -0
- package/src/form/textarea/textarea.stories.tsx +1 -1
- package/src/form/textarea/textarea.tsx +19 -2
- package/src/form/validation-message/index.tsx +2 -0
- package/src/form/validation-message/validation-message.stories.tsx +20 -0
- package/src/form/validation-message/validation-message.tsx +18 -0
- package/src/help-text/help-text.stories.tsx +1 -1
- package/src/layout/container/container.stories.tsx +1 -1
- package/src/layout/grid/grid.stories.tsx +1 -1
- package/src/layout/stack/stack.stories.tsx +1 -1
- package/src/link/link.stories.tsx +1 -1
- package/src/list/link-list.stories.tsx +1 -1
- package/src/list/list.stories.tsx +1 -1
- package/src/message/message.stories.tsx +1 -1
- package/src/modal/modal.stories.tsx +5 -9
- package/src/navbar/navbar-expandable-menu.tsx +1 -0
- package/src/navbar/navbar.stories.tsx +1 -1
- package/src/show-more/show-more.stories.tsx +1 -1
- package/src/skeleton/skeleton.stories.tsx +1 -1
- package/src/spinner/spinner.stories.tsx +1 -1
- package/src/step-indicator/step-indicator.stories.tsx +1 -1
- package/src/styled-html/styled-html.stories.tsx +1 -1
- package/src/table/table.stories.tsx +1 -1
- package/src/tabs/tabs.stories.tsx +1 -1
- package/src/text/text.stories.tsx +1 -1
- package/src/utils/utils.ts +16 -0
- package/src/warning-banner/warning-banner.stories.tsx +1 -1
- package/dist/chunk-3VKESN3T.mjs +0 -37
- package/dist/chunk-3VKESN3T.mjs.map +0 -1
- package/dist/chunk-6OJINZ37.mjs.map +0 -1
- package/dist/chunk-77M2ZTP7.mjs.map +0 -1
- package/dist/chunk-BFM6UZGI.mjs.map +0 -1
- package/dist/chunk-BO3EWZGA.mjs +0 -78
- package/dist/chunk-BO3EWZGA.mjs.map +0 -1
- package/dist/chunk-E6OOFTRQ.mjs.map +0 -1
- package/dist/chunk-HEDGKRGC.mjs.map +0 -1
- package/dist/chunk-IJSEJZ3W.mjs +0 -1
- package/dist/chunk-J35DWEJX.mjs.map +0 -1
- package/dist/chunk-JYN2QSN2.mjs.map +0 -1
- package/dist/chunk-LHIG6RW7.mjs.map +0 -1
- package/dist/chunk-LMF3QGSF.mjs +0 -1
- package/dist/chunk-N4W3OMA2.mjs +0 -37
- package/dist/chunk-N4W3OMA2.mjs.map +0 -1
- package/dist/chunk-NBEGX26X.mjs +0 -36
- package/dist/chunk-NBEGX26X.mjs.map +0 -1
- package/dist/chunk-TYCGAA35.mjs.map +0 -1
- package/dist/chunk-W6CFPK2C.mjs.map +0 -1
- package/dist/chunk-Z2ZPTZ6F.mjs +0 -69
- package/dist/chunk-Z2ZPTZ6F.mjs.map +0 -1
- package/src/form/error-message/error-message.stories.tsx +0 -20
- /package/dist/{chunk-IJSEJZ3W.mjs.map → chunk-5J5LYE6Z.mjs.map} +0 -0
- /package/dist/{chunk-LMF3QGSF.mjs.map → chunk-5M6MEYM7.mjs.map} +0 -0
- /package/dist/{chunk-5RXT5GLF.mjs.map → chunk-F6QJWZJX.mjs.map} +0 -0
- /package/dist/{chunk-NUP7ZBVE.mjs.map → chunk-GICUX46A.mjs.map} +0 -0
- /package/dist/{chunk-GYI4NCUY.mjs.map → chunk-KPNAC2WN.mjs.map} +0 -0
- /package/dist/{chunk-R6MQFVHE.mjs.map → chunk-O55OTMJ5.mjs.map} +0 -0
- /package/dist/{chunk-YNGU3V4J.mjs.map → chunk-QDG2QLFV.mjs.map} +0 -0
- /package/dist/{chunk-B6T36QDV.mjs.map → chunk-QTC4ATZD.mjs.map} +0 -0
- /package/dist/{chunk-AGIY7SFP.mjs.map → chunk-SO7TS4TS.mjs.map} +0 -0
- /package/dist/{chunk-HBGFFKP3.mjs.map → chunk-WVCJV74B.mjs.map} +0 -0
- /package/dist/{chunk-EDPWJWQO.mjs.map → chunk-YQT2TN3U.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/accordion/accordion-content.tsx","../../src/utils/utils.ts","../../src/accordion/context.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { inertPropValue } from \"../utils\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ children, className, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n return (\n <div\n id={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n {...{ inert: inertPropValue(!context.open) }}\n className={clsx(\"hds-accordion-item-content\", className as undefined)}\n ref={ref}\n {...rest}\n >\n <div className={clsx(\"hds-accordion-item-content-inner\")}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionContent.displayName = \"Accordion.Content\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } 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\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { createContext } from \"react\";\n\nexport interface AccordionItemContextProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n contentId: string;\n}\n\nexport const AccordionItemContext = createContext<AccordionItemContextProps | null>(null);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,gBAAuC;AACvC,6BAAqB;;;ACFrB,YAAuB;AACvB,mBAA0D;
|
|
1
|
+
{"version":3,"sources":["../../src/accordion/accordion-content.tsx","../../src/utils/utils.ts","../../src/accordion/context.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { inertPropValue } from \"../utils\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ children, className, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n return (\n <div\n id={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n {...{ inert: inertPropValue(!context.open) }}\n className={clsx(\"hds-accordion-item-content\", className as undefined)}\n ref={ref}\n {...rest}\n >\n <div className={clsx(\"hds-accordion-item-content-inner\")}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionContent.displayName = \"Accordion.Content\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } 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\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\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\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { createContext } from \"react\";\n\nexport interface AccordionItemContextProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n contentId: string;\n}\n\nexport const AccordionItemContext = createContext<AccordionItemContextProps | null>(null);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,gBAAuC;AACvC,6BAAqB;;;ACFrB,YAAuB;AACvB,mBAA0D;AAkI1D,IAAM,wBAAiC,OAAO,qBAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK;AAKjE,IAAM,iBAA2D,wBACpE,CAAC,MAAwB,IACzB,CAAC,MAAgC,IAAI,KAAK;;;AC1I9C,IAAAC,gBAA8B;AAQvB,IAAM,2BAAuB,6BAAgD,IAAI;;;AFiBhF;AAfD,IAAM,uBAAmB;AAAA,EAC9B,CAAC,IAAkC,QAAQ;AAA1C,iBAAE,YAAU,UAXf,IAWG,IAA0B,iBAA1B,IAA0B,CAAxB,YAAU;AACX,UAAM,cAAU,0BAAW,oBAAoB;AAC/C,QAAI,YAAY,MAAM;AACpB,aAAO;AAAA,IACT;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,QAAQ;AAAA,QACZ,cAAY,QAAQ,OAAO,SAAS;AAAA,SAChC,EAAE,OAAO,eAAe,CAAC,QAAQ,IAAI,EAAE,IAH5C;AAAA,QAIC,eAAW,6BAAK,8BAA8B,SAAsB;AAAA,QACpE;AAAA,UACI,OANL;AAAA,QAQC,sDAAC,SAAI,eAAW,6BAAK,kCAAkC,GAAI,UAAS;AAAA;AAAA,IACtE;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;","names":["import_react","import_react"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccordionContent
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-SO7TS4TS.mjs";
|
|
4
4
|
import "../chunk-CYDWEPFL.mjs";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-KPNAC2WN.mjs";
|
|
6
|
+
import "../chunk-3V4GFS46.mjs";
|
|
7
7
|
import "../chunk-YQFL5UN4.mjs";
|
|
8
8
|
import "../chunk-YOSPWY5K.mjs";
|
|
9
9
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/accordion/accordion.tsx","../../src/accordion/accordion-item.tsx","../../src/accordion/context.ts","../../src/accordion/accordion-header.tsx","../../src/accordion/accordion-content.tsx","../../src/utils/utils.ts"],"sourcesContent":["import type { ReactElement } from \"react\";\nimport { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItem, type AccordionItemProps } from \"./accordion-item\";\nimport { AccordionHeader } from \"./accordion-header\";\nimport { AccordionContent } from \"./accordion-content\";\n\nexport interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Accepts type of <AccordionItem/>\n */\n children: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];\n\n /**\n * Adds padding to the left of the accordion\n */\n indent?: boolean;\n}\n\n/**\n * Displays collapsible content sections\n *\n * @example\n * ```tsx\n * <Accordion>\n * <Accordion.Item defaultOpen>\n * <Accordion.Header>Item one</Accordion.Header>\n * <Accordion.Content>\n * Some content\n * </Accordion.Content>\n * </Accordion.Item>\n * <Accordion.Item>\n * <Accordion.Header>Item two</Accordion.Header>\n * <Accordion.Content>\n * Some more content\n * </Accordion.Content>\n * </Accordion.Item>\n * </Accordion>\n * ```\n */\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n ({ children, className, indent = true, ...rest }, ref) => {\n return (\n <div\n {...rest}\n className={clsx(\n \"hds-accordion\",\n !indent && \"hds-accordion--no-indent\",\n className as undefined,\n )}\n ref={ref}\n >\n {children}\n </div>\n );\n },\n) as AccordionType;\nAccordion.displayName = \"Accordion\";\n\nAccordion.Item = AccordionItem;\nAccordion.Header = AccordionHeader;\nAccordion.Content = AccordionContent;\n\ntype AccordionType = ReturnType<typeof forwardRef<HTMLDivElement, AccordionProps>> & {\n Item: typeof AccordionItem;\n Header: typeof AccordionHeader;\n Content: typeof AccordionContent;\n};\n","import type { ReactElement } from \"react\";\nimport { forwardRef, useId, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\nimport type { AccordionHeaderProps } from \"./accordion-header\";\nimport type { AccordionContentProps } from \"./accordion-content\";\n\nexport type AccordionItemChildrenType =\n | ReactElement<AccordionHeaderProps>\n | ReactElement<AccordionContentProps>;\n\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Control the open state of the accordion manually\n */\n open?: boolean;\n\n /**\n * Use with open to control the open state of the accordion manually\n */\n onOpenChange?: (open: boolean) => void;\n\n /**\n * If the accordion should be open by default\n */\n defaultOpen?: boolean;\n\n /**\n * Accepts type of Accordion.Content and Accordion.Header\n */\n children: AccordionItemChildrenType[];\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(\n ({ children, defaultOpen, open: outerOpen, onOpenChange, className, ...rest }, ref) => {\n const contentId = useId();\n const [innerOpen, setInnerOpen] = useState(defaultOpen ?? false);\n const open = outerOpen ?? innerOpen;\n\n const handleOpen = () => {\n if (outerOpen !== undefined) {\n onOpenChange && onOpenChange(!open);\n } else {\n setInnerOpen(!open);\n }\n };\n\n return (\n <div\n {...rest}\n data-state={open ? \"open\" : \"closed\"}\n className={clsx(\"hds-accordion-item\", className as undefined)}\n ref={ref}\n >\n <AccordionItemContext.Provider value={{ contentId, open, setOpen: handleOpen }}>\n {children}\n </AccordionItemContext.Provider>\n </div>\n );\n },\n);\n\nAccordionItem.displayName = \"Accordion.Item\";\n","import { createContext } from \"react\";\n\nexport interface AccordionItemContextProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n contentId: string;\n}\n\nexport const AccordionItemContext = createContext<AccordionItemContextProps | null>(null);\n","import type { MouseEvent, ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionHeaderProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n}\n\nexport const AccordionHeader = forwardRef<HTMLButtonElement, AccordionHeaderProps>(\n ({ children, className, onClick, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n const expandOrCollapse = (e: MouseEvent<HTMLButtonElement>) => {\n context.setOpen(!context.open);\n onClick?.(e);\n };\n return (\n <button\n {...rest}\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n className={clsx(\"hds-accordion-item-header\", className as undefined)}\n onClick={expandOrCollapse}\n ref={ref}\n type=\"button\"\n >\n <span>{children}</span>\n </button>\n );\n },\n);\n\nAccordionHeader.displayName = \"Accordion.Header\";\n","import type { ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { inertPropValue } from \"../utils\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ children, className, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n return (\n <div\n id={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n {...{ inert: inertPropValue(!context.open) }}\n className={clsx(\"hds-accordion-item-content\", className as undefined)}\n ref={ref}\n {...rest}\n >\n <div className={clsx(\"hds-accordion-item-content-inner\")}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionContent.displayName = \"Accordion.Content\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } 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\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,gBAA2B;AAC3B,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA4C;AAC5C,6BAAqB;;;ACFrB,mBAA8B;AAQvB,IAAM,2BAAuB,4BAAgD,IAAI;;;AD8ChF;AArBD,IAAM,oBAAgB;AAAA,EAC3B,CAAC,IAA8E,QAAQ;AAAtF,iBAAE,YAAU,aAAa,MAAM,WAAW,cAAc,UAlC3D,IAkCG,IAAsE,iBAAtE,IAAsE,CAApE,YAAU,eAAa,QAAiB,gBAAc;AACvD,UAAM,gBAAY,qBAAM;AACxB,UAAM,CAAC,WAAW,YAAY,QAAI,wBAAS,oCAAe,KAAK;AAC/D,UAAM,OAAO,gCAAa;AAE1B,UAAM,aAAa,MA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,CAAC,KAAK;AAKjE,IAAM,iBAA2D,wBACpE,CAAC,MAAwB,IACzB,CAAC,MAAgC,IAAI,KAAK;;;ADjGtC,IAAAC,sBAAA;AAfD,IAAM,uBAAmB;AAAA,EAC9B,CAAC,IAAkC,QAAQ;AAA1C,iBAAE,YAAU,UAXf,IAWG,IAA0B,iBAA1B,IAA0B,CAAxB,YAAU;AACX,UAAM,cAAU,0BAAW,oBAAoB;AAC/C,QAAI,YAAY,MAAM;AACpB,aAAO;AAAA,IACT;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,QAAQ;AAAA,QACZ,cAAY,QAAQ,OAAO,SAAS;AAAA,SAChC,EAAE,OAAO,eAAe,CAAC,QAAQ,IAAI,EAAE,IAH5C;AAAA,QAIC,eAAW,8BAAK,8BAA8B,SAAsB;AAAA,QACpE;AAAA,UACI,OANL;AAAA,QAQC,uDAAC,SAAI,eAAW,8BAAK,kCAAkC,GAAI,UAAS;AAAA;AAAA,IACtE;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;;;AJYzB,IAAAC,sBAAA;AAHC,IAAM,gBAAY;AAAA,EACvB,CAAC,IAAiD,QAAQ;AAAzD,iBAAE,YAAU,WAAW,SAAS,KAzCnC,IAyCG,IAAyC,iBAAzC,IAAyC,CAAvC,YAAU,aAAW;AACtB,WACE;AAAA,MAAC;AAAA,uCACK,OADL;AAAA,QAEC,eAAW;AAAA,UACT;AAAA,UACA,CAAC,UAAU;AAAA,UACX;AAAA,QACF;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAExB,UAAU,OAAO;AACjB,UAAU,SAAS;AACnB,UAAU,UAAU;","names":["import_react","import_typed_classname","import_react","import_react","import_typed_classname","import_jsx_runtime","import_react","import_typed_classname","import_react","import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../src/accordion/accordion.tsx","../../src/accordion/accordion-item.tsx","../../src/accordion/context.ts","../../src/accordion/accordion-header.tsx","../../src/accordion/accordion-content.tsx","../../src/utils/utils.ts"],"sourcesContent":["import type { ReactElement } from \"react\";\nimport { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItem, type AccordionItemProps } from \"./accordion-item\";\nimport { AccordionHeader } from \"./accordion-header\";\nimport { AccordionContent } from \"./accordion-content\";\n\nexport interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Accepts type of <AccordionItem/>\n */\n children: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];\n\n /**\n * Adds padding to the left of the accordion\n */\n indent?: boolean;\n}\n\n/**\n * Displays collapsible content sections\n *\n * @example\n * ```tsx\n * <Accordion>\n * <Accordion.Item defaultOpen>\n * <Accordion.Header>Item one</Accordion.Header>\n * <Accordion.Content>\n * Some content\n * </Accordion.Content>\n * </Accordion.Item>\n * <Accordion.Item>\n * <Accordion.Header>Item two</Accordion.Header>\n * <Accordion.Content>\n * Some more content\n * </Accordion.Content>\n * </Accordion.Item>\n * </Accordion>\n * ```\n */\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n ({ children, className, indent = true, ...rest }, ref) => {\n return (\n <div\n {...rest}\n className={clsx(\n \"hds-accordion\",\n !indent && \"hds-accordion--no-indent\",\n className as undefined,\n )}\n ref={ref}\n >\n {children}\n </div>\n );\n },\n) as AccordionType;\nAccordion.displayName = \"Accordion\";\n\nAccordion.Item = AccordionItem;\nAccordion.Header = AccordionHeader;\nAccordion.Content = AccordionContent;\n\ntype AccordionType = ReturnType<typeof forwardRef<HTMLDivElement, AccordionProps>> & {\n Item: typeof AccordionItem;\n Header: typeof AccordionHeader;\n Content: typeof AccordionContent;\n};\n","import type { ReactElement } from \"react\";\nimport { forwardRef, useId, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\nimport type { AccordionHeaderProps } from \"./accordion-header\";\nimport type { AccordionContentProps } from \"./accordion-content\";\n\nexport type AccordionItemChildrenType =\n | ReactElement<AccordionHeaderProps>\n | ReactElement<AccordionContentProps>;\n\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Control the open state of the accordion manually\n */\n open?: boolean;\n\n /**\n * Use with open to control the open state of the accordion manually\n */\n onOpenChange?: (open: boolean) => void;\n\n /**\n * If the accordion should be open by default\n */\n defaultOpen?: boolean;\n\n /**\n * Accepts type of Accordion.Content and Accordion.Header\n */\n children: AccordionItemChildrenType[];\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(\n ({ children, defaultOpen, open: outerOpen, onOpenChange, className, ...rest }, ref) => {\n const contentId = useId();\n const [innerOpen, setInnerOpen] = useState(defaultOpen ?? false);\n const open = outerOpen ?? innerOpen;\n\n const handleOpen = () => {\n if (outerOpen !== undefined) {\n onOpenChange && onOpenChange(!open);\n } else {\n setInnerOpen(!open);\n }\n };\n\n return (\n <div\n {...rest}\n data-state={open ? \"open\" : \"closed\"}\n className={clsx(\"hds-accordion-item\", className as undefined)}\n ref={ref}\n >\n <AccordionItemContext.Provider value={{ contentId, open, setOpen: handleOpen }}>\n {children}\n </AccordionItemContext.Provider>\n </div>\n );\n },\n);\n\nAccordionItem.displayName = \"Accordion.Item\";\n","import { createContext } from \"react\";\n\nexport interface AccordionItemContextProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n contentId: string;\n}\n\nexport const AccordionItemContext = createContext<AccordionItemContextProps | null>(null);\n","import type { MouseEvent, ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionHeaderProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n}\n\nexport const AccordionHeader = forwardRef<HTMLButtonElement, AccordionHeaderProps>(\n ({ children, className, onClick, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n const expandOrCollapse = (e: MouseEvent<HTMLButtonElement>) => {\n context.setOpen(!context.open);\n onClick?.(e);\n };\n return (\n <button\n {...rest}\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n className={clsx(\"hds-accordion-item-header\", className as undefined)}\n onClick={expandOrCollapse}\n ref={ref}\n type=\"button\"\n >\n <span>{children}</span>\n </button>\n );\n },\n);\n\nAccordionHeader.displayName = \"Accordion.Header\";\n","import type { ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { inertPropValue } from \"../utils\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ children, className, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n return (\n <div\n id={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n {...{ inert: inertPropValue(!context.open) }}\n className={clsx(\"hds-accordion-item-content\", className as undefined)}\n ref={ref}\n {...rest}\n >\n <div className={clsx(\"hds-accordion-item-content-inner\")}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionContent.displayName = \"Accordion.Content\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } 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\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\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\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,gBAA2B;AAC3B,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA4C;AAC5C,6BAAqB;;;ACFrB,mBAA8B;AAQvB,IAAM,2BAAuB,4BAAgD,IAAI;;;AD8ChF;AArBD,IAAM,oBAAgB;AAAA,EAC3B,CAAC,IAA8E,QAAQ;AAAtF,iBAAE,YAAU,aAAa,MAAM,WAAW,cAAc,UAlC3D,IAkCG,IAAsE,iBAAtE,IAAsE,CAApE,YAAU,eAAa,QAAiB,gBAAc;AACvD,UAAM,gBAAY,qBAAM;AACxB,UAAM,CAAC,WAAW,YAAY,QAAI,wBAAS,oCAAe,KAAK;AAC/D,UAAM,OAAO,gCAAa;AAE1B,UAAM,aAAa,MAAM;AACvB,UAAI,cAAc,QAAW;AAC3B,wBAAgB,aAAa,CAAC,IAAI;AAAA,MACpC,OAAO;AACL,qBAAa,CAAC,IAAI;AAAA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AA;AAfD,IAAM,uBAAmB;AAAA,EAC9B,CAAC,IAAkC,QAAQ;AAA1C,iBAAE,YAAU,UAXf,IAWG,IAA0B,iBAA1B,IAA0B,CAAxB,YAAU;AACX,UAAM,cAAU,0BAAW,oBAAoB;AAC/C,QAAI,YAAY,MAAM;AACpB,aAAO;AAAA,IACT;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,QAAQ;AAAA,QACZ,cAAY,QAAQ,OAAO,SAAS;AAAA,SAChC,EAAE,OAAO,eAAe,CAAC,QAAQ,IAAI,EAAE,IAH5C;AAAA,QAIC,eAAW,8BAAK,8BAA8B,SAAsB;AAAA,QACpE;AAAA,UACI,OANL;AAAA,QAQC,uDAAC,SAAI,eAAW,8BAAK,kCAAkC,GAAI,UAAS;AAAA;AAAA,IACtE;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;;;AJYzB,IAAAC,sBAAA;AAHC,IAAM,gBAAY;AAAA,EACvB,CAAC,IAAiD,QAAQ;AAAzD,iBAAE,YAAU,WAAW,SAAS,KAzCnC,IAyCG,IAAyC,iBAAzC,IAAyC,CAAvC,YAAU,aAAW;AACtB,WACE;AAAA,MAAC;AAAA,uCACK,OADL;AAAA,QAEC,eAAW;AAAA,UACT;AAAA,UACA,CAAC,UAAU;AAAA,UACX;AAAA,QACF;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAExB,UAAU,OAAO;AACjB,UAAU,SAAS;AACnB,UAAU,UAAU;","names":["import_react","import_typed_classname","import_react","import_react","import_typed_classname","import_jsx_runtime","import_react","import_typed_classname","import_react","import_jsx_runtime","import_jsx_runtime"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Accordion
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-O55OTMJ5.mjs";
|
|
4
|
+
import "../chunk-SO7TS4TS.mjs";
|
|
5
5
|
import "../chunk-CYDWEPFL.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-KPNAC2WN.mjs";
|
|
7
|
+
import "../chunk-3V4GFS46.mjs";
|
|
8
8
|
import "../chunk-MYVC3HMO.mjs";
|
|
9
9
|
import "../chunk-EZVEYJOX.mjs";
|
|
10
10
|
import "../chunk-YQFL5UN4.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/accordion/index.tsx","../../src/accordion/accordion.tsx","../../src/accordion/accordion-item.tsx","../../src/accordion/context.ts","../../src/accordion/accordion-header.tsx","../../src/accordion/accordion-content.tsx","../../src/utils/utils.ts"],"sourcesContent":["export { Accordion } from \"./accordion\";\nexport { AccordionItem } from \"./accordion-item\";\nexport { AccordionHeader } from \"./accordion-header\";\nexport { AccordionContent } from \"./accordion-content\";\n\nexport type * from \"./accordion\";\nexport type * from \"./accordion-item\";\nexport type * from \"./accordion-header\";\nexport type * from \"./accordion-content\";\n","import type { ReactElement } from \"react\";\nimport { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItem, type AccordionItemProps } from \"./accordion-item\";\nimport { AccordionHeader } from \"./accordion-header\";\nimport { AccordionContent } from \"./accordion-content\";\n\nexport interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Accepts type of <AccordionItem/>\n */\n children: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];\n\n /**\n * Adds padding to the left of the accordion\n */\n indent?: boolean;\n}\n\n/**\n * Displays collapsible content sections\n *\n * @example\n * ```tsx\n * <Accordion>\n * <Accordion.Item defaultOpen>\n * <Accordion.Header>Item one</Accordion.Header>\n * <Accordion.Content>\n * Some content\n * </Accordion.Content>\n * </Accordion.Item>\n * <Accordion.Item>\n * <Accordion.Header>Item two</Accordion.Header>\n * <Accordion.Content>\n * Some more content\n * </Accordion.Content>\n * </Accordion.Item>\n * </Accordion>\n * ```\n */\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n ({ children, className, indent = true, ...rest }, ref) => {\n return (\n <div\n {...rest}\n className={clsx(\n \"hds-accordion\",\n !indent && \"hds-accordion--no-indent\",\n className as undefined,\n )}\n ref={ref}\n >\n {children}\n </div>\n );\n },\n) as AccordionType;\nAccordion.displayName = \"Accordion\";\n\nAccordion.Item = AccordionItem;\nAccordion.Header = AccordionHeader;\nAccordion.Content = AccordionContent;\n\ntype AccordionType = ReturnType<typeof forwardRef<HTMLDivElement, AccordionProps>> & {\n Item: typeof AccordionItem;\n Header: typeof AccordionHeader;\n Content: typeof AccordionContent;\n};\n","import type { ReactElement } from \"react\";\nimport { forwardRef, useId, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\nimport type { AccordionHeaderProps } from \"./accordion-header\";\nimport type { AccordionContentProps } from \"./accordion-content\";\n\nexport type AccordionItemChildrenType =\n | ReactElement<AccordionHeaderProps>\n | ReactElement<AccordionContentProps>;\n\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Control the open state of the accordion manually\n */\n open?: boolean;\n\n /**\n * Use with open to control the open state of the accordion manually\n */\n onOpenChange?: (open: boolean) => void;\n\n /**\n * If the accordion should be open by default\n */\n defaultOpen?: boolean;\n\n /**\n * Accepts type of Accordion.Content and Accordion.Header\n */\n children: AccordionItemChildrenType[];\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(\n ({ children, defaultOpen, open: outerOpen, onOpenChange, className, ...rest }, ref) => {\n const contentId = useId();\n const [innerOpen, setInnerOpen] = useState(defaultOpen ?? false);\n const open = outerOpen ?? innerOpen;\n\n const handleOpen = () => {\n if (outerOpen !== undefined) {\n onOpenChange && onOpenChange(!open);\n } else {\n setInnerOpen(!open);\n }\n };\n\n return (\n <div\n {...rest}\n data-state={open ? \"open\" : \"closed\"}\n className={clsx(\"hds-accordion-item\", className as undefined)}\n ref={ref}\n >\n <AccordionItemContext.Provider value={{ contentId, open, setOpen: handleOpen }}>\n {children}\n </AccordionItemContext.Provider>\n </div>\n );\n },\n);\n\nAccordionItem.displayName = \"Accordion.Item\";\n","import { createContext } from \"react\";\n\nexport interface AccordionItemContextProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n contentId: string;\n}\n\nexport const AccordionItemContext = createContext<AccordionItemContextProps | null>(null);\n","import type { MouseEvent, ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionHeaderProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n}\n\nexport const AccordionHeader = forwardRef<HTMLButtonElement, AccordionHeaderProps>(\n ({ children, className, onClick, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n const expandOrCollapse = (e: MouseEvent<HTMLButtonElement>) => {\n context.setOpen(!context.open);\n onClick?.(e);\n };\n return (\n <button\n {...rest}\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n className={clsx(\"hds-accordion-item-header\", className as undefined)}\n onClick={expandOrCollapse}\n ref={ref}\n type=\"button\"\n >\n <span>{children}</span>\n </button>\n );\n },\n);\n\nAccordionHeader.displayName = \"Accordion.Header\";\n","import type { ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { inertPropValue } from \"../utils\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ children, className, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n return (\n <div\n id={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n {...{ inert: inertPropValue(!context.open) }}\n className={clsx(\"hds-accordion-item-content\", className as undefined)}\n ref={ref}\n {...rest}\n >\n <div className={clsx(\"hds-accordion-item-content-inner\")}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionContent.displayName = \"Accordion.Content\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } 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\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,gBAA2B;AAC3B,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA4C;AAC5C,6BAAqB;;;ACFrB,mBAA8B;AAQvB,IAAM,2BAAuB,4BAAgD,IAAI;;;AD8ChF;AArBD,IAAM,oBAAgB;AAA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AA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAExB,UAAU,OAAO;AACjB,UAAU,SAAS;AACnB,UAAU,UAAU;","names":["import_react","import_typed_classname","import_react","import_react","import_typed_classname","import_jsx_runtime","import_react","import_typed_classname","import_react","import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../src/accordion/index.tsx","../../src/accordion/accordion.tsx","../../src/accordion/accordion-item.tsx","../../src/accordion/context.ts","../../src/accordion/accordion-header.tsx","../../src/accordion/accordion-content.tsx","../../src/utils/utils.ts"],"sourcesContent":["export { Accordion } from \"./accordion\";\nexport { AccordionItem } from \"./accordion-item\";\nexport { AccordionHeader } from \"./accordion-header\";\nexport { AccordionContent } from \"./accordion-content\";\n\nexport type * from \"./accordion\";\nexport type * from \"./accordion-item\";\nexport type * from \"./accordion-header\";\nexport type * from \"./accordion-content\";\n","import type { ReactElement } from \"react\";\nimport { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItem, type AccordionItemProps } from \"./accordion-item\";\nimport { AccordionHeader } from \"./accordion-header\";\nimport { AccordionContent } from \"./accordion-content\";\n\nexport interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Accepts type of <AccordionItem/>\n */\n children: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];\n\n /**\n * Adds padding to the left of the accordion\n */\n indent?: boolean;\n}\n\n/**\n * Displays collapsible content sections\n *\n * @example\n * ```tsx\n * <Accordion>\n * <Accordion.Item defaultOpen>\n * <Accordion.Header>Item one</Accordion.Header>\n * <Accordion.Content>\n * Some content\n * </Accordion.Content>\n * </Accordion.Item>\n * <Accordion.Item>\n * <Accordion.Header>Item two</Accordion.Header>\n * <Accordion.Content>\n * Some more content\n * </Accordion.Content>\n * </Accordion.Item>\n * </Accordion>\n * ```\n */\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n ({ children, className, indent = true, ...rest }, ref) => {\n return (\n <div\n {...rest}\n className={clsx(\n \"hds-accordion\",\n !indent && \"hds-accordion--no-indent\",\n className as undefined,\n )}\n ref={ref}\n >\n {children}\n </div>\n );\n },\n) as AccordionType;\nAccordion.displayName = \"Accordion\";\n\nAccordion.Item = AccordionItem;\nAccordion.Header = AccordionHeader;\nAccordion.Content = AccordionContent;\n\ntype AccordionType = ReturnType<typeof forwardRef<HTMLDivElement, AccordionProps>> & {\n Item: typeof AccordionItem;\n Header: typeof AccordionHeader;\n Content: typeof AccordionContent;\n};\n","import type { ReactElement } from \"react\";\nimport { forwardRef, useId, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\nimport type { AccordionHeaderProps } from \"./accordion-header\";\nimport type { AccordionContentProps } from \"./accordion-content\";\n\nexport type AccordionItemChildrenType =\n | ReactElement<AccordionHeaderProps>\n | ReactElement<AccordionContentProps>;\n\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Control the open state of the accordion manually\n */\n open?: boolean;\n\n /**\n * Use with open to control the open state of the accordion manually\n */\n onOpenChange?: (open: boolean) => void;\n\n /**\n * If the accordion should be open by default\n */\n defaultOpen?: boolean;\n\n /**\n * Accepts type of Accordion.Content and Accordion.Header\n */\n children: AccordionItemChildrenType[];\n}\n\nexport const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(\n ({ children, defaultOpen, open: outerOpen, onOpenChange, className, ...rest }, ref) => {\n const contentId = useId();\n const [innerOpen, setInnerOpen] = useState(defaultOpen ?? false);\n const open = outerOpen ?? innerOpen;\n\n const handleOpen = () => {\n if (outerOpen !== undefined) {\n onOpenChange && onOpenChange(!open);\n } else {\n setInnerOpen(!open);\n }\n };\n\n return (\n <div\n {...rest}\n data-state={open ? \"open\" : \"closed\"}\n className={clsx(\"hds-accordion-item\", className as undefined)}\n ref={ref}\n >\n <AccordionItemContext.Provider value={{ contentId, open, setOpen: handleOpen }}>\n {children}\n </AccordionItemContext.Provider>\n </div>\n );\n },\n);\n\nAccordionItem.displayName = \"Accordion.Item\";\n","import { createContext } from \"react\";\n\nexport interface AccordionItemContextProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n contentId: string;\n}\n\nexport const AccordionItemContext = createContext<AccordionItemContextProps | null>(null);\n","import type { MouseEvent, ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionHeaderProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n children: ReactNode;\n}\n\nexport const AccordionHeader = forwardRef<HTMLButtonElement, AccordionHeaderProps>(\n ({ children, className, onClick, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n const expandOrCollapse = (e: MouseEvent<HTMLButtonElement>) => {\n context.setOpen(!context.open);\n onClick?.(e);\n };\n return (\n <button\n {...rest}\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n className={clsx(\"hds-accordion-item-header\", className as undefined)}\n onClick={expandOrCollapse}\n ref={ref}\n type=\"button\"\n >\n <span>{children}</span>\n </button>\n );\n },\n);\n\nAccordionHeader.displayName = \"Accordion.Header\";\n","import type { ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { inertPropValue } from \"../utils\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ children, className, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n return (\n <div\n id={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n {...{ inert: inertPropValue(!context.open) }}\n className={clsx(\"hds-accordion-item-content\", className as undefined)}\n ref={ref}\n {...rest}\n >\n <div className={clsx(\"hds-accordion-item-content-inner\")}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionContent.displayName = \"Accordion.Content\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } 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\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\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\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,gBAA2B;AAC3B,IAAAC,0BAAqB;;;ACDrB,I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AC;AAAA,uCACK,OADL;AAAA,QAEC,eAAW;AAAA,UACT;AAAA,UACA,CAAC,UAAU;AAAA,UACX;AAAA,QACF;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAExB,UAAU,OAAO;AACjB,UAAU,SAAS;AACnB,UAAU,UAAU;","names":["import_react","import_typed_classname","import_react","import_react","import_typed_classname","import_jsx_runtime","import_react","import_typed_classname","import_react","import_jsx_runtime","import_jsx_runtime"]}
|
package/dist/accordion/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "../chunk-ZKMFJZSH.mjs";
|
|
2
2
|
import {
|
|
3
3
|
Accordion
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-O55OTMJ5.mjs";
|
|
5
5
|
import {
|
|
6
6
|
AccordionContent
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-SO7TS4TS.mjs";
|
|
8
8
|
import "../chunk-CYDWEPFL.mjs";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-KPNAC2WN.mjs";
|
|
10
|
+
import "../chunk-3V4GFS46.mjs";
|
|
11
11
|
import {
|
|
12
12
|
AccordionHeader
|
|
13
13
|
} from "../chunk-MYVC3HMO.mjs";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated This interface is deprecated and will be removed in a future release.
|
|
3
|
+
*/
|
|
1
4
|
export interface BlockquoteProps extends React.HTMLAttributes<HTMLQuoteElement> {
|
|
2
5
|
children?: React.ReactNode;
|
|
3
6
|
/**
|
|
@@ -13,16 +16,6 @@ export interface BlockquoteProps extends React.HTMLAttributes<HTMLQuoteElement>
|
|
|
13
16
|
*/
|
|
14
17
|
asChild?: boolean;
|
|
15
18
|
}
|
|
16
|
-
/**
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <Blockquote>
|
|
21
|
-
* <p>... but they’ll never take our freedom!</p>
|
|
22
|
-
* <footer>William Wallace</footer>
|
|
23
|
-
* </Blockquote>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
19
|
+
/** @deprecated This component is deprecated and will be removed in a future release. */
|
|
27
20
|
export declare const Blockquote: import("react").ForwardRefExoticComponent<BlockquoteProps & import("react").RefAttributes<HTMLQuoteElement>>;
|
|
28
21
|
//# sourceMappingURL=blockquote.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["../../src/blockquote/blockquote.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAElC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["../../src/blockquote/blockquote.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAElC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AACD,wFAAwF;AACxF,eAAO,MAAM,UAAU,8GAiBtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/blockquote/blockquote.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nexport interface BlockquoteProps extends React.HTMLAttributes<HTMLQuoteElement> {\n children?: React.ReactNode;\n\n /**\n * The quote style\n *\n * @default \"default\"\n */\n variant?: \"default\" | \"norwegian\";\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n
|
|
1
|
+
{"version":3,"sources":["../../src/blockquote/blockquote.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\n/**\n * @deprecated This interface is deprecated and will be removed in a future release.\n */\nexport interface BlockquoteProps extends React.HTMLAttributes<HTMLQuoteElement> {\n children?: React.ReactNode;\n\n /**\n * The quote style\n *\n * @default \"default\"\n */\n variant?: \"default\" | \"norwegian\";\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n/** @deprecated This component is deprecated and will be removed in a future release. */\nexport const Blockquote = forwardRef<HTMLQuoteElement, BlockquoteProps>(\n ({ children, asChild, className, variant, ...rest }, ref) => {\n const Component = asChild ? Slot : \"blockquote\";\n return (\n <Component\n ref={ref}\n className={clsx(\n \"hds-blockquote\",\n variant === \"norwegian\" && `hds-blockquote--norwegian`,\n className as undefined,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nBlockquote.displayName = \"Blockquote\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAqB;AACrB,wBAAqB;AACrB,mBAA2B;AA2BrB;AAJC,IAAM,iBAAa;AAAA,EACxB,CAAC,IAAoD,QAAQ;AAA5D,iBAAE,YAAU,SAAS,WAAW,QA1BnC,IA0BG,IAA4C,iBAA5C,IAA4C,CAA1C,YAAU,WAAS,aAAW;AAC/B,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW;AAAA,UACT;AAAA,UACA,YAAY,eAAe;AAAA,UAC3B;AAAA,QACF;AAAA,SACI,OAPL;AAAA,QASE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,WAAW,cAAc;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/blockquote/index.tsx","../../src/blockquote/blockquote.tsx"],"sourcesContent":["export { Blockquote } from \"./blockquote\";\n\nexport type * from \"./blockquote\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nexport interface BlockquoteProps extends React.HTMLAttributes<HTMLQuoteElement> {\n children?: React.ReactNode;\n\n /**\n * The quote style\n *\n * @default \"default\"\n */\n variant?: \"default\" | \"norwegian\";\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n
|
|
1
|
+
{"version":3,"sources":["../../src/blockquote/index.tsx","../../src/blockquote/blockquote.tsx"],"sourcesContent":["export { Blockquote } from \"./blockquote\";\n\nexport type * from \"./blockquote\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\n/**\n * @deprecated This interface is deprecated and will be removed in a future release.\n */\nexport interface BlockquoteProps extends React.HTMLAttributes<HTMLQuoteElement> {\n children?: React.ReactNode;\n\n /**\n * The quote style\n *\n * @default \"default\"\n */\n variant?: \"default\" | \"norwegian\";\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n/** @deprecated This component is deprecated and will be removed in a future release. */\nexport const Blockquote = forwardRef<HTMLQuoteElement, BlockquoteProps>(\n ({ children, asChild, className, variant, ...rest }, ref) => {\n const Component = asChild ? Slot : \"blockquote\";\n return (\n <Component\n ref={ref}\n className={clsx(\n \"hds-blockquote\",\n variant === \"norwegian\" && `hds-blockquote--norwegian`,\n className as undefined,\n )}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nBlockquote.displayName = \"Blockquote\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,6BAAqB;AACrB,wBAAqB;AACrB,mBAA2B;AA2BrB;AAJC,IAAM,iBAAa;AAAA,EACxB,CAAC,IAAoD,QAAQ;AAA5D,iBAAE,YAAU,SAAS,WAAW,QA1BnC,IA0BG,IAA4C,iBAA5C,IAA4C,CAA1C,YAAU,WAAS,aAAW;AAC/B,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW;AAAA,UACT;AAAA,UACA,YAAY,eAAe;AAAA,UAC3B;AAAA,QACF;AAAA,SACI,OAPL;AAAA,QASE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,WAAW,cAAc;","names":[]}
|
package/dist/button/button.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated The "inverted" variant is deprecated. Use "primary", "secondary", or "tertiary" instead.
|
|
3
|
+
*/
|
|
4
|
+
export type DeprecatedVariant = "inverted";
|
|
1
5
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
6
|
/**
|
|
3
7
|
* The height, font size and padding of the button
|
|
@@ -10,7 +14,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
10
14
|
*
|
|
11
15
|
* @default "primary"
|
|
12
16
|
*/
|
|
13
|
-
variant?: "primary" | "secondary" | "tertiary" |
|
|
17
|
+
variant?: "primary" | "secondary" | "tertiary" | DeprecatedVariant;
|
|
14
18
|
/**
|
|
15
19
|
* Make the button use 100% width available.
|
|
16
20
|
* Using the "mobile" it only stretch to full width on smaller screens
|
|
@@ -38,7 +42,6 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
38
42
|
* @example
|
|
39
43
|
* <Button variant="primary">Primary</Button>
|
|
40
44
|
* <Button variant="secondary" size="large">Secondary</Button>
|
|
41
|
-
* <Button variant="inverted">Inverted</Button>
|
|
42
45
|
* <Button variant="tertiary" fullWidth="mobile">Tertiary</Button>
|
|
43
46
|
* <Button icon="leading"><LeadingIcon />Leading icon</Button>
|
|
44
47
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE3C,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,iBAAiB,CAAC;IAEnE;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE/B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;IAExC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM,2GAsClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/button/button.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n *\n * @default \"large\"\n */\n size?: \"small\" | \"large\";\n\n /**\n * The background and fill of the button\n *\n * @default \"primary\"\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\" |
|
|
1
|
+
{"version":3,"sources":["../../src/button/button.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\n/**\n * @deprecated The \"inverted\" variant is deprecated. Use \"primary\", \"secondary\", or \"tertiary\" instead.\n */\nexport type DeprecatedVariant = \"inverted\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n *\n * @default \"large\"\n */\n size?: \"small\" | \"large\";\n\n /**\n * The background and fill of the button\n *\n * @default \"primary\"\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\" | DeprecatedVariant;\n\n /**\n * Make the button use 100% width available.\n * Using the \"mobile\" it only stretch to full width on smaller screens\n */\n fullWidth?: boolean | \"mobile\";\n\n /**\n * Specify that there is an icon in the button.\n * `icon`: There is only an icon in the button.\n * `icon=\"leading\"`: There is an icon before the text.\n * `icon=\"trailing\"`: There is an icon after the text.\n *\n * @default false\n */\n icon?: boolean | \"leading\" | \"trailing\";\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * Button component\n *\n * @example\n * <Button variant=\"primary\">Primary</Button>\n * <Button variant=\"secondary\" size=\"large\">Secondary</Button>\n * <Button variant=\"tertiary\" fullWidth=\"mobile\">Tertiary</Button>\n * <Button icon=\"leading\"><LeadingIcon />Leading icon</Button>\n *\n * @example\n * // If used for navigation use the `asChild` prop with a anchor element as a child.\n * <Button asChild><a href=\"/home\">Home</a></Button>\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n asChild,\n children,\n variant = \"primary\",\n size = \"large\",\n fullWidth = false,\n icon = false,\n className,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : \"button\";\n\n return (\n <Component\n className={clsx(\n \"hds-button\",\n `hds-button--${size}`,\n `hds-button--${variant}`,\n {\n \"hds-button--full\": fullWidth === true,\n \"hds-button--mobile-full\": fullWidth === \"mobile\",\n \"hds-button--only-icon\": icon === true,\n \"hds-button--leading-icon\": icon === \"leading\",\n \"hds-button--trailing-icon\": icon === \"trailing\",\n },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nButton.displayName = \"Button\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AA4Ef;AAjBC,IAAM,aAAS;AAAA,EACpB,CACE,IAUA,QACG;AAXH,iBACE;AAAA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,OAAO;AAAA,MACP;AAAA,IAtEN,IA+DI,IAQK,iBARL,IAQK;AAAA,MAPH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,YAAY,UAAU,yBAAO;AAEnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,eAAe,IAAI;AAAA,UACnB,eAAe,OAAO;AAAA,UACtB;AAAA,YACE,oBAAoB,cAAc;AAAA,YAClC,2BAA2B,cAAc;AAAA,YACzC,yBAAyB,SAAS;AAAA,YAClC,4BAA4B,SAAS;AAAA,YACrC,6BAA6B,SAAS;AAAA,UACxC;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,SACI,OAfL;AAAA,QAiBE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
package/dist/button/button.mjs
CHANGED
package/dist/button/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/button/index.tsx","../../src/button/button.tsx"],"sourcesContent":["export { Button } from \"./button\";\n\nexport type * from \"./button\";\n","import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n *\n * @default \"large\"\n */\n size?: \"small\" | \"large\";\n\n /**\n * The background and fill of the button\n *\n * @default \"primary\"\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\" |
|
|
1
|
+
{"version":3,"sources":["../../src/button/index.tsx","../../src/button/button.tsx"],"sourcesContent":["export { Button } from \"./button\";\n\nexport type * from \"./button\";\n","import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\n/**\n * @deprecated The \"inverted\" variant is deprecated. Use \"primary\", \"secondary\", or \"tertiary\" instead.\n */\nexport type DeprecatedVariant = \"inverted\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n *\n * @default \"large\"\n */\n size?: \"small\" | \"large\";\n\n /**\n * The background and fill of the button\n *\n * @default \"primary\"\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\" | DeprecatedVariant;\n\n /**\n * Make the button use 100% width available.\n * Using the \"mobile\" it only stretch to full width on smaller screens\n */\n fullWidth?: boolean | \"mobile\";\n\n /**\n * Specify that there is an icon in the button.\n * `icon`: There is only an icon in the button.\n * `icon=\"leading\"`: There is an icon before the text.\n * `icon=\"trailing\"`: There is an icon after the text.\n *\n * @default false\n */\n icon?: boolean | \"leading\" | \"trailing\";\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * Button component\n *\n * @example\n * <Button variant=\"primary\">Primary</Button>\n * <Button variant=\"secondary\" size=\"large\">Secondary</Button>\n * <Button variant=\"tertiary\" fullWidth=\"mobile\">Tertiary</Button>\n * <Button icon=\"leading\"><LeadingIcon />Leading icon</Button>\n *\n * @example\n * // If used for navigation use the `asChild` prop with a anchor element as a child.\n * <Button asChild><a href=\"/home\">Home</a></Button>\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n asChild,\n children,\n variant = \"primary\",\n size = \"large\",\n fullWidth = false,\n icon = false,\n className,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : \"button\";\n\n return (\n <Component\n className={clsx(\n \"hds-button\",\n `hds-button--${size}`,\n `hds-button--${variant}`,\n {\n \"hds-button--full\": fullWidth === true,\n \"hds-button--mobile-full\": fullWidth === \"mobile\",\n \"hds-button--only-icon\": icon === true,\n \"hds-button--leading-icon\": icon === \"leading\",\n \"hds-button--trailing-icon\": icon === \"trailing\",\n },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nButton.displayName = \"Button\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AA4Ef;AAjBC,IAAM,aAAS;AAAA,EACpB,CACE,IAUA,QACG;AAXH,iBACE;AAAA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,OAAO;AAAA,MACP;AAAA,IAtEN,IA+DI,IAQK,iBARL,IAQK;AAAA,MAPH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,YAAY,UAAU,yBAAO;AAEnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,eAAe,IAAI;AAAA,UACnB,eAAe,OAAO;AAAA,UACtB;AAAA,YACE,oBAAoB,cAAc;AAAA,YAClC,2BAA2B,cAAc;AAAA,YACzC,yBAAyB,SAAS;AAAA,YAClC,4BAA4B,SAAS;AAAA,YACrC,6BAA6B,SAAS;AAAA,UACxC;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,SACI,OAfL;AAAA,QAiBE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
package/dist/button/index.mjs
CHANGED
package/dist/card/card.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface CardImageMediaProps extends React.ImgHTMLAttributes<HTMLImageEl
|
|
|
15
15
|
* "scale": No cropping, image scales to the maximum size available and centers.
|
|
16
16
|
* If the aspect ratio doesn't match, then the background will show on the top/bottom or left/right sides of the image.
|
|
17
17
|
*
|
|
18
|
-
* @default "
|
|
18
|
+
* @default "scale"
|
|
19
19
|
*/
|
|
20
20
|
variant?: "crop" | "scale";
|
|
21
21
|
}
|
package/dist/card/card.js
CHANGED
|
@@ -83,7 +83,7 @@ var CardMediaImg = (0, import_react.forwardRef)(
|
|
|
83
83
|
__spreadProps(__spreadValues({}, rest), {
|
|
84
84
|
className: (0, import_typed_classname.clsx)(
|
|
85
85
|
"hds-card__media__img",
|
|
86
|
-
{ "hds-
|
|
86
|
+
{ "hds-card__img__crop": variant === "crop" },
|
|
87
87
|
className
|
|
88
88
|
),
|
|
89
89
|
ref
|
package/dist/card/card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/card/card.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport const CardMedia = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component {...rest} className={clsx(\"hds-card__media\", className as undefined)} ref={ref}>\n {children}\n </Component>\n );\n },\n);\nCardMedia.displayName = \"Card.Media\";\n\nexport interface CardImageMediaProps extends React.ImgHTMLAttributes<HTMLImageElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n /**\n * Define image scaling behavior when the image are varies in both width and height across different page breaks and sizes of the card.\n * \"crop\": Image always fills the available space.\n * If the aspect ratio doesn't match, then the top/bottom or left/right edges are cropped away.\n * \"scale\": No cropping, image scales to the maximum size available and centers.\n * If the aspect ratio doesn't match, then the background will show on the top/bottom or left/right sides of the image.\n *\n * @default \"crop\"\n */\n variant?: \"crop\" | \"scale\";\n}\nexport const CardMediaImg = forwardRef<HTMLImageElement, CardImageMediaProps>(\n ({ asChild, variant, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"img\";\n return (\n <Component\n {...rest}\n className={clsx(\n \"hds-card__media__img\",\n { \"hds-card__img__scale\": variant === \"scale\" },\n className as undefined,\n )}\n ref={ref}\n />\n );\n },\n);\nCardMediaImg.displayName = \"Card.MediaImg\";\n\nexport const CardBody = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component {...rest} className={clsx(\"hds-card__body\", className as undefined)} ref={ref}>\n <div className={clsx(\"hds-card__centerbody\", className as undefined)}>{children}</div>\n </Component>\n );\n },\n);\nCardBody.displayName = \"Card.Body\";\n\nexport const CardBodyHeader = forwardRef<\n HTMLHeadingElement,\n CardBaseProps &\n (\n | {\n /**\n * Heading level of the card heading\n */\n as: \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n asChild?: never;\n }\n | {\n asChild: true;\n as?: never;\n }\n )\n>(({ as: Tag, asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : Tag;\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n});\nCardBodyHeader.displayName = \"Card.BodyHeader\";\n\nexport const CardBodyHeaderOverline = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header-overline\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyHeaderOverline.displayName = \"Card.BodyHeaderOverline\";\n\nexport const CardBodyHeaderTitle = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header-title\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyHeaderTitle.displayName = \"Card.BodyHeaderTitle\";\n\nexport const CardBodyDescription = forwardRef<HTMLParagraphElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"p\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-description\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyDescription.displayName = \"Card.BodyDescription\";\n\nexport const CardBodyAction = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-action\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyAction.displayName = \"Card.BodyAction\";\n\nexport const CardBodyActionRow = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-action-row\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyActionRow.displayName = \"Card.BodyActionRow\";\n\ninterface CardBodyActionArrowProps extends React.HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n\n /**\n * Set direction of the arrow\n *\n * @default \"right\"\n */\n direction?: \"right\" | \"up-right\";\n}\nexport const CardBodyActionArrow = forwardRef<HTMLSpanElement, CardBodyActionArrowProps>(\n ({ asChild, className, direction, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n {...rest}\n className={clsx(\n \"hds-card__body-action-arrow\",\n { \"hds-card__body-action-arrow-up-right\": direction === \"up-right\" },\n className as undefined,\n )}\n ref={ref}\n />\n );\n },\n);\nCardBodyActionArrow.displayName = \"Card.BodyActionArrow\";\n\nexport interface CardBaseProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in a future release.\n * Use `CardSlimAndMiniatureProps` with props `data-color` and `theme` instead.\n */\nexport interface CardSlimAndMiniaturePropsDeprecated extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n /**\n * Allows for a horizontal variant for sizes above small.\n *\n * @default \"slim\"\n */\n variant?: \"slim\" | \"miniature\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * @deprecated\n * Use props `data-color` and `theme` instead.\n * These colors will be removed in a future release.\n */\n color?: \"white\" | \"lighter-brand\" | \"light-grey-fill\";\n\n /* Only fullwidth or focus cards can have images to the left or right of the text: */\n imagePosition?: never;\n}\n\nexport interface CardSlimAndMiniatureProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n /**\n * Allows for a horizontal variant for sizes above small.\n *\n * @default \"slim\"\n */\n variant?: \"slim\" | \"miniature\";\n /**\n * Set theme for card\n * @default \"default\"\n */\n theme?: \"default\" | \"tinted\" | \"base\";\n /**\n * Set data-color for card.\n */\n \"data-color\"?: \"neutral\" | \"posten\" | \"bring\";\n /* Only fullwidth or focus cards can have images to the left or right of the text: */\n imagePosition?: never;\n}\n\n/**\n * @deprecated Use Full-width card instead\n */\nexport interface CardFocusProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n /** @deprecated Use Full-width card instead */\n variant: \"focus\";\n /**\n * @deprecated\n * Use props `data-color` and `theme` instead.\n * The color prop will be removed in a future release.\n */\n color?: \"darker\" | \"dark\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in a future release.\n * Use `CardSlimAndMiniatureProps` with props `data-color` and `theme` instead.\n */\nexport interface CardFullwidthPropsDeprecated extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"full-width\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * @deprecated\n * Use `data-color` and `theme` instead.\n * The color prop will be removed in a future release.\n */\n color: \"white\" | \"lighter-brand\" | \"light-grey-fill\";\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\nexport interface CardFullwidthProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"full-width\";\n /**\n * Set theme for card\n * @default \"default\"\n */\n theme?: \"default\" | \"tinted\" | \"base\";\n /**\n * Set data-color for card.\n */\n \"data-color\"?: \"neutral\" | \"posten\" | \"bring\";\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\nexport type CardProps =\n | CardSlimAndMiniatureProps\n | CardFocusProps\n | CardFullwidthProps\n | CardSlimAndMiniaturePropsDeprecated\n | CardFullwidthPropsDeprecated;\n\n/**\n * Converts deprecated colors to current colors\n * @param color\n * @returns\n */\nconst convertDeprecatedColor = (\n color: string | undefined,\n): Partial<{\n theme: NonNullable<CardSlimAndMiniatureProps[\"theme\"]>;\n dataColor: NonNullable<CardSlimAndMiniatureProps[\"data-color\"]>;\n dataColorScheme: \"light\" | \"dark\";\n}> => {\n switch (color) {\n case \"lighter-brand\":\n return { theme: \"default\" };\n case \"light-grey-fill\":\n return { theme: \"base\", dataColor: \"neutral\" };\n case \"white\":\n return { theme: \"default\", dataColor: \"neutral\" };\n case \"dark\":\n return { theme: \"base\" };\n case \"darker\":\n return { theme: \"tinted\", dataColorScheme: \"dark\" };\n default:\n return {};\n }\n};\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n (\n {\n as: Tag = \"section\",\n asChild,\n className,\n children,\n variant = \"slim\",\n \"data-color\": dataColorAttr,\n theme = \"default\",\n color,\n imagePosition,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : Tag;\n\n const {\n theme: themeFromDeprecated,\n dataColor: dataColorFromDeprecated,\n dataColorScheme: dataColorSchemeFromDeprecated,\n } = convertDeprecatedColor(color ?? (variant === \"focus\" ? \"darker\" : undefined));\n\n return (\n <Component\n {...rest}\n {...(dataColorAttr ? { \"data-color\": dataColorAttr } : {})}\n {...(dataColorFromDeprecated ? { \"data-color\": dataColorFromDeprecated } : {})}\n {...(dataColorSchemeFromDeprecated\n ? { \"data-color-scheme\": dataColorSchemeFromDeprecated }\n : {})}\n className={clsx(\n \"hds-card\",\n { \"hds-card--full-width\": variant === \"full-width\" },\n { \"hds-card--miniature\": variant === \"miniature\" },\n { \"hds-card--focus\": variant === \"focus\" }, // @deprecated\n { \"hds-card--slim\": variant === \"slim\" },\n { \"hds-card--theme-default\": (themeFromDeprecated ?? theme) === \"default\" },\n { \"hds-card--theme-tinted\": (themeFromDeprecated ?? theme) === \"tinted\" },\n { \"hds-card--theme-base\": (themeFromDeprecated ?? theme) === \"base\" },\n { \"hds-card--image-position-right\": imagePosition === \"right\" },\n className as undefined,\n )}\n ref={ref}\n >\n {variant === \"full-width\" || variant === \"focus\" ? (\n <div className={clsx(\"hds-card__layoutwrapper\", className as undefined)}>{children}</div>\n ) : (\n children\n )}\n </Component>\n );\n },\n) as CardType;\nCard.displayName = \"Card\";\n\nCard.Media = CardMedia;\nCard.MediaImg = CardMediaImg;\nCard.Body = CardBody;\nCard.BodyHeader = CardBodyHeader;\nCard.BodyHeaderOverline = CardBodyHeaderOverline;\nCard.BodyHeaderTitle = CardBodyHeaderTitle;\nCard.BodyDescription = CardBodyDescription;\nCard.BodyAction = CardBodyAction;\nCard.BodyActionRow = CardBodyActionRow;\nCard.BodyActionArrow = CardBodyActionArrow;\n\ntype CardType = ReturnType<typeof forwardRef<HTMLDivElement, CardProps>> & {\n Media: typeof CardMedia;\n MediaImg: typeof CardMediaImg;\n Body: typeof CardBody;\n BodyHeader: typeof CardBodyHeader;\n BodyHeaderOverline: typeof CardBodyHeaderOverline;\n BodyHeaderTitle: typeof CardBodyHeaderTitle;\n BodyDescription: typeof CardBodyDescription;\n BodyAction: typeof CardBodyAction;\n BodyActionRow: typeof CardBodyActionRow;\n BodyActionArrow: typeof CardBodyActionArrow;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA2B;AAC3B,6B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,EAEJ;AACF;AACA,KAAK,cAAc;AAEnB,KAAK,QAAQ;AACb,KAAK,WAAW;AAChB,KAAK,OAAO;AACZ,KAAK,aAAa;AAClB,KAAK,qBAAqB;AAC1B,KAAK,kBAAkB;AACvB,KAAK,kBAAkB;AACvB,KAAK,aAAa;AAClB,KAAK,gBAAgB;AACrB,KAAK,kBAAkB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/card/card.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport const CardMedia = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component {...rest} className={clsx(\"hds-card__media\", className as undefined)} ref={ref}>\n {children}\n </Component>\n );\n },\n);\nCardMedia.displayName = \"Card.Media\";\n\nexport interface CardImageMediaProps extends React.ImgHTMLAttributes<HTMLImageElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n /**\n * Define image scaling behavior when the image are varies in both width and height across different page breaks and sizes of the card.\n * \"crop\": Image always fills the available space.\n * If the aspect ratio doesn't match, then the top/bottom or left/right edges are cropped away.\n * \"scale\": No cropping, image scales to the maximum size available and centers.\n * If the aspect ratio doesn't match, then the background will show on the top/bottom or left/right sides of the image.\n *\n * @default \"scale\"\n */\n variant?: \"crop\" | \"scale\";\n}\nexport const CardMediaImg = forwardRef<HTMLImageElement, CardImageMediaProps>(\n ({ asChild, variant, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"img\";\n return (\n <Component\n {...rest}\n className={clsx(\n \"hds-card__media__img\",\n { \"hds-card__img__crop\": variant === \"crop\" },\n className as undefined,\n )}\n ref={ref}\n />\n );\n },\n);\nCardMediaImg.displayName = \"Card.MediaImg\";\n\nexport const CardBody = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component {...rest} className={clsx(\"hds-card__body\", className as undefined)} ref={ref}>\n <div className={clsx(\"hds-card__centerbody\", className as undefined)}>{children}</div>\n </Component>\n );\n },\n);\nCardBody.displayName = \"Card.Body\";\n\nexport const CardBodyHeader = forwardRef<\n HTMLHeadingElement,\n CardBaseProps &\n (\n | {\n /**\n * Heading level of the card heading\n */\n as: \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n asChild?: never;\n }\n | {\n asChild: true;\n as?: never;\n }\n )\n>(({ as: Tag, asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : Tag;\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n});\nCardBodyHeader.displayName = \"Card.BodyHeader\";\n\nexport const CardBodyHeaderOverline = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header-overline\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyHeaderOverline.displayName = \"Card.BodyHeaderOverline\";\n\nexport const CardBodyHeaderTitle = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header-title\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyHeaderTitle.displayName = \"Card.BodyHeaderTitle\";\n\nexport const CardBodyDescription = forwardRef<HTMLParagraphElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"p\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-description\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyDescription.displayName = \"Card.BodyDescription\";\n\nexport const CardBodyAction = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-action\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyAction.displayName = \"Card.BodyAction\";\n\nexport const CardBodyActionRow = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-action-row\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyActionRow.displayName = \"Card.BodyActionRow\";\n\ninterface CardBodyActionArrowProps extends React.HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n\n /**\n * Set direction of the arrow\n *\n * @default \"right\"\n */\n direction?: \"right\" | \"up-right\";\n}\nexport const CardBodyActionArrow = forwardRef<HTMLSpanElement, CardBodyActionArrowProps>(\n ({ asChild, className, direction, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n {...rest}\n className={clsx(\n \"hds-card__body-action-arrow\",\n { \"hds-card__body-action-arrow-up-right\": direction === \"up-right\" },\n className as undefined,\n )}\n ref={ref}\n />\n );\n },\n);\nCardBodyActionArrow.displayName = \"Card.BodyActionArrow\";\n\nexport interface CardBaseProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in a future release.\n * Use `CardSlimAndMiniatureProps` with props `data-color` and `theme` instead.\n */\nexport interface CardSlimAndMiniaturePropsDeprecated extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n /**\n * Allows for a horizontal variant for sizes above small.\n *\n * @default \"slim\"\n */\n variant?: \"slim\" | \"miniature\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * @deprecated\n * Use props `data-color` and `theme` instead.\n * These colors will be removed in a future release.\n */\n color?: \"white\" | \"lighter-brand\" | \"light-grey-fill\";\n\n /* Only fullwidth or focus cards can have images to the left or right of the text: */\n imagePosition?: never;\n}\n\nexport interface CardSlimAndMiniatureProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n /**\n * Allows for a horizontal variant for sizes above small.\n *\n * @default \"slim\"\n */\n variant?: \"slim\" | \"miniature\";\n /**\n * Set theme for card\n * @default \"default\"\n */\n theme?: \"default\" | \"tinted\" | \"base\";\n /**\n * Set data-color for card.\n */\n \"data-color\"?: \"neutral\" | \"posten\" | \"bring\";\n /* Only fullwidth or focus cards can have images to the left or right of the text: */\n imagePosition?: never;\n}\n\n/**\n * @deprecated Use Full-width card instead\n */\nexport interface CardFocusProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n /** @deprecated Use Full-width card instead */\n variant: \"focus\";\n /**\n * @deprecated\n * Use props `data-color` and `theme` instead.\n * The color prop will be removed in a future release.\n */\n color?: \"darker\" | \"dark\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in a future release.\n * Use `CardSlimAndMiniatureProps` with props `data-color` and `theme` instead.\n */\nexport interface CardFullwidthPropsDeprecated extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"full-width\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * @deprecated\n * Use `data-color` and `theme` instead.\n * The color prop will be removed in a future release.\n */\n color: \"white\" | \"lighter-brand\" | \"light-grey-fill\";\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\nexport interface CardFullwidthProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"full-width\";\n /**\n * Set theme for card\n * @default \"default\"\n */\n theme?: \"default\" | \"tinted\" | \"base\";\n /**\n * Set data-color for card.\n */\n \"data-color\"?: \"neutral\" | \"posten\" | \"bring\";\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\nexport type CardProps =\n | CardSlimAndMiniatureProps\n | CardFocusProps\n | CardFullwidthProps\n | CardSlimAndMiniaturePropsDeprecated\n | CardFullwidthPropsDeprecated;\n\n/**\n * Converts deprecated colors to current colors\n * @param color\n * @returns\n */\nconst convertDeprecatedColor = (\n color: string | undefined,\n): Partial<{\n theme: NonNullable<CardSlimAndMiniatureProps[\"theme\"]>;\n dataColor: NonNullable<CardSlimAndMiniatureProps[\"data-color\"]>;\n dataColorScheme: \"light\" | \"dark\";\n}> => {\n switch (color) {\n case \"lighter-brand\":\n return { theme: \"default\" };\n case \"light-grey-fill\":\n return { theme: \"base\", dataColor: \"neutral\" };\n case \"white\":\n return { theme: \"default\", dataColor: \"neutral\" };\n case \"dark\":\n return { theme: \"base\" };\n case \"darker\":\n return { theme: \"tinted\", dataColorScheme: \"dark\" };\n default:\n return {};\n }\n};\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n (\n {\n as: Tag = \"section\",\n asChild,\n className,\n children,\n variant = \"slim\",\n \"data-color\": dataColorAttr,\n theme = \"default\",\n color,\n imagePosition,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : Tag;\n\n const {\n theme: themeFromDeprecated,\n dataColor: dataColorFromDeprecated,\n dataColorScheme: dataColorSchemeFromDeprecated,\n } = convertDeprecatedColor(color ?? (variant === \"focus\" ? \"darker\" : undefined));\n\n return (\n <Component\n {...rest}\n {...(dataColorAttr ? { \"data-color\": dataColorAttr } : {})}\n {...(dataColorFromDeprecated ? { \"data-color\": dataColorFromDeprecated } : {})}\n {...(dataColorSchemeFromDeprecated\n ? { \"data-color-scheme\": dataColorSchemeFromDeprecated }\n : {})}\n className={clsx(\n \"hds-card\",\n { \"hds-card--full-width\": variant === \"full-width\" },\n { \"hds-card--miniature\": variant === \"miniature\" },\n { \"hds-card--focus\": variant === \"focus\" }, // @deprecated\n { \"hds-card--slim\": variant === \"slim\" },\n { \"hds-card--theme-default\": (themeFromDeprecated ?? theme) === \"default\" },\n { \"hds-card--theme-tinted\": (themeFromDeprecated ?? theme) === \"tinted\" },\n { \"hds-card--theme-base\": (themeFromDeprecated ?? theme) === \"base\" },\n { \"hds-card--image-position-right\": imagePosition === \"right\" },\n className as undefined,\n )}\n ref={ref}\n >\n {variant === \"full-width\" || variant === \"focus\" ? (\n <div className={clsx(\"hds-card__layoutwrapper\", className as undefined)}>{children}</div>\n ) : (\n children\n )}\n </Component>\n );\n },\n) as CardType;\nCard.displayName = \"Card\";\n\nCard.Media = CardMedia;\nCard.MediaImg = CardMediaImg;\nCard.Body = CardBody;\nCard.BodyHeader = CardBodyHeader;\nCard.BodyHeaderOverline = CardBodyHeaderOverline;\nCard.BodyHeaderTitle = CardBodyHeaderTitle;\nCard.BodyDescription = CardBodyDescription;\nCard.BodyAction = CardBodyAction;\nCard.BodyActionRow = CardBodyActionRow;\nCard.BodyActionArrow = CardBodyActionArrow;\n\ntype CardType = ReturnType<typeof forwardRef<HTMLDivElement, CardProps>> & {\n Media: typeof CardMedia;\n MediaImg: typeof CardMediaImg;\n Body: typeof CardBody;\n BodyHeader: typeof CardBodyHeader;\n BodyHeaderOverline: typeof CardBodyHeaderOverline;\n BodyHeaderTitle: typeof CardBodyHeaderTitle;\n BodyDescription: typeof CardBodyDescription;\n BodyAction: typeof CardBodyAction;\n BodyActionRow: typeof CardBodyActionRow;\n BodyActionArrow: typeof CardBodyActionArrow;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AAMf;AAJC,IAAM,gBAAY;AAAA,EACvB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SANzB,IAMG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE,4CAAC,4CAAc,OAAd,EAAoB,eAAW,6BAAK,mBAAmB,SAAsB,GAAG,KAC9E,WACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAoBjB,IAAM,mBAAe;AAAA,EAC1B,CAAC,IAA0C,QAAQ;AAAlD,iBAAE,WAAS,SAAS,UApCvB,IAoCG,IAAkC,iBAAlC,IAAkC,CAAhC,WAAS,WAAS;AACnB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA,uCACK,OADL;AAAA,QAEC,eAAW;AAAA,UACT;AAAA,UACA,EAAE,uBAAuB,YAAY,OAAO;AAAA,UAC5C;AAAA,QACF;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,aAAa,cAAc;AAEpB,IAAM,eAAW;AAAA,EACtB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SAtDzB,IAsDG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE,4CAAC,4CAAc,OAAd,EAAoB,eAAW,6BAAK,kBAAkB,SAAsB,GAAG,KAC9E,sDAAC,SAAI,eAAW,6BA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1E,EAAE,2BAA2B,oDAAuB,WAAW,SAAS;AAAA,UACxE,EAAE,yBAAyB,oDAAuB,WAAW,OAAO;AAAA,UACpE,EAAE,kCAAkC,kBAAkB,QAAQ;AAAA,UAC9D;AAAA,QACF;AAAA,QACA;AAAA,QAEC,sBAAY,gBAAgB,YAAY,UACvC,4CAAC,SAAI,eAAW,6BAAK,2BAA2B,SAAsB,GAAI,UAAS,IAEnF;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AACA,KAAK,cAAc;AAEnB,KAAK,QAAQ;AACb,KAAK,WAAW;AAChB,KAAK,OAAO;AACZ,KAAK,aAAa;AAClB,KAAK,qBAAqB;AAC1B,KAAK,kBAAkB;AACvB,KAAK,kBAAkB;AACvB,KAAK,aAAa;AAClB,KAAK,gBAAgB;AACrB,KAAK,kBAAkB;","names":[]}
|
package/dist/card/card.mjs
CHANGED
package/dist/card/index.js
CHANGED
|
@@ -84,7 +84,7 @@ var CardMediaImg = (0, import_react.forwardRef)(
|
|
|
84
84
|
__spreadProps(__spreadValues({}, rest), {
|
|
85
85
|
className: (0, import_typed_classname.clsx)(
|
|
86
86
|
"hds-card__media__img",
|
|
87
|
-
{ "hds-
|
|
87
|
+
{ "hds-card__img__crop": variant === "crop" },
|
|
88
88
|
className
|
|
89
89
|
),
|
|
90
90
|
ref
|