@amsterdam/design-system-react 0.14.1 → 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 +1043 -1038
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +213 -189
- package/dist/index.esm.js +1043 -1039
- 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,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { forwardRef, useCallback, useContext, useMemo } from 'react';
|
|
8
|
+
import { ImageSliderContext } from './ImageSliderContext';
|
|
9
|
+
import { generateAspectRatioClass } from '../Image/generateAspectRatioClass';
|
|
10
|
+
export const ImageSliderThumbnails = forwardRef(({ className, imageLabel, thumbnails, ...restProps }, ref) => {
|
|
11
|
+
const { currentSlideId, goToNextSlide, goToPreviousSlide, goToSlideId } = useContext(ImageSliderContext);
|
|
12
|
+
const handleKeyDown = useCallback((event) => {
|
|
13
|
+
const element = event.currentTarget.children[currentSlideId];
|
|
14
|
+
if (event.key === 'ArrowRight') {
|
|
15
|
+
const nextElement = element?.nextElementSibling;
|
|
16
|
+
if (nextElement) {
|
|
17
|
+
nextElement.focus();
|
|
18
|
+
goToNextSlide();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (event.key === 'ArrowLeft') {
|
|
22
|
+
const previousElement = element?.previousElementSibling;
|
|
23
|
+
if (previousElement) {
|
|
24
|
+
previousElement.focus();
|
|
25
|
+
goToPreviousSlide();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, [currentSlideId, goToNextSlide, goToPreviousSlide]);
|
|
29
|
+
const renderThumbnails = useMemo(() => thumbnails.map(({ alt, aspectRatio, src }, index) => (_jsx("button", { "aria-label": `${imageLabel} ${index + 1}: ${alt}`, "aria-posinset": index + 1, "aria-selected": currentSlideId === index ? 'true' : 'false', "aria-setsize": thumbnails.length, className: clsx('ams-image-slider__thumbnail', currentSlideId === index && 'ams-image-slider__thumbnail--in-view', generateAspectRatioClass(aspectRatio)), onClick: () => goToSlideId(index), role: "tab", style: { backgroundImage: `url(${src})` }, tabIndex: currentSlideId === index ? 0 : -1 }, index))), [currentSlideId, goToSlideId, imageLabel, thumbnails]);
|
|
30
|
+
return (_jsx("nav", { ...restProps, className: clsx('ams-image-slider__thumbnails', className), onKeyDown: handleKeyDown, ref: ref, role: "tablist", children: renderThumbnails }));
|
|
31
|
+
});
|
|
32
|
+
ImageSliderThumbnails.displayName = 'ImageSlider.Thumbnails';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { ImageSliderThumbnails } from './ImageSliderThumbnails';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Image Slider Thumbnails', () => {
|
|
7
|
+
const thumbnails = [
|
|
8
|
+
{
|
|
9
|
+
alt: 'This is gallery image 1',
|
|
10
|
+
src: 'https://picsum.photos/id/122/1280/720',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
alt: 'This is gallery image 2',
|
|
14
|
+
src: 'https://picsum.photos/id/101/1280/720',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
alt: 'This is gallery image 3',
|
|
18
|
+
src: 'https://picsum.photos/id/153/1280/720',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
it('renders', () => {
|
|
22
|
+
const { container } = render(_jsx(ImageSliderThumbnails, { thumbnails: thumbnails }));
|
|
23
|
+
const component = container.querySelector(':only-child');
|
|
24
|
+
expect(component).toBeInTheDocument();
|
|
25
|
+
expect(component).toBeVisible();
|
|
26
|
+
});
|
|
27
|
+
it('renders thumbnails', () => {
|
|
28
|
+
const { container } = render(_jsx(ImageSliderThumbnails, { thumbnails: thumbnails }));
|
|
29
|
+
const thumbs = container.querySelectorAll('.ams-image-slider__thumbnail');
|
|
30
|
+
expect(thumbs).toHaveLength(thumbnails.length);
|
|
31
|
+
});
|
|
32
|
+
it('renders a design system BEM class name', () => {
|
|
33
|
+
const { container } = render(_jsx(ImageSliderThumbnails, { thumbnails: thumbnails }));
|
|
34
|
+
const component = container.querySelector(':only-child');
|
|
35
|
+
expect(component).toHaveClass('ams-image-slider__thumbnails');
|
|
36
|
+
});
|
|
37
|
+
it('renders an additional class name', () => {
|
|
38
|
+
const { container } = render(_jsx(ImageSliderThumbnails, { className: "extra", thumbnails: thumbnails }));
|
|
39
|
+
const component = container.querySelector(':only-child');
|
|
40
|
+
expect(component).toHaveClass('ams-image-slider__thumbnails extra');
|
|
41
|
+
});
|
|
42
|
+
it('supports ForwardRef in React', () => {
|
|
43
|
+
const ref = createRef();
|
|
44
|
+
const { container } = render(_jsx(ImageSliderThumbnails, { ref: ref, thumbnails: thumbnails }));
|
|
45
|
+
const component = container.querySelector(':only-child');
|
|
46
|
+
expect(ref.current).toBe(component);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ImageSlider } from './ImageSlider';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes } from 'react';
|
|
6
|
+
import type { HeadingProps } from '../Heading';
|
|
7
|
+
export type ErrorLink = {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
export type InvalidFormAlertProps = {
|
|
12
|
+
/**
|
|
13
|
+
* The text following the error count.
|
|
14
|
+
* This is used to show the error count in the document title.
|
|
15
|
+
* @default { plural: 'invoerfouten', singular: 'invoerfout' }
|
|
16
|
+
*/
|
|
17
|
+
errorCountLabel?: {
|
|
18
|
+
plural: string;
|
|
19
|
+
singular: string;
|
|
20
|
+
};
|
|
21
|
+
/** The list of error messages to display. */
|
|
22
|
+
errors: ErrorLink[];
|
|
23
|
+
/**
|
|
24
|
+
* Whether the component receives focus on first render
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
focusOnRender?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The text for the Heading.
|
|
30
|
+
* @default Verbeter de fouten voor u verder gaat
|
|
31
|
+
*/
|
|
32
|
+
heading?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The hierarchical level of the Invalid Form Alert’s Heading within the document.
|
|
35
|
+
* There is no default value; determine the correct level for each instance.
|
|
36
|
+
* Note: this intentionally does not change the font size.
|
|
37
|
+
**/
|
|
38
|
+
headingLevel: HeadingProps['level'];
|
|
39
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
40
|
+
export declare const InvalidFormAlert: import("react").ForwardRefExoticComponent<{
|
|
41
|
+
/**
|
|
42
|
+
* The text following the error count.
|
|
43
|
+
* This is used to show the error count in the document title.
|
|
44
|
+
* @default { plural: 'invoerfouten', singular: 'invoerfout' }
|
|
45
|
+
*/
|
|
46
|
+
errorCountLabel?: {
|
|
47
|
+
plural: string;
|
|
48
|
+
singular: string;
|
|
49
|
+
};
|
|
50
|
+
/** The list of error messages to display. */
|
|
51
|
+
errors: ErrorLink[];
|
|
52
|
+
/**
|
|
53
|
+
* Whether the component receives focus on first render
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
focusOnRender?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The text for the Heading.
|
|
59
|
+
* @default Verbeter de fouten voor u verder gaat
|
|
60
|
+
*/
|
|
61
|
+
heading?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The hierarchical level of the Invalid Form Alert’s Heading within the document.
|
|
64
|
+
* There is no default value; determine the correct level for each instance.
|
|
65
|
+
* Note: this intentionally does not change the font size.
|
|
66
|
+
**/
|
|
67
|
+
headingLevel: HeadingProps["level"];
|
|
68
|
+
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { forwardRef, useState } from 'react';
|
|
7
|
+
import { InvalidFormAlertWithErrors } from './InvalidFormAlertWithErrors';
|
|
8
|
+
import { useAddErrorCountToDocumentTitle } from './useAddErrorCountToDocumentTitle';
|
|
9
|
+
export const InvalidFormAlert = forwardRef(({ errorCountLabel, errors, ...restProps }, ref) => {
|
|
10
|
+
// An Invalid Form Alert without errors only resets the document title.
|
|
11
|
+
// With errors, it renders the InvalidFormAlertWithErrors component.
|
|
12
|
+
useAddErrorCountToDocumentTitle(errors, errorCountLabel);
|
|
13
|
+
// Focus should only be set on first render of InvalidFormAlertWithErrors.
|
|
14
|
+
// Subsequent renders should not set focus.
|
|
15
|
+
const [hasFocusedOnce, setHasFocusedOnce] = useState(false);
|
|
16
|
+
if (errors.length === 0)
|
|
17
|
+
return undefined;
|
|
18
|
+
return (_jsx(InvalidFormAlertWithErrors, { ...restProps, errors: errors, hasFocusedOnce: hasFocusedOnce, ref: ref, setHasFocusedOnce: setHasFocusedOnce }));
|
|
19
|
+
});
|
|
20
|
+
InvalidFormAlert.displayName = 'InvalidFormAlert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { InvalidFormAlert } from './InvalidFormAlert';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Invalid Form Alert', () => {
|
|
7
|
+
const testErrors = [
|
|
8
|
+
{ id: '#', label: 'Vul een geldige datum in (bijvoorbeeld 6 januari 2030).' },
|
|
9
|
+
{ id: '#', label: 'De geldigheidsdatum van uw paspoort moet in de toekomst liggen.' },
|
|
10
|
+
];
|
|
11
|
+
it('renders', () => {
|
|
12
|
+
const { container } = render(_jsx(InvalidFormAlert, { errors: testErrors, headingLevel: 2 }));
|
|
13
|
+
const component = container.querySelector(':only-child');
|
|
14
|
+
expect(component).toBeInTheDocument();
|
|
15
|
+
expect(component).toBeVisible();
|
|
16
|
+
});
|
|
17
|
+
it('does not render when there are no errors', () => {
|
|
18
|
+
const { container } = render(_jsx(InvalidFormAlert, { errors: [], headingLevel: 2 }));
|
|
19
|
+
const component = container.querySelector(':only-child');
|
|
20
|
+
expect(component).not.toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
it('renders a design system BEM class name', () => {
|
|
23
|
+
const { container } = render(_jsx(InvalidFormAlert, { errors: testErrors, headingLevel: 2 }));
|
|
24
|
+
const component = container.querySelector(':only-child');
|
|
25
|
+
expect(component).toHaveClass('ams-invalid-form-alert');
|
|
26
|
+
});
|
|
27
|
+
it('renders an additional class name', () => {
|
|
28
|
+
const { container } = render(_jsx(InvalidFormAlert, { className: "extra", errors: testErrors, headingLevel: 2 }));
|
|
29
|
+
const component = container.querySelector(':only-child');
|
|
30
|
+
expect(component).toHaveClass('ams-invalid-form-alert extra');
|
|
31
|
+
});
|
|
32
|
+
it('renders a list item and link for every error', () => {
|
|
33
|
+
render(_jsx(InvalidFormAlert, { errors: testErrors, headingLevel: 2 }));
|
|
34
|
+
const listItems = screen.getAllByRole('listitem');
|
|
35
|
+
const links = screen.getAllByRole('link');
|
|
36
|
+
expect(listItems.length).toBe(2);
|
|
37
|
+
expect(links.length).toBe(2);
|
|
38
|
+
});
|
|
39
|
+
it('renders a link with the correct name and href for every error', () => {
|
|
40
|
+
render(_jsx(InvalidFormAlert, { errors: testErrors, headingLevel: 2 }));
|
|
41
|
+
const link1 = screen.getByRole('link', { name: testErrors[0].label });
|
|
42
|
+
const link2 = screen.getByRole('link', { name: testErrors[1].label });
|
|
43
|
+
expect(link1).toHaveAttribute('href', testErrors[0].id);
|
|
44
|
+
expect(link2).toHaveAttribute('href', testErrors[1].id);
|
|
45
|
+
});
|
|
46
|
+
it('renders a custom heading', () => {
|
|
47
|
+
render(_jsx(InvalidFormAlert, { errors: testErrors, heading: "Test heading", headingLevel: 2 }));
|
|
48
|
+
const component = screen.getByRole('heading', { name: 'Test heading' });
|
|
49
|
+
expect(component).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
it('renders the correct heading level', () => {
|
|
52
|
+
render(_jsx(InvalidFormAlert, { errors: testErrors, headingLevel: 4 }));
|
|
53
|
+
const component = screen.getByRole('heading', { level: 4 });
|
|
54
|
+
expect(component).toBeInTheDocument();
|
|
55
|
+
});
|
|
56
|
+
const docTitle = 'Document title';
|
|
57
|
+
const singleTestError = [{ id: '#', label: 'De geldigheidsdatum van uw paspoort moet in de toekomst liggen.' }];
|
|
58
|
+
describe('prepends the document title with the error count', () => {
|
|
59
|
+
it('single error', async () => {
|
|
60
|
+
document.title = docTitle;
|
|
61
|
+
render(_jsx(InvalidFormAlert, { errors: singleTestError, headingLevel: 2 }));
|
|
62
|
+
await waitFor(() => expect(document.title).toBe(`(1 invoerfout) ${docTitle}`));
|
|
63
|
+
});
|
|
64
|
+
it('multiple errors', async () => {
|
|
65
|
+
document.title = docTitle;
|
|
66
|
+
render(_jsx(InvalidFormAlert, { errors: testErrors, headingLevel: 2 }));
|
|
67
|
+
await waitFor(() => expect(document.title).toBe(`(2 invoerfouten) ${docTitle}`));
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe('renders a custom document title label', () => {
|
|
71
|
+
const label = { plural: 'errors', singular: 'error' };
|
|
72
|
+
it('no errors', async () => {
|
|
73
|
+
document.title = docTitle;
|
|
74
|
+
render(_jsx(InvalidFormAlert, { errors: [], headingLevel: 2 }));
|
|
75
|
+
await waitFor(() => expect(document.title).toBe(docTitle));
|
|
76
|
+
});
|
|
77
|
+
it('single error', async () => {
|
|
78
|
+
document.title = docTitle;
|
|
79
|
+
render(_jsx(InvalidFormAlert, { errorCountLabel: label, errors: singleTestError, headingLevel: 2 }));
|
|
80
|
+
await waitFor(() => expect(document.title).toBe(`(1 error) ${docTitle}`));
|
|
81
|
+
});
|
|
82
|
+
it('multiple errors', async () => {
|
|
83
|
+
document.title = docTitle;
|
|
84
|
+
render(_jsx(InvalidFormAlert, { errorCountLabel: label, errors: testErrors, headingLevel: 2 }));
|
|
85
|
+
await waitFor(() => expect(document.title).toBe(`(2 errors) ${docTitle}`));
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
it('has focus on render', async () => {
|
|
89
|
+
const { container } = render(_jsx(InvalidFormAlert, { errors: testErrors, headingLevel: 2 }));
|
|
90
|
+
const component = container.querySelector(':only-child');
|
|
91
|
+
expect(component).toHaveFocus();
|
|
92
|
+
});
|
|
93
|
+
it('can disable automatic focus', async () => {
|
|
94
|
+
const { container } = render(_jsx(InvalidFormAlert, { errors: testErrors, focusOnRender: false, headingLevel: 2 }));
|
|
95
|
+
const component = container.querySelector(':only-child');
|
|
96
|
+
expect(component).not.toHaveFocus();
|
|
97
|
+
});
|
|
98
|
+
it('supports ForwardRef in React', () => {
|
|
99
|
+
const ref = createRef();
|
|
100
|
+
const { container } = render(_jsx(InvalidFormAlert, { errors: testErrors, headingLevel: 2, ref: ref }));
|
|
101
|
+
const component = container.querySelector(':only-child');
|
|
102
|
+
expect(ref.current).toBe(component);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
6
|
+
import type { InvalidFormAlertProps } from './InvalidFormAlert';
|
|
7
|
+
export declare const InvalidFormAlertWithErrors: import("react").ForwardRefExoticComponent<Omit<InvalidFormAlertProps, "errorCountLabel"> & {
|
|
8
|
+
/** Whether the component has set focus once. */
|
|
9
|
+
hasFocusedOnce: boolean;
|
|
10
|
+
/** Callback to let parent component know whether focus has been set once. */
|
|
11
|
+
setHasFocusedOnce: Dispatch<SetStateAction<boolean>>;
|
|
12
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
8
|
+
import { Alert } from '../Alert';
|
|
9
|
+
import { LinkList } from '../LinkList';
|
|
10
|
+
export const InvalidFormAlertWithErrors = forwardRef(({ className, errors, focusOnRender = true, hasFocusedOnce, heading = 'Verbeter de fouten voor u verder gaat', headingLevel, setHasFocusedOnce, ...restProps }, ref) => {
|
|
11
|
+
const innerRef = useRef(null);
|
|
12
|
+
// use a passed ref if it's there, otherwise use innerRef
|
|
13
|
+
useImperativeHandle(ref, () => innerRef.current);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (innerRef.current && focusOnRender && !hasFocusedOnce) {
|
|
16
|
+
innerRef.current.focus();
|
|
17
|
+
setHasFocusedOnce(true);
|
|
18
|
+
}
|
|
19
|
+
}, [innerRef]);
|
|
20
|
+
return (_jsx(Alert, { ...restProps, className: clsx('ams-invalid-form-alert', className), heading: heading, headingLevel: headingLevel, ref: innerRef, severity: "error", tabIndex: -1, children: _jsx(LinkList, { children: errors.map(({ id, label }) => (_jsx(LinkList.Link, { href: id, children: label }, `${id}-${label}`))) }) }));
|
|
21
|
+
});
|
|
22
|
+
InvalidFormAlertWithErrors.displayName = 'InvalidFormAlertWithErrors';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InvalidFormAlert } from './InvalidFormAlert';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const useAddErrorCountToDocumentTitle: (
|
|
2
|
+
/** The list of error messages used to calculate the error count. */
|
|
3
|
+
errors: {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}[],
|
|
7
|
+
/** The text following the error count. */
|
|
8
|
+
label?: {
|
|
9
|
+
plural: string;
|
|
10
|
+
singular: string;
|
|
11
|
+
}) => null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
export const useAddErrorCountToDocumentTitle = (
|
|
3
|
+
/** The list of error messages used to calculate the error count. */
|
|
4
|
+
errors,
|
|
5
|
+
/** The text following the error count. */
|
|
6
|
+
label = {
|
|
7
|
+
plural: 'invoerfouten',
|
|
8
|
+
singular: 'invoerfout',
|
|
9
|
+
}) => {
|
|
10
|
+
const [documentTitle, setDocumentTitle] = useState();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setDocumentTitle(document.title);
|
|
13
|
+
}, []);
|
|
14
|
+
if (!documentTitle)
|
|
15
|
+
return null;
|
|
16
|
+
if (errors.length === 1) {
|
|
17
|
+
document.title = `(${errors.length} ${label.singular}) ${documentTitle}`;
|
|
18
|
+
}
|
|
19
|
+
else if (errors.length > 1) {
|
|
20
|
+
document.title = `(${errors.length} ${label.plural}) ${documentTitle}`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
document.title = documentTitle;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright (c) 2021 Robbert Broersma
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import type { LabelHTMLAttributes, PropsWithChildren } from 'react';
|
|
7
|
+
import { HintProps } from '../Hint';
|
|
8
|
+
export type LabelProps = PropsWithChildren<LabelHTMLAttributes<HTMLLabelElement>> & HintProps;
|
|
9
|
+
export declare const Label: import("react").ForwardRefExoticComponent<LabelHTMLAttributes<HTMLLabelElement> & {
|
|
10
|
+
children?: import("react").ReactNode | undefined;
|
|
11
|
+
} & import("react").HTMLAttributes<HTMLElement> & {
|
|
12
|
+
hint?: string;
|
|
13
|
+
optional?: boolean;
|
|
14
|
+
} & import("react").RefAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } 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 { Hint } from '../Hint';
|
|
10
|
+
export const Label = forwardRef(({ children, className, hint, optional, ...restProps }, ref) => {
|
|
11
|
+
return (_jsxs("label", { ...restProps, className: clsx('ams-label', className), ref: ref, children: [children, " ", _jsx(Hint, { hint: hint, optional: optional })] }));
|
|
12
|
+
});
|
|
13
|
+
Label.displayName = 'Label';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { Label } from './Label';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Label', () => {
|
|
7
|
+
it('renders an HTML label element', () => {
|
|
8
|
+
const { container } = render(_jsx(Label, { htmlFor: "form-control" }));
|
|
9
|
+
const label = container.querySelector('label:only-child');
|
|
10
|
+
expect(label).toBeInTheDocument();
|
|
11
|
+
expect(label).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
it('renders an HTML label element with for attribute', () => {
|
|
14
|
+
const { container } = render(_jsx(Label, { htmlFor: "form-control" }));
|
|
15
|
+
const label = container.querySelector('label[for="form-control"]:only-child');
|
|
16
|
+
expect(label).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
it('renders a design system BEM class name', () => {
|
|
19
|
+
const { container } = render(_jsx(Label, { htmlFor: "form-control" }));
|
|
20
|
+
const label = container.querySelector(':only-child');
|
|
21
|
+
expect(label).toHaveClass('ams-label');
|
|
22
|
+
});
|
|
23
|
+
it('renders rich text content', () => {
|
|
24
|
+
const { container } = render(_jsxs(Label, { htmlFor: "form-control", children: [_jsx("strong", { children: "Current" }), " password"] }));
|
|
25
|
+
const label = container.querySelector(':only-child');
|
|
26
|
+
const richText = label?.querySelector('strong');
|
|
27
|
+
expect(richText).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
it('can be associated with an HTML form input', () => {
|
|
30
|
+
render(_jsxs(_Fragment, { children: [_jsx(Label, { htmlFor: "email", children: "Email" }), _jsx("input", { id: "email", type: "email" })] }));
|
|
31
|
+
const textbox = screen.getByRole('textbox', {
|
|
32
|
+
name: 'Email',
|
|
33
|
+
});
|
|
34
|
+
expect(textbox).toBeInTheDocument();
|
|
35
|
+
expect(textbox).toBeVisible();
|
|
36
|
+
});
|
|
37
|
+
it('can be hidden', () => {
|
|
38
|
+
const { container } = render(_jsx(Label, { hidden: true, htmlFor: "form-control" }));
|
|
39
|
+
const label = container.querySelector(':only-child');
|
|
40
|
+
expect(label).not.toBeVisible();
|
|
41
|
+
});
|
|
42
|
+
it('renders an additional class name', () => {
|
|
43
|
+
const { container } = render(_jsx(Label, { className: "large", htmlFor: "form-control" }));
|
|
44
|
+
const label = container.querySelector(':only-child');
|
|
45
|
+
expect(label).toHaveClass('large');
|
|
46
|
+
expect(label).toHaveClass('ams-label');
|
|
47
|
+
});
|
|
48
|
+
it('supports ForwardRef in React', () => {
|
|
49
|
+
const ref = createRef();
|
|
50
|
+
const { container } = render(_jsx(Label, { htmlFor: "form-control", ref: ref }));
|
|
51
|
+
const div = container.querySelector(':only-child');
|
|
52
|
+
expect(ref.current).toBe(div);
|
|
53
|
+
});
|
|
54
|
+
it('renders the provided hint text after the label', () => {
|
|
55
|
+
const { container } = render(_jsx(Label, { hint: "hint text", htmlFor: "form-control", children: "Label" }));
|
|
56
|
+
const label = container.querySelector('label:only-child');
|
|
57
|
+
expect(label).toHaveTextContent('Label (hint text)');
|
|
58
|
+
});
|
|
59
|
+
it('renders the default hint text after the label', () => {
|
|
60
|
+
const { container } = render(_jsx(Label, { htmlFor: "form-control", optional: true, children: "Label" }));
|
|
61
|
+
const label = container.querySelector('label:only-child');
|
|
62
|
+
expect(label).toHaveTextContent('Label (niet verplicht)');
|
|
63
|
+
});
|
|
64
|
+
it('renders the provided hint text after the label when `optional` is set to `false`', () => {
|
|
65
|
+
const { container } = render(_jsx(Label, { hint: "not required", htmlFor: "form-control", optional: true, children: "Label" }));
|
|
66
|
+
const label = container.querySelector('label:only-child');
|
|
67
|
+
expect(label).toHaveTextContent('Label (not required)');
|
|
68
|
+
});
|
|
69
|
+
it('renders the provided hint text after the label while `optional` is set to `false`', () => {
|
|
70
|
+
const { container } = render(_jsx(Label, { hint: "required", htmlFor: "form-control", optional: false, children: "Label" }));
|
|
71
|
+
const label = container.querySelector('label:only-child');
|
|
72
|
+
expect(label).toHaveTextContent('Label (required)');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from './Label';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from './Label';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { AnchorHTMLAttributes } from 'react';
|
|
6
|
+
type LinkVariant = 'standalone' | 'inline';
|
|
7
|
+
export type LinkProps = {
|
|
8
|
+
/** Changes the text colour for readability on a light or dark background. */
|
|
9
|
+
color?: 'contrast' | 'inverse';
|
|
10
|
+
/** Whether the link is inline or stands alone. */
|
|
11
|
+
variant?: LinkVariant;
|
|
12
|
+
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'placeholder'>;
|
|
13
|
+
export declare const Link: import("react").ForwardRefExoticComponent<{
|
|
14
|
+
/** Changes the text colour for readability on a light or dark background. */
|
|
15
|
+
color?: "contrast" | "inverse";
|
|
16
|
+
/** Whether the link is inline or stands alone. */
|
|
17
|
+
variant?: LinkVariant;
|
|
18
|
+
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "placeholder"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } 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
|
+
export const Link = forwardRef(({ children, className, color, variant = 'standalone', ...restProps }, ref) => (_jsx("a", { ...restProps, className: clsx('ams-link', color && `ams-link--${color}`, variant === 'inline' && 'ams-link--inline', variant === 'standalone' && 'ams-link--standalone', className), ref: ref, children: children })));
|
|
9
|
+
Link.displayName = 'Link';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { Link } from './Link';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Link', () => {
|
|
7
|
+
const linktext = 'Linktext';
|
|
8
|
+
it('renders with href attribute', () => {
|
|
9
|
+
const { container } = render(_jsx(Link, { href: "#", children: linktext }));
|
|
10
|
+
const link = container.querySelector('a:only-child');
|
|
11
|
+
expect(link).toBeInTheDocument();
|
|
12
|
+
expect(link).toHaveAttribute('href', '#');
|
|
13
|
+
});
|
|
14
|
+
it('renders standalone variant', () => {
|
|
15
|
+
const { container } = render(_jsx(Link, { href: "#", children: linktext }));
|
|
16
|
+
const link = container.querySelector('a:only-child');
|
|
17
|
+
expect(link).toHaveClass('ams-link');
|
|
18
|
+
});
|
|
19
|
+
it('renders inline variant', () => {
|
|
20
|
+
const { container } = render(_jsx(Link, { href: "#", variant: "inline", children: linktext }));
|
|
21
|
+
const link = container.querySelector('a:only-child');
|
|
22
|
+
expect(link).toHaveClass('ams-link ams-link--inline');
|
|
23
|
+
});
|
|
24
|
+
it('renders an additional class name', () => {
|
|
25
|
+
const { container } = render(_jsx(Link, { className: "large" }));
|
|
26
|
+
const link = container.querySelector(':only-child');
|
|
27
|
+
expect(link).toHaveClass('large');
|
|
28
|
+
expect(link).toHaveClass('ams-link');
|
|
29
|
+
});
|
|
30
|
+
it('renders the class name for contrast color', () => {
|
|
31
|
+
const { container } = render(_jsx(Link, { color: "contrast", href: "#", children: linktext }));
|
|
32
|
+
const link = container.querySelector('a:only-child');
|
|
33
|
+
expect(link).toHaveClass('ams-link ams-link--contrast');
|
|
34
|
+
});
|
|
35
|
+
it('renders the class name for inverse color', () => {
|
|
36
|
+
const { container } = render(_jsx(Link, { color: "inverse", href: "#", children: linktext }));
|
|
37
|
+
const link = container.querySelector('a:only-child');
|
|
38
|
+
expect(link).toHaveClass('ams-link ams-link--inverse');
|
|
39
|
+
});
|
|
40
|
+
it('supports ForwardRef in React', () => {
|
|
41
|
+
const ref = createRef();
|
|
42
|
+
const { container } = render(_jsx(Link, { href: "https://example.com/", ref: ref, children: 'https://example.com/' }));
|
|
43
|
+
const link = container.querySelector(':only-child');
|
|
44
|
+
expect(ref.current).toBe(link);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Link } from './Link';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type LinkListProps = PropsWithChildren<HTMLAttributes<HTMLUListElement>>;
|
|
7
|
+
export declare const LinkList: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLUListElement> & {
|
|
8
|
+
children?: import("react").ReactNode | undefined;
|
|
9
|
+
} & import("react").RefAttributes<HTMLUListElement>> & {
|
|
10
|
+
Link: import("react").ForwardRefExoticComponent<{
|
|
11
|
+
color?: "contrast" | "inverse";
|
|
12
|
+
icon?: Function;
|
|
13
|
+
size?: "small" | "large";
|
|
14
|
+
} & import("react").AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
15
|
+
children?: import("react").ReactNode | undefined;
|
|
16
|
+
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } 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
|
+
import { LinkListLink } from './LinkListLink';
|
|
9
|
+
/** A collection of related links. */
|
|
10
|
+
const LinkListRoot = forwardRef(({ children, className, ...restProps }, ref) => {
|
|
11
|
+
return (_jsx("ul", { className: clsx('ams-link-list', className), ref: ref, ...restProps, children: children }));
|
|
12
|
+
});
|
|
13
|
+
LinkListRoot.displayName = 'LinkList';
|
|
14
|
+
export const LinkList = Object.assign(LinkListRoot, { Link: LinkListLink });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|