@reykjavik/hanna-react 0.10.113 → 0.10.115
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.js +1 -1
- package/AutosuggestSearch.d.ts +6 -0
- package/AutosuggestSearch.js +19 -3
- package/BasicTable.js +4 -4
- package/BgBox.d.ts +5 -2
- package/BgBox.js +1 -1
- package/Bling.js +4 -4
- package/CHANGELOG.md +16 -0
- package/Carousel.d.ts +1 -1
- package/CarouselStepper.js +2 -2
- package/CheckboxButton.d.ts +1 -1
- package/CityBlock.js +1 -1
- package/ContactBubble.js +5 -3
- package/Datepicker.js +2 -1
- package/FileInput/_FileInput.utils.js +1 -1
- package/FileInput.js +6 -7
- package/Form.js +1 -1
- package/FormField.d.ts +2 -2
- package/FormField.js +1 -1
- package/Heading.js +1 -1
- package/IframeBlock.js +1 -1
- package/InfoHero.js +1 -1
- package/IslandBlock.js +1 -1
- package/IslandPageBlock.js +1 -1
- package/MainMenu.js +3 -1
- package/MainMenu2.js +3 -2
- package/MobileMenuToggler/_useMobileMenuToggling.js +1 -1
- package/Multiselect/_Multiselect.search.d.ts +5 -3
- package/Multiselect/_Multiselect.search.js +4 -5
- package/Multiselect.d.ts +5 -0
- package/Multiselect.js +1 -2
- package/NameCard.js +1 -1
- package/PageHeading.js +1 -1
- package/Pagination.js +2 -2
- package/Radio.d.ts +3 -0
- package/Radio.js +8 -0
- package/RadioGroup.d.ts +1 -7
- package/RadioGroup.js +2 -5
- package/SearchResults/_SearchResultsItem.js +5 -5
- package/SearchResults.js +1 -3
- package/ShareButtons.js +3 -3
- package/SiteSearchAutocomplete.js +6 -6
- package/Skeleton.js +1 -1
- package/SubHeading.js +1 -1
- package/TextInput.js +2 -1
- package/VSpacer.js +1 -1
- package/VerticalTabsTOC.js +1 -1
- package/_abstract/_AbstractCarousel.d.ts +2 -2
- package/_abstract/_AbstractCarousel.js +5 -5
- package/_abstract/_AbstractModal.js +1 -0
- package/_abstract/_Blings.js +1 -1
- package/_abstract/_CardList.js +5 -5
- package/_abstract/_Quote.js +2 -2
- package/_abstract/_Table.js +2 -2
- package/_abstract/_TogglerGroup.js +1 -1
- package/_abstract/_TogglerInput.d.ts +1 -0
- package/_abstract/_TogglerInput.js +10 -9
- package/esm/AccordionList.js +1 -1
- package/esm/AutosuggestSearch.d.ts +6 -0
- package/esm/AutosuggestSearch.js +19 -3
- package/esm/BasicTable.js +4 -4
- package/esm/BgBox.d.ts +5 -2
- package/esm/BgBox.js +1 -1
- package/esm/Bling.js +4 -4
- package/esm/Carousel.d.ts +1 -1
- package/esm/CarouselStepper.js +2 -2
- package/esm/CheckboxButton.d.ts +1 -1
- package/esm/CityBlock.js +1 -1
- package/esm/ContactBubble.js +5 -3
- package/esm/Datepicker.js +2 -1
- package/esm/FileInput/_FileInput.utils.js +1 -1
- package/esm/FileInput.js +6 -7
- package/esm/Form.js +1 -1
- package/esm/FormField.d.ts +2 -2
- package/esm/FormField.js +1 -1
- package/esm/Heading.js +1 -1
- package/esm/IframeBlock.js +1 -1
- package/esm/InfoHero.js +1 -1
- package/esm/IslandBlock.js +1 -1
- package/esm/IslandPageBlock.js +1 -1
- package/esm/MainMenu.js +3 -1
- package/esm/MainMenu2.js +3 -2
- package/esm/MobileMenuToggler/_useMobileMenuToggling.js +1 -1
- package/esm/Multiselect/_Multiselect.search.d.ts +5 -3
- package/esm/Multiselect/_Multiselect.search.js +4 -5
- package/esm/Multiselect.d.ts +5 -0
- package/esm/Multiselect.js +1 -2
- package/esm/NameCard.js +1 -1
- package/esm/PageHeading.js +1 -1
- package/esm/Pagination.js +2 -2
- package/esm/Radio.d.ts +3 -0
- package/esm/Radio.js +3 -0
- package/esm/RadioGroup.d.ts +1 -7
- package/esm/RadioGroup.js +1 -4
- package/esm/SearchResults/_SearchResultsItem.js +5 -5
- package/esm/SearchResults.js +1 -3
- package/esm/ShareButtons.js +3 -3
- package/esm/SiteSearchAutocomplete.js +6 -6
- package/esm/Skeleton.js +1 -1
- package/esm/SubHeading.js +1 -1
- package/esm/TextInput.js +2 -1
- package/esm/VSpacer.js +1 -1
- package/esm/VerticalTabsTOC.js +1 -1
- package/esm/_abstract/_AbstractCarousel.d.ts +2 -2
- package/esm/_abstract/_AbstractCarousel.js +5 -5
- package/esm/_abstract/_AbstractModal.js +1 -0
- package/esm/_abstract/_Blings.js +1 -1
- package/esm/_abstract/_CardList.js +5 -5
- package/esm/_abstract/_Quote.js +2 -2
- package/esm/_abstract/_Table.js +2 -2
- package/esm/_abstract/_TogglerGroup.js +1 -1
- package/esm/_abstract/_TogglerInput.d.ts +1 -0
- package/esm/_abstract/_TogglerInput.js +10 -9
- package/esm/index.d.ts +1 -0
- package/esm/utils/browserSide.js +2 -6
- package/esm/utils/seenEffect.js +2 -2
- package/esm/utils/useLaggedState.js +1 -1
- package/esm/utils/useMixedControlState.js +9 -15
- package/esm/utils/useShortState.js +4 -1
- package/index.d.ts +1 -0
- package/package.json +7 -3
- package/utils/browserSide.js +2 -6
- package/utils/seenEffect.js +2 -2
- package/utils/useMixedControlState.js +9 -15
- package/utils/useShortState.js +4 -1
|
@@ -10,10 +10,10 @@ const SearchResultsItem = (props) => {
|
|
|
10
10
|
const bem = highlight ? 'SearchResultsHighlightItem' : 'SearchResultsItem';
|
|
11
11
|
const metaArr = (Array.isArray(meta) ? meta : [meta]);
|
|
12
12
|
return (react_1.default.createElement("li", { className: bem },
|
|
13
|
-
react_1.default.createElement(_Link_js_1.Link, { className: bem
|
|
14
|
-
react_1.default.createElement("h3", { className: bem
|
|
15
|
-
metaArr.length > 0 && (react_1.default.createElement("span", { className: bem
|
|
16
|
-
highlight && image && react_1.default.createElement(_Image_js_1.Image, { bem: bem
|
|
17
|
-
react_1.default.createElement("div", { className: bem
|
|
13
|
+
react_1.default.createElement(_Link_js_1.Link, { className: `${bem}__link`, href: href },
|
|
14
|
+
react_1.default.createElement("h3", { className: `${bem}__title` }, title),
|
|
15
|
+
metaArr.length > 0 && (react_1.default.createElement("span", { className: `${bem}__meta` }, metaArr.map((item, i) => typeof item === 'function' ? item() : item && react_1.default.createElement("span", { key: i }, item)))),
|
|
16
|
+
highlight && image && react_1.default.createElement(_Image_js_1.Image, { bem: `${bem}__image`, src: image }),
|
|
17
|
+
react_1.default.createElement("div", { className: `${bem}__summary`, dangerouslySetInnerHTML: { __html: summary } }))));
|
|
18
18
|
};
|
|
19
19
|
exports.SearchResultsItem = SearchResultsItem;
|
package/SearchResults.js
CHANGED
|
@@ -85,9 +85,7 @@ const renderTitle = (props, texts) => {
|
|
|
85
85
|
status === 'loadingquery'
|
|
86
86
|
? texts.loadQueryTitle
|
|
87
87
|
: totalHits
|
|
88
|
-
? (0, prettyNum_1.prettyNum)(totalHits, { lang: texts.lang })
|
|
89
|
-
' ' +
|
|
90
|
-
texts.resultsTitle
|
|
88
|
+
? `${(0, prettyNum_1.prettyNum)(totalHits, { lang: texts.lang })} ${texts.resultsTitle}`
|
|
91
89
|
: texts.noResultsTitle,
|
|
92
90
|
react_1.default.createElement("span", { className: "SearchResults__query" }, query)));
|
|
93
91
|
};
|
package/ShareButtons.js
CHANGED
|
@@ -22,7 +22,7 @@ const ShareButtons__item = (props) => {
|
|
|
22
22
|
const buttonText = (0, shareButtonsUtils_1.getShareButtonLabel)(type, label);
|
|
23
23
|
const popup = type !== 'email';
|
|
24
24
|
return (react_1.default.createElement("li", { className: "ShareButtons__item" },
|
|
25
|
-
react_1.default.createElement(_Link_js_1.Link, { className:
|
|
25
|
+
react_1.default.createElement(_Link_js_1.Link, { className: `ShareButtons__link ShareButtons__link--${type}`, href: href, title: buttonText, rel: "noopener noreferrer", target: popup ? '_blank' : undefined, onClick: popup ? shareButtonsUtils_1.openInPopup : undefined }, buttonText)));
|
|
26
26
|
};
|
|
27
27
|
const ShareButtons = (props) => {
|
|
28
28
|
const { texts, lang, ssr, facebook = true, twitter = true, linkedin, email, wrapperProps, } = props;
|
|
@@ -41,8 +41,8 @@ const ShareButtons = (props) => {
|
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
const txt = texts ||
|
|
44
|
-
(docMeta &&
|
|
45
|
-
|
|
44
|
+
(docMeta && shareButtonsUtils_1.shareButtonTexts[docMeta.lang]) ||
|
|
45
|
+
shareButtonsUtils_1.shareButtonTexts[i18n_1.DEFAULT_LANG];
|
|
46
46
|
const { label, buttonLabel, emailSubject } = txt;
|
|
47
47
|
const className = (0, classUtils_1.modifiedClass)('ShareButtons', null, (wrapperProps || {}).className);
|
|
48
48
|
if (!docMeta || ssr === 'ssr-only') {
|
|
@@ -42,12 +42,12 @@ const SiteSearchAutocomplete = (props) => {
|
|
|
42
42
|
}
|
|
43
43
|
return (react_1.default.createElement(react_autosuggest_1.default, { theme: {
|
|
44
44
|
container: bem,
|
|
45
|
-
containerOpen: bem
|
|
46
|
-
suggestionsContainer: bem
|
|
47
|
-
suggestionsContainerOpen: bem
|
|
48
|
-
suggestionsList: bem
|
|
49
|
-
suggestion: bem
|
|
50
|
-
suggestionHighlighted: bem
|
|
45
|
+
containerOpen: `${bem}--open`,
|
|
46
|
+
suggestionsContainer: `${bem}__container`,
|
|
47
|
+
suggestionsContainerOpen: `${bem}__container--open`,
|
|
48
|
+
suggestionsList: `${bem}__list`,
|
|
49
|
+
suggestion: `${bem}__item`,
|
|
50
|
+
suggestionHighlighted: `${bem}__item--highlighted`,
|
|
51
51
|
}, focusInputOnSuggestionClick: true, suggestions: suggestions, onSuggestionsClearRequested: () => setSuggestions([]), onSuggestionsFetchRequested: onSuggestionsFetchRequested, getSuggestionValue: getSuggestionValue, onSuggestionSelected: onSuggestionSelected, onSuggestionHighlighted: onSuggestionHighlighted, renderSuggestion: renderSuggestion || ((s) => String(s)), containerProps: Object.assign(Object.assign({}, wrapperProps), { 'aria-label': txt.label }), renderSuggestionsContainer: ({ containerProps, children }) => (react_1.default.createElement("div", Object.assign({}, containerProps, { "aria-label": suggestions.length ? txt.suggestionsLabel : undefined }), children)), inputProps: {
|
|
52
52
|
ref: inputRef,
|
|
53
53
|
value: value,
|
package/Skeleton.js
CHANGED
|
@@ -24,7 +24,7 @@ const Skeleton = (props) => {
|
|
|
24
24
|
const gap = minmax(props.gap, 5, 1);
|
|
25
25
|
const items = minmax(props.items, 20, 2) || 1;
|
|
26
26
|
const { wrapperProps } = props;
|
|
27
|
-
const className = (0, classUtils_1.modifiedClass)('Skeleton', [props.text && 'text', height &&
|
|
27
|
+
const className = (0, classUtils_1.modifiedClass)('Skeleton', [props.text && 'text', height && `height--${height}`, gap && `gap--${gap}`], (wrapperProps || {}).className);
|
|
28
28
|
if (items) {
|
|
29
29
|
return (react_1.default.createElement(react_1.default.Fragment, null, (0, range_1.default)(1, items).map((key) => (react_1.default.createElement("span", { key: key, className: className })))));
|
|
30
30
|
}
|
package/SubHeading.js
CHANGED
|
@@ -8,7 +8,7 @@ const SubHeading = (props) => {
|
|
|
8
8
|
const { small, Tag = 'h2', children, align, wide, wrapperProps } = props;
|
|
9
9
|
return (react_1.default.createElement(Tag, Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('SubHeading', [
|
|
10
10
|
small && 'small',
|
|
11
|
-
align === 'right' &&
|
|
11
|
+
align === 'right' && `align--${align}`,
|
|
12
12
|
!align && wide && 'wide',
|
|
13
13
|
], (wrapperProps || {}).className) }), children));
|
|
14
14
|
};
|
package/TextInput.js
CHANGED
|
@@ -28,7 +28,8 @@ const TextInput = (props) => {
|
|
|
28
28
|
if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) {
|
|
29
29
|
setHasValue(true);
|
|
30
30
|
}
|
|
31
|
-
}, []
|
|
31
|
+
}, [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
32
|
+
);
|
|
32
33
|
return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: (0, classUtils_1.modifiedClass)('TextInput', [multiline && 'multiline']), empty: empty, filled: filled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => multiline ? (react_1.default.createElement("textarea", Object.assign({ className: className.input, onChange: _onChange }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) : (react_1.default.createElement("input", Object.assign({ className: className.input, onChange: _onChange, type: type }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) })));
|
|
33
34
|
};
|
|
34
35
|
exports.TextInput = TextInput;
|
package/VSpacer.js
CHANGED
|
@@ -35,7 +35,7 @@ const VSpacer = (props) => {
|
|
|
35
35
|
bottomVal = undefined;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
const className = (0, classUtils_1.modifiedClass)('VSpacer', [sizeVal, topVal &&
|
|
38
|
+
const className = (0, classUtils_1.modifiedClass)('VSpacer', [sizeVal, topVal && `top--${topVal}`, bottomVal && `bottom--${bottomVal}`], (wrapperProps || {}).className);
|
|
39
39
|
return isWrapper ? (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: className }), children)) : (react_1.default.createElement("hr", Object.assign({}, wrapperProps, { className: className })));
|
|
40
40
|
};
|
|
41
41
|
exports.VSpacer = VSpacer;
|
package/VerticalTabsTOC.js
CHANGED
|
@@ -3,13 +3,13 @@ import { EitherObj } from '@reykjavik/hanna-utils';
|
|
|
3
3
|
import { SSRSupportProps, WrapperElmProps } from '../utils.js';
|
|
4
4
|
import { DeprecatedSeenProp } from '../utils/seenEffect.js';
|
|
5
5
|
import { BemProps } from '../utils/types.js';
|
|
6
|
-
export type CarouselProps<I extends Record<string, unknown> =
|
|
6
|
+
export type CarouselProps<I extends Record<string, unknown> = Record<string, never>, P extends Record<string, unknown> | undefined = Record<string, never>> = {
|
|
7
7
|
className?: string;
|
|
8
8
|
/** @deprecated Ingored because never used (Will be removed in v0.11) */
|
|
9
9
|
scrollRight?: boolean;
|
|
10
10
|
} & SSRSupportProps & EitherObj<{
|
|
11
11
|
items: Array<I>;
|
|
12
|
-
Component: (props:
|
|
12
|
+
Component: (props: I & P) => ReactElement | null;
|
|
13
13
|
ComponentProps?: P;
|
|
14
14
|
}, {
|
|
15
15
|
children: ReactNode;
|
|
@@ -89,7 +89,7 @@ const AbstractCarousel = (props) => {
|
|
|
89
89
|
if (!itemCount) {
|
|
90
90
|
return null;
|
|
91
91
|
}
|
|
92
|
-
const itemList = (react_1.default.createElement("div", { className: bem
|
|
92
|
+
const itemList = (react_1.default.createElement("div", { className: `${bem}__itemlist`, style: leftOffset
|
|
93
93
|
? { '--Carousel--leftOffset': `${leftOffset}px` }
|
|
94
94
|
: undefined, "data-scroll-snapping": leftOffset ? 'true' : undefined, ref: listRef }, children ||
|
|
95
95
|
items.map((item, i) => (
|
|
@@ -98,14 +98,14 @@ const AbstractCarousel = (props) => {
|
|
|
98
98
|
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)(bem, modifier,
|
|
99
99
|
// Prefer `className` over `wrapperProps.className`
|
|
100
100
|
className || (wrapperProps || {}).className), "data-sprinkled": isBrowser }),
|
|
101
|
-
title && react_1.default.createElement("h2", { className: bem
|
|
102
|
-
isBrowser ? (react_1.default.createElement("div", { className: bem
|
|
101
|
+
title && react_1.default.createElement("h2", { className: `${bem}__title` }, title),
|
|
102
|
+
isBrowser ? (react_1.default.createElement("div", { className: `${bem}__itemlist-wrapper` },
|
|
103
103
|
itemList,
|
|
104
|
-
activeItem > 0 && (react_1.default.createElement("div", { className: bem
|
|
104
|
+
activeItem > 0 && (react_1.default.createElement("div", { className: `${bem}__itemlist-goLeft`, onClick: () => {
|
|
105
105
|
delayedScrollLeft.cancel();
|
|
106
106
|
scrollToItem(activeItem - 1);
|
|
107
107
|
}, onMouseOver: () => delayedScrollLeft(activeItem), onMouseOut: () => delayedScrollLeft.cancel() })),
|
|
108
|
-
activeItem < itemCount - 1 && (react_1.default.createElement("div", { className: bem
|
|
108
|
+
activeItem < itemCount - 1 && (react_1.default.createElement("div", { className: `${bem}__itemlist-goRight`, onClick: () => {
|
|
109
109
|
delayedScrollRight.cancel();
|
|
110
110
|
scrollToItem(activeItem + 1);
|
|
111
111
|
}, onMouseOver: () => delayedScrollRight(activeItem), onMouseOut: () => delayedScrollRight.cancel() })))) : (itemList),
|
|
@@ -49,6 +49,7 @@ exports.defaultAbstractModalTexts = {
|
|
|
49
49
|
const AbstractModal = (props) => {
|
|
50
50
|
var _a;
|
|
51
51
|
const { bem, modifier, closeDelay = 500, wrapperProps = {}, ssr } = props;
|
|
52
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
52
53
|
const isFickle = !((_a = props.stable) !== null && _a !== void 0 ? _a : props.fickle === false) || undefined;
|
|
53
54
|
const txt = (0, i18n_1.getTexts)(props, exports.defaultAbstractModalTexts);
|
|
54
55
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
package/_abstract/_Blings.js
CHANGED
|
@@ -12,5 +12,5 @@ const inverseAlignments = {
|
|
|
12
12
|
'right-ish': 'left-ish',
|
|
13
13
|
right: 'left',
|
|
14
14
|
};
|
|
15
|
-
const Blings = (props) => (react_1.default.createElement(react_1.default.Fragment, null, props.blings.map(({ type, align, vertical, color, overlay, parent }, i) => (react_1.default.createElement(Bling_js_1.default, { key: type
|
|
15
|
+
const Blings = (props) => (react_1.default.createElement(react_1.default.Fragment, null, props.blings.map(({ type, align, vertical, color, overlay, parent }, i) => (react_1.default.createElement(Bling_js_1.default, { key: `${type}-${i}`, type: type, align: props.mirror ? inverseAlignments[align || 'left'] : align, vertical: vertical, color: color, overlay: overlay, parent: parent })))));
|
|
16
16
|
exports.Blings = Blings;
|
package/_abstract/_CardList.js
CHANGED
|
@@ -27,16 +27,16 @@ const CardList = (props) => {
|
|
|
27
27
|
const fallbackImageUrl = (imgPlaceholder !== true && imgPlaceholder) || undefined;
|
|
28
28
|
const fallbackImageStyle = fallbackImageUrl
|
|
29
29
|
? {
|
|
30
|
-
[
|
|
30
|
+
[`--${bemPrefix}--fallback`]: `url("${fallbackImageUrl}")`,
|
|
31
31
|
}
|
|
32
32
|
: undefined;
|
|
33
33
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
34
|
-
summaryElement ? (react_1.default.createElement("div", { className: bemPrefix
|
|
35
|
-
title && react_1.default.createElement(TitleTag, { className: bemPrefix
|
|
36
|
-
summaryElement)) : (title && react_1.default.createElement(TitleTag, { className: bemPrefix
|
|
34
|
+
summaryElement ? (react_1.default.createElement("div", { className: `${bemPrefix}__summary` },
|
|
35
|
+
title && react_1.default.createElement(TitleTag, { className: `${bemPrefix}__title` }, title),
|
|
36
|
+
summaryElement)) : (title && react_1.default.createElement(TitleTag, { className: `${bemPrefix}__title` }, title)),
|
|
37
37
|
react_1.default.createElement("ul", Object.assign({}, wrapperProps, { className: props.standalone
|
|
38
38
|
? (0, classUtils_1.modifiedClass)(bemPrefix, modifier, (wrapperProps || {}).className)
|
|
39
|
-
: bemPrefix
|
|
39
|
+
: `${bemPrefix}__list`, style: fallbackImageStyle }), cards.map((card, i) => (react_1.default.createElement("li", { key: i, className: `${bemPrefix}__item` },
|
|
40
40
|
react_1.default.createElement(Card
|
|
41
41
|
/* Assert as `ImageCardProps` to silence the imgPlaceholder false-positive */
|
|
42
42
|
, Object.assign({}, card, { bem: bemPrefix, imgPlaceholder: !!imgPlaceholder })))))),
|
package/_abstract/_Quote.js
CHANGED
|
@@ -8,7 +8,7 @@ const _Link_js_1 = require("./_Link.js");
|
|
|
8
8
|
const _Quote = (props) => {
|
|
9
9
|
const { bem, children, by, byHref, wrapperProps } = props;
|
|
10
10
|
return (react_1.default.createElement("figure", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)(bem, null, (wrapperProps || {}).className) }),
|
|
11
|
-
react_1.default.createElement("blockquote", { className: bem
|
|
12
|
-
by && (react_1.default.createElement("figcaption", { className: bem
|
|
11
|
+
react_1.default.createElement("blockquote", { className: `${bem}__quote` }, children),
|
|
12
|
+
by && (react_1.default.createElement("figcaption", { className: `${bem}__by` }, byHref ? (react_1.default.createElement(_Link_js_1.Link, { href: byHref }, by)) : typeof by === 'string' ? (react_1.default.createElement("span", null, by)) : (by)))));
|
|
13
13
|
};
|
|
14
14
|
exports._Quote = _Quote;
|
package/_abstract/_Table.js
CHANGED
|
@@ -13,12 +13,12 @@ const TableCell = (props) => {
|
|
|
13
13
|
? ''
|
|
14
14
|
: number === true
|
|
15
15
|
? 'Cell--number'
|
|
16
|
-
:
|
|
16
|
+
: `Cell--number Cell--number--${number}`;
|
|
17
17
|
const textClass = !text
|
|
18
18
|
? ''
|
|
19
19
|
: text === true
|
|
20
20
|
? 'Cell--text'
|
|
21
|
-
:
|
|
21
|
+
: `Cell--text Cell--text--${text}`;
|
|
22
22
|
const telClass = tel ? 'Cell--tel' : '';
|
|
23
23
|
return (react_1.default.createElement(Tag, { className: (0, classUtils_1.classes)(numberClass || telClass || textClass, className), colSpan: colSpan && colSpan > 1 ? colSpan : undefined, scope: rowScope ? 'row' : undefined }, typeof value === 'function' ? value(rowIdx) : value));
|
|
24
24
|
};
|
|
@@ -25,7 +25,7 @@ const TogglerGroup = (props) => {
|
|
|
25
25
|
? disabled.includes(i)
|
|
26
26
|
: disabled;
|
|
27
27
|
const isChecked = values.includes(option.value);
|
|
28
|
-
return (react_1.default.createElement(Toggler, Object.assign({ key: i }, inputProps, { className: bem
|
|
28
|
+
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) => {
|
|
29
29
|
inputProps.onChange && inputProps.onChange(e);
|
|
30
30
|
const { value } = option;
|
|
31
31
|
const checked = e.currentTarget.checked;
|
|
@@ -5,13 +5,14 @@ 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 useDomid_js_1 = require("../utils/useDomid.js");
|
|
8
|
+
// eslint-disable-next-line complexity
|
|
8
9
|
const TogglerInput = (props) => {
|
|
9
|
-
const { bem, modifier, className, label, invalid, errorMessage, Wrapper = 'div', required, reqText, type, id, innerWrap, wrapperProps, inputProps } = props, restInputProps = tslib_1.__rest(props, ["bem", "modifier", "className", "label", "invalid", "errorMessage", "Wrapper", "required", "reqText", "type", "id", "innerWrap", "wrapperProps", "inputProps"]);
|
|
10
|
+
const { bem, modifier, className, label, hideLabel, invalid, errorMessage, Wrapper = 'div', required, reqText, type, id, innerWrap, wrapperProps, inputProps } = props, restInputProps = tslib_1.__rest(props, ["bem", "modifier", "className", "label", "hideLabel", "invalid", "errorMessage", "Wrapper", "required", "reqText", "type", "id", "innerWrap", "wrapperProps", "inputProps"]);
|
|
10
11
|
const domid = (0, useDomid_js_1.useDomid)(id);
|
|
11
|
-
const errorId = errorMessage &&
|
|
12
|
-
const reqStar = required && reqText !== false && (react_1.default.createElement("abbr", { className: bem
|
|
12
|
+
const errorId = errorMessage && `error${domid}`;
|
|
13
|
+
const reqStar = required && reqText !== false && (react_1.default.createElement("abbr", { className: `${bem}__label__reqstar`,
|
|
13
14
|
// FIXME: add mo-better i18n thinking
|
|
14
|
-
title:
|
|
15
|
+
title: `${reqText || 'Þarf að haka í'}: ` }, "*"));
|
|
15
16
|
const readOnly = restInputProps.readOnly || (inputProps || {}).readOnly;
|
|
16
17
|
const labelContent = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
18
|
' ',
|
|
@@ -19,14 +20,14 @@ const TogglerInput = (props) => {
|
|
|
19
20
|
" ",
|
|
20
21
|
label,
|
|
21
22
|
' '));
|
|
22
|
-
return (react_1.default.createElement(Wrapper, Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)(bem, modifier,
|
|
23
|
+
return (react_1.default.createElement(Wrapper, Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)(bem, [modifier, hideLabel && 'nolabel'],
|
|
23
24
|
// Prefer `className` over `wrapperProps.className`
|
|
24
25
|
className || (wrapperProps || {}).className) }),
|
|
25
|
-
react_1.default.createElement("input", Object.assign({ className: bem
|
|
26
|
+
react_1.default.createElement("input", Object.assign({ className: `${bem}__input`, type: type, id: domid, "aria-invalid": invalid || !!errorMessage || undefined, "aria-describedby": errorId }, restInputProps, inputProps, (readOnly && { disabled: true }))),
|
|
26
27
|
' ',
|
|
27
|
-
react_1.default.createElement("label", { className: bem
|
|
28
|
-
innerWrap ? (react_1.default.createElement("span", { className: bem
|
|
28
|
+
react_1.default.createElement("label", { className: `${bem}__label`, htmlFor: domid },
|
|
29
|
+
innerWrap ? (react_1.default.createElement("span", { className: `${bem}__label__wrap` }, labelContent)) : (labelContent),
|
|
29
30
|
readOnly && (react_1.default.createElement("input", { type: "hidden", name: restInputProps.name, value: restInputProps.value }))),
|
|
30
|
-
errorMessage && (react_1.default.createElement("div", { className: bem
|
|
31
|
+
errorMessage && (react_1.default.createElement("div", { className: `${bem}__error`, id: errorId }, errorMessage))));
|
|
31
32
|
};
|
|
32
33
|
exports.TogglerInput = TogglerInput;
|
package/esm/AccordionList.js
CHANGED
|
@@ -14,7 +14,7 @@ const AccordionListItem = (props) => {
|
|
|
14
14
|
};
|
|
15
15
|
export const AccordionList = (props) => {
|
|
16
16
|
const { items, ssr, wide, defaultOpen, wrapperProps } = props;
|
|
17
|
-
const [open, setOpenArray
|
|
17
|
+
const [open, setOpenArray /*, mode */] = useMixedControlState(props, 'open', []);
|
|
18
18
|
const onToggle = (index) => {
|
|
19
19
|
setOpenArray((prevOpen) => {
|
|
20
20
|
const opened = !prevOpen.includes(index);
|
|
@@ -18,8 +18,13 @@ export type AutosuggestSearchI18n = {
|
|
|
18
18
|
lang?: string;
|
|
19
19
|
};
|
|
20
20
|
export declare const defaultAutosuggestSearchTexts: DefaultTexts<AutosuggestSearchI18n>;
|
|
21
|
+
type EmptyMessage = {
|
|
22
|
+
message: string | JSX.Element;
|
|
23
|
+
type: 'empty' | 'loading';
|
|
24
|
+
};
|
|
21
25
|
export type AutosuggestSearchProps<T extends string | object> = {
|
|
22
26
|
options: Array<T>;
|
|
27
|
+
emptyMessage?: EmptyMessage | EmptyMessage['message'];
|
|
23
28
|
onInput: (value: string) => void;
|
|
24
29
|
onSelected: (payload: {
|
|
25
30
|
value: string;
|
|
@@ -38,3 +43,4 @@ export type AutosuggestSearchProps<T extends string | object> = {
|
|
|
38
43
|
lang?: HannaLang;
|
|
39
44
|
} & Pick<SearchInputProps, 'onSubmit' | 'onButtonClick' | 'button'> & WrapperElmProps;
|
|
40
45
|
export declare const AutosuggestSearch: <T extends string | object>(props: AutosuggestSearchProps<T>) => JSX.Element;
|
|
46
|
+
export {};
|
package/esm/AutosuggestSearch.js
CHANGED
|
@@ -28,7 +28,7 @@ export const defaultAutosuggestSearchTexts = {
|
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
export const AutosuggestSearch = (props) => {
|
|
31
|
-
const { options, itemActionIcon, onInput, onSelected, onClearOptions, onSubmit, onButtonClick = onSubmit, button, getOptionValue = (opt) => typeof opt !== 'object' || !('value' in opt)
|
|
31
|
+
const { options, emptyMessage, itemActionIcon, onInput, onSelected, onClearOptions, onSubmit, onButtonClick = onSubmit, button, getOptionValue = (opt) => typeof opt !== 'object' || !('value' in opt)
|
|
32
32
|
? opt.toString()
|
|
33
33
|
: opt.value != null
|
|
34
34
|
? opt.value.toString()
|
|
@@ -38,6 +38,7 @@ export const AutosuggestSearch = (props) => {
|
|
|
38
38
|
const [value, setValue] = useState('');
|
|
39
39
|
const inputRef = useRef(null);
|
|
40
40
|
const txt = getTexts(props, defaultAutosuggestSearchTexts);
|
|
41
|
+
const showEmptyMessage = !options.length && emptyMessage;
|
|
41
42
|
return (React.createElement(Autosuggest, { theme: {
|
|
42
43
|
container: 'AutosuggestSearch',
|
|
43
44
|
containerOpen: 'AutosuggestSearch--open',
|
|
@@ -46,11 +47,26 @@ export const AutosuggestSearch = (props) => {
|
|
|
46
47
|
suggestionsList: modifiedClass('AutosuggestSearch__list', itemActionIcon && `action--${itemActionIcon}`),
|
|
47
48
|
suggestion: 'AutosuggestSearch__item',
|
|
48
49
|
suggestionHighlighted: 'AutosuggestSearch__item--highlighted',
|
|
49
|
-
}, focusInputOnSuggestionClick: true, suggestions: options, onSuggestionsClearRequested: onClearOptions, onSuggestionsFetchRequested: ({ value }) => onInput(value), getSuggestionValue:
|
|
50
|
+
}, focusInputOnSuggestionClick: true, suggestions: showEmptyMessage ? [true] : options, onSuggestionsClearRequested: onClearOptions, onSuggestionsFetchRequested: ({ value }) => onInput(value), getSuggestionValue: showEmptyMessage
|
|
51
|
+
? () => value // Return the input value in case the user uses the up/down keys to select the hidden empty message
|
|
52
|
+
: getOptionValue, onSuggestionSelected: (event, data) => {
|
|
53
|
+
if (showEmptyMessage) {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
50
57
|
onSelected({ value: data.suggestionValue, option: data.suggestion });
|
|
51
58
|
},
|
|
52
59
|
// onSuggestionHighlighted={onSuggestionHighlighted}
|
|
53
|
-
renderSuggestion: renderSuggestion, containerProps: Object.assign(Object.assign({}, wrapperProps), { 'aria-label': txt.label }), renderSuggestionsContainer: ({ containerProps, children }) =>
|
|
60
|
+
renderSuggestion: showEmptyMessage ? () => '' : renderSuggestion, containerProps: Object.assign(Object.assign({}, wrapperProps), { 'aria-label': txt.label }), renderSuggestionsContainer: ({ containerProps, children }) => {
|
|
61
|
+
let contents = children;
|
|
62
|
+
if (showEmptyMessage) {
|
|
63
|
+
const { message, type } = typeof emptyMessage === 'string' || !('message' in emptyMessage)
|
|
64
|
+
? { message: emptyMessage, type: 'empty' }
|
|
65
|
+
: emptyMessage;
|
|
66
|
+
contents = (React.createElement("div", { className: modifiedClass('AutosuggestSearch__emptyMessage', type !== 'empty' && type) }, message));
|
|
67
|
+
}
|
|
68
|
+
return (React.createElement("div", Object.assign({}, containerProps, { "aria-label": options.length ? txt.suggestionsLabel : undefined }), contents));
|
|
69
|
+
}, inputProps: {
|
|
54
70
|
ref: inputRef,
|
|
55
71
|
value: value,
|
|
56
72
|
onChange: (_, { newValue }) => {
|
package/esm/BasicTable.js
CHANGED
|
@@ -7,15 +7,15 @@ const tableTypes = {
|
|
|
7
7
|
number: 'data--number',
|
|
8
8
|
};
|
|
9
9
|
export const BasicTable = (props) => {
|
|
10
|
-
// eslint-disable-
|
|
11
|
-
|
|
10
|
+
const { align, fullWidth, type, tbody, tbodies, modifier, // eslint-disable-line deprecation/deprecation
|
|
11
|
+
thead, tfoot, tableProps, caption, rowProps, compact, cols, wrapperProps, } = props;
|
|
12
12
|
return (React.createElement(ScrollWrapper, { bem: "TableWrapper", modifier: [
|
|
13
13
|
'BasicTable',
|
|
14
|
-
modifier &&
|
|
14
|
+
modifier && `BasicTable--${modifier}`,
|
|
15
15
|
fullWidth
|
|
16
16
|
? 'BasicTable--fullwidth'
|
|
17
17
|
: align === 'right'
|
|
18
|
-
?
|
|
18
|
+
? `BasicTable--align--${align}`
|
|
19
19
|
: undefined,
|
|
20
20
|
], wrapperProps: wrapperProps },
|
|
21
21
|
React.createElement(Table, Object.assign({ className: modifiedClass('BasicTable', [
|
package/esm/BgBox.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { DeprecatedSeenProp
|
|
2
|
+
import { DeprecatedSeenProp } from './utils/seenEffect.js';
|
|
3
3
|
import { WrapperElmProps } from './utils.js';
|
|
4
4
|
export type BgBoxProps = {
|
|
5
5
|
className?: string;
|
|
6
6
|
children: ReactNode;
|
|
7
|
-
} & WrapperElmProps & DeprecatedSeenProp &
|
|
7
|
+
} & WrapperElmProps & DeprecatedSeenProp & {
|
|
8
|
+
/** @deprecated This prop does nothing nowadays (Will be removed in v0.11) */
|
|
9
|
+
effectType?: string;
|
|
10
|
+
};
|
|
8
11
|
export declare const BgBox: (props: BgBoxProps) => JSX.Element;
|
|
9
12
|
export default BgBox;
|
package/esm/BgBox.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
export const BgBox = (props) => {
|
|
4
|
-
const { className, children,
|
|
4
|
+
const { className, children, wrapperProps } = props;
|
|
5
5
|
return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('BgBox', undefined,
|
|
6
6
|
// Prefer `className` over `wrapperProps.className`
|
|
7
7
|
className || (wrapperProps || {}).className) }), children));
|
package/esm/Bling.js
CHANGED
|
@@ -34,10 +34,10 @@ export const Bling = (props) => {
|
|
|
34
34
|
const imageUrl = type ? getBlingUrl(type) : blingUrl;
|
|
35
35
|
const inlineSvg = useGetSVGtext(imageUrl);
|
|
36
36
|
return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('Bling', [
|
|
37
|
-
|
|
38
|
-
vertical && vertical in valigns &&
|
|
39
|
-
color && color in colors &&
|
|
40
|
-
parent && parent in parentOffset &&
|
|
37
|
+
`align--${align && align in aligns ? align : 'left'}`,
|
|
38
|
+
vertical && vertical in valigns && `vertical--${vertical}`,
|
|
39
|
+
color && color in colors && `color--${color}`,
|
|
40
|
+
parent && parent in parentOffset && `parent--${parent}`,
|
|
41
41
|
overlay && 'overlay',
|
|
42
42
|
],
|
|
43
43
|
// Prefer `className` over `wrapperProps.className`
|
package/esm/Carousel.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CarouselProps } from './_abstract/_AbstractCarousel.js';
|
|
2
2
|
export type { CarouselProps } from './_abstract/_AbstractCarousel.js';
|
|
3
|
-
export declare const Carousel: <I extends Record<string, unknown> =
|
|
3
|
+
export declare const Carousel: <I extends Record<string, unknown> = Record<string, never>, P extends Record<string, unknown> | undefined = Record<string, never>>(props: CarouselProps<I, P>) => JSX.Element;
|
|
4
4
|
export default Carousel;
|
package/esm/CarouselStepper.js
CHANGED
|
@@ -6,11 +6,11 @@ const defaultTexts = {
|
|
|
6
6
|
const array = new Array(50).join(' ').split('');
|
|
7
7
|
export const CarouselStepper = (props) => {
|
|
8
8
|
const { current, itemCount, setCurrent, texts = defaultTexts, wrapperProps } = props;
|
|
9
|
-
const labelPrefix = texts.prefix ? texts.prefix
|
|
9
|
+
const labelPrefix = texts.prefix ? `${texts.prefix} ` : '';
|
|
10
10
|
return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('CarouselStepper', null, (wrapperProps || {}).className) }), array.slice(0, itemCount).map((_, i) => {
|
|
11
11
|
const isCurrent = current === i || undefined;
|
|
12
12
|
const label = labelPrefix + (i + 1);
|
|
13
|
-
return (React.createElement("button", { key: i, className:
|
|
13
|
+
return (React.createElement("button", { key: i, className: "CarouselStepper__button", type: "button", disabled: isCurrent, "aria-pressed": isCurrent, "aria-controls": props['aria-controls'], onClick: () => setCurrent(i), "aria-label": label, title: label }, label));
|
|
14
14
|
})));
|
|
15
15
|
};
|
|
16
16
|
export default CarouselStepper;
|
package/esm/CheckboxButton.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TogglerInputProps } from './_abstract/_TogglerInput.js';
|
|
2
2
|
/** @deprecated Use `CheckboxButtonProps` instead (Will be removed in v0.11) */
|
|
3
3
|
export type CheckboxProps = CheckboxButtonProps;
|
|
4
|
-
export type CheckboxButtonProps = TogglerInputProps
|
|
4
|
+
export type CheckboxButtonProps = Omit<TogglerInputProps, 'hideLabel'>;
|
|
5
5
|
export declare const CheckboxButton: (props: CheckboxButtonProps) => JSX.Element;
|
|
6
6
|
export default CheckboxButton;
|
package/esm/CityBlock.js
CHANGED
|
@@ -9,7 +9,7 @@ const types = {
|
|
|
9
9
|
export const CityBlock = (props) => {
|
|
10
10
|
const align = props.align || 'right';
|
|
11
11
|
const type = !props.illustration && props.type; // The presence of illustration prop suppresses type
|
|
12
|
-
const modifier = [aligns[align] &&
|
|
12
|
+
const modifier = [aligns[align] && `align--${align}`, type && types[type] && type];
|
|
13
13
|
const imageProps = props.illustration != null
|
|
14
14
|
? { src: getIllustrationUrl(props.illustration) }
|
|
15
15
|
: props.image;
|
package/esm/ContactBubble.js
CHANGED
|
@@ -98,7 +98,7 @@ export const ContactBubble = (props) => {
|
|
|
98
98
|
};
|
|
99
99
|
},
|
|
100
100
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
|
-
[isBrowser, alwaysShow, closeBubble]);
|
|
101
|
+
[isBrowser, alwaysShow, closeBubble /* , wrapperRef */]);
|
|
102
102
|
useEffect(() => {
|
|
103
103
|
const escHandler = (e) => e.key === 'Escape' && closeBubble();
|
|
104
104
|
const outsideClickHandler = (e) => {
|
|
@@ -121,7 +121,9 @@ export const ContactBubble = (props) => {
|
|
|
121
121
|
document.removeEventListener('keydown', escHandler);
|
|
122
122
|
document.removeEventListener('click', outsideClickHandler, true);
|
|
123
123
|
};
|
|
124
|
-
},
|
|
124
|
+
},
|
|
125
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
126
|
+
[open, closeBubble /* , wrapperRef */]);
|
|
125
127
|
if (links.length === 0) {
|
|
126
128
|
return null;
|
|
127
129
|
}
|
|
@@ -130,7 +132,7 @@ export const ContactBubble = (props) => {
|
|
|
130
132
|
React.createElement("ul", { className: "ContactBubble__list" }, links.map((linkInfo, i) => {
|
|
131
133
|
const { href, label, extraLabel, target, onClick } = linkInfo;
|
|
132
134
|
const icon = ensureIcon(linkInfo.icon);
|
|
133
|
-
const itemClass = modifiedClass('ContactBubble__item', icon &&
|
|
135
|
+
const itemClass = modifiedClass('ContactBubble__item', icon && `type--${icon}`);
|
|
134
136
|
const onClickHandler = (e) => {
|
|
135
137
|
if (onClick) {
|
|
136
138
|
const doPreventDefault = onClick() !== true;
|
package/esm/Datepicker.js
CHANGED
|
@@ -109,7 +109,8 @@ const defaultDatepickerTexts = {
|
|
|
109
109
|
* Internally, this component uses the [`react-datepicker`](https://reactdatepicker.com/) component.
|
|
110
110
|
*/
|
|
111
111
|
export const Datepicker = (props) => {
|
|
112
|
-
const { placeholder, dateFormat, name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, inputRef, isoMode, texts, lang = props.localeCode,
|
|
112
|
+
const { placeholder, dateFormat, name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, inputRef, isoMode, texts, lang = props.localeCode, // eslint-disable-line deprecation/deprecation
|
|
113
|
+
fieldWrapperProps, } = groupFormFieldWrapperProps(props);
|
|
113
114
|
const [value, setValue] = useMixedControlState.raw(props.value || props.initialDate, // eslint-disable-line deprecation/deprecation
|
|
114
115
|
props.defaultValue, 'value');
|
|
115
116
|
/*
|
|
@@ -31,7 +31,7 @@ export const formatBytes = (bytes, lang = 'is', decimals = 2) => {
|
|
|
31
31
|
}
|
|
32
32
|
const i = Math.min(Math.floor(Math.log(Math.abs(bytes) / kThreshold) / Math.log(k)), units.length - 1);
|
|
33
33
|
const scaled = bytes / Math.pow(k, i);
|
|
34
|
-
const formatted =
|
|
34
|
+
const formatted = `${parseFloat(scaled.toFixed(decimals))}`.replace('.',
|
|
35
35
|
// NOTE: As of 2022-11 Chrome still doesn't support Icelandic
|
|
36
36
|
decimalSymbols[lang] || (1.1).toLocaleString(lang)[1]);
|
|
37
37
|
return `${formatted} ${units[i]}`;
|
package/esm/FileInput.js
CHANGED
|
@@ -13,12 +13,11 @@ const defaultRemoveFileText = {
|
|
|
13
13
|
pl: 'Usuń',
|
|
14
14
|
};
|
|
15
15
|
const defaultOnFilesRejected = (rejectedFiles) => {
|
|
16
|
-
window.alert(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
21
|
-
.join(', '));
|
|
16
|
+
window.alert(`Error:\n${rejectedFiles
|
|
17
|
+
.map((elm) => {
|
|
18
|
+
return elm.name;
|
|
19
|
+
})
|
|
20
|
+
.join(', ')}`);
|
|
22
21
|
};
|
|
23
22
|
const arrayToFileList = (arr) => {
|
|
24
23
|
const fileList = new DataTransfer();
|
|
@@ -106,7 +105,7 @@ export const FileInput = (props) => {
|
|
|
106
105
|
}
|
|
107
106
|
onFilesUpdated(fileList, diff);
|
|
108
107
|
};
|
|
109
|
-
return (React.createElement(FormField, Object.assign({ extraClassName: modifiedClass('FileInput', [multiple && 'multi']) }, fieldWrapperProps, { id: domid
|
|
108
|
+
return (React.createElement(FormField, Object.assign({ extraClassName: modifiedClass('FileInput', [multiple && 'multi']) }, fieldWrapperProps, { id: `${domid}-fake`, LabelTag: "h4", renderInput: (className, inputProps /* , addFocusProps */) => {
|
|
110
109
|
return (React.createElement("div", { className: className.control, ref: fileInputWrapper },
|
|
111
110
|
// Explicitly skip rendering of input element if no
|
|
112
111
|
// name prop is provided. This is implicitly what the
|
package/esm/Form.js
CHANGED
|
@@ -5,6 +5,6 @@ import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
|
5
5
|
// it makes little sense to add support for `wrapperProps` on top.
|
|
6
6
|
export const Form = (props) => {
|
|
7
7
|
const { children, align, wide, className } = props, formProps = __rest(props, ["children", "align", "wide", "className"]);
|
|
8
|
-
return (React.createElement("form", Object.assign({}, formProps, { className: modifiedClass('Form', [align === 'right' &&
|
|
8
|
+
return (React.createElement("form", Object.assign({}, formProps, { className: modifiedClass('Form', [align === 'right' && `align--${align}`, !align && wide && 'wide'], className) }), children));
|
|
9
9
|
};
|
|
10
10
|
export default Form;
|
package/esm/FormField.d.ts
CHANGED
|
@@ -86,8 +86,8 @@ export declare const getFormFieldWrapperProps: (props: (FormFieldGroupWrappingPr
|
|
|
86
86
|
}) => RequireExplicitUndefined<FormFieldGroupWrappingProps> & {
|
|
87
87
|
small: boolean | undefined;
|
|
88
88
|
};
|
|
89
|
-
export declare const groupFormFieldWrapperProps: <T extends (FormFieldGroupWrappingProps | Pick<TogglerGroupFieldProps<"default", {}>, "label" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "
|
|
89
|
+
export declare const groupFormFieldWrapperProps: <T extends (FormFieldGroupWrappingProps | Pick<TogglerGroupFieldProps<"default", {}>, "label" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "hideLabel" | "errorMessage" | "reqText" | "assistText" | "wrapperRef" | "LabelTag">) & {
|
|
90
90
|
small?: boolean | undefined;
|
|
91
|
-
}>(props: T) => Omit<T, "label" | "small" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "
|
|
91
|
+
}>(props: T) => Omit<T, "label" | "small" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "hideLabel" | "errorMessage" | "reqText" | "assistText" | "wrapperRef" | "LabelTag"> & {
|
|
92
92
|
fieldWrapperProps: ReturnType<typeof getFormFieldWrapperProps>;
|
|
93
93
|
};
|