@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/esm/RowBlockColumn.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { WrapperElmProps } from './utils.js';
|
|
2
3
|
export type RowBlockColumnProps = {
|
|
3
4
|
background?: boolean | 'primary';
|
|
4
5
|
narrow?: boolean;
|
|
5
6
|
children: ReactNode;
|
|
6
|
-
};
|
|
7
|
+
} & WrapperElmProps;
|
|
7
8
|
export declare const RowBlockColumn: (props: RowBlockColumnProps) => JSX.Element;
|
|
8
9
|
export default RowBlockColumn;
|
package/esm/RowBlockColumn.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
export const RowBlockColumn = (props) => {
|
|
4
|
-
const { background, narrow, children } = props;
|
|
5
|
-
return (React.createElement("div", { className: modifiedClass('RowBlockColumn', [
|
|
4
|
+
const { background, narrow, children, wrapperProps } = props;
|
|
5
|
+
return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('RowBlockColumn', [
|
|
6
6
|
narrow && 'narrow',
|
|
7
7
|
background && 'background',
|
|
8
8
|
background === 'primary' && 'background--primary',
|
|
9
|
-
]) }, children));
|
|
9
|
+
], (wrapperProps || {}).className) }), children));
|
|
10
10
|
};
|
|
11
11
|
export default RowBlockColumn;
|
package/esm/SearchInput.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
|
-
type
|
|
4
|
-
type BaseProps<Type extends {
|
|
5
|
-
type?: string;
|
|
6
|
-
}, InputProps extends object> = {
|
|
3
|
+
export type SearchInputProps = FormFieldWrappingProps & {
|
|
7
4
|
small?: boolean;
|
|
8
|
-
|
|
5
|
+
type?: string;
|
|
9
6
|
onButtonClick?: () => void;
|
|
10
7
|
buttonText?: string;
|
|
11
8
|
inputRef?: RefObject<HTMLInputElement>;
|
|
12
9
|
buttonRef?: RefObject<HTMLButtonElement>;
|
|
13
|
-
} &
|
|
14
|
-
export type SearchInputProps = BaseProps<{
|
|
15
|
-
type?: 'text';
|
|
16
|
-
}, InputElmProps>;
|
|
10
|
+
} & JSX.IntrinsicElements['input'];
|
|
17
11
|
export declare const SearchInput: (props: SearchInputProps) => JSX.Element;
|
|
18
12
|
export default SearchInput;
|
package/esm/SearchInput.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import FormField from './FormField.js';
|
|
3
|
+
import FormField, { groupFormFieldWrapperProps, } from './FormField.js';
|
|
5
4
|
export const SearchInput = (props) => {
|
|
6
5
|
var _a;
|
|
7
|
-
const
|
|
6
|
+
const _b = groupFormFieldWrapperProps(props), { onChange, onButtonClick, buttonText = 'Leita', fieldWrapperProps } = _b, inputElementProps = __rest(_b, ["onChange", "onButtonClick", "buttonText", "fieldWrapperProps"]);
|
|
8
7
|
const { value, defaultValue, placeholder } = inputElementProps;
|
|
9
8
|
const [hasValue, setHasValue] = useState(undefined);
|
|
10
9
|
const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
|
|
@@ -15,9 +14,9 @@ export const SearchInput = (props) => {
|
|
|
15
14
|
setHasValue(!!e.target.value);
|
|
16
15
|
onChange && onChange(e);
|
|
17
16
|
};
|
|
18
|
-
return (React.createElement(FormField, {
|
|
17
|
+
return (React.createElement(FormField, Object.assign({ extraClassName: "SearchInput", empty: empty, filled: filled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
|
|
19
18
|
React.createElement("input", Object.assign({ className: "SearchInput__input", onChange: _onChange }, inputProps, inputElementProps, { ref: props.inputRef })),
|
|
20
19
|
' ',
|
|
21
|
-
onButtonClick && (React.createElement("button", { className: "SearchInput__button", type: "button", onClick: onButtonClick, title: buttonText, ref: props.buttonRef, disabled: disabled || readOnly }, buttonText)))) }));
|
|
20
|
+
onButtonClick && (React.createElement("button", { className: "SearchInput__button", type: "button", onClick: onButtonClick, title: buttonText, ref: props.buttonRef, disabled: props.disabled || props.readOnly }, buttonText)))) })));
|
|
22
21
|
};
|
|
23
22
|
export default SearchInput;
|
|
@@ -9,6 +9,6 @@ export const SearchResultsItem = (props) => {
|
|
|
9
9
|
React.createElement(Link, { className: bem + '__link', href: href },
|
|
10
10
|
React.createElement("h3", { className: bem + '__title' }, title),
|
|
11
11
|
metaArr.length > 0 && (React.createElement("span", { className: bem + '__meta' }, metaArr.map((item, i) => typeof item === 'function' ? item() : item && React.createElement("span", { key: i }, item)))),
|
|
12
|
-
highlight && image && React.createElement(Image, {
|
|
12
|
+
highlight && image && React.createElement(Image, { bem: bem + '__image', src: image }),
|
|
13
13
|
React.createElement("div", { className: bem + '__summary', dangerouslySetInnerHTML: { __html: summary } }))));
|
|
14
14
|
};
|
package/esm/SearchResults.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { SearchResultsItemProps } from './SearchResults/_SearchResultsItem.js';
|
|
3
|
+
import { WrapperElmProps } from './utils.js';
|
|
3
4
|
export type SearchReesultI18n = {
|
|
4
5
|
lang: string;
|
|
5
6
|
loadQueryTitle: string;
|
|
@@ -32,6 +33,6 @@ export type SearchResultsProps = {
|
|
|
32
33
|
loadMore?: () => void;
|
|
33
34
|
texts?: SearchReesultI18n;
|
|
34
35
|
lang?: string;
|
|
35
|
-
};
|
|
36
|
+
} & WrapperElmProps;
|
|
36
37
|
export declare const SearchResults: (props: SearchResultsProps) => JSX.Element;
|
|
37
38
|
export default SearchResults;
|
package/esm/SearchResults.js
CHANGED
|
@@ -94,10 +94,10 @@ const renderLoadMore = (props, texts) => {
|
|
|
94
94
|
};
|
|
95
95
|
// TODO: add plural translation thingy for result string
|
|
96
96
|
export const SearchResults = (props) => {
|
|
97
|
-
const { filters, activeFilterIdx, setFilter, status, errorText } = props;
|
|
97
|
+
const { filters, activeFilterIdx, setFilter, status, errorText, wrapperProps } = props;
|
|
98
98
|
const texts = getTexts(props, defaultTexts);
|
|
99
99
|
const domid = useDomid();
|
|
100
|
-
return (React.createElement("div", { className: modifiedClass('SearchResults', status !== 'results' && status) },
|
|
100
|
+
return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('SearchResults', status !== 'results' && status, (wrapperProps || {}).className) }),
|
|
101
101
|
renderTitle(props, texts),
|
|
102
102
|
React.createElement(SearchResults_Tabs, { domid: domid, filters: filters, activeIdx: activeFilterIdx, setFilter: setFilter, lang: texts.lang }),
|
|
103
103
|
React.createElement("div", { className: "SearchResults__results", id: domid },
|
package/esm/SeenEffect.js
CHANGED
|
@@ -6,6 +6,8 @@ const _SeenEffect = (props) => {
|
|
|
6
6
|
const [ref] = useSeenEffect();
|
|
7
7
|
return React.createElement(Tag, Object.assign({}, tagProps, { ref: ref }, getEffectAttr(effectType)));
|
|
8
8
|
};
|
|
9
|
+
// NOTE: As this component already accepts all `<div/>` props directly,
|
|
10
|
+
// it makes little sense to add support for `wrapperProps` on top.
|
|
9
11
|
export const SeenEffect = (props) => {
|
|
10
12
|
const _a = props, { Tag = 'div', effectType, startSeen } = _a, tagProps = __rest(_a, ["Tag", "effectType", "startSeen"]);
|
|
11
13
|
const addEffects = (effectType || '') !== 'none' || startSeen !== true;
|
package/esm/Selectbox.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
4
3
|
import _Selectbox from '@hugsmidjan/react/Selectbox';
|
|
5
|
-
import FormField from './FormField.js';
|
|
4
|
+
import FormField, { groupFormFieldWrapperProps, } from './FormField.js';
|
|
6
5
|
const getValue = (opt) => {
|
|
7
6
|
const val = typeof opt === 'object' ? opt.value : opt;
|
|
8
7
|
return typeof val === 'number' ? String(val) : val;
|
|
9
8
|
};
|
|
10
9
|
export const Selectbox = (props) => {
|
|
11
|
-
const
|
|
10
|
+
const _a = groupFormFieldWrapperProps(props), { onChange, fieldWrapperProps } = _a, selectProps = __rest(_a, ["onChange", "fieldWrapperProps"]);
|
|
12
11
|
const { value, defaultValue, placeholder, options } = selectProps;
|
|
13
12
|
const _selectRef = useRef(null);
|
|
14
13
|
const selectRef = selectProps.selectRef || _selectRef;
|
|
@@ -32,7 +31,7 @@ export const Selectbox = (props) => {
|
|
|
32
31
|
setIsEmpty(!((_a = selectElm.selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.text));
|
|
33
32
|
onChange && onChange(e);
|
|
34
33
|
};
|
|
35
|
-
return (React.createElement(FormField, {
|
|
34
|
+
return (React.createElement(FormField, Object.assign({ extraClassName: "Selectbox", empty: isEmpty, filled: isFilled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => (React.createElement(_Selectbox, Object.assign({ bem: className.input, ssr: props.ssr, onChange: _onChange }, inputProps, addFocusProps(selectProps), { selectRef: selectRef }))) })));
|
|
36
35
|
};
|
|
37
36
|
// /** @deprecated Use named export instead (The default export will be removed in v0.11+) */
|
|
38
37
|
// const SelectboxDefault = Selectbox;
|
package/esm/ShareButtons.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ShareButtonI18n, ShareButtonPlatforms } from '@reykjavik/hanna-utils/shareButtonsUtils';
|
|
2
|
-
import { SSRSupportProps } from './utils.js';
|
|
2
|
+
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
3
3
|
export type ShareButtonsProps = {
|
|
4
4
|
texts?: Readonly<ShareButtonI18n>;
|
|
5
5
|
lang?: string;
|
|
6
|
-
} & SSRSupportProps & Partial<Record<ShareButtonPlatforms, boolean>>;
|
|
6
|
+
} & SSRSupportProps & WrapperElmProps<null, 'aria-label'> & Partial<Record<ShareButtonPlatforms, boolean>>;
|
|
7
7
|
export declare const ShareButtons: (props: ShareButtonsProps) => JSX.Element | null;
|
|
8
8
|
export default ShareButtons;
|
package/esm/ShareButtons.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
2
3
|
import { DEFAULT_LANG } from '@reykjavik/hanna-utils/i18n';
|
|
3
4
|
import { getDocMeta, getShareButtonLabel, openInPopup, shareButtonTexts, shareButtonTypes, } from '@reykjavik/hanna-utils/shareButtonsUtils';
|
|
4
5
|
import { Link } from './_abstract/_Link.js';
|
|
@@ -20,7 +21,7 @@ const ShareButtons__item = (props) => {
|
|
|
20
21
|
React.createElement(Link, { className: 'ShareButtons__link ShareButtons__link--' + type, href: href, title: buttonText, rel: "noopener noreferrer", target: popup ? '_blank' : undefined, onClick: popup ? openInPopup : undefined }, buttonText)));
|
|
21
22
|
};
|
|
22
23
|
export const ShareButtons = (props) => {
|
|
23
|
-
const { texts, lang, ssr, facebook = true, twitter = true, linkedin, email, } = props;
|
|
24
|
+
const { texts, lang, ssr, facebook = true, twitter = true, linkedin, email, wrapperProps, } = props;
|
|
24
25
|
const [docMeta, setDocMeta] = useState();
|
|
25
26
|
const href = docLoc.href; // assign to local variable to silence `react-hooks/exhaustive-deps`
|
|
26
27
|
useEffect(() => {
|
|
@@ -39,9 +40,10 @@ export const ShareButtons = (props) => {
|
|
|
39
40
|
(docMeta && (shareButtonTexts[docMeta.lang] || shareButtonTexts[DEFAULT_LANG])) ||
|
|
40
41
|
{};
|
|
41
42
|
const { label, buttonLabel, emailSubject } = txt;
|
|
43
|
+
const className = modifiedClass('ShareButtons', null, (wrapperProps || {}).className);
|
|
42
44
|
if (!docMeta || ssr === 'ssr-only') {
|
|
43
45
|
// Generate SSR markup for hanna-sprinkles to pick up on.
|
|
44
|
-
return (React.createElement("div", { className:
|
|
46
|
+
return (React.createElement("div", Object.assign({}, wrapperProps, { className: className, "data-button-types": generateTypeList(facebook, twitter, linkedin, email), "data-label": label, "data-buttonlabel": buttonLabel, "data-emailsubject": emailSubject || undefined })));
|
|
45
47
|
}
|
|
46
48
|
const showTypes = {
|
|
47
49
|
facebook,
|
|
@@ -49,7 +51,7 @@ export const ShareButtons = (props) => {
|
|
|
49
51
|
linkedin,
|
|
50
52
|
email,
|
|
51
53
|
};
|
|
52
|
-
return (React.createElement("div", { className:
|
|
54
|
+
return (React.createElement("div", Object.assign({}, wrapperProps, { className: className, "aria-label": label, "data-sprinkled": "true" }),
|
|
53
55
|
label && React.createElement("strong", { className: "ShareButtons__label" }, label),
|
|
54
56
|
React.createElement("ul", { className: "ShareButtons__list" }, shareButtonTypes.map((type) => showTypes[type] && (React.createElement(ShareButtons__item, { key: type, type: type, label: buttonLabel || '', href: docMeta.hrefs[type] }))))));
|
|
55
57
|
};
|
package/esm/Sharpie.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { WrapperElmProps } from './utils.js';
|
|
2
3
|
declare const colors: {
|
|
3
4
|
green: number;
|
|
4
5
|
red: number;
|
|
@@ -18,6 +19,6 @@ export type SharpieProps = {
|
|
|
18
19
|
color: SharpieColor;
|
|
19
20
|
tag?: SharpieTag;
|
|
20
21
|
children: ReactNode;
|
|
21
|
-
};
|
|
22
|
+
} & WrapperElmProps;
|
|
22
23
|
export declare const Sharpie: (props: SharpieProps) => JSX.Element;
|
|
23
24
|
export default Sharpie;
|
package/esm/Sharpie.js
CHANGED
|
@@ -14,9 +14,9 @@ const tags = {
|
|
|
14
14
|
s: 1,
|
|
15
15
|
};
|
|
16
16
|
export const Sharpie = (props) => {
|
|
17
|
-
const { color, tag, children } = props;
|
|
17
|
+
const { color, tag, children, wrapperProps } = props;
|
|
18
18
|
const colorModifier = colors[color] ? color : 'green';
|
|
19
19
|
const Tag = tag && tags[tag] ? tag : 'span';
|
|
20
|
-
return React.createElement(Tag, { className: modifiedClass('Sharpie', colorModifier) }, children);
|
|
20
|
+
return (React.createElement(Tag, Object.assign({}, wrapperProps, { className: modifiedClass('Sharpie', colorModifier, (wrapperProps || {}).className) }), children));
|
|
21
21
|
};
|
|
22
22
|
export default Sharpie;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import Autosuggest, { RenderSuggestion } from 'react-autosuggest';
|
|
3
3
|
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
4
4
|
import { BemProps } from './utils/types.js';
|
|
5
|
+
import { WrapperElmProps } from './utils.js';
|
|
5
6
|
export type SiteSearchACI18n = {
|
|
6
7
|
lang?: string;
|
|
7
8
|
/** Label for the autocomplete's combobox container div */
|
|
@@ -35,6 +36,6 @@ export type SiteSearchAutocompleteProps<T> = {
|
|
|
35
36
|
texts?: SiteSearchACI18n;
|
|
36
37
|
/** @deprecated Use `text` prop instead (will be removed in v0.11) */
|
|
37
38
|
label?: string;
|
|
38
|
-
} & BemProps;
|
|
39
|
+
} & BemProps & WrapperElmProps;
|
|
39
40
|
export declare const SiteSearchAutocomplete: <T>(props: SiteSearchAutocompleteProps<T>) => JSX.Element;
|
|
40
41
|
export default SiteSearchAutocomplete;
|
|
@@ -20,7 +20,7 @@ export const defaultSiteSearchACTexts = {
|
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
export const SiteSearchAutocomplete = (props) => {
|
|
23
|
-
const { suggestions, setSuggestions, renderSuggestion, getSuggestionValue, onSuggestionsFetchRequested, onSuggestionSelected, onSuggestionHighlighted, onSubmit, onButtonClick = onSubmit, bem = 'SiteSearchAutocomplete', } = props;
|
|
23
|
+
const { suggestions, setSuggestions, renderSuggestion, getSuggestionValue, onSuggestionsFetchRequested, onSuggestionSelected, onSuggestionHighlighted, onSubmit, onButtonClick = onSubmit, bem = 'SiteSearchAutocomplete', wrapperProps, } = props;
|
|
24
24
|
const [value, setValue] = useState('');
|
|
25
25
|
const inputRef = createRef();
|
|
26
26
|
const txt = getTexts(props, defaultSiteSearchACTexts);
|
|
@@ -40,9 +40,9 @@ export const SiteSearchAutocomplete = (props) => {
|
|
|
40
40
|
},
|
|
41
41
|
}, renderInputComponent: (inputProps) => {
|
|
42
42
|
/* prettier-ignore */
|
|
43
|
-
const { className, type, disabled, readOnly, required, children } = inputProps,
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const { className, type, disabled, readOnly, required, children } = inputProps, siteSearchProps = __rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
|
|
44
|
+
return (React.createElement(SiteSearchInput, Object.assign({}, siteSearchProps, { wrapperProps: wrapperProps, label: props.label || // eslint-disable-line deprecation/deprecation
|
|
45
|
+
txt.inputLabel, placeholder: txt.placeholder, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
|
|
46
46
|
} }));
|
|
47
47
|
};
|
|
48
48
|
export default SiteSearchAutocomplete;
|
package/esm/SiteSearchCurtain.js
CHANGED
|
@@ -2,6 +2,8 @@ import React, { useEffect } from 'react';
|
|
|
2
2
|
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import { useLaggedState } from '@hugsmidjan/react/hooks';
|
|
4
4
|
import { isPreact } from './utils/env.js';
|
|
5
|
+
// NOTE: This component is too low-level (and too esoteric and rarely used)
|
|
6
|
+
// to justify `wrapperProps`
|
|
5
7
|
export const SiteSearchCurtain = (props) => {
|
|
6
8
|
const [focused, setFocused] = useLaggedState(false);
|
|
7
9
|
useEffect(() => {
|
package/esm/SiteSearchInput.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
|
-
import { SSRSupportProps } from './utils.js';
|
|
4
3
|
type InputElmProps = Omit<JSX.IntrinsicElements['input'], 'className' | 'type' | 'disabled' | 'readOnly' | 'required' | 'onSubmit'>;
|
|
5
|
-
type
|
|
6
|
-
export type SiteSearchInputProps = {
|
|
4
|
+
export type SiteSearchInputProps = Pick<FormFieldWrappingProps, 'id' | 'label' | 'ssr' | 'wrapperProps'> & {
|
|
7
5
|
/** Triggered when user hits ENTER key with the focus inside the input field
|
|
8
6
|
*
|
|
9
7
|
* Return `true` to **allow** the browser's default submit hehavior
|
|
@@ -17,7 +15,6 @@ export type SiteSearchInputProps = {
|
|
|
17
15
|
*/
|
|
18
16
|
onButtonClick?: () => boolean | void;
|
|
19
17
|
buttonText?: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare const SiteSearchInput: React.ForwardRefExoticComponent<Pick<SiteSearchInputProps, "form" | "label" | "slot" | "style" | "title" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "value" | "pattern" | "name" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "size" | "src" | "multiple" | "alt" | "ssr" | "accept" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "height" | "max" | "maxLength" | "min" | "minLength" | "width" | "onButtonClick" | "buttonText"> & React.RefAttributes<HTMLInputElement>>;
|
|
18
|
+
} & InputElmProps;
|
|
19
|
+
export declare const SiteSearchInput: React.ForwardRefExoticComponent<Pick<SiteSearchInputProps, "form" | "label" | "slot" | "style" | "title" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "value" | "pattern" | "name" | "wrapperProps" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "size" | "src" | "multiple" | "alt" | "ssr" | "accept" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "height" | "max" | "maxLength" | "min" | "minLength" | "width" | "onButtonClick" | "buttonText"> & React.RefAttributes<HTMLInputElement>>;
|
|
23
20
|
export default SiteSearchInput;
|
package/esm/SiteSearchInput.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import FormField from './FormField.js';
|
|
3
|
+
import FormField, { groupFormFieldWrapperProps, } from './FormField.js';
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
export const SiteSearchInput = React.forwardRef((props, ref) => {
|
|
6
6
|
var _a;
|
|
7
|
-
const {
|
|
7
|
+
const _b = groupFormFieldWrapperProps(props), { onChange, buttonText = 'Leita', onSubmit, onButtonClick = props.onSubmit, onKeyDown, placeholder = typeof props.label === 'string' ? props.label : undefined, fieldWrapperProps } = _b, inputElementProps = __rest(_b, ["onChange", "buttonText", "onSubmit", "onButtonClick", "onKeyDown", "placeholder", "fieldWrapperProps"]);
|
|
8
8
|
const { value, defaultValue } = inputElementProps;
|
|
9
9
|
const [hasValue, setHasValue] = useState(undefined);
|
|
10
10
|
const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
|
|
@@ -15,7 +15,7 @@ export const SiteSearchInput = React.forwardRef((props, ref) => {
|
|
|
15
15
|
setHasValue(!!e.target.value);
|
|
16
16
|
onChange && onChange(e);
|
|
17
17
|
};
|
|
18
|
-
return (React.createElement(FormField, {
|
|
18
|
+
return (React.createElement(FormField, Object.assign({ extraClassName: "SiteSearchInput", empty: empty, filled: filled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
|
|
19
19
|
React.createElement("input", Object.assign({ className: "SiteSearchInput__input", onChange: _onChange }, inputProps, { placeholder: placeholder, onKeyDown: onSubmit
|
|
20
20
|
? (e) => {
|
|
21
21
|
if (e.key === 'Enter' && onSubmit() !== true) {
|
|
@@ -25,6 +25,6 @@ export const SiteSearchInput = React.forwardRef((props, ref) => {
|
|
|
25
25
|
}
|
|
26
26
|
: onKeyDown }, inputElementProps, { ref: ref })),
|
|
27
27
|
' ',
|
|
28
|
-
React.createElement("button", { className: "SiteSearchInput__button", type: "submit", onClick: onButtonClick && ((e) => !onButtonClick() && e.preventDefault()), title: buttonText }, buttonText))) }));
|
|
28
|
+
React.createElement("button", { className: "SiteSearchInput__button", type: "submit", onClick: onButtonClick && ((e) => !onButtonClick() && e.preventDefault()), title: buttonText }, buttonText))) })));
|
|
29
29
|
});
|
|
30
30
|
export default SiteSearchInput;
|
package/esm/Skeleton.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
3
|
+
import { WrapperElmProps } from './utils.js';
|
|
2
4
|
export type SkeletonProps = {
|
|
3
5
|
text?: boolean;
|
|
4
6
|
height?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
7
|
+
} & EitherObj<{
|
|
5
8
|
items?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
6
9
|
gap?: 1 | 2 | 3 | 4 | 5;
|
|
7
|
-
}
|
|
10
|
+
}, WrapperElmProps>;
|
|
8
11
|
export declare const Skeleton: {
|
|
9
12
|
(props: SkeletonProps): JSX.Element;
|
|
10
13
|
/** Returns a single `<Skeleton height={X}/>` element of branded type `SkeletonBlock` */
|
package/esm/Skeleton.js
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import range from '@hugsmidjan/qj/range';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
num
|
|
11
|
-
return num > min ? num : undefined;
|
|
4
|
+
/** Rounds the input number, caps it at max. If it's below min, returns undefined */
|
|
5
|
+
const minmax = (num, max, min) => {
|
|
6
|
+
if (num == null || isNaN(num)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
num = Math.round(num);
|
|
10
|
+
return num > max ? max : num >= min ? num : undefined;
|
|
12
11
|
};
|
|
13
12
|
export const Skeleton = (props) => {
|
|
14
|
-
const height = minmax(props.height,
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (items > 1) {
|
|
22
|
-
return React.createElement(React.Fragment, null, range(1, items).map(renderSkeleton));
|
|
13
|
+
const height = minmax(props.height, 20, 2);
|
|
14
|
+
const gap = minmax(props.gap, 5, 1);
|
|
15
|
+
const items = minmax(props.items, 20, 2) || 1;
|
|
16
|
+
const { wrapperProps } = props;
|
|
17
|
+
const className = modifiedClass('Skeleton', [props.text && 'text', height && 'height--' + height, gap && 'gap--' + gap], (wrapperProps || {}).className);
|
|
18
|
+
if (items) {
|
|
19
|
+
return (React.createElement(React.Fragment, null, range(1, items).map((key) => (React.createElement("span", { key: key, className: className })))));
|
|
23
20
|
}
|
|
24
|
-
return
|
|
21
|
+
return React.createElement("span", Object.assign({}, wrapperProps, { className: className }));
|
|
25
22
|
};
|
|
26
23
|
export default Skeleton;
|
|
27
24
|
/** Returns a single `<Skeleton height={X}/>` element of branded type `SkeletonBlock` */
|
package/esm/SubHeading.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
3
|
import { ComponentLayoutProps } from './constants.js';
|
|
4
|
+
import { WrapperElmProps } from './utils.js';
|
|
4
5
|
export type SubHeadingProps = {
|
|
5
6
|
Tag?: 'h2' | 'h3';
|
|
6
7
|
small?: boolean;
|
|
7
8
|
children: ReactNode;
|
|
8
|
-
} & ComponentLayoutProps & SeenProp;
|
|
9
|
+
} & ComponentLayoutProps & WrapperElmProps & SeenProp;
|
|
9
10
|
export declare const SubHeading: (props: SubHeadingProps) => JSX.Element;
|
|
10
11
|
export default SubHeading;
|
package/esm/SubHeading.js
CHANGED
|
@@ -2,12 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
4
|
export const SubHeading = (props) => {
|
|
5
|
-
const { small, Tag = 'h2', children, align, wide, startSeen } = props;
|
|
5
|
+
const { small, Tag = 'h2', children, align, wide, startSeen, wrapperProps } = props;
|
|
6
6
|
const [ref] = useSeenEffect(startSeen);
|
|
7
|
-
return (React.createElement(Tag, { className: modifiedClass('SubHeading', [
|
|
7
|
+
return (React.createElement(Tag, Object.assign({}, wrapperProps, { className: modifiedClass('SubHeading', [
|
|
8
8
|
small && 'small',
|
|
9
9
|
align === 'right' && 'align--' + align,
|
|
10
10
|
!align && wide && 'wide',
|
|
11
|
-
]), ref: ref }, children));
|
|
11
|
+
], (wrapperProps || {}).className), ref: ref }), children));
|
|
12
12
|
};
|
|
13
13
|
export default SubHeading;
|
package/esm/Tabs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SeenProp } from './utils/seenEffect.js';
|
|
2
|
-
import { SSRSupportProps } from './utils.js';
|
|
2
|
+
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
3
3
|
export type TabItemProps = {
|
|
4
4
|
label: string;
|
|
5
5
|
badge?: string | number;
|
|
@@ -27,7 +27,7 @@ export type TabsProps<T extends TabItemProps = TabItemProps> = BaseTabsProps<T>
|
|
|
27
27
|
vertical?: boolean;
|
|
28
28
|
/** Optional <Tabs/> block connected to the currently active tab */
|
|
29
29
|
subTabs?: BaseTabsProps;
|
|
30
|
-
} & SeenProp;
|
|
30
|
+
} & WrapperElmProps<null, 'role' | 'aria-label' | 'aria-labelledby'> & SeenProp;
|
|
31
31
|
/** @deprecated Use `TabsProps` instead (Will be removed in v0.11) */
|
|
32
32
|
export type TablistProps<T extends TabItemProps = TabItemProps> = TabsProps<T>;
|
|
33
33
|
export declare const Tabs: (props: TabsProps) => JSX.Element;
|
package/esm/Tabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { getFrag } from '@hugsmidjan/qj/frag';
|
|
3
2
|
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
|
+
import { getFrag } from '@hugsmidjan/qj/frag';
|
|
4
4
|
import { useSeenEffect } from './utils/seenEffect.js';
|
|
5
5
|
import { useIsBrowserSide } from './utils.js';
|
|
6
6
|
const navKeyEffects = {
|
|
@@ -9,7 +9,6 @@ const navKeyEffects = {
|
|
|
9
9
|
ArrowDown: 1,
|
|
10
10
|
ArrowRight: 1,
|
|
11
11
|
};
|
|
12
|
-
// eslint-disable-next-line complexity
|
|
13
12
|
const renderTab = (tabProps, index, listProps) => {
|
|
14
13
|
const { label, badge, href, type, longLabel } = tabProps;
|
|
15
14
|
const { activeIdx, activateTab, focusedIdx, setFocusedIdx, tabRole, listAriaControls, isBrowser, } = listProps;
|
|
@@ -46,7 +45,7 @@ const renderTab = (tabProps, index, listProps) => {
|
|
|
46
45
|
// https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-2/tabs.html
|
|
47
46
|
export const Tabs = (props) => {
|
|
48
47
|
var _a, _b;
|
|
49
|
-
const { tabs, role, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-controls': listAriaControls, id, activeIdx, onSetActive, activateOnFocus, ssr, startSeen, vertical, subTabs, } = props;
|
|
48
|
+
const { tabs, role, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-controls': listAriaControls, wrapperProps = {}, id = wrapperProps.id, activeIdx, onSetActive, activateOnFocus, ssr, startSeen, vertical, subTabs, } = props;
|
|
50
49
|
const isBrowser = useIsBrowserSide(ssr);
|
|
51
50
|
const [focusedIdx, setFocusedIdx] = useState(activeIdx || 0);
|
|
52
51
|
const tabRole = isBrowser && role === 'tablist' ? 'tab' : undefined;
|
|
@@ -62,7 +61,7 @@ export const Tabs = (props) => {
|
|
|
62
61
|
};
|
|
63
62
|
const handleKeydown = tabRole &&
|
|
64
63
|
((e) => {
|
|
65
|
-
var _a;
|
|
64
|
+
var _a, _b;
|
|
66
65
|
const delta = navKeyEffects[e.key];
|
|
67
66
|
if (delta) {
|
|
68
67
|
// prevent scolling +
|
|
@@ -73,6 +72,7 @@ export const Tabs = (props) => {
|
|
|
73
72
|
nextIdx = nextIdx < 0 ? maxIdx : nextIdx > maxIdx ? 0 : nextIdx;
|
|
74
73
|
(_a = e.currentTarget.querySelectorAll('.Tabs__tab')[nextIdx]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
75
74
|
activateOnFocus && activateTab(nextIdx);
|
|
75
|
+
(_b = wrapperProps.onKeyDown) === null || _b === void 0 ? void 0 : _b.call(wrapperProps, e);
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
const [ref] = useSeenEffect(startSeen);
|
|
@@ -85,7 +85,7 @@ export const Tabs = (props) => {
|
|
|
85
85
|
listAriaControls,
|
|
86
86
|
isBrowser,
|
|
87
87
|
};
|
|
88
|
-
return (React.createElement("div", { className: modifiedClass('Tabs', vertical && 'vertical'), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref },
|
|
88
|
+
return (React.createElement("div", Object.assign({}, props.wrapperProps, { className: modifiedClass('Tabs', vertical && 'vertical', wrapperProps.className), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref }),
|
|
89
89
|
tabs.map((tabProps, index) => renderTab(tabProps, index, listProps)),
|
|
90
90
|
subTabs && (React.createElement(Tabs, Object.assign({}, subTabs, { role: 'role' in subTabs ? subTabs.role : role, activateOnFocus: (_a = subTabs.activateOnFocus) !== null && _a !== void 0 ? _a : activateOnFocus, ssr: (_b = subTabs.ssr) !== null && _b !== void 0 ? _b : ssr, startSeen: true,
|
|
91
91
|
// just to be sure
|
package/esm/TagPill.js
CHANGED
|
@@ -9,6 +9,8 @@ const colors = {
|
|
|
9
9
|
orange: 'color--orange',
|
|
10
10
|
red: 'color--red',
|
|
11
11
|
};
|
|
12
|
+
// NOTE: As a `_abstract/_Button.tsx`-derived component, all `<button/>` and
|
|
13
|
+
// `<a/>` props are allowed directly, so adding `wrapperProps` makes no sense.
|
|
12
14
|
export const TagPill = (props) => {
|
|
13
15
|
const { modifier, large, removable, onRemove, children, color = 'normal', label = children, removeLabel = 'x', removeLabelLong = removeLabel } = props, buttonProps = __rest(props, ["modifier", "large", "removable", "onRemove", "children", "color", "label", "removeLabel", "removeLabelLong"]);
|
|
14
16
|
const isStatic = !('href' in props || 'type' in props || props.onClick);
|
package/esm/TextBlock.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
3
|
import { ComponentLayoutProps } from './constants.js';
|
|
4
|
+
import { WrapperElmProps } from './utils.js';
|
|
4
5
|
export type TextBlockProps = ComponentLayoutProps & {
|
|
5
6
|
/** Make H2 headings float to the left
|
|
6
7
|
*
|
|
@@ -10,6 +11,6 @@ export type TextBlockProps = ComponentLayoutProps & {
|
|
|
10
11
|
/** Sets a smaller text-size */
|
|
11
12
|
small?: boolean;
|
|
12
13
|
children: ReactNode;
|
|
13
|
-
} & SeenProp;
|
|
14
|
+
} & WrapperElmProps & SeenProp;
|
|
14
15
|
export declare const TextBlock: (props: TextBlockProps) => JSX.Element;
|
|
15
16
|
export default TextBlock;
|
package/esm/TextBlock.js
CHANGED
|
@@ -2,14 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
4
|
export const TextBlock = (props) => {
|
|
5
|
-
const { children, align, labelled, wide, small, startSeen } = props;
|
|
5
|
+
const { children, align, labelled, wide, small, startSeen, wrapperProps } = props;
|
|
6
6
|
const rightAligned = align === 'right' || labelled;
|
|
7
7
|
const [ref] = useSeenEffect(startSeen);
|
|
8
|
-
return (React.createElement("div", { className: modifiedClass('TextBlock', [
|
|
8
|
+
return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('TextBlock', [
|
|
9
9
|
labelled && 'labelled',
|
|
10
10
|
rightAligned && 'align--right',
|
|
11
11
|
wide && !rightAligned && 'wide',
|
|
12
12
|
small && !labelled && 'small',
|
|
13
|
-
]), ref: ref }, children));
|
|
13
|
+
], (wrapperProps || {}).className), ref: ref }), children));
|
|
14
14
|
};
|
|
15
15
|
export default TextBlock;
|
package/esm/TextButton.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Button } from './_abstract/_Button.js';
|
|
3
|
+
// NOTE: As a `_abstract/_Button.tsx`-derived component, all `<button/>` and
|
|
4
|
+
// `<a/>` props are allowed directly, so adding `wrapperProps` makes no sense.
|
|
3
5
|
export const TextButton = (props) => {
|
|
4
6
|
if ('disabled' in props) {
|
|
5
7
|
props = Object.assign(Object.assign({}, props), { disabled: undefined });
|
package/esm/TextInput.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { RefObject } from 'react';
|
|
|
2
2
|
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
3
|
type InputElmProps = JSX.IntrinsicElements['input'];
|
|
4
4
|
type TextareaElmProps = JSX.IntrinsicElements['textarea'];
|
|
5
|
-
export type TextInputProps = {
|
|
5
|
+
export type TextInputProps = FormFieldWrappingProps & {
|
|
6
6
|
small?: boolean;
|
|
7
|
-
} &
|
|
7
|
+
} & (({
|
|
8
8
|
type?: 'text' | 'email' | 'tel' | 'number' | 'date' | 'url' | 'password' | 'search';
|
|
9
9
|
inputRef?: RefObject<HTMLInputElement>;
|
|
10
10
|
} & InputElmProps) | ({
|