@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,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { createRef } from 'react';
|
|
5
|
+
import { TableOfContents } from './TableOfContents';
|
|
6
|
+
describe('Table of Contents link', () => {
|
|
7
|
+
it('renders', () => {
|
|
8
|
+
render(_jsx(TableOfContents.Link, { href: "#", label: "Test label" }));
|
|
9
|
+
const link = screen.getByRole('link');
|
|
10
|
+
expect(link).toBeInTheDocument();
|
|
11
|
+
expect(link).toBeVisible();
|
|
12
|
+
expect(link).toHaveTextContent('Test label');
|
|
13
|
+
});
|
|
14
|
+
it('renders a design system BEM class name', () => {
|
|
15
|
+
render(_jsx(TableOfContents.Link, { href: "#", label: "Test" }));
|
|
16
|
+
const component = screen.getByRole('link');
|
|
17
|
+
expect(component).toHaveClass('ams-table-of-contents__link');
|
|
18
|
+
});
|
|
19
|
+
it('renders an additional class name', () => {
|
|
20
|
+
render(_jsx(TableOfContents.Link, { className: "extra", href: "#", label: "Test" }));
|
|
21
|
+
const component = screen.getByRole('link');
|
|
22
|
+
expect(component).toHaveClass('ams-table-of-contents__link extra');
|
|
23
|
+
});
|
|
24
|
+
it('supports ForwardRef in React', () => {
|
|
25
|
+
const ref = createRef();
|
|
26
|
+
render(_jsx(TableOfContents.Link, { href: "#", label: "Test", ref: ref }));
|
|
27
|
+
const component = screen.getByRole('link');
|
|
28
|
+
expect(ref.current).toBe(component);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type TableOfContentsListProps = PropsWithChildren<HTMLAttributes<HTMLUListElement>>;
|
|
7
|
+
export declare const TableOfContentsList: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLUListElement> & {
|
|
8
|
+
children?: import("react").ReactNode | undefined;
|
|
9
|
+
} & import("react").RefAttributes<HTMLUListElement>>;
|
|
@@ -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
|
+
export const TableOfContentsList = forwardRef(({ children, className, ...restProps }, ref) => {
|
|
9
|
+
return (_jsx("ul", { ...restProps, className: clsx('ams-table-of-contents__list', className), ref: ref, children: children }));
|
|
10
|
+
});
|
|
11
|
+
TableOfContentsList.displayName = 'TableOfContents.List';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { TableOfContents } from './TableOfContents';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Table of Contents list', () => {
|
|
7
|
+
it('renders an HTML ul element', () => {
|
|
8
|
+
const { container } = render(_jsx(TableOfContents.List, {}));
|
|
9
|
+
const list = container.querySelector('ul:only-child');
|
|
10
|
+
expect(list).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
it('renders a design system BEM class name', () => {
|
|
13
|
+
render(_jsx(TableOfContents.List, {}));
|
|
14
|
+
const component = screen.getByRole('list');
|
|
15
|
+
expect(component).toHaveClass('ams-table-of-contents__list');
|
|
16
|
+
});
|
|
17
|
+
it('renders an additional class name', () => {
|
|
18
|
+
render(_jsx(TableOfContents.List, { className: "extra" }));
|
|
19
|
+
const component = screen.getByRole('list');
|
|
20
|
+
expect(component).toHaveClass('ams-table-of-contents__list extra');
|
|
21
|
+
});
|
|
22
|
+
it('renders its subcomponent', () => {
|
|
23
|
+
const listItems = ['Item 1', 'Item 2', 'Item 3'];
|
|
24
|
+
const { container } = render(_jsx(TableOfContents.List, { children: listItems.map((item, index) => (_jsx(TableOfContents.Link, { label: `Link ${item}` }, index))) }));
|
|
25
|
+
const list = screen.getByRole('list');
|
|
26
|
+
const items = container.querySelectorAll('.ams-table-of-contents__item');
|
|
27
|
+
expect(list).toBeInTheDocument();
|
|
28
|
+
expect(items.length).toBe(3);
|
|
29
|
+
});
|
|
30
|
+
it('supports ForwardRef in React', () => {
|
|
31
|
+
const ref = createRef();
|
|
32
|
+
render(_jsx(TableOfContents.List, { ref: ref }));
|
|
33
|
+
const component = screen.getByRole('list');
|
|
34
|
+
expect(ref.current).toBe(component);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableOfContents } from './TableOfContents';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type TabsProps = {
|
|
7
|
+
/** The identifier of the initially active tab. Corresponds to its `tab` value. */
|
|
8
|
+
activeTab?: string;
|
|
9
|
+
onTabChange?: (tabId: string) => void;
|
|
10
|
+
} & PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const Tabs: import("react").ForwardRefExoticComponent<{
|
|
12
|
+
/** The identifier of the initially active tab. Corresponds to its `tab` value. */
|
|
13
|
+
activeTab?: string;
|
|
14
|
+
onTabChange?: (tabId: string) => void;
|
|
15
|
+
} & HTMLAttributes<HTMLDivElement> & {
|
|
16
|
+
children?: import("react").ReactNode | undefined;
|
|
17
|
+
} & import("react").RefAttributes<HTMLDivElement>> & {
|
|
18
|
+
Button: import("react").ForwardRefExoticComponent<{
|
|
19
|
+
tab: string;
|
|
20
|
+
} & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
21
|
+
children?: import("react").ReactNode | undefined;
|
|
22
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
List: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
24
|
+
children?: import("react").ReactNode | undefined;
|
|
25
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
|
+
Panel: import("react").ForwardRefExoticComponent<{
|
|
27
|
+
tab: string;
|
|
28
|
+
} & HTMLAttributes<HTMLDivElement> & {
|
|
29
|
+
children?: import("react").ReactNode | undefined;
|
|
30
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
31
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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, useId, useMemo, useState } from 'react';
|
|
8
|
+
import { TabsButton } from './TabsButton';
|
|
9
|
+
import { TabsContext } from './TabsContext';
|
|
10
|
+
import { TabsList } from './TabsList';
|
|
11
|
+
import { TabsPanel } from './TabsPanel';
|
|
12
|
+
const TabsRoot = forwardRef(({ activeTab, children, className, onTabChange, ...restProps }, ref) => {
|
|
13
|
+
const tabsId = useId();
|
|
14
|
+
const [activeTabId, setActiveTabId] = useState();
|
|
15
|
+
const allTabIds = useMemo(() => {
|
|
16
|
+
if (!Array.isArray(children))
|
|
17
|
+
return [];
|
|
18
|
+
// The first child of Tabs should be TabsList
|
|
19
|
+
const tabsList = children[0];
|
|
20
|
+
// Get children of TabsList
|
|
21
|
+
const tabsListChildren = tabsList.props.children;
|
|
22
|
+
// TabsList can have 0, 1, or more children
|
|
23
|
+
// If there is only 1 child, it will be an object
|
|
24
|
+
if (tabsListChildren.props) {
|
|
25
|
+
return [tabsListChildren.props.tab];
|
|
26
|
+
}
|
|
27
|
+
// If there is more than 1 child, it will be an array
|
|
28
|
+
if (Array.isArray(tabsListChildren)) {
|
|
29
|
+
return tabsListChildren.map((child) => child.props.tab);
|
|
30
|
+
}
|
|
31
|
+
// If there are no children, return an empty array
|
|
32
|
+
return [];
|
|
33
|
+
}, [children]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!activeTab) {
|
|
36
|
+
setActiveTabId(allTabIds[0]);
|
|
37
|
+
}
|
|
38
|
+
else if (!allTabIds.includes(activeTab)) {
|
|
39
|
+
console.warn(`The active tab "${activeTab}" does not exist. Falling back to the first tab.`);
|
|
40
|
+
setActiveTabId(allTabIds[0]);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
setActiveTabId(activeTab);
|
|
44
|
+
}
|
|
45
|
+
}, [activeTab, allTabIds]);
|
|
46
|
+
const updateTab = (tab) => {
|
|
47
|
+
setActiveTabId(tab);
|
|
48
|
+
onTabChange?.(tab);
|
|
49
|
+
};
|
|
50
|
+
return (_jsx(TabsContext.Provider, { value: { activeTabId, tabsId, updateTab }, children: _jsx("div", { ...restProps, className: clsx('ams-tabs', className), ref: ref, children: children }) }));
|
|
51
|
+
});
|
|
52
|
+
TabsRoot.displayName = 'Tabs';
|
|
53
|
+
export const Tabs = Object.assign(TabsRoot, {
|
|
54
|
+
Button: TabsButton,
|
|
55
|
+
List: TabsList,
|
|
56
|
+
Panel: TabsPanel,
|
|
57
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { createRef } from 'react';
|
|
5
|
+
import { Tabs } from './Tabs';
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
|
+
describe('Tabs', () => {
|
|
8
|
+
it('renders', () => {
|
|
9
|
+
const { container } = render(_jsx(Tabs, {}));
|
|
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(Tabs, {}));
|
|
16
|
+
const component = container.querySelector(':only-child');
|
|
17
|
+
expect(component).toHaveClass('ams-tabs');
|
|
18
|
+
});
|
|
19
|
+
it('renders an additional class name', () => {
|
|
20
|
+
const { container } = render(_jsx(Tabs, { className: "extra" }));
|
|
21
|
+
const component = container.querySelector(':only-child');
|
|
22
|
+
expect(component).toHaveClass('ams-tabs extra');
|
|
23
|
+
});
|
|
24
|
+
it('supports ForwardRef in React', () => {
|
|
25
|
+
const ref = createRef();
|
|
26
|
+
const { container } = render(_jsx(Tabs, { ref: ref }));
|
|
27
|
+
const component = container.querySelector(':only-child');
|
|
28
|
+
expect(ref.current).toBe(component);
|
|
29
|
+
});
|
|
30
|
+
it('supports children', () => {
|
|
31
|
+
render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { tab: "one", children: "Tab 1" }), _jsx(Tabs.Button, { tab: "two", children: "Tab 2" })] }), _jsx(Tabs.Panel, { tab: "one", children: "Content 1" }), _jsx(Tabs.Panel, { tab: "two", children: "Content 2" })] }));
|
|
32
|
+
expect(screen.getByRole('tablist')).toBeInTheDocument();
|
|
33
|
+
expect(screen.getByRole('tab', { selected: true })).toBeInTheDocument();
|
|
34
|
+
expect(screen.getByRole('tabpanel')).toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
it('should select a tab when clicked', async () => {
|
|
37
|
+
const user = userEvent.setup();
|
|
38
|
+
render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { tab: "one", children: "Tab 1" }), _jsx(Tabs.Button, { tab: "two", children: "Tab 2" })] }), _jsx(Tabs.Panel, { tab: "one", children: "Content 1" }), _jsx(Tabs.Panel, { tab: "two", children: "Content 2" })] }));
|
|
39
|
+
const tabOne = screen.getByRole('tab', { name: 'Tab 1' });
|
|
40
|
+
const tabTwo = screen.getByRole('tab', { name: 'Tab 2' });
|
|
41
|
+
expect(tabOne).toHaveAttribute('aria-selected', 'true');
|
|
42
|
+
expect(tabOne).toHaveAttribute('tabindex', '0');
|
|
43
|
+
expect(tabTwo).toHaveAttribute('aria-selected', 'false');
|
|
44
|
+
expect(tabTwo).toHaveAttribute('tabindex', '-1');
|
|
45
|
+
expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 1');
|
|
46
|
+
if (tabTwo) {
|
|
47
|
+
await user.click(tabTwo);
|
|
48
|
+
}
|
|
49
|
+
expect(tabOne).toHaveAttribute('aria-selected', 'false');
|
|
50
|
+
expect(tabOne).toHaveAttribute('tabindex', '-1');
|
|
51
|
+
expect(tabTwo).toHaveAttribute('aria-selected', 'true');
|
|
52
|
+
expect(tabTwo).toHaveAttribute('tabindex', '0');
|
|
53
|
+
expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 2');
|
|
54
|
+
});
|
|
55
|
+
it('calls onTabChange with the newly activated tab', async () => {
|
|
56
|
+
const user = userEvent.setup();
|
|
57
|
+
const onTabChange = jest.fn();
|
|
58
|
+
render(_jsx(Tabs, { onTabChange: onTabChange, children: _jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one", children: "Tab 1" }) }) }));
|
|
59
|
+
const button = screen.getByRole('tab', { name: 'Tab 1' });
|
|
60
|
+
await user.click(button);
|
|
61
|
+
expect(onTabChange).toHaveBeenCalledWith('one');
|
|
62
|
+
});
|
|
63
|
+
it('should be able to set the initially active tab', () => {
|
|
64
|
+
render(_jsxs(Tabs, { activeTab: "three", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { tab: "one", children: "Tab 1" }), _jsx(Tabs.Button, { tab: "two", children: "Tab 2" }), _jsx(Tabs.Button, { tab: "three", children: "Tab 3" }), _jsx(Tabs.Button, { tab: "four", children: "Tab 4" })] }), _jsx(Tabs.Panel, { tab: "one", children: "Content 1" }), _jsx(Tabs.Panel, { tab: "two", children: "Content 2" }), _jsx(Tabs.Panel, { tab: "three", children: "Content 3" }), _jsx(Tabs.Panel, { tab: "four", children: "Content 4" })] }));
|
|
65
|
+
const tabOne = screen.getByRole('tab', { name: 'Tab 1' });
|
|
66
|
+
const tabThree = screen.getByRole('tab', { name: 'Tab 3' });
|
|
67
|
+
expect(tabOne).toHaveAttribute('aria-selected', 'false');
|
|
68
|
+
expect(tabOne).toHaveAttribute('tabindex', '-1');
|
|
69
|
+
expect(tabThree).toHaveAttribute('aria-selected', 'true');
|
|
70
|
+
expect(tabThree).toHaveAttribute('tabindex', '0');
|
|
71
|
+
expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 3');
|
|
72
|
+
});
|
|
73
|
+
it('should set the first tab as the initially active tab when the supplied active tab does not exist', async () => {
|
|
74
|
+
// Disable console.warn for this test, to prevent it from cluttering the test output
|
|
75
|
+
jest.spyOn(console, 'warn').mockImplementation(() => { });
|
|
76
|
+
render(_jsxs(Tabs, { activeTab: "unknown", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { tab: "one", children: "Tab 1" }), _jsx(Tabs.Button, { tab: "two", children: "Tab 2" }), _jsx(Tabs.Button, { tab: "three", children: "Tab 3" }), _jsx(Tabs.Button, { tab: "four", children: "Tab 4" })] }), _jsx(Tabs.Panel, { tab: "one", children: "Content 1" }), _jsx(Tabs.Panel, { tab: "two", children: "Content 2" }), _jsx(Tabs.Panel, { tab: "three", children: "Content 3" }), _jsx(Tabs.Panel, { tab: "four", children: "Content 4" })] }));
|
|
77
|
+
const firstTab = screen.getByRole('tab', { name: 'Tab 1' });
|
|
78
|
+
const lastTab = screen.getByRole('tab', { name: 'Tab 4' });
|
|
79
|
+
expect(firstTab).toHaveAttribute('aria-selected', 'true');
|
|
80
|
+
expect(firstTab).toHaveAttribute('tabindex', '0');
|
|
81
|
+
expect(lastTab).toHaveAttribute('aria-selected', 'false');
|
|
82
|
+
expect(lastTab).toHaveAttribute('tabindex', '-1');
|
|
83
|
+
expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 1');
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { ButtonHTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type TabsButtonProps = {
|
|
7
|
+
/** An identifier. */
|
|
8
|
+
tab: string;
|
|
9
|
+
} & PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
10
|
+
export declare const TabsButton: import("react").ForwardRefExoticComponent<{
|
|
11
|
+
/** An identifier. */
|
|
12
|
+
tab: string;
|
|
13
|
+
} & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
14
|
+
children?: import("react").ReactNode | undefined;
|
|
15
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 clsx from 'clsx';
|
|
7
|
+
import { forwardRef, startTransition, useContext } from 'react';
|
|
8
|
+
import { TabsContext } from './TabsContext';
|
|
9
|
+
export const TabsButton = forwardRef(({ children, className, onClick, tab, ...restProps }, ref) => {
|
|
10
|
+
const { activeTabId, tabsId, updateTab } = useContext(TabsContext);
|
|
11
|
+
const handleClick = (event) => {
|
|
12
|
+
onClick?.(event);
|
|
13
|
+
startTransition(() => {
|
|
14
|
+
updateTab(tab);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
return (_jsxs("button", { ...restProps, "aria-controls": `${tabsId}-panel-${tab}`, "aria-selected": activeTabId === tab, className: clsx('ams-tabs__button', className), id: `${tabsId}-tab-${tab}`, onClick: handleClick, ref: ref, role: "tab", tabIndex: activeTabId === tab ? 0 : -1, children: [_jsx("span", { "aria-hidden": "true", className: "ams-tabs__button-label-hidden", children: children }), _jsx("span", { className: "ams-tabs__button-label", children: children })] }));
|
|
18
|
+
});
|
|
19
|
+
TabsButton.displayName = 'Tabs.Button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { TabsButton } from './TabsButton';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Tabs button', () => {
|
|
7
|
+
it('renders', () => {
|
|
8
|
+
render(_jsx(TabsButton, { tab: "one" }));
|
|
9
|
+
const component = screen.getByRole('tab');
|
|
10
|
+
expect(component).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
it('renders a design system BEM class name', () => {
|
|
13
|
+
render(_jsx(TabsButton, { tab: "one" }));
|
|
14
|
+
const component = screen.getByRole('tab');
|
|
15
|
+
expect(component).toHaveClass('ams-tabs__button');
|
|
16
|
+
});
|
|
17
|
+
it('renders an additional class name', () => {
|
|
18
|
+
render(_jsx(TabsButton, { className: "extra", tab: "one" }));
|
|
19
|
+
const component = screen.getByRole('tab');
|
|
20
|
+
expect(component).toHaveClass('ams-tabs__button extra');
|
|
21
|
+
});
|
|
22
|
+
it('renders a label', () => {
|
|
23
|
+
render(_jsx(TabsButton, { tab: "one", children: "Label" }));
|
|
24
|
+
const component = screen.getByRole('tab', { name: 'Label' });
|
|
25
|
+
expect(component).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
it('renders the correct id based on the tabs prop', () => {
|
|
28
|
+
const { container } = render(_jsx(TabsButton, { tab: "one" }));
|
|
29
|
+
const component = container.querySelector('#-tab-one');
|
|
30
|
+
expect(component).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
it('should associate the button with the correct tab', () => {
|
|
33
|
+
render(_jsx(TabsButton, { tab: "one" }));
|
|
34
|
+
const component = screen.getByRole('tab');
|
|
35
|
+
expect(component).toHaveAttribute('aria-controls', '-panel-one');
|
|
36
|
+
});
|
|
37
|
+
it('supports ForwardRef in React', () => {
|
|
38
|
+
const ref = createRef();
|
|
39
|
+
render(_jsx(TabsButton, { ref: ref, tab: "one" }));
|
|
40
|
+
const component = screen.getByRole('tab');
|
|
41
|
+
expect(ref.current).toBe(component);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
export type TabsContextValue = {
|
|
6
|
+
/** The identifier of the active tab. */
|
|
7
|
+
activeTabId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The generated identifier for the entire Tabs component.
|
|
10
|
+
* This lets you have several Tabs components, possibly with the same tabs, on one page.
|
|
11
|
+
*/
|
|
12
|
+
tabsId: string;
|
|
13
|
+
/** A function to update the active tab. */
|
|
14
|
+
updateTab: (tab: string) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const TabsContext: import("react").Context<TabsContextValue>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import { createContext } from 'react';
|
|
6
|
+
const defaultValues = {
|
|
7
|
+
activeTabId: undefined,
|
|
8
|
+
tabsId: '',
|
|
9
|
+
updateTab: () => { },
|
|
10
|
+
};
|
|
11
|
+
export const TabsContext = createContext(defaultValues);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type TabsListProps = PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const TabsList: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
children?: import("react").ReactNode | undefined;
|
|
9
|
+
} & 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 clsx from 'clsx';
|
|
7
|
+
import { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
8
|
+
import { useKeyboardFocus } from '../common/useKeyboardFocus';
|
|
9
|
+
export const TabsList = forwardRef(({ children, className, ...restProps }, ref) => {
|
|
10
|
+
const innerRef = useRef(null);
|
|
11
|
+
// Use a passed ref if it's there, otherwise use innerRef
|
|
12
|
+
useImperativeHandle(ref, () => innerRef.current);
|
|
13
|
+
const { keyDown } = useKeyboardFocus(innerRef, {
|
|
14
|
+
focusableElements: ['button[role="tab"]'],
|
|
15
|
+
horizontally: true,
|
|
16
|
+
rotating: true,
|
|
17
|
+
});
|
|
18
|
+
return (_jsx("div", { ...restProps, className: clsx('ams-tabs__list', className), onKeyDown: keyDown, ref: innerRef, role: "tablist", children: children }));
|
|
19
|
+
});
|
|
20
|
+
TabsList.displayName = 'Tabs.List';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { TabsList } from './TabsList';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Tabs list', () => {
|
|
7
|
+
it('renders', () => {
|
|
8
|
+
render(_jsx(TabsList, {}));
|
|
9
|
+
const component = screen.getByRole('tablist');
|
|
10
|
+
expect(component).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
it('renders a design system BEM class name', () => {
|
|
13
|
+
render(_jsx(TabsList, {}));
|
|
14
|
+
const component = screen.getByRole('tablist');
|
|
15
|
+
expect(component).toHaveClass('ams-tabs__list');
|
|
16
|
+
});
|
|
17
|
+
it('renders an additional class name', () => {
|
|
18
|
+
render(_jsx(TabsList, { className: "extra" }));
|
|
19
|
+
const component = screen.getByRole('tablist');
|
|
20
|
+
expect(component).toHaveClass('ams-tabs__list extra');
|
|
21
|
+
});
|
|
22
|
+
it('supports ForwardRef in React', () => {
|
|
23
|
+
const ref = createRef();
|
|
24
|
+
render(_jsx(TabsList, { ref: ref }));
|
|
25
|
+
const component = screen.getByRole('tablist');
|
|
26
|
+
expect(ref.current).toBe(component);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { HTMLAttributes, PropsWithChildren } from 'react';
|
|
6
|
+
export type TabsPanelProps = {
|
|
7
|
+
/** The identifier of the corresponding Tab. */
|
|
8
|
+
tab: string;
|
|
9
|
+
} & PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const TabsPanel: import("react").ForwardRefExoticComponent<{
|
|
11
|
+
/** The identifier of the corresponding Tab. */
|
|
12
|
+
tab: string;
|
|
13
|
+
} & HTMLAttributes<HTMLDivElement> & {
|
|
14
|
+
children?: import("react").ReactNode | undefined;
|
|
15
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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, useContext } from 'react';
|
|
8
|
+
import { TabsContext } from './TabsContext';
|
|
9
|
+
export const TabsPanel = forwardRef(({ children, className, tab, ...restProps }, ref) => {
|
|
10
|
+
const { activeTabId, tabsId } = useContext(TabsContext);
|
|
11
|
+
if (tab !== activeTabId) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return (_jsx("div", { ...restProps, "aria-labelledby": `${tabsId}-tab-${tab}`, className: clsx('ams-tabs__panel', className), id: `${tabsId}-panel-${tab}`, ref: ref, role: "tabpanel", tabIndex: 0, children: children }));
|
|
15
|
+
});
|
|
16
|
+
TabsPanel.displayName = 'Tabs.Panel';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { createRef } from 'react';
|
|
4
|
+
import { Tabs } from './Tabs';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
describe('Tabs Panel', () => {
|
|
7
|
+
it('renders', () => {
|
|
8
|
+
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { tab: "one" })] }));
|
|
9
|
+
const component = screen.getByRole('tabpanel');
|
|
10
|
+
expect(component).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
it('renders a design system BEM class name', () => {
|
|
13
|
+
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { tab: "one" })] }));
|
|
14
|
+
const component = screen.getByRole('tabpanel');
|
|
15
|
+
expect(component).toHaveClass('ams-tabs__panel');
|
|
16
|
+
});
|
|
17
|
+
it('renders an additional class name', () => {
|
|
18
|
+
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { className: "extra", tab: "one" })] }));
|
|
19
|
+
const component = screen.getByRole('tabpanel');
|
|
20
|
+
expect(component).toHaveClass('ams-tabs__panel extra');
|
|
21
|
+
});
|
|
22
|
+
it('renders the correct id based on the tabs prop', () => {
|
|
23
|
+
const { container } = render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { tab: "one" })] }));
|
|
24
|
+
// The start of the id is generated by useId, so we only check the end of the id
|
|
25
|
+
const component = container.querySelector('[id$="panel-one"]');
|
|
26
|
+
expect(component).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
it('should associate the tab with the correct button', () => {
|
|
29
|
+
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { tab: "one" })] }));
|
|
30
|
+
const component = screen.getByRole('tabpanel');
|
|
31
|
+
// The start of the attribute value is generated by useId, so we only check the end of the value
|
|
32
|
+
expect(component).toHaveAttribute('aria-labelledby', expect.stringMatching(/-tab-one$/));
|
|
33
|
+
});
|
|
34
|
+
it('supports ForwardRef in React', () => {
|
|
35
|
+
const ref = createRef();
|
|
36
|
+
render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { ref: ref, tab: "one" })] }));
|
|
37
|
+
const component = screen.getByRole('tabpanel');
|
|
38
|
+
expect(ref.current).toBe(component);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tabs } from './Tabs';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license EUPL-1.2+
|
|
3
|
+
* Copyright Gemeente Amsterdam
|
|
4
|
+
*/
|
|
5
|
+
import type { TextareaHTMLAttributes } from 'react';
|
|
6
|
+
export type TextAreaProps = {
|
|
7
|
+
/** Whether the value fails a validation rule. */
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
/** Allows the user to resize the text box. The default is resizing in both directions. */
|
|
10
|
+
resize?: 'none' | 'horizontal' | 'vertical';
|
|
11
|
+
} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'aria-invalid'>;
|
|
12
|
+
export declare const TextArea: import("react").ForwardRefExoticComponent<{
|
|
13
|
+
/** Whether the value fails a validation rule. */
|
|
14
|
+
invalid?: boolean;
|
|
15
|
+
/** Allows the user to resize the text box. The default is resizing in both directions. */
|
|
16
|
+
resize?: "none" | "horizontal" | "vertical";
|
|
17
|
+
} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "aria-invalid"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -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 TextArea = forwardRef(({ className, dir, invalid, resize, ...restProps }, ref) => (_jsx("textarea", { ...restProps, "aria-invalid": invalid || undefined, className: clsx('ams-text-area', resize && `ams-text-area--resize-${resize}`, restProps.cols && 'ams-text-area--cols', className), dir: dir ?? 'auto', ref: ref })));
|
|
9
|
+
TextArea.displayName = 'TextArea';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|