@orangesk/orange-design-system 2.0.0-beta.36 → 2.0.0-beta.38
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/Loader/style.css +1 -1
- package/build/components/Loader/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/Table/style.css +1 -1
- package/build/components/Table/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 +737 -729
- package/build/components/types/src/components/Accordion/Accordion.static.d.ts +2 -0
- 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/Autocomplete/Autocomplete.d.ts +3 -1
- package/build/components/types/src/components/Forms/Autocomplete/Autocomplete.static.d.ts +1 -0
- 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/Loader/LoaderFullscreen.d.ts +7 -0
- package/build/components/types/src/components/Loader/index.d.ts +1 -0
- 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 +21 -21
- 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/sprite.svg +1 -1
- package/package.json +39 -30
- package/src/assets/icons/discount-price.svg +4 -0
- package/src/components/Accordion/Accordion.static.ts +44 -1
- 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 +112 -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/styles/config.scss +6 -6
- 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/styles/mixins.scss +46 -49
- 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/styles/config.scss +2 -2
- package/src/components/Container/styles/mixins.scss +4 -4
- 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.static.ts +1 -0
- package/src/components/Forms/Autocomplete/Autocomplete.tsx +8 -3
- package/src/components/Forms/Autocomplete/styles/config.scss +3 -3
- package/src/components/Forms/Checkbox/Checkbox.tsx +1 -1
- package/src/components/Forms/Checkbox/styles/mixins.scss +2 -2
- 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/File/styles/config.scss +5 -5
- 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/Hint/styles/config.scss +1 -1
- package/src/components/Forms/Hint/styles/mixins.scss +2 -2
- package/src/components/Forms/InputStepper/InputStepper.tsx +1 -1
- package/src/components/Forms/Label/Label.tsx +1 -1
- package/src/components/Forms/Label/styles/mixins.scss +2 -2
- package/src/components/Forms/Message/Message.tsx +9 -5
- package/src/components/Forms/Radio/Radio.tsx +1 -1
- package/src/components/Forms/Radio/styles/mixins.scss +2 -2
- package/src/components/Forms/RangeSlider/RangeSlider.tsx +1 -1
- package/src/components/Forms/Select/Select.tsx +1 -1
- package/src/components/Forms/Select/styles/mixins.scss +6 -6
- package/src/components/Forms/TextArea/TextArea.tsx +1 -1
- package/src/components/Forms/TextInput/TextInput.tsx +3 -5
- package/src/components/Forms/TextInput/styles/mixins.scss +10 -10
- 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/styles/config.scss +0 -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/export/size.scss +2 -2
- package/src/components/Icon/styles/mixins.scss +3 -3
- 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/styles/config.scss +2 -2
- package/src/components/IconList/styles/style.scss +1 -1
- 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/LoaderFullscreen.tsx +32 -0
- package/src/components/Loader/index.ts +1 -0
- package/src/components/Loader/styles/config.scss +5 -5
- package/src/components/Loader/styles/mixins.scss +24 -0
- package/src/components/Loader/styles/style.scss +9 -0
- package/src/components/Loader/tests/Loader.conformance.test.jsx +1 -1
- package/src/components/Loader/tests/LoaderFullscreen.conformance.test.jsx +21 -0
- package/src/components/Loader/tests/LoaderFullscreen.unit.test.jsx +41 -0
- package/src/components/Loader/tests/test.scss +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/styles/config.scss +2 -4
- 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/styles/mixins.scss +3 -3
- 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/styles/mixins.scss +2 -2
- 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/docsData.ts +0 -1
- package/src/components/Table/index.ts +1 -1
- package/src/components/Table/styles/mixins.scss +5 -0
- 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/styles/mixins.scss +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/styles/config.scss +25 -22
- package/src/components/Testimonial/styles/mixins.scss +36 -32
- 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/styles/mixins.scss +14 -13
- 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 +41 -40
- package/src/styles/base/globals.scss +17 -1
- package/src/styles/export/breakpoint.scss +1 -1
- package/src/styles/export/breakpoint.ts +7 -7
- package/src/styles/export/space.scss +1 -1
- package/src/styles/tokens/breakpoint.scss +64 -49
- package/src/styles/tokens/space.scss +9 -9
- package/src/styles/tools/generate.scss +6 -6
- package/src/styles/tools/layout.scss +3 -3
- package/src/styles/tools/map.scss +2 -2
- package/src/styles/tools/text.scss +1 -1
- package/src/styles/utilities/index.scss +7 -7
- package/build/search-index.json +0 -426
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { transitionHiddenElement } from "@cloudfour/transition-hidden-element";
|
|
2
|
+
import {
|
|
3
|
+
createPopper,
|
|
4
|
+
Instance as PopperInstance,
|
|
5
|
+
Options as PopperOptions,
|
|
6
|
+
} from "@popperjs/core";
|
|
3
7
|
|
|
4
|
-
import { keys } from
|
|
8
|
+
import { keys } from "../../utils";
|
|
5
9
|
|
|
6
10
|
export interface TooltipConfig {
|
|
7
11
|
rootContainerSelector: string;
|
|
@@ -10,39 +14,39 @@ export interface TooltipConfig {
|
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
export const defaultConfig: TooltipConfig = {
|
|
13
|
-
rootContainerSelector:
|
|
17
|
+
rootContainerSelector: "#root-tooltips",
|
|
14
18
|
removeDialogOnDestroy: false,
|
|
15
19
|
popperOptions: {
|
|
16
|
-
placement:
|
|
17
|
-
strategy:
|
|
20
|
+
placement: "bottom",
|
|
21
|
+
strategy: "absolute",
|
|
18
22
|
modifiers: [
|
|
19
23
|
{
|
|
20
|
-
name:
|
|
24
|
+
name: "arrow",
|
|
21
25
|
options: {
|
|
22
|
-
element:
|
|
26
|
+
element: ".tooltip__arrow",
|
|
23
27
|
padding: 10,
|
|
24
28
|
},
|
|
25
29
|
},
|
|
26
30
|
{
|
|
27
|
-
name:
|
|
31
|
+
name: "eventListeners",
|
|
28
32
|
options: {
|
|
29
33
|
scroll: false,
|
|
30
34
|
resize: false,
|
|
31
35
|
},
|
|
32
36
|
},
|
|
33
37
|
{
|
|
34
|
-
name:
|
|
38
|
+
name: "flip",
|
|
35
39
|
options: {
|
|
36
|
-
fallbackPlacements: [
|
|
40
|
+
fallbackPlacements: ["right", "top", "auto"],
|
|
37
41
|
},
|
|
38
42
|
},
|
|
39
43
|
{
|
|
40
|
-
name:
|
|
44
|
+
name: "offset",
|
|
41
45
|
options: {
|
|
42
46
|
offset: ({ placement }: { placement: string }) => {
|
|
43
|
-
if (placement.includes(
|
|
47
|
+
if (placement.includes("start")) {
|
|
44
48
|
return [-10, 0];
|
|
45
|
-
} else if (placement.includes(
|
|
49
|
+
} else if (placement.includes("end")) {
|
|
46
50
|
return [10, 0];
|
|
47
51
|
}
|
|
48
52
|
return [0, 0];
|
|
@@ -60,6 +64,8 @@ export default class Tooltip {
|
|
|
60
64
|
public trigger!: HTMLElement;
|
|
61
65
|
public rootContainer?: HTMLElement | null;
|
|
62
66
|
public transitioner: any;
|
|
67
|
+
private isOpen = false;
|
|
68
|
+
private ignoreNextBlur = false;
|
|
63
69
|
|
|
64
70
|
constructor(element: HTMLElement, config?: Partial<TooltipConfig>) {
|
|
65
71
|
this.element = element;
|
|
@@ -75,6 +81,8 @@ export default class Tooltip {
|
|
|
75
81
|
|
|
76
82
|
this.handleVisibility = this.handleVisibility.bind(this);
|
|
77
83
|
this.onKeydown = this.onKeydown.bind(this);
|
|
84
|
+
this.onDialogMouseDown = this.onDialogMouseDown.bind(this);
|
|
85
|
+
this.onDocumentClick = this.onDocumentClick.bind(this);
|
|
78
86
|
|
|
79
87
|
(this.element as any).ODS_Tooltip = this;
|
|
80
88
|
|
|
@@ -88,111 +96,136 @@ export default class Tooltip {
|
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
wrapLastWordAndButton(): void {
|
|
91
|
-
if (!this.element.hasAttribute(
|
|
99
|
+
if (!this.element.hasAttribute("data-tooltip-keep-with-text")) return;
|
|
92
100
|
const previousSibling = this.trigger.previousSibling;
|
|
93
101
|
if (!previousSibling || previousSibling.nodeType !== Node.TEXT_NODE) {
|
|
94
|
-
console.warn(
|
|
102
|
+
console.warn("Previous sibling is not a text node.");
|
|
95
103
|
return;
|
|
96
104
|
}
|
|
97
|
-
const textContent = previousSibling.textContent?.trim() ||
|
|
98
|
-
const words = textContent.split(
|
|
105
|
+
const textContent = previousSibling.textContent?.trim() || "";
|
|
106
|
+
const words = textContent.split(" ");
|
|
99
107
|
const lastWord = words.pop();
|
|
100
|
-
const updatedTextContent = words.join(
|
|
101
|
-
previousSibling.textContent = updatedTextContent +
|
|
102
|
-
const span = document.createElement(
|
|
103
|
-
span.className =
|
|
108
|
+
const updatedTextContent = words.join(" ");
|
|
109
|
+
previousSibling.textContent = updatedTextContent + " ";
|
|
110
|
+
const span = document.createElement("span");
|
|
111
|
+
span.className = "text-nowrap";
|
|
104
112
|
span.innerHTML = `${lastWord} ${this.trigger.outerHTML}`;
|
|
105
113
|
this.trigger.parentNode?.replaceChild(span, this.trigger);
|
|
106
|
-
this.trigger = span.querySelector(
|
|
114
|
+
this.trigger = span.querySelector("[data-tooltip-trigger]") as HTMLElement;
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
private init(): void {
|
|
110
118
|
this.trigger = document.querySelector(
|
|
111
|
-
`[data-tooltip-trigger][aria-describedby=${this.element.getAttribute(
|
|
119
|
+
`[data-tooltip-trigger][aria-describedby=${this.element.getAttribute("id")}]`,
|
|
112
120
|
) as HTMLElement;
|
|
113
121
|
if (!this.trigger) {
|
|
114
122
|
console.warn(
|
|
115
|
-
`tooltip trigger element is not defined and the tooltip cannot be attached. Please provide an element with [aria-describedby=${this.element.getAttribute(
|
|
123
|
+
`tooltip trigger element is not defined and the tooltip cannot be attached. Please provide an element with [aria-describedby=${this.element.getAttribute("id")}]`,
|
|
116
124
|
);
|
|
117
125
|
}
|
|
118
|
-
if (this.element.hasAttribute(
|
|
126
|
+
if (this.element.hasAttribute("data-tooltip-keep-with-text")) {
|
|
119
127
|
this.wrapLastWordAndButton();
|
|
120
128
|
}
|
|
121
|
-
this.rootContainer = document.querySelector(
|
|
129
|
+
this.rootContainer = document.querySelector(
|
|
130
|
+
this.config.rootContainerSelector,
|
|
131
|
+
);
|
|
122
132
|
if (this.rootContainer) {
|
|
123
133
|
this.rootContainer.appendChild(this.element);
|
|
124
134
|
} else {
|
|
125
135
|
console.warn(
|
|
126
|
-
|
|
136
|
+
"rootContainer element is not defined. Tooltips will be placed inside content which can affect positioning. Please provide rootContainer element (should be placed outside of main content, usually in end of <body /> tag)",
|
|
127
137
|
);
|
|
128
138
|
}
|
|
129
|
-
const customPlacement = this.element.getAttribute(
|
|
139
|
+
const customPlacement = this.element.getAttribute("data-tooltip-placement");
|
|
130
140
|
if (customPlacement) {
|
|
131
141
|
this.config.popperOptions.placement = customPlacement as any;
|
|
132
142
|
}
|
|
133
143
|
this.instance = createPopper(
|
|
134
144
|
this.trigger,
|
|
135
145
|
this.element,
|
|
136
|
-
this.config.popperOptions
|
|
146
|
+
this.config.popperOptions,
|
|
137
147
|
);
|
|
138
148
|
this.transitioner = transitionHiddenElement({
|
|
139
149
|
element: this.element,
|
|
140
|
-
visibleClass:
|
|
150
|
+
visibleClass: "is-visible",
|
|
141
151
|
});
|
|
142
|
-
this.
|
|
143
|
-
this.trigger.addEventListener(
|
|
144
|
-
this.trigger.addEventListener(
|
|
145
|
-
this.trigger.addEventListener(
|
|
152
|
+
this.element.addEventListener("mousedown", this.onDialogMouseDown);
|
|
153
|
+
this.trigger.addEventListener("click", this.handleVisibility);
|
|
154
|
+
this.trigger.addEventListener("keydown", this.handleVisibility);
|
|
155
|
+
this.trigger.addEventListener("blur", this.handleVisibility);
|
|
146
156
|
}
|
|
147
157
|
|
|
148
|
-
private
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
158
|
+
private onDialogMouseDown(): void {
|
|
159
|
+
this.ignoreNextBlur = true;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private onDocumentClick(e: MouseEvent): void {
|
|
163
|
+
const target = e.target as Node | null;
|
|
164
|
+
|
|
165
|
+
if (!target) {
|
|
166
|
+
return;
|
|
154
167
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this.hide();
|
|
159
|
-
}
|
|
168
|
+
|
|
169
|
+
if (this.trigger.contains(target) || this.element.contains(target)) {
|
|
170
|
+
return;
|
|
160
171
|
}
|
|
172
|
+
|
|
173
|
+
this.hide();
|
|
161
174
|
}
|
|
162
175
|
|
|
163
|
-
private
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
176
|
+
private handleVisibility(e: Event): void {
|
|
177
|
+
if (e.type === "click") {
|
|
178
|
+
this.toggle();
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (e.type === "keydown") {
|
|
182
|
+
this.onKeydown(e as KeyboardEvent);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (e.type === "blur") {
|
|
186
|
+
if (this.ignoreNextBlur) {
|
|
187
|
+
this.ignoreNextBlur = false;
|
|
188
|
+
return;
|
|
170
189
|
}
|
|
171
|
-
|
|
172
|
-
if (this.element.contains(mouseLeftTo)) {
|
|
173
|
-
this.element.addEventListener('mouseleave', callback);
|
|
174
|
-
return false;
|
|
190
|
+
this.hide();
|
|
175
191
|
}
|
|
176
|
-
return true;
|
|
177
192
|
}
|
|
178
193
|
|
|
179
194
|
private onKeydown(e: KeyboardEvent): void {
|
|
195
|
+
if (
|
|
196
|
+
(e.key === "Enter" || e.key === " ") &&
|
|
197
|
+
this.trigger.tagName !== "BUTTON"
|
|
198
|
+
) {
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
this.toggle();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
180
203
|
if (keys.ESC.includes(e.key)) {
|
|
181
204
|
this.hide();
|
|
182
205
|
}
|
|
183
206
|
}
|
|
184
207
|
|
|
208
|
+
private toggle(): void {
|
|
209
|
+
if (this.isOpen) {
|
|
210
|
+
this.hide();
|
|
211
|
+
} else {
|
|
212
|
+
this.show();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
185
216
|
public show(): void {
|
|
186
217
|
this.transitioner.show();
|
|
187
|
-
this.trigger.classList.add(
|
|
218
|
+
this.trigger.classList.add("is-active");
|
|
219
|
+
this.isOpen = true;
|
|
188
220
|
this.instance.forceUpdate();
|
|
189
|
-
document.addEventListener(
|
|
221
|
+
document.addEventListener("click", this.onDocumentClick);
|
|
190
222
|
}
|
|
191
223
|
|
|
192
224
|
public hide(): void {
|
|
193
225
|
this.transitioner.hide();
|
|
194
|
-
this.trigger.classList.remove(
|
|
195
|
-
|
|
226
|
+
this.trigger.classList.remove("is-active");
|
|
227
|
+
this.isOpen = false;
|
|
228
|
+
document.removeEventListener("click", this.onDocumentClick);
|
|
196
229
|
}
|
|
197
230
|
|
|
198
231
|
public update(): void {
|
|
@@ -200,10 +233,11 @@ export default class Tooltip {
|
|
|
200
233
|
}
|
|
201
234
|
|
|
202
235
|
public destroy(): void {
|
|
203
|
-
this.
|
|
204
|
-
this.trigger.removeEventListener(
|
|
205
|
-
this.trigger.removeEventListener(
|
|
206
|
-
this.trigger.removeEventListener(
|
|
236
|
+
this.element.removeEventListener("mousedown", this.onDialogMouseDown);
|
|
237
|
+
this.trigger.removeEventListener("click", this.handleVisibility);
|
|
238
|
+
this.trigger.removeEventListener("keydown", this.handleVisibility);
|
|
239
|
+
this.trigger.removeEventListener("blur", this.handleVisibility);
|
|
240
|
+
document.removeEventListener("click", this.onDocumentClick);
|
|
207
241
|
this.instance.destroy();
|
|
208
242
|
(this.element as any).ODS_Tooltip = null;
|
|
209
243
|
if (this.config.removeDialogOnDestroy) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import React from "react";
|
|
4
3
|
import cx from "classnames";
|
|
5
|
-
|
|
6
|
-
import TooltipStatic from "./Tooltip.static";
|
|
4
|
+
import React from "react";
|
|
7
5
|
import { useHydrationSafeId, useStatic } from "../../utils/hooks";
|
|
6
|
+
import TooltipStatic from "./Tooltip.static";
|
|
8
7
|
|
|
9
8
|
const CLASS_ROOT = "tooltip";
|
|
10
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
3
|
-
@use
|
|
4
|
-
@use
|
|
5
|
-
@use
|
|
6
|
-
@use
|
|
1
|
+
@use "sass:math" as math;
|
|
2
|
+
@use "../../../styles/tokens/base";
|
|
3
|
+
@use "../../../styles/tools/generate";
|
|
4
|
+
@use "../../../styles/tools/convert";
|
|
5
|
+
@use "../../../styles/tools/layout";
|
|
6
|
+
@use "./config";
|
|
7
7
|
|
|
8
8
|
@mixin tooltip($config: config.$layout, $offset: config.$offset) {
|
|
9
9
|
position: absolute;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
@each $direction, $opposite in config.$direction-opposites {
|
|
21
|
-
&[data-popper-placement^=
|
|
21
|
+
&[data-popper-placement^="#{$direction}"] {
|
|
22
22
|
padding-#{$opposite}: $offset;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -42,13 +42,14 @@
|
|
|
42
42
|
$size-unitless: convert.strip-units($size);
|
|
43
43
|
$hypotenuse: math.sqrt(
|
|
44
44
|
math.pow($size-unitless, 2) + math.pow($size-unitless, 2)
|
|
45
|
-
) *
|
|
45
|
+
) *
|
|
46
|
+
1rem;
|
|
46
47
|
$arrow-position: $offset - math.div($hypotenuse, 4);
|
|
47
48
|
|
|
48
49
|
display: block;
|
|
49
50
|
|
|
50
51
|
&::before {
|
|
51
|
-
content:
|
|
52
|
+
content: "";
|
|
52
53
|
display: block;
|
|
53
54
|
width: $size;
|
|
54
55
|
height: $size;
|
|
@@ -59,13 +60,13 @@
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
@each $direction, $opposite in config.$direction-opposites {
|
|
62
|
-
[data-popper-placement^=
|
|
63
|
+
[data-popper-placement^="#{$direction}"] & {
|
|
63
64
|
#{$opposite}: $arrow-position;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
@each $direction, $reset-directions in config.$direction-border-color-reset {
|
|
68
|
-
[data-popper-placement^=
|
|
69
|
+
[data-popper-placement^="#{$direction}"] &:before {
|
|
69
70
|
@each $reset-direction in $reset-directions {
|
|
70
71
|
border-#{$reset-direction}-color: transparent;
|
|
71
72
|
}
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
@include base.focusring-round;
|
|
81
82
|
|
|
82
83
|
&::before {
|
|
83
|
-
content:
|
|
84
|
+
content: "";
|
|
84
85
|
position: absolute;
|
|
85
86
|
top: convert.to-rem(-10px);
|
|
86
87
|
left: convert.to-rem(-10px);
|
|
@@ -91,4 +92,4 @@
|
|
|
91
92
|
|
|
92
93
|
@mixin info-tooltip-active-icon {
|
|
93
94
|
color: config.$icon-active-color;
|
|
94
|
-
}
|
|
95
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fireEvent, render } from "@testing-library/react";
|
|
2
2
|
|
|
3
3
|
import { Tooltip } from "../Tooltip";
|
|
4
4
|
|
|
@@ -223,79 +223,88 @@ describe("rendering Tooltip", () => {
|
|
|
223
223
|
</Base>,
|
|
224
224
|
);
|
|
225
225
|
});
|
|
226
|
-
it("button
|
|
226
|
+
it("button does not get class is-active when focused", () => {
|
|
227
227
|
const { container } = tooltip;
|
|
228
228
|
fireEvent.focus(container.querySelector("button"));
|
|
229
|
-
expect(container.querySelector("button")).toHaveClass("is-active");
|
|
229
|
+
expect(container.querySelector("button")).not.toHaveClass("is-active");
|
|
230
230
|
});
|
|
231
231
|
|
|
232
|
-
it("tooltip
|
|
232
|
+
it("tooltip is not visible when button is focused", () => {
|
|
233
233
|
const { container, getByTestId } = tooltip;
|
|
234
234
|
fireEvent.focus(container.querySelector("button"));
|
|
235
|
-
expect(getByTestId("test-id")).toHaveClass("is-visible");
|
|
235
|
+
expect(getByTestId("test-id")).not.toHaveClass("is-visible");
|
|
236
236
|
});
|
|
237
|
-
it("button has class is-active when
|
|
237
|
+
it("button has class is-active when clicked", () => {
|
|
238
238
|
const { container } = tooltip;
|
|
239
|
-
fireEvent.
|
|
239
|
+
fireEvent.click(container.querySelector("button"));
|
|
240
240
|
expect(container.querySelector("button")).toHaveClass("is-active");
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
-
it("tooltip has class is-visible when
|
|
243
|
+
it("tooltip has class is-visible when button is clicked", () => {
|
|
244
244
|
const { container, getByTestId } = tooltip;
|
|
245
|
-
fireEvent.
|
|
245
|
+
fireEvent.click(container.querySelector("button"));
|
|
246
246
|
expect(getByTestId("test-id")).toHaveClass("is-visible");
|
|
247
247
|
});
|
|
248
|
-
it("has hidden attribute set to false after
|
|
248
|
+
it("has hidden attribute set to false after button click", () => {
|
|
249
249
|
const { getByTestId, container } = tooltip;
|
|
250
|
-
fireEvent.
|
|
250
|
+
fireEvent.click(container.querySelector("button"));
|
|
251
251
|
expect(getByTestId("test-id").hidden).toBe(false);
|
|
252
252
|
});
|
|
253
|
-
it("
|
|
253
|
+
it("keeps hidden attribute set to true after button focus", () => {
|
|
254
254
|
const { getByTestId, container } = tooltip;
|
|
255
255
|
fireEvent.focus(container.querySelector("button"));
|
|
256
|
-
expect(getByTestId("test-id").hidden).toBe(
|
|
256
|
+
expect(getByTestId("test-id").hidden).toBe(true);
|
|
257
257
|
});
|
|
258
|
-
it("button
|
|
258
|
+
it("button loses class is-active after blur", () => {
|
|
259
259
|
const { container } = tooltip;
|
|
260
|
-
fireEvent.
|
|
260
|
+
fireEvent.click(container.querySelector("button"));
|
|
261
261
|
fireEvent.blur(container.querySelector("button"));
|
|
262
262
|
expect(container.querySelector("button")).not.toHaveClass("is-active");
|
|
263
263
|
});
|
|
264
264
|
|
|
265
|
-
it("tooltip
|
|
265
|
+
it("tooltip loses class is-visible after blur", () => {
|
|
266
266
|
const { container, getByTestId } = tooltip;
|
|
267
|
-
fireEvent.
|
|
267
|
+
fireEvent.click(container.querySelector("button"));
|
|
268
268
|
fireEvent.blur(container.querySelector("button"));
|
|
269
269
|
expect(getByTestId("test-id")).not.toHaveClass("is-visible");
|
|
270
270
|
});
|
|
271
|
-
it("button
|
|
271
|
+
it("button loses class is-active after second click", () => {
|
|
272
272
|
const { container } = tooltip;
|
|
273
|
-
fireEvent.
|
|
274
|
-
fireEvent.
|
|
273
|
+
fireEvent.click(container.querySelector("button"));
|
|
274
|
+
fireEvent.click(container.querySelector("button"));
|
|
275
275
|
expect(container.querySelector("button")).not.toHaveClass("is-active");
|
|
276
276
|
});
|
|
277
277
|
|
|
278
|
-
it("tooltip
|
|
278
|
+
it("tooltip loses class is-visible after second click", () => {
|
|
279
279
|
const { container, getByTestId } = tooltip;
|
|
280
|
-
fireEvent.
|
|
281
|
-
fireEvent.
|
|
280
|
+
fireEvent.click(container.querySelector("button"));
|
|
281
|
+
fireEvent.click(container.querySelector("button"));
|
|
282
282
|
expect(getByTestId("test-id")).not.toHaveClass("is-visible");
|
|
283
283
|
});
|
|
284
|
-
it("
|
|
284
|
+
it("hides on blur after being opened by click", () => {
|
|
285
285
|
const { getByTestId, container } = tooltip;
|
|
286
|
-
fireEvent.
|
|
287
|
-
fireEvent.
|
|
288
|
-
|
|
289
|
-
expect(getByTestId("test-id").hidden).toBe(false);
|
|
290
|
-
});
|
|
286
|
+
fireEvent.click(container.querySelector("button"));
|
|
287
|
+
fireEvent.blur(container.querySelector("button"));
|
|
288
|
+
expect(getByTestId("test-id")).not.toHaveClass("is-visible");
|
|
291
289
|
});
|
|
292
|
-
it("
|
|
290
|
+
it("stays visible when tooltip content is clicked", () => {
|
|
293
291
|
const { getByTestId, container } = tooltip;
|
|
294
|
-
fireEvent.
|
|
292
|
+
fireEvent.click(container.querySelector("button"));
|
|
293
|
+
fireEvent.mouseDown(getByTestId("test-id"));
|
|
295
294
|
fireEvent.blur(container.querySelector("button"));
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
expect(getByTestId("test-id")).toHaveClass("is-visible");
|
|
296
|
+
});
|
|
297
|
+
it("hides when clicking outside tooltip and trigger", () => {
|
|
298
|
+
const { getByTestId, container } = tooltip;
|
|
299
|
+
fireEvent.click(container.querySelector("button"));
|
|
300
|
+
fireEvent.click(document.body);
|
|
301
|
+
expect(getByTestId("test-id")).not.toHaveClass("is-visible");
|
|
302
|
+
});
|
|
303
|
+
it("hides on Escape key press", () => {
|
|
304
|
+
const { getByTestId, container } = tooltip;
|
|
305
|
+
fireEvent.click(container.querySelector("button"));
|
|
306
|
+
fireEvent.keyDown(container.querySelector("button"), { key: "Escape" });
|
|
307
|
+
expect(getByTestId("test-id")).not.toHaveClass("is-visible");
|
|
299
308
|
});
|
|
300
309
|
});
|
|
301
310
|
});
|