@reykjavik/hanna-react 0.10.83 → 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 +13 -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 +390 -4
- 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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Cleanup } from '@reykjavik/hanna-utils';
|
|
2
|
+
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
3
|
+
import { AuxilaryPanelIllustration, AuxiliaryPanelProps } from './MainMenu/_Auxiliary.js';
|
|
4
|
+
import { MegaMenuItem, MegaMenuPanel, PrimaryPanelI18n } from './MainMenu/_PrimaryPanel.js';
|
|
5
|
+
import { SSRSupport } from './utils.js';
|
|
6
|
+
export type MainMenuI18n = Cleanup<{
|
|
7
|
+
lang?: string;
|
|
8
|
+
homeLabel?: string;
|
|
9
|
+
} & PrimaryPanelI18n>;
|
|
10
|
+
export declare const defaultMainMenuTexts: DefaultTexts<Required<MainMenuI18n>>;
|
|
11
|
+
export type { AuxilaryPanelIllustration, AuxiliaryPanelProps, MegaMenuItem, MegaMenuPanel, };
|
|
12
|
+
export type MainMenuItem = {
|
|
13
|
+
label: string;
|
|
14
|
+
labelLong?: string;
|
|
15
|
+
lang?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Puts a modifier className on the menu item element.
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
*
|
|
21
|
+
* ```html
|
|
22
|
+
* <li class="MainMenu__item MainMenu__item--${modifier}">
|
|
23
|
+
* ```
|
|
24
|
+
* */
|
|
25
|
+
modifier?: string;
|
|
26
|
+
current?: boolean;
|
|
27
|
+
href?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Adding `onClick` automatically results in a <button/> element being rendered.
|
|
30
|
+
*
|
|
31
|
+
* NOTE: Clicking a MainMenu item will automatically close HannaUIState's
|
|
32
|
+
* "Hamburger menu" (a.k.a. "Mobile menu")
|
|
33
|
+
* … unless the `onClick` function explicitly returns `false`.
|
|
34
|
+
*/
|
|
35
|
+
onClick?: (index: number, item: MainMenuItem) => void | boolean;
|
|
36
|
+
controlsId?: string;
|
|
37
|
+
};
|
|
38
|
+
export type MainMenuSeparator = '---';
|
|
39
|
+
export type MainMenuItemList = Array<MainMenuItem | MainMenuSeparator>;
|
|
40
|
+
export type MainMenuProps = {
|
|
41
|
+
title: string;
|
|
42
|
+
items: MainMenuItemList;
|
|
43
|
+
/**
|
|
44
|
+
* Link for the homepage - defaults to `"/"` adding a
|
|
45
|
+
* generic sounding "Home"/"Forsíða" label
|
|
46
|
+
*/
|
|
47
|
+
homeLink?: string | Omit<MainMenuItem, 'modifier'>;
|
|
48
|
+
megaPanels?: Array<MegaMenuPanel>;
|
|
49
|
+
auxiliaryPanel?: AuxiliaryPanelProps;
|
|
50
|
+
/**
|
|
51
|
+
* NOTE: Clicking a MainMenu item will automatically close HannaUIState's
|
|
52
|
+
* "Hamburger menu" (a.k.a. "Mobile menu")
|
|
53
|
+
* … unless the `onItemClick` function explicitly returns `false`.
|
|
54
|
+
*/
|
|
55
|
+
onItemClick?: (index: number, item: MainMenuItem) => void | boolean;
|
|
56
|
+
activePanelId?: string;
|
|
57
|
+
texts?: MainMenuI18n;
|
|
58
|
+
lang?: string;
|
|
59
|
+
ssr?: SSRSupport;
|
|
60
|
+
};
|
|
61
|
+
export declare const MainMenu: (props: MainMenuProps) => JSX.Element | null;
|
|
62
|
+
export default MainMenu;
|
package/esm/MainMenu.js
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import focusElm from '@hugsmidjan/qj/focusElm';
|
|
3
|
+
import useShortState from '@hugsmidjan/react/hooks/useShortState';
|
|
4
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
5
|
+
import { getPageScrollElm } from '@reykjavik/hanna-utils';
|
|
6
|
+
import { getTexts } from '@reykjavik/hanna-utils/i18n';
|
|
7
|
+
import { Link } from './_abstract/_Link.js';
|
|
8
|
+
import { AuxiliaryPanel, } from './MainMenu/_Auxiliary.js';
|
|
9
|
+
import { PrimaryPanel, } from './MainMenu/_PrimaryPanel.js';
|
|
10
|
+
import { useHannaUIState } from './utils/HannaUIState.js';
|
|
11
|
+
import { useFormatMonitor } from './utils/useFormatMonitor.js';
|
|
12
|
+
import { useIsBrowserSide } from './utils.js';
|
|
13
|
+
const findActivePanel = (megaPanels, activeId) => activeId ? megaPanels.find((panel) => activeId === panel.id) : undefined;
|
|
14
|
+
export const defaultMainMenuTexts = {
|
|
15
|
+
is: {
|
|
16
|
+
lang: 'is',
|
|
17
|
+
homeLabel: 'Forsíða',
|
|
18
|
+
backToMenu: 'Loka',
|
|
19
|
+
backToMenuLong: 'Til baka í valmynd',
|
|
20
|
+
},
|
|
21
|
+
en: {
|
|
22
|
+
lang: 'en',
|
|
23
|
+
homeLabel: 'Home page',
|
|
24
|
+
backToMenu: 'Close',
|
|
25
|
+
backToMenuLong: 'Close and return to menu',
|
|
26
|
+
},
|
|
27
|
+
pl: {
|
|
28
|
+
lang: 'pl',
|
|
29
|
+
homeLabel: 'Strona główna',
|
|
30
|
+
backToMenu: 'Zamknij',
|
|
31
|
+
backToMenuLong: 'Zamknij i wróć do menu',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
const _issueHomeLinkWarnings = (hasHomeItem, hasHomeLinkProp) => {
|
|
36
|
+
const bothDefined = hasHomeItem && hasHomeLinkProp;
|
|
37
|
+
const neitherDefined = !hasHomeItem && !hasHomeLinkProp;
|
|
38
|
+
if (bothDefined) {
|
|
39
|
+
console.warn('Ignoring a redundant `MainMenuProps.homeLink` value. ' +
|
|
40
|
+
'(As `MainMenuProps.items` already starts with a "Home" item.)');
|
|
41
|
+
}
|
|
42
|
+
else if (neitherDefined) {
|
|
43
|
+
console.warn('`MainMenuProps.homeLink` is missing. Auto-inserting a generic "home link" with `href="/"`.');
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const normalizeMenuItems = (itemsProp, megaPanels, homeLink, texts) => {
|
|
47
|
+
const items = itemsProp.map((item) => {
|
|
48
|
+
if (item === '---') {
|
|
49
|
+
return item;
|
|
50
|
+
}
|
|
51
|
+
const href = item.href;
|
|
52
|
+
const controlsId = item.controlsId || (href && /^#/.test(href) && href.slice(1)) || undefined;
|
|
53
|
+
const megaPanel = controlsId
|
|
54
|
+
? megaPanels.find((panel) => panel.id === controlsId)
|
|
55
|
+
: undefined;
|
|
56
|
+
return Object.assign(Object.assign({}, item), { controlsId, megaPanel });
|
|
57
|
+
});
|
|
58
|
+
const firstItem = items[0];
|
|
59
|
+
if (firstItem) {
|
|
60
|
+
// Prepend menu item list with a "home link", unless it's already there
|
|
61
|
+
const hasHomeItem = typeof firstItem === 'object' && firstItem.modifier === 'home';
|
|
62
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
63
|
+
_issueHomeLinkWarnings(hasHomeItem, !!homeLink);
|
|
64
|
+
}
|
|
65
|
+
if (!hasHomeItem) {
|
|
66
|
+
if (!homeLink || typeof homeLink === 'string') {
|
|
67
|
+
let label = texts.homeLabel;
|
|
68
|
+
let lang;
|
|
69
|
+
if (label == null) {
|
|
70
|
+
const def = defaultMainMenuTexts[texts.lang || 'en'] ||
|
|
71
|
+
defaultMainMenuTexts.en ||
|
|
72
|
+
defaultMainMenuTexts.is;
|
|
73
|
+
label = def.homeLabel;
|
|
74
|
+
lang = def.lang;
|
|
75
|
+
}
|
|
76
|
+
homeLink = { href: homeLink || '/', label, lang };
|
|
77
|
+
}
|
|
78
|
+
items.unshift(Object.assign(Object.assign({}, homeLink), { modifier: 'home' }));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return items;
|
|
82
|
+
};
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
const emptyPanelList = [];
|
|
85
|
+
export const MainMenu = (props) => {
|
|
86
|
+
const { title, megaPanels = emptyPanelList, onItemClick, ssr, auxiliaryPanel } = props;
|
|
87
|
+
const texts = getTexts(props, defaultMainMenuTexts);
|
|
88
|
+
const { closeHamburgerMenu } = useHannaUIState();
|
|
89
|
+
const isBrowser = useIsBrowserSide(ssr);
|
|
90
|
+
const menuElmRef = useRef(null);
|
|
91
|
+
const pressedLinkRef = useRef(null);
|
|
92
|
+
const activePanelRef = useRef(null);
|
|
93
|
+
const [activePanel, _setActivePanel] = useState(() => isBrowser && findActivePanel(megaPanels, props.activePanelId));
|
|
94
|
+
const [laggyActivePanel, setLaggyActivePanel] = useShortState();
|
|
95
|
+
const setActivePanel = useMemo(() => isBrowser
|
|
96
|
+
? (newActive, setFocus = true) => {
|
|
97
|
+
const htmlElmDataset = document.documentElement.dataset;
|
|
98
|
+
// const menuElm = menuElmRef.current as HTMLElement;
|
|
99
|
+
_setActivePanel((activePanel) => {
|
|
100
|
+
const scrollElm = getPageScrollElm();
|
|
101
|
+
if (!newActive) {
|
|
102
|
+
activePanel && setLaggyActivePanel(activePanel, 1000);
|
|
103
|
+
scrollElm.scrollTop = parseInt(htmlElmDataset.scrollTop || '') || 0;
|
|
104
|
+
delete htmlElmDataset.scrollTop;
|
|
105
|
+
delete htmlElmDataset.megaPanelActive;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
setLaggyActivePanel(undefined, 0);
|
|
109
|
+
htmlElmDataset.scrollTop = String(scrollElm.scrollTop);
|
|
110
|
+
scrollElm.scrollTop = 0;
|
|
111
|
+
htmlElmDataset.megaPanelActive = '';
|
|
112
|
+
}
|
|
113
|
+
if (setFocus) {
|
|
114
|
+
const pressedLinkElm = pressedLinkRef.current; // pressedLinkElm will be undefined when setTimeout fires
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
if (!newActive) {
|
|
117
|
+
// const buttonElm = menuElm.querySelector<HTMLButtonElement>(
|
|
118
|
+
// 'button.MainMenu__link[aria-pressed="true"]'
|
|
119
|
+
// );
|
|
120
|
+
focusElm(pressedLinkElm);
|
|
121
|
+
}
|
|
122
|
+
else if (newActive !== activePanel) {
|
|
123
|
+
// const panelElm = menuElm.querySelector<HTMLButtonElement>(
|
|
124
|
+
// '.PrimaryPanel--active'
|
|
125
|
+
// );
|
|
126
|
+
focusElm(activePanelRef.current);
|
|
127
|
+
}
|
|
128
|
+
}, 100);
|
|
129
|
+
}
|
|
130
|
+
return newActive;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
: () => undefined, [setLaggyActivePanel, isBrowser]);
|
|
134
|
+
useFormatMonitor((media) => {
|
|
135
|
+
if (media.leftTopmenu) {
|
|
136
|
+
setActivePanel(undefined);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const hasActivePanel = !!activePanel;
|
|
140
|
+
const menuItems = useMemo(() => normalizeMenuItems(props.items, megaPanels, props.homeLink, texts), [props.items, props.homeLink, megaPanels, texts]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
setActivePanel(findActivePanel(megaPanels, props.activePanelId));
|
|
143
|
+
}, [props.activePanelId, megaPanels, setActivePanel]);
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
const menuElm = menuElmRef.current;
|
|
146
|
+
if (!isBrowser || !hasActivePanel || !menuElm) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const escHandler = (e) => {
|
|
150
|
+
if (e.key === 'Escape') {
|
|
151
|
+
setActivePanel(undefined);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const clickHandler = (e) => {
|
|
155
|
+
if (!menuElm.contains(e.target)) {
|
|
156
|
+
setActivePanel(undefined);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
document.addEventListener('keydown', escHandler);
|
|
160
|
+
document.addEventListener('click', clickHandler, true);
|
|
161
|
+
return () => {
|
|
162
|
+
document.removeEventListener('keydown', escHandler);
|
|
163
|
+
document.removeEventListener('click', clickHandler, true);
|
|
164
|
+
};
|
|
165
|
+
}, [hasActivePanel, setActivePanel, isBrowser]);
|
|
166
|
+
if (menuItems.length === 0) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
/** Close mega panels on clicks their links. */
|
|
170
|
+
const handleMegaPanelClicks = (e) => {
|
|
171
|
+
if (
|
|
172
|
+
// NOTE: We can NOT check for `e.defaultPrevented` because if the current
|
|
173
|
+
// LinkRenderer is something like Next.js or Remix's <Link/> compponent
|
|
174
|
+
// then default is ALWAYS prevented
|
|
175
|
+
e.target.closest('a[href]')) {
|
|
176
|
+
setActivePanel(undefined);
|
|
177
|
+
closeHamburgerMenu();
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
return (React.createElement("nav", { className: "MainMenu", "aria-label": title, "data-sprinkled": isBrowser, ref: menuElmRef },
|
|
181
|
+
React.createElement("h2", { className: "MainMenu__title" }, title),
|
|
182
|
+
React.createElement("ul", { className: "MainMenu__items" }, menuItems.map((item, i) => {
|
|
183
|
+
if (item === '---') {
|
|
184
|
+
return React.createElement("li", { key: i, className: "MainMenu__separator", "aria-hidden": "true" });
|
|
185
|
+
}
|
|
186
|
+
const { label, labelLong, lang, controlsId, onClick } = item;
|
|
187
|
+
const pressed = (activePanel && controlsId === activePanel.id) || undefined;
|
|
188
|
+
return (React.createElement("li", { key: i, className: getBemClass('MainMenu__item', item.modifier), "aria-current": item.current || undefined }, onClick || (!!item.megaPanel && (isBrowser || !item.href)) ? (
|
|
189
|
+
// only print script-driven buttons in the browser
|
|
190
|
+
React.createElement("button", { className: "MainMenu__link", onClick: () => {
|
|
191
|
+
const keepOpen1 = onClick && onClick(i, item) === false;
|
|
192
|
+
const keepOpen2 = onItemClick && onItemClick(i, item) === false;
|
|
193
|
+
const { megaPanel } = item;
|
|
194
|
+
if (megaPanel) {
|
|
195
|
+
setActivePanel(megaPanel !== activePanel ? megaPanel : undefined);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
!(keepOpen1 || keepOpen2) && closeHamburgerMenu();
|
|
199
|
+
}
|
|
200
|
+
}, ref: pressed && pressedLinkRef, "aria-pressed": pressed, "aria-controls": controlsId, "aria-label": labelLong, title: labelLong, lang: lang, type: "button" }, label)) : item.href != null ? (
|
|
201
|
+
// always render links server-side
|
|
202
|
+
React.createElement(Link, { className: "MainMenu__link", href: item.href, "aria-label": labelLong, title: labelLong, onClick: () => {
|
|
203
|
+
const keepOpen = onItemClick && onItemClick(i, item) === false;
|
|
204
|
+
!keepOpen && closeHamburgerMenu();
|
|
205
|
+
}, lang: lang }, label)) : undefined // skip rendering non-link menu items server side
|
|
206
|
+
));
|
|
207
|
+
})),
|
|
208
|
+
'\n\n',
|
|
209
|
+
megaPanels.length > 0 && (React.createElement("div", { className: getBemClass('MainMenu__panelsWrap', [activePanel && 'active']) },
|
|
210
|
+
React.createElement("ul", { className: "MainMenu__panels", onClick: handleMegaPanelClicks },
|
|
211
|
+
megaPanels.map((panel, i) => {
|
|
212
|
+
if (!panel.items.length) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const isActive = activePanel === panel || laggyActivePanel === panel || undefined;
|
|
216
|
+
const isParent = !!panel.items.find((item) => item.current);
|
|
217
|
+
return (React.createElement(PrimaryPanel, { key: i, isParent: isParent, isActive: isActive, panel: panel, isBrowser: isBrowser, setActivePanel: setActivePanel, texts: texts, activeRef: activePanelRef }));
|
|
218
|
+
}),
|
|
219
|
+
auxiliaryPanel && React.createElement(AuxiliaryPanel, Object.assign({}, auxiliaryPanel)))))));
|
|
220
|
+
};
|
|
221
|
+
export default MainMenu;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ButtonProps } from './_abstract/_Button.js';
|
|
2
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
export type MiniMetricsProps = {
|
|
4
|
+
text: string;
|
|
5
|
+
moreButton: ButtonProps;
|
|
6
|
+
} & SeenProp;
|
|
7
|
+
export declare const MiniMetrics: (props: MiniMetricsProps) => JSX.Element;
|
|
8
|
+
export default MiniMetrics;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from './_abstract/_Button.js';
|
|
3
|
+
import SeenEffect from './SeenEffect.js';
|
|
4
|
+
export const MiniMetrics = (props) => {
|
|
5
|
+
const { text, moreButton, startSeen } = props;
|
|
6
|
+
return (React.createElement(SeenEffect, { className: "MiniMetrics", startSeen: startSeen },
|
|
7
|
+
React.createElement("strong", { className: "MiniMetrics__text" }, text),
|
|
8
|
+
" ",
|
|
9
|
+
'\n',
|
|
10
|
+
React.createElement(Button, Object.assign({ bem: "MiniMetrics__more" }, moreButton))));
|
|
11
|
+
};
|
|
12
|
+
export default MiniMetrics;
|
package/esm/Modal.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ModalProps as _ModalProps } from '@hugsmidjan/react/Modal';
|
|
3
|
+
export type ModalProps = Omit<_ModalProps, 'bem' | 'bodyWrap' | 'modifier'> & {
|
|
4
|
+
modifier?: 'w6' | 'w8' | 'w10';
|
|
5
|
+
bling?: ReactElement;
|
|
6
|
+
};
|
|
7
|
+
export declare const Modal: (props: ModalProps) => JSX.Element;
|
|
8
|
+
export default Modal;
|
package/esm/Modal.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import _Modal from '@hugsmidjan/react/Modal';
|
|
3
|
+
export const Modal = (props) => {
|
|
4
|
+
const { closeDelay = 500, texts = {
|
|
5
|
+
closeButton: 'Loka ',
|
|
6
|
+
}, bling, children, render = () => children, } = props;
|
|
7
|
+
return (React.createElement(_Modal, Object.assign({}, props, { bodyWrap: false, bem: "Modal", closeDelay: closeDelay, texts: texts, render: (args) => bling ? (React.createElement(React.Fragment, null,
|
|
8
|
+
render(args),
|
|
9
|
+
React.createElement("div", { className: "Modal__blings" },
|
|
10
|
+
React.createElement("div", { className: "Modal__blings__inner" }, bling)))) : (render(args)),
|
|
11
|
+
// eslint-disable-next-line react/no-children-prop
|
|
12
|
+
children: undefined })));
|
|
13
|
+
};
|
|
14
|
+
export default Modal;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type NameCardI18n = {
|
|
2
|
+
updatedLabel: string;
|
|
3
|
+
availableLabel: string;
|
|
4
|
+
unavailableLabel: string;
|
|
5
|
+
/** @deprecated Use availableLabel instead (will be removed in v0.11) */
|
|
6
|
+
vacancyLabel?: string;
|
|
7
|
+
/** @deprecated Use unavailableLabel instead (will be removed in v0.11) */
|
|
8
|
+
noVacancyLabel?: string;
|
|
9
|
+
/** @deprecated Not used anymore (will be rmoved in v0.11) */
|
|
10
|
+
telLabel?: string;
|
|
11
|
+
};
|
|
12
|
+
type ContactInfo = {
|
|
13
|
+
href: string;
|
|
14
|
+
label: string;
|
|
15
|
+
longLabel?: string;
|
|
16
|
+
};
|
|
17
|
+
/** @deprecated use label and longLabel props instead (Will be removed in v0.11) */
|
|
18
|
+
type DeprecatedContactInfo = {
|
|
19
|
+
href: string;
|
|
20
|
+
value: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
};
|
|
23
|
+
export type NameCardProps = {
|
|
24
|
+
name: string;
|
|
25
|
+
/** Phone numbers, e-mail addresses, etc. */
|
|
26
|
+
contactInfo?: Array<string | ContactInfo | DeprecatedContactInfo>;
|
|
27
|
+
/** Address/location info
|
|
28
|
+
*
|
|
29
|
+
* Special handling of string:
|
|
30
|
+
* Inserts `<br/>`s on `\n`. Collapses multiple `\n`s.
|
|
31
|
+
*
|
|
32
|
+
* Only simple, inline element HTML allowed
|
|
33
|
+
*/
|
|
34
|
+
location?: string | JSX.Element;
|
|
35
|
+
/** Misc info such as opening-hours, etc.
|
|
36
|
+
*
|
|
37
|
+
* Special handling of string:
|
|
38
|
+
* Inserts `<br/>`s on `\n`. Collapses multiple `\n`s.
|
|
39
|
+
*
|
|
40
|
+
* Only simple, inline element HTML allowed
|
|
41
|
+
*/
|
|
42
|
+
aboutText?: string | JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* Designated for info about working/opening hours
|
|
45
|
+
*
|
|
46
|
+
* Special handling of string:
|
|
47
|
+
* Inserts `<br/>`s on `\n`. Collapses multiple `\n`s.
|
|
48
|
+
*
|
|
49
|
+
* Only simple, inline element HTML allowed
|
|
50
|
+
*/
|
|
51
|
+
hours?: string | JSX.Element;
|
|
52
|
+
/** Displays "active" indicator. Use for vacancies, inline-status, etc. */
|
|
53
|
+
available?: boolean;
|
|
54
|
+
/** Meta data about freshness status, etc. */
|
|
55
|
+
updated?: string | Date;
|
|
56
|
+
lang?: string;
|
|
57
|
+
texts?: NameCardI18n;
|
|
58
|
+
/** @deprecated Use `available` instead (will be removed in v0.11) */
|
|
59
|
+
vacancy?: boolean;
|
|
60
|
+
/** @deprecated Use `contactInfo` instead (will be removed in v0.11) */
|
|
61
|
+
tel?: string | Array<string>;
|
|
62
|
+
};
|
|
63
|
+
export declare const NameCard: (props: NameCardProps) => JSX.Element;
|
|
64
|
+
export default NameCard;
|
package/esm/NameCard.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React 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 { breakOnNL } from './_abstract/breakOnNL.js';
|
|
6
|
+
const formatDate = (date) => {
|
|
7
|
+
return typeof date === 'string'
|
|
8
|
+
? date
|
|
9
|
+
: date.toISOString().slice(0, 10).replace(/-/g, '.');
|
|
10
|
+
};
|
|
11
|
+
const _telToContactInfo = (tel) => {
|
|
12
|
+
if (!tel) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
tel = typeof tel === 'string' ? [tel] : tel;
|
|
16
|
+
return tel.map((tel) => ({
|
|
17
|
+
href: 'tel:' + tel,
|
|
18
|
+
value: tel,
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
const renderContent = (content) => typeof content === 'string' ? breakOnNL(content) : content;
|
|
22
|
+
const defaultTexts = {
|
|
23
|
+
en: {
|
|
24
|
+
updatedLabel: 'Updated on',
|
|
25
|
+
availableLabel: '',
|
|
26
|
+
unavailableLabel: '',
|
|
27
|
+
vacancyLabel: 'Vacancy',
|
|
28
|
+
noVacancyLabel: 'No vacancy',
|
|
29
|
+
},
|
|
30
|
+
is: {
|
|
31
|
+
updatedLabel: 'Uppfært síðast',
|
|
32
|
+
availableLabel: '',
|
|
33
|
+
unavailableLabel: '',
|
|
34
|
+
vacancyLabel: 'Laus pláss',
|
|
35
|
+
noVacancyLabel: 'Ekki laus pláss',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export const NameCard = (props) => {
|
|
39
|
+
const { name, location, hours, aboutText, available = props.vacancy, updated } = props;
|
|
40
|
+
const renderMeta = () => {
|
|
41
|
+
if (available == null && !updated) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const texts = getTexts(props, defaultTexts);
|
|
45
|
+
const { updatedLabel, availableLabel, unavailableLabel } = texts;
|
|
46
|
+
return (React.createElement("div", { className: "NameCard__meta" },
|
|
47
|
+
available != null && (React.createElement("span", { className: getBemClass('NameCard__availability', available && 'available') },
|
|
48
|
+
available
|
|
49
|
+
? availableLabel || texts.vacancyLabel
|
|
50
|
+
: unavailableLabel || texts.noVacancyLabel,
|
|
51
|
+
' ')),
|
|
52
|
+
updated != null && (React.createElement("span", { className: "NameCard__updated" },
|
|
53
|
+
updatedLabel,
|
|
54
|
+
" ",
|
|
55
|
+
formatDate(updated)))));
|
|
56
|
+
};
|
|
57
|
+
let contactInfo = props.contactInfo;
|
|
58
|
+
if (!contactInfo) {
|
|
59
|
+
contactInfo = _telToContactInfo(props.tel) || [];
|
|
60
|
+
}
|
|
61
|
+
// Remove/map @deprecated contactinfo items
|
|
62
|
+
const cleanContactInfo = contactInfo.map((item) => {
|
|
63
|
+
if (typeof item !== 'string' && 'value' in item) {
|
|
64
|
+
return {
|
|
65
|
+
href: item.href,
|
|
66
|
+
label: item.value,
|
|
67
|
+
longLabel: item.label,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return item;
|
|
71
|
+
});
|
|
72
|
+
return (React.createElement("div", { className: "NameCard" },
|
|
73
|
+
React.createElement("div", { className: "NameCard__name" }, name),
|
|
74
|
+
contactInfo.length > 0 && (React.createElement("p", { className: "NameCard__contactinfo" }, cleanContactInfo.map((item, i) => (React.createElement(React.Fragment, null,
|
|
75
|
+
typeof item === 'string' ? (React.createElement("span", { className: "NameCard__contactinfo__item" }, item)) : (React.createElement(Button, { key: i, bem: "NameCard__contactinfo__item", href: item.href, "aria-label": item.longLabel, title: item.longLabel }, item.label)),
|
|
76
|
+
' '))))),
|
|
77
|
+
location && React.createElement("p", { className: "NameCard__location" }, renderContent(location)),
|
|
78
|
+
hours && React.createElement("p", { className: "NameCard__hours" }, renderContent(hours)),
|
|
79
|
+
aboutText && React.createElement("p", { className: "NameCard__abouttext" }, renderContent(aboutText)),
|
|
80
|
+
renderMeta()));
|
|
81
|
+
};
|
|
82
|
+
export default NameCard;
|
package/esm/NameCards.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import NameCard from './NameCard.js';
|
|
3
|
+
export const NameCards = (props) => {
|
|
4
|
+
const { items } = props;
|
|
5
|
+
return (React.createElement("div", { className: "NameCards" }, items.map((item, i) => (React.createElement(NameCard, Object.assign({ key: i }, item))))));
|
|
6
|
+
};
|
|
7
|
+
export default NameCards;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ImageProps } from './_abstract/_Image.js';
|
|
2
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
type BlingOptions = 'interesting' | 'snake' | 'pentagon' | 'dome' | 'balls-small' | 'balls-large';
|
|
4
|
+
export type NewsHeroProps = {
|
|
5
|
+
title: string;
|
|
6
|
+
meta?: string;
|
|
7
|
+
summary?: string | JSX.Element;
|
|
8
|
+
/** For custom sharing component */
|
|
9
|
+
sharing?: boolean | (() => JSX.Element);
|
|
10
|
+
image?: ImageProps;
|
|
11
|
+
blingType?: BlingOptions;
|
|
12
|
+
} & SeenProp;
|
|
13
|
+
export declare const NewsHero: (props: NewsHeroProps) => JSX.Element;
|
|
14
|
+
export default NewsHero;
|
package/esm/NewsHero.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { getStableRandomItem } from '@reykjavik/hanna-utils';
|
|
4
|
+
import { Blings } from './_abstract/_Blings.js';
|
|
5
|
+
import { Image } from './_abstract/_Image.js';
|
|
6
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
7
|
+
import ShareButtons from './ShareButtons.js';
|
|
8
|
+
const blingOptions = {
|
|
9
|
+
interesting: [
|
|
10
|
+
{
|
|
11
|
+
type: 'circle-xlarge',
|
|
12
|
+
parent: 'center',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'loops-small',
|
|
16
|
+
color: 'secondary',
|
|
17
|
+
align: 'left-ish',
|
|
18
|
+
vertical: 'down-ish',
|
|
19
|
+
parent: 'center',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
snake: [
|
|
23
|
+
{
|
|
24
|
+
type: 'snake-large',
|
|
25
|
+
align: 'left',
|
|
26
|
+
parent: 'top',
|
|
27
|
+
vertical: 'down',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
pentagon: [
|
|
31
|
+
{
|
|
32
|
+
type: 'pentagon-large',
|
|
33
|
+
align: 'left',
|
|
34
|
+
parent: 'center',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
dome: [
|
|
38
|
+
{
|
|
39
|
+
type: 'dome-large',
|
|
40
|
+
align: 'left-ish',
|
|
41
|
+
parent: 'top',
|
|
42
|
+
vertical: 'down',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
'balls-small': [
|
|
46
|
+
{
|
|
47
|
+
type: 'circle-large',
|
|
48
|
+
align: 'left',
|
|
49
|
+
parent: 'center',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'circle-small',
|
|
53
|
+
color: 'secondary',
|
|
54
|
+
align: 'right',
|
|
55
|
+
parent: 'bottom',
|
|
56
|
+
vertical: 'down',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
'balls-large': [
|
|
60
|
+
{
|
|
61
|
+
type: 'halfcircle-down-large',
|
|
62
|
+
align: 'left',
|
|
63
|
+
parent: 'bottom',
|
|
64
|
+
vertical: 'up',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'circle-medium',
|
|
68
|
+
color: 'secondary',
|
|
69
|
+
align: 'left-center',
|
|
70
|
+
parent: 'bottom',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
export const NewsHero = (props) => {
|
|
75
|
+
const { title, sharing = true, meta, summary, image, blingType, startSeen } = props;
|
|
76
|
+
const [ref] = useSeenEffect(startSeen);
|
|
77
|
+
const blings = (blingType && blingOptions[blingType]) || getStableRandomItem(blingOptions, title);
|
|
78
|
+
return (React.createElement("div", { className: getBemClass('NewsHero', [!image && 'align--right']), ref: ref },
|
|
79
|
+
React.createElement("div", { className: "NewsHero__content" },
|
|
80
|
+
React.createElement("h1", { className: "NewsHero__title" }, title),
|
|
81
|
+
meta && React.createElement("span", { className: "NewsHero__meta" }, meta),
|
|
82
|
+
React.createElement("div", { className: "NewsHero__summary" }, summary),
|
|
83
|
+
sharing === true ? React.createElement(ShareButtons, null) : sharing && sharing()),
|
|
84
|
+
image ? (React.createElement(Image, Object.assign({ className: "NewsHero__image" }, image))) : (React.createElement(Blings, { blings: blings }))));
|
|
85
|
+
};
|
|
86
|
+
export default NewsHero;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
3
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
4
|
+
export type PageFilterProps = {
|
|
5
|
+
title: string;
|
|
6
|
+
summary?: React.ReactNode;
|
|
7
|
+
footnote?: React.ReactNode;
|
|
8
|
+
buttonRow?: React.ReactNode;
|
|
9
|
+
underlap?: boolean;
|
|
10
|
+
} & EitherObj<{
|
|
11
|
+
filters: React.ReactNode;
|
|
12
|
+
}, {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}> & SeenProp;
|
|
15
|
+
export declare const PageFilter: (props: PageFilterProps) => JSX.Element;
|
|
16
|
+
export default PageFilter;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
|
+
import Footnote from './Footnote.js';
|
|
5
|
+
export const PageFilter = (props) => {
|
|
6
|
+
const { title, summary, footnote, filters, children, buttonRow, underlap, startSeen } = props;
|
|
7
|
+
const [ref] = useSeenEffect(startSeen);
|
|
8
|
+
return (React.createElement("div", { className: getBemClass('PageFilter', underlap && 'underlap'), ref: ref },
|
|
9
|
+
React.createElement("h2", { className: "PageFilter__title" }, title),
|
|
10
|
+
summary && React.createElement("div", { className: "PageFilter__summary" }, summary),
|
|
11
|
+
React.createElement("div", { className: "PageFilter__filters" }, filters || children),
|
|
12
|
+
React.createElement("div", { className: "PageFilter__buttons" }, buttonRow),
|
|
13
|
+
footnote && React.createElement(Footnote, null, footnote)));
|
|
14
|
+
};
|
|
15
|
+
export default PageFilter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
export type PageHeadingProps = {
|
|
4
|
+
Tag?: 'h1' | 'h2';
|
|
5
|
+
align?: 'right';
|
|
6
|
+
small?: boolean;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
} & SeenProp;
|
|
9
|
+
export declare const PageHeading: (props: PageHeadingProps) => JSX.Element;
|
|
10
|
+
export default PageHeading;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
|
+
export const PageHeading = (props) => {
|
|
5
|
+
const { Tag = 'h1', align, small, children, startSeen } = props;
|
|
6
|
+
const [ref] = useSeenEffect(startSeen);
|
|
7
|
+
return (React.createElement(Tag, { className: getBemClass('PageHeading', [
|
|
8
|
+
small && 'small',
|
|
9
|
+
align === 'right' && 'align--' + align,
|
|
10
|
+
]), ref: ref }, children));
|
|
11
|
+
};
|
|
12
|
+
export default PageHeading;
|
package/esm/Picture.d.ts
ADDED