@amsterdam/design-system-react 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.d.ts +35 -0
- package/dist/Accordion/Accordion.js +19 -0
- package/dist/Accordion/Accordion.test.d.ts +1 -0
- package/dist/Accordion/Accordion.test.js +24 -0
- package/dist/Accordion/AccordionContext.d.ts +12 -0
- package/dist/Accordion/AccordionContext.js +11 -0
- package/dist/Accordion/AccordionSection.d.ts +19 -0
- package/dist/Accordion/AccordionSection.js +22 -0
- package/dist/Accordion/AccordionSection.test.d.ts +1 -0
- package/dist/Accordion/AccordionSection.test.js +83 -0
- package/dist/Accordion/index.d.ts +3 -0
- package/dist/Accordion/index.js +1 -0
- package/dist/ActionGroup/ActionGroup.d.ts +9 -0
- package/dist/ActionGroup/ActionGroup.js +9 -0
- package/dist/ActionGroup/ActionGroup.test.d.ts +1 -0
- package/dist/ActionGroup/ActionGroup.test.js +29 -0
- package/dist/ActionGroup/index.d.ts +2 -0
- package/dist/ActionGroup/index.js +1 -0
- package/dist/Alert/Alert.d.ts +46 -0
- package/dist/Alert/Alert.js +22 -0
- package/dist/Alert/Alert.test.d.ts +1 -0
- package/dist/Alert/Alert.test.js +59 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/index.js +1 -0
- package/dist/Avatar/Avatar.d.ts +24 -0
- package/dist/Avatar/Avatar.js +25 -0
- package/dist/Avatar/Avatar.test.d.ts +1 -0
- package/dist/Avatar/Avatar.test.js +58 -0
- package/dist/Avatar/index.d.ts +2 -0
- package/dist/Avatar/index.js +1 -0
- package/dist/Badge/Badge.d.ts +20 -0
- package/dist/Badge/Badge.js +10 -0
- package/dist/Badge/Badge.test.d.ts +1 -0
- package/dist/Badge/Badge.test.js +39 -0
- package/dist/Badge/index.d.ts +2 -0
- package/dist/Badge/index.js +1 -0
- package/dist/Blockquote/Blockquote.d.ts +15 -0
- package/dist/Blockquote/Blockquote.js +9 -0
- package/dist/Blockquote/Blockquote.test.d.ts +1 -0
- package/dist/Blockquote/Blockquote.test.js +43 -0
- package/dist/Blockquote/index.d.ts +2 -0
- package/dist/Blockquote/index.js +1 -0
- package/dist/Breadcrumb/Breadcrumb.d.ts +11 -0
- package/dist/Breadcrumb/Breadcrumb.js +11 -0
- package/dist/Breadcrumb/Breadcrumb.test.d.ts +1 -0
- package/dist/Breadcrumb/Breadcrumb.test.js +41 -0
- package/dist/Breadcrumb/BreadcrumbLink.d.ts +7 -0
- package/dist/Breadcrumb/BreadcrumbLink.js +9 -0
- package/dist/Breadcrumb/BreadcrumbLink.test.d.ts +1 -0
- package/dist/Breadcrumb/BreadcrumbLink.test.js +36 -0
- package/dist/Breadcrumb/index.d.ts +3 -0
- package/dist/Breadcrumb/index.js +1 -0
- package/dist/Breakout/Breakout.d.ts +15 -0
- package/dist/Breakout/Breakout.js +12 -0
- package/dist/Breakout/Breakout.test.d.ts +1 -0
- package/dist/Breakout/Breakout.test.js +66 -0
- package/dist/Breakout/BreakoutCell.d.ts +35 -0
- package/dist/Breakout/BreakoutCell.js +10 -0
- package/dist/Breakout/BreakoutCell.test.d.ts +1 -0
- package/dist/Breakout/BreakoutCell.test.js +120 -0
- package/dist/Breakout/breakoutCellClasses.d.ts +6 -0
- package/dist/Breakout/breakoutCellClasses.js +11 -0
- package/dist/Breakout/index.d.ts +3 -0
- package/dist/Breakout/index.js +1 -0
- package/dist/Button/Button.d.ts +31 -0
- package/dist/Button/Button.js +10 -0
- package/dist/Button/Button.test.d.ts +1 -0
- package/dist/Button/Button.test.js +103 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/index.js +1 -0
- package/dist/Card/Card.d.ts +18 -0
- package/dist/Card/Card.js +12 -0
- package/dist/Card/Card.test.d.ts +1 -0
- package/dist/Card/Card.test.js +29 -0
- package/dist/Card/CardHeadingGroup.d.ts +15 -0
- package/dist/Card/CardHeadingGroup.js +10 -0
- package/dist/Card/CardHeadingGroup.test.d.ts +1 -0
- package/dist/Card/CardHeadingGroup.test.js +34 -0
- package/dist/Card/CardLink.d.ts +9 -0
- package/dist/Card/CardLink.js +9 -0
- package/dist/Card/CardLink.test.d.ts +1 -0
- package/dist/Card/CardLink.test.js +29 -0
- package/dist/Card/index.d.ts +4 -0
- package/dist/Card/index.js +1 -0
- package/dist/CharacterCount/CharacterCount.d.ts +17 -0
- package/dist/CharacterCount/CharacterCount.js +9 -0
- package/dist/CharacterCount/CharacterCount.test.d.ts +1 -0
- package/dist/CharacterCount/CharacterCount.test.js +34 -0
- package/dist/CharacterCount/index.d.ts +2 -0
- package/dist/CharacterCount/index.js +1 -0
- package/dist/Checkbox/Checkbox.d.ts +19 -0
- package/dist/Checkbox/Checkbox.js +24 -0
- package/dist/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/Checkbox/Checkbox.test.js +124 -0
- package/dist/Checkbox/index.d.ts +2 -0
- package/dist/Checkbox/index.js +1 -0
- package/dist/Column/Column.d.ts +56 -0
- package/dist/Column/Column.js +10 -0
- package/dist/Column/Column.test.d.ts +1 -0
- package/dist/Column/Column.test.js +57 -0
- package/dist/Column/index.d.ts +2 -0
- package/dist/Column/index.js +1 -0
- package/dist/DateInput/DateInput.d.ts +20 -0
- package/dist/DateInput/DateInput.js +10 -0
- package/dist/DateInput/DateInput.test.d.ts +1 -0
- package/dist/DateInput/DateInput.test.js +54 -0
- package/dist/DateInput/index.d.ts +2 -0
- package/dist/DateInput/index.js +1 -0
- package/dist/DescriptionList/DescriptionList.d.ts +30 -0
- package/dist/DescriptionList/DescriptionList.js +18 -0
- package/dist/DescriptionList/DescriptionList.test.d.ts +1 -0
- package/dist/DescriptionList/DescriptionList.test.js +39 -0
- package/dist/DescriptionList/DescriptionListDescription.d.ts +9 -0
- package/dist/DescriptionList/DescriptionListDescription.js +9 -0
- package/dist/DescriptionList/DescriptionListDescription.test.d.ts +1 -0
- package/dist/DescriptionList/DescriptionListDescription.test.js +29 -0
- package/dist/DescriptionList/DescriptionListSection.d.ts +9 -0
- package/dist/DescriptionList/DescriptionListSection.js +9 -0
- package/dist/DescriptionList/DescriptionListSection.test.d.ts +1 -0
- package/dist/DescriptionList/DescriptionListSection.test.js +29 -0
- package/dist/DescriptionList/DescriptionListTerm.d.ts +9 -0
- package/dist/DescriptionList/DescriptionListTerm.js +9 -0
- package/dist/DescriptionList/DescriptionListTerm.test.d.ts +1 -0
- package/dist/DescriptionList/DescriptionListTerm.test.js +29 -0
- package/dist/DescriptionList/index.d.ts +4 -0
- package/dist/DescriptionList/index.js +1 -0
- package/dist/Dialog/Dialog.d.ts +27 -0
- package/dist/Dialog/Dialog.js +17 -0
- package/dist/Dialog/Dialog.test.d.ts +1 -0
- package/dist/Dialog/Dialog.test.js +78 -0
- package/dist/Dialog/index.d.ts +2 -0
- package/dist/Dialog/index.js +1 -0
- package/dist/ErrorMessage/ErrorMessage.d.ts +19 -0
- package/dist/ErrorMessage/ErrorMessage.js +11 -0
- package/dist/ErrorMessage/ErrorMessage.test.d.ts +1 -0
- package/dist/ErrorMessage/ErrorMessage.test.js +49 -0
- package/dist/ErrorMessage/index.d.ts +2 -0
- package/dist/ErrorMessage/index.js +1 -0
- package/dist/Field/Field.d.ts +15 -0
- package/dist/Field/Field.js +9 -0
- package/dist/Field/Field.test.d.ts +1 -0
- package/dist/Field/Field.test.js +34 -0
- package/dist/Field/index.d.ts +2 -0
- package/dist/Field/index.js +1 -0
- package/dist/FieldSet/FieldSet.d.ts +23 -0
- package/dist/FieldSet/FieldSet.js +12 -0
- package/dist/FieldSet/FieldSet.test.d.ts +1 -0
- package/dist/FieldSet/FieldSet.test.js +59 -0
- package/dist/FieldSet/index.d.ts +2 -0
- package/dist/FieldSet/index.js +1 -0
- package/dist/Figure/Figure.d.ts +15 -0
- package/dist/Figure/Figure.js +11 -0
- package/dist/Figure/Figure.test.d.ts +1 -0
- package/dist/Figure/Figure.test.js +29 -0
- package/dist/Figure/FigureCaption.d.ts +15 -0
- package/dist/Figure/FigureCaption.js +9 -0
- package/dist/Figure/FigureCaption.test.d.ts +1 -0
- package/dist/Figure/FigureCaption.test.js +34 -0
- package/dist/Figure/index.d.ts +2 -0
- package/dist/Figure/index.js +1 -0
- package/dist/FileInput/FileInput.d.ts +7 -0
- package/dist/FileInput/FileInput.js +9 -0
- package/dist/FileInput/FileInput.test.d.ts +1 -0
- package/dist/FileInput/FileInput.test.js +29 -0
- package/dist/FileInput/index.d.ts +2 -0
- package/dist/FileInput/index.js +1 -0
- package/dist/FileList/FileList.d.ts +17 -0
- package/dist/FileList/FileList.js +13 -0
- package/dist/FileList/FileList.test.d.ts +1 -0
- package/dist/FileList/FileList.test.js +29 -0
- package/dist/FileList/FileListItem.d.ts +13 -0
- package/dist/FileList/FileListItem.js +14 -0
- package/dist/FileList/FileListItem.test.d.ts +1 -0
- package/dist/FileList/FileListItem.test.js +40 -0
- package/dist/FileList/index.d.ts +2 -0
- package/dist/FileList/index.js +1 -0
- package/dist/Footer/Footer.d.ts +19 -0
- package/dist/Footer/Footer.js +17 -0
- package/dist/Footer/Footer.test.d.ts +1 -0
- package/dist/Footer/Footer.test.js +29 -0
- package/dist/Footer/FooterMenu.d.ts +9 -0
- package/dist/Footer/FooterMenu.js +9 -0
- package/dist/Footer/FooterMenu.test.d.ts +1 -0
- package/dist/Footer/FooterMenu.test.js +31 -0
- package/dist/Footer/FooterMenuLink.d.ts +9 -0
- package/dist/Footer/FooterMenuLink.js +9 -0
- package/dist/Footer/FooterMenuLink.test.d.ts +1 -0
- package/dist/Footer/FooterMenuLink.test.js +29 -0
- package/dist/Footer/FooterSpotlight.d.ts +9 -0
- package/dist/Footer/FooterSpotlight.js +9 -0
- package/dist/Footer/FooterSpotlight.test.d.ts +1 -0
- package/dist/Footer/FooterSpotlight.test.js +29 -0
- package/dist/Footer/index.d.ts +5 -0
- package/dist/Footer/index.js +1 -0
- package/dist/Grid/Grid.d.ts +37 -0
- package/dist/Grid/Grid.js +13 -0
- package/dist/Grid/Grid.test.d.ts +1 -0
- package/dist/Grid/Grid.test.js +81 -0
- package/dist/Grid/GridCell.d.ts +25 -0
- package/dist/Grid/GridCell.js +11 -0
- package/dist/Grid/GridCell.test.d.ts +1 -0
- package/dist/Grid/GridCell.test.js +86 -0
- package/dist/Grid/gridCellClasses.d.ts +8 -0
- package/dist/Grid/gridCellClasses.js +18 -0
- package/dist/Grid/index.d.ts +3 -0
- package/dist/Grid/index.js +1 -0
- package/dist/Grid/paddingClasses.d.ts +2 -0
- package/dist/Grid/paddingClasses.js +13 -0
- package/dist/Header/Header.d.ts +49 -0
- package/dist/Header/Header.js +31 -0
- package/dist/Header/Header.test.d.ts +2 -0
- package/dist/Header/Header.test.js +121 -0
- package/dist/Header/HeaderGridCellNarrowWindowOnly.d.ts +2 -0
- package/dist/Header/HeaderGridCellNarrowWindowOnly.js +6 -0
- package/dist/Header/HeaderGridCellNarrowWindowOnly.test.d.ts +1 -0
- package/dist/Header/HeaderGridCellNarrowWindowOnly.test.js +34 -0
- package/dist/Header/HeaderMenuIcon.d.ts +2 -0
- package/dist/Header/HeaderMenuIcon.js +2 -0
- package/dist/Header/HeaderMenuLink.d.ts +9 -0
- package/dist/Header/HeaderMenuLink.js +5 -0
- package/dist/Header/HeaderMenuLink.test.d.ts +1 -0
- package/dist/Header/HeaderMenuLink.test.js +41 -0
- package/dist/Header/index.d.ts +3 -0
- package/dist/Header/index.js +1 -0
- package/dist/Header/matchMedia.mock.d.ts +0 -0
- package/dist/Header/matchMedia.mock.js +15 -0
- package/dist/Heading/Heading.d.ts +24 -0
- package/dist/Heading/Heading.js +15 -0
- package/dist/Heading/Heading.test.d.ts +1 -0
- package/dist/Heading/Heading.test.js +62 -0
- package/dist/Heading/getHeadingTag.d.ts +2 -0
- package/dist/Heading/getHeadingTag.js +13 -0
- package/dist/Heading/index.d.ts +2 -0
- package/dist/Heading/index.js +1 -0
- package/dist/Hint/Hint.d.ts +16 -0
- package/dist/Hint/Hint.js +21 -0
- package/dist/Hint/Hint.test.d.ts +1 -0
- package/dist/Hint/Hint.test.js +49 -0
- package/dist/Hint/index.d.ts +2 -0
- package/dist/Hint/index.js +1 -0
- package/dist/Icon/Icon.d.ts +30 -0
- package/dist/Icon/Icon.js +12 -0
- package/dist/Icon/Icon.test.d.ts +1 -0
- package/dist/Icon/Icon.test.js +52 -0
- package/dist/Icon/index.d.ts +2 -0
- package/dist/Icon/index.js +1 -0
- package/dist/IconButton/IconButton.d.ts +26 -0
- package/dist/IconButton/IconButton.js +11 -0
- package/dist/IconButton/IconButton.test.d.ts +1 -0
- package/dist/IconButton/IconButton.test.js +44 -0
- package/dist/IconButton/index.d.ts +2 -0
- package/dist/IconButton/index.js +1 -0
- package/dist/Image/Image.d.ts +18 -0
- package/dist/Image/Image.js +10 -0
- package/dist/Image/Image.test.d.ts +1 -0
- package/dist/Image/Image.test.js +39 -0
- package/dist/Image/generateAspectRatioClass.d.ts +1 -0
- package/dist/Image/generateAspectRatioClass.js +1 -0
- package/dist/Image/index.d.ts +3 -0
- package/dist/Image/index.js +2 -0
- package/dist/ImageSlider/ImageSlider.d.ts +49 -0
- package/dist/ImageSlider/ImageSlider.js +98 -0
- package/dist/ImageSlider/ImageSlider.test.d.ts +1 -0
- package/dist/ImageSlider/ImageSlider.test.js +66 -0
- package/dist/ImageSlider/ImageSliderContext.d.ts +13 -0
- package/dist/ImageSlider/ImageSliderContext.js +14 -0
- package/dist/ImageSlider/ImageSliderControls.d.ts +17 -0
- package/dist/ImageSlider/ImageSliderControls.js +17 -0
- package/dist/ImageSlider/ImageSliderControls.test.d.ts +1 -0
- package/dist/ImageSlider/ImageSliderControls.test.js +21 -0
- package/dist/ImageSlider/ImageSliderItem.d.ts +15 -0
- package/dist/ImageSlider/ImageSliderItem.js +15 -0
- package/dist/ImageSlider/ImageSliderItem.test.d.ts +1 -0
- package/dist/ImageSlider/ImageSliderItem.test.js +33 -0
- package/dist/ImageSlider/ImageSliderScroller.d.ts +9 -0
- package/dist/ImageSlider/ImageSliderScroller.js +9 -0
- package/dist/ImageSlider/ImageSliderScroller.test.d.ts +1 -0
- package/dist/ImageSlider/ImageSliderScroller.test.js +33 -0
- package/dist/ImageSlider/ImageSliderThumbnails.d.ts +14 -0
- package/dist/ImageSlider/ImageSliderThumbnails.js +32 -0
- package/dist/ImageSlider/ImageSliderThumbnails.test.d.ts +1 -0
- package/dist/ImageSlider/ImageSliderThumbnails.test.js +48 -0
- package/dist/ImageSlider/index.d.ts +3 -0
- package/dist/ImageSlider/index.js +1 -0
- package/dist/InvalidFormAlert/InvalidFormAlert.d.ts +68 -0
- package/dist/InvalidFormAlert/InvalidFormAlert.js +20 -0
- package/dist/InvalidFormAlert/InvalidFormAlert.test.d.ts +1 -0
- package/dist/InvalidFormAlert/InvalidFormAlert.test.js +104 -0
- package/dist/InvalidFormAlert/InvalidFormAlertWithErrors.d.ts +12 -0
- package/dist/InvalidFormAlert/InvalidFormAlertWithErrors.js +22 -0
- package/dist/InvalidFormAlert/index.d.ts +2 -0
- package/dist/InvalidFormAlert/index.js +1 -0
- package/dist/InvalidFormAlert/useAddErrorCountToDocumentTitle.d.ts +11 -0
- package/dist/InvalidFormAlert/useAddErrorCountToDocumentTitle.js +26 -0
- package/dist/Label/Label.d.ts +14 -0
- package/dist/Label/Label.js +13 -0
- package/dist/Label/Label.test.d.ts +1 -0
- package/dist/Label/Label.test.js +74 -0
- package/dist/Label/index.d.ts +1 -0
- package/dist/Label/index.js +1 -0
- package/dist/Link/Link.d.ts +19 -0
- package/dist/Link/Link.js +9 -0
- package/dist/Link/Link.test.d.ts +1 -0
- package/dist/Link/Link.test.js +46 -0
- package/dist/Link/index.d.ts +2 -0
- package/dist/Link/index.js +1 -0
- package/dist/LinkList/LinkList.d.ts +17 -0
- package/dist/LinkList/LinkList.js +14 -0
- package/dist/LinkList/LinkList.test.d.ts +1 -0
- package/dist/LinkList/LinkList.test.js +29 -0
- package/dist/LinkList/LinkListLink.d.ts +24 -0
- package/dist/LinkList/LinkListLink.js +14 -0
- package/dist/LinkList/LinkListLink.test.d.ts +1 -0
- package/dist/LinkList/LinkListLink.test.js +50 -0
- package/dist/LinkList/index.d.ts +3 -0
- package/dist/LinkList/index.js +1 -0
- package/dist/Logo/Logo.d.ts +11 -0
- package/dist/Logo/Logo.js +21 -0
- package/dist/Logo/Logo.test.d.ts +1 -0
- package/dist/Logo/Logo.test.js +30 -0
- package/dist/Logo/brand/LogoAmsterdam.d.ts +3 -0
- package/dist/Logo/brand/LogoAmsterdam.js +5 -0
- package/dist/Logo/brand/LogoGgdAmsterdam.d.ts +3 -0
- package/dist/Logo/brand/LogoGgdAmsterdam.js +5 -0
- package/dist/Logo/brand/LogoMuseumWeesp.d.ts +3 -0
- package/dist/Logo/brand/LogoMuseumWeesp.js +5 -0
- package/dist/Logo/brand/LogoStadsarchief.d.ts +3 -0
- package/dist/Logo/brand/LogoStadsarchief.js +5 -0
- package/dist/Logo/brand/LogoStadsbankVanLening.d.ts +3 -0
- package/dist/Logo/brand/LogoStadsbankVanLening.js +5 -0
- package/dist/Logo/brand/LogoVgaVerzekeringen.d.ts +3 -0
- package/dist/Logo/brand/LogoVgaVerzekeringen.js +5 -0
- package/dist/Logo/brand/index.d.ts +6 -0
- package/dist/Logo/brand/index.js +6 -0
- package/dist/Logo/index.d.ts +2 -0
- package/dist/Logo/index.js +1 -0
- package/dist/Mark/Mark.d.ts +9 -0
- package/dist/Mark/Mark.js +9 -0
- package/dist/Mark/Mark.test.d.ts +1 -0
- package/dist/Mark/Mark.test.js +29 -0
- package/dist/Mark/index.d.ts +2 -0
- package/dist/Mark/index.js +1 -0
- package/dist/MegaMenu/MegaMenu.d.ts +14 -0
- package/dist/MegaMenu/MegaMenu.js +12 -0
- package/dist/MegaMenu/MegaMenu.test.d.ts +1 -0
- package/dist/MegaMenu/MegaMenu.test.js +29 -0
- package/dist/MegaMenu/MegaMenuListCategory.d.ts +9 -0
- package/dist/MegaMenu/MegaMenuListCategory.js +9 -0
- package/dist/MegaMenu/MegaMenuListCategory.test.d.ts +1 -0
- package/dist/MegaMenu/MegaMenuListCategory.test.js +29 -0
- package/dist/MegaMenu/index.d.ts +3 -0
- package/dist/MegaMenu/index.js +1 -0
- package/dist/OrderedList/OrderedList.d.ts +27 -0
- package/dist/OrderedList/OrderedList.js +11 -0
- package/dist/OrderedList/OrderedList.test.d.ts +1 -0
- package/dist/OrderedList/OrderedList.test.js +51 -0
- package/dist/OrderedList/OrderedListItem.d.ts +9 -0
- package/dist/OrderedList/OrderedListItem.js +9 -0
- package/dist/OrderedList/OrderedListItem.test.d.ts +1 -0
- package/dist/OrderedList/OrderedListItem.test.js +28 -0
- package/dist/OrderedList/index.d.ts +3 -0
- package/dist/OrderedList/index.js +1 -0
- package/dist/Overlap/Overlap.d.ts +9 -0
- package/dist/Overlap/Overlap.js +9 -0
- package/dist/Overlap/Overlap.test.d.ts +1 -0
- package/dist/Overlap/Overlap.test.js +34 -0
- package/dist/Overlap/index.d.ts +2 -0
- package/dist/Overlap/index.js +1 -0
- package/dist/PageHeading/PageHeading.d.ts +15 -0
- package/dist/PageHeading/PageHeading.js +9 -0
- package/dist/PageHeading/PageHeading.test.d.ts +1 -0
- package/dist/PageHeading/PageHeading.test.js +37 -0
- package/dist/PageHeading/index.d.ts +2 -0
- package/dist/PageHeading/index.js +1 -0
- package/dist/PageMenu/PageMenu.d.ts +25 -0
- package/dist/PageMenu/PageMenu.js +12 -0
- package/dist/PageMenu/PageMenu.test.d.ts +1 -0
- package/dist/PageMenu/PageMenu.test.js +45 -0
- package/dist/PageMenu/PageMenuLink.d.ts +13 -0
- package/dist/PageMenu/PageMenuLink.js +10 -0
- package/dist/PageMenu/PageMenuLink.test.d.ts +1 -0
- package/dist/PageMenu/PageMenuLink.test.js +40 -0
- package/dist/PageMenu/index.d.ts +3 -0
- package/dist/PageMenu/index.js +1 -0
- package/dist/Pagination/LinkItem.d.ts +7 -0
- package/dist/Pagination/LinkItem.js +7 -0
- package/dist/Pagination/Pagination.d.ts +59 -0
- package/dist/Pagination/Pagination.js +23 -0
- package/dist/Pagination/Pagination.test.d.ts +1 -0
- package/dist/Pagination/Pagination.test.js +120 -0
- package/dist/Pagination/Spacer.d.ts +1 -0
- package/dist/Pagination/Spacer.js +2 -0
- package/dist/Pagination/getRange.d.ts +16 -0
- package/dist/Pagination/getRange.js +41 -0
- package/dist/Pagination/index.d.ts +2 -0
- package/dist/Pagination/index.js +1 -0
- package/dist/Paragraph/Paragraph.d.ts +20 -0
- package/dist/Paragraph/Paragraph.js +10 -0
- package/dist/Paragraph/Paragraph.test.d.ts +1 -0
- package/dist/Paragraph/Paragraph.test.js +58 -0
- package/dist/Paragraph/index.d.ts +2 -0
- package/dist/Paragraph/index.js +1 -0
- package/dist/PasswordInput/PasswordInput.d.ts +13 -0
- package/dist/PasswordInput/PasswordInput.js +9 -0
- package/dist/PasswordInput/PasswordInput.test.d.ts +1 -0
- package/dist/PasswordInput/PasswordInput.test.js +85 -0
- package/dist/PasswordInput/index.d.ts +2 -0
- package/dist/PasswordInput/index.js +1 -0
- package/dist/Radio/Radio.d.ts +19 -0
- package/dist/Radio/Radio.js +16 -0
- package/dist/Radio/Radio.test.d.ts +1 -0
- package/dist/Radio/Radio.test.js +121 -0
- package/dist/Radio/RadioIcon.d.ts +3 -0
- package/dist/Radio/RadioIcon.js +3 -0
- package/dist/Radio/index.d.ts +2 -0
- package/dist/Radio/index.js +1 -0
- package/dist/Row/Row.d.ts +66 -0
- package/dist/Row/Row.js +10 -0
- package/dist/Row/Row.test.d.ts +1 -0
- package/dist/Row/Row.test.js +62 -0
- package/dist/Row/index.d.ts +2 -0
- package/dist/Row/index.js +1 -0
- package/dist/Screen/Screen.d.ts +21 -0
- package/dist/Screen/Screen.js +9 -0
- package/dist/Screen/Screen.test.d.ts +1 -0
- package/dist/Screen/Screen.test.js +40 -0
- package/dist/Screen/index.d.ts +2 -0
- package/dist/Screen/index.js +1 -0
- package/dist/SearchField/SearchField.d.ts +292 -0
- package/dist/SearchField/SearchField.js +14 -0
- package/dist/SearchField/SearchField.test.d.ts +1 -0
- package/dist/SearchField/SearchField.test.js +47 -0
- package/dist/SearchField/SearchFieldButton.d.ts +8 -0
- package/dist/SearchField/SearchFieldButton.js +10 -0
- package/dist/SearchField/SearchFieldInput.d.ts +11 -0
- package/dist/SearchField/SearchFieldInput.js +12 -0
- package/dist/SearchField/SearchFieldInput.test.d.ts +1 -0
- package/dist/SearchField/SearchFieldInput.test.js +62 -0
- package/dist/SearchField/index.d.ts +2 -0
- package/dist/SearchField/index.js +1 -0
- package/dist/Select/Select.d.ts +22 -0
- package/dist/Select/Select.js +12 -0
- package/dist/Select/Select.test.d.ts +1 -0
- package/dist/Select/Select.test.js +70 -0
- package/dist/Select/SelectOption.d.ts +9 -0
- package/dist/Select/SelectOption.js +9 -0
- package/dist/Select/SelectOption.test.d.ts +1 -0
- package/dist/Select/SelectOption.test.js +41 -0
- package/dist/Select/SelectOptionGroup.d.ts +9 -0
- package/dist/Select/SelectOptionGroup.js +9 -0
- package/dist/Select/SelectOptionGroup.test.d.ts +1 -0
- package/dist/Select/SelectOptionGroup.test.js +41 -0
- package/dist/Select/index.d.ts +3 -0
- package/dist/Select/index.js +1 -0
- package/dist/SkipLink/SkipLink.d.ts +9 -0
- package/dist/SkipLink/SkipLink.js +9 -0
- package/dist/SkipLink/SkipLink.test.d.ts +1 -0
- package/dist/SkipLink/SkipLink.test.js +29 -0
- package/dist/SkipLink/index.d.ts +2 -0
- package/dist/SkipLink/index.js +1 -0
- package/dist/Spotlight/Spotlight.d.ts +22 -0
- package/dist/Spotlight/Spotlight.js +10 -0
- package/dist/Spotlight/Spotlight.test.d.ts +1 -0
- package/dist/Spotlight/Spotlight.test.js +40 -0
- package/dist/Spotlight/index.d.ts +2 -0
- package/dist/Spotlight/index.js +1 -0
- package/dist/Switch/Switch.d.ts +9 -0
- package/dist/Switch/Switch.js +12 -0
- package/dist/Switch/Switch.test.d.ts +1 -0
- package/dist/Switch/Switch.test.js +65 -0
- package/dist/Switch/index.d.ts +2 -0
- package/dist/Switch/index.js +1 -0
- package/dist/Table/Table.d.ts +31 -0
- package/dist/Table/Table.js +25 -0
- package/dist/Table/Table.test.d.ts +1 -0
- package/dist/Table/Table.test.js +29 -0
- package/dist/Table/TableBody.d.ts +9 -0
- package/dist/Table/TableBody.js +9 -0
- package/dist/Table/TableBody.test.d.ts +1 -0
- package/dist/Table/TableBody.test.js +30 -0
- package/dist/Table/TableCaption.d.ts +10 -0
- package/dist/Table/TableCaption.js +10 -0
- package/dist/Table/TableCaption.test.d.ts +1 -0
- package/dist/Table/TableCaption.test.js +41 -0
- package/dist/Table/TableCell.d.ts +9 -0
- package/dist/Table/TableCell.js +9 -0
- package/dist/Table/TableCell.test.d.ts +1 -0
- package/dist/Table/TableCell.test.js +32 -0
- package/dist/Table/TableFooter.d.ts +9 -0
- package/dist/Table/TableFooter.js +9 -0
- package/dist/Table/TableFooter.test.d.ts +1 -0
- package/dist/Table/TableFooter.test.js +30 -0
- package/dist/Table/TableHeader.d.ts +9 -0
- package/dist/Table/TableHeader.js +9 -0
- package/dist/Table/TableHeader.test.d.ts +1 -0
- package/dist/Table/TableHeader.test.js +30 -0
- package/dist/Table/TableHeaderCell.d.ts +9 -0
- package/dist/Table/TableHeaderCell.js +9 -0
- package/dist/Table/TableHeaderCell.test.d.ts +1 -0
- package/dist/Table/TableHeaderCell.test.js +38 -0
- package/dist/Table/TableRow.d.ts +9 -0
- package/dist/Table/TableRow.js +9 -0
- package/dist/Table/TableRow.test.d.ts +1 -0
- package/dist/Table/TableRow.test.js +31 -0
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.js +1 -0
- package/dist/TableOfContents/TableOfContents.d.ts +33 -0
- package/dist/TableOfContents/TableOfContents.js +18 -0
- package/dist/TableOfContents/TableOfContents.test.d.ts +1 -0
- package/dist/TableOfContents/TableOfContents.test.js +40 -0
- package/dist/TableOfContents/TableOfContentsLink.d.ts +13 -0
- package/dist/TableOfContents/TableOfContentsLink.js +9 -0
- package/dist/TableOfContents/TableOfContentsLink.test.d.ts +1 -0
- package/dist/TableOfContents/TableOfContentsLink.test.js +30 -0
- package/dist/TableOfContents/TableOfContentsList.d.ts +9 -0
- package/dist/TableOfContents/TableOfContentsList.js +11 -0
- package/dist/TableOfContents/TableOfContentsList.test.d.ts +1 -0
- package/dist/TableOfContents/TableOfContentsList.test.js +36 -0
- package/dist/TableOfContents/index.d.ts +4 -0
- package/dist/TableOfContents/index.js +1 -0
- package/dist/Tabs/Tabs.d.ts +31 -0
- package/dist/Tabs/Tabs.js +57 -0
- package/dist/Tabs/Tabs.test.d.ts +1 -0
- package/dist/Tabs/Tabs.test.js +85 -0
- package/dist/Tabs/TabsButton.d.ts +15 -0
- package/dist/Tabs/TabsButton.js +19 -0
- package/dist/Tabs/TabsButton.test.d.ts +1 -0
- package/dist/Tabs/TabsButton.test.js +43 -0
- package/dist/Tabs/TabsContext.d.ts +16 -0
- package/dist/Tabs/TabsContext.js +11 -0
- package/dist/Tabs/TabsList.d.ts +9 -0
- package/dist/Tabs/TabsList.js +20 -0
- package/dist/Tabs/TabsList.test.d.ts +1 -0
- package/dist/Tabs/TabsList.test.js +28 -0
- package/dist/Tabs/TabsPanel.d.ts +15 -0
- package/dist/Tabs/TabsPanel.js +16 -0
- package/dist/Tabs/TabsPanel.test.d.ts +1 -0
- package/dist/Tabs/TabsPanel.test.js +40 -0
- package/dist/Tabs/index.d.ts +5 -0
- package/dist/Tabs/index.js +1 -0
- package/dist/TextArea/TextArea.d.ts +17 -0
- package/dist/TextArea/TextArea.js +9 -0
- package/dist/TextArea/TextArea.test.d.ts +1 -0
- package/dist/TextArea/TextArea.test.js +101 -0
- package/dist/TextArea/index.d.ts +2 -0
- package/dist/TextArea/index.js +1 -0
- package/dist/TextInput/TextInput.d.ts +20 -0
- package/dist/TextInput/TextInput.js +10 -0
- package/dist/TextInput/TextInput.test.d.ts +1 -0
- package/dist/TextInput/TextInput.test.js +89 -0
- package/dist/TextInput/index.d.ts +2 -0
- package/dist/TextInput/index.js +1 -0
- package/dist/TimeInput/TimeInput.d.ts +13 -0
- package/dist/TimeInput/TimeInput.js +9 -0
- package/dist/TimeInput/TimeInput.test.d.ts +1 -0
- package/dist/TimeInput/TimeInput.test.js +47 -0
- package/dist/TimeInput/index.d.ts +2 -0
- package/dist/TimeInput/index.js +1 -0
- package/dist/TopTaskLink/TopTaskLink.d.ts +17 -0
- package/dist/TopTaskLink/TopTaskLink.js +9 -0
- package/dist/TopTaskLink/TopTaskLink.test.d.ts +1 -0
- package/dist/TopTaskLink/TopTaskLink.test.js +42 -0
- package/dist/TopTaskLink/index.d.ts +1 -0
- package/dist/TopTaskLink/index.js +1 -0
- package/dist/UnorderedList/UnorderedList.d.ts +27 -0
- package/dist/UnorderedList/UnorderedList.js +13 -0
- package/dist/UnorderedList/UnorderedList.test.d.ts +1 -0
- package/dist/UnorderedList/UnorderedList.test.js +51 -0
- package/dist/UnorderedList/UnorderedListItem.d.ts +9 -0
- package/dist/UnorderedList/UnorderedListItem.js +9 -0
- package/dist/UnorderedList/UnorderedListItem.test.d.ts +1 -0
- package/dist/UnorderedList/UnorderedListItem.test.js +28 -0
- package/dist/UnorderedList/index.d.ts +3 -0
- package/dist/UnorderedList/index.js +1 -0
- package/dist/common/accessibility.d.ts +5 -0
- package/dist/common/accessibility.js +13 -0
- package/dist/common/formatFileSize.d.ts +10 -0
- package/dist/common/formatFileSize.js +17 -0
- package/dist/common/formatFileSize.test.d.ts +1 -0
- package/dist/common/formatFileSize.test.js +18 -0
- package/dist/common/formatFileType.d.ts +10 -0
- package/dist/common/formatFileType.js +34 -0
- package/dist/common/formatFileType.test.d.ts +1 -0
- package/dist/common/formatFileType.test.js +23 -0
- package/dist/common/shortSize.d.ts +12 -0
- package/dist/common/shortSize.js +15 -0
- package/dist/common/types.d.ts +11 -0
- package/dist/common/types.js +9 -0
- package/dist/common/useIsAfterBreakpoint.d.ts +3 -0
- package/dist/common/useIsAfterBreakpoint.js +24 -0
- package/dist/common/useKeyboardFocus.d.ts +23 -0
- package/dist/common/useKeyboardFocus.js +56 -0
- package/dist/common/useKeyboardFocus.test.d.ts +1 -0
- package/dist/common/useKeyboardFocus.test.js +79 -0
- package/dist/index.cjs.js +1051 -1041
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +213 -187
- package/dist/index.esm.js +1051 -1042
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +66 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +20 -21
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { createRef } from 'react';
|
|
5
|
+
import './matchMedia.mock'; // Must be imported before Header
|
|
6
|
+
import { Header } from './Header';
|
|
7
|
+
import '@testing-library/jest-dom';
|
|
8
|
+
describe('Header', () => {
|
|
9
|
+
it('renders', () => {
|
|
10
|
+
render(_jsx(Header, {}));
|
|
11
|
+
const component = screen.getByRole('banner');
|
|
12
|
+
expect(component).toBeInTheDocument();
|
|
13
|
+
expect(component).toBeVisible();
|
|
14
|
+
});
|
|
15
|
+
it('renders a design system BEM class name', () => {
|
|
16
|
+
render(_jsx(Header, {}));
|
|
17
|
+
const component = screen.getByRole('banner');
|
|
18
|
+
expect(component).toHaveClass('ams-header');
|
|
19
|
+
});
|
|
20
|
+
it('renders an additional class name', () => {
|
|
21
|
+
render(_jsx(Header, { className: "extra" }));
|
|
22
|
+
const component = screen.getByRole('banner');
|
|
23
|
+
expect(component).toHaveClass('extra');
|
|
24
|
+
expect(component).toHaveClass('ams-header');
|
|
25
|
+
});
|
|
26
|
+
it('supports ForwardRef in React', () => {
|
|
27
|
+
const ref = createRef();
|
|
28
|
+
render(_jsx(Header, { ref: ref }));
|
|
29
|
+
const component = screen.getByRole('banner');
|
|
30
|
+
expect(ref.current).toBe(component);
|
|
31
|
+
});
|
|
32
|
+
it('renders a logo link', () => {
|
|
33
|
+
render(_jsx(Header, {}));
|
|
34
|
+
const component = screen.getByRole('link');
|
|
35
|
+
expect(component).toHaveClass('ams-header__logo-link');
|
|
36
|
+
});
|
|
37
|
+
it('renders a different brand logo', () => {
|
|
38
|
+
const { container } = render(_jsx(Header, { logoBrand: "ggd-amsterdam" }));
|
|
39
|
+
const component = container.querySelector('.ams-logo__text-secondary');
|
|
40
|
+
expect(component).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
it('renders a custom logo link', () => {
|
|
43
|
+
render(_jsx(Header, { logoLink: "/home" }));
|
|
44
|
+
const logoLink = screen.getByRole('link');
|
|
45
|
+
expect(logoLink).toHaveAttribute('href', '/home');
|
|
46
|
+
});
|
|
47
|
+
it('renders a custom logo link title', () => {
|
|
48
|
+
render(_jsx(Header, { logoLinkTitle: "Go to homepage" }));
|
|
49
|
+
const logoLinkTitle = screen.getByRole('link', { name: 'Go to homepage' });
|
|
50
|
+
expect(logoLinkTitle).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
it('renders an application name', () => {
|
|
53
|
+
render(_jsx(Header, { brandName: "Application name" }));
|
|
54
|
+
const brandName = screen.getByText('Application name');
|
|
55
|
+
expect(brandName).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
it('renders the correct class for the responsive logo', () => {
|
|
58
|
+
const { container } = render(_jsx(Header, { brandName: "Application name" }));
|
|
59
|
+
const logoContainer = container.querySelector('.ams-header__logo-container');
|
|
60
|
+
expect(logoContainer).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
it('renders a nav section', () => {
|
|
63
|
+
render(_jsx(Header, { children: "Test" }));
|
|
64
|
+
const component = screen.getByRole('navigation');
|
|
65
|
+
expect(component).toHaveClass('ams-header__navigation');
|
|
66
|
+
});
|
|
67
|
+
it('renders a nav section with a custom label', () => {
|
|
68
|
+
render(_jsx(Header, { navigationLabel: "Custom Navigation", children: "Test" }));
|
|
69
|
+
const component = screen.getByRole('navigation', { name: 'Custom Navigation' });
|
|
70
|
+
expect(component).toBeInTheDocument();
|
|
71
|
+
});
|
|
72
|
+
it('renders a menu', () => {
|
|
73
|
+
render(_jsx(Header, { menuItems: _jsx(Header.MenuLink, { children: "Menu Item" }) }));
|
|
74
|
+
const component = screen.getByRole('list');
|
|
75
|
+
expect(component).toHaveClass('ams-header__menu');
|
|
76
|
+
});
|
|
77
|
+
it('renders menu items', () => {
|
|
78
|
+
render(_jsx(Header, { menuItems: [
|
|
79
|
+
_jsx(Header.MenuLink, { href: "/", children: "Menu Item 1" }, 1),
|
|
80
|
+
_jsx(Header.MenuLink, { href: "/", children: "Menu Item 2" }, 2),
|
|
81
|
+
] }));
|
|
82
|
+
const item1 = screen.getByRole('link', { name: 'Menu Item 1' });
|
|
83
|
+
const item2 = screen.getByRole('link', { name: 'Menu Item 2' });
|
|
84
|
+
expect(item1).toBeInTheDocument();
|
|
85
|
+
expect(item2).toBeInTheDocument();
|
|
86
|
+
});
|
|
87
|
+
it('renders a menu button', () => {
|
|
88
|
+
render(_jsx(Header, { children: "Test" }));
|
|
89
|
+
const component = screen.getByRole('button', { name: 'Menu' });
|
|
90
|
+
expect(component).toHaveClass('ams-header__mega-menu-button');
|
|
91
|
+
});
|
|
92
|
+
it('renders a menu button icon', () => {
|
|
93
|
+
const { container } = render(_jsx(Header, { children: "Test" }));
|
|
94
|
+
const component = container.querySelector('.ams-header__menu-icon');
|
|
95
|
+
expect(component).toBeInTheDocument();
|
|
96
|
+
});
|
|
97
|
+
it('renders a custom menu button text', () => {
|
|
98
|
+
render(_jsx(Header, { menuButtonText: "Custom button text", children: "Test" }));
|
|
99
|
+
const component = screen.getByRole('button', { name: 'Custom button text' });
|
|
100
|
+
expect(component).toBeInTheDocument();
|
|
101
|
+
});
|
|
102
|
+
it('renders the correct class when noMenuButtonOnWideWindow is true', () => {
|
|
103
|
+
render(_jsx(Header, { noMenuButtonOnWideWindow: true, children: "Test" }));
|
|
104
|
+
const component = screen.getByRole('listitem');
|
|
105
|
+
expect(component).toHaveClass('ams-header__mega-menu-button-item--hide-on-wide-window');
|
|
106
|
+
});
|
|
107
|
+
it('opens and closes the mega menu', async () => {
|
|
108
|
+
const user = userEvent.setup();
|
|
109
|
+
const { container } = render(_jsx(Header, { children: "Test" }));
|
|
110
|
+
const closedMegaMenu = container.querySelector('.ams-header__mega-menu--closed');
|
|
111
|
+
expect(closedMegaMenu).toBeInTheDocument();
|
|
112
|
+
const menuButton = screen.getByRole('button', { name: 'Menu' });
|
|
113
|
+
await user.click(menuButton);
|
|
114
|
+
const openMegaMenu = container.querySelector('.ams-header__mega-menu');
|
|
115
|
+
expect(openMegaMenu).toBeInTheDocument();
|
|
116
|
+
expect(openMegaMenu).not.toHaveClass('ams-header__mega-menu--closed');
|
|
117
|
+
});
|
|
118
|
+
it.skip('it closes the mega menu when it is open and the screen width passes the breakpoint', () => {
|
|
119
|
+
// TODO: Add this test
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { Grid } from '../Grid';
|
|
5
|
+
export const HeaderGridCellNarrowWindowOnly = forwardRef(({ children, className, ...restProps }, ref) => (_jsx(Grid.Cell, { ...restProps, className: clsx('ams-header__grid-cell-narrow-window-only', className), ref: ref, children: children })));
|
|
6
|
+
HeaderGridCellNarrowWindowOnly.displayName = 'Header.GridCellNarrowWindowOnly';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { HeaderGridCellNarrowWindowOnly } from './HeaderGridCellNarrowWindowOnly';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Header narrow screen only grid cell', () => {
|
|
7
|
+
it('renders', () => {
|
|
8
|
+
const { container } = render(_jsx(HeaderGridCellNarrowWindowOnly, {}));
|
|
9
|
+
const component = container.querySelector(':only-child');
|
|
10
|
+
expect(component).toBeInTheDocument();
|
|
11
|
+
expect(component).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
it('renders a Grid.Cell', () => {
|
|
14
|
+
const { container } = render(_jsx(HeaderGridCellNarrowWindowOnly, {}));
|
|
15
|
+
const component = container.querySelector(':only-child');
|
|
16
|
+
expect(component).toHaveClass('ams-grid__cell');
|
|
17
|
+
});
|
|
18
|
+
it('renders a design system BEM class name', () => {
|
|
19
|
+
const { container } = render(_jsx(HeaderGridCellNarrowWindowOnly, {}));
|
|
20
|
+
const component = container.querySelector(':only-child');
|
|
21
|
+
expect(component).toHaveClass('ams-header__grid-cell-narrow-window-only');
|
|
22
|
+
});
|
|
23
|
+
it('renders an additional class name', () => {
|
|
24
|
+
const { container } = render(_jsx(HeaderGridCellNarrowWindowOnly, { className: "extra" }));
|
|
25
|
+
const component = container.querySelector(':only-child');
|
|
26
|
+
expect(component).toHaveClass('ams-header__grid-cell-narrow-window-only extra');
|
|
27
|
+
});
|
|
28
|
+
it('supports ForwardRef in React', () => {
|
|
29
|
+
const ref = createRef();
|
|
30
|
+
const { container } = render(_jsx(HeaderGridCellNarrowWindowOnly, { ref: ref }));
|
|
31
|
+
const component = container.querySelector(':only-child');
|
|
32
|
+
expect(ref.current).toBe(component);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const HeaderMenuIcon = (props) => (_jsxs("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("line", { className: "ams-header__menu-icon-top", x1: "0", x2: "100%", y1: "50%", y2: "50%" }), _jsx("line", { className: "ams-header__menu-icon-middle", x1: "0", x2: "100%", y1: "50%", y2: "50%" }), _jsx("line", { className: "ams-header__menu-icon-bottom", x1: "0", x2: "100%", y1: "50%", y2: "50%" })] }));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, PropsWithChildren } from 'react';
|
|
2
|
+
export type HeaderMenuLinkProps = {
|
|
3
|
+
fixed?: boolean;
|
|
4
|
+
} & PropsWithChildren<AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
5
|
+
export declare const HeaderMenuLink: import("react").ForwardRefExoticComponent<{
|
|
6
|
+
fixed?: boolean;
|
|
7
|
+
} & AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
8
|
+
children?: import("react").ReactNode | undefined;
|
|
9
|
+
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
export const HeaderMenuLink = forwardRef(({ children, className, fixed, ...restProps }, ref) => (_jsx("li", { className: clsx('ams-header__menu-item', fixed && 'ams-header__menu-item--fixed'), children: _jsx("a", { ...restProps, className: clsx('ams-header__menu-link', className), ref: ref, children: children }) })));
|
|
5
|
+
HeaderMenuLink.displayName = 'Header.MenuLink';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { HeaderMenuLink } from './HeaderMenuLink';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Header menu link', () => {
|
|
7
|
+
it('renders', () => {
|
|
8
|
+
render(_jsx(HeaderMenuLink, { href: "/" }));
|
|
9
|
+
const component = screen.getByRole('listitem');
|
|
10
|
+
expect(component).toBeInTheDocument();
|
|
11
|
+
expect(component).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
it('renders a design system BEM class name', () => {
|
|
14
|
+
render(_jsx(HeaderMenuLink, { href: "/" }));
|
|
15
|
+
const item = screen.getByRole('listitem');
|
|
16
|
+
expect(item).toHaveClass('ams-header__menu-item');
|
|
17
|
+
const link = screen.getByRole('link');
|
|
18
|
+
expect(link).toHaveClass('ams-header__menu-link');
|
|
19
|
+
});
|
|
20
|
+
it('renders an additional class name', () => {
|
|
21
|
+
render(_jsx(HeaderMenuLink, { className: "extra", href: "/" }));
|
|
22
|
+
const component = screen.getByRole('link');
|
|
23
|
+
expect(component).toHaveClass('ams-header__menu-link extra');
|
|
24
|
+
});
|
|
25
|
+
it('renders the href attribute', () => {
|
|
26
|
+
render(_jsx(HeaderMenuLink, { href: "/" }));
|
|
27
|
+
const component = screen.getByRole('link');
|
|
28
|
+
expect(component).toHaveAttribute('href', '/');
|
|
29
|
+
});
|
|
30
|
+
it('renders the ‘fixed’ prop classname', () => {
|
|
31
|
+
render(_jsx(HeaderMenuLink, { fixed: true, href: "/" }));
|
|
32
|
+
const component = screen.getByRole('listitem');
|
|
33
|
+
expect(component).toHaveClass('ams-header__menu-item--fixed');
|
|
34
|
+
});
|
|
35
|
+
it('supports ForwardRef in React', () => {
|
|
36
|
+
const ref = createRef();
|
|
37
|
+
render(_jsx(HeaderMenuLink, { href: "/", ref: ref }));
|
|
38
|
+
const component = screen.getByRole('link');
|
|
39
|
+
expect(ref.current).toBe(component);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Header } from './Header';
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Sourced from https://jestjs.io/docs/29.4/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
|
3
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
4
|
+
value: jest.fn().mockImplementation((query) => ({
|
|
5
|
+
addEventListener: jest.fn(),
|
|
6
|
+
addListener: jest.fn(), // deprecated
|
|
7
|
+
dispatchEvent: jest.fn(),
|
|
8
|
+
matches: false,
|
|
9
|
+
media: query,
|
|
10
|
+
onchange: null,
|
|
11
|
+
removeEventListener: jest.fn(),
|
|
12
|
+
removeListener: jest.fn(), // deprecated
|
|
13
|
+
})),
|
|
14
|
+
writable: true,
|
|
15
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
7
|
+
export type HeadingProps = {
|
|
8
|
+
/** Changes the text colour for readability on a dark background. */
|
|
9
|
+
color?: 'inverse';
|
|
10
|
+
/** The hierarchical level within the document. */
|
|
11
|
+
level: 1 | 2 | 3 | 4;
|
|
12
|
+
/** Uses larger or smaller text without changing its position in the heading hierarchy. */
|
|
13
|
+
size?: 'level-1' | 'level-2' | 'level-3' | 'level-4' | 'level-5' | 'level-6';
|
|
14
|
+
} & PropsWithChildren<HTMLAttributes<HTMLHeadingElement>>;
|
|
15
|
+
export declare const Heading: import("react").ForwardRefExoticComponent<{
|
|
16
|
+
/** Changes the text colour for readability on a dark background. */
|
|
17
|
+
color?: "inverse";
|
|
18
|
+
/** The hierarchical level within the document. */
|
|
19
|
+
level: 1 | 2 | 3 | 4;
|
|
20
|
+
/** Uses larger or smaller text without changing its position in the heading hierarchy. */
|
|
21
|
+
size?: "level-1" | "level-2" | "level-3" | "level-4" | "level-5" | "level-6";
|
|
22
|
+
} & HTMLAttributes<HTMLHeadingElement> & {
|
|
23
|
+
children?: import("react").ReactNode | undefined;
|
|
24
|
+
} & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
5
|
+
* Copyright Gemeente Amsterdam
|
|
6
|
+
*/
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
import { getHeadingTag } from './getHeadingTag';
|
|
10
|
+
export const Heading = forwardRef(({ children, className, color, level, size, ...restProps }, ref) => {
|
|
11
|
+
const Tag = getHeadingTag(level);
|
|
12
|
+
const visualLevel = size ? size.slice(-1) : level;
|
|
13
|
+
return (_jsx(Tag, { className: clsx('ams-heading', `ams-heading--${visualLevel}`, color && `ams-heading--${color}`, className), ref: ref, ...restProps, children: children }));
|
|
14
|
+
});
|
|
15
|
+
Heading.displayName = 'Heading';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { Heading } from './Heading';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Heading', () => {
|
|
7
|
+
it('renders an element with role heading', () => {
|
|
8
|
+
render(_jsx(Heading, { level: 1, children: "Breaking news" }));
|
|
9
|
+
const heading = screen.getByRole('heading', {
|
|
10
|
+
name: 'Breaking news',
|
|
11
|
+
});
|
|
12
|
+
expect(heading).toBeInTheDocument();
|
|
13
|
+
expect(heading).toBeVisible();
|
|
14
|
+
});
|
|
15
|
+
it('renders the other allowed levels correctly', () => {
|
|
16
|
+
render(_jsxs(_Fragment, { children: [_jsx(Heading, { level: 2, children: "Heading 2" }), _jsx(Heading, { level: 3, children: "Heading 3" }), _jsx(Heading, { level: 4, children: "Heading 4" })] }));
|
|
17
|
+
const h2 = screen.getByRole('heading', { level: 2, name: 'Heading 2' });
|
|
18
|
+
const h3 = screen.getByRole('heading', { level: 3, name: 'Heading 3' });
|
|
19
|
+
const h4 = screen.getByRole('heading', { level: 4, name: 'Heading 4' });
|
|
20
|
+
expect(h2).toBeInTheDocument();
|
|
21
|
+
expect(h3).toBeInTheDocument();
|
|
22
|
+
expect(h4).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
it('renders the correct style level class', () => {
|
|
25
|
+
render(_jsxs(_Fragment, { children: [_jsx(Heading, { level: 1, size: "level-1", children: "Size level 1" }), _jsx(Heading, { level: 1, size: "level-2", children: "Size level 2" }), _jsx(Heading, { level: 1, size: "level-3", children: "Size level 3" }), _jsx(Heading, { level: 1, size: "level-4", children: "Size level 4" }), _jsx(Heading, { level: 1, size: "level-5", children: "Size level 5" }), _jsx(Heading, { level: 1, size: "level-6", children: "Size level 6" })] }));
|
|
26
|
+
const sizeLevel1 = screen.getByRole('heading', { level: 1, name: 'Size level 1' });
|
|
27
|
+
const sizeLevel2 = screen.getByRole('heading', { level: 1, name: 'Size level 2' });
|
|
28
|
+
const sizeLevel3 = screen.getByRole('heading', { level: 1, name: 'Size level 3' });
|
|
29
|
+
const sizeLevel4 = screen.getByRole('heading', { level: 1, name: 'Size level 4' });
|
|
30
|
+
const sizeLevel5 = screen.getByRole('heading', { level: 1, name: 'Size level 5' });
|
|
31
|
+
const sizeLevel6 = screen.getByRole('heading', { level: 1, name: 'Size level 6' });
|
|
32
|
+
expect(sizeLevel1).toHaveClass('ams-heading--1');
|
|
33
|
+
expect(sizeLevel2).toHaveClass('ams-heading--2');
|
|
34
|
+
expect(sizeLevel3).toHaveClass('ams-heading--3');
|
|
35
|
+
expect(sizeLevel4).toHaveClass('ams-heading--4');
|
|
36
|
+
expect(sizeLevel5).toHaveClass('ams-heading--5');
|
|
37
|
+
expect(sizeLevel6).toHaveClass('ams-heading--6');
|
|
38
|
+
});
|
|
39
|
+
it('renders the class name for inverse color', () => {
|
|
40
|
+
render(_jsx(Heading, { color: "inverse", level: 1, children: "Heading" }));
|
|
41
|
+
const heading = screen.getByRole('heading', { name: 'Heading' });
|
|
42
|
+
expect(heading).toHaveClass('ams-heading--inverse');
|
|
43
|
+
});
|
|
44
|
+
it('renders inline markup', () => {
|
|
45
|
+
render(_jsxs(Heading, { level: 1, children: [_jsx("strong", { children: "Breaking" }), " news"] }));
|
|
46
|
+
const heading = screen.getByRole('heading', { name: 'Breaking news' });
|
|
47
|
+
const inlineMarkup = heading.querySelector('strong');
|
|
48
|
+
expect(inlineMarkup).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
it('renders an additional class name', () => {
|
|
51
|
+
const { container } = render(_jsx(Heading, { className: "large", level: 1 }));
|
|
52
|
+
const heading = container.querySelector(':only-child');
|
|
53
|
+
expect(heading).toHaveClass('large');
|
|
54
|
+
expect(heading).toHaveClass('ams-heading');
|
|
55
|
+
});
|
|
56
|
+
it('is able to pass a React ref', () => {
|
|
57
|
+
const ref = createRef();
|
|
58
|
+
const { container } = render(_jsx(Heading, { level: 1, ref: ref }));
|
|
59
|
+
const heading = container.querySelector(':only-child');
|
|
60
|
+
expect(ref.current).toBe(heading);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Heading } from './Heading';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
type HintAndOptionalProps = {
|
|
7
|
+
/** Show a custom hint text. */
|
|
8
|
+
hint?: string;
|
|
9
|
+
/** Appends the text '(niet verplicht)' to the label or legend if no hint is provided. Use when the associated inputs are optional. */
|
|
10
|
+
optional?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type HintProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & HintAndOptionalProps;
|
|
13
|
+
export declare const Hint: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
14
|
+
children?: import("react").ReactNode | undefined;
|
|
15
|
+
} & HintAndOptionalProps & import("react").RefAttributes<HTMLElement>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { forwardRef } from 'react';
|
|
8
|
+
const getHintText = ({ hint, optional }) => {
|
|
9
|
+
if (hint) {
|
|
10
|
+
return hint;
|
|
11
|
+
}
|
|
12
|
+
else if (optional) {
|
|
13
|
+
return 'niet verplicht';
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
export const Hint = forwardRef(({ className, hint, optional, ...restProps }, ref) => {
|
|
18
|
+
const hintText = getHintText({ hint, optional });
|
|
19
|
+
return (hintText && (_jsxs("span", { ...restProps, className: clsx('ams-hint', className), ref: ref, children: ["(", hintText, ")"] })));
|
|
20
|
+
});
|
|
21
|
+
Hint.displayName = 'Hint';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { Hint } from '.';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Hint', () => {
|
|
7
|
+
it('renders', () => {
|
|
8
|
+
const { container } = render(_jsx(Hint, { hint: "hint" }));
|
|
9
|
+
const component = container.querySelector(':only-child');
|
|
10
|
+
expect(component).toBeInTheDocument();
|
|
11
|
+
expect(component).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
it('renders a design system BEM class name', () => {
|
|
14
|
+
const { container } = render(_jsx(Hint, { optional: true }));
|
|
15
|
+
const component = container.querySelector(':only-child');
|
|
16
|
+
expect(component).toHaveClass('ams-hint');
|
|
17
|
+
});
|
|
18
|
+
it('renders an additional class name', () => {
|
|
19
|
+
const { container } = render(_jsx(Hint, { className: "extra", optional: true }));
|
|
20
|
+
const component = container.querySelector(':only-child');
|
|
21
|
+
expect(component).toHaveClass('ams-hint extra');
|
|
22
|
+
});
|
|
23
|
+
it('supports ForwardRef in React', () => {
|
|
24
|
+
const ref = createRef();
|
|
25
|
+
const { container } = render(_jsx(Hint, { ref: ref }));
|
|
26
|
+
const component = container.querySelector(':only-child');
|
|
27
|
+
expect(ref.current).toBe(component);
|
|
28
|
+
});
|
|
29
|
+
it('renders the provided hint text', () => {
|
|
30
|
+
const { container } = render(_jsx(Hint, { hint: "hint text" }));
|
|
31
|
+
const component = container.querySelector(':only-child');
|
|
32
|
+
expect(component).toHaveTextContent('(hint text)');
|
|
33
|
+
});
|
|
34
|
+
it('renders the default hint text', () => {
|
|
35
|
+
const { container } = render(_jsx(Hint, { optional: true }));
|
|
36
|
+
const component = container.querySelector(':only-child');
|
|
37
|
+
expect(component).toHaveTextContent('(niet verplicht)');
|
|
38
|
+
});
|
|
39
|
+
it('renders the provided hint text when `optional` is set to `false`', () => {
|
|
40
|
+
const { container } = render(_jsx(Hint, { hint: "not required", optional: true }));
|
|
41
|
+
const component = container.querySelector(':only-child');
|
|
42
|
+
expect(component).toHaveTextContent('(not required)');
|
|
43
|
+
});
|
|
44
|
+
it('renders the provided hint text "required" while also being marked as not optional', () => {
|
|
45
|
+
const { container } = render(_jsx(Hint, { hint: "required", optional: false }));
|
|
46
|
+
const component = container.querySelector(':only-child');
|
|
47
|
+
expect(component).toHaveTextContent('(required)');
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Hint } from './Hint';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2021 Gemeente Utrecht
|
|
4
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
5
|
+
* Copyright Gemeente Amsterdam
|
|
6
|
+
*/
|
|
7
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
8
|
+
export declare const iconSizes: string[];
|
|
9
|
+
type IconSize = (typeof iconSizes)[number];
|
|
10
|
+
export type IconProps = {
|
|
11
|
+
/** Changes the icon colour for readability on a dark background. */
|
|
12
|
+
color?: 'inverse';
|
|
13
|
+
/** The size of the icon. Choose the size of the corresponding body text or heading. */
|
|
14
|
+
size?: IconSize;
|
|
15
|
+
/** Whether the icon container should be made square. */
|
|
16
|
+
square?: boolean;
|
|
17
|
+
/** The component rendering the icon’s markup. */
|
|
18
|
+
svg: Function | ReactNode;
|
|
19
|
+
} & HTMLAttributes<HTMLSpanElement>;
|
|
20
|
+
export declare const Icon: import("react").ForwardRefExoticComponent<{
|
|
21
|
+
/** Changes the icon colour for readability on a dark background. */
|
|
22
|
+
color?: "inverse";
|
|
23
|
+
/** The size of the icon. Choose the size of the corresponding body text or heading. */
|
|
24
|
+
size?: IconSize;
|
|
25
|
+
/** Whether the icon container should be made square. */
|
|
26
|
+
square?: boolean;
|
|
27
|
+
/** The component rendering the icon’s markup. */
|
|
28
|
+
svg: Function | ReactNode;
|
|
29
|
+
} & HTMLAttributes<HTMLSpanElement> & import("react").RefAttributes<HTMLElement>>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright (c) 2021 Gemeente Utrecht
|
|
5
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
6
|
+
* Copyright Gemeente Amsterdam
|
|
7
|
+
*/
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import { forwardRef } from 'react';
|
|
10
|
+
export const iconSizes = ['small', 'large', 'heading-3', 'heading-4', 'heading-5', 'heading-6'];
|
|
11
|
+
export const Icon = forwardRef(({ className, color, size, square, svg, ...restProps }, ref) => (_jsx("span", { className: clsx('ams-icon', color && `ams-icon--${color}`, size && `ams-icon--${size}`, square && 'ams-icon--square', className), ref: ref, ...restProps, children: typeof svg === 'function' ? svg() : svg })));
|
|
12
|
+
Icon.displayName = 'Icon';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AlertIcon } from '@amsterdam/design-system-react-icons';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import { createRef } from 'react';
|
|
5
|
+
import { Icon, iconSizes } from './Icon';
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
|
+
describe('Icon', () => {
|
|
8
|
+
it('renders a span element', () => {
|
|
9
|
+
const { container } = render(_jsx(Icon, { svg: AlertIcon }));
|
|
10
|
+
const icon = container.querySelector('span:only-child');
|
|
11
|
+
expect(icon).toBeInTheDocument();
|
|
12
|
+
});
|
|
13
|
+
it('renders a design system BEM class name', () => {
|
|
14
|
+
const { container } = render(_jsx(Icon, { svg: AlertIcon }));
|
|
15
|
+
const icon = container.querySelector(':only-child');
|
|
16
|
+
expect(icon).toHaveClass('ams-icon');
|
|
17
|
+
});
|
|
18
|
+
it('renders an svg child', () => {
|
|
19
|
+
const { container } = render(_jsx(Icon, { svg: AlertIcon }));
|
|
20
|
+
const svg = container.querySelector(':only-child svg');
|
|
21
|
+
expect(svg).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
iconSizes.forEach((size) => {
|
|
24
|
+
it(`renders the correct class name for a ‘${size}’ icon`, () => {
|
|
25
|
+
const { container } = render(_jsx(Icon, { size: size, svg: AlertIcon }));
|
|
26
|
+
const icon = container.querySelector(':only-child');
|
|
27
|
+
expect(icon).toHaveClass(`ams-icon--${size}`);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
it('renders the right square class', () => {
|
|
31
|
+
const { container } = render(_jsx(Icon, { square: true, svg: AlertIcon }));
|
|
32
|
+
const icon = container.querySelector('span:only-child');
|
|
33
|
+
expect(icon).toHaveClass('ams-icon--square');
|
|
34
|
+
});
|
|
35
|
+
it('renders the class name for inverse color', () => {
|
|
36
|
+
const { container } = render(_jsx(Icon, { color: "inverse", svg: AlertIcon }));
|
|
37
|
+
const icon = container.querySelector('span:only-child');
|
|
38
|
+
expect(icon).toHaveClass('ams-icon--inverse');
|
|
39
|
+
});
|
|
40
|
+
it('renders an additional class name', () => {
|
|
41
|
+
const { container } = render(_jsx(Icon, { className: "large", svg: AlertIcon }));
|
|
42
|
+
const icon = container.querySelector(':only-child');
|
|
43
|
+
expect(icon).toHaveClass('large');
|
|
44
|
+
expect(icon).toHaveClass('ams-icon');
|
|
45
|
+
});
|
|
46
|
+
it('supports ForwardRef in React', () => {
|
|
47
|
+
const ref = createRef();
|
|
48
|
+
const { container } = render(_jsx(Icon, { ref: ref, svg: AlertIcon }));
|
|
49
|
+
const icon = container.querySelector(':only-child');
|
|
50
|
+
expect(ref.current).toBe(icon);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Icon } from './Icon';
|