@amsterdam/design-system-react 0.14.1 → 0.16.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/README.md +1 -1
- package/dist/Accordion/Accordion.d.ts +35 -0
- package/dist/Accordion/Accordion.js +22 -0
- package/dist/Accordion/Accordion.test.d.ts +1 -0
- package/dist/Accordion/Accordion.test.js +40 -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 +42 -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 +58 -0
- package/dist/Breakout/BreakoutCell.d.ts +37 -0
- package/dist/Breakout/BreakoutCell.js +11 -0
- package/dist/Breakout/BreakoutCell.test.d.ts +1 -0
- package/dist/Breakout/BreakoutCell.test.js +124 -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 +110 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/index.js +1 -0
- package/dist/Card/Card.d.ts +28 -0
- package/dist/Card/Card.js +19 -0
- package/dist/Card/Card.test.d.ts +1 -0
- package/dist/Card/Card.test.js +29 -0
- package/dist/Card/CardHeading.d.ts +11 -0
- package/dist/Card/CardHeading.js +10 -0
- package/dist/Card/CardHeading.test.d.ts +1 -0
- package/dist/Card/CardHeading.test.js +34 -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/CardImage.d.ts +7 -0
- package/dist/Card/CardImage.js +10 -0
- package/dist/Card/CardImage.test.d.ts +1 -0
- package/dist/Card/CardImage.test.js +29 -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 +123 -0
- package/dist/Checkbox/index.d.ts +2 -0
- package/dist/Checkbox/index.js +1 -0
- package/dist/Column/Column.d.ts +57 -0
- package/dist/Column/Column.js +11 -0
- package/dist/Column/Column.test.d.ts +1 -0
- package/dist/Column/Column.test.js +55 -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/Grid/Grid.d.ts +40 -0
- package/dist/Grid/Grid.js +15 -0
- package/dist/Grid/Grid.test.d.ts +1 -0
- package/dist/Grid/Grid.test.js +65 -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 +80 -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/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 +68 -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 +51 -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 +14 -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 +73 -0
- package/dist/Label/index.d.ts +1 -0
- package/dist/Label/index.js +1 -0
- package/dist/Link/Link.d.ts +13 -0
- package/dist/Link/Link.js +9 -0
- package/dist/Link/Link.test.d.ts +1 -0
- package/dist/Link/Link.test.js +39 -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 +29 -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/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/Page/Page.d.ts +9 -0
- package/dist/Page/Page.js +9 -0
- package/dist/Page/Page.test.d.ts +1 -0
- package/dist/Page/Page.test.js +29 -0
- package/dist/Page/index.d.ts +2 -0
- package/dist/Page/index.js +1 -0
- package/dist/PageFooter/PageFooter.d.ts +19 -0
- package/dist/PageFooter/PageFooter.js +17 -0
- package/dist/PageFooter/PageFooter.test.d.ts +1 -0
- package/dist/PageFooter/PageFooter.test.js +29 -0
- package/dist/PageFooter/PageFooterMenu.d.ts +9 -0
- package/dist/PageFooter/PageFooterMenu.js +9 -0
- package/dist/PageFooter/PageFooterMenu.test.d.ts +1 -0
- package/dist/PageFooter/PageFooterMenu.test.js +31 -0
- package/dist/PageFooter/PageFooterMenuLink.d.ts +9 -0
- package/dist/PageFooter/PageFooterMenuLink.js +9 -0
- package/dist/PageFooter/PageFooterMenuLink.test.d.ts +1 -0
- package/dist/PageFooter/PageFooterMenuLink.test.js +29 -0
- package/dist/PageFooter/PageFooterSpotlight.d.ts +9 -0
- package/dist/PageFooter/PageFooterSpotlight.js +9 -0
- package/dist/PageFooter/PageFooterSpotlight.test.d.ts +1 -0
- package/dist/PageFooter/PageFooterSpotlight.test.js +29 -0
- package/dist/PageFooter/index.d.ts +5 -0
- package/dist/PageFooter/index.js +1 -0
- package/dist/PageHeader/PageHeader.d.ts +49 -0
- package/dist/PageHeader/PageHeader.js +31 -0
- package/dist/PageHeader/PageHeader.test.d.ts +2 -0
- package/dist/PageHeader/PageHeader.test.js +120 -0
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.d.ts +2 -0
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.js +6 -0
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.test.d.ts +1 -0
- package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.test.js +34 -0
- package/dist/PageHeader/PageHeaderMenuIcon.d.ts +2 -0
- package/dist/PageHeader/PageHeaderMenuIcon.js +2 -0
- package/dist/PageHeader/PageHeaderMenuLink.d.ts +9 -0
- package/dist/PageHeader/PageHeaderMenuLink.js +5 -0
- package/dist/PageHeader/PageHeaderMenuLink.test.d.ts +1 -0
- package/dist/PageHeader/PageHeaderMenuLink.test.js +41 -0
- package/dist/PageHeader/index.d.ts +3 -0
- package/dist/PageHeader/index.js +1 -0
- package/dist/PageHeader/matchMedia.mock.d.ts +0 -0
- package/dist/PageHeader/matchMedia.mock.js +15 -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 +36 -0
- package/dist/PageHeading/index.d.ts +2 -0
- package/dist/PageHeading/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 +67 -0
- package/dist/Row/Row.js +11 -0
- package/dist/Row/Row.test.d.ts +1 -0
- package/dist/Row/Row.test.js +60 -0
- package/dist/Row/index.d.ts +2 -0
- package/dist/Row/index.js +1 -0
- package/dist/SearchField/SearchField.d.ts +294 -0
- package/dist/SearchField/SearchField.js +14 -0
- package/dist/SearchField/SearchField.test.d.ts +1 -0
- package/dist/SearchField/SearchField.test.js +46 -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 +61 -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 +24 -0
- package/dist/Spotlight/Spotlight.js +11 -0
- package/dist/Spotlight/Spotlight.test.d.ts +1 -0
- package/dist/Spotlight/Spotlight.test.js +42 -0
- package/dist/Spotlight/index.d.ts +2 -0
- package/dist/Spotlight/index.js +1 -0
- package/dist/StandaloneLink/StandaloneLink.d.ts +17 -0
- package/dist/StandaloneLink/StandaloneLink.js +10 -0
- package/dist/StandaloneLink/StandaloneLink.test.d.ts +1 -0
- package/dist/StandaloneLink/StandaloneLink.test.js +40 -0
- package/dist/StandaloneLink/index.d.ts +2 -0
- package/dist/StandaloneLink/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 +56 -0
- package/dist/Tabs/Tabs.test.d.ts +1 -0
- package/dist/Tabs/Tabs.test.js +100 -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 +11 -0
- package/dist/Tabs/TabsContext.js +10 -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 +38 -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 +88 -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/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 +13 -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 +1512 -1564
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +339 -345
- package/dist/index.esm.js +1509 -1560
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +64 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +23 -24
|
@@ -0,0 +1,13 @@
|
|
|
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 { FileListItem } from './FileListItem';
|
|
9
|
+
export const FileListRoot = forwardRef(({ children, className, ...restProps }, ref) => (_jsx("ul", { ...restProps, className: clsx('ams-file-list', className), ref: ref, children: children })));
|
|
10
|
+
FileListRoot.displayName = 'FileList';
|
|
11
|
+
export const FileList = Object.assign(FileListRoot, {
|
|
12
|
+
Item: FileListItem,
|
|
13
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { FileList } from './FileList';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('FileList', () => {
|
|
7
|
+
it('renders', () => {
|
|
8
|
+
render(_jsx(FileList, {}));
|
|
9
|
+
const component = screen.getByRole('list');
|
|
10
|
+
expect(component).toBeInTheDocument();
|
|
11
|
+
expect(component).toBeVisible();
|
|
12
|
+
});
|
|
13
|
+
it('renders a design system BEM class name', () => {
|
|
14
|
+
render(_jsx(FileList, {}));
|
|
15
|
+
const component = screen.getByRole('list');
|
|
16
|
+
expect(component).toHaveClass('ams-file-list');
|
|
17
|
+
});
|
|
18
|
+
it('renders an extra class name', () => {
|
|
19
|
+
render(_jsx(FileList, { className: "extra" }));
|
|
20
|
+
const component = screen.getByRole('list');
|
|
21
|
+
expect(component).toHaveClass('ams-file-list extra');
|
|
22
|
+
});
|
|
23
|
+
it('supports ForwardRef in React', () => {
|
|
24
|
+
const ref = createRef();
|
|
25
|
+
render(_jsx(FileList, { ref: ref }));
|
|
26
|
+
const component = screen.getByRole('list');
|
|
27
|
+
expect(ref.current).toBe(component);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes } from 'react';
|
|
6
|
+
export type FileListItemProps = {
|
|
7
|
+
file: File;
|
|
8
|
+
onDelete?: () => void;
|
|
9
|
+
} & HTMLAttributes<HTMLLIElement>;
|
|
10
|
+
export declare const FileListItem: import("react").ForwardRefExoticComponent<{
|
|
11
|
+
file: File;
|
|
12
|
+
onDelete?: () => void;
|
|
13
|
+
} & HTMLAttributes<HTMLLIElement> & import("react").RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @license EUPL-1.2+
|
|
4
|
+
* Copyright Gemeente Amsterdam
|
|
5
|
+
*/
|
|
6
|
+
import { DocumentIcon } from '@amsterdam/design-system-react-icons';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
import { Button } from '../Button';
|
|
10
|
+
import { Icon } from '../Icon';
|
|
11
|
+
import { formatFileSize } from '../common/formatFileSize';
|
|
12
|
+
import { formatFileType } from '../common/formatFileType';
|
|
13
|
+
export const FileListItem = forwardRef(({ className, file, onDelete, ...restProps }, ref) => (_jsxs("li", { ...restProps, className: clsx('ams-file-list__item', className), ref: ref, children: [_jsx("div", { className: "ams-file-list__item-preview", children: file.type.startsWith('image/') ? (_jsx("img", { alt: file.name, src: URL.createObjectURL(file) })) : (_jsx(Icon, { size: "heading-3", square: true, svg: DocumentIcon })) }), _jsxs("div", { className: "ams-file-list__item-info", children: [file.name, _jsxs("div", { className: "ams-file-input__item-details", children: ["(", formatFileType(file.type), ", ", formatFileSize(file.size), ")"] })] }), onDelete && (_jsx("div", { children: _jsx(Button, { onClick: () => onDelete(), variant: "tertiary", children: "Verwijder" }) }))] })));
|
|
14
|
+
FileListItem.displayName = 'FileList.Item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
import { FileListItem } from './FileListItem';
|
|
6
|
+
describe('FileListItem', () => {
|
|
7
|
+
const file = new File(['sample content'], 'sample.txt', { type: 'text/plain' });
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
render(_jsx(FileListItem, { file: file }));
|
|
10
|
+
const component = screen.getByRole('listitem');
|
|
11
|
+
expect(component).toBeInTheDocument();
|
|
12
|
+
expect(component).toBeVisible();
|
|
13
|
+
});
|
|
14
|
+
it('renders a design system BEM class name', () => {
|
|
15
|
+
render(_jsx(FileListItem, { file: file }));
|
|
16
|
+
const component = screen.getByRole('listitem');
|
|
17
|
+
expect(component).toHaveClass('ams-file-list__item');
|
|
18
|
+
});
|
|
19
|
+
it('renders an extra class name', () => {
|
|
20
|
+
render(_jsx(FileListItem, { className: "extra", file: file }));
|
|
21
|
+
const component = screen.getByRole('listitem');
|
|
22
|
+
expect(component).toHaveClass('ams-file-list__item extra');
|
|
23
|
+
});
|
|
24
|
+
it('supports ForwardRef in React', () => {
|
|
25
|
+
const ref = createRef();
|
|
26
|
+
render(_jsx(FileListItem, { file: file, ref: ref }));
|
|
27
|
+
const component = screen.getByRole('listitem');
|
|
28
|
+
expect(ref.current).toBe(component);
|
|
29
|
+
});
|
|
30
|
+
it('renders the file name', () => {
|
|
31
|
+
render(_jsx(FileListItem, { file: file }));
|
|
32
|
+
expect(screen.getByText('sample.txt')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
it('calls onDelete when the remove button is clicked', () => {
|
|
35
|
+
const onDelete = jest.fn();
|
|
36
|
+
render(_jsx(FileListItem, { file: file, onDelete: onDelete }));
|
|
37
|
+
fireEvent.click(screen.getByRole('button'));
|
|
38
|
+
expect(onDelete).toHaveBeenCalledTimes(1);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FileList } from './FileList';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type GridColumnNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
7
|
+
export type GridColumnNumbers = {
|
|
8
|
+
narrow: 1 | 2 | 3 | 4;
|
|
9
|
+
medium: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
10
|
+
wide: GridColumnNumber;
|
|
11
|
+
};
|
|
12
|
+
export declare const gridGaps: readonly ["none", "large", "2x-large"];
|
|
13
|
+
export type GridGap = (typeof gridGaps)[number];
|
|
14
|
+
export declare const gridPaddings: readonly ["large", "x-large", "2x-large"];
|
|
15
|
+
export type GridPadding = (typeof gridPaddings)[number];
|
|
16
|
+
export declare const gridTags: readonly ["article", "aside", "div", "footer", "header", "main", "nav", "section"];
|
|
17
|
+
export type GridTag = (typeof gridTags)[number];
|
|
18
|
+
type GridPaddingVerticalProp = {
|
|
19
|
+
paddingBottom?: never;
|
|
20
|
+
paddingTop?: never;
|
|
21
|
+
/** The amount of space above and below. */
|
|
22
|
+
paddingVertical?: GridPadding;
|
|
23
|
+
};
|
|
24
|
+
type GridPaddingTopAndBottomProps = {
|
|
25
|
+
/** The amount of space below. */
|
|
26
|
+
paddingBottom?: GridPadding;
|
|
27
|
+
/** The amount of space above. */
|
|
28
|
+
paddingTop?: GridPadding;
|
|
29
|
+
paddingVertical?: never;
|
|
30
|
+
};
|
|
31
|
+
export type GridProps = {
|
|
32
|
+
/** The HTML tag to use. */
|
|
33
|
+
as?: GridTag;
|
|
34
|
+
/** The amount of space between rows. */
|
|
35
|
+
gapVertical?: GridGap;
|
|
36
|
+
} & (GridPaddingVerticalProp | GridPaddingTopAndBottomProps) & PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
|
|
37
|
+
export declare const Grid: import("react").ForwardRefExoticComponent<GridProps & import("react").RefAttributes<any>> & {
|
|
38
|
+
Cell: import("react").ForwardRefExoticComponent<import("./GridCell").GridCellProps & import("react").RefAttributes<unknown>>;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
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 { GridCell } from './GridCell';
|
|
9
|
+
import { paddingClasses } from './paddingClasses';
|
|
10
|
+
export const gridGaps = ['none', 'large', '2x-large'];
|
|
11
|
+
export const gridPaddings = ['large', 'x-large', '2x-large'];
|
|
12
|
+
export const gridTags = ['article', 'aside', 'div', 'footer', 'header', 'main', 'nav', 'section'];
|
|
13
|
+
const GridRoot = forwardRef(({ as: Tag = 'div', children, className, gapVertical, paddingBottom, paddingTop, paddingVertical, ...restProps }, ref) => (_jsx(Tag, { ...restProps, className: clsx('ams-grid', gapVertical && `ams-grid--gap-vertical--${gapVertical}`, paddingClasses('grid', paddingBottom, paddingTop, paddingVertical), className), ref: ref, children: children })));
|
|
14
|
+
GridRoot.displayName = 'Grid';
|
|
15
|
+
export const Grid = Object.assign(GridRoot, { Cell: GridCell });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { Grid, gridGaps, gridPaddings, gridTags } from './Grid';
|
|
5
|
+
import { ariaRoleForTag } from '../common/accessibility';
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
|
+
describe('Grid', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const { container } = render(_jsx(Grid, {}));
|
|
10
|
+
const component = container.querySelector(':only-child');
|
|
11
|
+
expect(component).toBeInTheDocument();
|
|
12
|
+
expect(component).toBeVisible();
|
|
13
|
+
});
|
|
14
|
+
it('renders a design system BEM class name', () => {
|
|
15
|
+
const { container } = render(_jsx(Grid, {}));
|
|
16
|
+
const component = container.querySelector(':only-child');
|
|
17
|
+
expect(component).toHaveClass('ams-grid');
|
|
18
|
+
});
|
|
19
|
+
it('renders an extra class name', () => {
|
|
20
|
+
const { container } = render(_jsx(Grid, { className: "extra" }));
|
|
21
|
+
const component = container.querySelector(':only-child');
|
|
22
|
+
expect(component).toHaveClass('ams-grid extra');
|
|
23
|
+
});
|
|
24
|
+
gridGaps.forEach((size) => {
|
|
25
|
+
it(`renders the correct class name for a ${size} vertical gap`, () => {
|
|
26
|
+
const { container } = render(_jsx(Grid, { gapVertical: size }));
|
|
27
|
+
const component = container.querySelector(':only-child');
|
|
28
|
+
expect(component).toHaveClass(`ams-grid--gap-vertical--${size}`);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
gridPaddings.forEach((size) => {
|
|
32
|
+
it(`renders the correct class name for a ${size} bottom padding`, () => {
|
|
33
|
+
const { container } = render(_jsx(Grid, { paddingBottom: size }));
|
|
34
|
+
const component = container.querySelector(':only-child');
|
|
35
|
+
expect(component).toHaveClass(`ams-grid--padding-bottom--${size}`);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
gridPaddings.forEach((size) => {
|
|
39
|
+
it(`renders the correct class name for a ${size} top padding`, () => {
|
|
40
|
+
const { container } = render(_jsx(Grid, { paddingTop: size }));
|
|
41
|
+
const component = container.querySelector(':only-child');
|
|
42
|
+
expect(component).toHaveClass(`ams-grid--padding-top--${size}`);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
gridPaddings.forEach((size) => {
|
|
46
|
+
it(`renders the correct class name for a ${size} vertical padding`, () => {
|
|
47
|
+
const { container } = render(_jsx(Grid, { paddingVertical: size }));
|
|
48
|
+
const component = container.querySelector(':only-child');
|
|
49
|
+
expect(component).toHaveClass(`ams-grid--padding-vertical--${size}`);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
gridTags.forEach((tag) => {
|
|
53
|
+
it(`renders with a custom ${tag} tag`, () => {
|
|
54
|
+
const { container } = render(_jsx(Grid, { "aria-label": tag === 'section' ? 'Accessible name' : undefined, as: tag }));
|
|
55
|
+
const component = tag === 'div' ? container.querySelector(tag) : screen.getByRole(ariaRoleForTag[tag]);
|
|
56
|
+
expect(component).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
it('supports ForwardRef in React', () => {
|
|
60
|
+
const ref = createRef();
|
|
61
|
+
const { container } = render(_jsx(Grid, { ref: ref }));
|
|
62
|
+
const component = container.querySelector(':only-child');
|
|
63
|
+
expect(ref.current).toBe(component);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
import type { GridColumnNumber, GridColumnNumbers } from './Grid';
|
|
7
|
+
export declare const gridCellTags: readonly ["article", "aside", "div", "footer", "header", "main", "nav", "section"];
|
|
8
|
+
export type GridCellTag = (typeof gridCellTags)[number];
|
|
9
|
+
type GridCellSpanAllProp = {
|
|
10
|
+
/** Lets the cell span the full width of all grid variants. */
|
|
11
|
+
span: 'all';
|
|
12
|
+
start?: never;
|
|
13
|
+
};
|
|
14
|
+
type GridCellSpanAndStartProps = {
|
|
15
|
+
/** The amount of grid columns the cell spans. */
|
|
16
|
+
span?: GridColumnNumber | GridColumnNumbers;
|
|
17
|
+
/** The index of the grid column the cell starts at. */
|
|
18
|
+
start?: GridColumnNumber | GridColumnNumbers;
|
|
19
|
+
};
|
|
20
|
+
export type GridCellProps = {
|
|
21
|
+
/** The HTML tag to use. */
|
|
22
|
+
as?: GridCellTag;
|
|
23
|
+
} & (GridCellSpanAllProp | GridCellSpanAndStartProps) & PropsWithChildren<HTMLAttributes<HTMLElement>>;
|
|
24
|
+
export declare const GridCell: import("react").ForwardRefExoticComponent<GridCellProps & import("react").RefAttributes<unknown>>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 { gridCellClasses } from './gridCellClasses';
|
|
9
|
+
export const gridCellTags = ['article', 'aside', 'div', 'footer', 'header', 'main', 'nav', 'section'];
|
|
10
|
+
export const GridCell = forwardRef(({ as: Tag = 'div', children, className, span, start, ...restProps }, ref) => (_jsx(Tag, { ...restProps, className: clsx('ams-grid__cell', gridCellClasses(span, start), className), ref: ref, children: children })));
|
|
11
|
+
GridCell.displayName = 'Grid.Cell';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { Grid } from './Grid';
|
|
5
|
+
import { gridCellTags } from './GridCell';
|
|
6
|
+
import { ariaRoleForTag } from '../common/accessibility';
|
|
7
|
+
import '@testing-library/jest-dom';
|
|
8
|
+
describe('Grid cell', () => {
|
|
9
|
+
it('renders', () => {
|
|
10
|
+
const { container } = render(_jsx(Grid.Cell, {}));
|
|
11
|
+
const component = container.querySelector(':only-child');
|
|
12
|
+
expect(component).toBeInTheDocument();
|
|
13
|
+
expect(component).toBeVisible();
|
|
14
|
+
});
|
|
15
|
+
it('renders a design system BEM class name', () => {
|
|
16
|
+
const { container } = render(_jsx(Grid.Cell, {}));
|
|
17
|
+
const component = container.querySelector(':only-child');
|
|
18
|
+
expect(component).toHaveClass('ams-grid__cell');
|
|
19
|
+
});
|
|
20
|
+
it('renders an extra class name', () => {
|
|
21
|
+
const { container } = render(_jsx(Grid.Cell, { className: "extra" }));
|
|
22
|
+
const component = container.querySelector(':only-child');
|
|
23
|
+
expect(component).toHaveClass('ams-grid__cell extra');
|
|
24
|
+
});
|
|
25
|
+
it('renders no class names for undefined values for start and span', () => {
|
|
26
|
+
const { container } = render(_jsx(Grid.Cell, {}));
|
|
27
|
+
const elementWithSpanClass = container.querySelector('[class*="ams-grid__cell--span"]');
|
|
28
|
+
const elementWithStartClass = container.querySelector('[class*="ams-grid__cell--start"]');
|
|
29
|
+
expect(elementWithSpanClass).not.toBeInTheDocument();
|
|
30
|
+
expect(elementWithStartClass).not.toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
it('renders class names for single number values for start and span', () => {
|
|
33
|
+
const { container } = render(_jsx(Grid.Cell, { span: 4, start: 2 }));
|
|
34
|
+
const component = container.querySelector(':only-child');
|
|
35
|
+
expect(component).toHaveClass('ams-grid__cell--span-4 ams-grid__cell--start-2');
|
|
36
|
+
});
|
|
37
|
+
it('renders class names for a single number value for start', () => {
|
|
38
|
+
const { container } = render(_jsx(Grid.Cell, { span: 8 }));
|
|
39
|
+
const component = container.querySelector(':only-child');
|
|
40
|
+
expect(component).toHaveClass('ams-grid__cell--span-8');
|
|
41
|
+
});
|
|
42
|
+
it('renders class names for a single number value for span', () => {
|
|
43
|
+
const { container } = render(_jsx(Grid.Cell, { start: 6 }));
|
|
44
|
+
const component = container.querySelector(':only-child');
|
|
45
|
+
expect(component).toHaveClass('ams-grid__cell--start-6');
|
|
46
|
+
});
|
|
47
|
+
it('renders class names for a single number for span and an object for start', () => {
|
|
48
|
+
const { container } = render(_jsx(Grid.Cell, { span: 8, start: { narrow: 2, medium: 4, wide: 6 } }));
|
|
49
|
+
const component = container.querySelector(':only-child');
|
|
50
|
+
expect(component).toHaveClass('ams-grid__cell--span-8 ams-grid__cell--start-2 ams-grid__cell--start-4-medium ams-grid__cell--start-6-wide');
|
|
51
|
+
});
|
|
52
|
+
it('renders class names for an object for span and a single number for start', () => {
|
|
53
|
+
const { container } = render(_jsx(Grid.Cell, { span: { narrow: 3, medium: 5, wide: 7 }, start: 2 }));
|
|
54
|
+
const component = container.querySelector(':only-child');
|
|
55
|
+
expect(component).toHaveClass('ams-grid__cell--span-3 ams-grid__cell--span-5-medium ams-grid__cell--span-7-wide ams-grid__cell--start-2');
|
|
56
|
+
});
|
|
57
|
+
it('renders class names for an object for both start and span', () => {
|
|
58
|
+
const { container } = render(_jsx(Grid.Cell, { span: { narrow: 2, medium: 4, wide: 6 }, start: { narrow: 1, medium: 3, wide: 5 } }));
|
|
59
|
+
const component = container.querySelector(':only-child');
|
|
60
|
+
expect(component).toHaveClass('ams-grid__cell--span-2 ams-grid__cell--span-4-medium ams-grid__cell--span-6-wide ams-grid__cell--start-1 ams-grid__cell--start-3-medium ams-grid__cell--start-5-wide');
|
|
61
|
+
});
|
|
62
|
+
it('renders the correct class name for the “all” value of span', () => {
|
|
63
|
+
const { container } = render(_jsx(Grid.Cell, { span: "all" }));
|
|
64
|
+
const component = container.querySelector(':only-child');
|
|
65
|
+
expect(component).toHaveClass('ams-grid__cell--span-all');
|
|
66
|
+
});
|
|
67
|
+
gridCellTags.forEach((tag) => {
|
|
68
|
+
it(`renders with a custom ${tag} tag`, () => {
|
|
69
|
+
const { container } = render(_jsx(Grid.Cell, { "aria-label": tag === 'section' ? 'Accessible name' : undefined, as: tag }));
|
|
70
|
+
const component = tag === 'div' ? container.querySelector(tag) : screen.getByRole(ariaRoleForTag[tag]);
|
|
71
|
+
expect(component).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
it('supports ForwardRef in React', () => {
|
|
75
|
+
const ref = createRef();
|
|
76
|
+
const { container } = render(_jsx(Grid.Cell, { ref: ref }));
|
|
77
|
+
const component = container.querySelector(':only-child');
|
|
78
|
+
expect(ref.current).toBe(component);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { GridColumnNumber, GridColumnNumbers } from './Grid';
|
|
6
|
+
import type { GridCellProps } from './GridCell';
|
|
7
|
+
export declare const addGridClass: (prefix: string, value?: GridColumnNumber | GridColumnNumbers | "all") => string[];
|
|
8
|
+
export declare const gridCellClasses: (colSpan?: GridCellProps["span"], colStart?: GridCellProps["start"]) => string[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
export const addGridClass = (prefix, value) => {
|
|
6
|
+
if (value === 'all' || typeof value === 'number') {
|
|
7
|
+
return [`${prefix}${value}`];
|
|
8
|
+
}
|
|
9
|
+
else if (value) {
|
|
10
|
+
const { narrow, medium, wide } = value;
|
|
11
|
+
return [`${prefix}${narrow}`, `${prefix}${medium}-medium`, `${prefix}${wide}-wide`];
|
|
12
|
+
}
|
|
13
|
+
return [];
|
|
14
|
+
};
|
|
15
|
+
export const gridCellClasses = (colSpan, colStart) => [
|
|
16
|
+
...addGridClass('ams-grid__cell--span-', colSpan),
|
|
17
|
+
...addGridClass('ams-grid__cell--start-', colStart),
|
|
18
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Grid } from './Grid';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const paddingClasses = (componentName, paddingBottom, paddingTop, paddingVertical) => {
|
|
2
|
+
const classes = [];
|
|
3
|
+
if (paddingVertical) {
|
|
4
|
+
return [`ams-${componentName}--padding-vertical--${paddingVertical}`];
|
|
5
|
+
}
|
|
6
|
+
if (paddingBottom) {
|
|
7
|
+
classes.push(`ams-${componentName}--padding-bottom--${paddingBottom}`);
|
|
8
|
+
}
|
|
9
|
+
if (paddingTop) {
|
|
10
|
+
classes.push(`ams-${componentName}--padding-top--${paddingTop}`);
|
|
11
|
+
}
|
|
12
|
+
return classes;
|
|
13
|
+
};
|
|
@@ -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,68 @@
|
|
|
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 a design system BEM class name', () => {
|
|
16
|
+
render(_jsx(Heading, { level: 1 }));
|
|
17
|
+
const heading = screen.getByRole('heading');
|
|
18
|
+
expect(heading).toHaveClass('ams-heading');
|
|
19
|
+
});
|
|
20
|
+
it('renders an extra class name', () => {
|
|
21
|
+
render(_jsx(Heading, { className: "extra", level: 1 }));
|
|
22
|
+
const heading = screen.getByRole('heading');
|
|
23
|
+
expect(heading).toHaveClass('ams-heading extra');
|
|
24
|
+
});
|
|
25
|
+
it('renders the allowed levels correctly', () => {
|
|
26
|
+
render(_jsxs(_Fragment, { children: [_jsx(Heading, { level: 1, children: "Heading 1" }), _jsx(Heading, { level: 2, children: "Heading 2" }), _jsx(Heading, { level: 3, children: "Heading 3" }), _jsx(Heading, { level: 4, children: "Heading 4" })] }));
|
|
27
|
+
const h1 = screen.getByRole('heading', { level: 1, name: 'Heading 1' });
|
|
28
|
+
const h2 = screen.getByRole('heading', { level: 2, name: 'Heading 2' });
|
|
29
|
+
const h3 = screen.getByRole('heading', { level: 3, name: 'Heading 3' });
|
|
30
|
+
const h4 = screen.getByRole('heading', { level: 4, name: 'Heading 4' });
|
|
31
|
+
expect(h1).toBeInTheDocument();
|
|
32
|
+
expect(h2).toBeInTheDocument();
|
|
33
|
+
expect(h3).toBeInTheDocument();
|
|
34
|
+
expect(h4).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
it('renders the correct size level class', () => {
|
|
37
|
+
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" })] }));
|
|
38
|
+
const sizeLevel1 = screen.getByRole('heading', { level: 1, name: 'Size level 1' });
|
|
39
|
+
const sizeLevel2 = screen.getByRole('heading', { level: 1, name: 'Size level 2' });
|
|
40
|
+
const sizeLevel3 = screen.getByRole('heading', { level: 1, name: 'Size level 3' });
|
|
41
|
+
const sizeLevel4 = screen.getByRole('heading', { level: 1, name: 'Size level 4' });
|
|
42
|
+
const sizeLevel5 = screen.getByRole('heading', { level: 1, name: 'Size level 5' });
|
|
43
|
+
const sizeLevel6 = screen.getByRole('heading', { level: 1, name: 'Size level 6' });
|
|
44
|
+
expect(sizeLevel1).toHaveClass('ams-heading--1');
|
|
45
|
+
expect(sizeLevel2).toHaveClass('ams-heading--2');
|
|
46
|
+
expect(sizeLevel3).toHaveClass('ams-heading--3');
|
|
47
|
+
expect(sizeLevel4).toHaveClass('ams-heading--4');
|
|
48
|
+
expect(sizeLevel5).toHaveClass('ams-heading--5');
|
|
49
|
+
expect(sizeLevel6).toHaveClass('ams-heading--6');
|
|
50
|
+
});
|
|
51
|
+
it('renders the class name for inverse color', () => {
|
|
52
|
+
render(_jsx(Heading, { color: "inverse", level: 1, children: "Heading" }));
|
|
53
|
+
const heading = screen.getByRole('heading', { name: 'Heading' });
|
|
54
|
+
expect(heading).toHaveClass('ams-heading--inverse');
|
|
55
|
+
});
|
|
56
|
+
it('renders inline markup', () => {
|
|
57
|
+
render(_jsxs(Heading, { level: 1, children: [_jsx("strong", { children: "Breaking" }), " news"] }));
|
|
58
|
+
const heading = screen.getByRole('heading', { name: 'Breaking news' });
|
|
59
|
+
const inlineMarkup = heading.querySelector('strong');
|
|
60
|
+
expect(inlineMarkup).toBeInTheDocument();
|
|
61
|
+
});
|
|
62
|
+
it('is able to pass a React ref', () => {
|
|
63
|
+
const ref = createRef();
|
|
64
|
+
render(_jsx(Heading, { level: 1, ref: ref }));
|
|
65
|
+
const heading = screen.getByRole('heading');
|
|
66
|
+
expect(ref.current).toBe(heading);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -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';
|