@reykjavik/hanna-react 0.10.76 → 0.10.77
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 +3 -3
- package/AccordionList.js +1 -1
- package/ActionCards.d.ts +2 -2
- package/Alert.d.ts +4 -4
- package/Alert.js +4 -4
- package/ArticleCards.d.ts +3 -3
- package/ArticleCarousel/_ArticleCarouselCard.d.ts +2 -2
- package/ArticleCarousel.d.ts +2 -2
- package/ArticleMeta.d.ts +2 -2
- package/Attention.d.ts +1 -1
- package/BasicTable.d.ts +1 -1
- package/BgBox.d.ts +1 -1
- package/Bling.d.ts +5 -5
- package/BlockQuote.d.ts +1 -1
- package/BreadCrumbs.d.ts +3 -3
- package/ButtonBack.d.ts +1 -1
- package/ButtonBar.d.ts +1 -1
- package/ButtonPrimary.d.ts +1 -1
- package/ButtonSecondary.d.ts +1 -1
- package/ButtonTertiary.d.ts +3 -3
- package/CHANGELOG.md +15 -1
- package/CarouselStepper.d.ts +1 -1
- package/CenterColumn.d.ts +1 -1
- package/Checkbox.d.ts +1 -1
- package/CheckboxButton.d.ts +4 -0
- package/CheckboxButton.js +9 -0
- package/CheckboxButtonsGroup.d.ts +3 -2
- package/CheckboxButtonsGroup.js +2 -3
- package/CheckboxGroup.d.ts +4 -3
- package/CityBlock.d.ts +1 -1
- package/ContactBubble.d.ts +5 -5
- package/ContactBubble.js +2 -1
- package/ContentArticle.d.ts +1 -1
- package/ContentArticle.js +4 -2
- package/ContentImage.d.ts +1 -1
- package/Datepicker.d.ts +2 -2
- package/Datepicker.js +5 -5
- package/ExtraLinks.d.ts +4 -4
- package/FeatureList.d.ts +1 -1
- package/FieldGroup.d.ts +1 -1
- package/FileInput/_FileInput.utils.d.ts +1 -1
- package/FileInput/_FileInputFileList.d.ts +1 -1
- package/FileInput.d.ts +1 -1
- package/Foonote.d.ts +1 -1
- package/FooterBadges.d.ts +1 -1
- package/FooterInfo.d.ts +3 -3
- package/Footnote.d.ts +1 -1
- package/Form.d.ts +1 -1
- package/FormField.d.ts +8 -8
- package/FormField.js +7 -6
- package/Gallery/_GalleryItem.d.ts +1 -1
- package/Gallery/_GalleryModal.d.ts +1 -1
- package/Gallery/_GalleryModalContext.d.ts +1 -1
- package/Gallery.d.ts +3 -3
- package/GridBlocks.d.ts +3 -3
- package/Heading.d.ts +2 -2
- package/HeroBlock.d.ts +2 -2
- package/IframeBlock.d.ts +1 -1
- package/Illustration.d.ts +1 -1
- package/ImageCards.d.ts +3 -3
- package/InfoBlock.d.ts +1 -1
- package/InfoHero.d.ts +2 -2
- package/IslandBlock.d.ts +4 -4
- package/IslandPageBlock.d.ts +3 -3
- package/LabeledTextBlock.d.ts +1 -1
- package/Layout.d.ts +3 -3
- package/Layout.js +2 -2
- package/MainMenu/_Auxiliary.d.ts +2 -2
- package/MainMenu/_PrimaryPanel.d.ts +1 -1
- package/MainMenu.d.ts +8 -8
- package/MainMenu.js +2 -2
- package/MiniMetrics.d.ts +1 -1
- package/Modal.d.ts +1 -1
- package/NameCard.d.ts +4 -4
- package/NameCards.d.ts +1 -1
- package/NewsHero.d.ts +2 -2
- package/PageFilter.d.ts +1 -1
- package/PageHeading.d.ts +1 -1
- package/Picture.d.ts +1 -1
- package/ProcessOverview.d.ts +2 -2
- package/PullQuote.d.ts +1 -1
- package/README.md +1 -1
- package/RadioButtonsGroup.d.ts +3 -2
- package/RadioButtonsGroup.js +2 -2
- package/RadioGroup.d.ts +5 -4
- package/RadioGroup.js +1 -1
- package/RelatedLinks.d.ts +3 -3
- package/RowBlock.d.ts +1 -1
- package/RowBlockColumn.d.ts +1 -1
- package/SearchInput.d.ts +3 -3
- package/SearchResults/_SearchResultsItem.d.ts +2 -2
- package/SearchResults.d.ts +4 -4
- package/SeenEffect.d.ts +1 -1
- package/Selectbox.d.ts +2 -2
- package/ShareButtons.d.ts +2 -2
- package/Sharpie.d.ts +3 -3
- package/SiteSearchAutocomplete.d.ts +2 -2
- package/SiteSearchCurtain.d.ts +2 -2
- package/SiteSearchCurtain.js +7 -12
- package/SiteSearchInput.d.ts +5 -5
- package/Skeleton.d.ts +3 -3
- package/SubHeading.d.ts +1 -1
- package/Tabs.d.ts +6 -6
- package/Tabs.js +2 -2
- package/TagPill.d.ts +2 -2
- package/TextBlock.d.ts +1 -1
- package/TextButton.d.ts +1 -1
- package/TextInput.d.ts +3 -3
- package/VSpacer.d.ts +3 -3
- package/VerticalTabsTOC.d.ts +3 -3
- package/WizardLayout.d.ts +2 -2
- package/WizardLayout.js +2 -2
- package/WizardStepper.d.ts +2 -2
- package/_abstract/_AbstractCarousel.d.ts +3 -3
- package/_abstract/_AbstractCarousel.js +2 -2
- package/_abstract/_Blings.d.ts +2 -2
- package/_abstract/_Block.d.ts +4 -4
- package/_abstract/_Button.d.ts +9 -9
- package/_abstract/_CardList.d.ts +8 -8
- package/_abstract/_Image.d.ts +5 -5
- package/_abstract/_Link.d.ts +8 -8
- package/_abstract/_Link.js +3 -3
- package/_abstract/_Quote.d.ts +1 -1
- package/_abstract/_TogglerGroup.d.ts +7 -5
- package/_abstract/_TogglerGroup.js +14 -16
- package/_abstract/_TogglerGroupField.d.ts +6 -4
- package/_abstract/_TogglerGroupField.js +9 -3
- package/_abstract/_TogglerInput.d.ts +3 -2
- package/_abstract/_TogglerInput.js +9 -7
- package/assets.d.ts +4 -4
- package/constants.d.ts +2 -2
- package/index.d.ts +1 -0
- package/package.json +6 -6
- package/utils/browserSide.d.ts +1 -0
- package/utils/browserSide.js +6 -0
- package/utils/config.d.ts +2 -0
- package/utils/config.js +3 -4
- package/utils/seenEffect.d.ts +3 -3
- package/utils/useGetSVGtext.d.ts +1 -1
- package/utils/useMenuToggling.d.ts +1 -1
- package/utils/useMixedControlState.d.ts +5 -5
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
package/_abstract/_Button.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { BemProps, BemPropsModifier } from '@hugsmidjan/react/types';
|
|
3
|
-
|
|
3
|
+
type ButtonElmProps = {
|
|
4
4
|
href?: never;
|
|
5
5
|
} & BemPropsModifier & Omit<JSX.IntrinsicElements['button'], 'className' | 'style'>;
|
|
6
|
-
|
|
6
|
+
type AnchorElmProps = {
|
|
7
7
|
href: string;
|
|
8
8
|
type?: never;
|
|
9
9
|
name?: never;
|
|
10
10
|
value?: never;
|
|
11
11
|
} & BemPropsModifier & Omit<JSX.IntrinsicElements['a'], 'className' | 'style'>;
|
|
12
|
-
export
|
|
12
|
+
export type ButtonProps = {
|
|
13
13
|
/** Label takes preference over `children` */
|
|
14
14
|
label?: string | JSX.Element;
|
|
15
15
|
} & (ButtonElmProps | AnchorElmProps);
|
|
@@ -18,22 +18,22 @@ declare const sizes: {
|
|
|
18
18
|
readonly small: "small";
|
|
19
19
|
readonly wide: "wide";
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
type ButtonSize = keyof typeof sizes;
|
|
22
22
|
declare const variants: {
|
|
23
23
|
readonly normal: "";
|
|
24
24
|
readonly destructive: "destructive";
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export
|
|
26
|
+
type ButtonVariant = keyof typeof variants;
|
|
27
|
+
type NavigationFlag = 'none' | 'go-back' | 'go-forward';
|
|
28
|
+
type ButtonIcon = 'edit';
|
|
29
|
+
export type ButtonVariantProps = {
|
|
30
30
|
size?: ButtonSize;
|
|
31
31
|
variant?: ButtonVariant;
|
|
32
32
|
icon?: ButtonIcon | NavigationFlag;
|
|
33
33
|
/** @deprecated (Will be removed in v0.11) */
|
|
34
34
|
small?: boolean;
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
type _ButtonProps = ButtonProps & ButtonVariantProps & BemProps & {
|
|
37
37
|
children?: ReactNode;
|
|
38
38
|
};
|
|
39
39
|
export declare const Button: (props: _ButtonProps) => JSX.Element;
|
package/_abstract/_CardList.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
3
3
|
import { ImageProps } from './_Image';
|
|
4
|
-
|
|
4
|
+
type BaseCardProps = {
|
|
5
5
|
title: string;
|
|
6
6
|
href: string;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ImageCardProps = BaseCardProps & {
|
|
9
9
|
meta?: string;
|
|
10
10
|
image?: ImageProps;
|
|
11
11
|
imgPlaceholder?: boolean;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type TextCardProps = BaseCardProps & {
|
|
14
14
|
summary?: string;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type CardListProps<T> = {
|
|
17
17
|
cards: Array<T>;
|
|
18
18
|
title?: string | undefined;
|
|
19
19
|
titleTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'p';
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type CardListSummaryProps = {
|
|
22
22
|
summaryElement?: ReactElement;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type ImageCardListProps = CardListProps<ImageCardProps> & {
|
|
25
25
|
imgPlaceholder?: boolean | string;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
28
|
-
|
|
27
|
+
export type TextCardListProps = CardListProps<TextCardProps>;
|
|
28
|
+
type _CardListProps = EitherObj<ImageCardListProps, TextCardListProps> & CardListSummaryProps & {
|
|
29
29
|
bemPrefix: string;
|
|
30
30
|
children?: ReactNode;
|
|
31
31
|
standalone?: boolean;
|
package/_abstract/_Image.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Source = {
|
|
2
2
|
srcset: string;
|
|
3
3
|
media: string;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ImagePropsLinked = {
|
|
6
6
|
altText?: string;
|
|
7
7
|
sources?: Array<Source>;
|
|
8
8
|
/** The default image source to (lazy) load */
|
|
@@ -12,7 +12,7 @@ export declare type ImagePropsLinked = {
|
|
|
12
12
|
inline?: false;
|
|
13
13
|
focalPoint?: string;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type ImagePropsInlinedSvg = {
|
|
16
16
|
altText?: string;
|
|
17
17
|
/** Should the image be fetched and inlined as <svg/> */
|
|
18
18
|
inline: true;
|
|
@@ -21,8 +21,8 @@ export declare type ImagePropsInlinedSvg = {
|
|
|
21
21
|
preloadSrc?: undefined;
|
|
22
22
|
focalPoint?: undefined;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
25
|
-
|
|
24
|
+
export type ImageProps = ImagePropsLinked | ImagePropsInlinedSvg;
|
|
25
|
+
type _ImageProps = {
|
|
26
26
|
/** container className */
|
|
27
27
|
className: string | undefined;
|
|
28
28
|
/** Controls if the container is rendered when image is missing/undefined.
|
package/_abstract/_Link.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type HTMLAnchorProps = JSX.IntrinsicElements['a'];
|
|
2
|
+
type LinkProps = HTMLAnchorProps & {
|
|
3
3
|
href: string;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type _LinkRenderer_internal = (props: LinkProps) => JSX.Element;
|
|
6
6
|
export declare let Link: _LinkRenderer_internal;
|
|
7
7
|
/**
|
|
8
8
|
* Props object ready to be ..spread onto an anchor element
|
|
9
9
|
* */
|
|
10
|
-
export
|
|
10
|
+
export type LinkRendererProps = Omit<LinkProps, 'ref'> & {
|
|
11
11
|
ref: Exclude<HTMLAnchorProps['ref'], string>;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type LinkRenderer = (props: LinkRendererProps) => JSX.Element;
|
|
14
14
|
/**
|
|
15
15
|
* Allows you to set a callback function to wrapp <a href=""/> links with
|
|
16
16
|
* a custom routing component.
|
|
@@ -37,7 +37,7 @@ export declare type LinkRenderer = (props: LinkRendererProps) => JSX.Element;
|
|
|
37
37
|
* setLinkRenderer.pop(); // reset link rendering
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
|
-
* The
|
|
40
|
+
* The default linkrenderer is defined as:
|
|
41
41
|
*
|
|
42
42
|
* ```js
|
|
43
43
|
* (linkProps) => React.createElement('a', linkProps);
|
|
@@ -47,13 +47,13 @@ export declare type LinkRenderer = (props: LinkRendererProps) => JSX.Element;
|
|
|
47
47
|
* as an argument — like so:
|
|
48
48
|
*
|
|
49
49
|
* ```js
|
|
50
|
-
* setLinkRenderer(undefined);
|
|
50
|
+
* setLinkRenderer(undefined); // pushes the default linkrenderer to the stack
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
53
|
export declare const setLinkRenderer: {
|
|
54
54
|
(linkRenderer: LinkRenderer | undefined): void;
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* Unsets the last pushed custom renderer
|
|
57
57
|
*/
|
|
58
58
|
pop(): void;
|
|
59
59
|
};
|
package/_abstract/_Link.js
CHANGED
|
@@ -32,7 +32,7 @@ const history = [];
|
|
|
32
32
|
* setLinkRenderer.pop(); // reset link rendering
|
|
33
33
|
* ```
|
|
34
34
|
*
|
|
35
|
-
* The
|
|
35
|
+
* The default linkrenderer is defined as:
|
|
36
36
|
*
|
|
37
37
|
* ```js
|
|
38
38
|
* (linkProps) => React.createElement('a', linkProps);
|
|
@@ -42,7 +42,7 @@ const history = [];
|
|
|
42
42
|
* as an argument — like so:
|
|
43
43
|
*
|
|
44
44
|
* ```js
|
|
45
|
-
* setLinkRenderer(undefined);
|
|
45
|
+
* setLinkRenderer(undefined); // pushes the default linkrenderer to the stack
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
const setLinkRenderer = (linkRenderer) => {
|
|
@@ -61,7 +61,7 @@ const setLinkRenderer = (linkRenderer) => {
|
|
|
61
61
|
};
|
|
62
62
|
exports.setLinkRenderer = setLinkRenderer;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Unsets the last pushed custom renderer
|
|
65
65
|
*/
|
|
66
66
|
exports.setLinkRenderer.pop = () => {
|
|
67
67
|
history.shift();
|
package/_abstract/_Quote.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FormFieldInputProps } from '../FormField';
|
|
2
2
|
import { TogglerInputProps } from './_TogglerInput';
|
|
3
|
-
export
|
|
3
|
+
export type TogglerGroupOption = {
|
|
4
4
|
value: string;
|
|
5
5
|
label?: string | JSX.Element;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
id?: string;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
export
|
|
9
|
+
export type TogglerGroupOptions = Array<TogglerGroupOption>;
|
|
10
|
+
type RestrictedInputProps = Omit<JSX.IntrinsicElements['input'], 'type' | 'value' | 'defaultValue' | 'checked' | 'defaultChecked' | 'className' | 'id' | 'name' | 'children'>;
|
|
11
|
+
export type TogglerGroupProps = {
|
|
12
12
|
options: TogglerGroupOptions;
|
|
13
13
|
className?: string;
|
|
14
14
|
name: string;
|
|
@@ -21,10 +21,12 @@ export declare type TogglerGroupProps = {
|
|
|
21
21
|
selectedValues: Array<string>;
|
|
22
22
|
}) => void;
|
|
23
23
|
} & Omit<FormFieldInputProps, 'disabled'>;
|
|
24
|
-
|
|
24
|
+
type _TogglerGroupProps = {
|
|
25
25
|
bem: string;
|
|
26
26
|
Toggler: (props: TogglerInputProps) => JSX.Element;
|
|
27
27
|
value?: ReadonlyArray<string>;
|
|
28
|
+
defaultValue?: ReadonlyArray<string>;
|
|
29
|
+
isRadio?: true;
|
|
28
30
|
};
|
|
29
31
|
export declare const TogglerGroup: (props: TogglerGroupProps & _TogglerGroupProps) => JSX.Element;
|
|
30
32
|
export {};
|
|
@@ -4,32 +4,30 @@ exports.TogglerGroup = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
7
|
+
const utils_1 = require("../utils");
|
|
7
8
|
const TogglerGroup = (props) => {
|
|
8
9
|
const {
|
|
9
10
|
// id,
|
|
10
|
-
className, bem, name, disabled, Toggler, onSelected, options, inputProps = {}, } = props;
|
|
11
|
-
const values = props
|
|
11
|
+
className, bem, name, disabled, Toggler, onSelected, options, isRadio, inputProps = {}, } = props;
|
|
12
|
+
const [values, setValues] = (0, utils_1.useMixedControlState)(props, 'value', []);
|
|
12
13
|
return (react_1.default.createElement("ul", { className: (0, getBemClass_1.default)(bem, null, className), role: "group", "aria-labelledby": props['aria-labelledby'], "aria-describedby": props['aria-describedby'], "aria-required": props.required }, options.map((option, i) => {
|
|
13
14
|
const isDisabled = option.disabled != null
|
|
14
15
|
? option.disabled
|
|
15
16
|
: disabled && typeof disabled !== 'boolean'
|
|
16
17
|
? disabled.includes(i)
|
|
17
18
|
: disabled;
|
|
18
|
-
const isChecked = values
|
|
19
|
-
return (react_1.default.createElement(Toggler, Object.assign({ key: i }, inputProps, { className: bem + '__item', name: name, Wrapper: "li" }, option, { label: option.label || option.value, onChange:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
: [];
|
|
27
|
-
if (checked) {
|
|
28
|
-
selectedValues.push(value);
|
|
29
|
-
}
|
|
30
|
-
onSelected({ value, checked, option, selectedValues });
|
|
19
|
+
const isChecked = values.includes(option.value);
|
|
20
|
+
return (react_1.default.createElement(Toggler, Object.assign({ key: i }, inputProps, { className: bem + '__item', name: name, Wrapper: "li" }, option, { label: option.label || option.value, onChange: (e) => {
|
|
21
|
+
inputProps.onChange && inputProps.onChange(e);
|
|
22
|
+
const { value } = option;
|
|
23
|
+
const checked = e.currentTarget.checked;
|
|
24
|
+
const selectedValues = isRadio ? [] : values.filter((val) => val !== value);
|
|
25
|
+
if (checked) {
|
|
26
|
+
selectedValues.push(value);
|
|
31
27
|
}
|
|
32
|
-
|
|
28
|
+
setValues(selectedValues);
|
|
29
|
+
onSelected && onSelected({ value, checked, option, selectedValues });
|
|
30
|
+
}, disabled: isDisabled, "aria-invalid": props['aria-invalid'], checked: isChecked })));
|
|
33
31
|
})));
|
|
34
32
|
};
|
|
35
33
|
exports.TogglerGroup = TogglerGroup;
|
|
@@ -3,15 +3,17 @@ import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
|
3
3
|
import { FormFieldGroupWrappingProps } from '../FormField';
|
|
4
4
|
import { TogglerGroupOption, TogglerGroupOptions, TogglerGroupProps } from './_TogglerGroup';
|
|
5
5
|
import { TogglerInputProps } from './_TogglerInput';
|
|
6
|
-
export
|
|
6
|
+
export type TogglerGroupFieldProps = {
|
|
7
7
|
className?: string;
|
|
8
8
|
} & FormFieldGroupWrappingProps & TogglerGroupProps;
|
|
9
|
-
|
|
9
|
+
type _TogglerGroupFieldProps = {
|
|
10
10
|
Toggler: (props: TogglerInputProps) => ReactElement;
|
|
11
|
+
isRadio?: true;
|
|
11
12
|
value?: string | ReadonlyArray<string>;
|
|
13
|
+
defaultValue?: string | ReadonlyArray<string>;
|
|
12
14
|
bem: string;
|
|
13
15
|
} & BemPropsModifier;
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
+
export type TogglerGroupFieldOption = TogglerGroupOption;
|
|
17
|
+
export type TogglerGroupFieldOptions = TogglerGroupOptions;
|
|
16
18
|
export declare const TogglerGroupField: (props: TogglerGroupFieldProps & _TogglerGroupFieldProps) => JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TogglerGroupField = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
7
7
|
const FormField_1 = tslib_1.__importDefault(require("../FormField"));
|
|
8
8
|
const _TogglerGroup_1 = require("./_TogglerGroup");
|
|
9
9
|
const TogglerGroupField = (props) => {
|
|
10
|
-
const { bem, Toggler, className, modifier, label, LabelTag, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, value } = props, togglerGroupProps = tslib_1.__rest(props, ["bem", "Toggler", "className", "modifier", "label", "LabelTag", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "value"]);
|
|
10
|
+
const { bem, Toggler, className, modifier, label, LabelTag, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, value, defaultValue } = props, togglerGroupProps = tslib_1.__rest(props, ["bem", "Toggler", "className", "modifier", "label", "LabelTag", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "value", "defaultValue"]);
|
|
11
|
+
const _value = (0, react_1.useMemo)(() => (value == null ? undefined : typeof value === 'string' ? [value] : value), [value]);
|
|
12
|
+
const _defaultValue = (0, react_1.useMemo)(() => defaultValue == null
|
|
13
|
+
? undefined
|
|
14
|
+
: typeof defaultValue === 'string'
|
|
15
|
+
? [defaultValue]
|
|
16
|
+
: defaultValue, [defaultValue]);
|
|
11
17
|
return (react_1.default.createElement(FormField_1.default, { className: (0, getBemClass_1.default)(bem, modifier, className), group: true, label: label, LabelTag: LabelTag, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps) => {
|
|
12
|
-
return (react_1.default.createElement(_TogglerGroup_1.TogglerGroup, Object.assign({ bem: className.options }, inputProps, togglerGroupProps, { value:
|
|
18
|
+
return (react_1.default.createElement(_TogglerGroup_1.TogglerGroup, Object.assign({ bem: className.options }, inputProps, togglerGroupProps, { value: _value, defaultValue: _defaultValue, Toggler: Toggler })));
|
|
13
19
|
} }));
|
|
14
20
|
};
|
|
15
21
|
exports.TogglerGroupField = TogglerGroupField;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
2
|
-
export
|
|
2
|
+
export type TogglerInputProps = {
|
|
3
3
|
label: string | JSX.Element;
|
|
4
4
|
children?: never;
|
|
5
5
|
Wrapper?: 'div' | 'li';
|
|
@@ -14,9 +14,10 @@ export declare type TogglerInputProps = {
|
|
|
14
14
|
reqText?: string | false;
|
|
15
15
|
errorMessage?: string | JSX.Element;
|
|
16
16
|
} & BemPropsModifier & Omit<JSX.IntrinsicElements['input'], 'type'>;
|
|
17
|
-
|
|
17
|
+
type _TogglerInputProps = {
|
|
18
18
|
bem: string;
|
|
19
19
|
type: 'radio' | 'checkbox';
|
|
20
|
+
innerWrap?: boolean;
|
|
20
21
|
};
|
|
21
22
|
export declare const TogglerInput: (props: TogglerInputProps & _TogglerInputProps) => JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -2,25 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TogglerInput = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
7
7
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
8
8
|
const TogglerInput = (props) => {
|
|
9
|
-
const { bem, modifier, className, label, invalid, errorMessage, Wrapper = 'div', required, reqText, type, id } = props, inputProps = tslib_1.__rest(props, ["bem", "modifier", "className", "label", "invalid", "errorMessage", "Wrapper", "required", "reqText", "type", "id"]);
|
|
9
|
+
const { bem, modifier, className, label, invalid, errorMessage, Wrapper = 'div', required, reqText, type, id, innerWrap } = props, inputProps = tslib_1.__rest(props, ["bem", "modifier", "className", "label", "invalid", "errorMessage", "Wrapper", "required", "reqText", "type", "id", "innerWrap"]);
|
|
10
10
|
const domid = (0, hooks_1.useDomid)(id);
|
|
11
11
|
const errorId = errorMessage && 'error' + domid;
|
|
12
12
|
const reqStar = required && reqText !== false && (react_1.default.createElement("abbr", { className: bem + '__label__reqstar',
|
|
13
13
|
// TODO: add mo-better i18n thinking
|
|
14
14
|
title: (reqText || 'Þarf að haka í') + ': ' }, "*"));
|
|
15
|
+
const InnerWrap = innerWrap ? 'span' : react_1.Fragment;
|
|
15
16
|
return (react_1.default.createElement(Wrapper, { className: (0, getBemClass_1.default)(bem, modifier, className) },
|
|
16
17
|
react_1.default.createElement("input", Object.assign({ className: bem + '__input', type: type, id: domid, "aria-invalid": invalid || !!errorMessage || undefined, "aria-describedby": errorId }, inputProps)),
|
|
17
18
|
' ',
|
|
18
19
|
react_1.default.createElement("label", { className: bem + '__label', htmlFor: domid },
|
|
19
|
-
'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
react_1.default.createElement(InnerWrap, { className: bem + '__label__wrap' },
|
|
21
|
+
' ',
|
|
22
|
+
reqStar,
|
|
23
|
+
" ",
|
|
24
|
+
label,
|
|
25
|
+
' ')),
|
|
24
26
|
errorMessage && (react_1.default.createElement("div", { className: bem + '__error', id: errorId }, errorMessage))));
|
|
25
27
|
};
|
|
26
28
|
exports.TogglerInput = TogglerInput;
|
package/assets.d.ts
CHANGED
|
@@ -31,12 +31,12 @@ export declare const getCssBundleUrl: (cssTokens: string | Array<string>, versio
|
|
|
31
31
|
/** @deprecated (Will be removed in v0.11) */
|
|
32
32
|
export declare const efnistakn_menu: readonly ["menu/borgarstjori", "menu/borgarstjorn", "menu/bygg_framkv", "menu/fjarmal", "menu/fundargerdir", "menu/itrottir_aftreying", "menu/log_reglugerdir", "menu/mannaudur", "menu/menning", "menu/rad_nefndir", "menu/skipulag", "menu/skolar_fristund", "menu/svid_deildir", "menu/umhverfi_samgongur", "menu/velferd_fjolskylda"];
|
|
33
33
|
/** @deprecated (Will be removed in v0.11) */
|
|
34
|
-
export
|
|
34
|
+
export type Efnistakn_Menu = typeof efnistakn_menu[number];
|
|
35
35
|
/** @deprecated (Will be removed in v0.11) */
|
|
36
36
|
export declare const auxiliary_menu_images: Array<Illustration>;
|
|
37
37
|
/** @deprecated Instead `import type { AuxilaryPanelIllustration } from '@reykjavik/hanna-react/MainMenu';` (Will be removed in v0.11) */
|
|
38
|
-
export
|
|
38
|
+
export type Auxilary_MenuImages = typeof auxiliary_menu_images[number];
|
|
39
39
|
/** @deprecated Instead `import type { BlingType } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
40
|
-
export
|
|
40
|
+
export type BlingTypes = BlingType;
|
|
41
41
|
/** @deprecated Instead `import type { Illustration } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
42
|
-
export
|
|
42
|
+
export type Illustrations = Illustration;
|
package/constants.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ export type { ColorFamily } from '@reykjavik/hanna-css';
|
|
|
10
10
|
export declare const themeOptions: readonly ["trustworthy", "dependable", "friendly", "lively", "colorful"] & Readonly<Record<import("@reykjavik/hanna-css").HannaColorTheme, import("@reykjavik/hanna-css").HannaColorTheme>>;
|
|
11
11
|
/** @depcrecated import type `HannaColorTheme` from `@reykjavik/hanna-css` instead (Will be removed in v0.11) */
|
|
12
12
|
export type { HannaColorTheme as ThemeOption } from '@reykjavik/hanna-css';
|
|
13
|
-
export
|
|
13
|
+
export type Alignment = 'right' | 'left';
|
|
14
14
|
export declare const aligns: Record<string, true | undefined>;
|
|
15
|
-
export
|
|
15
|
+
export type ComponentLayoutProps<Align extends string = 'right'> = EitherObj<{
|
|
16
16
|
wide?: boolean;
|
|
17
17
|
}, {
|
|
18
18
|
align?: Align;
|
package/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
/// <reference path="./CarouselStepper.d.tsx" />
|
|
22
22
|
/// <reference path="./CenterColumn.d.tsx" />
|
|
23
23
|
/// <reference path="./Checkbox.d.tsx" />
|
|
24
|
+
/// <reference path="./CheckboxButton.d.tsx" />
|
|
24
25
|
/// <reference path="./CheckboxButtonsGroup.d.tsx" />
|
|
25
26
|
/// <reference path="./CheckboxGroup.d.tsx" />
|
|
26
27
|
/// <reference path="./CityBlock.d.tsx" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reykjavik/hanna-react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.77",
|
|
4
4
|
"author": "Reykjavík (http://www.reykjavik.is)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Hugsmiðjan ehf (http://www.hugsmidjan.is)",
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@hugsmidjan/qj": "^4.10.2",
|
|
17
|
-
"@hugsmidjan/react": "^0.4.
|
|
18
|
-
"@reykjavik/hanna-css": "^0.3.
|
|
19
|
-
"@reykjavik/hanna-utils": "^0.2.
|
|
17
|
+
"@hugsmidjan/react": "^0.4.23",
|
|
18
|
+
"@reykjavik/hanna-css": "^0.3.11",
|
|
19
|
+
"@reykjavik/hanna-utils": "^0.2.1",
|
|
20
20
|
"@types/react": "^17.0.24",
|
|
21
21
|
"@types/react-autosuggest": "^10.1.0",
|
|
22
|
-
"@types/react-datepicker": "^
|
|
22
|
+
"@types/react-datepicker": "^4.8.0",
|
|
23
23
|
"@types/react-dom": "^17.0.9",
|
|
24
24
|
"@types/react-transition-group": "^4.4.0",
|
|
25
25
|
"iframe-resizer-react": "^1.1.0",
|
|
26
26
|
"react-autosuggest": "^10.1.0",
|
|
27
|
-
"react-datepicker": "^
|
|
27
|
+
"react-datepicker": "^4.8.0",
|
|
28
28
|
"react-dropzone": "^10.2.2",
|
|
29
29
|
"react-intersection-observer": "^8.30.1",
|
|
30
30
|
"react-transition-group": "^4.4.1"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useIsBrowserSide, useIsServerSide } from '@hugsmidjan/react/hooks';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsServerSide = exports.useIsBrowserSide = void 0;
|
|
4
|
+
var hooks_1 = require("@hugsmidjan/react/hooks");
|
|
5
|
+
Object.defineProperty(exports, "useIsBrowserSide", { enumerable: true, get: function () { return hooks_1.useIsBrowserSide; } });
|
|
6
|
+
Object.defineProperty(exports, "useIsServerSide", { enumerable: true, get: function () { return hooks_1.useIsServerSide; } });
|
package/utils/config.d.ts
CHANGED
package/utils/config.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setLinkRenderer = void 0;
|
|
3
|
+
exports.setDefaultSSR = exports.setLinkRenderer = void 0;
|
|
4
4
|
var _Link_1 = require("../_abstract/_Link");
|
|
5
5
|
Object.defineProperty(exports, "setLinkRenderer", { enumerable: true, get: function () { return _Link_1.setLinkRenderer; } });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// * Add defaultSSR variable that can be set globally for
|
|
6
|
+
var hooks_1 = require("@hugsmidjan/react/hooks");
|
|
7
|
+
Object.defineProperty(exports, "setDefaultSSR", { enumerable: true, get: function () { return hooks_1.setDefaultSSR; } });
|
package/utils/seenEffect.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ declare const effects: {
|
|
|
9
9
|
readonly fadeup: 1;
|
|
10
10
|
readonly fadeleft: 1;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
12
|
+
export type SeenEffectType = keyof typeof effects;
|
|
13
|
+
export type EffectProp = {
|
|
14
14
|
/** Should the component appear instantly, and not transition-in once seen */
|
|
15
15
|
effectType?: SeenEffectType | 'none';
|
|
16
16
|
};
|
|
@@ -19,7 +19,7 @@ export declare const ensureEffectType: (maybeType?: string) => SeenEffectType |
|
|
|
19
19
|
export declare const getEffectAttr: (maybeType?: string) => {
|
|
20
20
|
'data-seen-effect': string | undefined;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type SeenProp = {
|
|
23
23
|
/** Should the component appear instantly, and not transition-in once seen */
|
|
24
24
|
startSeen?: boolean;
|
|
25
25
|
};
|
package/utils/useGetSVGtext.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
type CtrlMode = 'controlled' | 'uncontrolled' | undefined;
|
|
3
|
+
type RetArray<R> = [value: R, setValue: Dispatch<SetStateAction<R>>, mode: CtrlMode];
|
|
4
|
+
type DefaultProp<N extends string> = `default${Capitalize<N>}`;
|
|
5
|
+
type PropPair<N extends string> = N | DefaultProp<N>;
|
|
6
|
+
type StrictKeys<P extends Record<string, unknown>, N extends string> = PropPair<N> extends keyof P ? P : {
|
|
7
7
|
[Key in PropPair<N>]: P[Key];
|
|
8
8
|
};
|
|
9
9
|
/**
|
package/utils.d.ts
CHANGED
package/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./utils/browserSide"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./utils/config"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./utils/useDidChange"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./utils/useFormatMonitor"), exports);
|