@reykjavik/hanna-react 0.10.56 → 0.10.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{AccordionList.jsx → AccordionList.js} +5 -14
- package/{ActionCards.jsx → ActionCards.js} +2 -3
- package/{Alert.jsx → Alert.js} +6 -8
- package/ArticleCarousel/_ArticleCarouselCard.js +31 -0
- package/{ArticleCarousel.jsx → ArticleCarousel.js} +1 -1
- package/{ArticleMeta.jsx → ArticleMeta.js} +9 -8
- package/{Attention.jsx → Attention.js} +1 -1
- package/{BasicTable.jsx → BasicTable.js} +11 -12
- package/{Bling.jsx → Bling.js} +2 -2
- package/{BlockBreak.jsx → BlockBreak.js} +1 -1
- package/{BlockQuote.jsx → BlockQuote.js} +1 -1
- package/BreadCrumbs.js +33 -0
- package/{ButtonBack.jsx → ButtonBack.js} +1 -1
- package/{ButtonBar.jsx → ButtonBar.js} +2 -4
- package/{ButtonPrimary.jsx → ButtonPrimary.js} +1 -1
- package/{ButtonSecondary.jsx → ButtonSecondary.js} +1 -1
- package/{ButtonTertiary.jsx → ButtonTertiary.js} +1 -1
- package/CHANGELOG.md +1 -1
- package/{Carousel.jsx → Carousel.js} +1 -1
- package/{CarouselStepper.jsx → CarouselStepper.js} +1 -1
- package/{CenterColumn.jsx → CenterColumn.js} +1 -3
- package/{Checkbox.jsx → Checkbox.js} +1 -1
- package/{CheckboxButtonsGroup.jsx → CheckboxButtonsGroup.js} +2 -2
- package/{CheckboxGroup.jsx → CheckboxGroup.js} +1 -1
- package/{CityBlock.jsx → CityBlock.js} +1 -1
- package/{ContactBubble.jsx → ContactBubble.js} +12 -26
- package/{ContentArticle.jsx → ContentArticle.js} +9 -12
- package/ContentImage.js +23 -0
- package/{Datepicker.jsx → Datepicker.js} +17 -18
- package/{ExtraLinks.jsx → ExtraLinks.js} +9 -17
- package/FeatureList.js +21 -0
- package/{FieldGroup.jsx → FieldGroup.js} +3 -4
- package/{FileInput.jsx → FileInput.js} +22 -25
- package/{Foonote.jsx → Foonote.js} +0 -0
- package/FooterBadges.js +17 -0
- package/FooterInfo.js +14 -0
- package/{Footnote.jsx → Footnote.js} +1 -1
- package/{Form.jsx → Form.js} +2 -4
- package/{FormField.jsx → FormField.js} +20 -22
- package/Gallery/{_GalleryItem.jsx → _GalleryItem.js} +8 -9
- package/Gallery/{_GalleryModal.jsx → _GalleryModal.js} +11 -15
- package/Gallery/{_GalleryModalItem.jsx → _GalleryModalItem.js} +5 -7
- package/{Gallery.jsx → Gallery.js} +3 -4
- package/GridBlocks.js +29 -0
- package/{Heading.jsx → Heading.js} +2 -4
- package/{HeroBlock.jsx → HeroBlock.js} +8 -9
- package/{IframeBlock.jsx → IframeBlock.js} +6 -6
- package/{Illustration.jsx → Illustration.js} +1 -1
- package/{ImageCards.jsx → ImageCards.js} +2 -3
- package/InfoBlock.js +18 -0
- package/{InfoHero.jsx → InfoHero.js} +9 -15
- package/{IslandBlock.jsx → IslandBlock.js} +1 -1
- package/{IslandPageBlock.jsx → IslandPageBlock.js} +1 -1
- package/{LabeledTextBlock.jsx → LabeledTextBlock.js} +5 -7
- package/Layout.js +58 -0
- package/MainMenu/{_Auxiliary.jsx → _Auxiliary.js} +5 -11
- package/MainMenu/_PrimaryPanel.js +29 -0
- package/{MainMenu.jsx → MainMenu.js} +27 -40
- package/{MiniMetrics.jsx → MiniMetrics.js} +5 -4
- package/Modal.js +19 -0
- package/{NameCard.jsx → NameCard.js} +18 -23
- package/{NameCards.jsx → NameCards.js} +1 -3
- package/{NewsHero.jsx → NewsHero.js} +7 -9
- package/{PageFilter.jsx → PageFilter.js} +6 -7
- package/{PageHeading.jsx → PageHeading.js} +2 -4
- package/ProcessOverview.js +22 -0
- package/{PullQuote.jsx → PullQuote.js} +1 -1
- package/{RadioButtonsGroup.jsx → RadioButtonsGroup.js} +2 -2
- package/{RadioGroup.jsx → RadioGroup.js} +2 -2
- package/{RelatedLinks.jsx → RelatedLinks.js} +9 -13
- package/{RowBlock.jsx → RowBlock.js} +1 -3
- package/{RowBlockColumn.jsx → RowBlockColumn.js} +2 -4
- package/{SearchInput.jsx → SearchInput.js} +4 -6
- package/SearchResults/_SearchResultsItem.js +20 -0
- package/{SearchResults.jsx → SearchResults.js} +27 -36
- package/{SeenEffect.jsx → SeenEffect.js} +1 -1
- package/{Selectbox.jsx → Selectbox.js} +1 -1
- package/{ShareButtons.jsx → ShareButtons.js} +6 -12
- package/{Sharpie.jsx → Sharpie.js} +1 -1
- package/{SiteSearchAutocomplete.jsx → SiteSearchAutocomplete.js} +5 -7
- package/{SiteSearchCurtain.jsx → SiteSearchCurtain.js} +1 -5
- package/{SiteSearchInput.jsx → SiteSearchInput.js} +10 -12
- package/{Skeleton.jsx → Skeleton.js} +5 -5
- package/{SubHeading.jsx → SubHeading.js} +2 -4
- package/{Tabs.jsx → Tabs.js} +12 -12
- package/{TagPill.jsx → TagPill.js} +11 -16
- package/{TextBlock.jsx → TextBlock.js} +2 -4
- package/{TextButton.jsx → TextButton.js} +1 -1
- package/{TextInput.jsx → TextInput.js} +1 -1
- package/{VSpacer.jsx → VSpacer.js} +1 -1
- package/{VerticalTabsTOC.jsx → VerticalTabsTOC.js} +2 -2
- package/WizardLayout.js +35 -0
- package/{WizardLayoutClose.jsx → WizardLayoutClose.js} +1 -1
- package/WizardStepper.js +30 -0
- package/_abstract/{Button.jsx → Button.js} +2 -6
- package/_abstract/CardList.js +43 -0
- package/_abstract/{Image.jsx → Image.js} +10 -12
- package/_abstract/{Link.jsx → Link.js} +0 -0
- package/_abstract/TogglerGroup.js +34 -0
- package/_abstract/{TogglerGroupField.jsx → TogglerGroupField.js} +3 -3
- package/_abstract/{TogglerInput.jsx → TogglerInput.js} +13 -15
- package/_abstract/{_AbstractCarousel.jsx → _AbstractCarousel.js} +7 -10
- package/_abstract/{_Blings.jsx → _Blings.js} +1 -3
- package/_abstract/_Block.js +29 -0
- package/_abstract/{_Quote.jsx → _Quote.js} +3 -6
- package/_abstract/{breakOnNL.jsx → breakOnNL.js} +1 -1
- package/esm/AccordionList.js +24 -0
- package/esm/{ActionCards.jsx → ActionCards.js} +2 -3
- package/esm/{Alert.jsx → Alert.js} +6 -8
- package/esm/ArticleCarousel/_ArticleCarouselCard.js +24 -0
- package/esm/{ArticleCarousel.jsx → ArticleCarousel.js} +1 -1
- package/esm/ArticleMeta.js +18 -0
- package/esm/Attention.js +4 -0
- package/esm/{BasicTable.jsx → BasicTable.js} +11 -12
- package/esm/{Bling.jsx → Bling.js} +2 -2
- package/esm/BlockBreak.js +6 -0
- package/esm/BlockQuote.js +4 -0
- package/esm/BreadCrumbs.js +28 -0
- package/esm/ButtonBack.js +4 -0
- package/esm/{ButtonBar.jsx → ButtonBar.js} +2 -4
- package/esm/ButtonPrimary.js +4 -0
- package/esm/ButtonSecondary.js +4 -0
- package/esm/{ButtonTertiary.jsx → ButtonTertiary.js} +1 -1
- package/esm/Carousel.js +4 -0
- package/esm/CarouselStepper.js +4 -0
- package/esm/CenterColumn.js +7 -0
- package/esm/Checkbox.js +4 -0
- package/esm/{CheckboxButtonsGroup.jsx → CheckboxButtonsGroup.js} +2 -2
- package/esm/{CheckboxGroup.jsx → CheckboxGroup.js} +1 -1
- package/esm/{CityBlock.jsx → CityBlock.js} +1 -1
- package/esm/{ContactBubble.jsx → ContactBubble.js} +12 -26
- package/esm/ContentArticle.js +21 -0
- package/esm/ContentImage.js +18 -0
- package/esm/{Datepicker.jsx → Datepicker.js} +17 -18
- package/esm/{ExtraLinks.jsx → ExtraLinks.js} +9 -17
- package/esm/FeatureList.js +16 -0
- package/esm/FieldGroup.js +9 -0
- package/esm/{FileInput.jsx → FileInput.js} +22 -25
- package/esm/{Foonote.jsx → Foonote.js} +0 -0
- package/esm/FooterBadges.js +12 -0
- package/esm/FooterInfo.js +9 -0
- package/esm/Footnote.js +3 -0
- package/esm/{Form.jsx → Form.js} +2 -4
- package/esm/{FormField.jsx → FormField.js} +20 -22
- package/esm/Gallery/{_GalleryItem.jsx → _GalleryItem.js} +8 -9
- package/esm/Gallery/{_GalleryModal.jsx → _GalleryModal.js} +11 -15
- package/esm/Gallery/{_GalleryModalItem.jsx → _GalleryModalItem.js} +5 -7
- package/esm/{Gallery.jsx → Gallery.js} +3 -4
- package/esm/GridBlocks.js +24 -0
- package/esm/{Heading.jsx → Heading.js} +2 -4
- package/esm/HeroBlock.js +21 -0
- package/esm/{IframeBlock.jsx → IframeBlock.js} +6 -6
- package/esm/{Illustration.jsx → Illustration.js} +1 -1
- package/esm/{ImageCards.jsx → ImageCards.js} +2 -3
- package/esm/InfoBlock.js +13 -0
- package/esm/{InfoHero.jsx → InfoHero.js} +9 -15
- package/esm/{IslandBlock.jsx → IslandBlock.js} +1 -1
- package/esm/{IslandPageBlock.jsx → IslandPageBlock.js} +1 -1
- package/esm/LabeledTextBlock.js +14 -0
- package/esm/Layout.js +52 -0
- package/esm/MainMenu/_Auxiliary.js +13 -0
- package/esm/MainMenu/_PrimaryPanel.js +22 -0
- package/esm/{MainMenu.jsx → MainMenu.js} +27 -40
- package/esm/MiniMetrics.js +12 -0
- package/esm/Modal.js +14 -0
- package/esm/{NameCard.jsx → NameCard.js} +18 -23
- package/esm/NameCards.js +7 -0
- package/esm/{NewsHero.jsx → NewsHero.js} +7 -9
- package/esm/PageFilter.js +15 -0
- package/esm/{PageHeading.jsx → PageHeading.js} +2 -4
- package/esm/ProcessOverview.js +17 -0
- package/esm/PullQuote.js +4 -0
- package/esm/{RadioButtonsGroup.jsx → RadioButtonsGroup.js} +2 -2
- package/esm/RadioGroup.js +7 -0
- package/esm/RelatedLinks.js +26 -0
- package/esm/{RowBlock.jsx → RowBlock.js} +1 -3
- package/esm/{RowBlockColumn.jsx → RowBlockColumn.js} +2 -4
- package/esm/{SearchInput.jsx → SearchInput.js} +4 -6
- package/esm/SearchResults/_SearchResultsItem.js +15 -0
- package/esm/{SearchResults.jsx → SearchResults.js} +27 -36
- package/esm/{SeenEffect.jsx → SeenEffect.js} +1 -1
- package/esm/{Selectbox.jsx → Selectbox.js} +1 -1
- package/esm/{ShareButtons.jsx → ShareButtons.js} +6 -12
- package/esm/{Sharpie.jsx → Sharpie.js} +1 -1
- package/esm/{SiteSearchAutocomplete.jsx → SiteSearchAutocomplete.js} +5 -7
- package/esm/{SiteSearchCurtain.jsx → SiteSearchCurtain.js} +1 -5
- package/esm/{SiteSearchInput.jsx → SiteSearchInput.js} +10 -12
- package/esm/{Skeleton.jsx → Skeleton.js} +5 -5
- package/esm/{SubHeading.jsx → SubHeading.js} +2 -4
- package/esm/{Tabs.jsx → Tabs.js} +12 -12
- package/esm/{TagPill.jsx → TagPill.js} +11 -16
- package/esm/{TextBlock.jsx → TextBlock.js} +2 -4
- package/esm/{TextButton.jsx → TextButton.js} +1 -1
- package/esm/{TextInput.jsx → TextInput.js} +1 -1
- package/esm/{VSpacer.jsx → VSpacer.js} +1 -1
- package/esm/{VerticalTabsTOC.jsx → VerticalTabsTOC.js} +2 -2
- package/esm/WizardLayout.js +30 -0
- package/esm/WizardLayoutClose.js +4 -0
- package/esm/WizardStepper.js +25 -0
- package/esm/_abstract/{Button.jsx → Button.js} +2 -6
- package/esm/_abstract/CardList.js +36 -0
- package/esm/_abstract/{Image.jsx → Image.js} +10 -12
- package/esm/_abstract/{Link.jsx → Link.js} +0 -0
- package/esm/_abstract/TogglerGroup.js +29 -0
- package/esm/_abstract/{TogglerGroupField.jsx → TogglerGroupField.js} +3 -3
- package/esm/_abstract/{TogglerInput.jsx → TogglerInput.js} +13 -15
- package/esm/_abstract/{_AbstractCarousel.jsx → _AbstractCarousel.js} +7 -10
- package/esm/_abstract/_Blings.js +12 -0
- package/esm/_abstract/_Block.js +24 -0
- package/esm/_abstract/_Quote.js +8 -0
- package/esm/_abstract/{breakOnNL.jsx → breakOnNL.js} +1 -1
- package/package.json +91 -91
- package/ArticleCarousel/_ArticleCarouselCard.jsx +0 -32
- package/BreadCrumbs.jsx +0 -36
- package/ContentImage.jsx +0 -18
- package/FeatureList.jsx +0 -28
- package/FooterBadges.jsx +0 -21
- package/FooterInfo.jsx +0 -19
- package/GridBlocks.jsx +0 -40
- package/InfoBlock.jsx +0 -23
- package/Layout.jsx +0 -69
- package/MainMenu/_PrimaryPanel.jsx +0 -37
- package/Modal.jsx +0 -21
- package/ProcessOverview.jsx +0 -25
- package/SearchResults/_SearchResultsItem.jsx +0 -24
- package/WizardLayout.jsx +0 -44
- package/WizardStepper.jsx +0 -34
- package/_abstract/CardList.jsx +0 -46
- package/_abstract/TogglerGroup.jsx +0 -36
- package/_abstract/_Block.jsx +0 -32
- package/esm/AccordionList.jsx +0 -33
- package/esm/ArticleCarousel/_ArticleCarouselCard.jsx +0 -25
- package/esm/ArticleMeta.jsx +0 -17
- package/esm/Attention.jsx +0 -4
- package/esm/BlockBreak.jsx +0 -6
- package/esm/BlockQuote.jsx +0 -4
- package/esm/BreadCrumbs.jsx +0 -31
- package/esm/ButtonBack.jsx +0 -4
- package/esm/ButtonPrimary.jsx +0 -4
- package/esm/ButtonSecondary.jsx +0 -4
- package/esm/Carousel.jsx +0 -4
- package/esm/CarouselStepper.jsx +0 -4
- package/esm/CenterColumn.jsx +0 -9
- package/esm/Checkbox.jsx +0 -4
- package/esm/ContentArticle.jsx +0 -24
- package/esm/ContentImage.jsx +0 -13
- package/esm/FeatureList.jsx +0 -23
- package/esm/FieldGroup.jsx +0 -10
- package/esm/FooterBadges.jsx +0 -16
- package/esm/FooterInfo.jsx +0 -14
- package/esm/Footnote.jsx +0 -3
- package/esm/GridBlocks.jsx +0 -35
- package/esm/HeroBlock.jsx +0 -22
- package/esm/InfoBlock.jsx +0 -18
- package/esm/LabeledTextBlock.jsx +0 -16
- package/esm/Layout.jsx +0 -63
- package/esm/MainMenu/_Auxiliary.jsx +0 -19
- package/esm/MainMenu/_PrimaryPanel.jsx +0 -30
- package/esm/MiniMetrics.jsx +0 -11
- package/esm/Modal.jsx +0 -16
- package/esm/NameCards.jsx +0 -9
- package/esm/PageFilter.jsx +0 -16
- package/esm/ProcessOverview.jsx +0 -20
- package/esm/PullQuote.jsx +0 -4
- package/esm/RadioGroup.jsx +0 -7
- package/esm/RelatedLinks.jsx +0 -30
- package/esm/SearchResults/_SearchResultsItem.jsx +0 -19
- package/esm/WizardLayout.jsx +0 -39
- package/esm/WizardLayoutClose.jsx +0 -4
- package/esm/WizardStepper.jsx +0 -29
- package/esm/_abstract/CardList.jsx +0 -39
- package/esm/_abstract/TogglerGroup.jsx +0 -31
- package/esm/_abstract/_Blings.jsx +0 -14
- package/esm/_abstract/_Block.jsx +0 -27
- package/esm/_abstract/_Quote.jsx +0 -11
|
@@ -69,6 +69,6 @@ const Selectbox = (props) => {
|
|
|
69
69
|
setIsEmpty(!((_a = selectElm.selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.text));
|
|
70
70
|
onChange && onChange(e);
|
|
71
71
|
};
|
|
72
|
-
return (
|
|
72
|
+
return (react_1.default.createElement(FormField_1.default, { className: (0, getBemClass_1.default)('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_1.default.createElement(Selectbox_1.default, Object.assign({ bem: className.input, ssr: ssr, onChange: _onChange }, inputProps, addFocusProps(selectProps), { selectRef: selectRef }))) }));
|
|
73
73
|
};
|
|
74
74
|
exports.default = Selectbox;
|
|
@@ -40,11 +40,8 @@ const ShareButtons__item = (props) => {
|
|
|
40
40
|
const { label, type, href } = props;
|
|
41
41
|
const buttonText = (0, shareButtonsUtils_1.getShareButtonLabel)(type, label);
|
|
42
42
|
const popup = type !== 'email';
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
{buttonText}
|
|
46
|
-
</Link_1.Link>
|
|
47
|
-
</li>);
|
|
43
|
+
return (react_1.default.createElement("li", { className: "ShareButtons__item" },
|
|
44
|
+
react_1.default.createElement(Link_1.Link, { className: 'ShareButtons__link ShareButtons__link--' + type, href: href, title: buttonText, rel: "noopener noreferrer", target: popup ? '_blank' : undefined, onClick: popup ? shareButtonsUtils_1.openInPopup : undefined }, buttonText)));
|
|
48
45
|
};
|
|
49
46
|
const ShareButtons = (props) => {
|
|
50
47
|
const { texts, ssr, facebook = true, twitter = true, linkedin, email, } = props;
|
|
@@ -64,7 +61,7 @@ const ShareButtons = (props) => {
|
|
|
64
61
|
const { label, buttonLabel } = txt;
|
|
65
62
|
if (!docMeta || ssr === 'ssr-only') {
|
|
66
63
|
// Generate SSR markup for hanna-sprinkles to pick up on.
|
|
67
|
-
return (
|
|
64
|
+
return (react_1.default.createElement("div", { className: "ShareButtons", "data-button-types": generateTypeList(facebook, twitter, linkedin, email), "data-label": label, "data-buttonlabel": buttonLabel, "data-emailsubject": txt.emailSubject || undefined }));
|
|
68
65
|
}
|
|
69
66
|
const showTypes = {
|
|
70
67
|
facebook,
|
|
@@ -72,11 +69,8 @@ const ShareButtons = (props) => {
|
|
|
72
69
|
linkedin,
|
|
73
70
|
email,
|
|
74
71
|
};
|
|
75
|
-
return (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{shareButtonsUtils_1.shareButtonTypes.map((type) => showTypes[type] && (<ShareButtons__item key={type} type={type} label={buttonLabel || ''} href={docMeta.hrefs[type]}/>))}
|
|
79
|
-
</ul>
|
|
80
|
-
</div>);
|
|
72
|
+
return (react_1.default.createElement("div", { className: "ShareButtons", "aria-label": label, "data-sprinkled": "true" },
|
|
73
|
+
label && react_1.default.createElement("strong", { className: "ShareButtons__label" }, label),
|
|
74
|
+
react_1.default.createElement("ul", { className: "ShareButtons__list" }, shareButtonsUtils_1.shareButtonTypes.map((type) => showTypes[type] && (react_1.default.createElement(ShareButtons__item, { key: type, type: type, label: buttonLabel || '', href: docMeta.hrefs[type] }))))));
|
|
81
75
|
};
|
|
82
76
|
exports.default = ShareButtons;
|
|
@@ -22,6 +22,6 @@ const Sharpie = (props) => {
|
|
|
22
22
|
const { color, tag, children } = props;
|
|
23
23
|
const colorModifier = colors[color] ? color : 'green';
|
|
24
24
|
const Tag = tag && tags[tag] ? tag : 'span';
|
|
25
|
-
return
|
|
25
|
+
return react_1.default.createElement(Tag, { className: (0, getBemClass_1.default)('Sharpie', colorModifier) }, children);
|
|
26
26
|
};
|
|
27
27
|
exports.default = Sharpie;
|
|
@@ -63,7 +63,7 @@ const SiteSearchAutocomplete = (props) => {
|
|
|
63
63
|
const [value, setValue] = (0, react_1.useState)('');
|
|
64
64
|
const inputRef = (0, react_1.createRef)();
|
|
65
65
|
const txt = (0, i18n_1.getTexts)(props, exports.defaultSiteSearchACTexts);
|
|
66
|
-
return (
|
|
66
|
+
return (react_1.default.createElement(react_autosuggest_1.default, { theme: {
|
|
67
67
|
container: bem,
|
|
68
68
|
containerOpen: bem + '--open',
|
|
69
69
|
suggestionsContainer: bem + '__container',
|
|
@@ -71,19 +71,17 @@ const SiteSearchAutocomplete = (props) => {
|
|
|
71
71
|
suggestionsList: bem + '__list',
|
|
72
72
|
suggestion: bem + '__item',
|
|
73
73
|
suggestionHighlighted: bem + '__item--highlighted',
|
|
74
|
-
}
|
|
75
|
-
{children}
|
|
76
|
-
</div>)} inputProps={{
|
|
74
|
+
}, focusInputOnSuggestionClick: true, suggestions: suggestions, onSuggestionsClearRequested: () => setSuggestions([]), onSuggestionsFetchRequested: onSuggestionsFetchRequested, getSuggestionValue: getSuggestionValue, onSuggestionSelected: onSuggestionSelected, onSuggestionHighlighted: onSuggestionHighlighted, renderSuggestion: renderSuggestion, containerProps: { 'aria-label': txt.label }, renderSuggestionsContainer: ({ containerProps, children }) => (react_1.default.createElement("div", Object.assign({}, containerProps, { "aria-label": txt.suggestionsLabel }), children)), inputProps: {
|
|
77
75
|
ref: inputRef,
|
|
78
76
|
value: value,
|
|
79
77
|
onChange: (_, { newValue }) => {
|
|
80
78
|
setValue(newValue);
|
|
81
79
|
},
|
|
82
|
-
}
|
|
80
|
+
}, renderInputComponent: (inputProps) => {
|
|
83
81
|
/* prettier-ignore */
|
|
84
82
|
const { className, type, disabled, readOnly, required, children } = inputProps, //eslint-disable-line @typescript-eslint/no-unused-vars
|
|
85
83
|
siteSearchProps = __rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
|
|
86
|
-
return (
|
|
87
|
-
}}
|
|
84
|
+
return (react_1.default.createElement(SiteSearchInput_1.default, Object.assign({}, siteSearchProps, { label: props.label || txt.inputLabel, placeholder: txt.placeholder, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
|
|
85
|
+
} }));
|
|
88
86
|
};
|
|
89
87
|
exports.default = SiteSearchAutocomplete;
|
|
@@ -56,10 +56,6 @@ const SiteSearchCurtain = (props) => {
|
|
|
56
56
|
}, 100);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
return (
|
|
60
|
-
// (Sneak this in as Preact does not bubble `FocusEvent`s)
|
|
61
|
-
{...(env_1.isPreact && { onfocusin: focusHandler, onfocusout: blurHandler })}>
|
|
62
|
-
{props.children}
|
|
63
|
-
</div>);
|
|
59
|
+
return (react_1.default.createElement("div", Object.assign({ className: (0, getBemClass_1.default)('SiteSearchCurtain', [focused && 'focused']), onFocus: focusHandler, onBlur: blurHandler }, (env_1.isPreact && { onfocusin: focusHandler, onfocusout: blurHandler })), props.children));
|
|
64
60
|
};
|
|
65
61
|
exports.default = SiteSearchCurtain;
|
|
@@ -53,18 +53,16 @@ const SiteSearchInput = react_1.default.forwardRef((props, ref) => {
|
|
|
53
53
|
setHasValue(!!e.target.value);
|
|
54
54
|
onChange && onChange(e);
|
|
55
55
|
};
|
|
56
|
-
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
return (react_1.default.createElement(FormField_1.default, { className: "SiteSearchInput", ssr: ssr, label: label, empty: empty, filled: filled, id: id, renderInput: (className, inputProps, addFocusProps) => (react_1.default.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
|
|
57
|
+
react_1.default.createElement("input", Object.assign({ className: "SiteSearchInput__input", onChange: _onChange }, inputProps, { placeholder: placeholder, onKeyDown: onSubmit
|
|
58
|
+
? (e) => {
|
|
59
|
+
if (e.key === 'Enter' && onSubmit() !== true) {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
}
|
|
62
|
+
onKeyDown && onKeyDown(e);
|
|
61
63
|
}
|
|
62
|
-
onKeyDown
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<button className="SiteSearchInput__button" type="submit" onClick={onButtonClick && ((e) => !onButtonClick() && e.preventDefault())} title={buttonText}>
|
|
66
|
-
{buttonText}
|
|
67
|
-
</button>
|
|
68
|
-
</div>)}/>);
|
|
64
|
+
: onKeyDown }, inputElementProps, { ref: ref })),
|
|
65
|
+
' ',
|
|
66
|
+
react_1.default.createElement("button", { className: "SiteSearchInput__button", type: "submit", onClick: onButtonClick && ((e) => !onButtonClick() && e.preventDefault()), title: buttonText }, buttonText))) }));
|
|
69
67
|
});
|
|
70
68
|
exports.default = SiteSearchInput;
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const range_1 = __importDefault(require("@hugsmidjan/qj/range"));
|
|
8
8
|
const getBemClass_1 = __importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
9
|
-
const makeRenderSkeleton = (props) => (key) => (
|
|
9
|
+
const makeRenderSkeleton = (props) => (key) => (react_1.default.createElement("span", { key: key, className: (0, getBemClass_1.default)('Skeleton', [
|
|
10
10
|
props.text && 'text',
|
|
11
11
|
props.height && 'height--' + props.height,
|
|
12
12
|
props.gap && 'gap--' + props.gap,
|
|
13
|
-
])}
|
|
13
|
+
]) }));
|
|
14
14
|
const minmax = (num = 0, max = 100, min = 1) => {
|
|
15
15
|
num = Math.min(Math.max(Math.round(num), min), max);
|
|
16
16
|
return num > min ? num : undefined;
|
|
@@ -24,12 +24,12 @@ const Skeleton = (props) => {
|
|
|
24
24
|
});
|
|
25
25
|
const items = minmax(props.items, 20) || 1;
|
|
26
26
|
if (items > 1) {
|
|
27
|
-
return
|
|
27
|
+
return react_1.default.createElement(react_1.default.Fragment, null, (0, range_1.default)(1, items).map(renderSkeleton));
|
|
28
28
|
}
|
|
29
29
|
return renderSkeleton();
|
|
30
30
|
};
|
|
31
31
|
exports.default = Skeleton;
|
|
32
32
|
/** Returns a single `<Skeleton height={X}/>` element of branded type `SkeletonBlock` */
|
|
33
|
-
Skeleton.block = (height) => (
|
|
33
|
+
Skeleton.block = (height) => (react_1.default.createElement(Skeleton, { height: height }));
|
|
34
34
|
/** Returns a single `<Skeleton text height={X}/>` element of branded type `SkeletonText` */
|
|
35
|
-
Skeleton.text = (height) => (
|
|
35
|
+
Skeleton.text = (height) => (react_1.default.createElement(Skeleton, { text: true, height: height }));
|
|
@@ -9,12 +9,10 @@ const seenEffect_1 = require("./utils/seenEffect");
|
|
|
9
9
|
const SubHeading = (props) => {
|
|
10
10
|
const { small, Tag = 'h2', children, align, wide, startSeen } = props;
|
|
11
11
|
const [ref] = (0, seenEffect_1.useSeenEffect)(startSeen);
|
|
12
|
-
return (
|
|
12
|
+
return (react_1.default.createElement(Tag, { className: (0, getBemClass_1.default)('SubHeading', [
|
|
13
13
|
small && 'small',
|
|
14
14
|
align === 'right' && 'align--' + align,
|
|
15
15
|
!align && wide && 'wide',
|
|
16
|
-
])
|
|
17
|
-
{children}
|
|
18
|
-
</Tag>);
|
|
16
|
+
]), ref: ref }, children));
|
|
19
17
|
};
|
|
20
18
|
exports.default = SubHeading;
|
package/{Tabs.jsx → Tabs.js}
RENAMED
|
@@ -60,10 +60,13 @@ const renderTab = (tabProps, index, listProps) => {
|
|
|
60
60
|
}
|
|
61
61
|
: { href };
|
|
62
62
|
return [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
react_1.default.createElement(Tag, Object.assign({ key: index, className: "Tabs__tab", "data-active": isActive }, tagProps, { onClick: handleClick, onFocus: handleFocus, "aria-label": longLabel, title: longLabel }),
|
|
64
|
+
label,
|
|
65
|
+
" ",
|
|
66
|
+
badge != null && react_1.default.createElement("small", { className: "Tabs__tab__badge" },
|
|
67
|
+
"(",
|
|
68
|
+
badge,
|
|
69
|
+
")")),
|
|
67
70
|
' ',
|
|
68
71
|
];
|
|
69
72
|
};
|
|
@@ -110,13 +113,10 @@ const Tabs = (props) => {
|
|
|
110
113
|
listAriaControls,
|
|
111
114
|
isBrowser,
|
|
112
115
|
};
|
|
113
|
-
return (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// just to be sure
|
|
119
|
-
vertical={undefined} subTabs={undefined}/>)}
|
|
120
|
-
</div>);
|
|
116
|
+
return (react_1.default.createElement("div", { className: (0, getBemClass_1.default)('Tabs', vertical && 'vertical'), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref },
|
|
117
|
+
tabs.map((tabProps, index) => renderTab(tabProps, index, listProps)),
|
|
118
|
+
subTabs && (react_1.default.createElement(Tabs, Object.assign({}, subTabs, { role: 'role' in subTabs ? subTabs.role : role, activateOnFocus: (_a = subTabs.activateOnFocus) !== null && _a !== void 0 ? _a : activateOnFocus, ssr: (_b = subTabs.ssr) !== null && _b !== void 0 ? _b : ssr, startSeen: true,
|
|
119
|
+
// just to be sure
|
|
120
|
+
vertical: undefined, subTabs: undefined })))));
|
|
121
121
|
};
|
|
122
122
|
exports.default = Tabs;
|
|
@@ -33,21 +33,16 @@ const TagPill = (props) => {
|
|
|
33
33
|
!onRemove &&
|
|
34
34
|
console.warn('static (non-button) `TagPill`s must not be removable');
|
|
35
35
|
const modifiers = [modifier, large && 'large', colors[color]];
|
|
36
|
-
const removeBtn = removable && (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{label}{' '}
|
|
48
|
-
{removable && (<span className="TagPill__remove" aria-label={removeLabelLong}>
|
|
49
|
-
{removeLabel}
|
|
50
|
-
</span>)}
|
|
51
|
-
</Button_1.default>);
|
|
36
|
+
const removeBtn = removable && (react_1.default.createElement("button", { className: "TagPill__remove", onClick: onRemove && (() => onRemove()), "aria-label": removeLabelLong, type: "button" }, removeLabel));
|
|
37
|
+
return isStatic ? (react_1.default.createElement("span", { className: (0, getBemClass_1.default)('TagPill', modifiers) },
|
|
38
|
+
label,
|
|
39
|
+
" ",
|
|
40
|
+
removeBtn)) : onRemove ? (react_1.default.createElement("span", { className: (0, getBemClass_1.default)('TagPill', modifiers) },
|
|
41
|
+
react_1.default.createElement(Button_1.default, Object.assign({ bem: "TagPill__button" }, buttonProps), label),
|
|
42
|
+
' ',
|
|
43
|
+
removeBtn)) : (react_1.default.createElement(Button_1.default, Object.assign({ bem: "TagPill" }, buttonProps, { modifier: modifiers }),
|
|
44
|
+
label,
|
|
45
|
+
' ',
|
|
46
|
+
removable && (react_1.default.createElement("span", { className: "TagPill__remove", "aria-label": removeLabelLong }, removeLabel))));
|
|
52
47
|
};
|
|
53
48
|
exports.default = TagPill;
|
|
@@ -10,13 +10,11 @@ const TextBlock = (props) => {
|
|
|
10
10
|
const { children, align, labelled, wide, small, startSeen } = props;
|
|
11
11
|
const rightAligned = align === 'right' || labelled;
|
|
12
12
|
const [ref] = (0, seenEffect_1.useSeenEffect)(startSeen);
|
|
13
|
-
return (
|
|
13
|
+
return (react_1.default.createElement("div", { className: (0, getBemClass_1.default)('TextBlock', [
|
|
14
14
|
labelled && 'labelled',
|
|
15
15
|
rightAligned && 'align--right',
|
|
16
16
|
wide && !rightAligned && 'wide',
|
|
17
17
|
small && !labelled && 'small',
|
|
18
|
-
])
|
|
19
|
-
{children}
|
|
20
|
-
</div>);
|
|
18
|
+
]), ref: ref }, children));
|
|
21
19
|
};
|
|
22
20
|
exports.default = TextBlock;
|
|
@@ -9,6 +9,6 @@ const TextButton = (props) => {
|
|
|
9
9
|
if ('disabled' in props) {
|
|
10
10
|
props = Object.assign(Object.assign({}, props), { disabled: undefined });
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return react_1.default.createElement(Button_1.default, Object.assign({ bem: "TextButton" }, props));
|
|
13
13
|
};
|
|
14
14
|
exports.default = TextButton;
|
|
@@ -58,6 +58,6 @@ const TextInput = (props) => {
|
|
|
58
58
|
// TypeScript is silly sometimes.
|
|
59
59
|
e);
|
|
60
60
|
};
|
|
61
|
-
return (
|
|
61
|
+
return (react_1.default.createElement(FormField_1.default, { className: (0, getBemClass_1.default)('TextInput', modifiers, 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) => multiline ? (react_1.default.createElement("textarea", Object.assign({ className: className.input, onChange: _onChange }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) : (react_1.default.createElement("input", Object.assign({ className: className.input, onChange: _onChange, type: type }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) }));
|
|
62
62
|
};
|
|
63
63
|
exports.default = TextInput;
|
|
@@ -41,6 +41,6 @@ const VSpacer = (props) => {
|
|
|
41
41
|
topVal && 'top--' + topVal,
|
|
42
42
|
bottomVal && 'bottom--' + bottomVal,
|
|
43
43
|
]);
|
|
44
|
-
return isWrapper ? (
|
|
44
|
+
return isWrapper ? (react_1.default.createElement("div", { className: className }, children)) : (react_1.default.createElement("hr", { className: className }));
|
|
45
45
|
};
|
|
46
46
|
exports.default = VSpacer;
|
|
@@ -86,11 +86,11 @@ const VerticalTabsTOC = (props) => {
|
|
|
86
86
|
window.addEventListener('hashchange', handleHash);
|
|
87
87
|
return () => window.removeEventListener('hashchange', handleHash);
|
|
88
88
|
}, [itemsById, onItemSelect]);
|
|
89
|
-
return (
|
|
89
|
+
return (react_1.default.createElement(Tabs_1.default, { id: domid, vertical: true, "aria-label": props['aria-label'], onSetActive: (_, item) => {
|
|
90
90
|
var _a;
|
|
91
91
|
const itemId = getItemId(item);
|
|
92
92
|
const newId = itemId || getItemId((_a = itemsById[itemId].subTabs) === null || _a === void 0 ? void 0 : _a.tabs[0]);
|
|
93
93
|
(0, frag_1.setFrag)(newId);
|
|
94
|
-
}
|
|
94
|
+
}, tabs: updatedItems, role: "tablist", activeIdx: state.activeIdx, subTabs: state.subTabs }));
|
|
95
95
|
};
|
|
96
96
|
exports.default = VerticalTabsTOC;
|
package/WizardLayout.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
8
|
+
const assets_1 = require("@reykjavik/hanna-utils/assets");
|
|
9
|
+
const Image_1 = __importDefault(require("./_abstract/Image"));
|
|
10
|
+
const Link_1 = require("./_abstract/Link");
|
|
11
|
+
const useScrollbarWidthCSSVar_1 = require("./utils/useScrollbarWidthCSSVar");
|
|
12
|
+
const WizardLayout = (props) => {
|
|
13
|
+
(0, useScrollbarWidthCSSVar_1.useScrollbarWidthCSSVar)();
|
|
14
|
+
const {
|
|
15
|
+
// ssr,
|
|
16
|
+
wizardStepper, wizardFooter, children, colorTheme, logoLink = '/', siteName = 'Reykjavík', globalAlerts, } = props;
|
|
17
|
+
const isBrowser = (0, hooks_1.useIsBrowserSide)( /* ssr */);
|
|
18
|
+
return (react_1.default.createElement("div", { className: "WizardLayout", "data-sprinkled": isBrowser, "data-color-theme": colorTheme },
|
|
19
|
+
globalAlerts && (react_1.default.createElement("div", { className: "WizardLayout__alerts", role: "alert" }, globalAlerts)),
|
|
20
|
+
react_1.default.createElement("div", { className: "WizardLayout__content" },
|
|
21
|
+
react_1.default.createElement("div", { className: "WizardLayout__header", role: "banner" },
|
|
22
|
+
react_1.default.createElement(Link_1.Link, { className: "WizardLayout__header__logo", href: logoLink },
|
|
23
|
+
' ',
|
|
24
|
+
react_1.default.createElement(Image_1.default, { inline: true, src: (0, assets_1.getAssetUrl)('reykjavik-logo.svg') }),
|
|
25
|
+
" ",
|
|
26
|
+
siteName,
|
|
27
|
+
' '),
|
|
28
|
+
' '),
|
|
29
|
+
react_1.default.createElement("div", { className: "WizardLayout__wrap" },
|
|
30
|
+
wizardStepper && (react_1.default.createElement("div", { className: "WizardLayout__stepper", role: "navigation" }, wizardStepper)),
|
|
31
|
+
react_1.default.createElement("div", { className: "WizardLayout__main", role: "main" }, children),
|
|
32
|
+
react_1.default.createElement("div", { className: "WizardLayout__deco WizardLayout__deco--geometry" })),
|
|
33
|
+
react_1.default.createElement("div", { className: "WizardLayout__footer", role: "complementary" }, wizardFooter))));
|
|
34
|
+
};
|
|
35
|
+
exports.default = WizardLayout;
|
|
@@ -5,5 +5,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const Button_1 = __importDefault(require("./_abstract/Button"));
|
|
8
|
-
const WizardLayoutClose = (props) => (
|
|
8
|
+
const WizardLayoutClose = (props) => (react_1.default.createElement(Button_1.default, Object.assign({ bem: "WizardLayoutClose" }, props)));
|
|
9
9
|
exports.default = WizardLayoutClose;
|
package/WizardStepper.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const getBemClass_1 = __importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
8
|
+
const WizardStepper = (props) => {
|
|
9
|
+
const { steps, activeStep = -1, allowForwardSkip, disableBacktrack, onClick } = props;
|
|
10
|
+
return (react_1.default.createElement("div", { className: (0, getBemClass_1.default)('WizardStepper', activeStep === -1 && 'preview') }, steps.map((step, i) => {
|
|
11
|
+
const { label, clickable, done, neutral } = step;
|
|
12
|
+
const stepClass = (0, getBemClass_1.default)('WizardStepper__step', [
|
|
13
|
+
(done || (done == null && i < activeStep)) && 'done',
|
|
14
|
+
neutral && 'neutral',
|
|
15
|
+
]);
|
|
16
|
+
const isClickable = clickable === 'always' ||
|
|
17
|
+
(clickable &&
|
|
18
|
+
(activeStep === i ||
|
|
19
|
+
(i > activeStep && allowForwardSkip) ||
|
|
20
|
+
(i < activeStep && !disableBacktrack)));
|
|
21
|
+
const ariaCurrent = activeStep === i ? 'step' : undefined;
|
|
22
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: i },
|
|
23
|
+
isClickable ? (react_1.default.createElement("button", { type: "button", className: stepClass, onClick: () => onClick(i), "aria-current": ariaCurrent }, label)) : (react_1.default.createElement("span", { className: stepClass, "aria-current": ariaCurrent },
|
|
24
|
+
' ',
|
|
25
|
+
label,
|
|
26
|
+
' ')),
|
|
27
|
+
' '));
|
|
28
|
+
})));
|
|
29
|
+
};
|
|
30
|
+
exports.default = WizardStepper;
|
|
@@ -43,14 +43,10 @@ const Button = (props) => {
|
|
|
43
43
|
(0, getBemClass_1.default)(bem, [modifier, variants[variant], sizes[size], navigationFlags[icon]]);
|
|
44
44
|
const iconProp = icons[icon] && { 'data-icon': icons[icon] };
|
|
45
45
|
if (buttonProps.href != null) {
|
|
46
|
-
return (
|
|
47
|
-
{label}
|
|
48
|
-
</Link_1.Link>);
|
|
46
|
+
return (react_1.default.createElement(Link_1.Link, Object.assign({ className: className }, buttonProps, { style: undefined }, iconProp), label));
|
|
49
47
|
}
|
|
50
48
|
else {
|
|
51
|
-
return (
|
|
52
|
-
{label}
|
|
53
|
-
</button>);
|
|
49
|
+
return (react_1.default.createElement("button", Object.assign({ className: className, type: "button" }, buttonProps, { style: undefined }, iconProp), label));
|
|
54
50
|
}
|
|
55
51
|
};
|
|
56
52
|
exports.default = Button;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CardList = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Button_1 = __importDefault(require("./Button"));
|
|
9
|
+
const Image_1 = __importDefault(require("./Image"));
|
|
10
|
+
const Card = (props) => {
|
|
11
|
+
const { bem, href, title, imgPlaceholder } = props;
|
|
12
|
+
const cardClass = `${bem}__card`;
|
|
13
|
+
const image = 'image' in props && props.image;
|
|
14
|
+
const meta = 'meta' in props && props.meta;
|
|
15
|
+
const summary = 'summary' in props && props.summary;
|
|
16
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
|
+
react_1.default.createElement(Button_1.default, { bem: cardClass, href: href },
|
|
18
|
+
' ',
|
|
19
|
+
react_1.default.createElement(Image_1.default, Object.assign({ className: `${bem}__image` }, image, { placeholder: imgPlaceholder })),
|
|
20
|
+
react_1.default.createElement("span", { className: `${cardClass}__title` }, title),
|
|
21
|
+
' ',
|
|
22
|
+
meta && react_1.default.createElement("span", { className: `${cardClass}__meta` }, meta),
|
|
23
|
+
' ',
|
|
24
|
+
summary && react_1.default.createElement("span", { className: `${cardClass}__summary` }, summary),
|
|
25
|
+
' '),
|
|
26
|
+
' '));
|
|
27
|
+
};
|
|
28
|
+
const CardList = (props) => {
|
|
29
|
+
const { bemPrefix, title, summaryElement, cards, titleTag = 'h2', children, imgPlaceholder, } = props;
|
|
30
|
+
const TitleTag = titleTag;
|
|
31
|
+
const fallbackImage = (imgPlaceholder !== true && imgPlaceholder) || undefined;
|
|
32
|
+
const fallbackImageStyle = fallbackImage
|
|
33
|
+
? { '--ImageCards--fallback': `url("${fallbackImage}")` }
|
|
34
|
+
: undefined;
|
|
35
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
36
|
+
summaryElement ? (react_1.default.createElement("div", { className: bemPrefix + '__summary' },
|
|
37
|
+
title && react_1.default.createElement(TitleTag, { className: bemPrefix + '__title' }, title),
|
|
38
|
+
summaryElement)) : (title && react_1.default.createElement(TitleTag, { className: bemPrefix + '__title' }, title)),
|
|
39
|
+
react_1.default.createElement("ul", { className: bemPrefix + '__list', style: fallbackImageStyle }, cards.map((card, i) => (react_1.default.createElement("li", { key: i, className: bemPrefix + '__item' },
|
|
40
|
+
react_1.default.createElement(Card, Object.assign({}, card, { bem: bemPrefix, imgPlaceholder: !!imgPlaceholder })))))),
|
|
41
|
+
children));
|
|
42
|
+
};
|
|
43
|
+
exports.CardList = CardList;
|
|
@@ -14,21 +14,19 @@ const Image = (props) => {
|
|
|
14
14
|
const imgLoading = preloadSrc ? 'eager' : 'lazy';
|
|
15
15
|
const inlineSvg = (0, useGetSVGtext_1.useGetSVGtext)(inline ? imageSrc : undefined);
|
|
16
16
|
if (!imageSrc) {
|
|
17
|
-
return placeholder ? (
|
|
18
|
-
{placeholder !== true && placeholder()}
|
|
19
|
-
</span>) : null;
|
|
17
|
+
return placeholder ? (react_1.default.createElement("span", { className: className && (0, getBemClass_1.default)(className, 'missing') }, placeholder !== true && placeholder())) : null;
|
|
20
18
|
}
|
|
21
19
|
if (inline && inlineSvg) {
|
|
22
20
|
const __html = inlineSvg.imageSrc === imageSrc ? inlineSvg.code : '';
|
|
23
|
-
return
|
|
21
|
+
return react_1.default.createElement("span", { className: className, dangerouslySetInnerHTML: { __html } });
|
|
24
22
|
}
|
|
25
|
-
return (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
return (react_1.default.createElement("picture", { className: className },
|
|
24
|
+
' ',
|
|
25
|
+
sources.map((source, i) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
26
|
+
react_1.default.createElement("source", { key: i, srcSet: source.srcset, media: source.media }),
|
|
27
|
+
' '))),
|
|
28
|
+
' ',
|
|
29
|
+
react_1.default.createElement("img", { src: imageSrc, alt: altText, loading: imgLoading }),
|
|
30
|
+
' '));
|
|
33
31
|
};
|
|
34
32
|
exports.default = Image;
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const getBemClass_1 = __importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
8
|
+
const TogglerGroup = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
// id,
|
|
11
|
+
className, bem, name, disabled, Toggler, onSelected, options, inputProps = {}, } = props;
|
|
12
|
+
const values = props.value || [];
|
|
13
|
+
return (react_1.default.createElement("ul", { className: (0, getBemClass_1.default)(bem, null, className), role: "group", "aria-labelledby": props['aria-labelledby'], "aria-describedby": props['aria-describedby'], "aria-required": props.required }, options.map((option, i) => {
|
|
14
|
+
const isDisabled = option.disabled != null
|
|
15
|
+
? option.disabled
|
|
16
|
+
: disabled && typeof disabled !== 'boolean'
|
|
17
|
+
? disabled.includes(i)
|
|
18
|
+
: disabled;
|
|
19
|
+
const isChecked = values.includes(option.value);
|
|
20
|
+
return (react_1.default.createElement(Toggler, Object.assign({ key: i }, inputProps, { className: bem + '__item', name: name, Wrapper: "li" }, option, { label: option.label || option.value, onChange: onSelected
|
|
21
|
+
? (e) => {
|
|
22
|
+
const { value } = option;
|
|
23
|
+
const checked = e.currentTarget.checked;
|
|
24
|
+
inputProps.onChange && inputProps.onChange(e);
|
|
25
|
+
const selectedValues = values.filter((val) => val !== value);
|
|
26
|
+
if (checked) {
|
|
27
|
+
selectedValues.push(value);
|
|
28
|
+
}
|
|
29
|
+
onSelected({ value, checked, option, selectedValues });
|
|
30
|
+
}
|
|
31
|
+
: inputProps.onChange, disabled: isDisabled, "aria-invalid": props['aria-invalid'], checked: isChecked })));
|
|
32
|
+
})));
|
|
33
|
+
};
|
|
34
|
+
exports.default = TogglerGroup;
|
|
@@ -20,8 +20,8 @@ const FormField_1 = __importDefault(require("../FormField"));
|
|
|
20
20
|
const TogglerGroup_1 = __importDefault(require("./TogglerGroup"));
|
|
21
21
|
const TogglerGroupField = (props) => {
|
|
22
22
|
const { bem, Toggler, className, modifier, label, LabelTag, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, value } = props, togglerGroupProps = __rest(props, ["bem", "Toggler", "className", "modifier", "label", "LabelTag", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "value"]);
|
|
23
|
-
return (
|
|
24
|
-
return (
|
|
25
|
-
}}
|
|
23
|
+
return (react_1.default.createElement(FormField_1.default, { className: (0, getBemClass_1.default)(bem, modifier, className), group: true, label: label, LabelTag: LabelTag, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps) => {
|
|
24
|
+
return (react_1.default.createElement(TogglerGroup_1.default, Object.assign({ bem: className.options }, inputProps, togglerGroupProps, { value: Array.isArray(value) ? value : value != null ? [value] : undefined, Toggler: Toggler })));
|
|
25
|
+
} }));
|
|
26
26
|
};
|
|
27
27
|
exports.default = TogglerGroupField;
|
|
@@ -21,20 +21,18 @@ const TogglerInput = (props) => {
|
|
|
21
21
|
const { bem, modifier, className, label, invalid, errorMessage, Wrapper = 'div', required, reqText, type, id } = props, inputProps = __rest(props, ["bem", "modifier", "className", "label", "invalid", "errorMessage", "Wrapper", "required", "reqText", "type", "id"]);
|
|
22
22
|
const domid = (0, hooks_1.useDomid)(id);
|
|
23
23
|
const errorId = errorMessage && 'error' + domid;
|
|
24
|
-
const reqStar = required && reqText !== false && (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</div>)}
|
|
38
|
-
</Wrapper>);
|
|
24
|
+
const reqStar = required && reqText !== false && (react_1.default.createElement("abbr", { className: bem + '__label__reqstar',
|
|
25
|
+
// TODO: add mo-better i18n thinking
|
|
26
|
+
title: (reqText || 'Þarf að haka í') + ': ' }, "*"));
|
|
27
|
+
return (react_1.default.createElement(Wrapper, { className: (0, getBemClass_1.default)(bem, modifier, className) },
|
|
28
|
+
react_1.default.createElement("input", Object.assign({ className: bem + '__input', type: type, id: domid, "aria-invalid": invalid || !!errorMessage || undefined, "aria-describedby": errorId }, inputProps)),
|
|
29
|
+
' ',
|
|
30
|
+
react_1.default.createElement("label", { className: bem + '__label', htmlFor: domid },
|
|
31
|
+
' ',
|
|
32
|
+
reqStar,
|
|
33
|
+
" ",
|
|
34
|
+
label,
|
|
35
|
+
' '),
|
|
36
|
+
errorMessage && (react_1.default.createElement("div", { className: bem + '__error', id: errorId }, errorMessage))));
|
|
39
37
|
};
|
|
40
38
|
exports.default = TogglerInput;
|