@orangesk/orange-design-system 2.0.0-beta.36 → 2.0.0-beta.37
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/README.md +8 -2
- package/build/components/Icon/style.css +1 -1
- package/build/components/Icon/style.css.map +1 -1
- package/build/components/PromoBanner/style.css +1 -1
- package/build/components/PromoBanner/style.css.map +1 -1
- package/build/components/index.js +1 -1
- package/build/components/index.js.map +1 -1
- package/build/components/tsconfig.tsbuildinfo +1 -1
- package/build/components/types/index.d.ts +729 -729
- package/build/components/types/src/components/Bar/index.d.ts +1 -1
- package/build/components/types/src/components/BlockAction/Context.d.ts +1 -1
- package/build/components/types/src/components/BlockAction/index.d.ts +2 -4
- package/build/components/types/src/components/Button/index.d.ts +1 -1
- package/build/components/types/src/components/Card/index.d.ts +2 -2
- package/build/components/types/src/components/Carousel/Carousel.d.ts +1 -1
- package/build/components/types/src/components/Carousel/CarouselItem.d.ts +1 -1
- package/build/components/types/src/components/CarouselHero/CarouselHero.d.ts +1 -1
- package/build/components/types/src/components/CarouselHero/CarouselHero.static.d.ts +1 -1
- package/build/components/types/src/components/CarouselHero/CarouselHeroItem.d.ts +1 -1
- package/build/components/types/src/components/CarouselHero/index.d.ts +1 -1
- package/build/components/types/src/components/CartTable/CartTable.d.ts +1 -1
- package/build/components/types/src/components/CartTable/data.d.ts +1 -1
- package/build/components/types/src/components/Code/Code.d.ts +1 -1
- package/build/components/types/src/components/Divider/Divider.d.ts +1 -1
- package/build/components/types/src/components/DocumentationSidebar/index.d.ts +1 -1
- package/build/components/types/src/components/Dropdown/index.d.ts +1 -1
- package/build/components/types/src/components/Forms/Group/Group.d.ts +1 -1
- package/build/components/types/src/components/Forms/Group/Item.d.ts +1 -1
- package/build/components/types/src/components/Forms/index.d.ts +1 -1
- package/build/components/types/src/components/Grid/GridCol.d.ts +3 -3
- package/build/components/types/src/components/Icon/iconSearchTags.d.ts +1 -0
- package/build/components/types/src/components/Icon/index.d.ts +1 -2
- package/build/components/types/src/components/IconList/Item.d.ts +1 -1
- package/build/components/types/src/components/List/ClickableControl.d.ts +1 -1
- package/build/components/types/src/components/List/List.d.ts +3 -3
- package/build/components/types/src/components/List/ListItem.d.ts +1 -1
- package/build/components/types/src/components/Megamenu/index.d.ts +1 -1
- package/build/components/types/src/components/Modal/ModalCloseButton.d.ts +1 -1
- package/build/components/types/src/components/Modal/index.d.ts +2 -2
- package/build/components/types/src/components/Pagination/helpers.d.ts +1 -1
- package/build/components/types/src/components/Pill/Pill.d.ts +1 -1
- package/build/components/types/src/components/Preview/Preview.d.ts +1 -1
- package/build/components/types/src/components/Preview/PreviewGenerator.d.ts +1 -1
- package/build/components/types/src/components/PromotionCard/PromotionCardContent.d.ts +1 -1
- package/build/components/types/src/components/PromotionCard/PromotionCardImageWrapper.d.ts +1 -1
- package/build/components/types/src/components/PromotionCard/PromotionCardTitle.d.ts +1 -1
- package/build/components/types/src/components/Sticker/Sticker.d.ts +3 -3
- package/build/components/types/src/components/Table/Table.d.ts +1 -1
- package/build/components/types/src/components/Table/index.d.ts +1 -1
- package/build/components/types/src/components/Tabs/index.d.ts +2 -2
- package/build/components/types/src/components/Tag/index.d.ts +1 -1
- package/build/components/types/src/components/Testimonial/Testimonial.d.ts +2 -2
- package/build/components/types/src/components/Tooltip/Tooltip.static.d.ts +6 -2
- package/build/components/types/src/components/Tooltip/index.d.ts +1 -1
- package/build/components/types/src/components/index.d.ts +20 -20
- package/build/components/types/src/scripts/index.d.ts +5 -5
- package/build/components/types/src/scripts/modules/SpacePreview/index.d.ts +1 -1
- package/build/components/types/src/utils/hooks.d.ts +1 -1
- package/build/components/types/src/utils/index.d.ts +2 -2
- package/build/lib/base.css +1 -1
- package/build/lib/base.css.map +1 -1
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/footer.js +1 -1
- package/build/lib/footer.js.map +1 -1
- package/build/lib/megamenu.js +1 -1
- package/build/lib/megamenu.js.map +1 -1
- package/build/lib/scripts.js +1 -1
- package/build/lib/scripts.js.map +1 -1
- package/build/lib/style.css +1 -1
- package/build/lib/style.css.map +1 -1
- package/build/lib/tsconfig.tsbuildinfo +1 -1
- package/build/search-index.json +3 -3
- package/build/sprite.svg +1 -1
- package/package.json +28 -26
- package/src/assets/icons/discount-price.svg +4 -0
- package/src/components/Accordion/Accordion.tsx +2 -3
- package/src/components/Accordion/AccordionHeader.tsx +1 -1
- package/src/components/Accordion/AccordionItem.tsx +2 -1
- package/src/components/Accordion/HeadingContext.tsx +1 -1
- package/src/components/Accordion/tests/Accordion.unit.test.jsx +3 -4
- package/src/components/Alert/Alert.tsx +3 -4
- package/src/components/Alert/tests/Alert.conformance.test.jsx +2 -3
- package/src/components/Alert/tests/Alert.test.jsx +1 -1
- package/src/components/Alert/tests/Alert.visual.test.jsx +1 -2
- package/src/components/AnchorNavigation/AnchorNavigation.tsx +3 -3
- package/src/components/AnchorNavigation/tests/AnchorNavigation.conformance.test.jsx +1 -1
- package/src/components/Bar/Bar.tsx +1 -1
- package/src/components/Bar/BarBreak.tsx +1 -1
- package/src/components/Bar/BarItem.tsx +1 -1
- package/src/components/Bar/index.ts +1 -1
- package/src/components/Bar/tests/Bar.conformance.test.jsx +1 -1
- package/src/components/BlockAction/BlockAction.tsx +1 -1
- package/src/components/BlockAction/BlockActionControl.tsx +2 -3
- package/src/components/BlockAction/BlockActionIndicator.tsx +2 -3
- package/src/components/BlockAction/CloneElementWithClassName.tsx +1 -1
- package/src/components/BlockAction/Context.tsx +1 -1
- package/src/components/BlockAction/index.tsx +3 -8
- package/src/components/BlockAction/tests/BlockActionControl.unit.test.jsx +1 -1
- package/src/components/BodyBanner/BodyBanner.tsx +2 -2
- package/src/components/BodyBanner/tests/BodyBanner.conformance.test.jsx +1 -1
- package/src/components/Breadcrumbs/BreadcrumbItem.tsx +1 -1
- package/src/components/Breadcrumbs/tests/Breadcrumbs.conformance.test.jsx +1 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Button/IconButton.tsx +7 -3
- package/src/components/Button/index.tsx +1 -3
- package/src/components/Button/tests/Button.conformance.test.jsx +1 -2
- package/src/components/Button/tests/Button.test.jsx +0 -1
- package/src/components/Button/tests/IconButton.unit.test.jsx +0 -1
- package/src/components/Buttons/tests/Buttons.conformance.test.jsx +1 -1
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Card/CardProductHeader.tsx +1 -1
- package/src/components/Card/CardSection.tsx +1 -1
- package/src/components/Card/index.ts +2 -2
- package/src/components/Card/tests/Card.conformance.test.jsx +2 -2
- package/src/components/Card/tests/CardProductHeader.unit.test.jsx +1 -1
- package/src/components/Carousel/Carousel.static.ts +15 -15
- package/src/components/Carousel/Carousel.tsx +9 -11
- package/src/components/Carousel/CarouselItem.tsx +1 -1
- package/src/components/Carousel/tests/Carousel.conformance.test.jsx +2 -4
- package/src/components/CarouselHero/CarouselHero.static.ts +15 -15
- package/src/components/CarouselHero/CarouselHero.tsx +12 -13
- package/src/components/CarouselHero/CarouselHeroItem.tsx +2 -2
- package/src/components/CarouselHero/index.ts +1 -1
- package/src/components/CarouselHero/tests/CarouselHeroItem.conformance.test.jsx +1 -1
- package/src/components/CarouselPromotions/CarouselPromotions.static.ts +10 -10
- package/src/components/CarouselPromotions/CarouselPromotions.tsx +6 -7
- package/src/components/CarouselPromotions/CarouselPromotionsItem.tsx +3 -3
- package/src/components/CarouselPromotions/tests/CarouselPromotions.conformance.test.jsx +1 -3
- package/src/components/CarouselPromotions/tests/CarouselPromotions.unit.test.jsx +1 -2
- package/src/components/CartTable/CartTable.tsx +3 -4
- package/src/components/CartTable/FooterPriceColumn.tsx +1 -1
- package/src/components/CartTable/Price.tsx +1 -1
- package/src/components/CartTable/data.ts +1 -1
- package/src/components/CartTable/generateFooter.tsx +1 -1
- package/src/components/CartTable/generateRow.tsx +6 -8
- package/src/components/CartTable/tests/CartTable.conformance.test.jsx +1 -1
- package/src/components/Code/Code.tsx +1 -1
- package/src/components/Container/Container.tsx +1 -1
- package/src/components/Container/tests/Container.unit.test.jsx +3 -2
- package/src/components/Controls/Controls.tsx +1 -1
- package/src/components/Controls/tests/Controls.test.jsx +2 -2
- package/src/components/Cover/Cover.tsx +1 -1
- package/src/components/Cover/index.ts +1 -0
- package/src/components/Cover/tests/Cover.conformance.test.jsx +8 -9
- package/src/components/Cover/tests/Cover.unit.test.jsx +0 -1
- package/src/components/Divider/Divider.tsx +1 -1
- package/src/components/Divider/tests/Divider.conformance.test.jsx +1 -1
- package/src/components/DocumentationSidebar/DocumentationSidebar.tsx +7 -7
- package/src/components/DocumentationSidebar/index.ts +2 -2
- package/src/components/Dropdown/Dropdown.static.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +3 -5
- package/src/components/Dropdown/DropdownDivider.tsx +1 -1
- package/src/components/Dropdown/DropdownItem.tsx +1 -1
- package/src/components/Dropdown/DropdownToggleButton.tsx +1 -1
- package/src/components/Dropdown/index.ts +1 -1
- package/src/components/Dropdown/tests/Dropdown.conformance.test.jsx +2 -2
- package/src/components/Dropdown/tests/Dropdown.unit.test.jsx +1 -2
- package/src/components/Expander/Expander.tsx +1 -1
- package/src/components/Expander/tests/Expander.conformance.test.jsx +2 -4
- package/src/components/Expander/tests/Expander.unit.test.jsx +2 -4
- package/src/components/FeatureAccordion/FeatureAccordion.tsx +2 -2
- package/src/components/FeatureAccordion/FeatureAccordionItem.tsx +2 -1
- package/src/components/FeatureAccordion/tests/FeatureAccordion.conformance.test.jsx +1 -1
- package/src/components/FeatureAccordion/tests/FeatureAccordion.unit.test.jsx +2 -3
- package/src/components/Footer/Footer.tsx +4 -5
- package/src/components/Footer/static.ts +2 -2
- package/src/components/Footer/tests/Footer.unit.test.jsx +1 -1
- package/src/components/Forms/Autocomplete/Autocomplete.tsx +2 -2
- package/src/components/Forms/Checkbox/Checkbox.tsx +1 -1
- package/src/components/Forms/DatePicker/DatePicker.tsx +1 -2
- package/src/components/Forms/Field/Control.tsx +3 -3
- package/src/components/Forms/Field/Description.tsx +1 -1
- package/src/components/Forms/Field/Field.tsx +4 -4
- package/src/components/Forms/Field/Label.tsx +1 -1
- package/src/components/Forms/Field/Messages.tsx +2 -2
- package/src/components/Forms/Field/tests/Autocomplete.Field.conformance.test.jsx +1 -1
- package/src/components/Forms/Field/tests/Checkbox.Field.conformance.test.jsx +1 -1
- package/src/components/Forms/Field/tests/File.Field.conformance.test.jsx +1 -1
- package/src/components/Forms/Field/tests/Group.Field.conformance.test.jsx +1 -1
- package/src/components/Forms/Field/tests/Radio.Field.conformance.test.jsx +1 -1
- package/src/components/Forms/Field/tests/Rangeslider.Field.test.jsx +1 -1
- package/src/components/Forms/Field/tests/Select.Field.conformance.test.jsx +1 -1
- package/src/components/Forms/Field/tests/Text.Field.conformance.test.jsx +1 -1
- package/src/components/Forms/Field/tests/Textarea.Field.conformance.test.jsx +1 -1
- package/src/components/Forms/Field/tests/Tooltip.unit.test.jsx +1 -2
- package/src/components/Forms/Fieldset/Fieldset.tsx +1 -1
- package/src/components/Forms/File/File.tsx +4 -7
- package/src/components/Forms/Group/Group.tsx +2 -3
- package/src/components/Forms/Group/Item.tsx +1 -1
- package/src/components/Forms/Hint/Hint.tsx +1 -1
- package/src/components/Forms/InputStepper/InputStepper.tsx +1 -1
- package/src/components/Forms/Label/Label.tsx +1 -1
- package/src/components/Forms/Message/Message.tsx +9 -5
- package/src/components/Forms/Radio/Radio.tsx +1 -1
- package/src/components/Forms/RangeSlider/RangeSlider.tsx +1 -1
- package/src/components/Forms/Select/Select.tsx +1 -1
- package/src/components/Forms/TextArea/TextArea.tsx +1 -1
- package/src/components/Forms/TextInput/TextInput.tsx +3 -5
- package/src/components/Forms/index.ts +1 -1
- package/src/components/Gauge/Gauge.tsx +1 -1
- package/src/components/Gauge/GaugeMaker.tsx +3 -3
- package/src/components/Gauge/tests/Gauge.unit.test.jsx +0 -1
- package/src/components/Grid/Grid.tsx +1 -1
- package/src/components/Grid/GridCol.tsx +21 -10
- package/src/components/Grid/tests/Grid.unit.test.jsx +0 -1
- package/src/components/Grid/tests/GridCol.unit.test.jsx +0 -1
- package/src/components/Hero/Hero.tsx +1 -1
- package/src/components/Hero/tests/Hero.conformance.test.jsx +1 -2
- package/src/components/Hero/tests/Hero.unit.test.jsx +0 -1
- package/src/components/Hero/tests/data.js +26 -26
- package/src/components/Icon/Icon.tsx +1 -1
- package/src/components/Icon/IconSearch.jsx +4 -4
- package/src/components/Icon/PictogramSearch.jsx +3 -14
- package/src/components/Icon/iconSearchTags.ts +1 -0
- package/src/components/Icon/index.ts +1 -2
- package/src/components/Icon/styles/style.scss +30 -0
- package/src/components/Icon/tests/Icon.conformance.test.jsx +1 -2
- package/src/components/Icon/tests/Icon.unit.test.jsx +1 -3
- package/src/components/Icon/tests/Pictogram.unit.test.jsx +1 -2
- package/src/components/IconList/IconList.tsx +1 -1
- package/src/components/IconList/Item.tsx +15 -11
- package/src/components/IconList/tests/IconList.conformance.test.jsx +1 -2
- package/src/components/IconList/tests/IconList.unit.test.jsx +29 -26
- package/src/components/Image/Image.tsx +1 -1
- package/src/components/Image/tests/Image.conformance.test.jsx +1 -1
- package/src/components/Image/tests/Image.unit.test.jsx +0 -1
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/Link/tests/Link.conformance.test.jsx +1 -1
- package/src/components/Link/tests/Link.unit.test.jsx +1 -1
- package/src/components/List/ClickableControl.tsx +12 -12
- package/src/components/List/List.tsx +13 -13
- package/src/components/List/ListItem.tsx +11 -11
- package/src/components/List/tests/ClickableControl.unit.test.jsx +0 -1
- package/src/components/List/tests/List.conformance.test.jsx +16 -17
- package/src/components/List/tests/ListItem.unit.test.jsx +46 -47
- package/src/components/Loader/Loader.tsx +1 -1
- package/src/components/Loader/tests/Loader.conformance.test.jsx +1 -1
- package/src/components/Megamenu/MegaMenuIcon.tsx +1 -1
- package/src/components/Megamenu/Megamenu.static.ts +5 -5
- package/src/components/Megamenu/Megamenu.tsx +28 -29
- package/src/components/Megamenu/MegamenuBlog.tsx +17 -19
- package/src/components/Megamenu/MegamenuSearchContent.tsx +2 -2
- package/src/components/Megamenu/MyOrangeMobilePanel.tsx +11 -12
- package/src/components/Megamenu/index.ts +1 -1
- package/src/components/Megamenu/static.ts +2 -2
- package/src/components/Modal/Modal.tsx +3 -4
- package/src/components/Modal/ModalBody.tsx +1 -1
- package/src/components/Modal/ModalCloseButton.tsx +1 -1
- package/src/components/Modal/ModalProductFooter.tsx +1 -1
- package/src/components/Modal/ModalProductHeader.tsx +1 -1
- package/src/components/Modal/index.ts +2 -2
- package/src/components/Modal/tests/Modal.conformance.test.jsx +2 -3
- package/src/components/Modal/tests/Modal.unit.test.jsx +0 -1
- package/src/components/Modal/tests/ModalProductHeader.unit.test.jsx +0 -1
- package/src/components/Modal/tests/ModalTitle.unit.test.jsx +0 -1
- package/src/components/Pagination/Pagination.tsx +2 -3
- package/src/components/Pagination/PaginationItem.tsx +1 -1
- package/src/components/Pagination/Separator.tsx +1 -1
- package/src/components/Pagination/helpers.ts +6 -1
- package/src/components/Pagination/tests/Item.unit.test.jsx +38 -39
- package/src/components/Pagination/tests/Pagination.conformance.test.jsx +7 -8
- package/src/components/Pagination/tests/Pagination.unit.test.jsx +39 -40
- package/src/components/Pagination/tests/Separator.unit.test.jsx +10 -11
- package/src/components/Pill/Pill.tsx +1 -1
- package/src/components/Pill/tests/Pill.conformance.test.jsx +1 -1
- package/src/components/Preview/CodeExample.tsx +6 -9
- package/src/components/Preview/Preview.tsx +2 -1
- package/src/components/Preview/PreviewGenerator.tsx +8 -8
- package/src/components/Preview/PreviewTitleBar.tsx +1 -1
- package/src/components/Preview/index.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/Progress/index.ts +1 -1
- package/src/components/Progress/tests/Progress.conformance.test.jsx +6 -7
- package/src/components/Progress/tests/Progress.unit.test.jsx +42 -39
- package/src/components/PromoBanner/PromoBanner.tsx +1 -1
- package/src/components/PromoBanner/styles/style.scss +2 -2
- package/src/components/PromoBanner/tests/PromoBanner.conformance.test.jsx +1 -2
- package/src/components/PromoBanner/tests/PromoBanner.unit.test.jsx +0 -1
- package/src/components/PromotionCard/PromotionCard.tsx +1 -1
- package/src/components/PromotionCard/PromotionCardContent.tsx +8 -8
- package/src/components/PromotionCard/PromotionCardImageWrapper.tsx +7 -9
- package/src/components/PromotionCard/PromotionCardSection.tsx +1 -1
- package/src/components/PromotionCard/PromotionCardTitle.tsx +11 -11
- package/src/components/PromotionCard/constants.ts +2 -2
- package/src/components/PromotionCard/tests/PromotionCard.conformance.test.jsx +1 -2
- package/src/components/PromotionCard/tests/PromotionCard.unit.test.jsx +0 -1
- package/src/components/Section/Section.tsx +1 -1
- package/src/components/Section/tests/Section.conformance.test.jsx +1 -2
- package/src/components/Section/tests/Section.unit.test.jsx +0 -1
- package/src/components/Skeleton/Skeleton.tsx +1 -1
- package/src/components/Skeleton/tests/Skeleton.conformance.test.jsx +1 -1
- package/src/components/SkipLink/SkipLink.tsx +1 -1
- package/src/components/SkipLink/tests/SkipLink.unit.test.jsx +0 -4
- package/src/components/SocialButton/SocialButton.tsx +1 -1
- package/src/components/SocialButton/tests/SocialButton.unit.test.jsx +1 -1
- package/src/components/Stepbar/Stepbar.tsx +1 -1
- package/src/components/Stepbar/tests/Stepbar.conformance.test.jsx +1 -1
- package/src/components/Sticker/Sticker.tsx +14 -8
- package/src/components/Sticker/index.ts +1 -0
- package/src/components/Sticker/tests/Sticker.conformance.test.jsx +5 -6
- package/src/components/Sticker/tests/Sticker.unit.test.jsx +16 -19
- package/src/components/Table/Header.tsx +1 -2
- package/src/components/Table/Row.tsx +1 -2
- package/src/components/Table/Rows.tsx +1 -2
- package/src/components/Table/Table.tsx +4 -5
- package/src/components/Table/index.ts +1 -1
- package/src/components/Table/tests/Footer.unit.test.jsx +1 -2
- package/src/components/Table/tests/Header.unit.test.jsx +1 -2
- package/src/components/Table/tests/Row.unit.test.jsx +1 -2
- package/src/components/Table/tests/Rows.unit.test.jsx +1 -2
- package/src/components/Table/tests/Table.conformance.test.jsx +6 -6
- package/src/components/Table/tests/Table.unit.test.jsx +1 -1
- package/src/components/Tabs/Tabs.tsx +2 -2
- package/src/components/Tabs/index.ts +2 -2
- package/src/components/Tabs/tests/Tabs.unit.test.jsx +2 -3
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/Tag/TagButton.tsx +1 -1
- package/src/components/Tag/index.ts +1 -1
- package/src/components/Tag/tests/Tag.conformance.test.jsx +2 -3
- package/src/components/Tag/tests/Tag.unit.test.jsx +1 -3
- package/src/components/Tag/tests/TagButton.conformance.test.jsx +1 -1
- package/src/components/Tag/tests/TagButton.unit.test.jsx +1 -1
- package/src/components/Testimonial/Testimonial.tsx +15 -15
- package/src/components/Testimonial/tests/Testimonial.conformance.test.jsx +5 -6
- package/src/components/Testimonial/tests/Testimonial.unit.test.jsx +22 -23
- package/src/components/Tile/Tile.tsx +2 -3
- package/src/components/Tile/tests/Tile.conformance.test.jsx +1 -1
- package/src/components/Tooltip/InfoTooltip.tsx +1 -1
- package/src/components/Tooltip/Tooltip.static.ts +100 -66
- package/src/components/Tooltip/Tooltip.tsx +2 -3
- package/src/components/Tooltip/index.ts +1 -1
- package/src/components/Tooltip/tests/Tooltip.conformance.test.jsx +1 -1
- package/src/components/Tooltip/tests/Tooltip.unit.test.jsx +43 -34
- package/src/components/index.ts +39 -39
- package/src/styles/base/globals.scss +17 -1
- package/src/styles/export/breakpoint.ts +7 -7
package/build/lib/footer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,o(i.key),i)}}function n(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var r,a=
|
|
1
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,o(i.key),i)}}function n(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var r,a={exports:{}};r||(r=1,a.exports=function(){var e=["decimals","thousand","mark","prefix","suffix","encoder","decoder","negativeBefore","negative","edit","undo"];function t(e){return e.split("").reverse().join("")}function n(e,t){return e.substring(0,t.length)===t}function o(e,t){return e.slice(-1*t.length)===t}function i(e,t,n){if((e[t]||e[n])&&e[t]===e[n])throw new Error(t)}function r(e){return"number"==typeof e&&isFinite(e)}function a(e,t){return e=e.toString().split("e"),(+((e=(e=Math.round(+(e[0]+"e"+(e[1]?+e[1]+t:t)))).toString().split("e"))[0]+"e"+(e[1]?+e[1]-t:-t))).toFixed(t)}function c(e,n,o,i,c,u,s,l,f,d,h,y){var m,g,p,v=y,w="",S="";return u&&(y=u(y)),!!r(y)&&(!1!==e&&0===parseFloat(y.toFixed(e))&&(y=0),y<0&&(m=!0,y=Math.abs(y)),!1!==e&&(y=a(y,e)),-1!==(y=y.toString()).indexOf(".")?(p=(g=y.split("."))[0],o&&(w=o+g[1])):p=y,n&&(p=t(p).match(/.{1,3}/g),p=t(p.join(t(n)))),m&&l&&(S+=l),i&&(S+=i),m&&f&&(S+=f),S+=p,S+=w,c&&(S+=c),d&&(S=d(S,v)),S)}function u(e,t,i,a,c,u,s,l,f,d,h,y){var m,g="";return h&&(y=h(y)),!(!y||"string"!=typeof y)&&(l&&n(y,l)&&(y=y.replace(l,""),m=!0),a&&n(y,a)&&(y=y.replace(a,"")),f&&n(y,f)&&(y=y.replace(f,""),m=!0),c&&o(y,c)&&(y=y.slice(0,-1*c.length)),t&&(y=y.split(t).join("")),i&&(y=y.replace(i,".")),m&&(g+="-"),""!==(g=(g+=y).replace(/[^0-9\.\-.]/g,""))&&(g=Number(g),s&&(g=s(g)),!!r(g)&&g))}function s(t){var n,o,r,a={};for(void 0===t.suffix&&(t.suffix=t.postfix),n=0;n<e.length;n+=1)if(void 0===(r=t[o=e[n]]))"negative"!==o||a.negativeBefore?"mark"===o&&"."!==a.thousand?a[o]=".":a[o]=!1:a[o]="-";else if("decimals"===o){if(!(r>=0&&r<8))throw new Error(o);a[o]=r}else if("encoder"===o||"decoder"===o||"edit"===o||"undo"===o){if("function"!=typeof r)throw new Error(o);a[o]=r}else{if("string"!=typeof r)throw new Error(o);a[o]=r}return i(a,"mark","thousand"),i(a,"prefix","negative"),i(a,"prefix","negativeBefore"),a}function l(t,n,o){var i,r=[];for(i=0;i<e.length;i+=1)r.push(t[e[i]]);return r.push(o),n.apply("",r)}function f(e){if(!(this instanceof f))return new f(e);"object"==typeof e&&(e=s(e),this.to=function(t){return l(e,c,t)},this.from=function(t){return l(e,u,t)})}return f}());var c="footer",u="".concat(c,"__menu-section"),s="".concat(c,"__accordion-toggle"),l=function(){return e=function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.ODS_Footer?t.ODS_Footer:(this.element=t,this.sections=[],this.mediaQueryList=window.matchMedia("(max-width: 479.98px)"),this.onToggleClick=this.handleToggleClick.bind(this),this.onMediaQueryChange=this.syncViewportState.bind(this),this.element.ODS_Footer=this,this.init(),this)},o=[{key:"getInstance",value:function(e){return e&&e.ODS_Footer?e.ODS_Footer:null}}],(n=[{key:"init",value:function(){var e=this;this.sections=Array.from(this.element.querySelectorAll("[data-footer-section].".concat(u))).map(function(t){var n=t.querySelector(".".concat(s)),o=null==n?void 0:n.getAttribute("aria-controls"),i=o?e.element.querySelector("#".concat(o)):null;return n&&n.addEventListener("click",e.onToggleClick),{element:t,toggle:n,panel:i}}),this.mediaQueryList.addEventListener("change",this.onMediaQueryChange),this.syncViewportState()}},{key:"setSectionState",value:function(e,t){e.toggle&&e.panel&&(e.toggle.setAttribute("aria-expanded",String(t)),e.panel.hidden=!t)}},{key:"syncViewportState",value:function(){var e=this,t=this.mediaQueryList.matches;this.sections.forEach(function(n,o){if(n.toggle&&n.panel){if(!t)return e.setSectionState(n,!0),void n.element.removeAttribute("data-footer-mobile-initialized");if("true"!==n.element.getAttribute("data-footer-mobile-initialized"))return e.setSectionState(n,0===o),void n.element.setAttribute("data-footer-mobile-initialized","true");var i="true"===n.toggle.getAttribute("aria-expanded");e.setSectionState(n,i)}})}},{key:"handleToggleClick",value:function(e){if(this.mediaQueryList.matches){var t=e.currentTarget,n=this.sections.find(function(e){return e.toggle===t});if(n&&n.toggle){var o="true"===n.toggle.getAttribute("aria-expanded");this.setSectionState(n,!o)}}}},{key:"destroy",value:function(){var e=this;this.sections.forEach(function(t){t.toggle&&t.toggle.removeEventListener("click",e.onToggleClick)}),this.mediaQueryList.removeEventListener("change",this.onMediaQueryChange)}},{key:"update",value:function(){this.destroy(),this.init()}}])&&t(e.prototype,n),o&&t(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}(),f=[{Module:l,name:"Footer",selector:"[data-footer]"}];window.ODSFooter=window.ODSFooter||{Footer:l,instances:[],init:function(){window.ODSFooter.instances=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Array.from(document.querySelectorAll(t)).map(function(t){return new e(t,n)})}(l,"[data-footer]")},destroy:function(){window.ODSFooter.instances.forEach(function(e){e&&"function"==typeof e.destroy&&e.destroy()}),window.ODSFooter.instances=[]},initModulesWithin:function(e){var t={};return window.ODS.moduleSelectorPairs.forEach(function(o){var i,r=(i=o.name).charAt(0).toLowerCase()+i.slice(1),a=Array.from(e.querySelectorAll(o.selector)),c="ODS_".concat(o.name),u=a.filter(function(e){return!e[c]});window&&window.ODS&&window.ODS.instances[r]&&(window.ODS.instances[r]=window.ODS.instances[r].filter(function(e){var t,n=document.contains(e.element);n||(null===(t=e.destroy)||void 0===t||t.call(e));return n}),window.ODS.instances[r].forEach(function(e){u.forEach(function(t,n){t.isSameNode(e.element)&&u.splice(n,1)})})),u.length&&(Array.isArray(window.ODS.instances[r])||(window.ODS.instances[r]=[]),t[r]=u.map(function(e){return new o.Module(e)}),window.ODS.instances[r]=[].concat(n(window.ODS.instances[r]),n(t[r])))}),t},destroyModulesWithin:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={};return Object.keys(window.ODS.instances).forEach(function(o){window.ODS.instances[o].forEach(function(r){"object"!==i(n[o])&&(n[o]=[]);var a,c=e.contains(r.element);"modal"===o?c=null===(a=r.instance)||void 0===a?void 0:a._openers.every(function(t){return e.contains(t)}):"tooltip"===o&&(c=e.contains(r.trigger));c&&(r.destroy(),n[o].push(r)),c&&t&&["modal","tooltip"].includes(o)&&r.element.remove()}),window.ODS.instances[o]=window.ODS.instances[o].filter(function(e){return!n[o].includes(e)})}),n}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){window.ODSFooter.init()}):window.ODSFooter.init();export{l as Footer,f as customFooterModuleSelectorPairs,l as default};
|
|
2
2
|
//# sourceMappingURL=footer.js.map
|
package/build/lib/footer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sources":["../../../src/components/Footer/constants.ts","../../../src/components/Footer/Footer.static.ts","../../node_modules/.pnpm/wnumb@1.2.0/node_modules/wnumb/wNumb.js","../../src/components/Footer/static.ts","../../../src/scripts/lib/moduleFactory.js","../../src/utils/helpers.js"],"sourcesContent":["export const CLASS_ROOT = \"footer\";\n\nexport const CLASS_CONTAINER = `${CLASS_ROOT}__container`;\nexport const CLASS_LOGO = `${CLASS_ROOT}__logo`;\nexport const CLASS_TITLE = `${CLASS_ROOT}__title`;\nexport const CLASS_LIST = `${CLASS_ROOT}__list`;\nexport const CLASS_LIST_SPACE_SMALL = `${CLASS_ROOT}__list--space-small`;\nexport const CLASS_LIST_INLINE = `${CLASS_ROOT}__list--inline`;\nexport const CLASS_LIST_STACK_SM_DOWN = `${CLASS_ROOT}__list--stack-sm-down`;\nexport const CLASS_LIST_BREAK_SM_DOWN = `${CLASS_ROOT}__list-break--sm-down`;\nexport const CLASS_LIST_ITEM_LEAD = `${CLASS_ROOT}__list-item--lead`;\nexport const CLASS_BOTTOM = `${CLASS_ROOT}__bottom`;\nexport const CLASS_BOTTOM_COPYRIGHT = `${CLASS_ROOT}__bottom-copyright`;\nexport const CLASS_MENU = `${CLASS_ROOT}__menu`;\nexport const CLASS_MENU_SECTION = `${CLASS_ROOT}__menu-section`;\nexport const CLASS_BAR = `${CLASS_ROOT}__bar`;\nexport const CLASS_MB_LARGE = `${CLASS_ROOT}--mb-xlarge`;\nexport const CLASS_ACCORDION_TOGGLE = `${CLASS_ROOT}__accordion-toggle`;\nexport const CLASS_ACCORDION_ICON = `${CLASS_ROOT}__accordion-icon`;\nexport const CLASS_DIVIDER = `${CLASS_ROOT}__divider`;\nexport const CLASS_DIVIDER_HIDE_XS_DOWN = `${CLASS_DIVIDER}--hide-xs-down`;\n","import { CLASS_ACCORDION_TOGGLE, CLASS_MENU_SECTION } from \"./constants\";\n\nconst MOBILE_MEDIA_QUERY = \"(max-width: 479.98px)\";\n\ninterface FooterSection {\n element: HTMLElement;\n toggle: HTMLButtonElement | null;\n panel: HTMLElement | null;\n}\n\nexport default class Footer {\n element!: HTMLElement;\n sections!: FooterSection[];\n mediaQueryList!: MediaQueryList;\n onToggleClick!: (event: Event) => void;\n onMediaQueryChange!: () => void;\n\n constructor(element: HTMLElement) {\n if ((element as any).ODS_Footer) {\n return (element as any).ODS_Footer;\n }\n\n this.element = element;\n this.sections = [];\n this.mediaQueryList = window.matchMedia(MOBILE_MEDIA_QUERY);\n\n this.onToggleClick = this.handleToggleClick.bind(this);\n this.onMediaQueryChange = this.syncViewportState.bind(this);\n\n (this.element as any).ODS_Footer = this;\n\n this.init();\n return this;\n }\n\n static getInstance(el: HTMLElement): Footer | null {\n return el && (el as any).ODS_Footer ? (el as any).ODS_Footer : null;\n }\n\n init(): void {\n this.sections = Array.from(\n this.element.querySelectorAll(\n `[data-footer-section].${CLASS_MENU_SECTION}`,\n ),\n ).map((section) => {\n const toggle = section.querySelector(\n `.${CLASS_ACCORDION_TOGGLE}`,\n ) as HTMLButtonElement | null;\n const panelId = toggle?.getAttribute(\"aria-controls\");\n const panel = panelId\n ? (this.element.querySelector(`#${panelId}`) as HTMLElement | null)\n : null;\n\n if (toggle) {\n toggle.addEventListener(\"click\", this.onToggleClick);\n }\n\n return {\n element: section as HTMLElement,\n toggle,\n panel,\n };\n });\n\n this.mediaQueryList.addEventListener(\"change\", this.onMediaQueryChange);\n\n this.syncViewportState();\n }\n\n private setSectionState(section: FooterSection, isExpanded: boolean): void {\n if (!section.toggle || !section.panel) return;\n\n section.toggle.setAttribute(\"aria-expanded\", String(isExpanded));\n section.panel.hidden = !isExpanded;\n }\n\n private syncViewportState(): void {\n const isMobile = this.mediaQueryList.matches;\n\n this.sections.forEach((section, index) => {\n if (!section.toggle || !section.panel) return;\n\n if (!isMobile) {\n this.setSectionState(section, true);\n section.element.removeAttribute(\"data-footer-mobile-initialized\");\n return;\n }\n\n const isInitialized =\n section.element.getAttribute(\"data-footer-mobile-initialized\") ===\n \"true\";\n\n if (!isInitialized) {\n this.setSectionState(section, index === 0);\n section.element.setAttribute(\"data-footer-mobile-initialized\", \"true\");\n return;\n }\n\n const isExpanded =\n section.toggle.getAttribute(\"aria-expanded\") === \"true\";\n this.setSectionState(section, isExpanded);\n });\n }\n\n private handleToggleClick(event: Event): void {\n if (!this.mediaQueryList.matches) return;\n\n const toggle = event.currentTarget as HTMLButtonElement;\n const section = this.sections.find((item) => item.toggle === toggle);\n\n if (!section || !section.toggle) return;\n\n const isExpanded = section.toggle.getAttribute(\"aria-expanded\") === \"true\";\n this.setSectionState(section, !isExpanded);\n }\n\n destroy(): void {\n this.sections.forEach((section) => {\n if (!section.toggle) return;\n section.toggle.removeEventListener(\"click\", this.onToggleClick);\n });\n\n this.mediaQueryList.removeEventListener(\"change\", this.onMediaQueryChange);\n }\n\n update(): void {\n this.destroy();\n this.init();\n }\n}\n","(function(factory) {\r\n if (typeof define === \"function\" && define.amd) {\r\n // AMD. Register as an anonymous module.\r\n define([], factory);\r\n } else if (typeof exports === \"object\") {\r\n // Node/CommonJS\r\n module.exports = factory();\r\n } else {\r\n // Browser globals\r\n window.wNumb = factory();\r\n }\r\n})(function() {\r\n \"use strict\";\r\n\r\n var FormatOptions = [\r\n \"decimals\",\r\n \"thousand\",\r\n \"mark\",\r\n \"prefix\",\r\n \"suffix\",\r\n \"encoder\",\r\n \"decoder\",\r\n \"negativeBefore\",\r\n \"negative\",\r\n \"edit\",\r\n \"undo\"\r\n ];\r\n\r\n // General\r\n\r\n // Reverse a string\r\n function strReverse(a) {\r\n return a\r\n .split(\"\")\r\n .reverse()\r\n .join(\"\");\r\n }\r\n\r\n // Check if a string starts with a specified prefix.\r\n function strStartsWith(input, match) {\r\n return input.substring(0, match.length) === match;\r\n }\r\n\r\n // Check is a string ends in a specified suffix.\r\n function strEndsWith(input, match) {\r\n return input.slice(-1 * match.length) === match;\r\n }\r\n\r\n // Throw an error if formatting options are incompatible.\r\n function throwEqualError(F, a, b) {\r\n if ((F[a] || F[b]) && F[a] === F[b]) {\r\n throw new Error(a);\r\n }\r\n }\r\n\r\n // Check if a number is finite and not NaN\r\n function isValidNumber(input) {\r\n return typeof input === \"number\" && isFinite(input);\r\n }\r\n\r\n // Provide rounding-accurate toFixed method.\r\n // Borrowed: http://stackoverflow.com/a/21323330/775265\r\n function toFixed(value, exp) {\r\n value = value.toString().split(\"e\");\r\n value = Math.round(+(value[0] + \"e\" + (value[1] ? +value[1] + exp : exp)));\r\n value = value.toString().split(\"e\");\r\n return (+(value[0] + \"e\" + (value[1] ? +value[1] - exp : -exp))).toFixed(exp);\r\n }\r\n\r\n // Formatting\r\n\r\n // Accept a number as input, output formatted string.\r\n function formatTo(\r\n decimals,\r\n thousand,\r\n mark,\r\n prefix,\r\n suffix,\r\n encoder,\r\n decoder,\r\n negativeBefore,\r\n negative,\r\n edit,\r\n undo,\r\n input\r\n ) {\r\n var originalInput = input,\r\n inputIsNegative,\r\n inputPieces,\r\n inputBase,\r\n inputDecimals = \"\",\r\n output = \"\";\r\n\r\n // Apply user encoder to the input.\r\n // Expected outcome: number.\r\n if (encoder) {\r\n input = encoder(input);\r\n }\r\n\r\n // Stop if no valid number was provided, the number is infinite or NaN.\r\n if (!isValidNumber(input)) {\r\n return false;\r\n }\r\n\r\n // Rounding away decimals might cause a value of -0\r\n // when using very small ranges. Remove those cases.\r\n if (decimals !== false && parseFloat(input.toFixed(decimals)) === 0) {\r\n input = 0;\r\n }\r\n\r\n // Formatting is done on absolute numbers,\r\n // decorated by an optional negative symbol.\r\n if (input < 0) {\r\n inputIsNegative = true;\r\n input = Math.abs(input);\r\n }\r\n\r\n // Reduce the number of decimals to the specified option.\r\n if (decimals !== false) {\r\n input = toFixed(input, decimals);\r\n }\r\n\r\n // Transform the number into a string, so it can be split.\r\n input = input.toString();\r\n\r\n // Break the number on the decimal separator.\r\n if (input.indexOf(\".\") !== -1) {\r\n inputPieces = input.split(\".\");\r\n\r\n inputBase = inputPieces[0];\r\n\r\n if (mark) {\r\n inputDecimals = mark + inputPieces[1];\r\n }\r\n } else {\r\n // If it isn't split, the entire number will do.\r\n inputBase = input;\r\n }\r\n\r\n // Group numbers in sets of three.\r\n if (thousand) {\r\n inputBase = strReverse(inputBase).match(/.{1,3}/g);\r\n inputBase = strReverse(inputBase.join(strReverse(thousand)));\r\n }\r\n\r\n // If the number is negative, prefix with negation symbol.\r\n if (inputIsNegative && negativeBefore) {\r\n output += negativeBefore;\r\n }\r\n\r\n // Prefix the number\r\n if (prefix) {\r\n output += prefix;\r\n }\r\n\r\n // Normal negative option comes after the prefix. Defaults to '-'.\r\n if (inputIsNegative && negative) {\r\n output += negative;\r\n }\r\n\r\n // Append the actual number.\r\n output += inputBase;\r\n output += inputDecimals;\r\n\r\n // Apply the suffix.\r\n if (suffix) {\r\n output += suffix;\r\n }\r\n\r\n // Run the output through a user-specified post-formatter.\r\n if (edit) {\r\n output = edit(output, originalInput);\r\n }\r\n\r\n // All done.\r\n return output;\r\n }\r\n\r\n // Accept a sting as input, output decoded number.\r\n function formatFrom(\r\n decimals,\r\n thousand,\r\n mark,\r\n prefix,\r\n suffix,\r\n encoder,\r\n decoder,\r\n negativeBefore,\r\n negative,\r\n edit,\r\n undo,\r\n input\r\n ) {\r\n var originalInput = input,\r\n inputIsNegative,\r\n output = \"\";\r\n\r\n // User defined pre-decoder. Result must be a non empty string.\r\n if (undo) {\r\n input = undo(input);\r\n }\r\n\r\n // Test the input. Can't be empty.\r\n if (!input || typeof input !== \"string\") {\r\n return false;\r\n }\r\n\r\n // If the string starts with the negativeBefore value: remove it.\r\n // Remember is was there, the number is negative.\r\n if (negativeBefore && strStartsWith(input, negativeBefore)) {\r\n input = input.replace(negativeBefore, \"\");\r\n inputIsNegative = true;\r\n }\r\n\r\n // Repeat the same procedure for the prefix.\r\n if (prefix && strStartsWith(input, prefix)) {\r\n input = input.replace(prefix, \"\");\r\n }\r\n\r\n // And again for negative.\r\n if (negative && strStartsWith(input, negative)) {\r\n input = input.replace(negative, \"\");\r\n inputIsNegative = true;\r\n }\r\n\r\n // Remove the suffix.\r\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice\r\n if (suffix && strEndsWith(input, suffix)) {\r\n input = input.slice(0, -1 * suffix.length);\r\n }\r\n\r\n // Remove the thousand grouping.\r\n if (thousand) {\r\n input = input.split(thousand).join(\"\");\r\n }\r\n\r\n // Set the decimal separator back to period.\r\n if (mark) {\r\n input = input.replace(mark, \".\");\r\n }\r\n\r\n // Prepend the negative symbol.\r\n if (inputIsNegative) {\r\n output += \"-\";\r\n }\r\n\r\n // Add the number\r\n output += input;\r\n\r\n // Trim all non-numeric characters (allow '.' and '-');\r\n output = output.replace(/[^0-9\\.\\-.]/g, \"\");\r\n\r\n // The value contains no parse-able number.\r\n if (output === \"\") {\r\n return false;\r\n }\r\n\r\n // Covert to number.\r\n output = Number(output);\r\n\r\n // Run the user-specified post-decoder.\r\n if (decoder) {\r\n output = decoder(output);\r\n }\r\n\r\n // Check is the output is valid, otherwise: return false.\r\n if (!isValidNumber(output)) {\r\n return false;\r\n }\r\n\r\n return output;\r\n }\r\n\r\n // Framework\r\n\r\n // Validate formatting options\r\n function validate(inputOptions) {\r\n var i,\r\n optionName,\r\n optionValue,\r\n filteredOptions = {};\r\n\r\n if (inputOptions[\"suffix\"] === undefined) {\r\n inputOptions[\"suffix\"] = inputOptions[\"postfix\"];\r\n }\r\n\r\n for (i = 0; i < FormatOptions.length; i += 1) {\r\n optionName = FormatOptions[i];\r\n optionValue = inputOptions[optionName];\r\n\r\n if (optionValue === undefined) {\r\n // Only default if negativeBefore isn't set.\r\n if (optionName === \"negative\" && !filteredOptions.negativeBefore) {\r\n filteredOptions[optionName] = \"-\";\r\n // Don't set a default for mark when 'thousand' is set.\r\n } else if (optionName === \"mark\" && filteredOptions.thousand !== \".\") {\r\n filteredOptions[optionName] = \".\";\r\n } else {\r\n filteredOptions[optionName] = false;\r\n }\r\n\r\n // Floating points in JS are stable up to 7 decimals.\r\n } else if (optionName === \"decimals\") {\r\n if (optionValue >= 0 && optionValue < 8) {\r\n filteredOptions[optionName] = optionValue;\r\n } else {\r\n throw new Error(optionName);\r\n }\r\n\r\n // These options, when provided, must be functions.\r\n } else if (\r\n optionName === \"encoder\" ||\r\n optionName === \"decoder\" ||\r\n optionName === \"edit\" ||\r\n optionName === \"undo\"\r\n ) {\r\n if (typeof optionValue === \"function\") {\r\n filteredOptions[optionName] = optionValue;\r\n } else {\r\n throw new Error(optionName);\r\n }\r\n\r\n // Other options are strings.\r\n } else {\r\n if (typeof optionValue === \"string\") {\r\n filteredOptions[optionName] = optionValue;\r\n } else {\r\n throw new Error(optionName);\r\n }\r\n }\r\n }\r\n\r\n // Some values can't be extracted from a\r\n // string if certain combinations are present.\r\n throwEqualError(filteredOptions, \"mark\", \"thousand\");\r\n throwEqualError(filteredOptions, \"prefix\", \"negative\");\r\n throwEqualError(filteredOptions, \"prefix\", \"negativeBefore\");\r\n\r\n return filteredOptions;\r\n }\r\n\r\n // Pass all options as function arguments\r\n function passAll(options, method, input) {\r\n var i,\r\n args = [];\r\n\r\n // Add all options in order of FormatOptions\r\n for (i = 0; i < FormatOptions.length; i += 1) {\r\n args.push(options[FormatOptions[i]]);\r\n }\r\n\r\n // Append the input, then call the method, presenting all\r\n // options as arguments.\r\n args.push(input);\r\n return method.apply(\"\", args);\r\n }\r\n\r\n function wNumb(options) {\r\n if (!(this instanceof wNumb)) {\r\n return new wNumb(options);\r\n }\r\n\r\n if (typeof options !== \"object\") {\r\n return;\r\n }\r\n\r\n options = validate(options);\r\n\r\n // Call 'formatTo' with proper arguments.\r\n this.to = function(input) {\r\n return passAll(options, formatTo, input);\r\n };\r\n\r\n // Call 'formatFrom' with proper arguments.\r\n this.from = function(input) {\r\n return passAll(options, formatFrom, input);\r\n };\r\n }\r\n\r\n return wNumb;\r\n});\r\n","import Footer from \"./Footer.static\";\nimport moduleFactory, {\n initModulesWithin,\n destroyModulesWithin,\n} from \"../../scripts/lib/moduleFactory\";\nimport \"./styles/style.scss\";\n\nexport const customFooterModuleSelectorPairs = [\n {\n Module: Footer,\n name: \"Footer\",\n selector: \"[data-footer]\",\n },\n];\n\ndeclare global {\n interface Window {\n ODSFooter: {\n Footer: typeof Footer;\n instances: Footer[];\n init: () => void;\n destroy: () => void;\n initModulesWithin: (container: any) => {};\n destroyModulesWithin: (\n container: any,\n removeOrphanedNodes?: boolean | undefined,\n ) => {};\n };\n }\n}\n\nwindow.ODSFooter = window.ODSFooter || {\n Footer,\n instances: [],\n init: () => {\n window.ODSFooter.instances = moduleFactory(Footer, \"[data-footer]\");\n },\n destroy: () => {\n window.ODSFooter.instances.forEach((instance) => {\n if (instance && typeof instance.destroy === \"function\") {\n instance.destroy();\n }\n });\n window.ODSFooter.instances = [];\n },\n initModulesWithin,\n destroyModulesWithin,\n};\n\nif (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => {\n window.ODSFooter.init();\n });\n} else {\n window.ODSFooter.init();\n}\n\nexport { Footer };\nexport default Footer;\n","import { lowerCamelCase } from \"../../utils/helpers\";\n\nexport default function moduleFactory(Module, selector, options = {}) {\n const elements = Array.from(document.querySelectorAll(selector));\n\n return elements.map((element) => new Module(element, options));\n}\n\nexport function destroyModulesWithin(container, removeOrphanedNodes = false) {\n const destroyedInstances = {};\n\n Object.keys(window.ODS.instances).forEach((moduleName) => {\n window.ODS.instances[moduleName].forEach((instance) => {\n if (typeof destroyedInstances[moduleName] !== \"object\") {\n destroyedInstances[moduleName] = [];\n }\n\n let isInContainer = container.contains(instance.element);\n if (moduleName === \"modal\") {\n isInContainer = instance.instance?._openers.every((opener) =>\n container.contains(opener),\n );\n } else if (moduleName === \"tooltip\") {\n isInContainer = container.contains(instance.trigger);\n }\n\n if (isInContainer) {\n instance.destroy();\n destroyedInstances[moduleName].push(instance);\n }\n\n if (\n isInContainer &&\n removeOrphanedNodes &&\n [\"modal\", \"tooltip\"].includes(moduleName)\n ) {\n instance.element.remove();\n }\n });\n\n window.ODS.instances[moduleName] = window.ODS.instances[moduleName].filter(\n (instance) => !destroyedInstances[moduleName].includes(instance),\n );\n });\n\n return destroyedInstances;\n}\n\nexport function initModulesWithin(container) {\n const instances = {};\n window.ODS.moduleSelectorPairs.forEach((module) => {\n const name = lowerCamelCase(module.name);\n const elements = Array.from(container.querySelectorAll(module.selector));\n\n // Filter out elements that already have an instance (e.g., initialized by React)\n const instancePropertyName = `ODS_${module.name}`;\n const uninitializedElements = elements.filter(\n (element) => !element[instancePropertyName],\n );\n\n if (window && window.ODS && window.ODS.instances[name]) {\n // Also clean up instances from elements that are no longer in the document\n window.ODS.instances[name] = window.ODS.instances[name].filter(\n (instance) => {\n const isInDocument = document.contains(instance.element);\n if (!isInDocument) {\n // Clean up the instance if its element is no longer in the document\n instance.destroy?.();\n }\n return isInDocument;\n },\n );\n\n window.ODS.instances[name].forEach((instance) => {\n uninitializedElements.forEach((element, index) => {\n if (element.isSameNode(instance.element)) {\n uninitializedElements.splice(index, 1);\n }\n });\n });\n }\n if (uninitializedElements.length) {\n if (!Array.isArray(window.ODS.instances[name])) {\n window.ODS.instances[name] = [];\n }\n instances[name] = uninitializedElements.map(\n (element) => new module.Module(element),\n );\n window.ODS.instances[name] = [\n ...window.ODS.instances[name],\n ...instances[name],\n ];\n }\n });\n return instances;\n}\n","import wnumb from 'wnumb';\n\nexport function isObject(val) {\n return val != null && typeof val === 'object' && Array.isArray(val) === false;\n}\n\nexport function dateToYYYYMMDD(date) {\n if (!date || !(date instanceof Date)) {\n return '';\n }\n\n return `${date.getFullYear()}-${(date.getMonth() + 1)\n .toString()\n .padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;\n}\n\n// Get element position relative to document\nexport function windowOffset(el) {\n const position = { x: 0, y: 0 };\n\n \n if (el.offsetParent) {\n do {\n position.x += el.offsetLeft;\n position.y += el.offsetTop;\n } while ((el = el.offsetParent));\n }\n \n\n return position;\n}\n\n// Get element siblings\nexport function getSiblings(el) {\n if (!(el instanceof Element)) {\n return false;\n }\n\n const parent = el.parentNode;\n if (!parent) {\n return false;\n }\n\n const parentChildren = [];\n const siblings = [];\n\n parentChildren.push.apply(parentChildren, parent.children); \n\n for (let i = 0, l = parentChildren.length; i < l; i += 1) {\n if (parentChildren[i] !== el) {\n siblings.push(parentChildren[i]);\n }\n }\n\n return siblings;\n}\n\n/**\n * Converts object to string\n *\n * Should be able to handle all types\n * objectToString({\n * 'boolean': true,\n * 'function': () => { return 'test'; },\n * 'namedfunction': function test() { return 'test'; },\n * 'null': null,\n * 'number1': 1,\n * 'number2': 2.345,\n * 'object1': { test: 'test' },\n * 'string': 'String',\n * 'undefined' : undefined,\n * })\n *\n * @param {object} object object to convert\n * @returns object converted to string\n */\nexport const objectToString = (object, spaceCount = 2) => {\n let str = '';\n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n let value = object?.[key];\n if (typeof value === 'string') {\n value = `\"${value}\"`;\n } else if (value === null) {\n value = 'null';\n } else if (typeof value === 'object') {\n value = objectToString(value, spaceCount + 2);\n } else if (typeof value === 'function') {\n value = value.toString();\n } else if (value === undefined) {\n value = 'undefined';\n }\n str += `${' '.repeat(spaceCount)}${key}: ${value},\\n`;\n }\n }\n return `{\\n${str}${' '.repeat(spaceCount - 2)}}`;\n};\nexport function capitalize(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nexport function lowerCamelCase(string) {\n return string.charAt(0).toLowerCase() + string.slice(1);\n}\n\nconst defaultPriceFormat = {\n decimals: 2,\n mark: ',',\n thousand: ' ',\n suffix: `\\xa0€`,\n};\n\nexport function formatPrice(price, format) {\n return wnumb({\n ...defaultPriceFormat,\n ...format,\n ...(price % 1 === 0 ? { decimals: 0 } : {}), // integers without decimals\n }).to(price);\n}\n"],"names":["CLASS_ROOT","CLASS_MENU_SECTION","concat","CLASS_ACCORDION_TOGGLE","Footer","element","_classCallCheck","ODS_Footer","this","sections","mediaQueryList","window","matchMedia","onToggleClick","handleToggleClick","bind","onMediaQueryChange","syncViewportState","init","key","value","el","_this","Array","from","querySelectorAll","map","section","toggle","querySelector","panelId","getAttribute","panel","addEventListener","isExpanded","setAttribute","String","hidden","_this2","isMobile","matches","forEach","index","setSectionState","removeAttribute","event","currentTarget","find","item","_this3","removeEventListener","destroy","exports","FormatOptions","strReverse","a","split","reverse","join","strStartsWith","input","match","substring","length","strEndsWith","slice","throwEqualError","F","b","Error","isValidNumber","isFinite","toFixed","exp","toString","Math","round","formatTo","decimals","thousand","mark","prefix","suffix","encoder","decoder","negativeBefore","negative","edit","undo","inputIsNegative","inputPieces","inputBase","originalInput","inputDecimals","output","parseFloat","abs","indexOf","formatFrom","replace","Number","validate","inputOptions","i","optionName","optionValue","filteredOptions","undefined","passAll","options","method","args","push","apply","wNumb","to","factory","customFooterModuleSelectorPairs","Module","name","selector","ODSFooter","instances","arguments","document","moduleFactory","instance","initModulesWithin","container","ODS","moduleSelectorPairs","module","string","charAt","toLowerCase","elements","instancePropertyName","uninitializedElements","filter","_instance$destroy","isInDocument","contains","call","isSameNode","splice","isArray","_toConsumableArray","destroyModulesWithin","removeOrphanedNodes","destroyedInstances","Object","keys","moduleName","_typeof","_instance$instance","isInContainer","_openers","every","opener","trigger","includes","remove","readyState"],"mappings":"g5CAAO,MAAMA,EAAa,SAcbC,EAAkB,GAAAC,OAAMF,EAAU,kBAGlCG,EAAsB,GAAAD,OAAMF,EAAU,sBCP9BI,EAAM,WAuBxB,SAhBD,SAAAA,EAAYC,GACV,mGAD8BC,MAAAF,GACzBC,EAAgBE,WACXF,EAAgBE,YAG1BC,KAAKH,QAAUA,EACfG,KAAKC,SAAW,GAChBD,KAAKE,eAAiBC,OAAOC,WAtBN,yBAwBvBJ,KAAKK,cAAgBL,KAAKM,kBAAkBC,KAAKP,MACjDA,KAAKQ,mBAAqBR,KAAKS,kBAAkBF,KAAKP,MAErDA,KAAKH,QAAgBE,WAAaC,KAEnCA,KAAKU,OACEV,KACT,IA+FC,CAAA,CAAAW,IAAA,cAAAC,MA7FD,SAAmBC,GACjB,OAAOA,GAAOA,EAAWd,WAAcc,EAAWd,WAAa,IACjE,OAJC,CAAA,CAAAY,IAAA,OAAAC,MAMD,WAAI,IAAAE,EAAAd,KACFA,KAAKC,SAAWc,MAAMC,KACpBhB,KAAKH,QAAQoB,0CAAgBvB,OACFD,KAE3ByB,IAAI,SAACC,GACL,IAAMC,EAASD,EAAQE,kBAAa3B,OAC9BC,IAEA2B,EAAUF,eAAAA,EAAQG,aAAa,iBAC/BC,EAAQF,EACTR,EAAKjB,QAAQwB,cAAa,IAAA3B,OAAK4B,IAChC,KAMJ,OAJIF,GACFA,EAAOK,iBAAiB,QAASX,EAAKT,eAGjC,CACLR,QAASsB,EACTC,OAAAA,EACAI,MAAAA,EAEJ,GAEAxB,KAAKE,eAAeuB,iBAAiB,SAAUzB,KAAKQ,oBAEpDR,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,QAErB,GAEAtJ,OAAOsH,IAAIP,UAAU8B,GAAc7I,OAAOsH,IAAIP,UAAU8B,GAAYd,OAClE,SAACZ,GAAQ,OAAMuB,EAAmBG,GAAYQ,SAASlC,EAAS,EAEpE,GAEOuB,CACT,GDG4B,YAAxBzB,SAASsC,WACXtC,SAAS3F,iBAAiB,mBAAoB,WAC5CtB,OAAO8G,UAAUvG,MACnB,GAEAP,OAAO8G,UAAUvG","x_google_ignoreList":[2]}
|
|
1
|
+
{"version":3,"file":"footer.js","sources":["../../node_modules/.pnpm/wnumb@1.2.0/node_modules/wnumb/wNumb.js","../../../src/components/Footer/constants.ts","../../../src/components/Footer/Footer.static.ts","../../src/components/Footer/static.ts","../../../src/scripts/lib/moduleFactory.js","../../src/utils/helpers.js"],"sourcesContent":["(function(factory) {\r\n if (typeof define === \"function\" && define.amd) {\r\n // AMD. Register as an anonymous module.\r\n define([], factory);\r\n } else if (typeof exports === \"object\") {\r\n // Node/CommonJS\r\n module.exports = factory();\r\n } else {\r\n // Browser globals\r\n window.wNumb = factory();\r\n }\r\n})(function() {\r\n \"use strict\";\r\n\r\n var FormatOptions = [\r\n \"decimals\",\r\n \"thousand\",\r\n \"mark\",\r\n \"prefix\",\r\n \"suffix\",\r\n \"encoder\",\r\n \"decoder\",\r\n \"negativeBefore\",\r\n \"negative\",\r\n \"edit\",\r\n \"undo\"\r\n ];\r\n\r\n // General\r\n\r\n // Reverse a string\r\n function strReverse(a) {\r\n return a\r\n .split(\"\")\r\n .reverse()\r\n .join(\"\");\r\n }\r\n\r\n // Check if a string starts with a specified prefix.\r\n function strStartsWith(input, match) {\r\n return input.substring(0, match.length) === match;\r\n }\r\n\r\n // Check is a string ends in a specified suffix.\r\n function strEndsWith(input, match) {\r\n return input.slice(-1 * match.length) === match;\r\n }\r\n\r\n // Throw an error if formatting options are incompatible.\r\n function throwEqualError(F, a, b) {\r\n if ((F[a] || F[b]) && F[a] === F[b]) {\r\n throw new Error(a);\r\n }\r\n }\r\n\r\n // Check if a number is finite and not NaN\r\n function isValidNumber(input) {\r\n return typeof input === \"number\" && isFinite(input);\r\n }\r\n\r\n // Provide rounding-accurate toFixed method.\r\n // Borrowed: http://stackoverflow.com/a/21323330/775265\r\n function toFixed(value, exp) {\r\n value = value.toString().split(\"e\");\r\n value = Math.round(+(value[0] + \"e\" + (value[1] ? +value[1] + exp : exp)));\r\n value = value.toString().split(\"e\");\r\n return (+(value[0] + \"e\" + (value[1] ? +value[1] - exp : -exp))).toFixed(exp);\r\n }\r\n\r\n // Formatting\r\n\r\n // Accept a number as input, output formatted string.\r\n function formatTo(\r\n decimals,\r\n thousand,\r\n mark,\r\n prefix,\r\n suffix,\r\n encoder,\r\n decoder,\r\n negativeBefore,\r\n negative,\r\n edit,\r\n undo,\r\n input\r\n ) {\r\n var originalInput = input,\r\n inputIsNegative,\r\n inputPieces,\r\n inputBase,\r\n inputDecimals = \"\",\r\n output = \"\";\r\n\r\n // Apply user encoder to the input.\r\n // Expected outcome: number.\r\n if (encoder) {\r\n input = encoder(input);\r\n }\r\n\r\n // Stop if no valid number was provided, the number is infinite or NaN.\r\n if (!isValidNumber(input)) {\r\n return false;\r\n }\r\n\r\n // Rounding away decimals might cause a value of -0\r\n // when using very small ranges. Remove those cases.\r\n if (decimals !== false && parseFloat(input.toFixed(decimals)) === 0) {\r\n input = 0;\r\n }\r\n\r\n // Formatting is done on absolute numbers,\r\n // decorated by an optional negative symbol.\r\n if (input < 0) {\r\n inputIsNegative = true;\r\n input = Math.abs(input);\r\n }\r\n\r\n // Reduce the number of decimals to the specified option.\r\n if (decimals !== false) {\r\n input = toFixed(input, decimals);\r\n }\r\n\r\n // Transform the number into a string, so it can be split.\r\n input = input.toString();\r\n\r\n // Break the number on the decimal separator.\r\n if (input.indexOf(\".\") !== -1) {\r\n inputPieces = input.split(\".\");\r\n\r\n inputBase = inputPieces[0];\r\n\r\n if (mark) {\r\n inputDecimals = mark + inputPieces[1];\r\n }\r\n } else {\r\n // If it isn't split, the entire number will do.\r\n inputBase = input;\r\n }\r\n\r\n // Group numbers in sets of three.\r\n if (thousand) {\r\n inputBase = strReverse(inputBase).match(/.{1,3}/g);\r\n inputBase = strReverse(inputBase.join(strReverse(thousand)));\r\n }\r\n\r\n // If the number is negative, prefix with negation symbol.\r\n if (inputIsNegative && negativeBefore) {\r\n output += negativeBefore;\r\n }\r\n\r\n // Prefix the number\r\n if (prefix) {\r\n output += prefix;\r\n }\r\n\r\n // Normal negative option comes after the prefix. Defaults to '-'.\r\n if (inputIsNegative && negative) {\r\n output += negative;\r\n }\r\n\r\n // Append the actual number.\r\n output += inputBase;\r\n output += inputDecimals;\r\n\r\n // Apply the suffix.\r\n if (suffix) {\r\n output += suffix;\r\n }\r\n\r\n // Run the output through a user-specified post-formatter.\r\n if (edit) {\r\n output = edit(output, originalInput);\r\n }\r\n\r\n // All done.\r\n return output;\r\n }\r\n\r\n // Accept a sting as input, output decoded number.\r\n function formatFrom(\r\n decimals,\r\n thousand,\r\n mark,\r\n prefix,\r\n suffix,\r\n encoder,\r\n decoder,\r\n negativeBefore,\r\n negative,\r\n edit,\r\n undo,\r\n input\r\n ) {\r\n var originalInput = input,\r\n inputIsNegative,\r\n output = \"\";\r\n\r\n // User defined pre-decoder. Result must be a non empty string.\r\n if (undo) {\r\n input = undo(input);\r\n }\r\n\r\n // Test the input. Can't be empty.\r\n if (!input || typeof input !== \"string\") {\r\n return false;\r\n }\r\n\r\n // If the string starts with the negativeBefore value: remove it.\r\n // Remember is was there, the number is negative.\r\n if (negativeBefore && strStartsWith(input, negativeBefore)) {\r\n input = input.replace(negativeBefore, \"\");\r\n inputIsNegative = true;\r\n }\r\n\r\n // Repeat the same procedure for the prefix.\r\n if (prefix && strStartsWith(input, prefix)) {\r\n input = input.replace(prefix, \"\");\r\n }\r\n\r\n // And again for negative.\r\n if (negative && strStartsWith(input, negative)) {\r\n input = input.replace(negative, \"\");\r\n inputIsNegative = true;\r\n }\r\n\r\n // Remove the suffix.\r\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice\r\n if (suffix && strEndsWith(input, suffix)) {\r\n input = input.slice(0, -1 * suffix.length);\r\n }\r\n\r\n // Remove the thousand grouping.\r\n if (thousand) {\r\n input = input.split(thousand).join(\"\");\r\n }\r\n\r\n // Set the decimal separator back to period.\r\n if (mark) {\r\n input = input.replace(mark, \".\");\r\n }\r\n\r\n // Prepend the negative symbol.\r\n if (inputIsNegative) {\r\n output += \"-\";\r\n }\r\n\r\n // Add the number\r\n output += input;\r\n\r\n // Trim all non-numeric characters (allow '.' and '-');\r\n output = output.replace(/[^0-9\\.\\-.]/g, \"\");\r\n\r\n // The value contains no parse-able number.\r\n if (output === \"\") {\r\n return false;\r\n }\r\n\r\n // Covert to number.\r\n output = Number(output);\r\n\r\n // Run the user-specified post-decoder.\r\n if (decoder) {\r\n output = decoder(output);\r\n }\r\n\r\n // Check is the output is valid, otherwise: return false.\r\n if (!isValidNumber(output)) {\r\n return false;\r\n }\r\n\r\n return output;\r\n }\r\n\r\n // Framework\r\n\r\n // Validate formatting options\r\n function validate(inputOptions) {\r\n var i,\r\n optionName,\r\n optionValue,\r\n filteredOptions = {};\r\n\r\n if (inputOptions[\"suffix\"] === undefined) {\r\n inputOptions[\"suffix\"] = inputOptions[\"postfix\"];\r\n }\r\n\r\n for (i = 0; i < FormatOptions.length; i += 1) {\r\n optionName = FormatOptions[i];\r\n optionValue = inputOptions[optionName];\r\n\r\n if (optionValue === undefined) {\r\n // Only default if negativeBefore isn't set.\r\n if (optionName === \"negative\" && !filteredOptions.negativeBefore) {\r\n filteredOptions[optionName] = \"-\";\r\n // Don't set a default for mark when 'thousand' is set.\r\n } else if (optionName === \"mark\" && filteredOptions.thousand !== \".\") {\r\n filteredOptions[optionName] = \".\";\r\n } else {\r\n filteredOptions[optionName] = false;\r\n }\r\n\r\n // Floating points in JS are stable up to 7 decimals.\r\n } else if (optionName === \"decimals\") {\r\n if (optionValue >= 0 && optionValue < 8) {\r\n filteredOptions[optionName] = optionValue;\r\n } else {\r\n throw new Error(optionName);\r\n }\r\n\r\n // These options, when provided, must be functions.\r\n } else if (\r\n optionName === \"encoder\" ||\r\n optionName === \"decoder\" ||\r\n optionName === \"edit\" ||\r\n optionName === \"undo\"\r\n ) {\r\n if (typeof optionValue === \"function\") {\r\n filteredOptions[optionName] = optionValue;\r\n } else {\r\n throw new Error(optionName);\r\n }\r\n\r\n // Other options are strings.\r\n } else {\r\n if (typeof optionValue === \"string\") {\r\n filteredOptions[optionName] = optionValue;\r\n } else {\r\n throw new Error(optionName);\r\n }\r\n }\r\n }\r\n\r\n // Some values can't be extracted from a\r\n // string if certain combinations are present.\r\n throwEqualError(filteredOptions, \"mark\", \"thousand\");\r\n throwEqualError(filteredOptions, \"prefix\", \"negative\");\r\n throwEqualError(filteredOptions, \"prefix\", \"negativeBefore\");\r\n\r\n return filteredOptions;\r\n }\r\n\r\n // Pass all options as function arguments\r\n function passAll(options, method, input) {\r\n var i,\r\n args = [];\r\n\r\n // Add all options in order of FormatOptions\r\n for (i = 0; i < FormatOptions.length; i += 1) {\r\n args.push(options[FormatOptions[i]]);\r\n }\r\n\r\n // Append the input, then call the method, presenting all\r\n // options as arguments.\r\n args.push(input);\r\n return method.apply(\"\", args);\r\n }\r\n\r\n function wNumb(options) {\r\n if (!(this instanceof wNumb)) {\r\n return new wNumb(options);\r\n }\r\n\r\n if (typeof options !== \"object\") {\r\n return;\r\n }\r\n\r\n options = validate(options);\r\n\r\n // Call 'formatTo' with proper arguments.\r\n this.to = function(input) {\r\n return passAll(options, formatTo, input);\r\n };\r\n\r\n // Call 'formatFrom' with proper arguments.\r\n this.from = function(input) {\r\n return passAll(options, formatFrom, input);\r\n };\r\n }\r\n\r\n return wNumb;\r\n});\r\n","export const CLASS_ROOT = \"footer\";\n\nexport const CLASS_CONTAINER = `${CLASS_ROOT}__container`;\nexport const CLASS_LOGO = `${CLASS_ROOT}__logo`;\nexport const CLASS_TITLE = `${CLASS_ROOT}__title`;\nexport const CLASS_LIST = `${CLASS_ROOT}__list`;\nexport const CLASS_LIST_SPACE_SMALL = `${CLASS_ROOT}__list--space-small`;\nexport const CLASS_LIST_INLINE = `${CLASS_ROOT}__list--inline`;\nexport const CLASS_LIST_STACK_SM_DOWN = `${CLASS_ROOT}__list--stack-sm-down`;\nexport const CLASS_LIST_BREAK_SM_DOWN = `${CLASS_ROOT}__list-break--sm-down`;\nexport const CLASS_LIST_ITEM_LEAD = `${CLASS_ROOT}__list-item--lead`;\nexport const CLASS_BOTTOM = `${CLASS_ROOT}__bottom`;\nexport const CLASS_BOTTOM_COPYRIGHT = `${CLASS_ROOT}__bottom-copyright`;\nexport const CLASS_MENU = `${CLASS_ROOT}__menu`;\nexport const CLASS_MENU_SECTION = `${CLASS_ROOT}__menu-section`;\nexport const CLASS_BAR = `${CLASS_ROOT}__bar`;\nexport const CLASS_MB_LARGE = `${CLASS_ROOT}--mb-xlarge`;\nexport const CLASS_ACCORDION_TOGGLE = `${CLASS_ROOT}__accordion-toggle`;\nexport const CLASS_ACCORDION_ICON = `${CLASS_ROOT}__accordion-icon`;\nexport const CLASS_DIVIDER = `${CLASS_ROOT}__divider`;\nexport const CLASS_DIVIDER_HIDE_XS_DOWN = `${CLASS_DIVIDER}--hide-xs-down`;\n","import { CLASS_ACCORDION_TOGGLE, CLASS_MENU_SECTION } from \"./constants\";\n\nconst MOBILE_MEDIA_QUERY = \"(max-width: 479.98px)\";\n\ninterface FooterSection {\n element: HTMLElement;\n toggle: HTMLButtonElement | null;\n panel: HTMLElement | null;\n}\n\nexport default class Footer {\n element!: HTMLElement;\n sections!: FooterSection[];\n mediaQueryList!: MediaQueryList;\n onToggleClick!: (event: Event) => void;\n onMediaQueryChange!: () => void;\n\n constructor(element: HTMLElement) {\n if ((element as any).ODS_Footer) {\n return (element as any).ODS_Footer;\n }\n\n this.element = element;\n this.sections = [];\n this.mediaQueryList = window.matchMedia(MOBILE_MEDIA_QUERY);\n\n this.onToggleClick = this.handleToggleClick.bind(this);\n this.onMediaQueryChange = this.syncViewportState.bind(this);\n\n (this.element as any).ODS_Footer = this;\n\n this.init();\n return this;\n }\n\n static getInstance(el: HTMLElement): Footer | null {\n return el && (el as any).ODS_Footer ? (el as any).ODS_Footer : null;\n }\n\n init(): void {\n this.sections = Array.from(\n this.element.querySelectorAll(\n `[data-footer-section].${CLASS_MENU_SECTION}`,\n ),\n ).map((section) => {\n const toggle = section.querySelector(\n `.${CLASS_ACCORDION_TOGGLE}`,\n ) as HTMLButtonElement | null;\n const panelId = toggle?.getAttribute(\"aria-controls\");\n const panel = panelId\n ? (this.element.querySelector(`#${panelId}`) as HTMLElement | null)\n : null;\n\n if (toggle) {\n toggle.addEventListener(\"click\", this.onToggleClick);\n }\n\n return {\n element: section as HTMLElement,\n toggle,\n panel,\n };\n });\n\n this.mediaQueryList.addEventListener(\"change\", this.onMediaQueryChange);\n\n this.syncViewportState();\n }\n\n private setSectionState(section: FooterSection, isExpanded: boolean): void {\n if (!section.toggle || !section.panel) return;\n\n section.toggle.setAttribute(\"aria-expanded\", String(isExpanded));\n section.panel.hidden = !isExpanded;\n }\n\n private syncViewportState(): void {\n const isMobile = this.mediaQueryList.matches;\n\n this.sections.forEach((section, index) => {\n if (!section.toggle || !section.panel) return;\n\n if (!isMobile) {\n this.setSectionState(section, true);\n section.element.removeAttribute(\"data-footer-mobile-initialized\");\n return;\n }\n\n const isInitialized =\n section.element.getAttribute(\"data-footer-mobile-initialized\") ===\n \"true\";\n\n if (!isInitialized) {\n this.setSectionState(section, index === 0);\n section.element.setAttribute(\"data-footer-mobile-initialized\", \"true\");\n return;\n }\n\n const isExpanded =\n section.toggle.getAttribute(\"aria-expanded\") === \"true\";\n this.setSectionState(section, isExpanded);\n });\n }\n\n private handleToggleClick(event: Event): void {\n if (!this.mediaQueryList.matches) return;\n\n const toggle = event.currentTarget as HTMLButtonElement;\n const section = this.sections.find((item) => item.toggle === toggle);\n\n if (!section || !section.toggle) return;\n\n const isExpanded = section.toggle.getAttribute(\"aria-expanded\") === \"true\";\n this.setSectionState(section, !isExpanded);\n }\n\n destroy(): void {\n this.sections.forEach((section) => {\n if (!section.toggle) return;\n section.toggle.removeEventListener(\"click\", this.onToggleClick);\n });\n\n this.mediaQueryList.removeEventListener(\"change\", this.onMediaQueryChange);\n }\n\n update(): void {\n this.destroy();\n this.init();\n }\n}\n","import moduleFactory, {\n destroyModulesWithin,\n initModulesWithin,\n} from \"../../scripts/lib/moduleFactory\";\nimport Footer from \"./Footer.static\";\nimport \"./styles/style.scss\";\n\nexport const customFooterModuleSelectorPairs = [\n {\n Module: Footer,\n name: \"Footer\",\n selector: \"[data-footer]\",\n },\n];\n\ndeclare global {\n interface Window {\n ODSFooter: {\n Footer: typeof Footer;\n instances: Footer[];\n init: () => void;\n destroy: () => void;\n initModulesWithin: (container: any) => {};\n destroyModulesWithin: (\n container: any,\n removeOrphanedNodes?: boolean | undefined,\n ) => {};\n };\n }\n}\n\nwindow.ODSFooter = window.ODSFooter || {\n Footer,\n instances: [],\n init: () => {\n window.ODSFooter.instances = moduleFactory(Footer, \"[data-footer]\");\n },\n destroy: () => {\n window.ODSFooter.instances.forEach((instance) => {\n if (instance && typeof instance.destroy === \"function\") {\n instance.destroy();\n }\n });\n window.ODSFooter.instances = [];\n },\n initModulesWithin,\n destroyModulesWithin,\n};\n\nif (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => {\n window.ODSFooter.init();\n });\n} else {\n window.ODSFooter.init();\n}\n\nexport { Footer };\nexport default Footer;\n","import { lowerCamelCase } from \"../../utils/helpers\";\n\nexport default function moduleFactory(Module, selector, options = {}) {\n const elements = Array.from(document.querySelectorAll(selector));\n\n return elements.map((element) => new Module(element, options));\n}\n\nexport function destroyModulesWithin(container, removeOrphanedNodes = false) {\n const destroyedInstances = {};\n\n Object.keys(window.ODS.instances).forEach((moduleName) => {\n window.ODS.instances[moduleName].forEach((instance) => {\n if (typeof destroyedInstances[moduleName] !== \"object\") {\n destroyedInstances[moduleName] = [];\n }\n\n let isInContainer = container.contains(instance.element);\n if (moduleName === \"modal\") {\n isInContainer = instance.instance?._openers.every((opener) =>\n container.contains(opener),\n );\n } else if (moduleName === \"tooltip\") {\n isInContainer = container.contains(instance.trigger);\n }\n\n if (isInContainer) {\n instance.destroy();\n destroyedInstances[moduleName].push(instance);\n }\n\n if (\n isInContainer &&\n removeOrphanedNodes &&\n [\"modal\", \"tooltip\"].includes(moduleName)\n ) {\n instance.element.remove();\n }\n });\n\n window.ODS.instances[moduleName] = window.ODS.instances[moduleName].filter(\n (instance) => !destroyedInstances[moduleName].includes(instance),\n );\n });\n\n return destroyedInstances;\n}\n\nexport function initModulesWithin(container) {\n const instances = {};\n window.ODS.moduleSelectorPairs.forEach((module) => {\n const name = lowerCamelCase(module.name);\n const elements = Array.from(container.querySelectorAll(module.selector));\n\n // Filter out elements that already have an instance (e.g., initialized by React)\n const instancePropertyName = `ODS_${module.name}`;\n const uninitializedElements = elements.filter(\n (element) => !element[instancePropertyName],\n );\n\n if (window && window.ODS && window.ODS.instances[name]) {\n // Also clean up instances from elements that are no longer in the document\n window.ODS.instances[name] = window.ODS.instances[name].filter(\n (instance) => {\n const isInDocument = document.contains(instance.element);\n if (!isInDocument) {\n // Clean up the instance if its element is no longer in the document\n instance.destroy?.();\n }\n return isInDocument;\n },\n );\n\n window.ODS.instances[name].forEach((instance) => {\n uninitializedElements.forEach((element, index) => {\n if (element.isSameNode(instance.element)) {\n uninitializedElements.splice(index, 1);\n }\n });\n });\n }\n if (uninitializedElements.length) {\n if (!Array.isArray(window.ODS.instances[name])) {\n window.ODS.instances[name] = [];\n }\n instances[name] = uninitializedElements.map(\n (element) => new module.Module(element),\n );\n window.ODS.instances[name] = [\n ...window.ODS.instances[name],\n ...instances[name],\n ];\n }\n });\n return instances;\n}\n","import wnumb from \"wnumb\";\n\nexport function isObject(val) {\n return val != null && typeof val === \"object\" && Array.isArray(val) === false;\n}\n\nexport function dateToYYYYMMDD(date) {\n if (!date || !(date instanceof Date)) {\n return \"\";\n }\n\n return `${date.getFullYear()}-${(date.getMonth() + 1)\n .toString()\n .padStart(2, \"0\")}-${date.getDate().toString().padStart(2, \"0\")}`;\n}\n\n// Get element position relative to document\nexport function windowOffset(el) {\n const position = { x: 0, y: 0 };\n\n if (el.offsetParent) {\n do {\n position.x += el.offsetLeft;\n position.y += el.offsetTop;\n } while ((el = el.offsetParent));\n }\n\n return position;\n}\n\n// Get element siblings\nexport function getSiblings(el) {\n if (!(el instanceof Element)) {\n return false;\n }\n\n const parent = el.parentNode;\n if (!parent) {\n return false;\n }\n\n const parentChildren = [];\n const siblings = [];\n\n parentChildren.push.apply(parentChildren, parent.children);\n\n for (let i = 0, l = parentChildren.length; i < l; i += 1) {\n if (parentChildren[i] !== el) {\n siblings.push(parentChildren[i]);\n }\n }\n\n return siblings;\n}\n\n/**\n * Converts object to string\n *\n * Should be able to handle all types\n * objectToString({\n * 'boolean': true,\n * 'function': () => { return 'test'; },\n * 'namedfunction': function test() { return 'test'; },\n * 'null': null,\n * 'number1': 1,\n * 'number2': 2.345,\n * 'object1': { test: 'test' },\n * 'string': 'String',\n * 'undefined' : undefined,\n * })\n *\n * @param {object} object object to convert\n * @returns object converted to string\n */\nexport const objectToString = (object, spaceCount = 2) => {\n let str = \"\";\n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n let value = object?.[key];\n if (typeof value === \"string\") {\n value = `\"${value}\"`;\n } else if (value === null) {\n value = \"null\";\n } else if (typeof value === \"object\") {\n value = objectToString(value, spaceCount + 2);\n } else if (typeof value === \"function\") {\n value = value.toString();\n } else if (value === undefined) {\n value = \"undefined\";\n }\n str += `${\" \".repeat(spaceCount)}${key}: ${value},\\n`;\n }\n }\n return `{\\n${str}${\" \".repeat(spaceCount - 2)}}`;\n};\nexport function capitalize(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nexport function lowerCamelCase(string) {\n return string.charAt(0).toLowerCase() + string.slice(1);\n}\n\nconst defaultPriceFormat = {\n decimals: 2,\n mark: \",\",\n thousand: \" \",\n suffix: `\\xa0€`,\n};\n\nexport function formatPrice(price, format) {\n return wnumb({\n ...defaultPriceFormat,\n ...format,\n ...(price % 1 === 0 ? { decimals: 0 } : {}), // integers without decimals\n }).to(price);\n}\n"],"names":["exports","FormatOptions","strReverse","a","split","reverse","join","strStartsWith","input","match","substring","length","strEndsWith","slice","throwEqualError","F","b","Error","isValidNumber","isFinite","toFixed","value","exp","toString","Math","round","formatTo","decimals","thousand","mark","prefix","suffix","encoder","decoder","negativeBefore","negative","edit","undo","inputIsNegative","inputPieces","inputBase","originalInput","inputDecimals","output","parseFloat","abs","indexOf","formatFrom","replace","Number","validate","inputOptions","i","optionName","optionValue","filteredOptions","undefined","passAll","options","method","args","push","apply","wNumb","this","to","from","factory","CLASS_ROOT","CLASS_MENU_SECTION","concat","CLASS_ACCORDION_TOGGLE","Footer","element","_classCallCheck","ODS_Footer","sections","mediaQueryList","window","matchMedia","onToggleClick","handleToggleClick","bind","onMediaQueryChange","syncViewportState","init","key","el","_this","Array","querySelectorAll","map","section","toggle","querySelector","panelId","getAttribute","panel","addEventListener","isExpanded","setAttribute","String","hidden","_this2","isMobile","matches","forEach","index","setSectionState","removeAttribute","event","currentTarget","find","item","_this3","removeEventListener","destroy","customFooterModuleSelectorPairs","Module","name","selector","ODSFooter","instances","arguments","document","moduleFactory","instance","initModulesWithin","container","ODS","moduleSelectorPairs","module","string","charAt","toLowerCase","elements","instancePropertyName","uninitializedElements","filter","_instance$destroy","isInDocument","contains","call","isSameNode","splice","isArray","_toConsumableArray","destroyModulesWithin","removeOrphanedNodes","destroyedInstances","Object","keys","moduleName","_typeof","_instance$instance","isInContainer","_openers","every","opener","trigger","includes","remove","readyState"],"mappings":"+6CAMIA,QAKD,WAGD,IAAIC,EAAgB,CAClB,WACA,WACA,OACA,SACA,SACA,UACA,UACA,iBACA,WACA,OACA,QAMF,SAASC,EAAWC,GAClB,OAAOA,EACJC,MAAM,IACNC,UACAC,K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,i=Array(t);n<t;n++)i[n]=e[n];return i}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,a(i.key),i)}}function n(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?i(Object(o),!0).forEach(function(t){n(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):i(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?e(t,n):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}var l,c="megamenu",u="".concat(c,"__nav-button"),d="".concat(c,"__nav-dropdown"),h="".concat(c,"__overlay"),f="".concat(c,"--hide-lg-up"),v="".concat(c,"__mobile"),m="".concat(c,"__mobile-overlay"),y="".concat(c,"__accordion-button"),g="".concat(c,"__accordion-icon"),b={dataToggle:"data-toggle",activeClass:"is-active",removeOnDestroy:!1},p=function(){return e=function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.ODS_Megamenu?t.ODS_Megamenu:(this.element=t,this.config=o(o({},b),i),this.handleToggleClick=this.handleToggleClick.bind(this),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleAccordionClick=this.handleAccordionClick.bind(this),this.handleArrowNavigation=this.handleArrowNavigation.bind(this),this.trapFocus=this.trapFocus.bind(this),this.handleMobileMenuToggle=this.handleMobileMenuToggle.bind(this),this.desktopOverlayClickHandler=function(){return n.closeAllDropdowns()},this.mobileCloseHandler=function(e){e.preventDefault(),n.closeMobileMenu()},this.element.ODS_Megamenu=this,this.init(),this)},n=[{key:"init",value:function(){var e=this;this.toggleButtons=this.element.querySelectorAll(".".concat(u,"[aria-controls]")),this.dropdowns=this.element.querySelectorAll(".".concat(d)),this.instanceName=this.element.getAttribute("data-megamenu-name")||this.element.id||"",this.mobilePanels=Array.from(this.element.querySelectorAll(".".concat(v))),this.activeMobilePanel=null,this.activeMobileTarget=null,this.focusTrapElement=null;var t=Array.from(this.element.querySelectorAll("[data-megamenu-mobile-toggle], .".concat(f," button"))),n=Array.from(document.querySelectorAll("[data-megamenu-mobile-toggle]"));this.mobileMenuButtons=Array.from(new Set([].concat(t,n))).filter(function(t){return e.shouldUseMobileTrigger(t)}),this.mobileCloseButtons=Array.from(this.element.querySelectorAll(".".concat(m,", [data-megamenu-close-button]"))),this.mobilePanels.forEach(function(e){e.setAttribute("aria-hidden","true")}),this.syncMobileButtonState(),this.desktopOverlay=this.element.querySelector(".".concat(h)),this.accordionButtons=this.element.querySelectorAll(".".concat(y)),this.toggleButtons.forEach(function(t){t.addEventListener("click",e.handleToggleClick)}),this.mobileMenuButtons.forEach(function(t){t.addEventListener("click",e.handleMobileMenuToggle)}),this.mobileCloseButtons.forEach(function(t){t.addEventListener("click",e.mobileCloseHandler)}),this.desktopOverlay&&this.desktopOverlay.addEventListener("click",this.desktopOverlayClickHandler),this.accordionButtons.forEach(function(t){t.addEventListener("click",e.handleAccordionClick)}),this.element.addEventListener("keydown",this.handleKeyPress),window.addEventListener("scroll",this.handleScroll),this.isKeyboardUser=!1,this.keydownHandler=function(t){"Tab"!==t.key&&" "!==t.key&&"Enter"!==t.key||(e.isKeyboardUser=!0)},this.mousedownHandler=function(){e.isKeyboardUser=!1},this.touchstartHandler=function(){e.isKeyboardUser=!1},this.element.addEventListener("keydown",this.keydownHandler),this.element.addEventListener("mousedown",this.mousedownHandler),this.element.addEventListener("touchstart",this.touchstartHandler),this.updateTabIndices()}},{key:"shouldUseMobileTrigger",value:function(e){if(this.element.contains(e))return!0;var t=e.getAttribute("data-megamenu-mobile-for");if(!t){var n=document.querySelectorAll("[data-megamenu]");return 1===n.length&&n[0]===this.element}return!!this.instanceName&&t===this.instanceName}},{key:"getDefaultMobileTarget",value:function(){var e=this.mobilePanels[0];return(null==e?void 0:e.getAttribute("data-megamenu-mobile-panel"))||"main"}},{key:"getTargetFromElement",value:function(e){return(null==e?void 0:e.getAttribute("data-megamenu-mobile-target"))||this.getDefaultMobileTarget()}},{key:"getPanelByTarget",value:function(e){var t=this.mobilePanels.find(function(t){return t.getAttribute("data-megamenu-mobile-panel")===e});return t||(e===this.getDefaultMobileTarget()&&1===this.mobilePanels.length?this.mobilePanels[0]:null)}},{key:"syncMobileButtonState",value:function(){var e=this;this.mobileMenuButtons.forEach(function(t){var n=e.getTargetFromElement(t),i=e.activeMobileTarget===n;t.setAttribute("aria-expanded",i?"true":"false"),t.classList.toggle(e.config.activeClass,i)})}},{key:"isInMobilePanel",value:function(e){return Boolean(e&&this.mobilePanels.some(function(t){return t.contains(e)}))}},{key:"getFocusRestoreTarget",value:function(){var e=this,t=this.lastFocusedElement;if(t&&t.isConnected&&!this.isInMobilePanel(t))return t;var n=this.activeMobileTarget;if(n){var i=this.mobileMenuButtons.find(function(t){return e.getTargetFromElement(t)===n&&!e.isInMobilePanel(t)});if(i)return i}return this.mobileMenuButtons.find(function(t){return!e.isInMobilePanel(t)})||null}},{key:"setMobilePanelState",value:function(e,t){e.classList.toggle(this.config.activeClass,t),e.setAttribute("aria-hidden",t?"false":"true")}},{key:"handleToggleClick",value:function(e){var t=e.currentTarget,n=t.classList.contains(this.config.activeClass);this.closeAllDropdowns(),n?t.focus():this.openDropdown(t)}},{key:"handleKeyPress",value:function(e){if("Escape"===e.key){var t=Array.from(this.toggleButtons).find(function(e){return"true"===e.getAttribute("aria-expanded")});this.closeAllDropdowns(),this.closeMobileMenu(),this.closeAllAccordions(),t&&t.focus()}if("Enter"===e.key||" "===e.key){var n=e.target;("BUTTON"===n.tagName&&n.hasAttribute("aria-controls")||n.classList.contains(y))&&(e.preventDefault(),n.click())}if("Home"===e.key||"End"===e.key){var i,o=null===(i=e.target)||void 0===i?void 0:i.closest(".".concat(d));if(o){e.preventDefault();var r=Array.from(o.querySelectorAll('a, button, [tabindex]:not([tabindex="-1"])'));"Home"===e.key&&r.length>0?r[0].focus():"End"===e.key&&r.length>0&&r[r.length-1].focus()}}if("ArrowDown"===e.key){var a=e.target;if("BUTTON"===a.tagName&&a.hasAttribute("aria-controls")){if("true"===a.getAttribute("aria-expanded")){var s;e.preventDefault();var l=null===(s=a.parentElement)||void 0===s?void 0:s.querySelector(".".concat(d)),c=null==l?void 0:l.querySelector("a, button");c&&c.focus()}}else{var u=a.closest(".".concat(d));u&&(e.preventDefault(),this.handleArrowNavigation(e,u))}}if("ArrowUp"===e.key){var h,f=null===(h=e.target)||void 0===h?void 0:h.closest(".".concat(d));f&&(e.preventDefault(),this.handleArrowNavigation(e,f))}}},{key:"handleAccordionClick",value:function(e){var t=e.currentTarget,n="true"===t.getAttribute("aria-expanded");this.closeAllAccordions(),n||this.openAccordion(t)}},{key:"handleScroll",value:function(){var e=this.element.querySelector('[data-hide-when-sticky="true"]');e&&(window.scrollY>15?(e.classList.add("is-hidden"),this.element.classList.add("top-hidden")):(e.classList.remove("is-hidden"),this.element.classList.remove("top-hidden")))}},{key:"openDropdown",value:function(e){var t,n=null===(t=e.parentElement)||void 0===t?void 0:t.querySelector(".".concat(d));n&&(e.classList.add(this.config.activeClass),e.setAttribute("aria-expanded","true"),n.style.display="block",n.classList.add("is-visible"),this.showDesktopOverlay(),this.updateTabIndices())}},{key:"closeDropdown",value:function(e){var t,n=null===(t=e.parentElement)||void 0===t?void 0:t.querySelector(".".concat(d));n&&(e.classList.remove(this.config.activeClass),e.setAttribute("aria-expanded","false"),n.classList.remove("is-visible"),n.style.display="none",this.updateTabIndices())}},{key:"closeAllDropdowns",value:function(){var e=this;this.toggleButtons.forEach(function(t){e.closeDropdown(t)}),this.hideDesktopOverlay()}},{key:"handleMobileMenuToggle",value:function(e){e.preventDefault();var t=e.currentTarget,n=this.getTargetFromElement(t),i=this.getPanelByTarget(n);i&&(this.activeMobileTarget===n&&i.classList.contains(this.config.activeClass)?this.closeMobileMenu():this.openMobileMenu(n,t))}},{key:"openMobileMenu",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getDefaultMobileTarget(),n=arguments.length>1?arguments[1]:void 0,i=this.getPanelByTarget(t);if(i){this.lastFocusedElement=n||document.activeElement;var o=document.activeElement;if(o&&o!==i&&this.mobilePanels.some(function(e){return e!==i&&e.contains(o)})&&o.blur(),this.mobilePanels.forEach(function(t){e.setMobilePanelState(t,t===i)}),this.activeMobilePanel=i,this.activeMobileTarget=t,this.syncMobileButtonState(),document.body.style.overflow="hidden",this.removeFocusTrap(),this.trapFocus(i),this.isKeyboardUser){var r=i.querySelector("button, a");r&&setTimeout(function(){return r.focus()},50)}this.updateTabIndices()}}},{key:"closeMobileMenu",value:function(){var e=this;if(this.activeMobilePanel){var t,n,i=this.getFocusRestoreTarget();i?i.focus():null===(t=document.activeElement)||void 0===t||null===(n=t.blur)||void 0===n||n.call(t),this.mobilePanels.forEach(function(t){e.setMobilePanelState(t,!1)}),document.body.style.overflow="",this.closeAllAccordions(),this.removeFocusTrap(),this.activeMobilePanel=null,this.activeMobileTarget=null,this.lastFocusedElement=null,this.syncMobileButtonState(),this.updateTabIndices()}}},{key:"showDesktopOverlay",value:function(){this.desktopOverlay&&this.desktopOverlay.classList.add(this.config.activeClass)}},{key:"hideDesktopOverlay",value:function(){this.desktopOverlay&&this.desktopOverlay.classList.remove(this.config.activeClass)}},{key:"openAccordion",value:function(e){var t=e.getAttribute("aria-controls"),n=t?this.element.querySelector("#".concat(t)):null,i=e.querySelector(".".concat(g));n&&(e.setAttribute("aria-expanded","true"),e.classList.add(this.config.activeClass),n.classList.add("is-visible"),n.style.display="block",i&&i.classList.add(this.config.activeClass))}},{key:"closeAccordion",value:function(e){var t=e.getAttribute("aria-controls"),n=t?this.element.querySelector("#".concat(t)):null,i=e.querySelector(".".concat(g));n&&(e.setAttribute("aria-expanded","false"),e.classList.remove(this.config.activeClass),n.classList.remove("is-visible"),n.style.display="none",i&&i.classList.remove(this.config.activeClass))}},{key:"closeAllAccordions",value:function(){var e=this;this.accordionButtons.forEach(function(t){e.closeAccordion(t)})}},{key:"handleArrowNavigation",value:function(e,t){var n=Array.from(t.querySelectorAll('a, button, [tabindex]:not([tabindex="-1"])'));if(0!==n.length){var i,o=n.findIndex(function(t){return t===e.target});if("ArrowDown"===e.key)i=o<n.length-1?o+1:0;else{if("ArrowUp"!==e.key)return;i=o>0?o-1:n.length-1}i>=0&&i<n.length&&n[i]&&n[i].focus()}}},{key:"trapFocus",value:function(e){var t=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=t[0],i=t[t.length-1];this.focusTrapHandler=function(e){"Tab"===e.key&&(e.shiftKey?document.activeElement===n&&(e.preventDefault(),i.focus()):document.activeElement===i&&(e.preventDefault(),n.focus()))},this.focusTrapElement=e,e.addEventListener("keydown",this.focusTrapHandler)}},{key:"removeFocusTrap",value:function(){this.focusTrapElement&&this.focusTrapHandler&&(this.focusTrapElement.removeEventListener("keydown",this.focusTrapHandler),this.focusTrapElement=null)}},{key:"updateTabIndices",value:function(){var e=this;this.dropdowns.forEach(function(e){var t=e.classList.contains("is-visible");e.querySelectorAll("a, button, [tabindex]:not([tabindex='-1'])").forEach(function(e){var n=t;n&&-1===e.tabIndex?e.tabIndex=0:n||-1===e.tabIndex||(e.tabIndex=-1)})}),this.mobilePanels.forEach(function(t){var n=t.classList.contains(e.config.activeClass);t.querySelectorAll("a, button, [tabindex]:not([tabindex='-1'])").forEach(function(e){e.tabIndex=n?0:-1})})}},{key:"destroy",value:function(){var e=this;this.toggleButtons.forEach(function(t){t.removeEventListener("click",e.handleToggleClick)}),this.mobileMenuButtons.forEach(function(t){t.removeEventListener("click",e.handleMobileMenuToggle)}),this.mobileCloseButtons.forEach(function(t){t.removeEventListener("click",e.mobileCloseHandler)}),this.desktopOverlay&&this.desktopOverlay.removeEventListener("click",this.desktopOverlayClickHandler),this.accordionButtons.forEach(function(t){t.removeEventListener("click",e.handleAccordionClick)}),this.element.removeEventListener("keydown",this.handleKeyPress),window.removeEventListener("scroll",this.handleScroll),this.element.removeEventListener("keydown",this.keydownHandler),this.element.removeEventListener("mousedown",this.mousedownHandler),this.element.removeEventListener("touchstart",this.touchstartHandler),document.body.style.overflow="",this.removeFocusTrap(),this.element.ODS_Megamenu=null,this.config.removeOnDestroy&&this.element.remove()}}],i=[{key:"getInstance",value:function(e){return e&&e.ODS_Megamenu?e.ODS_Megamenu:null}}],n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,i}(),w={exports:{}};l||(l=1,w.exports=function(){var e=["decimals","thousand","mark","prefix","suffix","encoder","decoder","negativeBefore","negative","edit","undo"];function t(e){return e.split("").reverse().join("")}function n(e,t){return e.substring(0,t.length)===t}function i(e,t){return e.slice(-1*t.length)===t}function o(e,t,n){if((e[t]||e[n])&&e[t]===e[n])throw new Error(t)}function r(e){return"number"==typeof e&&isFinite(e)}function a(e,t){return e=e.toString().split("e"),(+((e=(e=Math.round(+(e[0]+"e"+(e[1]?+e[1]+t:t)))).toString().split("e"))[0]+"e"+(e[1]?+e[1]-t:-t))).toFixed(t)}function s(e,n,i,o,s,l,c,u,d,h,f,v){var m,y,g,b=v,p="",w="";return l&&(v=l(v)),!!r(v)&&(!1!==e&&0===parseFloat(v.toFixed(e))&&(v=0),v<0&&(m=!0,v=Math.abs(v)),!1!==e&&(v=a(v,e)),-1!==(v=v.toString()).indexOf(".")?(g=(y=v.split("."))[0],i&&(p=i+y[1])):g=v,n&&(g=t(g).match(/.{1,3}/g),g=t(g.join(t(n)))),m&&u&&(w+=u),o&&(w+=o),m&&d&&(w+=d),w+=g,w+=p,s&&(w+=s),h&&(w=h(w,b)),w)}function l(e,t,o,a,s,l,c,u,d,h,f,v){var m,y="";return f&&(v=f(v)),!(!v||"string"!=typeof v)&&(u&&n(v,u)&&(v=v.replace(u,""),m=!0),a&&n(v,a)&&(v=v.replace(a,"")),d&&n(v,d)&&(v=v.replace(d,""),m=!0),s&&i(v,s)&&(v=v.slice(0,-1*s.length)),t&&(v=v.split(t).join("")),o&&(v=v.replace(o,".")),m&&(y+="-"),""!==(y=(y+=v).replace(/[^0-9\.\-.]/g,""))&&(y=Number(y),c&&(y=c(y)),!!r(y)&&y))}function c(t){var n,i,r,a={};for(void 0===t.suffix&&(t.suffix=t.postfix),n=0;n<e.length;n+=1)if(void 0===(r=t[i=e[n]]))"negative"!==i||a.negativeBefore?"mark"===i&&"."!==a.thousand?a[i]=".":a[i]=!1:a[i]="-";else if("decimals"===i){if(!(r>=0&&r<8))throw new Error(i);a[i]=r}else if("encoder"===i||"decoder"===i||"edit"===i||"undo"===i){if("function"!=typeof r)throw new Error(i);a[i]=r}else{if("string"!=typeof r)throw new Error(i);a[i]=r}return o(a,"mark","thousand"),o(a,"prefix","negative"),o(a,"prefix","negativeBefore"),a}function u(t,n,i){var o,r=[];for(o=0;o<e.length;o+=1)r.push(t[e[o]]);return r.push(i),n.apply("",r)}function d(e){if(!(this instanceof d))return new d(e);"object"==typeof e&&(e=c(e),this.to=function(t){return u(e,s,t)},this.from=function(t){return u(e,l,t)})}return d}());var k=[{Module:p,name:"Megamenu",selector:"[data-megamenu]"}];window.ODSMegamenu=window.ODSMegamenu||{Megamenu:p,instances:[],init:function(){window.ODSMegamenu.instances=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Array.from(document.querySelectorAll(t)).map(function(t){return new e(t,n)})}(p,"[data-megamenu]")},destroy:function(){window.ODSMegamenu.instances.forEach(function(e){e&&"function"==typeof e.destroy&&e.destroy()}),window.ODSMegamenu.instances=[]},initModulesWithin:function(e){var t={};return window.ODS.moduleSelectorPairs.forEach(function(n){var i,o=(i=n.name).charAt(0).toLowerCase()+i.slice(1),a=Array.from(e.querySelectorAll(n.selector)),s="ODS_".concat(n.name),l=a.filter(function(e){return!e[s]});window&&window.ODS&&window.ODS.instances[o]&&(window.ODS.instances[o]=window.ODS.instances[o].filter(function(e){var t,n=document.contains(e.element);n||(null===(t=e.destroy)||void 0===t||t.call(e));return n}),window.ODS.instances[o].forEach(function(e){l.forEach(function(t,n){t.isSameNode(e.element)&&l.splice(n,1)})})),l.length&&(Array.isArray(window.ODS.instances[o])||(window.ODS.instances[o]=[]),t[o]=l.map(function(e){return new n.Module(e)}),window.ODS.instances[o]=[].concat(r(window.ODS.instances[o]),r(t[o])))}),t},destroyModulesWithin:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={};return Object.keys(window.ODS.instances).forEach(function(i){window.ODS.instances[i].forEach(function(o){"object"!==s(n[i])&&(n[i]=[]);var r,a=e.contains(o.element);"modal"===i?a=null===(r=o.instance)||void 0===r?void 0:r._openers.every(function(t){return e.contains(t)}):"tooltip"===i&&(a=e.contains(o.trigger));a&&(o.destroy(),n[i].push(o)),a&&t&&["modal","tooltip"].includes(i)&&o.element.remove()}),window.ODS.instances[i]=window.ODS.instances[i].filter(function(e){return!n[i].includes(e)})}),n}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){window.ODSMegamenu.init()}):window.ODSMegamenu.init();export{p as Megamenu,k as customMegamenuModuleSelectorPairs,p as default};
|
|
1
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,a(i.key),i)}}function n(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?i(Object(o),!0).forEach(function(t){n(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):i(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?e(t,n):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}var l,c={exports:{}};l||(l=1,c.exports=function(){var e=["decimals","thousand","mark","prefix","suffix","encoder","decoder","negativeBefore","negative","edit","undo"];function t(e){return e.split("").reverse().join("")}function n(e,t){return e.substring(0,t.length)===t}function i(e,t){return e.slice(-1*t.length)===t}function o(e,t,n){if((e[t]||e[n])&&e[t]===e[n])throw new Error(t)}function r(e){return"number"==typeof e&&isFinite(e)}function a(e,t){return e=e.toString().split("e"),(+((e=(e=Math.round(+(e[0]+"e"+(e[1]?+e[1]+t:t)))).toString().split("e"))[0]+"e"+(e[1]?+e[1]-t:-t))).toFixed(t)}function s(e,n,i,o,s,l,c,u,d,h,f,v){var m,y,g,b=v,p="",w="";return l&&(v=l(v)),!!r(v)&&(!1!==e&&0===parseFloat(v.toFixed(e))&&(v=0),v<0&&(m=!0,v=Math.abs(v)),!1!==e&&(v=a(v,e)),-1!==(v=v.toString()).indexOf(".")?(g=(y=v.split("."))[0],i&&(p=i+y[1])):g=v,n&&(g=t(g).match(/.{1,3}/g),g=t(g.join(t(n)))),m&&u&&(w+=u),o&&(w+=o),m&&d&&(w+=d),w+=g,w+=p,s&&(w+=s),h&&(w=h(w,b)),w)}function l(e,t,o,a,s,l,c,u,d,h,f,v){var m,y="";return f&&(v=f(v)),!(!v||"string"!=typeof v)&&(u&&n(v,u)&&(v=v.replace(u,""),m=!0),a&&n(v,a)&&(v=v.replace(a,"")),d&&n(v,d)&&(v=v.replace(d,""),m=!0),s&&i(v,s)&&(v=v.slice(0,-1*s.length)),t&&(v=v.split(t).join("")),o&&(v=v.replace(o,".")),m&&(y+="-"),""!==(y=(y+=v).replace(/[^0-9\.\-.]/g,""))&&(y=Number(y),c&&(y=c(y)),!!r(y)&&y))}function c(t){var n,i,r,a={};for(void 0===t.suffix&&(t.suffix=t.postfix),n=0;n<e.length;n+=1)if(void 0===(r=t[i=e[n]]))"negative"!==i||a.negativeBefore?"mark"===i&&"."!==a.thousand?a[i]=".":a[i]=!1:a[i]="-";else if("decimals"===i){if(!(r>=0&&r<8))throw new Error(i);a[i]=r}else if("encoder"===i||"decoder"===i||"edit"===i||"undo"===i){if("function"!=typeof r)throw new Error(i);a[i]=r}else{if("string"!=typeof r)throw new Error(i);a[i]=r}return o(a,"mark","thousand"),o(a,"prefix","negative"),o(a,"prefix","negativeBefore"),a}function u(t,n,i){var o,r=[];for(o=0;o<e.length;o+=1)r.push(t[e[o]]);return r.push(i),n.apply("",r)}function d(e){if(!(this instanceof d))return new d(e);"object"==typeof e&&(e=c(e),this.to=function(t){return u(e,s,t)},this.from=function(t){return u(e,l,t)})}return d}());var u="megamenu",d="".concat(u,"__nav-button"),h="".concat(u,"__nav-dropdown"),f="".concat(u,"__overlay"),v="".concat(u,"--hide-lg-up"),m="".concat(u,"__mobile"),y="".concat(u,"__mobile-overlay"),g="".concat(u,"__accordion-button"),b="".concat(u,"__accordion-icon"),p={dataToggle:"data-toggle",activeClass:"is-active",removeOnDestroy:!1},w=function(){return e=function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.ODS_Megamenu?t.ODS_Megamenu:(this.element=t,this.config=o(o({},p),i),this.handleToggleClick=this.handleToggleClick.bind(this),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleAccordionClick=this.handleAccordionClick.bind(this),this.handleArrowNavigation=this.handleArrowNavigation.bind(this),this.trapFocus=this.trapFocus.bind(this),this.handleMobileMenuToggle=this.handleMobileMenuToggle.bind(this),this.desktopOverlayClickHandler=function(){return n.closeAllDropdowns()},this.mobileCloseHandler=function(e){e.preventDefault(),n.closeMobileMenu()},this.element.ODS_Megamenu=this,this.init(),this)},n=[{key:"init",value:function(){var e=this;this.toggleButtons=this.element.querySelectorAll(".".concat(d,"[aria-controls]")),this.dropdowns=this.element.querySelectorAll(".".concat(h)),this.instanceName=this.element.getAttribute("data-megamenu-name")||this.element.id||"",this.mobilePanels=Array.from(this.element.querySelectorAll(".".concat(m))),this.activeMobilePanel=null,this.activeMobileTarget=null,this.focusTrapElement=null;var t=Array.from(this.element.querySelectorAll("[data-megamenu-mobile-toggle], .".concat(v," button"))),n=Array.from(document.querySelectorAll("[data-megamenu-mobile-toggle]"));this.mobileMenuButtons=Array.from(new Set([].concat(t,n))).filter(function(t){return e.shouldUseMobileTrigger(t)}),this.mobileCloseButtons=Array.from(this.element.querySelectorAll(".".concat(y,", [data-megamenu-close-button]"))),this.mobilePanels.forEach(function(e){e.setAttribute("aria-hidden","true")}),this.syncMobileButtonState(),this.desktopOverlay=this.element.querySelector(".".concat(f)),this.accordionButtons=this.element.querySelectorAll(".".concat(g)),this.toggleButtons.forEach(function(t){t.addEventListener("click",e.handleToggleClick)}),this.mobileMenuButtons.forEach(function(t){t.addEventListener("click",e.handleMobileMenuToggle)}),this.mobileCloseButtons.forEach(function(t){t.addEventListener("click",e.mobileCloseHandler)}),this.desktopOverlay&&this.desktopOverlay.addEventListener("click",this.desktopOverlayClickHandler),this.accordionButtons.forEach(function(t){t.addEventListener("click",e.handleAccordionClick)}),this.element.addEventListener("keydown",this.handleKeyPress),window.addEventListener("scroll",this.handleScroll),this.isKeyboardUser=!1,this.keydownHandler=function(t){"Tab"!==t.key&&" "!==t.key&&"Enter"!==t.key||(e.isKeyboardUser=!0)},this.mousedownHandler=function(){e.isKeyboardUser=!1},this.touchstartHandler=function(){e.isKeyboardUser=!1},this.element.addEventListener("keydown",this.keydownHandler),this.element.addEventListener("mousedown",this.mousedownHandler),this.element.addEventListener("touchstart",this.touchstartHandler),this.updateTabIndices()}},{key:"shouldUseMobileTrigger",value:function(e){if(this.element.contains(e))return!0;var t=e.getAttribute("data-megamenu-mobile-for");if(!t){var n=document.querySelectorAll("[data-megamenu]");return 1===n.length&&n[0]===this.element}return!!this.instanceName&&t===this.instanceName}},{key:"getDefaultMobileTarget",value:function(){var e=this.mobilePanels[0];return(null==e?void 0:e.getAttribute("data-megamenu-mobile-panel"))||"main"}},{key:"getTargetFromElement",value:function(e){return(null==e?void 0:e.getAttribute("data-megamenu-mobile-target"))||this.getDefaultMobileTarget()}},{key:"getPanelByTarget",value:function(e){var t=this.mobilePanels.find(function(t){return t.getAttribute("data-megamenu-mobile-panel")===e});return t||(e===this.getDefaultMobileTarget()&&1===this.mobilePanels.length?this.mobilePanels[0]:null)}},{key:"syncMobileButtonState",value:function(){var e=this;this.mobileMenuButtons.forEach(function(t){var n=e.getTargetFromElement(t),i=e.activeMobileTarget===n;t.setAttribute("aria-expanded",i?"true":"false"),t.classList.toggle(e.config.activeClass,i)})}},{key:"isInMobilePanel",value:function(e){return Boolean(e&&this.mobilePanels.some(function(t){return t.contains(e)}))}},{key:"getFocusRestoreTarget",value:function(){var e=this,t=this.lastFocusedElement;if(t&&t.isConnected&&!this.isInMobilePanel(t))return t;var n=this.activeMobileTarget;if(n){var i=this.mobileMenuButtons.find(function(t){return e.getTargetFromElement(t)===n&&!e.isInMobilePanel(t)});if(i)return i}return this.mobileMenuButtons.find(function(t){return!e.isInMobilePanel(t)})||null}},{key:"setMobilePanelState",value:function(e,t){e.classList.toggle(this.config.activeClass,t),e.setAttribute("aria-hidden",t?"false":"true")}},{key:"handleToggleClick",value:function(e){var t=e.currentTarget,n=t.classList.contains(this.config.activeClass);this.closeAllDropdowns(),n?t.focus():this.openDropdown(t)}},{key:"handleKeyPress",value:function(e){if("Escape"===e.key){var t=Array.from(this.toggleButtons).find(function(e){return"true"===e.getAttribute("aria-expanded")});this.closeAllDropdowns(),this.closeMobileMenu(),this.closeAllAccordions(),t&&t.focus()}if("Enter"===e.key||" "===e.key){var n=e.target;("BUTTON"===n.tagName&&n.hasAttribute("aria-controls")||n.classList.contains(g))&&(e.preventDefault(),n.click())}if("Home"===e.key||"End"===e.key){var i,o=null===(i=e.target)||void 0===i?void 0:i.closest(".".concat(h));if(o){e.preventDefault();var r=Array.from(o.querySelectorAll('a, button, [tabindex]:not([tabindex="-1"])'));"Home"===e.key&&r.length>0?r[0].focus():"End"===e.key&&r.length>0&&r[r.length-1].focus()}}if("ArrowDown"===e.key){var a=e.target;if("BUTTON"===a.tagName&&a.hasAttribute("aria-controls")){if("true"===a.getAttribute("aria-expanded")){var s;e.preventDefault();var l=null===(s=a.parentElement)||void 0===s?void 0:s.querySelector(".".concat(h)),c=null==l?void 0:l.querySelector("a, button");c&&c.focus()}}else{var u=a.closest(".".concat(h));u&&(e.preventDefault(),this.handleArrowNavigation(e,u))}}if("ArrowUp"===e.key){var d,f=null===(d=e.target)||void 0===d?void 0:d.closest(".".concat(h));f&&(e.preventDefault(),this.handleArrowNavigation(e,f))}}},{key:"handleAccordionClick",value:function(e){var t=e.currentTarget,n="true"===t.getAttribute("aria-expanded");this.closeAllAccordions(),n||this.openAccordion(t)}},{key:"handleScroll",value:function(){var e=this.element.querySelector('[data-hide-when-sticky="true"]');e&&(window.scrollY>15?(e.classList.add("is-hidden"),this.element.classList.add("top-hidden")):(e.classList.remove("is-hidden"),this.element.classList.remove("top-hidden")))}},{key:"openDropdown",value:function(e){var t,n=null===(t=e.parentElement)||void 0===t?void 0:t.querySelector(".".concat(h));n&&(e.classList.add(this.config.activeClass),e.setAttribute("aria-expanded","true"),n.style.display="block",n.classList.add("is-visible"),this.showDesktopOverlay(),this.updateTabIndices())}},{key:"closeDropdown",value:function(e){var t,n=null===(t=e.parentElement)||void 0===t?void 0:t.querySelector(".".concat(h));n&&(e.classList.remove(this.config.activeClass),e.setAttribute("aria-expanded","false"),n.classList.remove("is-visible"),n.style.display="none",this.updateTabIndices())}},{key:"closeAllDropdowns",value:function(){var e=this;this.toggleButtons.forEach(function(t){e.closeDropdown(t)}),this.hideDesktopOverlay()}},{key:"handleMobileMenuToggle",value:function(e){e.preventDefault();var t=e.currentTarget,n=this.getTargetFromElement(t),i=this.getPanelByTarget(n);i&&(this.activeMobileTarget===n&&i.classList.contains(this.config.activeClass)?this.closeMobileMenu():this.openMobileMenu(n,t))}},{key:"openMobileMenu",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getDefaultMobileTarget(),n=arguments.length>1?arguments[1]:void 0,i=this.getPanelByTarget(t);if(i){this.lastFocusedElement=n||document.activeElement;var o=document.activeElement;if(o&&o!==i&&this.mobilePanels.some(function(e){return e!==i&&e.contains(o)})&&o.blur(),this.mobilePanels.forEach(function(t){e.setMobilePanelState(t,t===i)}),this.activeMobilePanel=i,this.activeMobileTarget=t,this.syncMobileButtonState(),document.body.style.overflow="hidden",this.removeFocusTrap(),this.trapFocus(i),this.isKeyboardUser){var r=i.querySelector("button, a");r&&setTimeout(function(){return r.focus()},50)}this.updateTabIndices()}}},{key:"closeMobileMenu",value:function(){var e=this;if(this.activeMobilePanel){var t,n,i=this.getFocusRestoreTarget();i?i.focus():null===(t=document.activeElement)||void 0===t||null===(n=t.blur)||void 0===n||n.call(t),this.mobilePanels.forEach(function(t){e.setMobilePanelState(t,!1)}),document.body.style.overflow="",this.closeAllAccordions(),this.removeFocusTrap(),this.activeMobilePanel=null,this.activeMobileTarget=null,this.lastFocusedElement=null,this.syncMobileButtonState(),this.updateTabIndices()}}},{key:"showDesktopOverlay",value:function(){this.desktopOverlay&&this.desktopOverlay.classList.add(this.config.activeClass)}},{key:"hideDesktopOverlay",value:function(){this.desktopOverlay&&this.desktopOverlay.classList.remove(this.config.activeClass)}},{key:"openAccordion",value:function(e){var t=e.getAttribute("aria-controls"),n=t?this.element.querySelector("#".concat(t)):null,i=e.querySelector(".".concat(b));n&&(e.setAttribute("aria-expanded","true"),e.classList.add(this.config.activeClass),n.classList.add("is-visible"),n.style.display="block",i&&i.classList.add(this.config.activeClass))}},{key:"closeAccordion",value:function(e){var t=e.getAttribute("aria-controls"),n=t?this.element.querySelector("#".concat(t)):null,i=e.querySelector(".".concat(b));n&&(e.setAttribute("aria-expanded","false"),e.classList.remove(this.config.activeClass),n.classList.remove("is-visible"),n.style.display="none",i&&i.classList.remove(this.config.activeClass))}},{key:"closeAllAccordions",value:function(){var e=this;this.accordionButtons.forEach(function(t){e.closeAccordion(t)})}},{key:"handleArrowNavigation",value:function(e,t){var n=Array.from(t.querySelectorAll('a, button, [tabindex]:not([tabindex="-1"])'));if(0!==n.length){var i,o=n.findIndex(function(t){return t===e.target});if("ArrowDown"===e.key)i=o<n.length-1?o+1:0;else{if("ArrowUp"!==e.key)return;i=o>0?o-1:n.length-1}i>=0&&i<n.length&&n[i]&&n[i].focus()}}},{key:"trapFocus",value:function(e){var t=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=t[0],i=t[t.length-1];this.focusTrapHandler=function(e){"Tab"===e.key&&(e.shiftKey?document.activeElement===n&&(e.preventDefault(),i.focus()):document.activeElement===i&&(e.preventDefault(),n.focus()))},this.focusTrapElement=e,e.addEventListener("keydown",this.focusTrapHandler)}},{key:"removeFocusTrap",value:function(){this.focusTrapElement&&this.focusTrapHandler&&(this.focusTrapElement.removeEventListener("keydown",this.focusTrapHandler),this.focusTrapElement=null)}},{key:"updateTabIndices",value:function(){var e=this;this.dropdowns.forEach(function(e){var t=e.classList.contains("is-visible");e.querySelectorAll("a, button, [tabindex]:not([tabindex='-1'])").forEach(function(e){var n=t;n&&-1===e.tabIndex?e.tabIndex=0:n||-1===e.tabIndex||(e.tabIndex=-1)})}),this.mobilePanels.forEach(function(t){var n=t.classList.contains(e.config.activeClass);t.querySelectorAll("a, button, [tabindex]:not([tabindex='-1'])").forEach(function(e){e.tabIndex=n?0:-1})})}},{key:"destroy",value:function(){var e=this;this.toggleButtons.forEach(function(t){t.removeEventListener("click",e.handleToggleClick)}),this.mobileMenuButtons.forEach(function(t){t.removeEventListener("click",e.handleMobileMenuToggle)}),this.mobileCloseButtons.forEach(function(t){t.removeEventListener("click",e.mobileCloseHandler)}),this.desktopOverlay&&this.desktopOverlay.removeEventListener("click",this.desktopOverlayClickHandler),this.accordionButtons.forEach(function(t){t.removeEventListener("click",e.handleAccordionClick)}),this.element.removeEventListener("keydown",this.handleKeyPress),window.removeEventListener("scroll",this.handleScroll),this.element.removeEventListener("keydown",this.keydownHandler),this.element.removeEventListener("mousedown",this.mousedownHandler),this.element.removeEventListener("touchstart",this.touchstartHandler),document.body.style.overflow="",this.removeFocusTrap(),this.element.ODS_Megamenu=null,this.config.removeOnDestroy&&this.element.remove()}}],i=[{key:"getInstance",value:function(e){return e&&e.ODS_Megamenu?e.ODS_Megamenu:null}}],n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,i}(),k=[{Module:w,name:"Megamenu",selector:"[data-megamenu]"}];window.ODSMegamenu=window.ODSMegamenu||{Megamenu:w,instances:[],init:function(){window.ODSMegamenu.instances=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Array.from(document.querySelectorAll(t)).map(function(t){return new e(t,n)})}(w,"[data-megamenu]")},destroy:function(){window.ODSMegamenu.instances.forEach(function(e){e&&"function"==typeof e.destroy&&e.destroy()}),window.ODSMegamenu.instances=[]},initModulesWithin:function(e){var t={};return window.ODS.moduleSelectorPairs.forEach(function(n){var i,o=(i=n.name).charAt(0).toLowerCase()+i.slice(1),a=Array.from(e.querySelectorAll(n.selector)),s="ODS_".concat(n.name),l=a.filter(function(e){return!e[s]});window&&window.ODS&&window.ODS.instances[o]&&(window.ODS.instances[o]=window.ODS.instances[o].filter(function(e){var t,n=document.contains(e.element);n||(null===(t=e.destroy)||void 0===t||t.call(e));return n}),window.ODS.instances[o].forEach(function(e){l.forEach(function(t,n){t.isSameNode(e.element)&&l.splice(n,1)})})),l.length&&(Array.isArray(window.ODS.instances[o])||(window.ODS.instances[o]=[]),t[o]=l.map(function(e){return new n.Module(e)}),window.ODS.instances[o]=[].concat(r(window.ODS.instances[o]),r(t[o])))}),t},destroyModulesWithin:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={};return Object.keys(window.ODS.instances).forEach(function(i){window.ODS.instances[i].forEach(function(o){"object"!==s(n[i])&&(n[i]=[]);var r,a=e.contains(o.element);"modal"===i?a=null===(r=o.instance)||void 0===r?void 0:r._openers.every(function(t){return e.contains(t)}):"tooltip"===i&&(a=e.contains(o.trigger));a&&(o.destroy(),n[i].push(o)),a&&t&&["modal","tooltip"].includes(i)&&o.element.remove()}),window.ODS.instances[i]=window.ODS.instances[i].filter(function(e){return!n[i].includes(e)})}),n}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){window.ODSMegamenu.init()}):window.ODSMegamenu.init();export{w as Megamenu,k as customMegamenuModuleSelectorPairs,w as default};
|
|
2
2
|
//# sourceMappingURL=megamenu.js.map
|