@reykjavik/hanna-react 0.10.84 → 0.10.85
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.d.ts +2 -2
- package/AccordionList.js +5 -5
- package/ActionCards.d.ts +2 -2
- package/ActionCards.js +4 -4
- package/Alert.d.ts +1 -1
- package/Alert.js +6 -6
- package/ArticleCards.d.ts +1 -1
- package/ArticleCards.js +2 -2
- package/ArticleCarousel/_ArticleCarouselCard.d.ts +2 -2
- package/ArticleCarousel/_ArticleCarouselCard.js +7 -7
- package/ArticleCarousel.d.ts +3 -3
- package/ArticleCarousel.js +3 -3
- package/ArticleMeta.js +2 -2
- package/BasicTable.d.ts +1 -1
- package/BasicTable.js +2 -2
- package/BgBox.d.ts +1 -1
- package/BgBox.js +3 -3
- package/Bling.js +2 -2
- package/BlockQuote.d.ts +1 -1
- package/BlockQuote.js +2 -2
- package/BreadCrumbs.js +2 -2
- package/ButtonBack.d.ts +1 -1
- package/ButtonBack.js +2 -2
- package/ButtonPrimary.d.ts +1 -1
- package/ButtonPrimary.js +2 -2
- package/ButtonSecondary.d.ts +1 -1
- package/ButtonSecondary.js +2 -2
- package/ButtonTertiary.d.ts +1 -1
- package/ButtonTertiary.js +2 -2
- package/CHANGELOG.md +7 -0
- package/Carousel.d.ts +2 -2
- package/Carousel.js +2 -2
- package/CenterColumn.d.ts +1 -1
- package/CenterColumn.js +2 -2
- package/Checkbox.d.ts +1 -1
- package/Checkbox.js +2 -2
- package/CheckboxButton.d.ts +1 -1
- package/CheckboxButton.js +2 -2
- package/CheckboxButtonsGroup.d.ts +1 -1
- package/CheckboxButtonsGroup.js +3 -3
- package/CheckboxGroup.d.ts +1 -1
- package/CheckboxGroup.js +3 -3
- package/CityBlock.d.ts +4 -4
- package/CityBlock.js +4 -4
- package/ContactBubble.d.ts +1 -1
- package/ContactBubble.js +6 -6
- package/ContentArticle.d.ts +4 -4
- package/ContentArticle.js +14 -14
- package/ContentImage.d.ts +1 -1
- package/ContentImage.js +2 -2
- package/Datepicker.d.ts +1 -1
- package/Datepicker.js +2 -2
- package/ExtraLinks.d.ts +2 -2
- package/ExtraLinks.js +6 -6
- package/FeatureList.d.ts +1 -1
- package/FeatureList.js +4 -4
- package/FileInput.d.ts +2 -2
- package/FileInput.js +4 -4
- package/Foonote.d.ts +1 -1
- package/Foonote.js +2 -2
- package/FooterBadges.js +2 -2
- package/Form.d.ts +1 -1
- package/FormField.d.ts +1 -1
- package/FormField.js +4 -4
- package/Gallery/_GalleryItem.d.ts +1 -1
- package/Gallery/_GalleryItem.js +7 -7
- package/Gallery/_GalleryModal.d.ts +1 -1
- package/Gallery/_GalleryModal.js +4 -4
- package/Gallery/_GalleryModalContext.d.ts +2 -2
- package/Gallery/_GalleryModalItem.d.ts +1 -1
- package/Gallery/_GalleryModalItem.js +2 -2
- package/Gallery.d.ts +4 -4
- package/Gallery.js +7 -7
- package/GridBlocks.d.ts +3 -3
- package/GridBlocks.js +8 -8
- package/Heading.d.ts +1 -1
- package/HeroBlock.d.ts +3 -3
- package/HeroBlock.js +8 -8
- package/Illustration.d.ts +1 -1
- package/Illustration.js +2 -2
- package/ImageCards.d.ts +2 -2
- package/ImageCards.js +4 -4
- package/InfoBlock.d.ts +1 -1
- package/InfoBlock.js +2 -2
- package/InfoHero.d.ts +3 -3
- package/InfoHero.js +10 -10
- package/IslandBlock.d.ts +4 -4
- package/IslandBlock.js +4 -4
- package/IslandPageBlock.d.ts +4 -4
- package/IslandPageBlock.js +4 -4
- package/LabeledTextBlock.d.ts +2 -2
- package/LabeledTextBlock.js +4 -4
- package/Layout.d.ts +1 -1
- package/Layout.js +13 -13
- package/MainMenu/_Auxiliary.d.ts +1 -1
- package/MainMenu/_Auxiliary.js +2 -2
- package/MainMenu/_PrimaryPanel.js +2 -2
- package/MainMenu.d.ts +3 -3
- package/MainMenu.js +15 -13
- package/MiniMetrics.d.ts +2 -2
- package/MiniMetrics.js +4 -4
- package/NameCard.js +4 -4
- package/NameCards.d.ts +1 -1
- package/NameCards.js +2 -2
- package/NewsHero.d.ts +2 -2
- package/NewsHero.js +7 -7
- package/PageFilter.d.ts +1 -1
- package/PageFilter.js +4 -4
- package/PageHeading.d.ts +1 -1
- package/PageHeading.js +2 -2
- package/Picture.d.ts +1 -1
- package/Picture.js +2 -2
- package/PullQuote.d.ts +1 -1
- package/PullQuote.js +2 -2
- package/RadioButtonsGroup.d.ts +1 -1
- package/RadioButtonsGroup.js +4 -4
- package/RadioGroup.d.ts +2 -2
- package/RadioGroup.js +4 -4
- package/RelatedLinks.js +2 -2
- package/RowBlock.d.ts +1 -1
- package/RowBlock.js +2 -2
- package/SearchInput.d.ts +1 -1
- package/SearchInput.js +2 -2
- package/SearchResults/_SearchResultsItem.js +4 -4
- package/SearchResults.d.ts +2 -2
- package/SearchResults.js +7 -7
- package/SeenEffect.d.ts +1 -1
- package/SeenEffect.js +3 -3
- package/Selectbox.d.ts +2 -2
- package/Selectbox.js +2 -2
- package/ShareButtons.d.ts +1 -1
- package/ShareButtons.js +2 -2
- package/SiteSearchAutocomplete.js +2 -2
- package/SiteSearchCurtain.js +2 -2
- package/SiteSearchInput.d.ts +2 -2
- package/SiteSearchInput.js +2 -2
- package/SubHeading.d.ts +2 -2
- package/SubHeading.js +2 -2
- package/Tabs.d.ts +2 -2
- package/Tabs.js +4 -4
- package/TagPill.d.ts +1 -1
- package/TagPill.js +3 -3
- package/TextBlock.d.ts +2 -2
- package/TextBlock.js +2 -2
- package/TextButton.d.ts +1 -1
- package/TextButton.js +2 -2
- package/TextInput.d.ts +1 -1
- package/TextInput.js +2 -2
- package/VerticalTabsTOC.d.ts +1 -1
- package/VerticalTabsTOC.js +2 -2
- package/WizardLayout.d.ts +1 -1
- package/WizardLayout.js +8 -8
- package/WizardLayoutClose.d.ts +1 -1
- package/WizardLayoutClose.js +2 -2
- package/_abstract/_AbstractCarousel.d.ts +2 -2
- package/_abstract/_AbstractCarousel.js +6 -6
- package/_abstract/_Blings.d.ts +1 -1
- package/_abstract/_Blings.js +2 -2
- package/_abstract/_Block.d.ts +3 -3
- package/_abstract/_Block.js +6 -6
- package/_abstract/_Button.js +2 -2
- package/_abstract/_CardList.d.ts +1 -1
- package/_abstract/_CardList.js +4 -4
- package/_abstract/_Image.js +2 -2
- package/_abstract/_Quote.js +2 -2
- package/_abstract/_TogglerGroup.d.ts +2 -2
- package/_abstract/_TogglerGroup.js +2 -2
- package/_abstract/_TogglerGroupField.d.ts +3 -3
- package/_abstract/_TogglerGroupField.js +4 -4
- package/assets.d.ts +2 -2
- package/esm/AccordionList.d.ts +25 -0
- package/esm/AccordionList.js +32 -0
- package/esm/ActionCards.d.ts +6 -0
- package/esm/ActionCards.js +9 -0
- package/esm/Alert.d.ts +48 -0
- package/esm/Alert.js +90 -0
- package/esm/ArticleCards.d.ts +8 -0
- package/esm/ArticleCards.js +4 -0
- package/esm/ArticleCarousel/_ArticleCarouselCard.d.ts +28 -0
- package/esm/ArticleCarousel/_ArticleCarouselCard.js +24 -0
- package/esm/ArticleCarousel.d.ts +12 -0
- package/esm/ArticleCarousel.js +8 -0
- package/esm/ArticleMeta.d.ts +10 -0
- package/esm/ArticleMeta.js +19 -0
- package/esm/Attention.d.ts +7 -0
- package/esm/Attention.js +4 -0
- package/esm/BasicTable.d.ts +14 -0
- package/esm/BasicTable.js +29 -0
- package/esm/BgBox.d.ts +8 -0
- package/esm/BgBox.js +9 -0
- package/esm/Bling.d.ts +81 -0
- package/esm/Bling.js +44 -0
- package/esm/BlockBreak.d.ts +2 -0
- package/esm/BlockBreak.js +6 -0
- package/esm/BlockQuote.d.ts +4 -0
- package/esm/BlockQuote.js +4 -0
- package/esm/BreadCrumbs.d.ts +11 -0
- package/esm/BreadCrumbs.js +28 -0
- package/esm/ButtonBack.d.ts +7 -0
- package/esm/ButtonBack.js +4 -0
- package/esm/ButtonBar.d.ts +17 -0
- package/esm/ButtonBar.js +15 -0
- package/esm/ButtonPrimary.d.ts +7 -0
- package/esm/ButtonPrimary.js +4 -0
- package/esm/ButtonSecondary.d.ts +7 -0
- package/esm/ButtonSecondary.js +4 -0
- package/esm/ButtonTertiary.d.ts +12 -0
- package/esm/ButtonTertiary.js +15 -0
- package/esm/Carousel.d.ts +4 -0
- package/esm/Carousel.js +4 -0
- package/esm/CarouselStepper.d.ts +4 -0
- package/esm/CarouselStepper.js +4 -0
- package/esm/CenterColumn.d.ts +7 -0
- package/esm/CenterColumn.js +7 -0
- package/esm/Checkbox.d.ts +4 -0
- package/esm/Checkbox.js +4 -0
- package/esm/CheckboxButton.d.ts +4 -0
- package/esm/CheckboxButton.js +4 -0
- package/esm/CheckboxButtonsGroup.d.ts +12 -0
- package/esm/CheckboxButtonsGroup.js +13 -0
- package/esm/CheckboxGroup.d.ts +10 -0
- package/esm/CheckboxGroup.js +7 -0
- package/esm/CityBlock.d.ts +21 -0
- package/esm/CityBlock.js +18 -0
- package/esm/ContactBubble.d.ts +58 -0
- package/esm/ContactBubble.js +152 -0
- package/esm/ContentArticle.d.ts +16 -0
- package/esm/ContentArticle.js +24 -0
- package/esm/ContentImage.d.ts +8 -0
- package/esm/ContentImage.js +18 -0
- package/esm/Datepicker.d.ts +40 -0
- package/esm/Datepicker.js +78 -0
- package/esm/ExtraLinks.d.ts +18 -0
- package/esm/ExtraLinks.js +24 -0
- package/esm/FeatureList.d.ts +12 -0
- package/esm/FeatureList.js +16 -0
- package/esm/FieldGroup.d.ts +10 -0
- package/esm/FieldGroup.js +9 -0
- package/esm/FileInput/_FileInput.utils.d.ts +36 -0
- package/esm/FileInput/_FileInput.utils.js +69 -0
- package/esm/FileInput/_FileInputFileList.d.ts +11 -0
- package/esm/FileInput/_FileInputFileList.js +19 -0
- package/esm/FileInput.d.ts +48 -0
- package/esm/FileInput.js +130 -0
- package/esm/Foonote.d.ts +12 -0
- package/esm/Foonote.js +7 -0
- package/esm/FooterBadges.d.ts +9 -0
- package/esm/FooterBadges.js +12 -0
- package/esm/FooterInfo.d.ts +20 -0
- package/esm/FooterInfo.js +12 -0
- package/esm/Footnote.d.ts +6 -0
- package/esm/Footnote.js +3 -0
- package/esm/Form.d.ts +7 -0
- package/esm/Form.js +10 -0
- package/esm/FormField.d.ts +65 -0
- package/esm/FormField.js +92 -0
- package/esm/Gallery/_GalleryItem.d.ts +7 -0
- package/esm/Gallery/_GalleryItem.js +19 -0
- package/esm/Gallery/_GalleryModal.d.ts +6 -0
- package/esm/Gallery/_GalleryModal.js +53 -0
- package/esm/Gallery/_GalleryModalContext.d.ts +9 -0
- package/esm/Gallery/_GalleryModalContext.js +2 -0
- package/esm/Gallery/_GalleryModalItem.d.ts +2 -0
- package/esm/Gallery/_GalleryModalItem.js +11 -0
- package/esm/Gallery.d.ts +17 -0
- package/esm/Gallery.js +27 -0
- package/esm/GridBlocks.d.ts +26 -0
- package/esm/GridBlocks.js +24 -0
- package/esm/Heading.d.ts +22 -0
- package/esm/Heading.js +19 -0
- package/esm/HeroBlock.d.ts +19 -0
- package/esm/HeroBlock.js +21 -0
- package/esm/IframeBlock.d.ts +28 -0
- package/esm/IframeBlock.js +26 -0
- package/esm/Illustration.d.ts +10 -0
- package/esm/Illustration.js +8 -0
- package/esm/ImageCards.d.ts +10 -0
- package/esm/ImageCards.js +12 -0
- package/esm/InfoBlock.d.ts +13 -0
- package/esm/InfoBlock.js +13 -0
- package/esm/InfoHero.d.ts +18 -0
- package/esm/InfoHero.js +83 -0
- package/esm/IslandBlock.d.ts +25 -0
- package/esm/IslandBlock.js +16 -0
- package/esm/IslandPageBlock.d.ts +24 -0
- package/esm/IslandPageBlock.js +16 -0
- package/esm/LabeledTextBlock.d.ts +11 -0
- package/esm/LabeledTextBlock.js +14 -0
- package/esm/Layout.d.ts +32 -0
- package/esm/Layout.js +56 -0
- package/esm/MainMenu/_Auxiliary.d.ts +6 -0
- package/esm/MainMenu/_Auxiliary.js +13 -0
- package/esm/MainMenu/_PrimaryPanel.d.ts +29 -0
- package/esm/MainMenu/_PrimaryPanel.js +22 -0
- package/esm/MainMenu.d.ts +62 -0
- package/esm/MainMenu.js +221 -0
- package/esm/MiniMetrics.d.ts +8 -0
- package/esm/MiniMetrics.js +12 -0
- package/esm/Modal.d.ts +8 -0
- package/esm/Modal.js +14 -0
- package/esm/NameCard.d.ts +64 -0
- package/esm/NameCard.js +82 -0
- package/esm/NameCards.d.ts +6 -0
- package/esm/NameCards.js +7 -0
- package/esm/NewsHero.d.ts +14 -0
- package/esm/NewsHero.js +86 -0
- package/esm/PageFilter.d.ts +16 -0
- package/esm/PageFilter.js +15 -0
- package/esm/PageHeading.d.ts +10 -0
- package/esm/PageHeading.js +12 -0
- package/esm/Picture.d.ts +7 -0
- package/esm/Picture.js +8 -0
- package/esm/ProcessOverview.d.ts +13 -0
- package/esm/ProcessOverview.js +17 -0
- package/esm/PullQuote.d.ts +4 -0
- package/esm/PullQuote.js +4 -0
- package/esm/RadioButtonsGroup.d.ts +12 -0
- package/esm/RadioButtonsGroup.js +14 -0
- package/esm/RadioGroup.d.ts +16 -0
- package/esm/RadioGroup.js +8 -0
- package/esm/RelatedLinks.d.ts +20 -0
- package/esm/RelatedLinks.js +26 -0
- package/esm/RowBlock.d.ts +12 -0
- package/esm/RowBlock.js +9 -0
- package/esm/RowBlockColumn.d.ts +8 -0
- package/esm/RowBlockColumn.js +11 -0
- package/esm/SearchInput.d.ts +18 -0
- package/esm/SearchInput.js +23 -0
- package/esm/SearchResults/_SearchResultsItem.d.ts +18 -0
- package/esm/SearchResults/_SearchResultsItem.js +14 -0
- package/esm/SearchResults.d.ts +37 -0
- package/esm/SearchResults.js +108 -0
- package/esm/SeenEffect.d.ts +4 -0
- package/esm/SeenEffect.js +9 -0
- package/esm/Selectbox.d.ts +11 -0
- package/esm/Selectbox.js +40 -0
- package/esm/ShareButtons.d.ts +9 -0
- package/esm/ShareButtons.js +56 -0
- package/esm/Sharpie.d.ts +23 -0
- package/esm/Sharpie.js +22 -0
- package/esm/SiteSearchAutocomplete.d.ts +40 -0
- package/esm/SiteSearchAutocomplete.js +48 -0
- package/esm/SiteSearchCurtain.d.ts +6 -0
- package/esm/SiteSearchCurtain.js +28 -0
- package/esm/SiteSearchInput.d.ts +24 -0
- package/esm/SiteSearchInput.js +30 -0
- package/esm/Skeleton.d.ts +25 -0
- package/esm/Skeleton.js +30 -0
- package/esm/SubHeading.d.ts +10 -0
- package/esm/SubHeading.js +13 -0
- package/esm/Tabs.d.ts +35 -0
- package/esm/Tabs.js +94 -0
- package/esm/TagPill.d.ts +25 -0
- package/esm/TagPill.js +34 -0
- package/esm/TextBlock.d.ts +15 -0
- package/esm/TextBlock.js +15 -0
- package/esm/TextButton.d.ts +9 -0
- package/esm/TextButton.js +9 -0
- package/esm/TextInput.d.ts +16 -0
- package/esm/TextInput.js +32 -0
- package/esm/Tooltip.d.ts +7 -0
- package/esm/Tooltip.js +58 -0
- package/esm/VSpacer.d.ts +22 -0
- package/esm/VSpacer.js +41 -0
- package/esm/VerticalTabsTOC.d.ts +14 -0
- package/esm/VerticalTabsTOC.js +68 -0
- package/esm/WizardLayout.d.ts +15 -0
- package/esm/WizardLayout.js +30 -0
- package/esm/WizardLayoutClose.d.ts +3 -0
- package/esm/WizardLayoutClose.js +4 -0
- package/esm/WizardStepper.d.ts +36 -0
- package/esm/WizardStepper.js +26 -0
- package/esm/_abstract/_AbstractCarousel.d.ts +29 -0
- package/esm/_abstract/_AbstractCarousel.js +108 -0
- package/esm/_abstract/_Blings.d.ts +11 -0
- package/esm/_abstract/_Blings.js +11 -0
- package/esm/_abstract/_Block.d.ts +21 -0
- package/esm/_abstract/_Block.js +23 -0
- package/esm/_abstract/_Button.d.ts +40 -0
- package/esm/_abstract/_Button.js +36 -0
- package/esm/_abstract/_CardList.d.ts +34 -0
- package/esm/_abstract/_CardList.js +37 -0
- package/esm/_abstract/_Image.d.ts +36 -0
- package/esm/_abstract/_Image.js +26 -0
- package/esm/_abstract/_Link.d.ts +60 -0
- package/esm/_abstract/_Link.js +64 -0
- package/esm/_abstract/_Quote.d.ts +11 -0
- package/esm/_abstract/_Quote.js +8 -0
- package/esm/_abstract/_TogglerGroup.d.ts +32 -0
- package/esm/_abstract/_TogglerGroup.js +28 -0
- package/esm/_abstract/_TogglerGroupField.d.ts +19 -0
- package/esm/_abstract/_TogglerGroupField.js +17 -0
- package/esm/_abstract/_TogglerInput.d.ts +23 -0
- package/esm/_abstract/_TogglerInput.js +23 -0
- package/esm/_abstract/breakOnNL.d.ts +1 -0
- package/esm/_abstract/breakOnNL.js +7 -0
- package/esm/assets.d.ts +42 -0
- package/esm/assets.js +58 -0
- package/esm/constants.d.ts +19 -0
- package/esm/constants.js +22 -0
- package/esm/focus-visible.d.ts +1 -0
- package/esm/focus-visible.js +3 -0
- package/esm/index.d.ts +97 -0
- package/esm/index.js +1 -0
- package/esm/package.json +1 -0
- package/esm/utils/HannaUIState.d.ts +8 -0
- package/esm/utils/HannaUIState.js +7 -0
- package/esm/utils/browserSide.d.ts +1 -0
- package/esm/utils/browserSide.js +1 -0
- package/esm/utils/config.d.ts +4 -0
- package/esm/utils/config.js +2 -0
- package/esm/utils/env.d.ts +1 -0
- package/esm/utils/env.js +8 -0
- package/esm/utils/seenEffect.d.ts +27 -0
- package/esm/utils/seenEffect.js +75 -0
- package/esm/utils/useDidChange.d.ts +37 -0
- package/esm/utils/useDidChange.js +43 -0
- package/esm/utils/useFormatMonitor.d.ts +38 -0
- package/esm/utils/useFormatMonitor.js +41 -0
- package/esm/utils/useGetSVGtext.d.ts +10 -0
- package/esm/utils/useGetSVGtext.js +23 -0
- package/esm/utils/useMenuToggling.d.ts +8 -0
- package/esm/utils/useMenuToggling.js +62 -0
- package/esm/utils/useMixedControlState.d.ts +137 -0
- package/esm/utils/useMixedControlState.js +101 -0
- package/esm/utils/useScrollbarWidthCSSVar.d.ts +17 -0
- package/esm/utils/useScrollbarWidthCSSVar.js +19 -0
- package/esm/utils.d.ts +8 -0
- package/esm/utils.js +8 -0
- package/package.json +389 -3
- package/utils/config.d.ts +2 -2
- package/utils/config.js +2 -2
- package/utils/useDidChange.d.ts +1 -1
- package/utils/useDidChange.js +1 -1
- package/utils/useMenuToggling.js +2 -2
- package/utils.d.ts +8 -8
- package/utils.js +8 -8
package/VerticalTabsTOC.js
CHANGED
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const frag_1 = require("@hugsmidjan/qj/frag");
|
|
7
7
|
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
8
|
-
const
|
|
8
|
+
const Tabs_js_1 = tslib_1.__importDefault(require("./Tabs.js"));
|
|
9
9
|
const getId = (url) => (url && decodeURIComponent(url.split('#')[1] || '')) || '';
|
|
10
10
|
const getItemId = (item) => getId(item && item.href);
|
|
11
11
|
const mapToItemsById = (items, domid) => {
|
|
@@ -62,7 +62,7 @@ const VerticalTabsTOC = (props) => {
|
|
|
62
62
|
window.addEventListener('hashchange', handleHash);
|
|
63
63
|
return () => window.removeEventListener('hashchange', handleHash);
|
|
64
64
|
}, [itemsById, onItemSelect]);
|
|
65
|
-
return (react_1.default.createElement(
|
|
65
|
+
return (react_1.default.createElement(Tabs_js_1.default, { id: domid, vertical: true, "aria-label": props['aria-label'], onSetActive: (_, item) => {
|
|
66
66
|
var _a;
|
|
67
67
|
const itemId = getItemId(item);
|
|
68
68
|
const newId = itemId || getItemId((_a = itemsById[itemId].subTabs) === null || _a === void 0 ? void 0 : _a.tabs[0]);
|
package/WizardLayout.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { HannaColorTheme } from '@reykjavik/hanna-css';
|
|
3
|
-
import { SSRSupport } from './utils';
|
|
3
|
+
import { SSRSupport } from './utils.js';
|
|
4
4
|
type WizardLayoutProps = {
|
|
5
5
|
wizardStepper?: ReactNode | false;
|
|
6
6
|
wizardFooter?: ReactNode | false;
|
package/WizardLayout.js
CHANGED
|
@@ -4,23 +4,23 @@ exports.WizardLayout = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const assets_1 = require("@reykjavik/hanna-utils/assets");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
7
|
+
const _Image_js_1 = require("./_abstract/_Image.js");
|
|
8
|
+
const _Link_js_1 = require("./_abstract/_Link.js");
|
|
9
|
+
const useScrollbarWidthCSSVar_js_1 = require("./utils/useScrollbarWidthCSSVar.js");
|
|
10
|
+
const utils_js_1 = require("./utils.js");
|
|
11
11
|
const WizardLayout = (props) => {
|
|
12
|
-
(0,
|
|
12
|
+
(0, useScrollbarWidthCSSVar_js_1.useScrollbarWidthCSSVar)();
|
|
13
13
|
const {
|
|
14
14
|
// ssr,
|
|
15
15
|
wizardStepper, wizardFooter, children, colorTheme, logoLink = '/', siteName = 'Reykjavík', globalAlerts, } = props;
|
|
16
|
-
const isBrowser = (0,
|
|
16
|
+
const isBrowser = (0, utils_js_1.useIsBrowserSide)( /* ssr */);
|
|
17
17
|
return (react_1.default.createElement("div", { className: "WizardLayout", "data-sprinkled": isBrowser, "data-color-theme": colorTheme },
|
|
18
18
|
globalAlerts && (react_1.default.createElement("div", { className: "WizardLayout__alerts", role: "alert" }, globalAlerts)),
|
|
19
19
|
react_1.default.createElement("div", { className: "WizardLayout__content" },
|
|
20
20
|
react_1.default.createElement("div", { className: "WizardLayout__header", role: "banner" },
|
|
21
|
-
react_1.default.createElement(
|
|
21
|
+
react_1.default.createElement(_Link_js_1.Link, { className: "WizardLayout__header__logo", href: logoLink },
|
|
22
22
|
' ',
|
|
23
|
-
react_1.default.createElement(
|
|
23
|
+
react_1.default.createElement(_Image_js_1.Image, { className: undefined, inline: true, src: (0, assets_1.getAssetUrl)('reykjavik-logo.svg') }),
|
|
24
24
|
' ',
|
|
25
25
|
siteName,
|
|
26
26
|
' '),
|
package/WizardLayoutClose.d.ts
CHANGED
package/WizardLayoutClose.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WizardLayoutClose = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
7
|
-
const WizardLayoutClose = (props) => (react_1.default.createElement(
|
|
6
|
+
const _Button_js_1 = require("./_abstract/_Button.js");
|
|
7
|
+
const WizardLayoutClose = (props) => (react_1.default.createElement(_Button_js_1.Button, Object.assign({ bem: "WizardLayoutClose" }, props)));
|
|
8
8
|
exports.WizardLayoutClose = WizardLayoutClose;
|
|
9
9
|
exports.default = exports.WizardLayoutClose;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { BemProps } from '@hugsmidjan/react/types';
|
|
3
3
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
4
|
-
import { SSRSupport } from '../utils';
|
|
5
|
-
import { SeenProp } from '../utils/seenEffect';
|
|
4
|
+
import { SSRSupport } from '../utils.js';
|
|
5
|
+
import { SeenProp } from '../utils/seenEffect.js';
|
|
6
6
|
export type CarouselProps<I extends Record<string, unknown> = {}, P extends Record<string, unknown> | undefined = {}> = {
|
|
7
7
|
className?: string;
|
|
8
8
|
ssr?: SSRSupport;
|
|
@@ -9,9 +9,9 @@ const focusElm_1 = tslib_1.__importDefault(require("@hugsmidjan/qj/focusElm"));
|
|
|
9
9
|
const throttle_1 = tslib_1.__importDefault(require("@hugsmidjan/qj/throttle"));
|
|
10
10
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
11
11
|
const hanna_utils_1 = require("@reykjavik/hanna-utils");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
12
|
+
const CarouselStepper_js_1 = tslib_1.__importDefault(require("../CarouselStepper.js"));
|
|
13
|
+
const utils_js_1 = require("../utils.js");
|
|
14
|
+
const seenEffect_js_1 = require("../utils/seenEffect.js");
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
16
16
|
const scrollXBy = (elm, deltaX) => {
|
|
17
17
|
const left = elm.scrollLeft + deltaX;
|
|
@@ -34,7 +34,7 @@ const AbstractCarousel = (props) => {
|
|
|
34
34
|
const itemCount = props.itemCount || (children || items).length;
|
|
35
35
|
const listRef = (0, react_1.useRef)(null);
|
|
36
36
|
const [activeItem, setActiveItem] = (0, react_1.useState)(0);
|
|
37
|
-
const isBrowser = (0,
|
|
37
|
+
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
|
38
38
|
// Since listElm gets unmounted and remounted based on isBrowser, we
|
|
39
39
|
// wait for isBrowser is true before setting scroll and resize events.
|
|
40
40
|
const listElm = isBrowser && listRef.current;
|
|
@@ -86,7 +86,7 @@ const AbstractCarousel = (props) => {
|
|
|
86
86
|
}, 1000);
|
|
87
87
|
return { delayedScrollLeft, delayedScrollRight };
|
|
88
88
|
}, []);
|
|
89
|
-
const [outerRef] = (0,
|
|
89
|
+
const [outerRef] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
90
90
|
if (!itemCount) {
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
@@ -108,6 +108,6 @@ const AbstractCarousel = (props) => {
|
|
|
108
108
|
delayedScrollRight.cancel();
|
|
109
109
|
scrollToItem(activeItem + 1);
|
|
110
110
|
}, onMouseOver: () => delayedScrollRight(activeItem), onMouseOut: () => delayedScrollRight.cancel() })))) : (itemList),
|
|
111
|
-
isBrowser && (react_1.default.createElement(
|
|
111
|
+
isBrowser && (react_1.default.createElement(CarouselStepper_js_1.default, { itemCount: itemCount, setCurrent: scrollToItem, current: activeItem }))));
|
|
112
112
|
};
|
|
113
113
|
exports.AbstractCarousel = AbstractCarousel;
|
package/_abstract/_Blings.d.ts
CHANGED
package/_abstract/_Blings.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Blings = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const Bling_js_1 = tslib_1.__importDefault(require("../Bling.js"));
|
|
7
7
|
const inverseAlignments = {
|
|
8
8
|
left: 'right',
|
|
9
9
|
'left-ish': 'right-ish',
|
|
@@ -12,5 +12,5 @@ const inverseAlignments = {
|
|
|
12
12
|
'right-ish': 'left-ish',
|
|
13
13
|
right: 'left',
|
|
14
14
|
};
|
|
15
|
-
const Blings = (props) => (react_1.default.createElement(react_1.default.Fragment, null, props.blings.map(({ type, align, vertical, color, overlay, parent }, i) => (react_1.default.createElement(
|
|
15
|
+
const Blings = (props) => (react_1.default.createElement(react_1.default.Fragment, null, props.blings.map(({ type, align, vertical, color, overlay, parent }, i) => (react_1.default.createElement(Bling_js_1.default, { key: type + '-' + i, type: type, align: props.mirror ? inverseAlignments[align || 'left'] : align, vertical: vertical, color: color, overlay: overlay, parent: parent })))));
|
|
16
16
|
exports.Blings = Blings;
|
package/_abstract/_Block.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
2
|
-
import { SeenProp } from '../utils/seenEffect';
|
|
3
|
-
import { ButtonProps } from './_Button';
|
|
4
|
-
import { ImageProps } from './_Image';
|
|
2
|
+
import { SeenProp } from '../utils/seenEffect.js';
|
|
3
|
+
import { ButtonProps } from './_Button.js';
|
|
4
|
+
import { ImageProps } from './_Image.js';
|
|
5
5
|
export type BlockItem = {
|
|
6
6
|
title: string;
|
|
7
7
|
summary?: string | JSX.Element;
|
package/_abstract/_Block.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.Block = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const seenEffect_js_1 = require("../utils/seenEffect.js");
|
|
8
|
+
const _Button_js_1 = require("./_Button.js");
|
|
9
|
+
const _Image_js_1 = require("./_Image.js");
|
|
10
10
|
const Block = (props) => {
|
|
11
11
|
const { image, modifier, bem, content, startSeen } = props;
|
|
12
|
-
const [ref] = (0,
|
|
12
|
+
const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
13
13
|
const contentItems = Array.isArray(content) ? content : [content];
|
|
14
14
|
return (react_1.default.createElement("div", { className: (0, getBemClass_1.default)(bem, modifier), ref: ref },
|
|
15
15
|
contentItems.map(({ title, summary, buttons = [] }, i) => {
|
|
@@ -20,9 +20,9 @@ const Block = (props) => {
|
|
|
20
20
|
buttons.length > 0 && (react_1.default.createElement("div", { className: `${bem}__buttons` },
|
|
21
21
|
' ',
|
|
22
22
|
buttons.map((buttonProps, i) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
23
|
-
react_1.default.createElement(
|
|
23
|
+
react_1.default.createElement(_Button_js_1.Button, Object.assign({ bem: `${bem}__button`, key: i }, buttonProps)),
|
|
24
24
|
' ')))))));
|
|
25
25
|
}),
|
|
26
|
-
image && react_1.default.createElement(
|
|
26
|
+
image && react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: `${bem}__image` }, image))));
|
|
27
27
|
};
|
|
28
28
|
exports.Block = Block;
|
package/_abstract/_Button.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.Button = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
7
|
-
const
|
|
7
|
+
const _Link_js_1 = require("./_Link.js");
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
const sizes = {
|
|
10
10
|
normal: '',
|
|
@@ -31,7 +31,7 @@ const Button = (props) => {
|
|
|
31
31
|
(0, getBemClass_1.default)(bem, [modifier, variants[variant], sizes[size], navigationFlags[icon]]);
|
|
32
32
|
const iconProp = icons[icon] && { 'data-icon': icons[icon] };
|
|
33
33
|
if (buttonProps.href != null) {
|
|
34
|
-
return (react_1.default.createElement(
|
|
34
|
+
return (react_1.default.createElement(_Link_js_1.Link, Object.assign({ className: className }, buttonProps, { style: undefined }, iconProp), label));
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
return (react_1.default.createElement("button", Object.assign({ className: className, type: "button" }, buttonProps, { style: undefined }, iconProp), label));
|
package/_abstract/_CardList.d.ts
CHANGED
package/_abstract/_CardList.js
CHANGED
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CardList = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const _Button_js_1 = require("./_Button.js");
|
|
7
|
+
const _Image_js_1 = require("./_Image.js");
|
|
8
8
|
const Card = (props) => {
|
|
9
9
|
const { bem, href, title, imgPlaceholder, image, meta, summary } = props;
|
|
10
10
|
const cardClass = `${bem}__card`;
|
|
11
11
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
12
|
-
react_1.default.createElement(
|
|
12
|
+
react_1.default.createElement(_Button_js_1.Button, { bem: cardClass, href: href },
|
|
13
13
|
' ',
|
|
14
|
-
react_1.default.createElement(
|
|
14
|
+
react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: `${bem}__image` }, image, { placeholder: imgPlaceholder })),
|
|
15
15
|
react_1.default.createElement("span", { className: `${cardClass}__title` }, title),
|
|
16
16
|
' ',
|
|
17
17
|
meta && react_1.default.createElement("span", { className: `${cardClass}__meta` }, meta),
|
package/_abstract/_Image.js
CHANGED
|
@@ -4,14 +4,14 @@ exports.Image = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
7
|
-
const
|
|
7
|
+
const useGetSVGtext_js_1 = require("../utils/useGetSVGtext.js");
|
|
8
8
|
// eslint-disable-next-line complexity
|
|
9
9
|
const Image = (props) => {
|
|
10
10
|
const { src, altText = '', sources = [], preloadSrc, className, inline, placeholder, focalPoint, } = props;
|
|
11
11
|
const _src = (sources.length && preloadSrc) || src;
|
|
12
12
|
const imageSrc = _src || (sources[0] != null ? sources[0].srcset.split(' ')[0] : undefined);
|
|
13
13
|
const imgLoading = preloadSrc ? 'eager' : 'lazy';
|
|
14
|
-
const inlineSvg = (0,
|
|
14
|
+
const inlineSvg = (0, useGetSVGtext_js_1.useGetSVGtext)(inline ? imageSrc : undefined);
|
|
15
15
|
if (!imageSrc) {
|
|
16
16
|
return placeholder ? (react_1.default.createElement("span", { className: className && (0, getBemClass_1.default)(className, 'missing') }, placeholder !== true && placeholder())) : null;
|
|
17
17
|
}
|
package/_abstract/_Quote.js
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports._Quote = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const _Link_js_1 = require("./_Link.js");
|
|
7
7
|
const _Quote = (props) => {
|
|
8
8
|
const { bem, children, by, byHref } = props;
|
|
9
9
|
return (react_1.default.createElement("figure", { className: bem },
|
|
10
10
|
react_1.default.createElement("blockquote", { className: bem + '__quote' }, children),
|
|
11
|
-
by && (react_1.default.createElement("figcaption", { className: bem + '__by' }, byHref ? (react_1.default.createElement(
|
|
11
|
+
by && (react_1.default.createElement("figcaption", { className: bem + '__by' }, byHref ? (react_1.default.createElement(_Link_js_1.Link, { href: byHref }, by)) : typeof by === 'string' ? (react_1.default.createElement("span", null, by)) : (by)))));
|
|
12
12
|
};
|
|
13
13
|
exports._Quote = _Quote;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormFieldInputProps } from '../FormField';
|
|
2
|
-
import { TogglerInputProps } from './_TogglerInput';
|
|
1
|
+
import { FormFieldInputProps } from '../FormField.js';
|
|
2
|
+
import { TogglerInputProps } from './_TogglerInput.js';
|
|
3
3
|
export type TogglerGroupOption = {
|
|
4
4
|
value: string;
|
|
5
5
|
label?: string | JSX.Element;
|
|
@@ -4,12 +4,12 @@ exports.TogglerGroup = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
7
|
-
const
|
|
7
|
+
const utils_js_1 = require("../utils.js");
|
|
8
8
|
const TogglerGroup = (props) => {
|
|
9
9
|
const {
|
|
10
10
|
// id,
|
|
11
11
|
className, bem, name, disabled, Toggler, onSelected, options, isRadio, inputProps = {}, } = props;
|
|
12
|
-
const [values, setValues] = (0,
|
|
12
|
+
const [values, setValues] = (0, utils_js_1.useMixedControlState)(props, 'value', []);
|
|
13
13
|
return (react_1.default.createElement("ul", { className: (0, getBemClass_1.default)(bem, null, className), role: "group", "aria-labelledby": props['aria-labelledby'], "aria-describedby": props['aria-describedby'], "aria-required": props.required }, options.map((option, i) => {
|
|
14
14
|
const isDisabled = option.disabled != null
|
|
15
15
|
? option.disabled
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
3
|
-
import { FormFieldGroupWrappingProps } from '../FormField';
|
|
4
|
-
import { TogglerGroupOption, TogglerGroupOptions, TogglerGroupProps } from './_TogglerGroup';
|
|
5
|
-
import { TogglerInputProps } from './_TogglerInput';
|
|
3
|
+
import { FormFieldGroupWrappingProps } from '../FormField.js';
|
|
4
|
+
import { TogglerGroupOption, TogglerGroupOptions, TogglerGroupProps } from './_TogglerGroup.js';
|
|
5
|
+
import { TogglerInputProps } from './_TogglerInput.js';
|
|
6
6
|
export type TogglerGroupFieldProps = {
|
|
7
7
|
className?: string;
|
|
8
8
|
} & FormFieldGroupWrappingProps & TogglerGroupProps;
|
|
@@ -4,8 +4,8 @@ exports.TogglerGroupField = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const FormField_js_1 = tslib_1.__importDefault(require("../FormField.js"));
|
|
8
|
+
const _TogglerGroup_js_1 = require("./_TogglerGroup.js");
|
|
9
9
|
const TogglerGroupField = (props) => {
|
|
10
10
|
const { bem, Toggler, className, modifier, label, LabelTag, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, value, defaultValue } = props, togglerGroupProps = tslib_1.__rest(props, ["bem", "Toggler", "className", "modifier", "label", "LabelTag", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "value", "defaultValue"]);
|
|
11
11
|
const _value = (0, react_1.useMemo)(() => (value == null ? undefined : typeof value === 'string' ? [value] : value), [value]);
|
|
@@ -14,8 +14,8 @@ const TogglerGroupField = (props) => {
|
|
|
14
14
|
: typeof defaultValue === 'string'
|
|
15
15
|
? [defaultValue]
|
|
16
16
|
: defaultValue, [defaultValue]);
|
|
17
|
-
return (react_1.default.createElement(
|
|
18
|
-
return (react_1.default.createElement(
|
|
17
|
+
return (react_1.default.createElement(FormField_js_1.default, { className: (0, getBemClass_1.default)(bem, modifier, className), group: true, label: label, LabelTag: LabelTag, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps) => {
|
|
18
|
+
return (react_1.default.createElement(_TogglerGroup_js_1.TogglerGroup, Object.assign({ bem: className.options }, inputProps, togglerGroupProps, { value: _value, defaultValue: _defaultValue, Toggler: Toggler })));
|
|
19
19
|
} }));
|
|
20
20
|
};
|
|
21
21
|
exports.TogglerGroupField = TogglerGroupField;
|
package/assets.d.ts
CHANGED
|
@@ -31,11 +31,11 @@ export declare const getCssBundleUrl: (cssTokens: string | Array<string>, versio
|
|
|
31
31
|
/** @deprecated (Will be removed in v0.11) */
|
|
32
32
|
export declare const efnistakn_menu: readonly ["menu/borgarstjori", "menu/borgarstjorn", "menu/bygg_framkv", "menu/fjarmal", "menu/fundargerdir", "menu/itrottir_aftreying", "menu/log_reglugerdir", "menu/mannaudur", "menu/menning", "menu/rad_nefndir", "menu/skipulag", "menu/skolar_fristund", "menu/svid_deildir", "menu/umhverfi_samgongur", "menu/velferd_fjolskylda"];
|
|
33
33
|
/** @deprecated (Will be removed in v0.11) */
|
|
34
|
-
export type Efnistakn_Menu = typeof efnistakn_menu[number];
|
|
34
|
+
export type Efnistakn_Menu = (typeof efnistakn_menu)[number];
|
|
35
35
|
/** @deprecated (Will be removed in v0.11) */
|
|
36
36
|
export declare const auxiliary_menu_images: Array<Illustration>;
|
|
37
37
|
/** @deprecated Instead `import type { AuxilaryPanelIllustration } from '@reykjavik/hanna-react/MainMenu';` (Will be removed in v0.11) */
|
|
38
|
-
export type Auxilary_MenuImages = typeof auxiliary_menu_images[number];
|
|
38
|
+
export type Auxilary_MenuImages = (typeof auxiliary_menu_images)[number];
|
|
39
39
|
/** @deprecated Instead `import type { BlingType } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
40
40
|
export type BlingTypes = BlingType;
|
|
41
41
|
/** @deprecated Instead `import type { Illustration } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
2
|
+
import { SSRSupport } from './utils.js';
|
|
3
|
+
export type AccordionListItemProps = {
|
|
4
|
+
title: string | JSX.Element;
|
|
5
|
+
content: string | JSX.Element | undefined;
|
|
6
|
+
id?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type AccordionListProps = {
|
|
10
|
+
items: Array<AccordionListItemProps>;
|
|
11
|
+
/** Index of the currently open items (controlled use) */
|
|
12
|
+
open?: Array<number>;
|
|
13
|
+
/** Called whenever an AccodrionList item is toggled */
|
|
14
|
+
onToggle?: (data: {
|
|
15
|
+
newOpen: Array<number>;
|
|
16
|
+
index: number;
|
|
17
|
+
opened: boolean;
|
|
18
|
+
}) => void;
|
|
19
|
+
/** Index of those items that should start open (uncontrolled use) */
|
|
20
|
+
defaultOpen?: Array<number>;
|
|
21
|
+
wide?: boolean;
|
|
22
|
+
ssr?: SSRSupport;
|
|
23
|
+
} & SeenProp;
|
|
24
|
+
export declare const AccordionList: (props: AccordionListProps) => JSX.Element;
|
|
25
|
+
export default AccordionList;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { useDomid } from '@hugsmidjan/react/hooks';
|
|
3
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
4
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
5
|
+
import { useIsBrowserSide, useMixedControlState } from './utils.js';
|
|
6
|
+
const AccordionListItem = (props) => {
|
|
7
|
+
const { title, content, id, disabled = false, ssr, open, onToggle } = props;
|
|
8
|
+
const defaultOpen = useRef(props.defaultOpen);
|
|
9
|
+
const domid = useDomid();
|
|
10
|
+
const isBrowser = useIsBrowserSide(ssr);
|
|
11
|
+
const itemDisabled = (isBrowser && disabled) || !content;
|
|
12
|
+
return (React.createElement("div", { className: getBemClass('AccordionList__item', [itemDisabled && 'disabled']), id: id, "data-start-open": defaultOpen.current, "data-sprinkled": isBrowser },
|
|
13
|
+
React.createElement("h3", { className: "AccordionList__title" }, isBrowser ? (React.createElement("button", { type: "button", className: "AccordionList__button", "aria-controls": domid, "aria-expanded": open || undefined, onClick: onToggle, disabled: itemDisabled }, title)) : (title)),
|
|
14
|
+
React.createElement("div", { id: isBrowser && domid, className: "AccordionList__content", hidden: isBrowser && (!open || itemDisabled) }, content)));
|
|
15
|
+
};
|
|
16
|
+
export const AccordionList = (props) => {
|
|
17
|
+
const { items, ssr, wide, startSeen, defaultOpen } = props;
|
|
18
|
+
const [ref] = useSeenEffect(startSeen);
|
|
19
|
+
const [open, setOpenArray, mode] = useMixedControlState(props, 'open', []);
|
|
20
|
+
const onToggle = (index) => {
|
|
21
|
+
setOpenArray((prevOpen) => {
|
|
22
|
+
const opened = !prevOpen.includes(index);
|
|
23
|
+
const newOpen = opened
|
|
24
|
+
? prevOpen.concat(index)
|
|
25
|
+
: prevOpen.filter((idx) => idx !== index);
|
|
26
|
+
props.onToggle && props.onToggle({ newOpen, index, opened });
|
|
27
|
+
return newOpen;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return (React.createElement("div", { className: getBemClass('AccordionList', [wide && 'wide']), ref: ref }, items.map((item, i) => (React.createElement(AccordionListItem, Object.assign({ key: i }, item, { ssr: ssr, open: open.includes(i), onToggle: () => onToggle(i), defaultOpen: defaultOpen && defaultOpen.includes(i) }))))));
|
|
31
|
+
};
|
|
32
|
+
export default AccordionList;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CardListSummaryProps, TextCardListProps, TextCardProps } from './_abstract/_CardList.js';
|
|
2
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
export type ActionCardsProps = TextCardListProps & CardListSummaryProps & SeenProp;
|
|
4
|
+
export type ActionCardsItemProps = TextCardProps;
|
|
5
|
+
export declare const ActionCards: (props: ActionCardsProps) => JSX.Element;
|
|
6
|
+
export default ActionCards;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CardList, } from './_abstract/_CardList.js';
|
|
3
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
|
+
export const ActionCards = (props) => {
|
|
5
|
+
const [ref] = useSeenEffect(props.startSeen);
|
|
6
|
+
return (React.createElement("div", { className: "ActionCards", ref: ref },
|
|
7
|
+
React.createElement(CardList, Object.assign({}, props, { bemPrefix: "ActionCards" }))));
|
|
8
|
+
};
|
|
9
|
+
export default ActionCards;
|
package/esm/Alert.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
3
|
+
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
4
|
+
import { SSRSupport } from './utils.js';
|
|
5
|
+
export type AlertI18n = {
|
|
6
|
+
closeLabel: string;
|
|
7
|
+
closeLabelLong?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const defaultAlertTexts: DefaultTexts<AlertI18n>;
|
|
10
|
+
export declare const alertTypes: {
|
|
11
|
+
info: number;
|
|
12
|
+
success: number;
|
|
13
|
+
warning: number;
|
|
14
|
+
error: number;
|
|
15
|
+
critical: number;
|
|
16
|
+
};
|
|
17
|
+
type AlertType = keyof typeof alertTypes;
|
|
18
|
+
export type AlertProps = {
|
|
19
|
+
type: AlertType;
|
|
20
|
+
closable?: boolean;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
childrenHTML?: string;
|
|
23
|
+
/** server-side anchor href */
|
|
24
|
+
closeUrl?: string;
|
|
25
|
+
texts?: AlertI18n;
|
|
26
|
+
lang?: string;
|
|
27
|
+
ssr?: SSRSupport;
|
|
28
|
+
} & EitherObj<{
|
|
29
|
+
/** Seconds until the Alert auto-closes.
|
|
30
|
+
*
|
|
31
|
+
* Mosueover and keyboard focus resets the timer.
|
|
32
|
+
*/
|
|
33
|
+
autoClose: number;
|
|
34
|
+
/** Return `false` to prevent the alert from closing. */
|
|
35
|
+
onClose?: () => void | boolean;
|
|
36
|
+
/** Callback that fires when the alert has closed/transitoned out */
|
|
37
|
+
onClosed: () => void;
|
|
38
|
+
}, {
|
|
39
|
+
/** @deprecated This signature with the `event` argument will be removed in hanna-react v0.11
|
|
40
|
+
*
|
|
41
|
+
* Return `false` to prevent the alert from closing
|
|
42
|
+
*/
|
|
43
|
+
onClose?(event: MouseEvent): void | boolean;
|
|
44
|
+
/** Callback that fires after the alert has closed/transitoned out */
|
|
45
|
+
onClosed?(): void;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const Alert: (props: AlertProps) => JSX.Element;
|
|
48
|
+
export default Alert;
|
package/esm/Alert.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState, } from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { getTexts } from '@reykjavik/hanna-utils/i18n';
|
|
4
|
+
import { Button } from './_abstract/_Button.js';
|
|
5
|
+
import { isPreact } from './utils/env.js';
|
|
6
|
+
import { useIsBrowserSide } from './utils.js';
|
|
7
|
+
// FIXME: Eventually import from @reykjavik/hanna-css
|
|
8
|
+
const AlertCloseTransitionDuration = 400;
|
|
9
|
+
const useAutoClosing = (autoClose) => {
|
|
10
|
+
const [temp, setTemp] = useState(0);
|
|
11
|
+
if (!autoClose) {
|
|
12
|
+
return { autoClosing: false };
|
|
13
|
+
}
|
|
14
|
+
const thaw = () => setTemp((temp) => temp + 1);
|
|
15
|
+
const freeze = () => setTemp((temp) => temp - 1);
|
|
16
|
+
return {
|
|
17
|
+
autoClosing: temp === 0,
|
|
18
|
+
autoClosingProps: Object.assign({ onMouseEnter: freeze, onMouseLeave: thaw, onFocus: freeze, onBlur: thaw }, (isPreact && {
|
|
19
|
+
onfocusin: (e) => e.currentTarget !== e.target && freeze(),
|
|
20
|
+
onfocusout: (e) => e.currentTarget !== e.target && thaw(),
|
|
21
|
+
})),
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export const defaultAlertTexts = {
|
|
25
|
+
en: { closeLabel: 'Hide' },
|
|
26
|
+
is: { closeLabel: 'Fela' },
|
|
27
|
+
};
|
|
28
|
+
export const alertTypes = {
|
|
29
|
+
info: 1,
|
|
30
|
+
success: 1,
|
|
31
|
+
warning: 1,
|
|
32
|
+
error: 1,
|
|
33
|
+
critical: 1,
|
|
34
|
+
};
|
|
35
|
+
export const Alert = (props) => {
|
|
36
|
+
const { type, childrenHTML, children, onClose, closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, } = props;
|
|
37
|
+
const autoClose = Math.max(props.autoClose || 0, 0);
|
|
38
|
+
const closing = useRef();
|
|
39
|
+
const [open, setOpen] = useState(!!ssr);
|
|
40
|
+
const isBrowser = useIsBrowserSide(ssr);
|
|
41
|
+
const showCloseButton = closable && (isBrowser || closeUrl != null);
|
|
42
|
+
const { closeLabel, closeLabelLong } = getTexts(props, defaultAlertTexts);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setOpen(true);
|
|
45
|
+
}, []);
|
|
46
|
+
const closeAlert = useCallback((event) => {
|
|
47
|
+
const ret = onClose &&
|
|
48
|
+
// @ts-expect-error (@deprecated `event` parameter will be removed in v0.11)
|
|
49
|
+
onClose(event);
|
|
50
|
+
if (ret !== false) {
|
|
51
|
+
setOpen(false);
|
|
52
|
+
if (closing.current) {
|
|
53
|
+
clearTimeout(closing.current);
|
|
54
|
+
closing.current = undefined;
|
|
55
|
+
}
|
|
56
|
+
closing.current = setTimeout(() => {
|
|
57
|
+
onClosed && onClosed();
|
|
58
|
+
}, AlertCloseTransitionDuration);
|
|
59
|
+
}
|
|
60
|
+
}, [onClose, onClosed]);
|
|
61
|
+
const { autoClosing, autoClosingProps } = useAutoClosing(autoClose);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (autoClosing) {
|
|
64
|
+
let autoCloseTimeout;
|
|
65
|
+
autoCloseTimeout = setTimeout(() => {
|
|
66
|
+
closeAlert();
|
|
67
|
+
}, autoClose * 1000);
|
|
68
|
+
return () => {
|
|
69
|
+
if (autoCloseTimeout) {
|
|
70
|
+
clearTimeout(autoCloseTimeout);
|
|
71
|
+
autoCloseTimeout = undefined;
|
|
72
|
+
}
|
|
73
|
+
if (closing.current) {
|
|
74
|
+
clearTimeout(closing.current);
|
|
75
|
+
closing.current = undefined;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}, [closeAlert, autoClosing, autoClose]);
|
|
80
|
+
return (React.createElement("div", Object.assign({ className: getBemClass('Alert', [
|
|
81
|
+
!!alertTypes[type] && type,
|
|
82
|
+
closable && 'closable',
|
|
83
|
+
]), role: "alert", hidden: !open || undefined }, autoClosingProps),
|
|
84
|
+
childrenHTML ? (React.createElement("div", { dangerouslySetInnerHTML: { __html: childrenHTML } })) : (children),
|
|
85
|
+
' ',
|
|
86
|
+
showCloseButton && (React.createElement(Button, Object.assign({ bem: "Alert__close" }, (closeUrl != null ? { href: closeUrl } : { type: 'button' }), { onClick: (e) => {
|
|
87
|
+
closeAlert(e);
|
|
88
|
+
}, "aria-label": closeLabelLong, title: closeLabelLong || closeLabel }), closeLabel))));
|
|
89
|
+
};
|
|
90
|
+
export default Alert;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Cleanup } from '@reykjavik/hanna-utils';
|
|
2
|
+
import { ImageCardListProps, ImageCardProps } from './_abstract/_CardList.js';
|
|
3
|
+
export type ArticleCardsItemProps = ImageCardProps;
|
|
4
|
+
/** @deprecated Use `ArticleCardsItemProps` instead (Remove in v0.11) */
|
|
5
|
+
export type ArticleCardProps = ArticleCardsItemProps;
|
|
6
|
+
export type ArticleCardsProps = Cleanup<Pick<ImageCardListProps, 'cards' | 'imgPlaceholder'>>;
|
|
7
|
+
export declare const ArticleCards: (props: ArticleCardsProps) => JSX.Element;
|
|
8
|
+
export default ArticleCards;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CardList } from './_abstract/_CardList.js';
|
|
3
|
+
export const ArticleCards = (props) => (React.createElement(CardList, { bemPrefix: "ArticleCards", standalone: true, cards: props.cards, imgPlaceholder: props.imgPlaceholder || true }));
|
|
4
|
+
export default ArticleCards;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HannaColorTheme } from '@reykjavik/hanna-css';
|
|
2
|
+
import { Illustration } from '@reykjavik/hanna-utils/assets';
|
|
3
|
+
import { ImageProps } from '../_abstract/_Image.js';
|
|
4
|
+
import { ColorFamily } from '../constants.js';
|
|
5
|
+
export type ArticleCarouselImageProps = ImageProps & {
|
|
6
|
+
photo?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type ArticleCarouselCardProps = {
|
|
9
|
+
date?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
href: string;
|
|
13
|
+
target?: string;
|
|
14
|
+
color?: ColorFamily;
|
|
15
|
+
/** NOTE: if both `color` and `theme` are specified
|
|
16
|
+
* then `color` takes precedence.
|
|
17
|
+
*/
|
|
18
|
+
theme?: HannaColorTheme;
|
|
19
|
+
} & ({
|
|
20
|
+
illustration: Illustration;
|
|
21
|
+
image?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
illustration?: undefined;
|
|
24
|
+
image: ArticleCarouselImageProps | undefined;
|
|
25
|
+
});
|
|
26
|
+
export declare const ArticleCarouselCard: (props: ArticleCarouselCardProps & {
|
|
27
|
+
moreLabel?: string;
|
|
28
|
+
}) => JSX.Element;
|