@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/ContactBubble.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContactBubble = exports.ensureIcon = exports.defaultTexts = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
6
7
|
const focusElm_1 = require("@hugsmidjan/qj/focusElm");
|
|
7
8
|
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
8
|
-
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
9
9
|
const i18n_1 = require("@reykjavik/hanna-utils/i18n");
|
|
10
10
|
const _Link_js_1 = require("./_abstract/_Link.js");
|
|
11
11
|
const breakOnNL_js_1 = require("./_abstract/breakOnNL.js");
|
|
@@ -37,14 +37,15 @@ const ensureIcon = (maybeIcon) => maybeIcon && icons[maybeIcon]
|
|
|
37
37
|
: undefined;
|
|
38
38
|
exports.ensureIcon = ensureIcon;
|
|
39
39
|
const ContactBubble = (props) => {
|
|
40
|
-
const { title, links, onToggle, alwaysShow } = props;
|
|
40
|
+
const { title, links, onToggle, alwaysShow, wrapperProps = {} } = props;
|
|
41
41
|
const txt = (0, i18n_1.getTexts)(props, exports.defaultTexts);
|
|
42
42
|
const useLocalState = props.open == null;
|
|
43
43
|
const [localOpen, setLocalOpen] = (0, react_1.useState)(false);
|
|
44
44
|
const open = useLocalState ? localOpen : props.open;
|
|
45
45
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(props.ssr);
|
|
46
46
|
const domid = (0, hooks_1.useDomid)();
|
|
47
|
-
const
|
|
47
|
+
const _wrapperRef = (0, react_1.useRef)(null);
|
|
48
|
+
const wrapperRef = wrapperProps.ref || _wrapperRef;
|
|
48
49
|
const { openBubble, closeBubble } = (0, react_1.useMemo)(() => ({
|
|
49
50
|
openBubble: () => {
|
|
50
51
|
useLocalState && setLocalOpen(true);
|
|
@@ -121,7 +122,7 @@ const ContactBubble = (props) => {
|
|
|
121
122
|
if (links.length === 0) {
|
|
122
123
|
return null;
|
|
123
124
|
}
|
|
124
|
-
const menu = (react_1.default.createElement("div", { className:
|
|
125
|
+
const menu = (react_1.default.createElement("div", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('ContactBubble', null, wrapperProps.className), id: isBrowser && domid, hidden: isBrowser && !open, "data-always-show": alwaysShow || undefined, "data-sprinkled": isBrowser }),
|
|
125
126
|
react_1.default.createElement("h2", { className: "ContactBubble__title" }, title || txt.openBtn),
|
|
126
127
|
react_1.default.createElement("ul", { className: "ContactBubble__list" }, links.map((linkInfo, i) => {
|
|
127
128
|
const { href, label, extraLabel, target, onClick } = linkInfo;
|
package/ContentArticle.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { SeenProp } from './utils/seenEffect.js';
|
|
|
3
3
|
import { ArticleMetaProps } from './ArticleMeta.js';
|
|
4
4
|
import { ContentImageProps } from './ContentImage.js';
|
|
5
5
|
import { RelatedLinksProps } from './RelatedLinks.js';
|
|
6
|
+
import { WrapperElmProps } from './utils.js';
|
|
6
7
|
export type ContentArticleProps = {
|
|
7
8
|
/** Date, author, etc. */
|
|
8
9
|
meta?: ArticleMetaProps['items'];
|
|
@@ -11,6 +12,6 @@ export type ContentArticleProps = {
|
|
|
11
12
|
topImage?: ContentImageProps;
|
|
12
13
|
body: ReactNode;
|
|
13
14
|
relatedLinks?: RelatedLinksProps;
|
|
14
|
-
} & SeenProp;
|
|
15
|
+
} & SeenProp & WrapperElmProps;
|
|
15
16
|
export declare const ContentArticle: (props: ContentArticleProps) => JSX.Element;
|
|
16
17
|
export default ContentArticle;
|
package/ContentArticle.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContentArticle = 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 ArticleMeta_js_1 = tslib_1.__importDefault(require("./ArticleMeta.js"));
|
|
8
9
|
const ContentImage_js_1 = tslib_1.__importDefault(require("./ContentImage.js"));
|
|
@@ -11,10 +12,10 @@ const RelatedLinks_js_1 = tslib_1.__importDefault(require("./RelatedLinks.js"));
|
|
|
11
12
|
const TextBlock_js_1 = tslib_1.__importDefault(require("./TextBlock.js"));
|
|
12
13
|
const VSpacer_js_1 = tslib_1.__importDefault(require("./VSpacer.js"));
|
|
13
14
|
const ContentArticle = (props) => {
|
|
14
|
-
const { relatedLinks } = props;
|
|
15
|
+
const { relatedLinks, wrapperProps } = props;
|
|
15
16
|
const [ref] = (0, seenEffect_js_1.useSeenEffect)(props.startSeen);
|
|
16
17
|
const headingElm = (react_1.default.createElement(Heading_js_1.default, { forceH1: props.headlineTag === 'h1' }, props.headline));
|
|
17
|
-
return (react_1.default.createElement("div", { className:
|
|
18
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('ContentArticle', null, (wrapperProps || {}).className), ref: ref }),
|
|
18
19
|
props.meta ? (react_1.default.createElement("div", { className: "ContentArticle__header" },
|
|
19
20
|
headingElm,
|
|
20
21
|
react_1.default.createElement(ArticleMeta_js_1.default, { items: props.meta }))) : (headingElm),
|
package/ContentImage.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ImageProps } from './_abstract/_Image.js';
|
|
2
|
+
import { WrapperElmProps } from './utils.js';
|
|
2
3
|
export type ContentImageProps = {
|
|
3
4
|
image?: ImageProps;
|
|
4
5
|
caption?: string | JSX.Element;
|
|
5
6
|
credit?: string | JSX.Element;
|
|
6
|
-
};
|
|
7
|
+
} & WrapperElmProps;
|
|
7
8
|
export declare const ContentImage: (props: ContentImageProps) => JSX.Element;
|
|
8
9
|
export default ContentImage;
|
package/ContentImage.js
CHANGED
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContentImage = 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 _Image_js_1 = require("./_abstract/_Image.js");
|
|
7
8
|
const ContentImage = (props) => {
|
|
8
|
-
const { image, caption, credit } = props;
|
|
9
|
-
return (react_1.default.createElement("figure", { className:
|
|
9
|
+
const { image, caption, credit, wrapperProps } = props;
|
|
10
|
+
return (react_1.default.createElement("figure", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('ContentImage', null, (wrapperProps || {}).className) }),
|
|
10
11
|
(caption || credit) && (react_1.default.createElement("figcaption", { className: "ContentImage__caption" },
|
|
11
12
|
caption && react_1.default.createElement("span", { className: "ContentImage__text" },
|
|
12
13
|
" ",
|
|
@@ -17,7 +18,7 @@ const ContentImage = (props) => {
|
|
|
17
18
|
" ",
|
|
18
19
|
credit,
|
|
19
20
|
" "))),
|
|
20
|
-
react_1.default.createElement(_Image_js_1.Image, Object.assign({
|
|
21
|
+
react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "ContentImage__image" }, image))));
|
|
21
22
|
};
|
|
22
23
|
exports.ContentImage = ContentImage;
|
|
23
24
|
exports.default = exports.ContentImage;
|
package/Datepicker.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.Datepicker = exports.getDateDiff = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
7
|
-
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
8
7
|
// For more info on localization see: https://stackoverflow.com/questions/54399084/change-locale-in-react-datepicker/58306958#58306958
|
|
9
8
|
const index_js_1 = tslib_1.__importDefault(require("date-fns/locale/is/index.js"));
|
|
10
9
|
const index_js_2 = tslib_1.__importDefault(require("date-fns/locale/pl/index.js"));
|
|
@@ -63,18 +62,19 @@ const i18n = {
|
|
|
63
62
|
* Internally, this component uses the [`react-datepicker`](https://reactdatepicker.com/) component.
|
|
64
63
|
*/
|
|
65
64
|
const Datepicker = (props) => {
|
|
66
|
-
const {
|
|
67
|
-
const [value, setValue] = utils_js_1.useMixedControlState.raw(props.value || props.initialDate,
|
|
65
|
+
const { placeholder, localeCode = 'is', dateFormat = 'd.M.yyyy', name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, inputRef, isoMode, fieldWrapperProps, } = (0, FormField_js_1.groupFormFieldWrapperProps)(props);
|
|
66
|
+
const [value, setValue] = utils_js_1.useMixedControlState.raw(props.value || props.initialDate, // eslint-disable-line deprecation/deprecation
|
|
67
|
+
props.defaultValue, 'value');
|
|
68
68
|
/*
|
|
69
69
|
TODO: Revert to this simpler pattern once we hit v0.11
|
|
70
70
|
and `props.initialDate` is removed:
|
|
71
71
|
*/
|
|
72
72
|
// const [value, setValue] = useMixedControlState(props, 'value');
|
|
73
|
-
const domid = (0, hooks_1.useDomid)(id);
|
|
73
|
+
const domid = (0, hooks_1.useDomid)(props.id);
|
|
74
74
|
const txts = i18n[localeCode] || {};
|
|
75
75
|
const filled = !!value;
|
|
76
76
|
const empty = !filled && !placeholder;
|
|
77
|
-
return (react_1.default.createElement(FormField_js_1.FormField, {
|
|
77
|
+
return (react_1.default.createElement(FormField_js_1.FormField, Object.assign({ extraClassName: "Datepicker", filled: filled, empty: empty }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => {
|
|
78
78
|
return (react_1.default.createElement("div", Object.assign({ className: className.input, onClick: ({ target, currentTarget }) => { var _a; return target === currentTarget && ((_a = currentTarget.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus()); }, ref: inputRef &&
|
|
79
79
|
((elm) => {
|
|
80
80
|
inputRef.current =
|
|
@@ -104,7 +104,7 @@ const Datepicker = (props) => {
|
|
|
104
104
|
// TODO: Implement this
|
|
105
105
|
// selectsRange
|
|
106
106
|
minDate: minDate, maxDate: maxDate, startDate: startDate, endDate: endDate, selectsStart: isStartDate, selectsEnd: isEndDate, formatWeekDay: (weekday) => weekday.charAt(0).toUpperCase(), showYearDropdown: true, scrollableYearDropdown: true, yearDropdownItemNumber: 15, showMonthDropdown: true }, inputProps, txts, datepickerExtraProps))));
|
|
107
|
-
} }));
|
|
107
|
+
} })));
|
|
108
108
|
};
|
|
109
109
|
exports.Datepicker = Datepicker;
|
|
110
110
|
exports.default = exports.Datepicker;
|
package/ExtraLinks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CardListProps, TextCardProps } from './_abstract/_CardList.js';
|
|
2
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
import { WrapperElmProps } from './utils.js';
|
|
3
4
|
export type RelatedLink = {
|
|
4
5
|
href: string;
|
|
5
6
|
label: string;
|
|
@@ -13,6 +14,6 @@ type RelatedProps = {
|
|
|
13
14
|
export type ExtraLinksCardProps = Omit<TextCardProps, 'meta'>;
|
|
14
15
|
export type ExtraLinksProps = CardListProps<ExtraLinksCardProps> & RelatedProps & {
|
|
15
16
|
className?: string;
|
|
16
|
-
} & SeenProp;
|
|
17
|
+
} & WrapperElmProps & SeenProp;
|
|
17
18
|
export declare const ExtraLinks: (props: ExtraLinksProps) => JSX.Element;
|
|
18
19
|
export default ExtraLinks;
|
package/ExtraLinks.js
CHANGED
|
@@ -16,10 +16,12 @@ const ExtraLinks__related = (props) => {
|
|
|
16
16
|
react_1.default.createElement(_Link_js_1.Link, { className: (0, classUtils_1.modifiedClass)('ExtraLinks__related__link', type), href: href, target: blank ? '_blank' : '', rel: blank ? 'noreferrer noopener' : '' }, label)))))));
|
|
17
17
|
};
|
|
18
18
|
const ExtraLinks = (props) => {
|
|
19
|
-
const { relatedTitle, relatedLinks, className, startSeen } = props, cardListProps = tslib_1.__rest(props, ["relatedTitle", "relatedLinks", "className", "startSeen"]);
|
|
19
|
+
const { relatedTitle, relatedLinks, className, startSeen, wrapperProps } = props, cardListProps = tslib_1.__rest(props, ["relatedTitle", "relatedLinks", "className", "startSeen", "wrapperProps"]);
|
|
20
20
|
const hasRelated = !!(relatedLinks && relatedLinks.length);
|
|
21
21
|
const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
22
|
-
return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('ExtraLinks', hasRelated && 'related',
|
|
22
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('ExtraLinks', hasRelated && 'related',
|
|
23
|
+
// Prefer `className` over `wrapperProps.className`
|
|
24
|
+
className || (wrapperProps || {}).className), ref: ref }),
|
|
23
25
|
react_1.default.createElement("div", { className: "ExtraLinks__main" },
|
|
24
26
|
react_1.default.createElement(_CardList_js_1.CardList, Object.assign({}, cardListProps, { bemPrefix: "ExtraLinks" }))),
|
|
25
27
|
hasRelated && (react_1.default.createElement(ExtraLinks__related, { relatedTitle: relatedTitle, relatedLinks: relatedLinks }))));
|
package/FeatureList.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Efnistakn } from '@reykjavik/hanna-utils/assets';
|
|
2
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
import { WrapperElmProps } from './utils.js';
|
|
3
4
|
export type FeatureListProps = {
|
|
4
5
|
title: string;
|
|
5
6
|
features: Array<{
|
|
@@ -7,6 +8,6 @@ export type FeatureListProps = {
|
|
|
7
8
|
iconUrl?: string;
|
|
8
9
|
name: string;
|
|
9
10
|
}>;
|
|
10
|
-
} & SeenProp;
|
|
11
|
+
} & WrapperElmProps & SeenProp;
|
|
11
12
|
export declare const FeatureList: (props: FeatureListProps) => JSX.Element;
|
|
12
13
|
export default FeatureList;
|
package/FeatureList.js
CHANGED
|
@@ -3,15 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FeatureList = 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 Bling_js_1 = tslib_1.__importDefault(require("./Bling.js"));
|
|
8
9
|
const FeatureList = (props) => {
|
|
9
|
-
const { title, features, startSeen } = props;
|
|
10
|
+
const { title, features, startSeen, wrapperProps } = props;
|
|
10
11
|
const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
11
12
|
const _features = features.length ? features : [{ name: '...' }];
|
|
12
13
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
13
14
|
react_1.default.createElement(Bling_js_1.default, { type: "snake-large", align: "left", vertical: "down-ish" }),
|
|
14
|
-
react_1.default.createElement("div", { className:
|
|
15
|
+
react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('FeatureList', null, (wrapperProps || {}).className), ref: ref }),
|
|
15
16
|
react_1.default.createElement("h2", { className: "FeatureList__title" }, title),
|
|
16
17
|
react_1.default.createElement("ul", { className: "FeatureList__list" }, _features.map(({ name, icon, iconUrl }, i) => (react_1.default.createElement("li", { key: i, className: "FeatureList__feature", style: iconUrl
|
|
17
18
|
? { '--efnistakn': `url("${iconUrl}")` }
|
package/FieldGroup.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { WrapperElmProps } from './utils.js';
|
|
2
3
|
export type FieldGroupProps = {
|
|
3
4
|
legend: string;
|
|
4
5
|
disabled?: boolean;
|
|
5
6
|
small?: boolean;
|
|
6
7
|
className?: string;
|
|
7
8
|
children: ReactNode;
|
|
8
|
-
}
|
|
9
|
+
} & WrapperElmProps<'fieldset'>;
|
|
9
10
|
export declare const FieldGroup: (props: FieldGroupProps) => JSX.Element;
|
|
10
11
|
export default FieldGroup;
|
package/FieldGroup.js
CHANGED
|
@@ -5,8 +5,10 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
7
|
const FieldGroup = (props) => {
|
|
8
|
-
const { legend, children, className, disabled, small } = props;
|
|
9
|
-
return (react_1.default.createElement("fieldset", { className: (0, classUtils_1.modifiedClass)('FieldGroup', small && 'small',
|
|
8
|
+
const { legend, children, className, disabled, small, wrapperProps } = props;
|
|
9
|
+
return (react_1.default.createElement("fieldset", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('FieldGroup', small && 'small',
|
|
10
|
+
// Prefer `className` over `wrapperProps.className`
|
|
11
|
+
className || (wrapperProps || {}).className), disabled: disabled }),
|
|
10
12
|
react_1.default.createElement("legend", { className: "FieldGroup__legend" }, legend),
|
|
11
13
|
children));
|
|
12
14
|
};
|
package/FileInput.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileListProps } from './FileInput/_FileInputFileList.js';
|
|
2
2
|
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
|
-
export type FileInputProps = {
|
|
3
|
+
export type FileInputProps = FormFieldWrappingProps & {
|
|
4
4
|
/**
|
|
5
5
|
* Flags if the input should accept multiple, or just a single file at a time.
|
|
6
6
|
*
|
|
@@ -43,6 +43,6 @@ export type FileInputProps = {
|
|
|
43
43
|
accept?: string;
|
|
44
44
|
multiple?: boolean;
|
|
45
45
|
};
|
|
46
|
-
}
|
|
46
|
+
};
|
|
47
47
|
export declare const FileInput: (props: FileInputProps) => JSX.Element;
|
|
48
48
|
export default FileInput;
|
package/FileInput.js
CHANGED
|
@@ -9,7 +9,7 @@ const i18n_1 = require("@reykjavik/hanna-utils/i18n");
|
|
|
9
9
|
const ReactDropzone_js_1 = require("./_mixed_export_resolution_/ReactDropzone.js");
|
|
10
10
|
const _FileInput_utils_js_1 = require("./FileInput/_FileInput.utils.js");
|
|
11
11
|
const _FileInputFileList_js_1 = require("./FileInput/_FileInputFileList.js");
|
|
12
|
-
const FormField_js_1 = tslib_1.
|
|
12
|
+
const FormField_js_1 = tslib_1.__importStar(require("./FormField.js"));
|
|
13
13
|
const defaultRemoveFileText = {
|
|
14
14
|
is: 'Fjarlægja',
|
|
15
15
|
en: 'Remove',
|
|
@@ -31,8 +31,13 @@ const arrayToFileList = (arr) => {
|
|
|
31
31
|
return fileList.files;
|
|
32
32
|
};
|
|
33
33
|
const FileInput = (props) => {
|
|
34
|
-
|
|
35
|
-
const
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
const lang = props.lang || i18n_1.DEFAULT_LANG;
|
|
36
|
+
const _d = (0, FormField_js_1.groupFormFieldWrapperProps)(props), { dropzoneProps, // eslint-disable-line deprecation/deprecation
|
|
37
|
+
multiple = (_b = (_a = props.dropzoneProps) === null || _a === void 0 ? void 0 : _a.multiple) !== null && _b !== void 0 ? _b : true, // eslint-disable-line deprecation/deprecation
|
|
38
|
+
accept = (_c = props.dropzoneProps) === null || _c === void 0 ? void 0 : _c.accept, // eslint-disable-line deprecation/deprecation
|
|
39
|
+
dropzoneText, removeFileText = defaultRemoveFileText[lang] || defaultRemoveFileText[i18n_1.DEFAULT_LANG], FileList = _FileInputFileList_js_1.DefaultFileList, onFilesUpdated = () => undefined, onFilesRejected, showFileSize, showImagePreviews, value = [], fieldWrapperProps } = _d, inputElementProps = tslib_1.__rest(_d, ["dropzoneProps", "multiple", "accept", "dropzoneText", "removeFileText", "FileList", "onFilesUpdated", "onFilesRejected", "showFileSize", "showImagePreviews", "value", "fieldWrapperProps"]);
|
|
40
|
+
const domid = (0, hooks_1.useDomid)(props.id);
|
|
36
41
|
const fileInputWrapper = (0, react_1.useRef)(null);
|
|
37
42
|
const fileInput = (0, react_1.useRef)(null);
|
|
38
43
|
const files = value;
|
|
@@ -104,7 +109,7 @@ const FileInput = (props) => {
|
|
|
104
109
|
}
|
|
105
110
|
onFilesUpdated(fileList, diff);
|
|
106
111
|
};
|
|
107
|
-
return (react_1.default.createElement(FormField_js_1.default, {
|
|
112
|
+
return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: (0, classUtils_1.modifiedClass)('FileInput', [multiple && 'multi']) }, fieldWrapperProps, { id: domid + '-fake', LabelTag: "h4", renderInput: (className, inputProps /* , addFocusProps */) => {
|
|
108
113
|
return (react_1.default.createElement("div", { className: className.control, ref: fileInputWrapper },
|
|
109
114
|
// Explicitly skip rendering of input element if no
|
|
110
115
|
// name prop is provided. This is implicitly what the
|
|
@@ -128,7 +133,7 @@ const FileInput = (props) => {
|
|
|
128
133
|
removeFile,
|
|
129
134
|
formatBytes: _FileInput_utils_js_1.formatBytes,
|
|
130
135
|
})))));
|
|
131
|
-
} }));
|
|
136
|
+
} })));
|
|
132
137
|
};
|
|
133
138
|
exports.FileInput = FileInput;
|
|
134
139
|
exports.default = exports.FileInput;
|
package/Foonote.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Footnote = void 0;
|
|
4
|
-
const
|
|
5
|
-
const Footnote_js_1 = tslib_1.__importDefault(require("./Footnote.js"));
|
|
4
|
+
const Footnote_js_1 = require("./Footnote.js");
|
|
6
5
|
/** @deprecated (Will be removed in v0.11)
|
|
7
6
|
*
|
|
8
7
|
* This module file is a typo. import from `Footnote` instead
|
|
9
8
|
*/
|
|
10
|
-
exports.Footnote = Footnote_js_1.
|
|
11
|
-
exports.default = exports.Footnote;
|
|
9
|
+
exports.Footnote = Footnote_js_1.Footnote;
|
|
10
|
+
exports.default = exports.Footnote; // eslint-disable-line deprecation/deprecation
|
package/Footnote.d.ts
CHANGED
package/Footnote.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Footnote = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
|
+
const Footnote = (props) => (react_1.default.createElement("div", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('Footnote', null, (props.wrapperProps || {}).className) }), props.children));
|
|
7
8
|
exports.Footnote = Footnote;
|
|
8
9
|
exports.default = exports.Footnote;
|
package/Form.js
CHANGED
|
@@ -4,12 +4,11 @@ exports.Form = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
|
+
// NOTE: As this component already accepts all `<form/>` props directly,
|
|
8
|
+
// it makes little sense to add support for `wrapperProps` on top.
|
|
7
9
|
const Form = (props) => {
|
|
8
|
-
const { children, align, wide } = props;
|
|
9
|
-
return (react_1.default.createElement("form", Object.assign({},
|
|
10
|
-
align === 'right' && 'align--' + align,
|
|
11
|
-
!align && wide && 'wide',
|
|
12
|
-
]) }), children));
|
|
10
|
+
const { children, align, wide, className } = props, formProps = tslib_1.__rest(props, ["children", "align", "wide", "className"]);
|
|
11
|
+
return (react_1.default.createElement("form", Object.assign({}, formProps, { className: (0, classUtils_1.modifiedClass)('Form', [align === 'right' && 'align--' + align, !align && wide && 'wide'], className) }), children));
|
|
13
12
|
};
|
|
14
13
|
exports.Form = Form;
|
|
15
14
|
exports.default = exports.Form;
|
package/FormField.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { RequireExplicitUndefined } from '@reykjavik/hanna-utils';
|
|
3
|
+
import { TogglerGroupFieldProps } from './_abstract/_TogglerGroupField.js';
|
|
4
|
+
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
3
5
|
type InputClassNames = {
|
|
4
6
|
/** Basic/raw FormField BEM name */
|
|
5
7
|
bem: string;
|
|
@@ -49,9 +51,13 @@ export type FormFieldWrappingProps = {
|
|
|
49
51
|
reqText?: string | false;
|
|
50
52
|
/** Optional pre-determinted id="" for the __input */
|
|
51
53
|
id?: string;
|
|
52
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Use `*Props.wrapperProps.ref` instead (Will be removed in v0.11)
|
|
56
|
+
*
|
|
57
|
+
* Ref object pointing to the outermost `.FormField` element
|
|
58
|
+
*/
|
|
53
59
|
wrapperRef?: RefObject<HTMLElement>;
|
|
54
|
-
} & SSRSupportProps;
|
|
60
|
+
} & WrapperElmProps & SSRSupportProps;
|
|
55
61
|
/**
|
|
56
62
|
* Mixin base props type for components using `FormField` to contain
|
|
57
63
|
* more complex multi-element, grouped choices, that require a Heading
|
|
@@ -61,8 +67,12 @@ export type FormFieldGroupWrappingProps = FormFieldWrappingProps & {
|
|
|
61
67
|
LabelTag?: 'h3' | 'h4' | 'h5';
|
|
62
68
|
};
|
|
63
69
|
type FormFieldProps = FormFieldGroupWrappingProps & {
|
|
64
|
-
/** Container className - alongside "FormField"
|
|
65
|
-
|
|
70
|
+
/** Container className - alongside "FormField" and `props.className`/
|
|
71
|
+
* `props.wrapperProps.className`. \
|
|
72
|
+
* Ideal to use if your wrapping compoent accepts its own `className`
|
|
73
|
+
* prop, so you don't have to merge/join them yourself.
|
|
74
|
+
*/
|
|
75
|
+
extraClassName?: string;
|
|
66
76
|
small?: boolean;
|
|
67
77
|
group?: boolean | 'inputlike';
|
|
68
78
|
empty?: boolean;
|
|
@@ -71,3 +81,13 @@ type FormFieldProps = FormFieldGroupWrappingProps & {
|
|
|
71
81
|
};
|
|
72
82
|
export declare const FormField: (props: FormFieldProps) => JSX.Element;
|
|
73
83
|
export default FormField;
|
|
84
|
+
export declare const getFormFieldWrapperProps: (props: (FormFieldGroupWrappingProps | Pick<TogglerGroupFieldProps, keyof FormFieldGroupWrappingProps>) & {
|
|
85
|
+
small?: boolean;
|
|
86
|
+
}) => RequireExplicitUndefined<FormFieldGroupWrappingProps> & {
|
|
87
|
+
small: boolean | undefined;
|
|
88
|
+
};
|
|
89
|
+
export declare const groupFormFieldWrapperProps: <T extends (FormFieldGroupWrappingProps | Pick<TogglerGroupFieldProps<"default">, "label" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "errorMessage" | "reqText" | "assistText" | "hideLabel" | "wrapperRef" | "LabelTag">) & {
|
|
90
|
+
small?: boolean | undefined;
|
|
91
|
+
}>(props: T) => Omit<T, "label" | "small" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "errorMessage" | "reqText" | "assistText" | "hideLabel" | "wrapperRef" | "LabelTag"> & {
|
|
92
|
+
fieldWrapperProps: ReturnType<typeof getFormFieldWrapperProps>;
|
|
93
|
+
};
|
package/FormField.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormField = void 0;
|
|
3
|
+
exports.groupFormFieldWrapperProps = exports.getFormFieldWrapperProps = exports.FormField = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
7
6
|
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
|
+
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
8
8
|
const env_js_1 = require("./utils/env.js");
|
|
9
9
|
const utils_js_1 = require("./utils.js");
|
|
10
10
|
const inputClassNames = {
|
|
@@ -16,8 +16,8 @@ const inputClassNames = {
|
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
// eslint-disable-next-line complexity
|
|
18
18
|
const FormField = (props) => {
|
|
19
|
-
const { className, small, group, LabelTag = group ? 'h4' : undefined, label, assistText, hideLabel, empty, filled, readOnly, disabled, invalid, errorMessage, required, reqText, // i18n
|
|
20
|
-
renderInput, id, ssr, } = props;
|
|
19
|
+
const { extraClassName, className, small, group, LabelTag = group ? 'h4' : undefined, label, assistText, hideLabel, empty, filled, readOnly, disabled, invalid, errorMessage, required, reqText, // TODO: i18n
|
|
20
|
+
renderInput, id, ssr, wrapperProps, } = props;
|
|
21
21
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
|
22
22
|
const isInvalid = invalid || !!errorMessage || undefined;
|
|
23
23
|
const domid = (0, hooks_1.useDomid)(id);
|
|
@@ -56,7 +56,7 @@ const FormField = (props) => {
|
|
|
56
56
|
const assistTextId = assistText ? `assist:${domid}` : undefined;
|
|
57
57
|
const labelId = LabelTag ? `label:${domid}` : undefined;
|
|
58
58
|
const reqStar = required && reqText !== false && (react_1.default.createElement("abbr", { className: "FormField__label__reqstar",
|
|
59
|
-
//
|
|
59
|
+
// FIXME: add mo-better i18n thinking
|
|
60
60
|
title: `${reqText || 'Þarf að fylla út'}: ` }, "*"));
|
|
61
61
|
const inputProps = {
|
|
62
62
|
id: domid,
|
|
@@ -67,7 +67,7 @@ const FormField = (props) => {
|
|
|
67
67
|
'aria-describedby': assistTextId && errorId ? assistTextId + ' ' + errorId : assistTextId || errorId,
|
|
68
68
|
'aria-labelledby': labelId, // undefined if normalLabel
|
|
69
69
|
};
|
|
70
|
-
return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('FormField', [
|
|
70
|
+
return (react_1.default.createElement("div", Object.assign({ ref: props.wrapperRef }, wrapperProps, { className: (0, classUtils_1.modifiedClass)('FormField', [
|
|
71
71
|
small && 'small',
|
|
72
72
|
hideLabel && 'nolabel',
|
|
73
73
|
isInvalid && 'invalid',
|
|
@@ -76,7 +76,10 @@ const FormField = (props) => {
|
|
|
76
76
|
isBrowser && empty && 'empty',
|
|
77
77
|
isBrowser && filled && 'filled',
|
|
78
78
|
isBrowser && focused && 'focused',
|
|
79
|
-
],
|
|
79
|
+
],
|
|
80
|
+
// Prefer `className` over `wrapperProps.className`
|
|
81
|
+
(className || (wrapperProps || {}).className || '') +
|
|
82
|
+
(extraClassName ? ` ${extraClassName}` : '')) }),
|
|
80
83
|
LabelTag ? (react_1.default.createElement(LabelTag, { className: "FormField__label", "data-inputlabel": group === 'inputlike' || undefined, id: labelId },
|
|
81
84
|
' ',
|
|
82
85
|
reqStar,
|
|
@@ -95,3 +98,25 @@ const FormField = (props) => {
|
|
|
95
98
|
};
|
|
96
99
|
exports.FormField = FormField;
|
|
97
100
|
exports.default = exports.FormField;
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
const getFormFieldWrapperProps = (props) => {
|
|
103
|
+
/* prettier-ignore */
|
|
104
|
+
const { wrapperProps, label, hideLabel, LabelTag, required, reqText, disabled, readOnly, assistText, invalid, errorMessage, id, small, ssr, className, wrapperRef, // eslint-disable-line deprecation/deprecation
|
|
105
|
+
} = props;
|
|
106
|
+
/* prettier-ignore */
|
|
107
|
+
return {
|
|
108
|
+
wrapperProps, label, LabelTag, hideLabel, required, reqText,
|
|
109
|
+
disabled: disabled === true,
|
|
110
|
+
readOnly, assistText, invalid, errorMessage, id,
|
|
111
|
+
small, ssr, className,
|
|
112
|
+
wrapperRef,
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
exports.getFormFieldWrapperProps = getFormFieldWrapperProps;
|
|
116
|
+
const groupFormFieldWrapperProps = (props) => {
|
|
117
|
+
/* prettier-ignore */
|
|
118
|
+
const { wrapperProps, label, hideLabel, LabelTag, required, reqText, disabled, readOnly, assistText, invalid, errorMessage, id, small, ssr, className, wrapperRef } = props, // eslint-disable-line deprecation/deprecation
|
|
119
|
+
rest = tslib_1.__rest(props, ["wrapperProps", "label", "hideLabel", "LabelTag", "required", "reqText", "disabled", "readOnly", "assistText", "invalid", "errorMessage", "id", "small", "ssr", "className", "wrapperRef"]);
|
|
120
|
+
return Object.assign({ fieldWrapperProps: (0, exports.getFormFieldWrapperProps)(props) }, rest);
|
|
121
|
+
};
|
|
122
|
+
exports.groupFormFieldWrapperProps = groupFormFieldWrapperProps;
|
package/Gallery/_GalleryItem.js
CHANGED
|
@@ -16,8 +16,8 @@ const GalleryItem = (props) => {
|
|
|
16
16
|
setCurrentImage(Object.assign(Object.assign({}, image), { caption, description, largeImageSrc }));
|
|
17
17
|
} },
|
|
18
18
|
' ',
|
|
19
|
-
react_1.default.createElement(_Image_js_1.Image, Object.assign({
|
|
20
|
-
' ')) : (react_1.default.createElement(_Image_js_1.Image, Object.assign({
|
|
19
|
+
react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "GalleryItem__image" }, image)),
|
|
20
|
+
' ')) : (react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "GalleryItem__image" }, image))),
|
|
21
21
|
description && react_1.default.createElement("div", { className: "GalleryItem__description" }, description)));
|
|
22
22
|
};
|
|
23
23
|
exports.GalleryItem = GalleryItem;
|
|
@@ -10,6 +10,6 @@ const GalleryModalItem = (props) => {
|
|
|
10
10
|
(caption || description) && (react_1.default.createElement("div", { className: "GalleryModalItem__text" },
|
|
11
11
|
react_1.default.createElement("div", { className: "GalleryModalItem__caption" }, caption),
|
|
12
12
|
react_1.default.createElement("div", { className: "GalleryModalItem__description" }, description))),
|
|
13
|
-
react_1.default.createElement(_Image_js_1.Image, {
|
|
13
|
+
react_1.default.createElement(_Image_js_1.Image, { bem: "GalleryModalItem__image", src: image.largeImageSrc || image.src })));
|
|
14
14
|
};
|
|
15
15
|
exports.GalleryModalItem = GalleryModalItem;
|
package/Gallery.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GalleryItemProps } from './Gallery/_GalleryItem.js';
|
|
2
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
-
import { SSRSupportProps } from './utils.js';
|
|
3
|
+
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
4
4
|
export type { GalleryItemProps } from './Gallery/_GalleryItem.js';
|
|
5
5
|
export type GalleryI18n = {
|
|
6
6
|
modalNextLabel: string;
|
|
@@ -11,6 +11,6 @@ export type GalleryProps = {
|
|
|
11
11
|
items: Array<GalleryItemProps>;
|
|
12
12
|
texts?: GalleryI18n;
|
|
13
13
|
lang?: string;
|
|
14
|
-
} & SSRSupportProps & SeenProp;
|
|
14
|
+
} & SSRSupportProps & WrapperElmProps & SeenProp;
|
|
15
15
|
export declare const Gallery: (props: GalleryProps) => JSX.Element;
|
|
16
16
|
export default Gallery;
|
package/Gallery.js
CHANGED
|
@@ -23,10 +23,11 @@ const defaultTexts = {
|
|
|
23
23
|
const Gallery = (props) => {
|
|
24
24
|
const { items, ssr, startSeen } = props;
|
|
25
25
|
const texts = (0, i18n_1.getTexts)(props, defaultTexts);
|
|
26
|
-
const [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
react_1.default.createElement(
|
|
26
|
+
const [currentImage, setCurrentImage] = (0, react_1.useState)(undefined);
|
|
27
|
+
const galleryState = (0, react_1.useMemo)(() => ({ items, setCurrentImage, currentImage }), [items, currentImage]);
|
|
28
|
+
return (react_1.default.createElement(_GalleryModalContext_js_1.GalleryModalContext.Provider, { value: galleryState },
|
|
29
|
+
react_1.default.createElement(_AbstractCarousel_js_1.AbstractCarousel, { bem: "Gallery", items: items, Component: _GalleryItem_js_1.GalleryItem, ssr: ssr, startSeen: startSeen, wrapperProps: props.wrapperProps }),
|
|
30
|
+
react_1.default.createElement(_GalleryModal_js_1.GalleryModal, Object.assign({}, currentImage, { texts: texts }))));
|
|
30
31
|
};
|
|
31
32
|
exports.Gallery = Gallery;
|
|
32
33
|
exports.default = exports.Gallery;
|
package/GridBlocks.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Efnistakn } 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
|
export type GridBlockItem = {
|
|
6
7
|
title: string;
|
|
7
8
|
summary: string | JSX.Element;
|
|
@@ -17,10 +18,6 @@ export type GridBlockItem = {
|
|
|
17
18
|
export type GridBlocksProps = {
|
|
18
19
|
blocks: Array<GridBlockItem>;
|
|
19
20
|
twocol?: boolean;
|
|
20
|
-
} & SeenProp;
|
|
21
|
-
export type GridBlocksProp1s = {
|
|
22
|
-
blocks: Array<GridBlockItem>;
|
|
23
|
-
twocol?: boolean;
|
|
24
|
-
};
|
|
21
|
+
} & WrapperElmProps & SeenProp;
|
|
25
22
|
export declare const GridBlocks: (props: GridBlocksProps) => JSX.Element;
|
|
26
23
|
export default GridBlocks;
|
package/GridBlocks.js
CHANGED
|
@@ -10,12 +10,12 @@ const _Link_js_1 = require("./_abstract/_Link.js");
|
|
|
10
10
|
const seenEffect_js_1 = require("./utils/seenEffect.js");
|
|
11
11
|
const ButtonTertiary_js_1 = tslib_1.__importDefault(require("./ButtonTertiary.js"));
|
|
12
12
|
const GridBlocks = (props) => {
|
|
13
|
-
const { blocks, twocol, startSeen } = props;
|
|
13
|
+
const { blocks, twocol, startSeen, wrapperProps } = props;
|
|
14
14
|
const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
|
|
15
|
-
return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('GridBlocks', [twocol && 'twocol']), ref: ref }, blocks.map(({ title, summary, href, links = [], icon, image }, i) => {
|
|
15
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('GridBlocks', [twocol && 'twocol'], (wrapperProps || {}).className), ref: ref }), blocks.map(({ title, summary, href, links = [], icon, image }, i) => {
|
|
16
16
|
const imageProps = icon ? { src: (0, assets_1.getEfnistaknUrl)(icon) } : image;
|
|
17
17
|
return (react_1.default.createElement("div", { key: i, className: "GridBlocks__item" },
|
|
18
|
-
imageProps && react_1.default.createElement(_Image_js_1.Image, Object.assign({
|
|
18
|
+
imageProps && react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "GridBlocks__illustration" }, imageProps)),
|
|
19
19
|
react_1.default.createElement("div", { className: "GridBlocks__textwrap" },
|
|
20
20
|
react_1.default.createElement("h3", { className: "GridBlocks__item__title" }, href != null ? (react_1.default.createElement(_Link_js_1.Link, { className: "GridBlocks__item__titlelink", href: href }, title)) : (title)),
|
|
21
21
|
react_1.default.createElement("div", { className: "GridBlocks__item__summary" }, summary),
|
package/Heading.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ComponentLayoutProps } from './constants.js';
|
|
3
|
+
import { WrapperElmProps } from './utils.js';
|
|
3
4
|
declare const sizes: {
|
|
4
5
|
readonly small: "small";
|
|
5
6
|
/** Default value */
|
|
@@ -17,6 +18,6 @@ export type HeadingProps = {
|
|
|
17
18
|
* This prop is ignore if the `Tag` prop is defined.
|
|
18
19
|
*/
|
|
19
20
|
forceH1?: boolean;
|
|
20
|
-
} & ComponentLayoutProps;
|
|
21
|
+
} & ComponentLayoutProps & WrapperElmProps;
|
|
21
22
|
export declare const Heading: (props: HeadingProps) => JSX.Element;
|
|
22
23
|
export default Heading;
|