@reykjavik/hanna-react 0.10.55 → 0.10.56
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/AccordionList.jsx +61 -0
- package/ActionCards.jsx +15 -0
- package/Alert.jsx +123 -0
- package/ArticleCarousel/_ArticleCarouselCard.d.ts +1 -1
- package/ArticleCarousel/_ArticleCarouselCard.jsx +32 -0
- package/ArticleCarousel.jsx +13 -0
- package/ArticleMeta.jsx +42 -0
- package/Attention.jsx +9 -0
- package/BasicTable.jsx +35 -0
- package/Bling.jsx +49 -0
- package/BlockBreak.jsx +11 -0
- package/BlockQuote.jsx +9 -0
- package/BreadCrumbs.jsx +36 -0
- package/ButtonBack.jsx +9 -0
- package/ButtonBar.jsx +23 -0
- package/ButtonPrimary.jsx +9 -0
- package/ButtonSecondary.jsx +9 -0
- package/ButtonTertiary.jsx +20 -0
- package/CHANGELOG.md +13 -5
- package/Carousel.jsx +9 -0
- package/CarouselStepper.jsx +9 -0
- package/CenterColumn.jsx +14 -0
- package/Checkbox.jsx +9 -0
- package/CheckboxButtonsGroup.jsx +19 -0
- package/CheckboxGroup.jsx +12 -0
- package/CityBlock.jsx +23 -0
- package/ContactBubble.jsx +192 -0
- package/ContentArticle.jsx +29 -0
- package/ContentImage.jsx +18 -0
- package/Datepicker.jsx +92 -0
- package/ExtraLinks.jsx +47 -0
- package/FeatureList.jsx +28 -0
- package/FieldGroup.jsx +15 -0
- package/FileInput.jsx +185 -0
- package/Foonote.jsx +12 -0
- package/FooterBadges.jsx +21 -0
- package/FooterInfo.jsx +19 -0
- package/Footnote.jsx +8 -0
- package/Form.jsx +17 -0
- package/FormField.jsx +121 -0
- package/Gallery/_GalleryItem.jsx +59 -0
- package/Gallery/_GalleryModal.jsx +86 -0
- package/Gallery/_GalleryModalContext.js +8 -0
- package/Gallery/_GalleryModalItem.jsx +29 -0
- package/Gallery.jsx +56 -0
- package/GridBlocks.jsx +40 -0
- package/Heading.jsx +24 -0
- package/HeroBlock.jsx +27 -0
- package/IframeBlock.jsx +31 -0
- package/Illustration.jsx +13 -0
- package/ImageCards.jsx +28 -0
- package/InfoBlock.jsx +23 -0
- package/InfoHero.jsx +93 -0
- package/IslandBlock.jsx +21 -0
- package/IslandPageBlock.jsx +21 -0
- package/LabeledTextBlock.jsx +21 -0
- package/Layout.jsx +69 -0
- package/MainMenu/_Auxiliary.jsx +26 -0
- package/MainMenu/_PrimaryPanel.jsx +37 -0
- package/MainMenu.d.ts +1 -1
- package/MainMenu.jsx +178 -0
- package/MiniMetrics.jsx +16 -0
- package/Modal.jsx +21 -0
- package/NameCard.jsx +92 -0
- package/NameCards.jsx +14 -0
- package/NewsHero.jsx +93 -0
- package/PageFilter.jsx +21 -0
- package/PageHeading.jsx +19 -0
- package/ProcessOverview.jsx +25 -0
- package/PullQuote.jsx +9 -0
- package/RadioButtonsGroup.jsx +19 -0
- package/RadioGroup.jsx +12 -0
- package/RelatedLinks.jsx +35 -0
- package/RowBlock.jsx +16 -0
- package/RowBlockColumn.jsx +18 -0
- package/SearchInput.jsx +63 -0
- package/SearchResults/_SearchResultsItem.jsx +24 -0
- package/SearchResults.jsx +146 -0
- package/SeenEffect.jsx +24 -0
- package/Selectbox.jsx +74 -0
- package/ShareButtons.jsx +82 -0
- package/Sharpie.jsx +27 -0
- package/SiteSearchAutocomplete.jsx +89 -0
- package/SiteSearchCurtain.jsx +65 -0
- package/SiteSearchInput.d.ts +1 -1
- package/SiteSearchInput.jsx +70 -0
- package/Skeleton.jsx +35 -0
- package/SubHeading.jsx +20 -0
- package/Tabs.jsx +122 -0
- package/TagPill.jsx +53 -0
- package/TextBlock.jsx +22 -0
- package/TextButton.jsx +14 -0
- package/TextInput.jsx +63 -0
- package/VSpacer.jsx +46 -0
- package/VerticalTabsTOC.jsx +96 -0
- package/WizardLayout.jsx +44 -0
- package/WizardLayoutClose.jsx +9 -0
- package/WizardStepper.jsx +34 -0
- package/_abstract/Button.jsx +56 -0
- package/_abstract/CardList.jsx +46 -0
- package/_abstract/Image.jsx +34 -0
- package/_abstract/Link.jsx +31 -0
- package/_abstract/TogglerGroup.jsx +36 -0
- package/_abstract/TogglerGroupField.jsx +27 -0
- package/_abstract/TogglerInput.jsx +40 -0
- package/_abstract/_AbstractCarousel.jsx +161 -0
- package/_abstract/_Blings.jsx +19 -0
- package/_abstract/_Block.jsx +32 -0
- package/_abstract/_Quote.jsx +18 -0
- package/_abstract/breakOnNL.jsx +13 -0
- package/assets.js +51 -0
- package/constants.js +25 -0
- package/esm/AccordionList.d.ts +17 -0
- package/esm/AccordionList.jsx +33 -0
- package/esm/ActionCards.d.ts +5 -0
- package/esm/ActionCards.jsx +10 -0
- package/esm/Alert.d.ts +49 -0
- package/esm/Alert.jsx +94 -0
- package/esm/ArticleCarousel/_ArticleCarouselCard.d.ts +27 -0
- package/esm/ArticleCarousel/_ArticleCarouselCard.jsx +25 -0
- package/esm/ArticleCarousel.d.ts +12 -0
- package/esm/ArticleCarousel.jsx +8 -0
- package/esm/ArticleMeta.d.ts +9 -0
- package/esm/ArticleMeta.jsx +17 -0
- package/esm/Attention.d.ts +7 -0
- package/esm/Attention.jsx +4 -0
- package/esm/BasicTable.d.ts +12 -0
- package/esm/BasicTable.jsx +30 -0
- package/esm/Bling.d.ts +81 -0
- package/esm/Bling.jsx +44 -0
- package/esm/BlockBreak.d.ts +2 -0
- package/esm/BlockBreak.jsx +6 -0
- package/esm/BlockQuote.d.ts +4 -0
- package/esm/BlockQuote.jsx +4 -0
- package/esm/BreadCrumbs.d.ts +11 -0
- package/esm/BreadCrumbs.jsx +31 -0
- package/esm/ButtonBack.d.ts +7 -0
- package/esm/ButtonBack.jsx +4 -0
- package/esm/ButtonBar.d.ts +16 -0
- package/esm/ButtonBar.jsx +16 -0
- package/esm/ButtonPrimary.d.ts +7 -0
- package/esm/ButtonPrimary.jsx +4 -0
- package/esm/ButtonSecondary.d.ts +7 -0
- package/esm/ButtonSecondary.jsx +4 -0
- package/esm/ButtonTertiary.d.ts +12 -0
- package/esm/ButtonTertiary.jsx +15 -0
- package/esm/Carousel.d.ts +4 -0
- package/esm/Carousel.jsx +4 -0
- package/esm/CarouselStepper.d.ts +4 -0
- package/esm/CarouselStepper.jsx +4 -0
- package/esm/CenterColumn.d.ts +7 -0
- package/esm/CenterColumn.jsx +9 -0
- package/esm/Checkbox.d.ts +4 -0
- package/esm/Checkbox.jsx +4 -0
- package/esm/CheckboxButtonsGroup.d.ts +11 -0
- package/esm/CheckboxButtonsGroup.jsx +14 -0
- package/esm/CheckboxGroup.d.ts +9 -0
- package/esm/CheckboxGroup.jsx +7 -0
- package/esm/CityBlock.d.ts +23 -0
- package/esm/CityBlock.jsx +18 -0
- package/esm/ContactBubble.d.ts +58 -0
- package/esm/ContactBubble.jsx +162 -0
- package/esm/ContentArticle.d.ts +15 -0
- package/esm/ContentArticle.jsx +24 -0
- package/esm/ContentImage.d.ts +8 -0
- package/esm/ContentImage.jsx +13 -0
- package/esm/Datepicker.d.ts +39 -0
- package/esm/Datepicker.jsx +64 -0
- package/esm/ExtraLinks.d.ts +18 -0
- package/esm/ExtraLinks.jsx +42 -0
- package/esm/FeatureList.d.ts +12 -0
- package/esm/FeatureList.jsx +23 -0
- package/esm/FieldGroup.d.ts +9 -0
- package/esm/FieldGroup.jsx +10 -0
- package/esm/FileInput.d.ts +17 -0
- package/esm/FileInput.jsx +157 -0
- package/esm/Foonote.d.ts +12 -0
- package/esm/Foonote.jsx +7 -0
- package/esm/FooterBadges.d.ts +9 -0
- package/esm/FooterBadges.jsx +16 -0
- package/esm/FooterInfo.d.ts +18 -0
- package/esm/FooterInfo.jsx +14 -0
- package/esm/Footnote.d.ts +6 -0
- package/esm/Footnote.jsx +3 -0
- package/esm/Form.d.ts +7 -0
- package/esm/Form.jsx +12 -0
- package/esm/FormField.d.ts +65 -0
- package/esm/FormField.jsx +93 -0
- package/esm/Gallery/_GalleryItem.d.ts +8 -0
- package/esm/Gallery/_GalleryItem.jsx +31 -0
- package/esm/Gallery/_GalleryModal.d.ts +6 -0
- package/esm/Gallery/_GalleryModal.jsx +58 -0
- package/esm/Gallery/_GalleryModalContext.d.ts +9 -0
- package/esm/Gallery/_GalleryModalContext.js +3 -0
- package/esm/Gallery/_GalleryModalItem.d.ts +3 -0
- package/esm/Gallery/_GalleryModalItem.jsx +24 -0
- package/esm/Gallery.d.ts +17 -0
- package/esm/Gallery.jsx +28 -0
- package/esm/GridBlocks.d.ts +26 -0
- package/esm/GridBlocks.jsx +35 -0
- package/esm/Heading.d.ts +16 -0
- package/esm/Heading.jsx +19 -0
- package/esm/HeroBlock.d.ts +19 -0
- package/esm/HeroBlock.jsx +22 -0
- package/esm/IframeBlock.d.ts +23 -0
- package/esm/IframeBlock.jsx +26 -0
- package/esm/Illustration.d.ts +13 -0
- package/esm/Illustration.jsx +8 -0
- package/esm/ImageCards.d.ts +8 -0
- package/esm/ImageCards.jsx +23 -0
- package/esm/InfoBlock.d.ts +17 -0
- package/esm/InfoBlock.jsx +18 -0
- package/esm/InfoHero.d.ts +17 -0
- package/esm/InfoHero.jsx +88 -0
- package/esm/IslandBlock.d.ts +25 -0
- package/esm/IslandBlock.jsx +16 -0
- package/esm/IslandPageBlock.d.ts +24 -0
- package/esm/IslandPageBlock.jsx +16 -0
- package/esm/LabeledTextBlock.d.ts +11 -0
- package/esm/LabeledTextBlock.jsx +16 -0
- package/esm/Layout.d.ts +33 -0
- package/esm/Layout.jsx +63 -0
- package/esm/MainMenu/_Auxiliary.d.ts +6 -0
- package/esm/MainMenu/_Auxiliary.jsx +19 -0
- package/esm/MainMenu/_PrimaryPanel.d.ts +13 -0
- package/esm/MainMenu/_PrimaryPanel.jsx +30 -0
- package/esm/MainMenu.d.ts +48 -0
- package/esm/MainMenu.jsx +149 -0
- package/esm/MiniMetrics.d.ts +8 -0
- package/esm/MiniMetrics.jsx +11 -0
- package/esm/Modal.d.ts +10 -0
- package/esm/Modal.jsx +16 -0
- package/esm/NameCard.d.ts +64 -0
- package/esm/NameCard.jsx +87 -0
- package/esm/NameCards.d.ts +6 -0
- package/esm/NameCards.jsx +9 -0
- package/esm/NewsHero.d.ts +14 -0
- package/esm/NewsHero.jsx +88 -0
- package/esm/PageFilter.d.ts +17 -0
- package/esm/PageFilter.jsx +16 -0
- package/esm/PageHeading.d.ts +10 -0
- package/esm/PageHeading.jsx +14 -0
- package/esm/ProcessOverview.d.ts +13 -0
- package/esm/ProcessOverview.jsx +20 -0
- package/esm/PullQuote.d.ts +4 -0
- package/esm/PullQuote.jsx +4 -0
- package/esm/RadioButtonsGroup.d.ts +11 -0
- package/esm/RadioButtonsGroup.jsx +14 -0
- package/esm/RadioGroup.d.ts +13 -0
- package/esm/RadioGroup.jsx +7 -0
- package/esm/RelatedLinks.d.ts +20 -0
- package/esm/RelatedLinks.jsx +30 -0
- package/esm/RowBlock.d.ts +12 -0
- package/esm/RowBlock.jsx +11 -0
- package/esm/RowBlockColumn.d.ts +8 -0
- package/esm/RowBlockColumn.jsx +13 -0
- package/esm/SearchInput.d.ts +18 -0
- package/esm/SearchInput.jsx +35 -0
- package/esm/SearchResults/_SearchResultsItem.d.ts +18 -0
- package/esm/SearchResults/_SearchResultsItem.jsx +19 -0
- package/esm/SearchResults.d.ts +33 -0
- package/esm/SearchResults.jsx +118 -0
- package/esm/SeenEffect.d.ts +4 -0
- package/esm/SeenEffect.jsx +19 -0
- package/esm/Selectbox.d.ts +8 -0
- package/esm/Selectbox.jsx +46 -0
- package/esm/ShareButtons.d.ts +9 -0
- package/esm/ShareButtons.jsx +57 -0
- package/esm/Sharpie.d.ts +23 -0
- package/esm/Sharpie.jsx +22 -0
- package/esm/SiteSearchAutocomplete.d.ts +40 -0
- package/esm/SiteSearchAutocomplete.jsx +60 -0
- package/esm/SiteSearchCurtain.d.ts +6 -0
- package/esm/SiteSearchCurtain.jsx +37 -0
- package/esm/SiteSearchInput.d.ts +24 -0
- package/esm/SiteSearchInput.jsx +42 -0
- package/esm/Skeleton.d.ts +25 -0
- package/esm/Skeleton.jsx +30 -0
- package/esm/SubHeading.d.ts +10 -0
- package/esm/SubHeading.jsx +15 -0
- package/esm/Tabs.d.ts +35 -0
- package/esm/Tabs.jsx +94 -0
- package/esm/TagPill.d.ts +27 -0
- package/esm/TagPill.jsx +48 -0
- package/esm/TextBlock.d.ts +15 -0
- package/esm/TextBlock.jsx +17 -0
- package/esm/TextButton.d.ts +9 -0
- package/esm/TextButton.jsx +9 -0
- package/esm/TextInput.d.ts +16 -0
- package/esm/TextInput.jsx +35 -0
- package/esm/VSpacer.d.ts +24 -0
- package/esm/VSpacer.jsx +41 -0
- package/esm/VerticalTabsTOC.d.ts +14 -0
- package/esm/VerticalTabsTOC.jsx +68 -0
- package/esm/WizardLayout.d.ts +15 -0
- package/esm/WizardLayout.jsx +39 -0
- package/esm/WizardLayoutClose.d.ts +3 -0
- package/esm/WizardLayoutClose.jsx +4 -0
- package/esm/WizardStepper.d.ts +36 -0
- package/esm/WizardStepper.jsx +29 -0
- package/esm/_abstract/Button.d.ts +40 -0
- package/esm/_abstract/Button.jsx +51 -0
- package/esm/_abstract/CardList.d.ts +29 -0
- package/esm/_abstract/CardList.jsx +39 -0
- package/esm/_abstract/Image.d.ts +32 -0
- package/esm/_abstract/Image.jsx +29 -0
- package/esm/_abstract/Link.d.ts +27 -0
- package/esm/_abstract/Link.jsx +24 -0
- package/esm/_abstract/TogglerGroup.d.ts +31 -0
- package/esm/_abstract/TogglerGroup.jsx +31 -0
- package/esm/_abstract/TogglerGroupField.d.ts +17 -0
- package/esm/_abstract/TogglerGroupField.jsx +22 -0
- package/esm/_abstract/TogglerInput.d.ts +22 -0
- package/esm/_abstract/TogglerInput.jsx +35 -0
- package/esm/_abstract/_AbstractCarousel.d.ts +25 -0
- package/esm/_abstract/_AbstractCarousel.jsx +133 -0
- package/esm/_abstract/_Blings.d.ts +11 -0
- package/esm/_abstract/_Blings.jsx +14 -0
- package/esm/_abstract/_Block.d.ts +22 -0
- package/esm/_abstract/_Block.jsx +27 -0
- package/esm/_abstract/_Quote.d.ts +9 -0
- package/esm/_abstract/_Quote.jsx +11 -0
- package/esm/_abstract/breakOnNL.d.ts +2 -0
- package/esm/_abstract/breakOnNL.jsx +8 -0
- package/esm/assets.d.ts +42 -0
- package/esm/assets.js +56 -0
- package/esm/constants.d.ts +39 -0
- package/esm/constants.js +22 -0
- package/esm/focus-visible.d.ts +1 -0
- package/esm/focus-visible.js +1 -0
- package/esm/package.json +1 -0
- package/esm/utils/env.d.ts +1 -0
- package/esm/utils/env.js +8 -0
- package/esm/utils/seenEffect.d.ts +28 -0
- package/esm/utils/seenEffect.js +73 -0
- package/esm/utils/useFormatMonitor.d.ts +38 -0
- package/esm/utils/useFormatMonitor.js +41 -0
- package/esm/utils/useGetSVGtext.d.ts +6 -0
- package/esm/utils/useGetSVGtext.js +19 -0
- package/esm/utils/useMenuToggling.d.ts +8 -0
- package/esm/utils/useMenuToggling.js +62 -0
- package/esm/utils/useScrollbarWidthCSSVar.d.ts +1 -0
- package/esm/utils/useScrollbarWidthCSSVar.js +3 -0
- package/esm/utils.d.ts +2 -0
- package/esm/utils.js +2 -0
- package/focus-visible.js +3 -0
- package/package.json +183 -184
- package/utils/env.js +14 -0
- package/utils/seenEffect.js +81 -0
- package/utils/useFormatMonitor.js +44 -0
- package/utils/useGetSVGtext.js +23 -0
- package/utils/useMenuToggling.js +66 -0
- package/utils/useScrollbarWidthCSSVar.js +10 -0
- package/utils.js +18 -0
- package/AccordionList.cjs +0 -91
- package/AccordionList.mjs +0 -69
- package/ActionCards.cjs +0 -57
- package/ActionCards.mjs +0 -35
- package/Alert.cjs +0 -159
- package/Alert.mjs +0 -139
- package/ArticleCarousel/_ArticleCarouselCard.cjs +0 -75
- package/ArticleCarousel/_ArticleCarouselCard.mjs +0 -51
- package/ArticleCarousel.cjs +0 -43
- package/ArticleCarousel.mjs +0 -21
- package/ArticleMeta.cjs +0 -46
- package/ArticleMeta.mjs +0 -22
- package/Attention.cjs +0 -33
- package/Attention.mjs +0 -9
- package/BasicTable.cjs +0 -72
- package/BasicTable.mjs +0 -50
- package/Bling.cjs +0 -76
- package/Bling.mjs +0 -52
- package/BlockBreak.cjs +0 -32
- package/BlockBreak.mjs +0 -8
- package/BlockQuote.cjs +0 -47
- package/BlockQuote.mjs +0 -25
- package/BreadCrumbs.cjs +0 -67
- package/BreadCrumbs.mjs +0 -43
- package/ButtonBack.cjs +0 -47
- package/ButtonBack.mjs +0 -25
- package/ButtonBar.cjs +0 -45
- package/ButtonBar.mjs +0 -18
- package/ButtonPrimary.cjs +0 -47
- package/ButtonPrimary.mjs +0 -25
- package/ButtonSecondary.cjs +0 -47
- package/ButtonSecondary.mjs +0 -25
- package/ButtonTertiary.cjs +0 -64
- package/ButtonTertiary.mjs +0 -42
- package/Carousel.cjs +0 -52
- package/Carousel.mjs +0 -30
- package/CarouselStepper.cjs +0 -51
- package/CarouselStepper.mjs +0 -29
- package/CenterColumn.cjs +0 -40
- package/CenterColumn.mjs +0 -16
- package/Checkbox.cjs +0 -52
- package/Checkbox.mjs +0 -30
- package/CheckboxButtonsGroup.cjs +0 -65
- package/CheckboxButtonsGroup.mjs +0 -43
- package/CheckboxGroup.cjs +0 -55
- package/CheckboxGroup.mjs +0 -33
- package/CityBlock.cjs +0 -49
- package/CityBlock.mjs +0 -25
- package/ContactBubble.cjs +0 -200
- package/ContactBubble.mjs +0 -173
- package/ContentArticle.cjs +0 -63
- package/ContentArticle.mjs +0 -41
- package/ContentImage.cjs +0 -58
- package/ContentImage.mjs +0 -36
- package/Datepicker.cjs +0 -164
- package/Datepicker.mjs +0 -142
- package/ExtraLinks.cjs +0 -96
- package/ExtraLinks.mjs +0 -74
- package/FeatureList.cjs +0 -53
- package/FeatureList.mjs +0 -29
- package/FieldGroup.cjs +0 -40
- package/FieldGroup.mjs +0 -16
- package/FileInput.cjs +0 -256
- package/FileInput.mjs +0 -234
- package/Foonote.cjs +0 -30
- package/Foonote.mjs +0 -6
- package/FooterBadges.cjs +0 -49
- package/FooterBadges.mjs +0 -25
- package/FooterInfo.cjs +0 -47
- package/FooterInfo.mjs +0 -23
- package/Footnote.cjs +0 -32
- package/Footnote.mjs +0 -8
- package/Form.cjs +0 -56
- package/Form.mjs +0 -34
- package/FormField.cjs +0 -153
- package/FormField.mjs +0 -131
- package/Gallery/_GalleryItem.cjs +0 -83
- package/Gallery/_GalleryItem.mjs +0 -61
- package/Gallery/_GalleryModal.cjs +0 -104
- package/Gallery/_GalleryModal.mjs +0 -82
- package/Gallery/_GalleryModalContext.cjs +0 -30
- package/Gallery/_GalleryModalContext.mjs +0 -6
- package/Gallery/_GalleryModalItem.cjs +0 -59
- package/Gallery/_GalleryModalItem.mjs +0 -36
- package/Gallery.cjs +0 -79
- package/Gallery.mjs +0 -57
- package/GridBlocks.cjs +0 -81
- package/GridBlocks.mjs +0 -59
- package/Heading.cjs +0 -45
- package/Heading.mjs +0 -21
- package/HeroBlock.cjs +0 -74
- package/HeroBlock.mjs +0 -52
- package/IframeBlock.cjs +0 -48
- package/IframeBlock.mjs +0 -24
- package/Illustration.cjs +0 -51
- package/Illustration.mjs +0 -31
- package/ImageCards.cjs +0 -72
- package/ImageCards.mjs +0 -52
- package/InfoBlock.cjs +0 -51
- package/InfoBlock.mjs +0 -27
- package/InfoHero.cjs +0 -150
- package/InfoHero.mjs +0 -128
- package/IslandBlock.cjs +0 -63
- package/IslandBlock.mjs +0 -41
- package/IslandPageBlock.cjs +0 -49
- package/IslandPageBlock.mjs +0 -25
- package/LabeledTextBlock.cjs +0 -60
- package/LabeledTextBlock.mjs +0 -38
- package/Layout.cjs +0 -113
- package/Layout.mjs +0 -87
- package/MainMenu/_Auxiliary.cjs +0 -54
- package/MainMenu/_Auxiliary.mjs +0 -28
- package/MainMenu/_PrimaryPanel.cjs +0 -74
- package/MainMenu/_PrimaryPanel.mjs +0 -48
- package/MainMenu.cjs +0 -209
- package/MainMenu.mjs +0 -187
- package/MiniMetrics.cjs +0 -56
- package/MiniMetrics.mjs +0 -34
- package/Modal.cjs +0 -70
- package/Modal.mjs +0 -48
- package/NameCard.cjs +0 -115
- package/NameCard.mjs +0 -91
- package/NameCards.cjs +0 -52
- package/NameCards.mjs +0 -30
- package/NewsHero.cjs +0 -136
- package/NewsHero.mjs +0 -114
- package/PageFilter.cjs +0 -48
- package/PageFilter.mjs +0 -24
- package/PageHeading.cjs +0 -42
- package/PageHeading.mjs +0 -18
- package/ProcessOverview.cjs +0 -52
- package/ProcessOverview.mjs +0 -28
- package/PullQuote.cjs +0 -47
- package/PullQuote.mjs +0 -25
- package/RadioButtonsGroup.cjs +0 -64
- package/RadioButtonsGroup.mjs +0 -42
- package/RadioGroup.cjs +0 -58
- package/RadioGroup.mjs +0 -36
- package/RelatedLinks.cjs +0 -61
- package/RelatedLinks.mjs +0 -37
- package/RowBlock.cjs +0 -39
- package/RowBlock.mjs +0 -15
- package/RowBlockColumn.cjs +0 -40
- package/RowBlockColumn.mjs +0 -16
- package/SearchInput.cjs +0 -136
- package/SearchInput.mjs +0 -114
- package/SearchResults/_SearchResultsItem.cjs +0 -54
- package/SearchResults/_SearchResultsItem.mjs +0 -30
- package/SearchResults.cjs +0 -172
- package/SearchResults.mjs +0 -150
- package/SeenEffect.cjs +0 -66
- package/SeenEffect.mjs +0 -44
- package/Selectbox.cjs +0 -144
- package/Selectbox.mjs +0 -122
- package/ShareButtons.cjs +0 -101
- package/ShareButtons.mjs +0 -83
- package/Sharpie.cjs +0 -51
- package/Sharpie.mjs +0 -27
- package/SiteSearchAutocomplete.cjs +0 -150
- package/SiteSearchAutocomplete.mjs +0 -126
- package/SiteSearchCurtain.cjs +0 -78
- package/SiteSearchCurtain.mjs +0 -56
- package/SiteSearchInput.cjs +0 -119
- package/SiteSearchInput.mjs +0 -97
- package/Skeleton.cjs +0 -63
- package/Skeleton.mjs +0 -39
- package/SubHeading.cjs +0 -43
- package/SubHeading.mjs +0 -19
- package/Tabs.cjs +0 -166
- package/Tabs.mjs +0 -144
- package/TagPill.cjs +0 -113
- package/TagPill.mjs +0 -91
- package/TextBlock.cjs +0 -45
- package/TextBlock.mjs +0 -21
- package/TextButton.cjs +0 -55
- package/TextButton.mjs +0 -33
- package/TextInput.cjs +0 -136
- package/TextInput.mjs +0 -114
- package/VSpacer.cjs +0 -70
- package/VSpacer.mjs +0 -46
- package/VerticalTabsTOC.cjs +0 -123
- package/VerticalTabsTOC.mjs +0 -101
- package/WizardLayout.cjs +0 -79
- package/WizardLayout.mjs +0 -55
- package/WizardLayoutClose.cjs +0 -47
- package/WizardLayoutClose.mjs +0 -25
- package/WizardStepper.cjs +0 -55
- package/WizardStepper.mjs +0 -31
- package/_abstract/Button.cjs +0 -114
- package/_abstract/Button.mjs +0 -92
- package/_abstract/CardList.cjs +0 -100
- package/_abstract/CardList.mjs +0 -76
- package/_abstract/Image.cjs +0 -75
- package/_abstract/Image.mjs +0 -51
- package/_abstract/Link.cjs +0 -37
- package/_abstract/Link.mjs +0 -10
- package/_abstract/TogglerGroup.cjs +0 -92
- package/_abstract/TogglerGroup.mjs +0 -70
- package/_abstract/TogglerGroupField.cjs +0 -121
- package/_abstract/TogglerGroupField.mjs +0 -99
- package/_abstract/TogglerInput.cjs +0 -105
- package/_abstract/TogglerInput.mjs +0 -83
- package/_abstract/_AbstractCarousel.cjs +0 -170
- package/_abstract/_AbstractCarousel.mjs +0 -152
- package/_abstract/_Blings.cjs +0 -47
- package/_abstract/_Blings.mjs +0 -23
- package/_abstract/_Block.cjs +0 -73
- package/_abstract/_Block.mjs +0 -51
- package/_abstract/_Quote.cjs +0 -43
- package/_abstract/_Quote.mjs +0 -17
- package/_abstract/breakOnNL.cjs +0 -30
- package/_abstract/breakOnNL.mjs +0 -6
- package/assets.cjs +0 -77
- package/assets.mjs +0 -53
- package/constants.cjs +0 -49
- package/constants.mjs +0 -24
- package/focus-visible.cjs +0 -1
- package/focus-visible.mjs +0 -1
- package/utils/config.cjs +0 -27
- package/utils/config.d.ts +0 -2
- package/utils/config.mjs +0 -4
- package/utils/detectEdgeScroll.cjs +0 -95
- package/utils/detectEdgeScroll.d.ts +0 -52
- package/utils/detectEdgeScroll.mjs +0 -71
- package/utils/env.cjs +0 -31
- package/utils/env.mjs +0 -5
- package/utils/seenEffect.cjs +0 -93
- package/utils/seenEffect.mjs +0 -65
- package/utils/useFormatMonitor.cjs +0 -29
- package/utils/useFormatMonitor.mjs +0 -6
- package/utils/useGetSVGtext.cjs +0 -44
- package/utils/useGetSVGtext.mjs +0 -21
- package/utils/useMenuToggling.cjs +0 -83
- package/utils/useMenuToggling.mjs +0 -60
- package/utils/useScrollbarWidthCSSVar.cjs +0 -32
- package/utils/useScrollbarWidthCSSVar.mjs +0 -6
- package/utils.cjs +0 -18
- package/utils.mjs +0 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FormFieldWrappingProps } from './FormField';
|
|
2
|
+
declare type dropzonePropsProps = {
|
|
3
|
+
accept?: string;
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare type FileInputProps = {
|
|
7
|
+
dropzoneProps: dropzonePropsProps;
|
|
8
|
+
dropzoneText: string | JSX.Element;
|
|
9
|
+
showFileSize?: boolean;
|
|
10
|
+
showImagePreviews?: boolean;
|
|
11
|
+
removeFileText: string;
|
|
12
|
+
onFilesUpdated?: (files: Array<File>) => void;
|
|
13
|
+
name?: string;
|
|
14
|
+
value?: ReadonlyArray<File>;
|
|
15
|
+
} & FormFieldWrappingProps;
|
|
16
|
+
declare const FileInput: (props: FileInputProps) => JSX.Element;
|
|
17
|
+
export default FileInput;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
13
|
+
import { useDropzone } from 'react-dropzone'; // https://react-dropzone.js.org/#!/Dropzone
|
|
14
|
+
import { useDomid } from '@hugsmidjan/react/hooks';
|
|
15
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
16
|
+
import FormField from './FormField';
|
|
17
|
+
/**
|
|
18
|
+
* Attaches a `preview` prop to file objects that don't already have a `preview` key defined
|
|
19
|
+
*
|
|
20
|
+
* The preview's value is either a data URI (for image-type files) or `undefined`
|
|
21
|
+
*/
|
|
22
|
+
const addPreview = (file) => {
|
|
23
|
+
if (!('preview' in file)) {
|
|
24
|
+
file.preview = file.type.includes('image/') ? URL.createObjectURL(file) : undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Revokes `preview` data URIs to avoid memory leaks
|
|
29
|
+
*
|
|
30
|
+
* (See: https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL)
|
|
31
|
+
*/
|
|
32
|
+
const releasePreview = (file) => {
|
|
33
|
+
file.preview && URL.revokeObjectURL(file.preview);
|
|
34
|
+
delete file.preview;
|
|
35
|
+
};
|
|
36
|
+
const arrayToFileList = (arr) => {
|
|
37
|
+
const fileList = new DataTransfer();
|
|
38
|
+
arr.forEach((item) => {
|
|
39
|
+
fileList.items.add(item);
|
|
40
|
+
});
|
|
41
|
+
return fileList.files;
|
|
42
|
+
};
|
|
43
|
+
const dedupeFilesArray = (files) => {
|
|
44
|
+
const newArray = [];
|
|
45
|
+
const found = {};
|
|
46
|
+
files.forEach((file) => {
|
|
47
|
+
if (!(file.name in found)) {
|
|
48
|
+
newArray.push(file);
|
|
49
|
+
found[file.name] = true;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
releasePreview(file);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return newArray;
|
|
56
|
+
};
|
|
57
|
+
const formatBytes = (bytes, decimals = 2) => {
|
|
58
|
+
if (bytes === 0) {
|
|
59
|
+
return '0 Bytes';
|
|
60
|
+
}
|
|
61
|
+
const k = 1024;
|
|
62
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
63
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
64
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i];
|
|
65
|
+
};
|
|
66
|
+
const FileInput = (props) => {
|
|
67
|
+
const { className, id, label, hideLabel, dropzoneProps = { multiple: true }, dropzoneText, removeFileText, assistText, disabled, invalid, errorMessage, required, reqText, onFilesUpdated = () => undefined, showFileSize, showImagePreviews, value = [] } = props, inputElementProps = __rest(props, ["className", "id", "label", "hideLabel", "dropzoneProps", "dropzoneText", "removeFileText", "assistText", "disabled", "invalid", "errorMessage", "required", "reqText", "onFilesUpdated", "showFileSize", "showImagePreviews", "value"]);
|
|
68
|
+
const domid = useDomid(id);
|
|
69
|
+
const fileInputWrapper = useRef(null);
|
|
70
|
+
const fileInput = useRef(null);
|
|
71
|
+
const files = value;
|
|
72
|
+
const [isHover, setIsHover] = useState(false);
|
|
73
|
+
const { getRootProps, getInputProps, isDragReject, inputRef } = useDropzone(Object.assign({ onDrop: (acceptedFiles) => {
|
|
74
|
+
acceptedFiles = acceptedFiles.map((file) => {
|
|
75
|
+
addPreview(file);
|
|
76
|
+
return file;
|
|
77
|
+
});
|
|
78
|
+
addFiles(acceptedFiles); // eslint-disable-line
|
|
79
|
+
setIsHover(false);
|
|
80
|
+
}, onDropRejected: (rejectedFiles) => {
|
|
81
|
+
window.alert('Error:\n' +
|
|
82
|
+
rejectedFiles
|
|
83
|
+
.map((elm) => {
|
|
84
|
+
return elm.name;
|
|
85
|
+
})
|
|
86
|
+
.join(', '));
|
|
87
|
+
}, onDragEnter: () => {
|
|
88
|
+
// 'dragLeave' always fires right after 'dragEnter', use 'dragOver' instead
|
|
89
|
+
// console.log('enter');
|
|
90
|
+
// setIsHover(true);
|
|
91
|
+
}, onDragLeave: () => {
|
|
92
|
+
// console.log('leave');
|
|
93
|
+
setIsHover(false);
|
|
94
|
+
}, onDragOver: () => {
|
|
95
|
+
// TODO: add error icon? 'isDragReject' gives unstable results
|
|
96
|
+
// console.log(isDragReject);
|
|
97
|
+
setIsHover(true);
|
|
98
|
+
} }, dropzoneProps));
|
|
99
|
+
// Add previews on incoming files
|
|
100
|
+
// (NOTE: `addPreview` ignores files that already have preview.)
|
|
101
|
+
files.forEach(addPreview);
|
|
102
|
+
useEffect(() => () => {
|
|
103
|
+
// Make sure to revoke the data uris on unmount to avoid memory leaks
|
|
104
|
+
files.forEach(releasePreview);
|
|
105
|
+
}, [files]);
|
|
106
|
+
const removeFile = (name) => {
|
|
107
|
+
if (fileInput.current) {
|
|
108
|
+
const newFileList = files.filter((file) => {
|
|
109
|
+
if (file.name !== name) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
releasePreview(file);
|
|
113
|
+
});
|
|
114
|
+
fileInput.current.files = arrayToFileList(newFileList);
|
|
115
|
+
onFilesUpdated(newFileList);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const addFiles = (filelist) => {
|
|
119
|
+
if (fileInput.current) {
|
|
120
|
+
const newFileList = dropzoneProps.multiple
|
|
121
|
+
? dedupeFilesArray(files.concat(filelist))
|
|
122
|
+
: filelist;
|
|
123
|
+
fileInput.current.files = arrayToFileList(newFileList);
|
|
124
|
+
onFilesUpdated(newFileList);
|
|
125
|
+
}
|
|
126
|
+
if (inputRef.current) {
|
|
127
|
+
// Empty on every add
|
|
128
|
+
inputRef.current.files = arrayToFileList([]);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const filesList = files.map((file) => (<li key={file.name} className="FileInput__file">
|
|
132
|
+
<button className="FileInput__file-remove" type="button" onClick={() => removeFile(file.name)} aria-label={removeFileText}>
|
|
133
|
+
{removeFileText}
|
|
134
|
+
</button>
|
|
135
|
+
<span className="FileInput__fileinfo">
|
|
136
|
+
{showImagePreviews && file.preview && (<>
|
|
137
|
+
<span className="FileInput__preview">
|
|
138
|
+
<img src={file.preview}/>
|
|
139
|
+
</span>{' '}
|
|
140
|
+
</>)}
|
|
141
|
+
<span className="FileInput__filename">{file.name}</span>
|
|
142
|
+
{showFileSize && (<small className="FileInput__filesize"> - ({formatBytes(file.size)})</small>)}
|
|
143
|
+
</span>
|
|
144
|
+
</li>));
|
|
145
|
+
return (<FormField className={getBemClass('FileInput', [dropzoneProps.multiple && 'multi'], className)} label={label} id={domid + '-fake'} LabelTag="h4" assistText={assistText} hideLabel={hideLabel} disabled={disabled} invalid={invalid} errorMessage={errorMessage} required={required} reqText={reqText} renderInput={(className, inputProps /* , addFocusProps */) => {
|
|
146
|
+
return (<div className={className.control} ref={fileInputWrapper}>
|
|
147
|
+
<input className="FileInput__input" name={inputElementProps.name} id={domid} ref={fileInput} type="file" style={{ display: 'none' }} multiple={dropzoneProps.multiple || undefined} required={inputProps.required} // ??? Bad idea ?? Scream test!!
|
|
148
|
+
/>{' '}
|
|
149
|
+
<input className="FileInput__input--fake" {...getInputProps()} tabIndex={undefined} style={undefined} multiple={dropzoneProps.multiple || undefined} {...inputProps} required={undefined}/>{' '}
|
|
150
|
+
<div className={getBemClass('FileInput__dropzone', [isHover && 'highlight'])} {...getRootProps({ isDragReject })} tabIndex={undefined}>
|
|
151
|
+
<p className="FileInput__droptext">{dropzoneText}</p>
|
|
152
|
+
</div>
|
|
153
|
+
{filesList.length ? <ul className="FileInput__filelist">{filesList}</ul> : ''}
|
|
154
|
+
</div>);
|
|
155
|
+
}}/>);
|
|
156
|
+
};
|
|
157
|
+
export default FileInput;
|
package/esm/Foonote.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FootnoteProps as _FootnoteProps } from './Footnote';
|
|
2
|
+
/** @deprecated (Will be removed in v0.11)
|
|
3
|
+
*
|
|
4
|
+
* This module file is a typo. import from `Footnote` instead
|
|
5
|
+
*/
|
|
6
|
+
export declare type FootnoteProps = _FootnoteProps;
|
|
7
|
+
/** @deprecated (Will be removed in v0.11)
|
|
8
|
+
*
|
|
9
|
+
* This module file is a typo. import from `Footnote` instead
|
|
10
|
+
*/
|
|
11
|
+
declare const Footnote: (props: _FootnoteProps) => JSX.Element;
|
|
12
|
+
export default Footnote;
|
package/esm/Foonote.jsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from './_abstract/Link';
|
|
3
|
+
const FooterBadges = (props) => {
|
|
4
|
+
if (!props.badges.length) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
return (<ul className="FooterBadges">
|
|
8
|
+
{props.badges.map(({ altText, src, href }, i) => (<li key={i} className="FooterBadges__badge">
|
|
9
|
+
{href ? (<Link href={href}>
|
|
10
|
+
{' '}
|
|
11
|
+
<img src={src} alt={altText}/>{' '}
|
|
12
|
+
</Link>) : (<img src={src} alt={altText}/>)}
|
|
13
|
+
</li>))}
|
|
14
|
+
</ul>);
|
|
15
|
+
};
|
|
16
|
+
export default FooterBadges;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
2
|
+
export declare type FooterInfoGroup = {
|
|
3
|
+
title: string;
|
|
4
|
+
role?: JSX.IntrinsicElements['div']['role'];
|
|
5
|
+
modifier?: string;
|
|
6
|
+
} & BemPropsModifier & ({
|
|
7
|
+
content: JSX.Element;
|
|
8
|
+
html?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
html: string;
|
|
11
|
+
content?: undefined;
|
|
12
|
+
});
|
|
13
|
+
export declare type FooterInfoBoxes = Array<FooterInfoGroup>;
|
|
14
|
+
export declare type FooterInfoProps = {
|
|
15
|
+
boxes: FooterInfoBoxes;
|
|
16
|
+
};
|
|
17
|
+
declare const FooterInfo: (props: FooterInfoProps) => JSX.Element;
|
|
18
|
+
export default FooterInfo;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
const FooterInfo = (props) => {
|
|
4
|
+
const { boxes } = props;
|
|
5
|
+
return (<div className="FooterInfo">
|
|
6
|
+
{boxes.map((group, i) => (<div className={getBemClass('FooterInfo__group', group.modifier)} role={group.role} key={i}>
|
|
7
|
+
<h3 className="FooterInfo__grouptitle">{group.title}</h3>
|
|
8
|
+
{group.content ? (<div className={getBemClass('FooterInfo__groupcontent', group.modifier)}>
|
|
9
|
+
{group.content}
|
|
10
|
+
</div>) : (<div className={getBemClass('FooterInfo__groupcontent', group.modifier)} dangerouslySetInnerHTML={{ __html: group.html }}/>)}
|
|
11
|
+
</div>))}
|
|
12
|
+
</div>);
|
|
13
|
+
};
|
|
14
|
+
export default FooterInfo;
|
package/esm/Footnote.jsx
ADDED
package/esm/Form.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ComponentLayoutProps } from './constants';
|
|
3
|
+
export declare type FormProps = ComponentLayoutProps & React.FormHTMLAttributes<HTMLFormElement> & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
declare const Form: (props: FormProps) => JSX.Element;
|
|
7
|
+
export default Form;
|
package/esm/Form.jsx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
const Form = (props) => {
|
|
4
|
+
const { children, align, wide } = props;
|
|
5
|
+
return (<form {...props} className={getBemClass('Form', [
|
|
6
|
+
align === 'right' && 'align--' + align,
|
|
7
|
+
!align && wide && 'wide',
|
|
8
|
+
])}>
|
|
9
|
+
{children}
|
|
10
|
+
</form>);
|
|
11
|
+
};
|
|
12
|
+
export default Form;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { SSRSupport } from '@hugsmidjan/react/hooks';
|
|
3
|
+
declare type InputClassNames = {
|
|
4
|
+
/** Basic/raw FormField BEM name */
|
|
5
|
+
bem: string;
|
|
6
|
+
/** Standard name for "<input/>"-styled controls */
|
|
7
|
+
input: string;
|
|
8
|
+
/** Standard name for radio/checkbox group conotrols */
|
|
9
|
+
options: string;
|
|
10
|
+
/** Generic name for unstyled/free-form controls. */
|
|
11
|
+
control: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type FormFieldInputProps = {
|
|
14
|
+
id?: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
19
|
+
'aria-labelledby'?: string;
|
|
20
|
+
'aria-describedby'?: string;
|
|
21
|
+
};
|
|
22
|
+
declare type FocusEvents = {
|
|
23
|
+
onFocus?: (e: any) => void;
|
|
24
|
+
onBlur?: (e: any) => void;
|
|
25
|
+
};
|
|
26
|
+
declare type FocusPropMaker = <P extends FocusEvents>(ownProps?: P) => P & Required<FocusEvents>;
|
|
27
|
+
export declare type FormFieldWrappingProps = {
|
|
28
|
+
/** Container className - alongside "FormField" */
|
|
29
|
+
className?: string;
|
|
30
|
+
label: string | JSX.Element;
|
|
31
|
+
assistText?: string | JSX.Element;
|
|
32
|
+
hideLabel?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
readOnly?: boolean;
|
|
35
|
+
invalid?: boolean;
|
|
36
|
+
errorMessage?: string | JSX.Element;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
/** Hidden label prefix text to indicate that the field is required.
|
|
39
|
+
*
|
|
40
|
+
* If your field is required but should not say so in its label
|
|
41
|
+
* then set this prop to `false`
|
|
42
|
+
*
|
|
43
|
+
* Default: `"Þarf að fylla út"`
|
|
44
|
+
* */
|
|
45
|
+
reqText?: string | false;
|
|
46
|
+
/** Optional pre-determinted id="" for the __input */
|
|
47
|
+
id?: string;
|
|
48
|
+
/** Ref object pointing to the outermost `.FormField` element */
|
|
49
|
+
wrapperRef?: RefObject<HTMLElement>;
|
|
50
|
+
ssr?: SSRSupport;
|
|
51
|
+
};
|
|
52
|
+
export declare type FormFieldGroupWrappingProps = FormFieldWrappingProps & {
|
|
53
|
+
LabelTag?: 'h3' | 'h4' | 'h5';
|
|
54
|
+
};
|
|
55
|
+
export declare type FormFieldProps = FormFieldGroupWrappingProps & {
|
|
56
|
+
/** Container className - alongside "FormField" */
|
|
57
|
+
className: string;
|
|
58
|
+
small?: boolean;
|
|
59
|
+
group?: boolean;
|
|
60
|
+
empty?: boolean;
|
|
61
|
+
filled?: boolean;
|
|
62
|
+
renderInput(className: InputClassNames, inputProps: FormFieldInputProps, addFocusProps: FocusPropMaker, isBrowser?: boolean): JSX.Element;
|
|
63
|
+
};
|
|
64
|
+
declare const FormField: (props: FormFieldProps) => JSX.Element;
|
|
65
|
+
export default FormField;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { useDomid, useIsBrowserSide } from '@hugsmidjan/react/hooks';
|
|
3
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
4
|
+
import { isPreact } from './utils/env';
|
|
5
|
+
const inputClassNames = {
|
|
6
|
+
bem: 'FormField',
|
|
7
|
+
input: 'FormField__input',
|
|
8
|
+
options: 'FormField__options',
|
|
9
|
+
control: 'FormField__control',
|
|
10
|
+
};
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// eslint-disable-next-line complexity
|
|
13
|
+
const FormField = (props) => {
|
|
14
|
+
const { className, small, group, LabelTag = group ? 'h4' : undefined, label, assistText, hideLabel, empty, filled, readOnly, disabled, invalid, errorMessage, required, reqText, // i18n
|
|
15
|
+
renderInput, id, ssr, } = props;
|
|
16
|
+
const isBrowser = useIsBrowserSide(ssr);
|
|
17
|
+
const isInvalid = invalid || !!errorMessage || undefined;
|
|
18
|
+
const domid = useDomid(id);
|
|
19
|
+
const [focused, setFocused] = useState(false);
|
|
20
|
+
// @ts-expect-error (Duck knows why this errors?!)
|
|
21
|
+
const addFocusProps = useCallback((ownProps) => {
|
|
22
|
+
const { onFocus, onBlur } = ownProps || {};
|
|
23
|
+
const focusHandler = (e) => {
|
|
24
|
+
if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
|
|
25
|
+
setFocused(true);
|
|
26
|
+
}
|
|
27
|
+
onFocus && onFocus(e);
|
|
28
|
+
};
|
|
29
|
+
const blurHandler = (e) => {
|
|
30
|
+
if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
|
|
31
|
+
setFocused(false);
|
|
32
|
+
}
|
|
33
|
+
onBlur && onBlur(e);
|
|
34
|
+
};
|
|
35
|
+
const focusProps = Object.assign(Object.assign({}, ownProps), { onFocus: focusHandler, onBlur: blurHandler });
|
|
36
|
+
if (isPreact) {
|
|
37
|
+
const focusinHandler = (e) => {
|
|
38
|
+
e.currentTarget !== e.target && focusHandler(e);
|
|
39
|
+
};
|
|
40
|
+
const focusoutHandler = (e) => {
|
|
41
|
+
e.currentTarget !== e.target && blurHandler(e);
|
|
42
|
+
};
|
|
43
|
+
// @ts-expect-error (Sneak this in as Preact does not bubble `FocusEvent`s)
|
|
44
|
+
focusProps.onfocusin = focusinHandler;
|
|
45
|
+
// @ts-expect-error (Sneak this in as Preact does not bubble `FocusEvent`s)
|
|
46
|
+
focusProps.onfocusout = focusoutHandler;
|
|
47
|
+
}
|
|
48
|
+
return focusProps;
|
|
49
|
+
}, []);
|
|
50
|
+
const errorId = errorMessage ? 'error:' + domid : undefined;
|
|
51
|
+
const assistTextId = assistText ? 'assist:' + domid : undefined;
|
|
52
|
+
const labelId = LabelTag ? 'label:' + domid : undefined;
|
|
53
|
+
const reqStar = required && reqText !== false && (<abbr className={'FormField__label__reqstar'}
|
|
54
|
+
// TODO: add mo-better i18n thinking
|
|
55
|
+
title={(reqText || 'Þarf að fylla út') + ': '}>
|
|
56
|
+
*
|
|
57
|
+
</abbr>);
|
|
58
|
+
const inputProps = {
|
|
59
|
+
id: domid,
|
|
60
|
+
disabled: disabled,
|
|
61
|
+
required: required,
|
|
62
|
+
readOnly: readOnly,
|
|
63
|
+
'aria-invalid': isInvalid,
|
|
64
|
+
'aria-describedby': assistTextId && errorId ? assistTextId + ' ' + errorId : assistTextId || errorId,
|
|
65
|
+
'aria-labelledby': labelId, // undefined if normalLabel
|
|
66
|
+
};
|
|
67
|
+
return (<div className={getBemClass('FormField', [
|
|
68
|
+
small && 'small',
|
|
69
|
+
hideLabel && 'nolabel',
|
|
70
|
+
isInvalid && 'invalid',
|
|
71
|
+
disabled && 'disabled',
|
|
72
|
+
readOnly && 'readonly',
|
|
73
|
+
isBrowser && empty && 'empty',
|
|
74
|
+
isBrowser && filled && 'filled',
|
|
75
|
+
isBrowser && focused && 'focused',
|
|
76
|
+
], className)} role={group ? 'group' : undefined} ref={props.wrapperRef}>
|
|
77
|
+
{LabelTag ? (<LabelTag className={'FormField__label'} id={labelId}>
|
|
78
|
+
{' '}
|
|
79
|
+
{reqStar} {label}{' '}
|
|
80
|
+
</LabelTag>) : (<label className={'FormField__label'} htmlFor={domid}>
|
|
81
|
+
{' '}
|
|
82
|
+
{reqStar} {label}{' '}
|
|
83
|
+
</label>)}{' '}
|
|
84
|
+
{renderInput(inputClassNames, inputProps, addFocusProps, isBrowser)}
|
|
85
|
+
{assistText && (<div id={assistTextId} className={'FormField__assist'}>
|
|
86
|
+
{assistText}
|
|
87
|
+
</div>)}
|
|
88
|
+
{errorMessage && (<div id={errorId} className={'FormField__error'}>
|
|
89
|
+
{errorMessage}
|
|
90
|
+
</div>)}
|
|
91
|
+
</div>);
|
|
92
|
+
};
|
|
93
|
+
export default FormField;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ImageProps } from '../_abstract/Image';
|
|
2
|
+
export declare type GalleryItemProps = {
|
|
3
|
+
caption?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
largeImageSrc?: string;
|
|
6
|
+
} & ImageProps;
|
|
7
|
+
declare const GalleryItem: (props: GalleryItemProps) => JSX.Element;
|
|
8
|
+
export default GalleryItem;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { useContext } from 'react';
|
|
13
|
+
import Button from '../_abstract/Button';
|
|
14
|
+
import Image from '../_abstract/Image';
|
|
15
|
+
import GalleryModalContext from './_GalleryModalContext';
|
|
16
|
+
const GalleryItem = (props) => {
|
|
17
|
+
const { caption, description, largeImageSrc } = props, image = __rest(props, ["caption", "description", "largeImageSrc"]);
|
|
18
|
+
const { setCurrentImage } = useContext(GalleryModalContext);
|
|
19
|
+
return (<figure className="GalleryItem">
|
|
20
|
+
<figcaption className="GalleryItem__caption">{caption}</figcaption>
|
|
21
|
+
{largeImageSrc ? (<Button bem="GalleryItem__button" href={largeImageSrc} onClick={(e) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
setCurrentImage(Object.assign(Object.assign({}, image), { caption, description, largeImageSrc }));
|
|
24
|
+
}}>
|
|
25
|
+
{' '}
|
|
26
|
+
<Image className="GalleryItem__image" {...image}/>{' '}
|
|
27
|
+
</Button>) : (<Image className="GalleryItem__image" {...image}/>)}
|
|
28
|
+
{description && <div className="GalleryItem__description">{description}</div>}
|
|
29
|
+
</figure>);
|
|
30
|
+
};
|
|
31
|
+
export default GalleryItem;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { CSSTransition } from 'react-transition-group';
|
|
3
|
+
import { objectClean, objectIsSame } from '@hugsmidjan/qj/object';
|
|
4
|
+
import CarouselPaging from '@hugsmidjan/react/CarouselPaging';
|
|
5
|
+
import Modal from '@hugsmidjan/react/Modal';
|
|
6
|
+
import GalleryModalContext from './_GalleryModalContext';
|
|
7
|
+
import GalleryModalItem from './_GalleryModalItem';
|
|
8
|
+
const GalleryModal = (props) => {
|
|
9
|
+
const { texts } = props;
|
|
10
|
+
const { currentImage, items, setCurrentImage } = useContext(GalleryModalContext);
|
|
11
|
+
const [image, setImage] = useState(currentImage);
|
|
12
|
+
const [animated, setAnimated] = useState(false);
|
|
13
|
+
const updateImage = (index) => {
|
|
14
|
+
setAnimated(!animated);
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
setCurrentImage(items[index]);
|
|
17
|
+
}, 200);
|
|
18
|
+
};
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (image !== currentImage) {
|
|
21
|
+
const imgSource = (currentImage === null || currentImage === void 0 ? void 0 : currentImage.largeImageSrc) || (currentImage === null || currentImage === void 0 ? void 0 : currentImage.src);
|
|
22
|
+
if (imgSource) {
|
|
23
|
+
const imageToLoad = new window.Image();
|
|
24
|
+
imageToLoad.src = imgSource;
|
|
25
|
+
imageToLoad.onload = () => {
|
|
26
|
+
setImage(currentImage);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
setImage(undefined);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [image, currentImage]);
|
|
34
|
+
if (!image) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const imageIndex = items.findIndex((item) =>
|
|
38
|
+
// FIXME: This if weirdly inefficient. Either memoize,
|
|
39
|
+
// or do a simpler single-property comparison.
|
|
40
|
+
objectIsSame(objectClean(image), objectClean(item)));
|
|
41
|
+
return (<Modal open={true} onClosed={() => {
|
|
42
|
+
setCurrentImage(undefined);
|
|
43
|
+
}} startOpen={false} bem="GalleryModal" texts={{ closeButton: texts.modalCloseLabel }}>
|
|
44
|
+
<>
|
|
45
|
+
<CSSTransition in={animated} timeout={200} onEntered={() => {
|
|
46
|
+
setAnimated(!animated);
|
|
47
|
+
}} classNames="GalleryModalItem--">
|
|
48
|
+
<GalleryModalItem {...image}/>
|
|
49
|
+
</CSSTransition>
|
|
50
|
+
|
|
51
|
+
<CarouselPaging bem="GalleryModalPager" itemCount={items.length} current={imageIndex} setCurrent={updateImage} texts={{
|
|
52
|
+
next: texts.modalNextLabel,
|
|
53
|
+
prev: texts.modalPrevLabel,
|
|
54
|
+
}}/>
|
|
55
|
+
</>
|
|
56
|
+
</Modal>);
|
|
57
|
+
};
|
|
58
|
+
export default GalleryModal;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GalleryProps } from '../Gallery';
|
|
3
|
+
import { GalleryItemProps } from './_GalleryItem';
|
|
4
|
+
declare type ModalContextProps = {
|
|
5
|
+
setCurrentImage: (item: GalleryItemProps | undefined) => void;
|
|
6
|
+
currentImage: GalleryItemProps | undefined;
|
|
7
|
+
} & GalleryProps;
|
|
8
|
+
declare const GalleryModalContext: React.Context<ModalContextProps>;
|
|
9
|
+
export default GalleryModalContext;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import Image from '../_abstract/Image';
|
|
14
|
+
const GalleryModalItem = (props) => {
|
|
15
|
+
const { caption, description } = props, image = __rest(props, ["caption", "description"]);
|
|
16
|
+
return (<div className="GalleryModalItem">
|
|
17
|
+
{(caption || description) && (<div className="GalleryModalItem__text">
|
|
18
|
+
<div className="GalleryModalItem__caption">{caption}</div>
|
|
19
|
+
<div className="GalleryModalItem__description">{description}</div>
|
|
20
|
+
</div>)}
|
|
21
|
+
<Image className="GalleryModalItem__image" src={image.largeImageSrc || image.src}/>
|
|
22
|
+
</div>);
|
|
23
|
+
};
|
|
24
|
+
export default GalleryModalItem;
|
package/esm/Gallery.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SSRSupport } from '@hugsmidjan/react/hooks';
|
|
2
|
+
import { GalleryItemProps } from './Gallery/_GalleryItem';
|
|
3
|
+
import { SeenProp } from './utils/seenEffect';
|
|
4
|
+
export type { GalleryItemProps } from './Gallery/_GalleryItem';
|
|
5
|
+
export declare type GalleryI18n = {
|
|
6
|
+
modalNextLabel: string;
|
|
7
|
+
modalPrevLabel: string;
|
|
8
|
+
modalCloseLabel: string;
|
|
9
|
+
};
|
|
10
|
+
export declare type GalleryProps = {
|
|
11
|
+
items: Array<GalleryItemProps>;
|
|
12
|
+
texts?: GalleryI18n;
|
|
13
|
+
lang?: string;
|
|
14
|
+
ssr?: SSRSupport;
|
|
15
|
+
} & SeenProp;
|
|
16
|
+
declare const Gallery: (props: GalleryProps) => JSX.Element;
|
|
17
|
+
export default Gallery;
|
package/esm/Gallery.jsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { getTexts } from '@reykjavik/hanna-utils/i18n';
|
|
3
|
+
import AbstractCarousel from './_abstract/_AbstractCarousel';
|
|
4
|
+
import GalleryItem from './Gallery/_GalleryItem';
|
|
5
|
+
import GalleryModal from './Gallery/_GalleryModal';
|
|
6
|
+
import GalleryModalContext from './Gallery/_GalleryModalContext';
|
|
7
|
+
const defaultTexts = {
|
|
8
|
+
en: {
|
|
9
|
+
modalNextLabel: 'Next image',
|
|
10
|
+
modalPrevLabel: 'Previous image',
|
|
11
|
+
modalCloseLabel: 'Back to article',
|
|
12
|
+
},
|
|
13
|
+
is: {
|
|
14
|
+
modalNextLabel: 'Næsta mynd',
|
|
15
|
+
modalPrevLabel: 'Fyrri mynd',
|
|
16
|
+
modalCloseLabel: 'Til baka í grein',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const Gallery = (props) => {
|
|
20
|
+
const { items, ssr, startSeen } = props;
|
|
21
|
+
const texts = getTexts(props, defaultTexts);
|
|
22
|
+
const [modalImage, setModalImage] = useState(undefined);
|
|
23
|
+
return (<GalleryModalContext.Provider value={{ items, setCurrentImage: setModalImage, currentImage: modalImage }}>
|
|
24
|
+
<AbstractCarousel bem="Gallery" items={items} Component={GalleryItem} ssr={ssr} startSeen={startSeen}/>
|
|
25
|
+
<GalleryModal {...modalImage} texts={texts}/>
|
|
26
|
+
</GalleryModalContext.Provider>);
|
|
27
|
+
};
|
|
28
|
+
export default Gallery;
|