@swisspost/design-system-components 10.0.0-next.75 → 10.0.0-next.76
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/cjs/{create-validator-decorator-Bimhl6Ib.js → create-validator-decorator-4dRrOF30.js} +1 -1
- package/dist/cjs/{index-CyeY2muT.js → index-BqngpwGa.js} +11 -15
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{one-of-BVQP1dR3.js → one-of-D1veqtsm.js} +1 -1
- package/dist/cjs/{package-JSyXVavg.js → package-B0PdQ0Dm.js} +1 -1
- package/dist/cjs/{pattern-BDKu8-v6.js → pattern-B7VKOu5m.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +10 -12
- package/dist/cjs/post-autocomplete.cjs.entry.js +6 -6
- package/dist/cjs/post-avatar.cjs.entry.js +7 -7
- package/dist/cjs/post-back-to-top.cjs.entry.js +6 -6
- package/dist/cjs/post-banner.cjs.entry.js +5 -5
- package/dist/cjs/post-breadcrumb-item.cjs.entry.js +7 -7
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +7 -7
- package/dist/cjs/post-closebutton_14.cjs.entry.js +41 -35
- package/dist/cjs/post-collapsible_2.cjs.entry.js +6 -6
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-date-picker.cjs.entry.js +427 -257
- package/dist/cjs/post-footer.cjs.entry.js +6 -6
- package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
- package/dist/cjs/post-listbox-option.cjs.entry.js +4 -4
- package/dist/cjs/post-listbox.cjs.entry.js +3 -3
- package/dist/cjs/post-number-input.cjs.entry.js +5 -4
- package/dist/cjs/post-pagination.cjs.entry.js +5 -5
- package/dist/cjs/post-popover-trigger.cjs.entry.js +5 -5
- package/dist/cjs/post-popover.cjs.entry.js +11 -12
- package/dist/cjs/post-progressbar.cjs.entry.js +4 -4
- package/dist/cjs/post-rating.cjs.entry.js +6 -6
- package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +7 -7
- package/dist/cjs/post-side-navigation.cjs.entry.js +18 -7
- package/dist/cjs/post-stepper-item.cjs.entry.js +3 -3
- package/dist/cjs/post-stepper.cjs.entry.js +7 -7
- package/dist/cjs/post-tab-item.cjs.entry.js +15 -14
- package/dist/cjs/post-tab-panel.cjs.entry.js +6 -6
- package/dist/cjs/post-tabs.cjs.entry.js +196 -74
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +7 -9
- package/dist/cjs/post-tooltip.cjs.entry.js +9 -10
- package/dist/cjs/{required-BsZuSJAl.js → required-Bkz8MOYa.js} +1 -1
- package/dist/cjs/{type-DXpEWY0w.js → type-D8eD1JMd.js} +1 -1
- package/dist/cjs/{url-D-EbWRlF.js → url-C7MnIIZ_.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -2
- package/dist/collection/components/post-accordion/post-accordion.js +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +4 -36
- package/dist/collection/components/post-autocomplete/post-autocomplete.js +1 -1
- package/dist/collection/components/post-avatar/post-avatar.js +1 -1
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +1 -1
- package/dist/collection/components/post-banner/post-banner.js +1 -1
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +1 -1
- package/dist/collection/components/post-closebutton/post-closebutton.js +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +1 -1
- package/dist/collection/components/post-date-picker/accessibility-utils.js +59 -0
- package/dist/collection/components/post-date-picker/date-utils.js +102 -0
- package/dist/collection/components/post-date-picker/native-mask-element.js +36 -0
- package/dist/collection/components/post-date-picker/post-date-picker.css +1 -1
- package/dist/collection/components/post-date-picker/post-date-picker.js +224 -301
- package/dist/collection/components/post-footer/post-footer.js +1 -1
- package/dist/collection/components/post-header/post-header.js +6 -5
- package/dist/collection/components/post-icon/post-icon.js +1 -1
- package/dist/collection/components/post-language-menu/post-language-menu.js +7 -5
- package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
- package/dist/collection/components/post-listbox/post-listbox.js +1 -1
- package/dist/collection/components/post-listbox-option/post-listbox-option.js +2 -2
- package/dist/collection/components/post-logo/post-logo.js +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +1 -1
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +1 -1
- package/dist/collection/components/post-menu/post-menu.js +9 -12
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
- package/dist/collection/components/post-number-input/post-number-input.js +3 -2
- package/dist/collection/components/post-popover/post-popover.js +12 -22
- package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +13 -9
- package/dist/collection/components/post-progressbar/post-progressbar.js +1 -1
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
- package/dist/collection/components/post-side-navigation/post-side-navigation.js +38 -2
- package/dist/collection/components/post-side-navigation/side-navigation-styles.js +1 -0
- package/dist/collection/components/post-side-navigation-trigger/post-side-navigation-trigger.css +1 -1
- package/dist/collection/components/post-side-navigation-trigger/post-side-navigation-trigger.js +1 -1
- package/dist/collection/components/post-stepper/post-stepper.js +1 -1
- package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
- package/dist/collection/components/post-tab-item/post-tab-item.js +36 -19
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +3 -2
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +255 -84
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +12 -22
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +2 -4
- package/dist/collection/types/element-api.js +3 -0
- package/dist/component-names.json +0 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +1 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +1 -1
- package/dist/components/post-accordion2.js +1 -1
- package/dist/components/post-autocomplete.js +1 -1
- package/dist/components/post-avatar.js +1 -1
- package/dist/components/post-back-to-top.js +1 -1
- package/dist/components/post-banner.js +1 -1
- package/dist/components/post-breadcrumbs.js +1 -1
- package/dist/components/post-closebutton2.js +1 -1
- package/dist/components/post-collapsible-trigger2.js +1 -1
- package/dist/components/post-collapsible2.js +1 -1
- package/dist/components/post-date-picker.js +1 -1
- package/dist/components/post-footer.js +1 -1
- package/dist/components/post-header.js +1 -1
- package/dist/components/post-icon2.js +1 -1
- package/dist/components/post-language-menu.js +1 -1
- package/dist/components/post-linkarea.js +1 -1
- package/dist/components/post-listbox-option.js +1 -1
- package/dist/components/post-listbox.js +1 -1
- package/dist/components/post-logo.js +1 -1
- package/dist/components/post-mainnavigation.js +1 -1
- package/dist/components/post-megadropdown-trigger.js +1 -1
- package/dist/components/post-megadropdown.js +1 -1
- package/dist/components/post-menu-trigger2.js +1 -1
- package/dist/components/post-menu2.js +1 -1
- package/dist/components/post-number-input.js +1 -1
- package/dist/components/post-popover-trigger.js +1 -1
- package/dist/components/post-popover.js +1 -1
- package/dist/components/post-popovercontainer2.js +1 -1
- package/dist/components/post-progressbar.js +1 -1
- package/dist/components/post-rating.js +1 -1
- package/dist/components/post-side-navigation-trigger.js +1 -1
- package/dist/components/post-side-navigation.js +1 -1
- package/dist/components/post-stepper-item.js +1 -1
- package/dist/components/post-stepper.js +1 -1
- package/dist/components/post-tab-item.js +1 -1
- package/dist/components/post-tab-panel.js +1 -1
- package/dist/components/post-tabs.js +1 -1
- package/dist/components/post-togglebutton2.js +1 -1
- package/dist/components/post-tooltip-trigger.js +1 -1
- package/dist/components/post-tooltip.js +1 -1
- package/dist/components/react/index.js +1 -1
- package/dist/components/react/{p-DU4XzTGt.js → p-06VKKzxv.js} +1 -1
- package/dist/components/react/p-BkWqx_6U.js +1 -0
- package/dist/components/react/p-Chtl9X7o.js +1 -0
- package/dist/components/react/{p-CbU3QFNG.js → p-CrLBbthi.js} +1 -1
- package/dist/components/react/{p-BUSQG9af.js → p-D0kuUny7.js} +1 -1
- package/dist/components/react/{p-DNddZV_h.js → p-DKF__bJF.js} +1 -1
- package/dist/components/react/p-DkKOmXaG.js +1 -0
- package/dist/components/react/{p-ztiqEfbC.js → p-UdMqVxhd.js} +1 -1
- package/dist/components/react/p-d02KpeUM.js +1 -0
- package/dist/components/react/{p-B3ZJPCU0.js → p-gUhGka9h.js} +1 -1
- package/dist/components/react/{p-BUAS73l8.js → p-uQE3DVb8.js} +1 -1
- package/dist/components/react/{p-DTg2SXJj.js → p-wLn52OZT.js} +1 -1
- package/dist/components/react/post-accordion-item.js +1 -1
- package/dist/components/react/post-accordion.js +1 -1
- package/dist/components/react/post-autocomplete.js +1 -1
- package/dist/components/react/post-avatar.js +1 -1
- package/dist/components/react/post-back-to-top.js +1 -1
- package/dist/components/react/post-banner.js +1 -1
- package/dist/components/react/post-breadcrumb-item.js +1 -1
- package/dist/components/react/post-breadcrumbs.js +1 -1
- package/dist/components/react/post-closebutton.js +1 -1
- package/dist/components/react/post-collapsible-trigger.js +1 -1
- package/dist/components/react/post-collapsible.js +1 -1
- package/dist/components/react/post-date-picker.js +1 -1
- package/dist/components/react/post-footer.js +1 -1
- package/dist/components/react/post-header.js +1 -1
- package/dist/components/react/post-icon.js +1 -1
- package/dist/components/react/post-language-menu-item.js +1 -1
- package/dist/components/react/post-language-menu.js +1 -1
- package/dist/components/react/post-linkarea.js +1 -1
- package/dist/components/react/post-listbox-option.js +1 -1
- package/dist/components/react/post-listbox.js +1 -1
- package/dist/components/react/post-logo.js +1 -1
- package/dist/components/react/post-mainnavigation.js +1 -1
- package/dist/components/react/post-megadropdown-trigger.js +1 -1
- package/dist/components/react/post-megadropdown.js +1 -1
- package/dist/components/react/post-menu-item.js +1 -1
- package/dist/components/react/post-menu-trigger.js +1 -1
- package/dist/components/react/post-menu.js +1 -1
- package/dist/components/react/post-number-input.js +1 -1
- package/dist/components/react/post-pagination.js +1 -1
- package/dist/components/react/post-popover-trigger.js +1 -1
- package/dist/components/react/post-popover.js +1 -1
- package/dist/components/react/post-popovercontainer.js +1 -1
- package/dist/components/react/post-progressbar.js +1 -1
- package/dist/components/react/post-rating.js +1 -1
- package/dist/components/react/post-side-navigation-trigger.js +1 -1
- package/dist/components/react/post-side-navigation.js +1 -1
- package/dist/components/react/post-stepper-item.js +1 -1
- package/dist/components/react/post-stepper.js +1 -1
- package/dist/components/react/post-tab-item.js +1 -1
- package/dist/components/react/post-tab-panel.js +1 -1
- package/dist/components/react/post-tabs.js +1 -1
- package/dist/components/react/post-togglebutton.js +1 -1
- package/dist/components/react/post-tooltip-trigger.js +1 -1
- package/dist/components/react/post-tooltip.js +1 -1
- package/dist/docs.json +287 -473
- package/dist/esm/{create-validator-decorator-BNkS_yAb.js → create-validator-decorator-CYYTw0AS.js} +1 -1
- package/dist/esm/{index-BGeKgZqi.js → index-DE1aWdqx.js} +11 -15
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{one-of-4BD_5pKR.js → one-of-Ug1_Xoes.js} +1 -1
- package/dist/esm/package-d02KpeUM.js +3 -0
- package/dist/esm/{pattern-D7tnGo1u.js → pattern-WLk4tOqI.js} +1 -1
- package/dist/esm/post-accordion_2.entry.js +10 -12
- package/dist/esm/post-autocomplete.entry.js +6 -6
- package/dist/esm/post-avatar.entry.js +7 -7
- package/dist/esm/post-back-to-top.entry.js +6 -6
- package/dist/esm/post-banner.entry.js +5 -5
- package/dist/esm/post-breadcrumb-item.entry.js +7 -7
- package/dist/esm/post-breadcrumbs.entry.js +7 -7
- package/dist/esm/post-closebutton_14.entry.js +41 -35
- package/dist/esm/post-collapsible_2.entry.js +6 -6
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-date-picker.entry.js +427 -257
- package/dist/esm/post-footer.entry.js +6 -6
- package/dist/esm/post-linkarea.entry.js +3 -3
- package/dist/esm/post-listbox-option.entry.js +4 -4
- package/dist/esm/post-listbox.entry.js +3 -3
- package/dist/esm/post-number-input.entry.js +5 -4
- package/dist/esm/post-pagination.entry.js +5 -5
- package/dist/esm/post-popover-trigger.entry.js +5 -5
- package/dist/esm/post-popover.entry.js +11 -12
- package/dist/esm/post-progressbar.entry.js +4 -4
- package/dist/esm/post-rating.entry.js +6 -6
- package/dist/esm/post-side-navigation-trigger.entry.js +7 -7
- package/dist/esm/post-side-navigation.entry.js +18 -7
- package/dist/esm/post-stepper-item.entry.js +3 -3
- package/dist/esm/post-stepper.entry.js +7 -7
- package/dist/esm/post-tab-item.entry.js +15 -14
- package/dist/esm/post-tab-panel.entry.js +6 -6
- package/dist/esm/post-tabs.entry.js +196 -74
- package/dist/esm/post-tooltip-trigger.entry.js +7 -9
- package/dist/esm/post-tooltip.entry.js +9 -10
- package/dist/esm/{required-DhBxDSbP.js → required-DeOhRbtk.js} +1 -1
- package/dist/esm/{type-icZlikjf.js → type-S-4aPMGU.js} +1 -1
- package/dist/esm/{url-B_2x2YCy.js → url-C8KSrmWc.js} +1 -1
- package/dist/post-components/p-0efb77f9.entry.js +1 -0
- package/dist/post-components/p-1223e51d.entry.js +1 -0
- package/dist/post-components/{p-41b5dbfc.entry.js → p-1878e9f8.entry.js} +1 -1
- package/dist/post-components/{p-97c1f070.entry.js → p-1eea2715.entry.js} +1 -1
- package/dist/post-components/{p-3e83aa1f.entry.js → p-2233c37e.entry.js} +1 -1
- package/dist/post-components/p-266e68a3.entry.js +1 -0
- package/dist/post-components/{p-0a08ae23.entry.js → p-2a0b9ed0.entry.js} +1 -1
- package/dist/post-components/p-3c71d687.entry.js +1 -0
- package/dist/post-components/{p-D2ex14Ye.js → p-4-_BhJWV.js} +1 -1
- package/dist/post-components/{p-15fa7e60.entry.js → p-477c8c35.entry.js} +1 -1
- package/dist/post-components/{p-fac58cbd.entry.js → p-4b366aa0.entry.js} +1 -1
- package/dist/post-components/{p-923439d1.entry.js → p-4c7750cd.entry.js} +1 -1
- package/dist/post-components/p-52e118e0.entry.js +1 -0
- package/dist/post-components/p-53f34806.entry.js +1 -0
- package/dist/post-components/p-621a81a7.entry.js +1 -0
- package/dist/post-components/p-85594193.entry.js +1 -0
- package/dist/post-components/p-89ea447b.entry.js +1 -0
- package/dist/post-components/{p-9e240299.entry.js → p-8d8ac7ae.entry.js} +1 -1
- package/dist/post-components/p-900dc8e1.entry.js +1 -0
- package/dist/post-components/p-93da9105.entry.js +1 -0
- package/dist/post-components/{p-6cbb2e7f.entry.js → p-95ad4d06.entry.js} +1 -1
- package/dist/post-components/{p-aff9dd5e.entry.js → p-9915ffee.entry.js} +1 -1
- package/dist/post-components/p-B6uZASBE.js +1 -0
- package/dist/post-components/{p-CIbyqT6u.js → p-BDW1XHCO.js} +1 -1
- package/dist/post-components/p-CiOyV6Mo.js +1 -0
- package/dist/post-components/p-DE1aWdqx.js +2 -0
- package/dist/post-components/{p-8SvFxSp6.js → p-DMiERazc.js} +1 -1
- package/dist/post-components/{p-DH5JdN6V.js → p-NPUljV0P.js} +1 -1
- package/dist/post-components/p-a08abdb2.entry.js +1 -0
- package/dist/post-components/{p-9ec32e7b.entry.js → p-a971ec25.entry.js} +1 -1
- package/dist/post-components/{p-eca119d2.entry.js → p-ad69ed8c.entry.js} +1 -1
- package/dist/post-components/p-c11a8e06.entry.js +1 -0
- package/dist/post-components/p-d02KpeUM.js +1 -0
- package/dist/post-components/{p-e54a6be0.entry.js → p-d9ce8f05.entry.js} +1 -1
- package/dist/post-components/{p-5d20cbcb.entry.js → p-dcceab4e.entry.js} +1 -1
- package/dist/post-components/{p-84c8d952.entry.js → p-e219e22a.entry.js} +1 -1
- package/dist/post-components/{p-7ee4b829.entry.js → p-f6c45fed.entry.js} +1 -1
- package/dist/post-components/post-components.css +2 -2
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +0 -8
- package/dist/types/components/post-date-picker/accessibility-utils.d.ts +19 -0
- package/dist/types/components/post-date-picker/date-utils.d.ts +48 -0
- package/dist/types/components/post-date-picker/native-mask-element.d.ts +12 -0
- package/dist/types/components/post-date-picker/post-date-picker.d.ts +23 -62
- package/dist/types/components/post-header/post-header.d.ts +2 -1
- package/dist/types/components/post-language-menu/post-language-menu.d.ts +2 -1
- package/dist/types/components/post-menu/post-menu.d.ts +4 -4
- package/dist/types/components/post-popover/post-popover.d.ts +4 -5
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +2 -2
- package/dist/types/components/post-side-navigation/post-side-navigation.d.ts +6 -0
- package/dist/types/components/post-side-navigation/side-navigation-styles.d.ts +2 -0
- package/dist/types/components/post-tab-item/post-tab-item.d.ts +8 -4
- package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +1 -1
- package/dist/types/components/post-tabs/post-tabs.d.ts +37 -17
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +4 -5
- package/dist/types/components.d.ts +90 -164
- package/dist/types/types/element-api.d.ts +3 -0
- package/hydrate/index.js +812 -596
- package/hydrate/index.mjs +812 -596
- package/package.json +11 -12
- package/dist/cjs/long-press-event-Dx21Ojod.js +0 -276
- package/dist/cjs/post-login-widget.cjs.entry.js +0 -92
- package/dist/collection/components/post-accordion-item/heading-levels.js +0 -1
- package/dist/collection/components/post-login-widget/post-login-widget.css +0 -1
- package/dist/collection/components/post-login-widget/post-login-widget.js +0 -218
- package/dist/collection/components/post-tab-item/post-tab-item.css +0 -1
- package/dist/components/long-press-event.js +0 -8
- package/dist/components/post-avatar2.js +0 -1
- package/dist/components/post-login-widget.d.ts +0 -11
- package/dist/components/post-login-widget.js +0 -1
- package/dist/components/react/p-BNgqqRsB.js +0 -8
- package/dist/components/react/p-C7aYEQh5.js +0 -1
- package/dist/components/react/p-CdhbouMD.js +0 -1
- package/dist/components/react/p-Ci08Eesw.js +0 -1
- package/dist/components/react/p-DWlDkwjY.js +0 -1
- package/dist/components/react/p-wqJxIo5L.js +0 -1
- package/dist/components/react/post-login-widget.d.ts +0 -11
- package/dist/components/react/post-login-widget.js +0 -1
- package/dist/esm/long-press-event-BNgqqRsB.js +0 -274
- package/dist/esm/package-CdhbouMD.js +0 -3
- package/dist/esm/post-login-widget.entry.js +0 -90
- package/dist/post-components/p-001f58d8.entry.js +0 -1
- package/dist/post-components/p-12c8b073.entry.js +0 -1
- package/dist/post-components/p-1839276a.entry.js +0 -1
- package/dist/post-components/p-28eeb5d8.entry.js +0 -1
- package/dist/post-components/p-6a1c4897.entry.js +0 -1
- package/dist/post-components/p-6d14f78a.entry.js +0 -1
- package/dist/post-components/p-6e8b6249.entry.js +0 -1
- package/dist/post-components/p-71918d59.entry.js +0 -1
- package/dist/post-components/p-8139b0cc.entry.js +0 -1
- package/dist/post-components/p-87ebb213.entry.js +0 -1
- package/dist/post-components/p-89da6378.entry.js +0 -1
- package/dist/post-components/p-8caaa149.entry.js +0 -1
- package/dist/post-components/p-BGeKgZqi.js +0 -2
- package/dist/post-components/p-BNgqqRsB.js +0 -8
- package/dist/post-components/p-CdhbouMD.js +0 -1
- package/dist/post-components/p-DiBqDD4N.js +0 -1
- package/dist/post-components/p-I6rSjhbA.js +0 -1
- package/dist/post-components/p-c905a97c.entry.js +0 -1
- package/dist/post-components/p-f9529d40.entry.js +0 -1
- package/dist/types/components/post-accordion-item/heading-levels.d.ts +0 -2
- package/dist/types/components/post-login-widget/post-login-widget.d.ts +0 -45
|
@@ -25,9 +25,6 @@ export class PostAccordionItem {
|
|
|
25
25
|
*/
|
|
26
26
|
this.collapsed = false;
|
|
27
27
|
}
|
|
28
|
-
componentWillLoad() {
|
|
29
|
-
this.id = this.host.id || `p${nanoid(6)}`;
|
|
30
|
-
}
|
|
31
28
|
// Capture to make sure the "collapsed" property is updated before the event is consumed
|
|
32
29
|
onCollapseToggle(event) {
|
|
33
30
|
this.collapsed = !event.detail;
|
|
@@ -45,12 +42,13 @@ export class PostAccordionItem {
|
|
|
45
42
|
this.slottedLogo = this.host.querySelector('img[slot="logo"]');
|
|
46
43
|
}
|
|
47
44
|
render() {
|
|
45
|
+
const collapsibleId = `c${nanoid(6)}`;
|
|
48
46
|
const headingLevel = this.host.closest('post-accordion')?.getAttribute('heading-level');
|
|
49
|
-
const HeadingTag = `h${headingLevel ??
|
|
50
|
-
return (h(Host, { key: '
|
|
47
|
+
const HeadingTag = `h${headingLevel ?? 2}`;
|
|
48
|
+
return (h(Host, { key: 'b9699596d57887d99214c6f163355535c68eae1a', "data-version": version }, h("post-collapsible-trigger", { key: 'ebd7c9d6bf2bc35d548867edc8766e31125d8509', for: collapsibleId }, h(HeadingTag, { key: '93806261d7dba93569b09d37dff0c01b4f29268b', class: "accordion-header" }, h("button", { key: '785a4bcff2c6705aade9b045e1176d43a2ef202b', type: "button", class: `accordion-button${this.collapsed ? ' collapsed' : ''}`, part: "post-accordion-button" }, h("span", { key: '87f8ba7f7ebe2ba851b6dc134656296820c467d0', class: {
|
|
51
49
|
'logo-container': true,
|
|
52
50
|
'has-image': !!this.slottedLogo,
|
|
53
|
-
} }, h("slot", { key: '
|
|
51
|
+
} }, h("slot", { key: '146256cb174f5895b25fd8f44464ca32fba6b6ee', name: "logo", onSlotchange: this.onSlotLogoChange.bind(this) })), h("slot", { key: 'd742ef89a88280f85c7da697536d4ad2ff825f0b', name: "header" }), h("post-icon", { key: 'f83e438c9d504ebaa0066df81b6f74ec14dcb08a', name: "chevronup" })))), h("post-collapsible", { key: '179f36eab7ebdb9faa909a70eb43e1d78503e6e1', id: collapsibleId, collapsed: this.collapsed, ref: el => (this.collapsible = el) }, h("div", { key: 'e93c3570cf76c971b49bf28d3d5540ac289b2469', class: "accordion-body", part: "post-accordion-body" }, h("slot", { key: 'db26c35edb371cb855141b6f7552d96ea10e06a4' })))));
|
|
54
52
|
}
|
|
55
53
|
static get is() { return "post-accordion-item"; }
|
|
56
54
|
static get encapsulation() { return "shadow"; }
|
|
@@ -85,41 +83,11 @@ export class PostAccordionItem {
|
|
|
85
83
|
"reflect": true,
|
|
86
84
|
"attribute": "collapsed",
|
|
87
85
|
"defaultValue": "false"
|
|
88
|
-
},
|
|
89
|
-
"headingLevel": {
|
|
90
|
-
"type": "number",
|
|
91
|
-
"mutable": false,
|
|
92
|
-
"complexType": {
|
|
93
|
-
"original": "HeadingLevel",
|
|
94
|
-
"resolved": "1 | 2 | 3 | 4 | 5 | 6",
|
|
95
|
-
"references": {
|
|
96
|
-
"HeadingLevel": {
|
|
97
|
-
"location": "import",
|
|
98
|
-
"path": "@/types",
|
|
99
|
-
"id": "src/types/index.ts::HeadingLevel",
|
|
100
|
-
"referenceLocation": "HeadingLevel"
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"required": false,
|
|
105
|
-
"optional": true,
|
|
106
|
-
"docs": {
|
|
107
|
-
"tags": [{
|
|
108
|
-
"name": "deprecated",
|
|
109
|
-
"text": "set the `heading-level` property on the parent `post-accordion` instead."
|
|
110
|
-
}],
|
|
111
|
-
"text": "Defines the hierarchical level of the accordion item header within the headings structure."
|
|
112
|
-
},
|
|
113
|
-
"getter": false,
|
|
114
|
-
"setter": false,
|
|
115
|
-
"reflect": false,
|
|
116
|
-
"attribute": "heading-level"
|
|
117
86
|
}
|
|
118
87
|
};
|
|
119
88
|
}
|
|
120
89
|
static get states() {
|
|
121
90
|
return {
|
|
122
|
-
"id": {},
|
|
123
91
|
"slottedLogo": {}
|
|
124
92
|
};
|
|
125
93
|
}
|
|
@@ -199,7 +199,7 @@ export class PostAutocomplete {
|
|
|
199
199
|
this.outputElement.textContent = this.textAvailableSuggestions.replace('{count}', String(count));
|
|
200
200
|
}
|
|
201
201
|
render() {
|
|
202
|
-
return (h(Host, { key: '
|
|
202
|
+
return (h(Host, { key: 'a88d1a65adcbe0603dc2c7ccf5900ae49dbe8edc', "data-version": version }, h("slot", { key: 'ff4724e2e298a38020c4eb93b2b9a38d811274b8' }), this.clearable && this.inputValue && (h("button", { key: '6a5f67d5376bdb0d261fd687ad29dd32d4f3be36', type: "button", class: "autocomplete-clear", onClick: this.clearInput }, h("post-icon", { key: '5b123fa4dbd581ebbba96f820b30d9d266b69b7d', "aria-hidden": "true", name: "closex" }))), h("post-icon", { key: '9d3fcaf73cfff3e17d440e7add858482e48a12a7', "aria-hidden": "true", class: "autocomplete-icon", name: "chevronDown" }), h("output", { key: '9c894f8ea34ffcc8b8c741216679ffbbd7b866bf', class: "visually-hidden", ref: el => (this.outputElement = el) })));
|
|
203
203
|
}
|
|
204
204
|
static get is() { return "post-autocomplete"; }
|
|
205
205
|
static get encapsulation() { return "shadow"; }
|
|
@@ -126,7 +126,7 @@ export class PostAvatar {
|
|
|
126
126
|
.join('')
|
|
127
127
|
.trim();
|
|
128
128
|
const fullname = names.join(' ');
|
|
129
|
-
return (h(Host, { key: '
|
|
129
|
+
return (h(Host, { key: 'ba9c39d64f6a1b77131ba8c603c9be3aad113c53', "data-version": version }, h("span", { key: '27a9ac87e8978fabf1717f3eb978e39d06670507', class: this.avatarType === 'slotted' ? '' : 'd-none' }, h("slot", { key: '3fa13670176f2fc3a79a8b11659962f433c37c2e', onSlotchange: this.slotChanged.bind(this) })), this.avatarType === 'image' && h("img", { key: '232099852c2ad8f2c4660eb1077c6d618092cdca', src: this.imageUrl, alt: this.imageAlt }), this.avatarType === 'initials' && (h("span", { key: 'e6b3bf751a95997a2abef2a16dcd8e2c78d308fa', class: "initials" }, initials, h("span", { key: '8d869a374678094e2ec5abc146b0b981c9079c15' }, this.description ?? fullname)))));
|
|
130
130
|
}
|
|
131
131
|
static get is() { return "post-avatar"; }
|
|
132
132
|
static get encapsulation() { return "shadow"; }
|
|
@@ -79,7 +79,7 @@ export class PostBackToTop {
|
|
|
79
79
|
window.removeEventListener('scroll', this.handleScroll);
|
|
80
80
|
}
|
|
81
81
|
render() {
|
|
82
|
-
return (h(Host, { key: '
|
|
82
|
+
return (h(Host, { key: '3d976e4e1a8ac4b72041369d5667c55d915d7118', "data-version": version }, h("button", { key: '7ceb4953248ca934a905ec63444934e9e6c09e43', class: "back-to-top", "aria-hidden": this.belowFold ? 'false' : 'true', tabindex: this.belowFold ? '0' : '-1', onClick: this.scrollToTop }, h("post-icon", { key: '89a2bc9a8278fb45d3fb915ec096ee94b3841edd', "aria-hidden": "true", name: "arrowup" }), h("span", { key: 'fc2517fba7599f37c3054b638afd6b9b2ba7e32a', class: "visually-hidden" }, this.textBackToTop))));
|
|
83
83
|
}
|
|
84
84
|
static get is() { return "post-back-to-top"; }
|
|
85
85
|
static get encapsulation() { return "shadow"; }
|
|
@@ -53,7 +53,7 @@ export class PostBanner {
|
|
|
53
53
|
this.hasActions = this.host.querySelectorAll('[slot="actions"]').length > 0;
|
|
54
54
|
}
|
|
55
55
|
render() {
|
|
56
|
-
return (h(Host, { key: '
|
|
56
|
+
return (h(Host, { key: 'afa4834733c7e9d985d2102a3e421f09f94b44ba', "data-version": version, role: "alert", "data-color-scheme": "light" }, h("slot", { key: '39dfccec7bf829ff354bac467a9b399e003ce473', name: "close-button" }), h("div", { key: 'e6dfc60165185da4384c4143153ee34db1299088', class: "post-banner-content" }, h("slot", { key: '9fc1e8e81cf396eb1ae1e5dfff7f04ccc6443986', name: "heading" }), h("slot", { key: 'e7d21db6f7feb1507c612319c3d56595b797a3c4' }), this.hasActions && (h("div", { key: 'd4229d09accb5cfb2a096c44ca523a132da4755d', class: "actions" }, h("slot", { key: 'b01633122bd45df2f95b7ee5e4694a83aceb68bd', name: "actions" }))))));
|
|
57
57
|
}
|
|
58
58
|
static get is() { return "post-banner"; }
|
|
59
59
|
static get encapsulation() { return "shadow"; }
|
|
@@ -95,7 +95,7 @@ export class PostBreadcrumbs {
|
|
|
95
95
|
return (h("div", { role: "listitem" }, h("div", { class: "breadcrumb-item" }, h("post-menu-trigger", { for: menuId }, h("button", null, h("span", { class: "visually-hidden" }, this.textMoreItems), h("span", { "aria-hidden": "true" }, "...")))), h("post-menu", { id: menuId, label: this.textMoreItems, placement: "bottom-start" }, h("slot", null))));
|
|
96
96
|
}
|
|
97
97
|
render() {
|
|
98
|
-
return (h(Host, { key: '
|
|
98
|
+
return (h(Host, { key: 'b6ac788d29127c030f4b1955c41a7d6e2ac8a346', "data-version": version }, h("nav", { key: 'a7c081b3b4d991cdab30b2ca424c47b7231484cd', "aria-label": this.textBreadcrumbs }, h("div", { key: 'c51606af26b874e66376afa2b7855b400368af85', role: "list" }, h("div", { key: '88a33d5554b807252b1d89ef6ce3a611dd7e5014', class: "breadcrumb-item home", role: "listitem" }, h("a", { key: 'f0fdbff28d44944d18497bf1be12bd22a1281778', href: this.homeUrl }, h("span", { key: '4d16bbe0565dfdd1764027db43cf4c61849f9159', class: "visually-hidden" }, this.textHome), h("post-icon", { key: '86611c819469da07c965c29db3510843e685e449', "aria-hidden": "true", name: "home" }))), this.shouldRenderMenu ? this.renderMenu() : h("slot", null), h("slot", { key: 'cb4a22117596bc8f3f9df72e62564b48c1d88975', name: "selected" })))));
|
|
99
99
|
}
|
|
100
100
|
static get is() { return "post-breadcrumbs"; }
|
|
101
101
|
static get encapsulation() { return "shadow"; }
|
|
@@ -60,7 +60,7 @@ export class PostClosebutton {
|
|
|
60
60
|
this.host.closest('dialog')?.close();
|
|
61
61
|
}
|
|
62
62
|
render() {
|
|
63
|
-
return (h(Host, { key: '
|
|
63
|
+
return (h(Host, { key: '22ac2b07e9a8a8f8d157423fea1bcedb2c4f9b11', "data-version": version }, h("button", { key: '91eb413a2546f131e4c97c28340374addbf2c7a7', type: this.buttonType, class: "btn btn-icon btn-secondary btn-sm", onClick: () => this.handleClick() }, h("post-icon", { key: '02202b3df2e5830aeb267921c924c1e75508d546', "aria-hidden": "true", name: "closex" }), h("span", { key: 'c691c845dd58b4f975c33791d29518428ade6ee8', ref: el => (this.visuallyHidden = el), class: "visually-hidden" }, h("slot", { key: '3fd42b82ef1d1ea76343e0c69f421a2916c26006' })))));
|
|
64
64
|
}
|
|
65
65
|
static get is() { return "post-closebutton"; }
|
|
66
66
|
static get encapsulation() { return "shadow"; }
|
|
@@ -66,7 +66,7 @@ export class PostCollapsible {
|
|
|
66
66
|
triggers.forEach(trigger => trigger.update());
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
|
-
return (h(Host, { key: '
|
|
69
|
+
return (h(Host, { key: '709d3f49d65324984e0aef09068cbc7c52299dcc', "data-version": version, tabindex: this.collapsed ? -1 : undefined, style: this.collapsed ? collapsedKeyframe : undefined }, h("slot", { key: 'c278bdbac8e10e9169a69ffe3037325016cc3fcb' })));
|
|
70
70
|
}
|
|
71
71
|
static get is() { return "post-collapsible"; }
|
|
72
72
|
static get encapsulation() { return "shadow"; }
|
|
@@ -104,7 +104,7 @@ export class PostCollapsibleTrigger {
|
|
|
104
104
|
this.updateAriaAttributes();
|
|
105
105
|
}
|
|
106
106
|
render() {
|
|
107
|
-
return (h(Host, { key: '
|
|
107
|
+
return (h(Host, { key: 'a62109f3d0490576da241fba140f0e32d37411e8', "data-version": version }, h("slot", { key: '4f56c5761fce00e350febdcf80c36ea5b94fd037' })));
|
|
108
108
|
}
|
|
109
109
|
static get is() { return "post-collapsible-trigger"; }
|
|
110
110
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add role and aria-label to each grid cell based on its type.
|
|
3
|
+
* @param data The render cell data from AirDatepicker.
|
|
4
|
+
* @param localeCode The BCP 47 locale code for formatting.
|
|
5
|
+
* @returns An object with `attrs` to apply to the cell element.
|
|
6
|
+
*/
|
|
7
|
+
export function renderCellAccessibility({ date, cellType }, localeCode) {
|
|
8
|
+
if (cellType === 'day') {
|
|
9
|
+
return {
|
|
10
|
+
attrs: {
|
|
11
|
+
'role': 'gridcell',
|
|
12
|
+
'aria-label': date.toLocaleDateString(localeCode, {
|
|
13
|
+
weekday: 'long',
|
|
14
|
+
year: 'numeric',
|
|
15
|
+
month: 'long',
|
|
16
|
+
day: 'numeric',
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
else if (cellType === 'month') {
|
|
22
|
+
return {
|
|
23
|
+
attrs: {
|
|
24
|
+
'role': 'gridcell',
|
|
25
|
+
'aria-label': date.toLocaleDateString(localeCode, {
|
|
26
|
+
year: 'numeric',
|
|
27
|
+
month: 'long',
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
else if (cellType === 'year') {
|
|
33
|
+
return {
|
|
34
|
+
attrs: {
|
|
35
|
+
'role': 'gridcell',
|
|
36
|
+
'aria-label': date.toLocaleDateString(localeCode, {
|
|
37
|
+
year: 'numeric',
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Merge the internal render cell (adding of role + aria-label attributes) and the user's render cell (disabling dates, etc.)
|
|
45
|
+
* @param base Internal render cell
|
|
46
|
+
* @param custom User render cell
|
|
47
|
+
* @returns Merged render cell
|
|
48
|
+
*/
|
|
49
|
+
export function mergeRenderCellResults(base, custom) {
|
|
50
|
+
if (!base)
|
|
51
|
+
return custom;
|
|
52
|
+
if (!custom)
|
|
53
|
+
return base;
|
|
54
|
+
return {
|
|
55
|
+
...base,
|
|
56
|
+
classes: [base.classes, custom.classes].filter(Boolean).join(' '),
|
|
57
|
+
disabled: custom.disabled || base.disabled,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { BUDDHIST_CALENDAR_YEAR_OFFSET } from "../../utils/index";
|
|
2
|
+
import { DATE_FORMAT_KEYS, DATE_FORMAT_KEYS_REGEX, DATE_FORMAT_MAP, DATE_FORMAT_SEPARATOR_REGEX, DATE_FORMAT_STRING_OPTIONS, TEXT_DIRECTION_MARKERS_REGEX, } from "./constants";
|
|
3
|
+
/**
|
|
4
|
+
* Pad the year component of an ISO date string to 4 digits.
|
|
5
|
+
* @param isoDateString An ISO formatted date string (YYYY-MM-DD).
|
|
6
|
+
* @returns The padded ISO date string.
|
|
7
|
+
*/
|
|
8
|
+
export function padIsoDate(isoDateString) {
|
|
9
|
+
const valueParts = isoDateString.split('-');
|
|
10
|
+
return `${valueParts[0].padStart(4, '0')}-${valueParts[1]}-${valueParts[2]}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Convert an ISO 8601 formatted date string (YYYY-MM-DD) to a localtime date object.
|
|
14
|
+
* @param isoDateString An ISO formatted, localtime date string.
|
|
15
|
+
* @returns A localtime date object.
|
|
16
|
+
*/
|
|
17
|
+
export function isoToDate(isoDateString) {
|
|
18
|
+
return new Date(`${padIsoDate(isoDateString)}T00:00`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Convert a date object to an ISO 8601 formatted date string (YYYY-MM-DD).
|
|
22
|
+
* @param date A localtime date object.
|
|
23
|
+
* @returns An ISO formatted, localtime date string.
|
|
24
|
+
*/
|
|
25
|
+
export function dateToIso(date) {
|
|
26
|
+
// The swedish locale (`sv`) happens to format the date in the exact ISO format (YYYY-MM-DD),
|
|
27
|
+
// so we can use it as a shortcut instead of manually constructing the string from the date parts.
|
|
28
|
+
return date.toLocaleDateString('sv', DATE_FORMAT_STRING_OPTIONS);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Convert a date object to a localized date string.
|
|
32
|
+
* @param date A localtime date object.
|
|
33
|
+
* @param localeCode The BCP 47 locale code to use for formatting.
|
|
34
|
+
* @returns A localized date string, depending on the given `localeCode`.
|
|
35
|
+
*/
|
|
36
|
+
export function dateToString(date, localeCode) {
|
|
37
|
+
const dateString = date.toLocaleDateString(localeCode, DATE_FORMAT_STRING_OPTIONS);
|
|
38
|
+
const yearString = date.getFullYear().toString();
|
|
39
|
+
if (yearString.length < 4) {
|
|
40
|
+
return dateString.replace(yearString, yearString.padStart(4, '0'));
|
|
41
|
+
}
|
|
42
|
+
return dateString;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Convert a localized date string to a date object.
|
|
46
|
+
* The date string should be in the same format as the date picker's `dateFormat`, which depends on the given `localeCode`.
|
|
47
|
+
* @param localeDateString A localized date string.
|
|
48
|
+
* @param dateFormat The date format string (e.g. "dd.mm.yyyy").
|
|
49
|
+
* @param isBuddhistCalendar Whether the locale uses the Buddhist calendar.
|
|
50
|
+
* @returns A localtime date object.
|
|
51
|
+
*/
|
|
52
|
+
export function stringToDate(localeDateString, dateFormat, isBuddhistCalendar) {
|
|
53
|
+
// Match the separator chars in the date format (e.g. "." for "dd.mm.yyyy", etc.).
|
|
54
|
+
const dateSeparator = dateFormat.match(DATE_FORMAT_SEPARATOR_REGEX)[0];
|
|
55
|
+
// Remove the text direction markers, split the date string into its parts (e.g. ["31", "01", "2026"], etc.)
|
|
56
|
+
// and make sure its values only contains digits (e.g. for "bg-BG", etc.).
|
|
57
|
+
const dateParts = localeDateString
|
|
58
|
+
.replace(TEXT_DIRECTION_MARKERS_REGEX, '')
|
|
59
|
+
.split(dateSeparator)
|
|
60
|
+
.map(p => p.replaceAll(/[^\d]/g, ''));
|
|
61
|
+
// Split the dateFormat into its parts to get the year, month, day order (e.g. ["d", "m", "y"], etc.).
|
|
62
|
+
// Removing everything else but the DATE_FORMAT_KEYS is necessary to support date formats with additional chars (e.g. "d.m.y г.", etc.).
|
|
63
|
+
const formatParts = dateFormat.replace(DATE_FORMAT_KEYS_REGEX, '').split('');
|
|
64
|
+
// Map the datePart values to their corresponding keys (e.g. y, m, d),
|
|
65
|
+
// to construct an ISO date string (e.g. "2026-01-31") that can be parsed by the Date constructor.
|
|
66
|
+
// This is necessary because different locale date formats may have different orders (e.g. "ymd", "dmy", "mdy", etc.).
|
|
67
|
+
const { y, m, d } = DATE_FORMAT_KEYS.reduce((parts, key) => ({
|
|
68
|
+
...parts,
|
|
69
|
+
[key]: dateParts[formatParts.indexOf(key)],
|
|
70
|
+
}), {});
|
|
71
|
+
// Adjust for Thai Buddhist calendar
|
|
72
|
+
const year = isBuddhistCalendar ? (Number(y) - BUDDHIST_CALENDAR_YEAR_OFFSET).toString() : y;
|
|
73
|
+
return isoToDate([year, m, d].join('-'));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get the date format string for a locale, by formatting a sample date and replacing the date parts
|
|
77
|
+
* with format keys (y, m, d). For example, it will return "dd.mm.yyyy" for "de-CH" locale and "mm/dd/yyyy" for "en-US" locale.
|
|
78
|
+
* @param localeCode The BCP 47 locale code.
|
|
79
|
+
* @param isBuddhistCalendar Whether the locale uses the Buddhist calendar.
|
|
80
|
+
* @returns The date format string.
|
|
81
|
+
*/
|
|
82
|
+
export function getDateFormat(localeCode, isBuddhistCalendar) {
|
|
83
|
+
const date = new Date(Object.values(DATE_FORMAT_MAP).join('-'));
|
|
84
|
+
// get the locale date format e.g. `22.11.3333` for `de-CH` or `11/22/3333` for `en-US`
|
|
85
|
+
let localeDateString = date.toLocaleDateString(localeCode, DATE_FORMAT_STRING_OPTIONS);
|
|
86
|
+
// replace the date parts (3333, 11, 22) with the corresponding format keys (y, m, d)
|
|
87
|
+
for (const [key, value] of Object.entries(DATE_FORMAT_MAP)) {
|
|
88
|
+
// for Thai locale, the year is in Buddhist calendar which is 543 years ahead of Gregorian calendar, so we need to adjust the year value accordingly
|
|
89
|
+
localeDateString = localeDateString.replace(isBuddhistCalendar && value.length === 4
|
|
90
|
+
? (Number(value) + BUDDHIST_CALENDAR_YEAR_OFFSET).toString()
|
|
91
|
+
: value, key);
|
|
92
|
+
}
|
|
93
|
+
return localeDateString;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Check if a value is a valid Date object.
|
|
97
|
+
* @param date The value to check.
|
|
98
|
+
* @returns `true` if the value is a valid Date, `false` otherwise.
|
|
99
|
+
*/
|
|
100
|
+
export function isValidDate(date) {
|
|
101
|
+
return date instanceof Date && !Number.isNaN(date.getTime()) && date.getFullYear() >= 1000;
|
|
102
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { HTMLInputMaskElement } from "imask";
|
|
2
|
+
const nativeValueDescriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
|
3
|
+
// iMask adapter that bypasses the instance-level `input.value` override (which returns ISO strings)
|
|
4
|
+
// so iMask always works with locale-formatted display text.
|
|
5
|
+
export class NativeInputMaskElement extends HTMLInputMaskElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.allowEvents = false;
|
|
9
|
+
this._inputEventSuppressor = (e) => {
|
|
10
|
+
if (this.allowEvents)
|
|
11
|
+
return;
|
|
12
|
+
if (!e.isTrusted)
|
|
13
|
+
e.stopImmediatePropagation();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
get value() {
|
|
17
|
+
return nativeValueDescriptor.get.call(this.input);
|
|
18
|
+
}
|
|
19
|
+
set value(val) {
|
|
20
|
+
nativeValueDescriptor.set.call(this.input, val);
|
|
21
|
+
}
|
|
22
|
+
bindEvents(handlers) {
|
|
23
|
+
this.input.addEventListener('input', this._inputEventSuppressor, true);
|
|
24
|
+
super.bindEvents(handlers);
|
|
25
|
+
}
|
|
26
|
+
unbindEvents() {
|
|
27
|
+
this.input.removeEventListener('input', this._inputEventSuppressor, true);
|
|
28
|
+
super.unbindEvents();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function getNativeValue(input) {
|
|
32
|
+
return nativeValueDescriptor.get.call(input);
|
|
33
|
+
}
|
|
34
|
+
export function setNativeValue(input, val) {
|
|
35
|
+
nativeValueDescriptor.set.call(input, val);
|
|
36
|
+
}
|