@reykjavik/hanna-react 0.10.99 → 0.10.101
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 +2 -2
- package/ActionCards.d.ts +2 -1
- package/ActionCards.js +1 -1
- package/Alert.d.ts +2 -2
- package/Alert.js +20 -12
- package/ArticleCards.d.ts +4 -1
- package/ArticleCards.js +1 -1
- package/ArticleCarousel/_ArticleCarouselCard.js +1 -2
- package/ArticleCarousel.d.ts +2 -2
- package/ArticleCarousel.js +1 -1
- package/ArticleMeta.d.ts +2 -1
- package/ArticleMeta.js +2 -2
- package/Attention.d.ts +2 -1
- package/Attention.js +4 -1
- package/BasicTable.d.ts +2 -1
- package/BgBox.d.ts +2 -1
- package/BgBox.js +4 -2
- package/Bling.d.ts +2 -1
- package/Bling.js +5 -3
- package/BlockBreak.js +1 -0
- package/BreadCrumbs.d.ts +2 -1
- package/BreadCrumbs.js +3 -2
- package/ButtonBack.js +2 -0
- package/ButtonBar.d.ts +4 -3
- package/ButtonBar.js +3 -3
- package/ButtonPrimary.js +2 -0
- package/ButtonSecondary.js +2 -0
- package/ButtonTertiary.js +2 -0
- package/CHANGELOG.md +14 -1
- package/CarouselStepper.d.ts +2 -1
- package/CenterColumn.d.ts +2 -1
- package/CenterColumn.js +4 -2
- package/CheckboxButton.d.ts +4 -2
- package/CheckboxButtonsGroup.js +2 -2
- package/CityBlock.d.ts +2 -1
- package/CityBlock.js +1 -1
- package/ContactBubble.d.ts +2 -2
- package/ContactBubble.js +5 -4
- package/ContentArticle.d.ts +2 -1
- package/ContentArticle.js +3 -2
- package/ContentImage.d.ts +2 -1
- package/ContentImage.js +4 -3
- package/Datepicker.js +6 -6
- package/ExtraLinks.d.ts +2 -1
- package/ExtraLinks.js +4 -2
- package/FeatureList.d.ts +2 -1
- package/FeatureList.js +3 -2
- package/FieldGroup.d.ts +2 -1
- package/FieldGroup.js +4 -2
- package/FileInput.d.ts +2 -2
- package/FileInput.js +10 -5
- package/Foonote.js +3 -4
- package/Footnote.d.ts +2 -1
- package/Footnote.js +2 -1
- package/Form.js +4 -5
- package/FormField.d.ts +25 -5
- package/FormField.js +32 -7
- package/Gallery/_GalleryItem.js +2 -2
- package/Gallery/_GalleryModalItem.js +1 -1
- package/Gallery.d.ts +2 -2
- package/Gallery.js +5 -4
- package/GridBlocks.d.ts +2 -5
- package/GridBlocks.js +3 -3
- package/Heading.d.ts +2 -1
- package/Heading.js +3 -3
- package/HeroBlock.d.ts +2 -1
- package/HeroBlock.js +4 -3
- package/IframeBlock.d.ts +9 -4
- package/IframeBlock.js +13 -12
- package/Illustration.d.ts +2 -1
- package/Illustration.js +1 -1
- package/ImageCards.d.ts +2 -1
- package/ImageCards.js +2 -2
- package/InfoBlock.d.ts +2 -1
- package/InfoBlock.js +3 -2
- package/InfoHero.d.ts +2 -1
- package/InfoHero.js +3 -3
- package/IslandBlock.d.ts +2 -1
- package/IslandBlock.js +2 -2
- package/IslandPageBlock.d.ts +2 -1
- package/IslandPageBlock.js +2 -2
- package/LabeledTextBlock.d.ts +2 -1
- package/LabeledTextBlock.js +2 -2
- package/Layout.d.ts +2 -2
- package/Layout.js +3 -3
- package/MainMenu.d.ts +2 -2
- package/MainMenu.js +4 -3
- package/MiniMetrics.d.ts +2 -1
- package/MiniMetrics.js +3 -2
- package/Modal.d.ts +2 -1
- package/Multiselect.d.ts +11 -6
- package/Multiselect.js +15 -11
- package/NameCard.d.ts +2 -1
- package/NameCard.js +10 -6
- package/NameCards.d.ts +3 -2
- package/NameCards.js +3 -2
- package/NewsHero.d.ts +2 -1
- package/NewsHero.js +3 -3
- package/PageFilter.d.ts +2 -1
- package/PageFilter.js +2 -2
- package/PageHeading.d.ts +2 -1
- package/PageHeading.js +2 -5
- package/Picture.d.ts +2 -1
- package/Picture.js +1 -5
- package/ProcessOverview.d.ts +2 -1
- package/ProcessOverview.js +2 -5
- package/RadioButtonsGroup.js +2 -2
- package/RadioGroup.js +1 -1
- package/ReadSpeakerPlayer.d.ts +1 -1
- package/ReadSpeakerPlayer.js +2 -2
- package/RelatedLinks.d.ts +2 -1
- package/RelatedLinks.js +3 -2
- package/RowBlock.d.ts +2 -1
- package/RowBlock.js +2 -2
- package/RowBlockColumn.d.ts +2 -1
- package/RowBlockColumn.js +3 -3
- package/SearchInput.d.ts +3 -9
- package/SearchInput.js +4 -5
- package/SearchResults/_SearchResultsItem.js +1 -1
- package/SearchResults.d.ts +2 -1
- package/SearchResults.js +2 -2
- package/SeenEffect.js +2 -0
- package/Selectbox.js +3 -4
- package/ShareButtons.d.ts +2 -2
- package/ShareButtons.js +5 -3
- package/Sharpie.d.ts +2 -1
- package/Sharpie.js +2 -2
- package/SiteSearchAutocomplete.d.ts +2 -1
- package/SiteSearchAutocomplete.js +4 -4
- package/SiteSearchCurtain.js +2 -0
- package/SiteSearchInput.d.ts +3 -6
- package/SiteSearchInput.js +4 -4
- package/Skeleton.d.ts +4 -1
- package/Skeleton.js +15 -18
- package/SubHeading.d.ts +2 -1
- package/SubHeading.js +3 -3
- package/Tabs.d.ts +2 -2
- package/Tabs.js +5 -5
- package/TagPill.js +2 -0
- package/TextBlock.d.ts +2 -1
- package/TextBlock.js +3 -3
- package/TextButton.js +2 -0
- package/TextInput.d.ts +2 -2
- package/TextInput.js +3 -4
- package/Tooltip.d.ts +2 -1
- package/Tooltip.js +28 -15
- package/VSpacer.d.ts +2 -1
- package/VSpacer.js +3 -7
- package/VerticalTabsTOC.d.ts +1 -1
- package/VerticalTabsTOC.js +1 -1
- package/WizardLayout.d.ts +2 -2
- package/WizardLayout.js +4 -3
- package/WizardLayoutClose.js +2 -0
- package/WizardStepper.d.ts +2 -1
- package/WizardStepper.js +2 -2
- package/_abstract/_AbstractCarousel.d.ts +2 -2
- package/_abstract/_AbstractCarousel.js +6 -3
- package/_abstract/_Block.d.ts +2 -1
- package/_abstract/_Block.js +3 -3
- package/_abstract/_Button.js +4 -1
- package/_abstract/_CardList.d.ts +3 -1
- package/_abstract/_CardList.js +6 -3
- package/_abstract/_Image.d.ts +6 -3
- package/_abstract/_Image.js +11 -4
- package/_abstract/_Quote.d.ts +2 -1
- package/_abstract/_Quote.js +3 -2
- package/_abstract/_TogglerGroup.js +1 -1
- package/_abstract/_TogglerGroupField.js +5 -5
- package/_abstract/_TogglerInput.d.ts +2 -2
- package/_abstract/_TogglerInput.js +4 -2
- package/esm/AccordionList.d.ts +2 -2
- package/esm/AccordionList.js +3 -3
- package/esm/ActionCards.d.ts +2 -1
- package/esm/ActionCards.js +1 -1
- package/esm/Alert.d.ts +2 -2
- package/esm/Alert.js +21 -13
- package/esm/ArticleCards.d.ts +4 -1
- package/esm/ArticleCards.js +1 -1
- package/esm/ArticleCarousel/_ArticleCarouselCard.js +1 -2
- package/esm/ArticleCarousel.d.ts +2 -2
- package/esm/ArticleCarousel.js +1 -1
- package/esm/ArticleMeta.d.ts +2 -1
- package/esm/ArticleMeta.js +2 -2
- package/esm/Attention.d.ts +2 -1
- package/esm/Attention.js +4 -1
- package/esm/BasicTable.d.ts +2 -1
- package/esm/BgBox.d.ts +2 -1
- package/esm/BgBox.js +4 -2
- package/esm/Bling.d.ts +2 -1
- package/esm/Bling.js +5 -3
- package/esm/BlockBreak.js +1 -0
- package/esm/BreadCrumbs.d.ts +2 -1
- package/esm/BreadCrumbs.js +3 -2
- package/esm/ButtonBack.js +2 -0
- package/esm/ButtonBar.d.ts +4 -3
- package/esm/ButtonBar.js +3 -3
- package/esm/ButtonPrimary.js +2 -0
- package/esm/ButtonSecondary.js +2 -0
- package/esm/ButtonTertiary.js +2 -0
- package/esm/CarouselStepper.d.ts +2 -1
- package/esm/CenterColumn.d.ts +2 -1
- package/esm/CenterColumn.js +4 -2
- package/esm/CheckboxButton.d.ts +4 -2
- package/esm/CheckboxButtonsGroup.js +2 -2
- package/esm/CityBlock.d.ts +2 -1
- package/esm/CityBlock.js +1 -1
- package/esm/ContactBubble.d.ts +2 -2
- package/esm/ContactBubble.js +5 -4
- package/esm/ContentArticle.d.ts +2 -1
- package/esm/ContentArticle.js +3 -2
- package/esm/ContentImage.d.ts +2 -1
- package/esm/ContentImage.js +4 -3
- package/esm/Datepicker.js +7 -7
- package/esm/ExtraLinks.d.ts +2 -1
- package/esm/ExtraLinks.js +4 -2
- package/esm/FeatureList.d.ts +2 -1
- package/esm/FeatureList.js +3 -2
- package/esm/FieldGroup.d.ts +2 -1
- package/esm/FieldGroup.js +4 -2
- package/esm/FileInput.d.ts +2 -2
- package/esm/FileInput.js +10 -5
- package/esm/Foonote.js +2 -2
- package/esm/Footnote.d.ts +2 -1
- package/esm/Footnote.js +2 -1
- package/esm/Form.js +5 -5
- package/esm/FormField.d.ts +25 -5
- package/esm/FormField.js +30 -6
- package/esm/Gallery/_GalleryItem.js +2 -2
- package/esm/Gallery/_GalleryModalItem.js +1 -1
- package/esm/Gallery.d.ts +2 -2
- package/esm/Gallery.js +6 -5
- package/esm/GridBlocks.d.ts +2 -5
- package/esm/GridBlocks.js +3 -3
- package/esm/Heading.d.ts +2 -1
- package/esm/Heading.js +3 -3
- package/esm/HeroBlock.d.ts +2 -1
- package/esm/HeroBlock.js +4 -3
- package/esm/IframeBlock.d.ts +9 -4
- package/esm/IframeBlock.js +13 -12
- package/esm/Illustration.d.ts +2 -1
- package/esm/Illustration.js +1 -1
- package/esm/ImageCards.d.ts +2 -1
- package/esm/ImageCards.js +2 -2
- package/esm/InfoBlock.d.ts +2 -1
- package/esm/InfoBlock.js +3 -2
- package/esm/InfoHero.d.ts +2 -1
- package/esm/InfoHero.js +3 -3
- package/esm/IslandBlock.d.ts +2 -1
- package/esm/IslandBlock.js +2 -2
- package/esm/IslandPageBlock.d.ts +2 -1
- package/esm/IslandPageBlock.js +2 -2
- package/esm/LabeledTextBlock.d.ts +2 -1
- package/esm/LabeledTextBlock.js +2 -2
- package/esm/Layout.d.ts +2 -2
- package/esm/Layout.js +3 -3
- package/esm/MainMenu.d.ts +2 -2
- package/esm/MainMenu.js +4 -3
- package/esm/MiniMetrics.d.ts +2 -1
- package/esm/MiniMetrics.js +3 -2
- package/esm/Modal.d.ts +2 -1
- package/esm/Multiselect.d.ts +11 -6
- package/esm/Multiselect.js +15 -11
- package/esm/NameCard.d.ts +2 -1
- package/esm/NameCard.js +10 -6
- package/esm/NameCards.d.ts +3 -2
- package/esm/NameCards.js +3 -2
- package/esm/NewsHero.d.ts +2 -1
- package/esm/NewsHero.js +3 -3
- package/esm/PageFilter.d.ts +2 -1
- package/esm/PageFilter.js +2 -2
- package/esm/PageHeading.d.ts +2 -1
- package/esm/PageHeading.js +2 -5
- package/esm/Picture.d.ts +2 -1
- package/esm/Picture.js +1 -5
- package/esm/ProcessOverview.d.ts +2 -1
- package/esm/ProcessOverview.js +2 -5
- package/esm/RadioButtonsGroup.js +2 -2
- package/esm/RadioGroup.js +1 -1
- package/esm/ReadSpeakerPlayer.d.ts +1 -1
- package/esm/ReadSpeakerPlayer.js +2 -2
- package/esm/RelatedLinks.d.ts +2 -1
- package/esm/RelatedLinks.js +3 -2
- package/esm/RowBlock.d.ts +2 -1
- package/esm/RowBlock.js +2 -2
- package/esm/RowBlockColumn.d.ts +2 -1
- package/esm/RowBlockColumn.js +3 -3
- package/esm/SearchInput.d.ts +3 -9
- package/esm/SearchInput.js +4 -5
- package/esm/SearchResults/_SearchResultsItem.js +1 -1
- package/esm/SearchResults.d.ts +2 -1
- package/esm/SearchResults.js +2 -2
- package/esm/SeenEffect.js +2 -0
- package/esm/Selectbox.js +3 -4
- package/esm/ShareButtons.d.ts +2 -2
- package/esm/ShareButtons.js +5 -3
- package/esm/Sharpie.d.ts +2 -1
- package/esm/Sharpie.js +2 -2
- package/esm/SiteSearchAutocomplete.d.ts +2 -1
- package/esm/SiteSearchAutocomplete.js +4 -4
- package/esm/SiteSearchCurtain.js +2 -0
- package/esm/SiteSearchInput.d.ts +3 -6
- package/esm/SiteSearchInput.js +4 -4
- package/esm/Skeleton.d.ts +4 -1
- package/esm/Skeleton.js +15 -18
- package/esm/SubHeading.d.ts +2 -1
- package/esm/SubHeading.js +3 -3
- package/esm/Tabs.d.ts +2 -2
- package/esm/Tabs.js +5 -5
- package/esm/TagPill.js +2 -0
- package/esm/TextBlock.d.ts +2 -1
- package/esm/TextBlock.js +3 -3
- package/esm/TextButton.js +2 -0
- package/esm/TextInput.d.ts +2 -2
- package/esm/TextInput.js +3 -4
- package/esm/Tooltip.d.ts +2 -1
- package/esm/Tooltip.js +28 -15
- package/esm/VSpacer.d.ts +2 -1
- package/esm/VSpacer.js +3 -7
- package/esm/VerticalTabsTOC.d.ts +1 -1
- package/esm/VerticalTabsTOC.js +1 -1
- package/esm/WizardLayout.d.ts +2 -2
- package/esm/WizardLayout.js +4 -3
- package/esm/WizardLayoutClose.js +2 -0
- package/esm/WizardStepper.d.ts +2 -1
- package/esm/WizardStepper.js +2 -2
- package/esm/_abstract/_AbstractCarousel.d.ts +2 -2
- package/esm/_abstract/_AbstractCarousel.js +6 -3
- package/esm/_abstract/_Block.d.ts +2 -1
- package/esm/_abstract/_Block.js +3 -3
- package/esm/_abstract/_Button.js +4 -1
- package/esm/_abstract/_CardList.d.ts +3 -1
- package/esm/_abstract/_CardList.js +6 -3
- package/esm/_abstract/_Image.d.ts +6 -3
- package/esm/_abstract/_Image.js +12 -5
- package/esm/_abstract/_Quote.d.ts +2 -1
- package/esm/_abstract/_Quote.js +3 -2
- package/esm/_abstract/_TogglerGroup.js +1 -1
- package/esm/_abstract/_TogglerGroupField.js +5 -5
- package/esm/_abstract/_TogglerInput.d.ts +2 -2
- package/esm/_abstract/_TogglerInput.js +4 -2
- package/esm/utils.d.ts +25 -2
- package/package.json +1 -1
- package/utils.d.ts +25 -2
package/Heading.js
CHANGED
|
@@ -11,14 +11,14 @@ const sizes = {
|
|
|
11
11
|
large: 'large',
|
|
12
12
|
};
|
|
13
13
|
const Heading = (props) => {
|
|
14
|
-
const { size = 'normal', align, wide, children } = props;
|
|
14
|
+
const { size = 'normal', align, wide, children, wrapperProps } = props;
|
|
15
15
|
const Tag = props.Tag || (props.forceH1 ? 'h1' : 'h2');
|
|
16
16
|
const suppressWarning = process.env.NODE_ENV !== 'production' && Tag === 'h1' ? true : undefined;
|
|
17
|
-
return (react_1.default.createElement(Tag, { "data-dev-forcedh1": suppressWarning, className: (0, classUtils_1.modifiedClass)('Heading', [
|
|
17
|
+
return (react_1.default.createElement(Tag, Object.assign({}, wrapperProps, { "data-dev-forcedh1": suppressWarning, className: (0, classUtils_1.modifiedClass)('Heading', [
|
|
18
18
|
sizes[size],
|
|
19
19
|
align === 'right' && 'align--' + align,
|
|
20
20
|
!align && wide && 'wide',
|
|
21
|
-
]) }, children));
|
|
21
|
+
]) }), children));
|
|
22
22
|
};
|
|
23
23
|
exports.Heading = Heading;
|
|
24
24
|
exports.default = exports.Heading;
|
package/HeroBlock.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Illustration } from '@reykjavik/hanna-utils/assets';
|
|
|
2
2
|
import { ButtonProps } from './_abstract/_Button.js';
|
|
3
3
|
import { ImageProps } from './_abstract/_Image.js';
|
|
4
4
|
import { SeenProp } from './utils/seenEffect.js';
|
|
5
|
+
import { WrapperElmProps } from './utils.js';
|
|
5
6
|
type HeroBlockImageProps = {
|
|
6
7
|
illustration: Illustration;
|
|
7
8
|
image?: undefined;
|
|
@@ -14,6 +15,6 @@ export type HeroBlockProps = {
|
|
|
14
15
|
summary: string | JSX.Element;
|
|
15
16
|
primaryButton?: ButtonProps;
|
|
16
17
|
secondaryButton?: ButtonProps;
|
|
17
|
-
} & HeroBlockImageProps & SeenProp;
|
|
18
|
+
} & HeroBlockImageProps & WrapperElmProps & SeenProp;
|
|
18
19
|
export declare const HeroBlock: (props: HeroBlockProps) => JSX.Element;
|
|
19
20
|
export default HeroBlock;
|
package/HeroBlock.js
CHANGED
|
@@ -3,19 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HeroBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
6
7
|
const assets_1 = require("@reykjavik/hanna-utils/assets");
|
|
7
8
|
const _Image_js_1 = require("./_abstract/_Image.js");
|
|
8
9
|
const seenEffect_js_1 = require("./utils/seenEffect.js");
|
|
9
10
|
const ButtonPrimary_js_1 = tslib_1.__importDefault(require("./ButtonPrimary.js"));
|
|
10
11
|
const ButtonTertiary_js_1 = tslib_1.__importDefault(require("./ButtonTertiary.js"));
|
|
11
12
|
const HeroBlock = (props) => {
|
|
12
|
-
const { title, summary, illustration, image, primaryButton, secondaryButton, startSeen, } = props;
|
|
13
|
+
const { title, summary, illustration, image, primaryButton, secondaryButton, startSeen, wrapperProps, } = props;
|
|
13
14
|
const hasButtons = Boolean(primaryButton || secondaryButton);
|
|
14
15
|
const imgProps = illustration ? { src: (0, assets_1.getIllustrationUrl)(illustration) } : image;
|
|
15
16
|
const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
16
|
-
return (react_1.default.createElement("div", { className:
|
|
17
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('HeroBlock', null, (wrapperProps || {}).className), ref: ref }),
|
|
17
18
|
react_1.default.createElement("h1", { className: "HeroBlock__title" }, title),
|
|
18
|
-
react_1.default.createElement(_Image_js_1.Image, Object.assign({
|
|
19
|
+
react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "HeroBlock__image" }, imgProps)),
|
|
19
20
|
react_1.default.createElement("div", { className: "HeroBlock__summary" }, summary),
|
|
20
21
|
hasButtons && (react_1.default.createElement("div", { className: "HeroBlock__buttons" },
|
|
21
22
|
primaryButton && react_1.default.createElement(ButtonPrimary_js_1.default, Object.assign({}, primaryButton)),
|
package/IframeBlock.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { IframeResizerProps, ResizerOptions } from 'iframe-resizer-react';
|
|
3
|
+
import { HTMLProps } from './utils.js';
|
|
4
|
+
type ForbiddenWrapperProps = 'scrolling' | 'height' | 'title' | 'src';
|
|
3
5
|
export type IframeBlockProps = {
|
|
4
6
|
src: string;
|
|
5
7
|
/** Accessible title attribute for the iframe (similar to alt="" on images) */
|
|
@@ -8,13 +10,16 @@ export type IframeBlockProps = {
|
|
|
8
10
|
compact?: boolean;
|
|
9
11
|
align?: 'right';
|
|
10
12
|
} & EitherObj<{
|
|
13
|
+
/** Fixed height, no auto-resizing of the iframe */
|
|
14
|
+
height: number;
|
|
15
|
+
scrolling?: boolean | 'no' | 'yes';
|
|
16
|
+
wrapperProps?: HTMLProps<'iframe', ForbiddenWrapperProps>;
|
|
17
|
+
}, {
|
|
11
18
|
/** Default: `'auto'` ... which initializes "iframe-resizer" script */
|
|
12
19
|
height?: 'auto';
|
|
13
20
|
/** Default: `false` ... Set to `true` for same-site only, or provide array of allowed domain-names */
|
|
14
21
|
checkOrigin?: ResizerOptions['checkOrigin'];
|
|
15
|
-
|
|
16
|
-
height: number;
|
|
17
|
-
scrolling?: boolean | 'no' | 'yes';
|
|
22
|
+
wrapperProps?: Omit<IframeResizerProps, ForbiddenWrapperProps>;
|
|
18
23
|
}>;
|
|
19
24
|
/**
|
|
20
25
|
* When `height` is undefined or "auto", then Add the following code-snipped to the iframed page:
|
package/IframeBlock.js
CHANGED
|
@@ -14,18 +14,19 @@ const iframe_resizer_react_1 = tslib_1.__importDefault(require("iframe-resizer-r
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
const IframeBlock = (props) => {
|
|
17
|
-
const { title, src, framed, compact,
|
|
18
|
-
const className = (0, classUtils_1.modifiedClass)('IframeBlock', [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
const { title, src, framed, compact, align } = props;
|
|
18
|
+
const className = (0, classUtils_1.modifiedClass)('IframeBlock', [framed && 'framed', compact && 'compact', align === 'right' && 'align--' + align], (props.wrapperProps || {}).className);
|
|
19
|
+
if (typeof props.height === 'number') {
|
|
20
|
+
const { wrapperProps, scrolling, height } = props;
|
|
21
|
+
return (react_1.default.createElement("iframe", Object.assign({}, wrapperProps, { className: className, title: title, src: src,
|
|
22
|
+
// hidden tiger: pass negative height to disable iframe-resizer but not set height explicitly
|
|
23
|
+
// (Silly hack, don't rely on this)
|
|
24
|
+
height: height < 0 ? undefined : height,
|
|
25
|
+
// allow undefined to suppress scrolling attribute
|
|
26
|
+
scrolling: scrolling === true ? 'yes' : scrolling === false ? 'no' : scrolling })));
|
|
27
|
+
}
|
|
28
|
+
const { wrapperProps, checkOrigin = false } = props;
|
|
29
|
+
return (react_1.default.createElement(iframe_resizer_react_1.default, Object.assign({}, wrapperProps, { className: className, title: title, src: src, checkOrigin: checkOrigin })));
|
|
29
30
|
};
|
|
30
31
|
exports.IframeBlock = IframeBlock;
|
|
31
32
|
exports.default = exports.IframeBlock;
|
package/Illustration.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
2
2
|
import { Illustration as IllustrationName } from '@reykjavik/hanna-utils/assets';
|
|
3
3
|
import { ImageProps } from './_abstract/_Image.js';
|
|
4
|
+
import { WrapperElmProps } from './utils.js';
|
|
4
5
|
type IllustrationProps = EitherObj<{
|
|
5
6
|
type: IllustrationName;
|
|
6
7
|
}, {
|
|
7
8
|
image: ImageProps;
|
|
8
|
-
}
|
|
9
|
+
}> & WrapperElmProps;
|
|
9
10
|
export declare const Illustration: (props: IllustrationProps) => JSX.Element;
|
|
10
11
|
export default Illustration;
|
package/Illustration.js
CHANGED
|
@@ -7,7 +7,7 @@ const assets_1 = require("@reykjavik/hanna-utils/assets");
|
|
|
7
7
|
const _Image_js_1 = require("./_abstract/_Image.js");
|
|
8
8
|
const Illustration = (props) => {
|
|
9
9
|
const imgProps = props.type ? { src: (0, assets_1.getIllustrationUrl)(props.type) } : props.image;
|
|
10
|
-
return react_1.default.createElement(_Image_js_1.Image, Object.assign({
|
|
10
|
+
return react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "Illustration" }, imgProps, { wrapperProps: props.wrapperProps }));
|
|
11
11
|
};
|
|
12
12
|
exports.Illustration = Illustration;
|
|
13
13
|
exports.default = exports.Illustration;
|
package/ImageCards.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CardListSummaryProps, ImageCardListProps, ImageCardProps as _ImageCardProps } from './_abstract/_CardList.js';
|
|
2
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
import { WrapperElmProps } from './utils.js';
|
|
3
4
|
export type ImageCardsItemProps = _ImageCardProps;
|
|
4
5
|
/** @deprecated Use `ImageCardsItemProps` instead. (Will be removed in v0.11) */
|
|
5
6
|
export type ImageCardProps = ImageCardsItemProps;
|
|
6
7
|
export type ImageCardsProps = ImageCardListProps & CardListSummaryProps & {
|
|
7
8
|
background?: boolean;
|
|
8
|
-
} & SeenProp;
|
|
9
|
+
} & WrapperElmProps & SeenProp;
|
|
9
10
|
export declare const ImageCards: (props: ImageCardsProps) => JSX.Element;
|
|
10
11
|
export default ImageCards;
|
package/ImageCards.js
CHANGED
|
@@ -7,9 +7,9 @@ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
|
7
7
|
const _CardList_js_1 = require("./_abstract/_CardList.js");
|
|
8
8
|
const seenEffect_js_1 = require("./utils/seenEffect.js");
|
|
9
9
|
const ImageCards = (props) => {
|
|
10
|
-
const { background, startSeen } = props, cardListProps = tslib_1.__rest(props, ["background", "startSeen"]);
|
|
10
|
+
const { background, startSeen, wrapperProps } = props, cardListProps = tslib_1.__rest(props, ["background", "startSeen", "wrapperProps"]);
|
|
11
11
|
const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
12
|
-
return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('ImageCards', background && 'background'), ref: ref },
|
|
12
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('ImageCards', background && 'background', (wrapperProps || {}).className), ref: ref }),
|
|
13
13
|
react_1.default.createElement(_CardList_js_1.CardList, Object.assign({}, cardListProps, { bemPrefix: "ImageCards", imgPlaceholder: props.imgPlaceholder || true }))));
|
|
14
14
|
};
|
|
15
15
|
exports.ImageCards = ImageCards;
|
package/InfoBlock.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
2
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
import { WrapperElmProps } from './utils.js';
|
|
3
4
|
export type InfoBlockProps = {
|
|
4
5
|
title: string;
|
|
5
6
|
subtitle?: string | JSX.Element;
|
|
@@ -8,6 +9,6 @@ export type InfoBlockProps = {
|
|
|
8
9
|
attention?: string | JSX.Element;
|
|
9
10
|
}, {
|
|
10
11
|
extraInfo?: string | JSX.Element;
|
|
11
|
-
}> & SeenProp;
|
|
12
|
+
}> & WrapperElmProps & SeenProp;
|
|
12
13
|
export declare const InfoBlock: (props: InfoBlockProps) => JSX.Element;
|
|
13
14
|
export default InfoBlock;
|
package/InfoBlock.js
CHANGED
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InfoBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
6
7
|
const seenEffect_js_1 = require("./utils/seenEffect.js");
|
|
7
8
|
const InfoBlock = (props) => {
|
|
8
|
-
const { title, subtitle, items, startSeen } = props;
|
|
9
|
+
const { title, subtitle, items, startSeen, wrapperProps } = props;
|
|
9
10
|
const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
10
|
-
return (react_1.default.createElement("div", { className:
|
|
11
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('InfoBlock', null, (wrapperProps || {}).className), ref: ref }),
|
|
11
12
|
react_1.default.createElement("h2", { className: "InfoBlock__title" }, title),
|
|
12
13
|
subtitle && react_1.default.createElement("div", { className: "InfoBlock__subtitle" }, subtitle),
|
|
13
14
|
react_1.default.createElement("ul", { className: "InfoBlock__items" }, items.map((item, i) => (react_1.default.createElement("li", { key: i, className: "InfoBlock__item" }, item)))),
|
package/InfoHero.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ButtonProps } from './_abstract/_Button.js';
|
|
2
2
|
import { ImageProps } from './_abstract/_Image.js';
|
|
3
3
|
import { Alignment } from './constants.js';
|
|
4
|
+
import { WrapperElmProps } from './utils.js';
|
|
4
5
|
type BlingOptions = 'waves' | 'sunny-waves' | 'triangles' | 'circles';
|
|
5
6
|
export type InfoHeroProps = {
|
|
6
7
|
title: string;
|
|
@@ -13,6 +14,6 @@ export type InfoHeroProps = {
|
|
|
13
14
|
align?: Alignment;
|
|
14
15
|
image?: ImageProps;
|
|
15
16
|
blingType?: BlingOptions;
|
|
16
|
-
};
|
|
17
|
+
} & WrapperElmProps;
|
|
17
18
|
export declare const InfoHero: (props: InfoHeroProps) => JSX.Element;
|
|
18
19
|
export default InfoHero;
|
package/InfoHero.js
CHANGED
|
@@ -68,12 +68,12 @@ const blingOptions = {
|
|
|
68
68
|
],
|
|
69
69
|
};
|
|
70
70
|
const InfoHero = (props) => {
|
|
71
|
-
const { title, titleBlurb, subTitle, blurb, image, buttons = [], footer, align, blingType, } = props;
|
|
71
|
+
const { title, titleBlurb, subTitle, blurb, image, buttons = [], footer, align, blingType, wrapperProps, } = props;
|
|
72
72
|
const showButtons = Boolean(buttons.length);
|
|
73
73
|
const alignment = align && constants_js_1.aligns[align] ? align : 'right';
|
|
74
74
|
const blings = (blingType && blingOptions[blingType]) ||
|
|
75
75
|
blingOptions.waves; // default to `waves`
|
|
76
|
-
return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('InfoHero', 'align--' + alignment) },
|
|
76
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('InfoHero', 'align--' + alignment, (wrapperProps || {}).className) }),
|
|
77
77
|
react_1.default.createElement("div", { className: "InfoHero__content" },
|
|
78
78
|
react_1.default.createElement("h1", { className: "InfoHero__title" }, title),
|
|
79
79
|
titleBlurb && react_1.default.createElement("div", { className: "InfoHero__titleblurb" }, titleBlurb),
|
|
@@ -81,7 +81,7 @@ const InfoHero = (props) => {
|
|
|
81
81
|
blurb && react_1.default.createElement("div", { className: "InfoHero__blurb" }, blurb),
|
|
82
82
|
showButtons && (react_1.default.createElement("div", { className: "InfoHero__buttons" }, buttons.map((buttonProps, i) => (react_1.default.createElement(ButtonTertiary_js_1.default, Object.assign({ key: i }, buttonProps)))))),
|
|
83
83
|
footer && react_1.default.createElement("div", { className: "InfoHero__footer" }, footer)),
|
|
84
|
-
react_1.default.createElement(_Image_js_1.Image, Object.assign({
|
|
84
|
+
react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "InfoHero__image", altText: title }, image, { placeholder: true })),
|
|
85
85
|
react_1.default.createElement(_Blings_js_1.Blings, { blings: blings, mirror: alignment === 'right' })));
|
|
86
86
|
};
|
|
87
87
|
exports.InfoHero = InfoHero;
|
package/IslandBlock.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BlockItem } from './_abstract/_Block.js';
|
|
|
3
3
|
import { ImageProps } from './_abstract/_Image.js';
|
|
4
4
|
import { SeenProp } from './utils/seenEffect.js';
|
|
5
5
|
import { Alignment } from './constants.js';
|
|
6
|
+
import { WrapperElmProps } from './utils.js';
|
|
6
7
|
type IslandBaseBlockProps = {
|
|
7
8
|
align?: Alignment;
|
|
8
9
|
};
|
|
@@ -20,6 +21,6 @@ type IslandContentBlocks = {
|
|
|
20
21
|
shapes?: undefined;
|
|
21
22
|
image?: undefined;
|
|
22
23
|
};
|
|
23
|
-
export type IslandBlockProps = IslandBaseBlockProps & (IslandContentBlocks | IslandImageBlock) & SeenProp;
|
|
24
|
+
export type IslandBlockProps = IslandBaseBlockProps & (IslandContentBlocks | IslandImageBlock) & WrapperElmProps & SeenProp;
|
|
24
25
|
export declare const IslandBlock: (props: IslandBlockProps) => JSX.Element;
|
|
25
26
|
export default IslandBlock;
|
package/IslandBlock.js
CHANGED
|
@@ -7,7 +7,7 @@ const assets_1 = require("@reykjavik/hanna-utils/assets");
|
|
|
7
7
|
const _Block_js_1 = require("./_abstract/_Block.js");
|
|
8
8
|
const constants_js_1 = require("./constants.js");
|
|
9
9
|
const IslandBlock = (props) => {
|
|
10
|
-
const { align, content, shapes, image, startSeen } = props;
|
|
10
|
+
const { align, content, shapes, image, startSeen, wrapperProps } = props;
|
|
11
11
|
const alignment = align && constants_js_1.aligns[align] ? align : 'right';
|
|
12
12
|
const blockProps = Array.isArray(content)
|
|
13
13
|
? { content }
|
|
@@ -15,7 +15,7 @@ const IslandBlock = (props) => {
|
|
|
15
15
|
content,
|
|
16
16
|
image: shapes ? { src: (0, assets_1.getFormheimurUrl)(shapes), inline: true } : image || {},
|
|
17
17
|
};
|
|
18
|
-
return (react_1.default.createElement(_Block_js_1.Block, Object.assign({ bem: "IslandBlock", modifier: 'align--' + alignment }, blockProps, { startSeen: startSeen })));
|
|
18
|
+
return (react_1.default.createElement(_Block_js_1.Block, Object.assign({ wrapperProps: wrapperProps, bem: "IslandBlock", modifier: 'align--' + alignment }, blockProps, { startSeen: startSeen })));
|
|
19
19
|
};
|
|
20
20
|
exports.IslandBlock = IslandBlock;
|
|
21
21
|
exports.default = exports.IslandBlock;
|
package/IslandPageBlock.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BlockItem } from './_abstract/_Block.js';
|
|
|
3
3
|
import { ImageProps } from './_abstract/_Image.js';
|
|
4
4
|
import { SeenProp } from './utils/seenEffect.js';
|
|
5
5
|
import { Alignment } from './constants.js';
|
|
6
|
+
import { WrapperElmProps } from './utils.js';
|
|
6
7
|
declare const backgrounds: {
|
|
7
8
|
none: undefined;
|
|
8
9
|
gray: string;
|
|
@@ -19,6 +20,6 @@ type IslandPageImageProps = {
|
|
|
19
20
|
export type IslandPageBlockProps = BlockItem & IslandPageImageProps & {
|
|
20
21
|
align?: Alignment;
|
|
21
22
|
background?: Background;
|
|
22
|
-
} & SeenProp;
|
|
23
|
+
} & WrapperElmProps & SeenProp;
|
|
23
24
|
export declare const IslandPageBlock: (props: IslandPageBlockProps) => JSX.Element;
|
|
24
25
|
export default IslandPageBlock;
|
package/IslandPageBlock.js
CHANGED
|
@@ -12,10 +12,10 @@ const backgrounds = {
|
|
|
12
12
|
secondary: 'secondary',
|
|
13
13
|
};
|
|
14
14
|
const IslandPageBlock = (props) => {
|
|
15
|
-
const { title, summary, buttons, illustration, image, align, background, startSeen } = props;
|
|
15
|
+
const { title, summary, buttons, illustration, image, align, background, startSeen, wrapperProps, } = props;
|
|
16
16
|
const alignment = align && constants_js_1.aligns[align] ? align : 'right';
|
|
17
17
|
const bg = backgrounds[background || 'none'];
|
|
18
|
-
return (react_1.default.createElement(_Block_js_1.Block, { bem: "IslandPageBlock", modifier: ['align--' + alignment, bg && 'background--' + bg], content: { title, summary, buttons }, image: illustration ? { src: (0, assets_1.getIllustrationUrl)(illustration) } : image || {}, startSeen: startSeen }));
|
|
18
|
+
return (react_1.default.createElement(_Block_js_1.Block, { wrapperProps: wrapperProps, bem: "IslandPageBlock", modifier: ['align--' + alignment, bg && 'background--' + bg], content: { title, summary, buttons }, image: illustration ? { src: (0, assets_1.getIllustrationUrl)(illustration) } : image || {}, startSeen: startSeen }));
|
|
19
19
|
};
|
|
20
20
|
exports.IslandPageBlock = IslandPageBlock;
|
|
21
21
|
exports.default = exports.IslandPageBlock;
|
package/LabeledTextBlock.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ButtonProps } from './_abstract/_Button.js';
|
|
3
3
|
import { SeenProp } from './utils/seenEffect.js';
|
|
4
|
+
import { WrapperElmProps } from './utils.js';
|
|
4
5
|
export type LabeledTextBlockProps = {
|
|
5
6
|
label: string;
|
|
6
7
|
summary: string | ReactElement;
|
|
7
8
|
wide?: boolean;
|
|
8
9
|
buttons?: Array<ButtonProps>;
|
|
9
|
-
} & SeenProp;
|
|
10
|
+
} & WrapperElmProps & SeenProp;
|
|
10
11
|
export declare const LabeledTextBlock: (props: LabeledTextBlockProps) => JSX.Element;
|
|
11
12
|
export default LabeledTextBlock;
|
package/LabeledTextBlock.js
CHANGED
|
@@ -7,9 +7,9 @@ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
|
7
7
|
const seenEffect_js_1 = require("./utils/seenEffect.js");
|
|
8
8
|
const ButtonTertiary_js_1 = tslib_1.__importDefault(require("./ButtonTertiary.js"));
|
|
9
9
|
const LabeledTextBlock = (props) => {
|
|
10
|
-
const { label, summary, wide, buttons = [], startSeen } = props;
|
|
10
|
+
const { label, summary, wide, buttons = [], startSeen, wrapperProps } = props;
|
|
11
11
|
const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
12
|
-
return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('LabeledTextBlock', wide && 'wide'), ref: ref },
|
|
12
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('LabeledTextBlock', wide && 'wide', (wrapperProps || {}).className), ref: ref }),
|
|
13
13
|
react_1.default.createElement("h2", { className: "LabeledTextBlock__label" }, label),
|
|
14
14
|
react_1.default.createElement("div", { className: "LabeledTextBlock__summary" },
|
|
15
15
|
summary,
|
package/Layout.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { HannaColorTheme } from '@reykjavik/hanna-css';
|
|
|
3
3
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
4
4
|
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
5
5
|
import { BemModifierProps } from './utils/types.js';
|
|
6
|
-
import { SSRSupportProps } from './utils.js';
|
|
6
|
+
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
7
7
|
export type LayoutI18n = {
|
|
8
8
|
lang?: string;
|
|
9
9
|
skipLinkLabel: string;
|
|
@@ -20,7 +20,7 @@ type LayoutProps = {
|
|
|
20
20
|
siteName?: string;
|
|
21
21
|
texts?: LayoutI18n;
|
|
22
22
|
lang?: string;
|
|
23
|
-
} & SSRSupportProps & BemModifierProps & EitherObj<{
|
|
23
|
+
} & SSRSupportProps & WrapperElmProps & BemModifierProps & EitherObj<{
|
|
24
24
|
mainChildren: ReactNode;
|
|
25
25
|
}, {
|
|
26
26
|
children: ReactNode;
|
package/Layout.js
CHANGED
|
@@ -31,16 +31,16 @@ exports.defaultLayoutTexts = {
|
|
|
31
31
|
};
|
|
32
32
|
const Layout = (props) => {
|
|
33
33
|
(0, utils_js_1.useScrollbarWidthCSSVar)();
|
|
34
|
-
const { ssr, globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName = '', logoLink = '/', } = props;
|
|
34
|
+
const { ssr, globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName = '', logoLink = '/', wrapperProps, } = props;
|
|
35
35
|
const { isMenuActive, uiState, closeMenu, toggleMenu } = (0, utils_js_1.useMenuToggling)(ssr !== 'ssr-only');
|
|
36
36
|
const txt = (0, i18n_1.getTexts)(props, exports.defaultLayoutTexts);
|
|
37
|
-
return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('Layout', props.modifier), "data-color-theme": colorTheme },
|
|
37
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('Layout', props.modifier, (wrapperProps || {}).className), "data-color-theme": colorTheme }),
|
|
38
38
|
globalAlerts && (react_1.default.createElement("div", { className: "Layout__alerts", role: "alert" }, globalAlerts)),
|
|
39
39
|
react_1.default.createElement("div", { className: "Layout__content" },
|
|
40
40
|
react_1.default.createElement("div", { className: "Layout__header", role: "banner" },
|
|
41
41
|
react_1.default.createElement(_Link_js_1.Link, { className: "Layout__header__logo", href: logoLink },
|
|
42
42
|
' ',
|
|
43
|
-
react_1.default.createElement(_Image_js_1.Image, {
|
|
43
|
+
react_1.default.createElement(_Image_js_1.Image, { bem: undefined, inline: true, src: (0, assets_1.getAssetUrl)('reykjavik-logo.svg'), altText: "Reykjav\u00EDk" }),
|
|
44
44
|
' ',
|
|
45
45
|
siteName,
|
|
46
46
|
' '),
|
package/MainMenu.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Cleanup } from '@reykjavik/hanna-utils';
|
|
|
3
3
|
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
4
4
|
import { AuxilaryPanelIllustration, AuxiliaryPanelProps } from './MainMenu/_Auxiliary.js';
|
|
5
5
|
import { MegaMenuItem, MegaMenuPanel, PrimaryPanelI18n } from './MainMenu/_PrimaryPanel.js';
|
|
6
|
-
import { SSRSupportProps } from './utils.js';
|
|
6
|
+
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
7
7
|
export type MainMenuI18n = Cleanup<{
|
|
8
8
|
lang?: string;
|
|
9
9
|
homeLabel?: string;
|
|
@@ -63,6 +63,6 @@ export type MainMenuProps = {
|
|
|
63
63
|
activePanelId?: string;
|
|
64
64
|
texts?: MainMenuI18n;
|
|
65
65
|
lang?: string;
|
|
66
|
-
} & SSRSupportProps
|
|
66
|
+
} & SSRSupportProps & WrapperElmProps<null, 'aria-label'>;
|
|
67
67
|
export declare const MainMenu: (props: MainMenuProps) => JSX.Element | null;
|
|
68
68
|
export default MainMenu;
|
package/MainMenu.js
CHANGED
|
@@ -89,12 +89,13 @@ const normalizeMenuItems = (itemsProp, megaPanels, homeLink, texts) => {
|
|
|
89
89
|
// ---------------------------------------------------------------------------
|
|
90
90
|
const emptyPanelList = [];
|
|
91
91
|
const MainMenu = (props) => {
|
|
92
|
-
const { megaPanels = emptyPanelList, onItemClick, ssr, auxiliaryPanel } = props;
|
|
92
|
+
const { megaPanels = emptyPanelList, onItemClick, ssr, auxiliaryPanel, wrapperProps = {}, } = props;
|
|
93
93
|
const texts = (0, i18n_1.getTexts)(props, exports.defaultMainMenuTexts);
|
|
94
94
|
const title = props.title || texts.title;
|
|
95
95
|
const { closeHamburgerMenu } = (0, HannaUIState_js_1.useHannaUIState)();
|
|
96
96
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
|
97
|
-
const
|
|
97
|
+
const _menuElmRef = (0, react_1.useRef)(null);
|
|
98
|
+
const menuElmRef = wrapperProps.ref || _menuElmRef;
|
|
98
99
|
const pressedLinkRef = (0, react_1.useRef)(null);
|
|
99
100
|
const activePanelRef = (0, react_1.useRef)(null);
|
|
100
101
|
const [activePanel, _setActivePanel] = (0, react_1.useState)(() => isBrowser && findActivePanel(megaPanels, props.activePanelId));
|
|
@@ -184,7 +185,7 @@ const MainMenu = (props) => {
|
|
|
184
185
|
closeHamburgerMenu();
|
|
185
186
|
}
|
|
186
187
|
};
|
|
187
|
-
return (react_1.default.createElement("nav", { className:
|
|
188
|
+
return (react_1.default.createElement("nav", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('MainMenu', null, wrapperProps.className), "aria-label": title, "data-sprinkled": isBrowser, ref: menuElmRef }),
|
|
188
189
|
react_1.default.createElement("h2", { className: "MainMenu__title" }, title),
|
|
189
190
|
react_1.default.createElement("ul", { className: "MainMenu__items" }, menuItems.map((item, i) => {
|
|
190
191
|
if (item === '---') {
|
package/MiniMetrics.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ButtonProps } from './_abstract/_Button.js';
|
|
2
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
import { WrapperElmProps } from './utils.js';
|
|
3
4
|
export type MiniMetricsProps = {
|
|
4
5
|
text: string;
|
|
5
6
|
moreButton: ButtonProps;
|
|
6
|
-
} & SeenProp;
|
|
7
|
+
} & WrapperElmProps & SeenProp;
|
|
7
8
|
export declare const MiniMetrics: (props: MiniMetricsProps) => JSX.Element;
|
|
8
9
|
export default MiniMetrics;
|
package/MiniMetrics.js
CHANGED
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MiniMetrics = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
6
7
|
const _Button_js_1 = require("./_abstract/_Button.js");
|
|
7
8
|
const SeenEffect_js_1 = tslib_1.__importDefault(require("./SeenEffect.js"));
|
|
8
9
|
const MiniMetrics = (props) => {
|
|
9
|
-
const { text, moreButton, startSeen } = props;
|
|
10
|
-
return (react_1.default.createElement(SeenEffect_js_1.default, { className:
|
|
10
|
+
const { text, moreButton, startSeen, wrapperProps } = props;
|
|
11
|
+
return (react_1.default.createElement(SeenEffect_js_1.default, Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('MiniMetrics', null, (wrapperProps || {}).className), startSeen: startSeen }),
|
|
11
12
|
react_1.default.createElement("strong", { className: "MiniMetrics__text" }, text),
|
|
12
13
|
" ",
|
|
13
14
|
'\n',
|
package/Modal.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ModalProps as _ModalProps } from '@hugsmidjan/react/Modal';
|
|
3
|
+
import { MissingWrapperElmProps } from './utils.js';
|
|
3
4
|
export type ModalProps = Omit<_ModalProps, 'bem' | 'bodyWrap' | 'modifier'> & {
|
|
4
5
|
modifier?: 'w6' | 'w8' | 'w10';
|
|
5
6
|
bling?: ReactElement;
|
|
6
|
-
};
|
|
7
|
+
} & MissingWrapperElmProps;
|
|
7
8
|
export declare const Modal: (props: ModalProps) => JSX.Element;
|
|
8
9
|
export default Modal;
|
package/Multiselect.d.ts
CHANGED
|
@@ -28,14 +28,18 @@ export type MultiselectProps = TogglerGroupFieldProps<string> & {
|
|
|
28
28
|
* even when the total options are fewer than
|
|
29
29
|
* `Multiselect.meta.summaryLimit`.
|
|
30
30
|
*
|
|
31
|
-
* NOTE: Using this option is generally not recommended
|
|
31
|
+
* NOTE: Using this option is generally not recommended,
|
|
32
|
+
* because the search UI (i.e. the on-screen keyboard), takes up a lot of
|
|
33
|
+
* space on mobile devices.
|
|
32
34
|
*/
|
|
33
35
|
forceSummary?: boolean;
|
|
34
36
|
/**
|
|
35
37
|
* Force the options to be searchable, even when they're
|
|
36
38
|
* fewer than `Multiselect.meta.searchableLimit`.
|
|
37
39
|
*
|
|
38
|
-
* NOTE: Using this option is generally not recommended
|
|
40
|
+
* NOTE: Using this option is generally not recommended,
|
|
41
|
+
* because the summary takes up valuable space when there are only a few
|
|
42
|
+
* items.
|
|
39
43
|
*/
|
|
40
44
|
forceSearchable?: boolean;
|
|
41
45
|
texts?: MultiselectI18n;
|
|
@@ -49,16 +53,17 @@ export declare const Multiselect: {
|
|
|
49
53
|
/**
|
|
50
54
|
* The item-count where the list becomes searchable.
|
|
51
55
|
*
|
|
52
|
-
* (The search UI
|
|
56
|
+
* (The search UI (on-screen keyboard), takes up a lot of space
|
|
53
57
|
* on mobile devices, so there's a balance that we want to strike.)
|
|
54
58
|
*/
|
|
55
|
-
searchableLimit: number;
|
|
59
|
+
readonly searchableLimit: number;
|
|
56
60
|
/**
|
|
57
61
|
* The item-count above which we display a summary of "current" values
|
|
58
62
|
* at the top of the drop-down list.
|
|
59
63
|
*
|
|
60
|
-
* (
|
|
64
|
+
* (The summary is pointless and takes up valuable space,
|
|
65
|
+
* when there are only a few items.)
|
|
61
66
|
*/
|
|
62
|
-
summaryLimit: number;
|
|
67
|
+
readonly summaryLimit: number;
|
|
63
68
|
};
|
|
64
69
|
};
|
package/Multiselect.js
CHANGED
|
@@ -11,14 +11,14 @@ const i18n_1 = require("@reykjavik/hanna-utils/i18n");
|
|
|
11
11
|
const _FocusTrap_js_1 = require("./_abstract/_FocusTrap.js");
|
|
12
12
|
const _Multiselect_search_js_1 = require("./Multiselect/_Multiselect.search.js");
|
|
13
13
|
const Checkbox_js_1 = tslib_1.__importDefault(require("./Checkbox.js"));
|
|
14
|
-
const FormField_js_1 = tslib_1.
|
|
14
|
+
const FormField_js_1 = tslib_1.__importStar(require("./FormField.js"));
|
|
15
15
|
const TagPill_js_1 = tslib_1.__importDefault(require("./TagPill.js"));
|
|
16
16
|
const utils_js_1 = require("./utils.js");
|
|
17
17
|
const metaData = {
|
|
18
18
|
/**
|
|
19
19
|
* The item-count where the list becomes searchable.
|
|
20
20
|
*
|
|
21
|
-
* (The search UI
|
|
21
|
+
* (The search UI (on-screen keyboard), takes up a lot of space
|
|
22
22
|
* on mobile devices, so there's a balance that we want to strike.)
|
|
23
23
|
*/
|
|
24
24
|
searchableLimit: 20,
|
|
@@ -26,10 +26,14 @@ const metaData = {
|
|
|
26
26
|
* The item-count above which we display a summary of "current" values
|
|
27
27
|
* at the top of the drop-down list.
|
|
28
28
|
*
|
|
29
|
-
* (
|
|
29
|
+
* (The summary is pointless and takes up valuable space,
|
|
30
|
+
* when there are only a few items.)
|
|
30
31
|
*/
|
|
32
|
+
// NOTE: First we tried 10, which felt way too low, now we're trying 20.
|
|
33
|
+
// Maybe the "sweet-spot" is closer to 15 ? — We'll see.
|
|
31
34
|
summaryLimit: 20,
|
|
32
35
|
};
|
|
36
|
+
// Extract the values up front, to prevent runtime changes of these values.
|
|
33
37
|
const { searchableLimit, summaryLimit } = metaData;
|
|
34
38
|
const defaultTexts = {
|
|
35
39
|
pl: {
|
|
@@ -65,7 +69,7 @@ const Multiselect = (props) => {
|
|
|
65
69
|
const placeholderText = !values.length ? props.placeholder : undefined;
|
|
66
70
|
const texts = (0, i18n_1.getTexts)(props, defaultTexts);
|
|
67
71
|
const inputRef = (0, react_1.useRef)(null);
|
|
68
|
-
const
|
|
72
|
+
const inputWrapperRef = (0, react_1.useRef)(null);
|
|
69
73
|
const [activeItemIndex, setActiveItemIndex] = (0, react_1.useState)(-1);
|
|
70
74
|
const [searchQuery, setSearchQuery] = (0, react_1.useState)('');
|
|
71
75
|
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
@@ -73,14 +77,14 @@ const Multiselect = (props) => {
|
|
|
73
77
|
setIsOpen((isOpen) => {
|
|
74
78
|
newIsOpen = typeof newIsOpen === 'boolean' ? newIsOpen : !isOpen;
|
|
75
79
|
if (!newIsOpen) {
|
|
76
|
-
|
|
80
|
+
inputWrapperRef.current.querySelector('.Multiselect__choices').scrollTo(0, 0);
|
|
77
81
|
setSearchQuery('');
|
|
78
82
|
setActiveItemIndex(-1);
|
|
79
83
|
}
|
|
80
84
|
return newIsOpen;
|
|
81
85
|
});
|
|
82
86
|
};
|
|
83
|
-
(0, hooks_1.useOnClickOutside)(
|
|
87
|
+
(0, hooks_1.useOnClickOutside)(inputWrapperRef, () => toggleOpen(false));
|
|
84
88
|
const options = (0, react_1.useMemo)(() => _options.map((item) => (typeof item === 'string' ? { value: item } : item)), [_options]);
|
|
85
89
|
const isSearchable = props.forceSearchable || options.length >= searchableLimit;
|
|
86
90
|
/*
|
|
@@ -168,7 +172,7 @@ const Multiselect = (props) => {
|
|
|
168
172
|
}, [activeItemIndex, filteredOptions, isOpen, handleCheckboxSelection, inputRef]);
|
|
169
173
|
// Auto-close the dropdown when focus has left the building
|
|
170
174
|
(0, react_1.useEffect)(() => {
|
|
171
|
-
const wrapperDiv =
|
|
175
|
+
const wrapperDiv = inputWrapperRef.current;
|
|
172
176
|
if (!wrapperDiv) {
|
|
173
177
|
return;
|
|
174
178
|
}
|
|
@@ -186,14 +190,14 @@ const Multiselect = (props) => {
|
|
|
186
190
|
}, []);
|
|
187
191
|
(0, react_1.useEffect)(() => {
|
|
188
192
|
var _a, _b;
|
|
189
|
-
(_b = (_a =
|
|
193
|
+
(_b = (_a = inputWrapperRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.Multiselect__option')[activeItemIndex]) === null || _b === void 0 ? void 0 : _b.scrollIntoView({
|
|
190
194
|
behavior: 'smooth',
|
|
191
195
|
block: 'nearest',
|
|
192
196
|
});
|
|
193
197
|
}, [activeItemIndex]);
|
|
194
|
-
return (react_1.default.createElement(FormField_js_1.default, {
|
|
198
|
+
return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: (0, classUtils_1.modifiedClass)('Multiselect', props.nowrap && 'nowrap'), group: "inputlike", filled: filled, empty: empty }, (0, FormField_js_1.getFormFieldWrapperProps)(props), { renderInput: (className, inputProps, addFocusProps, isBrowser) => {
|
|
195
199
|
const { id } = inputProps;
|
|
196
|
-
return (react_1.default.createElement("div", Object.assign({ className: (0, classUtils_1.modifiedClass)('Multiselect__input', [isOpen && 'open'], className.input) }, addFocusProps(), { "data-sprinkled": isBrowser, ref:
|
|
200
|
+
return (react_1.default.createElement("div", Object.assign({ className: (0, classUtils_1.modifiedClass)('Multiselect__input', [isOpen && 'open'], className.input) }, addFocusProps(), { "data-sprinkled": isBrowser, ref: inputWrapperRef }),
|
|
197
201
|
!isBrowser ? null : isSearchable ? (react_1.default.createElement("input", { className: "Multiselect__search", id: `toggler:${id}`, "aria-label": texts.search, "aria-controls": (0, domid_1.default)(), "data-expanded": isOpen || undefined, onChange: handleInputChange, onKeyDown: handleInputKeyDown, onClick: () => toggleOpen(), value: searchQuery,
|
|
198
202
|
// onFocus={handleInputFocus}
|
|
199
203
|
placeholder: placeholderText, disabled: disabled, ref: inputRef })) : (react_1.default.createElement("button", { className: "Multiselect__toggler", id: `toggler:${id}`, type: "button", "aria-label": texts.buttonShow, "aria-controls": (0, domid_1.default)(), "aria-expanded": isOpen, onClick: () => toggleOpen(), disabled: disabled,
|
|
@@ -229,7 +233,7 @@ const Multiselect = (props) => {
|
|
|
229
233
|
} })));
|
|
230
234
|
})) : searchQuery ? (react_1.default.createElement("li", { className: "Multiselect__noresults" }, texts.noneFoundMsg)) : undefined,
|
|
231
235
|
react_1.default.createElement(_FocusTrap_js_1.FocusTrap, { Tag: "li" })))));
|
|
232
|
-
} }));
|
|
236
|
+
} })));
|
|
233
237
|
};
|
|
234
238
|
exports.Multiselect = Multiselect;
|
|
235
239
|
/** Configuration constants for the Multiselect components */
|