@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/esm/Picture.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { Image } from './_abstract/_Image.js';
|
|
4
|
+
export const Picture = (props) => {
|
|
5
|
+
const { contain, className } = props;
|
|
6
|
+
return (React.createElement(Image, Object.assign({}, props, { className: getBemClass('Picture', contain && 'contain', className) })));
|
|
7
|
+
};
|
|
8
|
+
export default Picture;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ProcessOverviewItemProps = {
|
|
2
|
+
title: string;
|
|
3
|
+
content: string | JSX.Element;
|
|
4
|
+
};
|
|
5
|
+
export type ProcessOverviewProps = {
|
|
6
|
+
title: string;
|
|
7
|
+
items: Array<ProcessOverviewItemProps>;
|
|
8
|
+
attention?: string | JSX.Element;
|
|
9
|
+
transparent?: boolean;
|
|
10
|
+
narrow?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const ProcessOverview: (props: ProcessOverviewProps) => JSX.Element;
|
|
13
|
+
export default ProcessOverview;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
export const ProcessOverview = (props) => {
|
|
4
|
+
const { title, items, attention, transparent, narrow } = props;
|
|
5
|
+
return (React.createElement("div", { className: getBemClass('ProcessOverview', [
|
|
6
|
+
transparent && 'transparent',
|
|
7
|
+
narrow && 'narrow',
|
|
8
|
+
]) },
|
|
9
|
+
React.createElement("h2", { className: "ProcessOverview__title" }, title),
|
|
10
|
+
items.map(({ title, content }, i) => {
|
|
11
|
+
return (React.createElement("div", { key: i, className: "ProcessOverview__item" },
|
|
12
|
+
React.createElement("h3", { className: "ProcessOverview__item__title" }, title),
|
|
13
|
+
React.createElement("div", { className: "ProcessOverview__item__content" }, content)));
|
|
14
|
+
}),
|
|
15
|
+
attention && React.createElement("div", { className: "ProcessOverview__attention" }, attention)));
|
|
16
|
+
};
|
|
17
|
+
export default ProcessOverview;
|
package/esm/PullQuote.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TogglerGroupFieldOptions, TogglerGroupFieldProps } from './_abstract/_TogglerGroupField.js';
|
|
2
|
+
export type RadioButtonsGroupProps = TogglerGroupFieldProps & {
|
|
3
|
+
value?: string;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
/** @deprecated (Will be removed in v0.11) */
|
|
6
|
+
columns?: '2col' | '3col';
|
|
7
|
+
/** @deprecated (Will be removed in v0.11) */
|
|
8
|
+
layout?: 'slim';
|
|
9
|
+
};
|
|
10
|
+
export type RadioButtonsGroupOptions = TogglerGroupFieldOptions;
|
|
11
|
+
export declare const RadioButtonsGroup: (props: RadioButtonsGroupProps) => JSX.Element;
|
|
12
|
+
export default RadioButtonsGroup;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TogglerGroupField, } from './_abstract/_TogglerGroupField.js';
|
|
3
|
+
import { TogglerInput } from './_abstract/_TogglerInput.js';
|
|
4
|
+
const RadioButton = (props) => (React.createElement(TogglerInput, Object.assign({}, props, { bem: "RadioButton", type: "radio", innerWrap: true })));
|
|
5
|
+
export const RadioButtonsGroup = (props) => {
|
|
6
|
+
if (props.layout) {
|
|
7
|
+
console.warn('`RadioButtonsGroupProps.layout` is deprecated.');
|
|
8
|
+
}
|
|
9
|
+
if (props.columns) {
|
|
10
|
+
console.warn('`RadioButtonsGroupProps.columns` is deprecated.');
|
|
11
|
+
}
|
|
12
|
+
return (React.createElement(TogglerGroupField, Object.assign({}, props, { bem: "RadioButtonsGroup", Toggler: RadioButton, isRadio: true })));
|
|
13
|
+
};
|
|
14
|
+
export default RadioButtonsGroup;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TogglerGroupFieldOption, TogglerGroupFieldOptions, TogglerGroupFieldProps } from './_abstract/_TogglerGroupField.js';
|
|
2
|
+
import { TogglerInputProps } from './_abstract/_TogglerInput.js';
|
|
3
|
+
type RadioProps = Omit<TogglerInputProps, 'reqText'>;
|
|
4
|
+
export type RadioGroupProps = TogglerGroupFieldProps & {
|
|
5
|
+
layout?: 'inline';
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
};
|
|
9
|
+
export type RadioGroupOption = TogglerGroupFieldOption;
|
|
10
|
+
export type RadioGroupOptions = TogglerGroupFieldOptions;
|
|
11
|
+
export declare const RadioGroup: {
|
|
12
|
+
(props: RadioGroupProps): JSX.Element;
|
|
13
|
+
/** @deprecated Exposed for testing purposes only. This may disappear at any time. */
|
|
14
|
+
__Radio: (props: RadioProps) => JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TogglerGroupField, } from './_abstract/_TogglerGroupField.js';
|
|
3
|
+
import { TogglerInput } from './_abstract/_TogglerInput.js';
|
|
4
|
+
const Radio = (props) => React.createElement(TogglerInput, Object.assign({}, props, { bem: "Radio", type: "radio" }));
|
|
5
|
+
export const RadioGroup = (props) => (React.createElement(TogglerGroupField, Object.assign({}, props, { bem: "RadioGroup", modifier: props.layout, isRadio: true, Toggler: Radio })));
|
|
6
|
+
/** @deprecated Exposed for testing purposes only. This may disappear at any time. */
|
|
7
|
+
RadioGroup.__Radio = Radio;
|
|
8
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const types: {
|
|
2
|
+
readonly external: 1;
|
|
3
|
+
readonly document: 1;
|
|
4
|
+
readonly pdf: 1;
|
|
5
|
+
readonly link: 0;
|
|
6
|
+
};
|
|
7
|
+
export type RelatedLinkType = keyof typeof types;
|
|
8
|
+
export type RelatedLinkItem = {
|
|
9
|
+
href: string;
|
|
10
|
+
label: string;
|
|
11
|
+
target?: string;
|
|
12
|
+
type?: RelatedLinkType;
|
|
13
|
+
};
|
|
14
|
+
export type RelatedLinksProps = {
|
|
15
|
+
title?: string;
|
|
16
|
+
titleTag?: 'h2' | 'h3' | 'h4' | 'h5';
|
|
17
|
+
links: Array<RelatedLinkItem>;
|
|
18
|
+
};
|
|
19
|
+
export declare const RelatedLinks: (props: RelatedLinksProps) => JSX.Element | null;
|
|
20
|
+
export default RelatedLinks;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from './_abstract/_Link.js';
|
|
3
|
+
const types = {
|
|
4
|
+
external: 1,
|
|
5
|
+
document: 1,
|
|
6
|
+
pdf: 1,
|
|
7
|
+
link: 0,
|
|
8
|
+
};
|
|
9
|
+
export const RelatedLinks = (props) => {
|
|
10
|
+
const { title, links } = props;
|
|
11
|
+
if (links.length === 0) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const TitleTag = props.titleTag || 'h3';
|
|
15
|
+
return (React.createElement("div", { className: "RelatedLinks" },
|
|
16
|
+
title && React.createElement(TitleTag, { className: "RelatedLinks__title" }, title),
|
|
17
|
+
React.createElement("ul", { className: "RelatedLinks__list" }, links.map(({ href, label, type, target }, i) => {
|
|
18
|
+
type = type && types[type] ? type : undefined;
|
|
19
|
+
return (React.createElement("li", { key: i, className: "RelatedLinks__item" },
|
|
20
|
+
React.createElement(Link, { className: "RelatedLinks__link", href: href, "data-type": type, target: target },
|
|
21
|
+
' ',
|
|
22
|
+
label,
|
|
23
|
+
' ')));
|
|
24
|
+
}))));
|
|
25
|
+
};
|
|
26
|
+
export default RelatedLinks;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
3
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
4
|
+
export type RowBlockProps = {
|
|
5
|
+
/** Float the first RowBlockColumn to the right on larger screens. */
|
|
6
|
+
right?: boolean;
|
|
7
|
+
/** Custom **additional** class-name */
|
|
8
|
+
className?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
} & BemPropsModifier & SeenProp;
|
|
11
|
+
export declare const RowBlock: (props: RowBlockProps) => JSX.Element;
|
|
12
|
+
export default RowBlock;
|
package/esm/RowBlock.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
|
+
export const RowBlock = (props) => {
|
|
5
|
+
const { right, modifier, className, children, startSeen } = props;
|
|
6
|
+
const [ref] = useSeenEffect(startSeen);
|
|
7
|
+
return (React.createElement("div", { className: getBemClass('RowBlock', [modifier, right && 'align--right'], className), ref: ref }, children));
|
|
8
|
+
};
|
|
9
|
+
export default RowBlock;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type RowBlockColumnProps = {
|
|
3
|
+
background?: boolean | 'primary';
|
|
4
|
+
narrow?: boolean;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const RowBlockColumn: (props: RowBlockColumnProps) => JSX.Element;
|
|
8
|
+
export default RowBlockColumn;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
export const RowBlockColumn = (props) => {
|
|
4
|
+
const { background, narrow, children } = props;
|
|
5
|
+
return (React.createElement("div", { className: getBemClass('RowBlockColumn', [
|
|
6
|
+
narrow && 'narrow',
|
|
7
|
+
background && 'background',
|
|
8
|
+
background === 'primary' && 'background--primary',
|
|
9
|
+
]) }, children));
|
|
10
|
+
};
|
|
11
|
+
export default RowBlockColumn;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
|
+
type InputElmProps = JSX.IntrinsicElements['input'];
|
|
4
|
+
type BaseProps<Type extends {
|
|
5
|
+
type?: string;
|
|
6
|
+
}, InputProps extends object> = {
|
|
7
|
+
small?: boolean;
|
|
8
|
+
children?: never;
|
|
9
|
+
onButtonClick?: () => void;
|
|
10
|
+
buttonText?: string;
|
|
11
|
+
inputRef?: RefObject<HTMLInputElement>;
|
|
12
|
+
buttonRef?: RefObject<HTMLButtonElement>;
|
|
13
|
+
} & Type & FormFieldWrappingProps & InputProps;
|
|
14
|
+
export type SearchInputProps = BaseProps<{
|
|
15
|
+
type?: 'text';
|
|
16
|
+
}, InputElmProps>;
|
|
17
|
+
export declare const SearchInput: (props: SearchInputProps) => JSX.Element;
|
|
18
|
+
export default SearchInput;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
4
|
+
import FormField from './FormField.js';
|
|
5
|
+
export const SearchInput = (props) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const { className, label, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, onChange, small, onButtonClick, buttonText = 'Leita', ssr } = props, inputElementProps = __rest(props, ["className", "label", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "onChange", "small", "onButtonClick", "buttonText", "ssr"]);
|
|
8
|
+
const { value, defaultValue, placeholder } = inputElementProps;
|
|
9
|
+
const [hasValue, setHasValue] = useState(undefined);
|
|
10
|
+
const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
|
|
11
|
+
const empty = !filled && !placeholder;
|
|
12
|
+
const _onChange = value != null
|
|
13
|
+
? onChange
|
|
14
|
+
: (e) => {
|
|
15
|
+
setHasValue(!!e.target.value);
|
|
16
|
+
onChange && onChange(e);
|
|
17
|
+
};
|
|
18
|
+
return (React.createElement(FormField, { className: getBemClass('SearchInput', [], className), ssr: ssr, small: small, label: label, empty: empty, filled: filled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
|
|
19
|
+
React.createElement("input", Object.assign({ className: "SearchInput__input", onChange: _onChange }, inputProps, inputElementProps, { ref: props.inputRef })),
|
|
20
|
+
' ',
|
|
21
|
+
onButtonClick && (React.createElement("button", { className: "SearchInput__button", type: "button", onClick: onButtonClick, title: buttonText, ref: props.buttonRef, disabled: disabled || readOnly }, buttonText)))) }));
|
|
22
|
+
};
|
|
23
|
+
export default SearchInput;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type MetaValue = string | (() => JSX.Element | string | number);
|
|
2
|
+
export type SearchResultsItemProps = {
|
|
3
|
+
/** Plain text title */
|
|
4
|
+
title: string;
|
|
5
|
+
/** Simple HTML-encoded summary (excluding any layout) */
|
|
6
|
+
summary: string;
|
|
7
|
+
href: string;
|
|
8
|
+
meta?: MetaValue | ReadonlyArray<MetaValue>;
|
|
9
|
+
/**
|
|
10
|
+
* URL to the image to display with the result item.
|
|
11
|
+
* Should ideally be approximately 600-700px wide
|
|
12
|
+
*/
|
|
13
|
+
image?: string;
|
|
14
|
+
/** Should this search-result item be displayed as a "major"/"main" result at the top */
|
|
15
|
+
highlight?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const SearchResultsItem: (props: SearchResultsItemProps) => JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image } from '../_abstract/_Image.js';
|
|
3
|
+
import { Link } from '../_abstract/_Link.js';
|
|
4
|
+
export const SearchResultsItem = (props) => {
|
|
5
|
+
const { highlight, title, summary, href, meta, image } = props;
|
|
6
|
+
const bem = highlight ? 'SearchResultsHighlightItem' : 'SearchResultsItem';
|
|
7
|
+
const metaArr = (Array.isArray(meta) ? meta : [meta]);
|
|
8
|
+
return (React.createElement("li", { className: bem },
|
|
9
|
+
React.createElement(Link, { className: bem + '__link', href: href },
|
|
10
|
+
React.createElement("h3", { className: bem + '__title' }, title),
|
|
11
|
+
metaArr.length > 0 && (React.createElement("span", { className: bem + '__meta' }, metaArr.map((item, i) => typeof item === 'function' ? item() : item && React.createElement("span", { key: i }, item)))),
|
|
12
|
+
highlight && image && React.createElement(Image, { className: bem + '__image', src: image }),
|
|
13
|
+
React.createElement("div", { className: bem + '__summary', dangerouslySetInnerHTML: { __html: summary } }))));
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SearchResultsItemProps } from './SearchResults/_SearchResultsItem.js';
|
|
3
|
+
export type SearchReesultI18n = {
|
|
4
|
+
lang: string;
|
|
5
|
+
loadQueryTitle: string;
|
|
6
|
+
resultsTitle: string;
|
|
7
|
+
noResultsTitle: string;
|
|
8
|
+
loadMore: string;
|
|
9
|
+
};
|
|
10
|
+
export type SearchStatus = 'loadingquery' | 'loadingfilter' | 'error' | 'results' | 'loadingmore';
|
|
11
|
+
export type SearchResultsFilter = {
|
|
12
|
+
label: string;
|
|
13
|
+
count?: number;
|
|
14
|
+
};
|
|
15
|
+
export type { SearchResultsItemProps } from './SearchResults/_SearchResultsItem.js';
|
|
16
|
+
export type SearchResultsProps = {
|
|
17
|
+
/** Grand total number of searach results */
|
|
18
|
+
totalHits?: number;
|
|
19
|
+
/** Grand total number of searach results */
|
|
20
|
+
hits?: number;
|
|
21
|
+
query?: string;
|
|
22
|
+
items?: Array<SearchResultsItemProps>;
|
|
23
|
+
filters?: Array<SearchResultsFilter>;
|
|
24
|
+
activeFilterIdx?: number;
|
|
25
|
+
setFilter?: (activeTab: number) => void;
|
|
26
|
+
status: SearchStatus;
|
|
27
|
+
errorText?: string | ReactNode;
|
|
28
|
+
/** Number of results returned in each page/batch */
|
|
29
|
+
pageSize: number;
|
|
30
|
+
/** Total number of pages */
|
|
31
|
+
pages?: number;
|
|
32
|
+
loadMore?: () => void;
|
|
33
|
+
texts?: SearchReesultI18n;
|
|
34
|
+
lang?: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const SearchResults: (props: SearchResultsProps) => JSX.Element;
|
|
37
|
+
export default SearchResults;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { useInView } from 'react-intersection-observer';
|
|
3
|
+
import { prettyNum } from '@hugsmidjan/qj/prettyNum';
|
|
4
|
+
import range from '@hugsmidjan/qj/range';
|
|
5
|
+
import { useDomid } from '@hugsmidjan/react/hooks';
|
|
6
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
7
|
+
import { getTexts } from '@reykjavik/hanna-utils/i18n';
|
|
8
|
+
import { SearchResultsItem, } from './SearchResults/_SearchResultsItem.js';
|
|
9
|
+
import Alert from './Alert.js';
|
|
10
|
+
import Tabs from './Tabs.js';
|
|
11
|
+
const renderDefaultErrorText = () => (React.createElement(React.Fragment, null,
|
|
12
|
+
"\u00DAps, \u00FEa\u00F0 hefur komi\u00F0 upp villa. M\u00E1 bj\u00F3\u00F0a \u00FE\u00E9r a\u00F0 pr\u00F3fa aftur a\u00F0 leita?",
|
|
13
|
+
React.createElement("br", null),
|
|
14
|
+
"Ef ekkert l\u00E1t er \u00E1 villunni \u00FE\u00E1 kunnum vi\u00F0 a\u00F0 meta a\u00F0 \u00FE\u00FA l\u00E1tir okkur vita."));
|
|
15
|
+
const defaultTexts = {
|
|
16
|
+
en: {
|
|
17
|
+
lang: 'en',
|
|
18
|
+
loadQueryTitle: 'Loading results...',
|
|
19
|
+
resultsTitle: 'results found for',
|
|
20
|
+
noResultsTitle: 'No results were found for',
|
|
21
|
+
loadMore: 'Load more',
|
|
22
|
+
// loadingMore: 'Loading...',
|
|
23
|
+
},
|
|
24
|
+
is: {
|
|
25
|
+
lang: 'is',
|
|
26
|
+
loadQueryTitle: 'Sæki niðurstöður...',
|
|
27
|
+
resultsTitle: 'leitarniðurstöður fyrir',
|
|
28
|
+
noResultsTitle: 'Engar leitarniðurstöður fundust fyrir',
|
|
29
|
+
loadMore: 'Sækja fleiri',
|
|
30
|
+
// loadingMore: 'Sæki fleiri...',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const SearchResults_Tabs = (props) => {
|
|
34
|
+
const { domid, filters, activeIdx, setFilter, lang } = props;
|
|
35
|
+
const tabs = useMemo(() => (filters || []).map(({ label, count }) => ({
|
|
36
|
+
label,
|
|
37
|
+
badge: prettyNum(count, { lang }),
|
|
38
|
+
})), [filters, lang]);
|
|
39
|
+
return tabs.length ? (React.createElement(Tabs, { role: "tablist", "aria-controls": domid, tabs: tabs, activeIdx: activeIdx || 0, onSetActive: (i) => setFilter && setFilter(i) })) : null;
|
|
40
|
+
};
|
|
41
|
+
const LoadingScaffold = (props) => props.count ? (React.createElement("ol", { className: "SearchResults__list SearchResults__list--loading" }, range(1, props.count).map((item, i) => (React.createElement(SearchResultsItem, { key: i, title: "...", summary: "", href: "" }))))) : null;
|
|
42
|
+
// ===========================================================================
|
|
43
|
+
const NUM_AUTOLOADS = 2;
|
|
44
|
+
const SearchResults__loadmore = (props) => {
|
|
45
|
+
const { status, hits, numItems, loadMore, pageSize, texts } = props;
|
|
46
|
+
const { lang } = texts;
|
|
47
|
+
const moreCount = (hits || 0) - (numItems || 0);
|
|
48
|
+
const autoLoadCount = useRef(0);
|
|
49
|
+
const skip = !loadMore || autoLoadCount.current >= NUM_AUTOLOADS;
|
|
50
|
+
const [refFn, theEndIsNigh] = useInView({
|
|
51
|
+
rootMargin: '150px 0px 0px 0px',
|
|
52
|
+
skip, // disable after two clicks
|
|
53
|
+
});
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (theEndIsNigh && loadMore) {
|
|
56
|
+
autoLoadCount.current = autoLoadCount.current + 1;
|
|
57
|
+
loadMore();
|
|
58
|
+
}
|
|
59
|
+
}, [theEndIsNigh, loadMore]);
|
|
60
|
+
const moreAvailable = status === 'results' && moreCount && loadMore;
|
|
61
|
+
return status === 'loadingmore' ? (React.createElement(LoadingScaffold, { count: Math.min(pageSize, moreCount) })) : moreAvailable ? (React.createElement("button", { ref: refFn, className: "SearchResults__loadmore", type: "button", onClick: loadMore },
|
|
62
|
+
texts.loadMore,
|
|
63
|
+
' ',
|
|
64
|
+
React.createElement("span", { className: "SearchResults__loadmore__count" },
|
|
65
|
+
"(",
|
|
66
|
+
prettyNum(moreCount, { lang }),
|
|
67
|
+
")"))) : null;
|
|
68
|
+
};
|
|
69
|
+
// ===========================================================================
|
|
70
|
+
const renderTitle = (props, texts) => {
|
|
71
|
+
const { status, totalHits, query } = props;
|
|
72
|
+
return (React.createElement("h2", { className: "SearchResults__title" },
|
|
73
|
+
status === 'loadingquery'
|
|
74
|
+
? texts.loadQueryTitle
|
|
75
|
+
: totalHits
|
|
76
|
+
? prettyNum(totalHits, { lang: texts.lang }) +
|
|
77
|
+
' ' +
|
|
78
|
+
texts.resultsTitle
|
|
79
|
+
: texts.noResultsTitle,
|
|
80
|
+
React.createElement("span", { className: "SearchResults__query" }, query)));
|
|
81
|
+
};
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
const renderResults = (props) => {
|
|
84
|
+
const { status, pageSize, items, hits } = props;
|
|
85
|
+
if (status === 'loadingquery' || status === 'loadingfilter') {
|
|
86
|
+
return React.createElement(LoadingScaffold, { count: Math.min(pageSize, hits || 999) });
|
|
87
|
+
}
|
|
88
|
+
return items && items.length ? (React.createElement("ol", { className: "SearchResults__list" }, items.map((item, i) => (React.createElement(SearchResultsItem, Object.assign({ key: i }, item)))))) : null;
|
|
89
|
+
};
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
const renderLoadMore = (props, texts) => {
|
|
92
|
+
const { hits, items, status, pageSize, loadMore } = props;
|
|
93
|
+
return (React.createElement(SearchResults__loadmore, { hits: hits, numItems: items && items.length, status: status, pageSize: pageSize, loadMore: loadMore, texts: texts }));
|
|
94
|
+
};
|
|
95
|
+
// TODO: add plural translation thingy for result string
|
|
96
|
+
export const SearchResults = (props) => {
|
|
97
|
+
const { filters, activeFilterIdx, setFilter, status, errorText } = props;
|
|
98
|
+
const texts = getTexts(props, defaultTexts);
|
|
99
|
+
const domid = useDomid();
|
|
100
|
+
return (React.createElement("div", { className: getBemClass('SearchResults', status !== 'results' && status) },
|
|
101
|
+
renderTitle(props, texts),
|
|
102
|
+
React.createElement(SearchResults_Tabs, { domid: domid, filters: filters, activeIdx: activeFilterIdx, setFilter: setFilter, lang: texts.lang }),
|
|
103
|
+
React.createElement("div", { className: "SearchResults__results", id: domid },
|
|
104
|
+
renderResults(props),
|
|
105
|
+
status === 'error' && (React.createElement(Alert, { type: "error" }, errorText || renderDefaultErrorText())),
|
|
106
|
+
renderLoadMore(props, texts))));
|
|
107
|
+
};
|
|
108
|
+
export default SearchResults;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { getEffectAttr, useSeenEffect, } from './utils/seenEffect.js';
|
|
4
|
+
export const SeenEffect = (props) => {
|
|
5
|
+
const { effectType, startSeen } = props, divProps = __rest(props, ["effectType", "startSeen"]);
|
|
6
|
+
const [ref] = useSeenEffect(startSeen);
|
|
7
|
+
return React.createElement("div", Object.assign({}, divProps, { ref: ref }, getEffectAttr(effectType)));
|
|
8
|
+
};
|
|
9
|
+
export default SeenEffect;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SelectboxProps as _SelectboxProps } from '@hugsmidjan/react/Selectbox';
|
|
2
|
+
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
|
+
export { type SelectboxOption, type SelectboxOptions as SelectboxOptionList,
|
|
4
|
+
/** @deprecated Use `SelectboxOptionList` instead (Will be removed in v0.11) */
|
|
5
|
+
type SelectboxOptions, } from '@hugsmidjan/react/Selectbox';
|
|
6
|
+
type OptionOrValue = _SelectboxProps['options'][0];
|
|
7
|
+
export type SelectboxProps<O extends OptionOrValue = OptionOrValue> = FormFieldWrappingProps & Omit<_SelectboxProps<O>, 'bem'> & {
|
|
8
|
+
small?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const Selectbox: <O extends import("@hugsmidjan/react/__types/Selectbox.privates.js").OptionOrValue>(props: SelectboxProps<O>) => JSX.Element;
|
|
11
|
+
export default Selectbox;
|
package/esm/Selectbox.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import _Selectbox from '@hugsmidjan/react/Selectbox';
|
|
4
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
5
|
+
import FormField from './FormField.js';
|
|
6
|
+
const getValue = (opt) => {
|
|
7
|
+
const val = typeof opt === 'object' ? opt.value : opt;
|
|
8
|
+
return typeof val === 'number' ? String(val) : val;
|
|
9
|
+
};
|
|
10
|
+
export const Selectbox = (props) => {
|
|
11
|
+
const { className, label, assistText, hideLabel, disabled, readOnly, reqText, invalid, errorMessage, required, id, ssr, onChange, small } = props, selectProps = __rest(props, ["className", "label", "assistText", "hideLabel", "disabled", "readOnly", "reqText", "invalid", "errorMessage", "required", "id", "ssr", "onChange", "small"]);
|
|
12
|
+
const { value, defaultValue, placeholder, options } = selectProps;
|
|
13
|
+
const _selectRef = useRef(null);
|
|
14
|
+
const selectRef = selectProps.selectRef || _selectRef;
|
|
15
|
+
const getInitialValue = () => { var _a; return (_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : getValue(options[0]); };
|
|
16
|
+
const [isFilled, setIsFilled] = useState(() => !!getInitialValue());
|
|
17
|
+
const [isEmpty, setIsEmpty] = useState(() => !getInitialValue() && !placeholder);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
var _a;
|
|
21
|
+
const selectElm = selectRef.current;
|
|
22
|
+
if (selectElm) {
|
|
23
|
+
setIsFilled(!!selectElm.value);
|
|
24
|
+
setIsEmpty(!((_a = selectElm.selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.text));
|
|
25
|
+
}
|
|
26
|
+
}, 0);
|
|
27
|
+
}, [selectRef, value, defaultValue, options]);
|
|
28
|
+
const _onChange = (e) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const selectElm = e.currentTarget;
|
|
31
|
+
setIsFilled(!!selectElm.value);
|
|
32
|
+
setIsEmpty(!((_a = selectElm.selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.text));
|
|
33
|
+
onChange && onChange(e);
|
|
34
|
+
};
|
|
35
|
+
return (React.createElement(FormField, { className: getBemClass('Selectbox', null, className), ssr: ssr, small: small, label: label, empty: isEmpty, filled: isFilled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement(_Selectbox, Object.assign({ bem: className.input, ssr: ssr, onChange: _onChange }, inputProps, addFocusProps(selectProps), { selectRef: selectRef }))) }));
|
|
36
|
+
};
|
|
37
|
+
// /** @deprecated Use named export instead (The default export will be removed in v0.11+) */
|
|
38
|
+
// const SelectboxDefault = Selectbox;
|
|
39
|
+
// export default SelectboxDefault;
|
|
40
|
+
export default Selectbox;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ShareButtonI18n, ShareButtonPlatforms } from '@reykjavik/hanna-utils/shareButtonsUtils';
|
|
2
|
+
import { SSRSupport } from './utils.js';
|
|
3
|
+
export type ShareButtonsProps = {
|
|
4
|
+
ssr?: SSRSupport;
|
|
5
|
+
texts?: Readonly<ShareButtonI18n>;
|
|
6
|
+
lang?: string;
|
|
7
|
+
} & Partial<Record<ShareButtonPlatforms, boolean>>;
|
|
8
|
+
export declare const ShareButtons: (props: ShareButtonsProps) => JSX.Element | null;
|
|
9
|
+
export default ShareButtons;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { DEFAULT_LANG } from '@reykjavik/hanna-utils/i18n';
|
|
3
|
+
import { getDocMeta, getShareButtonLabel, openInPopup, shareButtonTexts, shareButtonTypes, } from '@reykjavik/hanna-utils/shareButtonsUtils';
|
|
4
|
+
import { Link } from './_abstract/_Link.js';
|
|
5
|
+
const generateTypeList = (facebook, twitter, linkedin, email) => {
|
|
6
|
+
const listStr = ((facebook ? 'facebook,' : '') +
|
|
7
|
+
(twitter ? 'twitter,' : '') +
|
|
8
|
+
(linkedin ? 'linkedin,' : '') +
|
|
9
|
+
(email ? 'email,' : '')).slice(0, -1);
|
|
10
|
+
return (listStr !== 'facebook,twitter' && listStr) || undefined;
|
|
11
|
+
};
|
|
12
|
+
// FIXME: see other FIXME below for details
|
|
13
|
+
// TODO: Also figure out if/why the truthyness of document.location would be in doubt here
|
|
14
|
+
const docLoc = typeof document !== 'undefined' ? document.location : { href: undefined };
|
|
15
|
+
const ShareButtons__item = (props) => {
|
|
16
|
+
const { label, type, href } = props;
|
|
17
|
+
const buttonText = getShareButtonLabel(type, label);
|
|
18
|
+
const popup = type !== 'email';
|
|
19
|
+
return (React.createElement("li", { className: "ShareButtons__item" },
|
|
20
|
+
React.createElement(Link, { className: 'ShareButtons__link ShareButtons__link--' + type, href: href, title: buttonText, rel: "noopener noreferrer", target: popup ? '_blank' : undefined, onClick: popup ? openInPopup : undefined }, buttonText)));
|
|
21
|
+
};
|
|
22
|
+
export const ShareButtons = (props) => {
|
|
23
|
+
const { texts, lang, ssr, facebook = true, twitter = true, linkedin, email, } = props;
|
|
24
|
+
const [docMeta, setDocMeta] = useState();
|
|
25
|
+
const href = docLoc.href; // assign to local variable to silence `react-hooks/exhaustive-deps`
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
// FIXME: Drop dependency on _loc.href and set up proper
|
|
28
|
+
// location/route monitoring event handler, with unsubscribe on unmount
|
|
29
|
+
setDocMeta(getDocMeta({
|
|
30
|
+
lang,
|
|
31
|
+
emailSubject: texts && texts.emailSubject,
|
|
32
|
+
}));
|
|
33
|
+
}, [texts, lang, href]);
|
|
34
|
+
if (!facebook && !twitter && !linkedin && !email) {
|
|
35
|
+
// no place to share
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const txt = texts ||
|
|
39
|
+
(docMeta && (shareButtonTexts[docMeta.lang] || shareButtonTexts[DEFAULT_LANG])) ||
|
|
40
|
+
{};
|
|
41
|
+
const { label, buttonLabel, emailSubject } = txt;
|
|
42
|
+
if (!docMeta || ssr === 'ssr-only') {
|
|
43
|
+
// Generate SSR markup for hanna-sprinkles to pick up on.
|
|
44
|
+
return (React.createElement("div", { className: "ShareButtons", "data-button-types": generateTypeList(facebook, twitter, linkedin, email), "data-label": label, "data-buttonlabel": buttonLabel, "data-emailsubject": emailSubject || undefined }));
|
|
45
|
+
}
|
|
46
|
+
const showTypes = {
|
|
47
|
+
facebook,
|
|
48
|
+
twitter,
|
|
49
|
+
linkedin,
|
|
50
|
+
email,
|
|
51
|
+
};
|
|
52
|
+
return (React.createElement("div", { className: "ShareButtons", "aria-label": label, "data-sprinkled": "true" },
|
|
53
|
+
label && React.createElement("strong", { className: "ShareButtons__label" }, label),
|
|
54
|
+
React.createElement("ul", { className: "ShareButtons__list" }, shareButtonTypes.map((type) => showTypes[type] && (React.createElement(ShareButtons__item, { key: type, type: type, label: buttonLabel || '', href: docMeta.hrefs[type] }))))));
|
|
55
|
+
};
|
|
56
|
+
export default ShareButtons;
|
package/esm/Sharpie.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare const colors: {
|
|
3
|
+
green: number;
|
|
4
|
+
red: number;
|
|
5
|
+
};
|
|
6
|
+
type SharpieColor = keyof typeof colors;
|
|
7
|
+
declare const tags: {
|
|
8
|
+
span: number;
|
|
9
|
+
strong: number;
|
|
10
|
+
em: number;
|
|
11
|
+
b: number;
|
|
12
|
+
i: number;
|
|
13
|
+
u: number;
|
|
14
|
+
s: number;
|
|
15
|
+
};
|
|
16
|
+
type SharpieTag = keyof typeof tags;
|
|
17
|
+
export type SharpieProps = {
|
|
18
|
+
color: SharpieColor;
|
|
19
|
+
tag?: SharpieTag;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
export declare const Sharpie: (props: SharpieProps) => JSX.Element;
|
|
23
|
+
export default Sharpie;
|
package/esm/Sharpie.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
const colors = {
|
|
4
|
+
green: 1,
|
|
5
|
+
red: 1,
|
|
6
|
+
};
|
|
7
|
+
const tags = {
|
|
8
|
+
span: 1,
|
|
9
|
+
strong: 1,
|
|
10
|
+
em: 1,
|
|
11
|
+
b: 1,
|
|
12
|
+
i: 1,
|
|
13
|
+
u: 1,
|
|
14
|
+
s: 1,
|
|
15
|
+
};
|
|
16
|
+
export const Sharpie = (props) => {
|
|
17
|
+
const { color, tag, children } = props;
|
|
18
|
+
const colorModifier = colors[color] ? color : 'green';
|
|
19
|
+
const Tag = tag && tags[tag] ? tag : 'span';
|
|
20
|
+
return React.createElement(Tag, { className: getBemClass('Sharpie', colorModifier) }, children);
|
|
21
|
+
};
|
|
22
|
+
export default Sharpie;
|