@reykjavik/hanna-react 0.10.112 → 0.10.114
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/Alert.js +1 -1
- package/AutosuggestSearch.d.ts +6 -0
- package/AutosuggestSearch.js +19 -3
- package/BasicTable.js +7 -7
- package/BgBox.d.ts +5 -2
- package/BgBox.js +1 -1
- package/Bling.js +4 -4
- package/CHANGELOG.md +37 -1
- 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 +12 -5
- package/Datepicker.d.ts +1 -0
- package/Datepicker.js +52 -13
- package/FileInput/_FileInput.utils.js +1 -1
- package/FileInput.js +6 -7
- package/{_abstract/_FocusTrap.d.ts → FocusTrap.d.ts} +5 -1
- package/{_abstract/_FocusTrap.js → FocusTrap.js} +5 -1
- 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/Layout.d.ts +7 -3
- package/Layout.js +7 -26
- package/MainMenu.d.ts +52 -20
- package/MainMenu.js +30 -7
- package/MainMenu2.d.ts +114 -0
- package/MainMenu2.js +234 -0
- package/MobileMenuToggler/_useMobileMenuToggling.d.ts +21 -0
- package/{utils/useMenuToggling.js → MobileMenuToggler/_useMobileMenuToggling.js} +34 -14
- package/MobileMenuToggler.d.ts +21 -0
- package/MobileMenuToggler.js +43 -0
- package/Multiselect/_Multiselect.search.d.ts +1 -1
- package/Multiselect.js +12 -6
- 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/TagPill.d.ts +2 -0
- 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 +4 -3
- package/_abstract/_Blings.js +1 -1
- package/_abstract/_Button.d.ts +3 -3
- package/_abstract/_Button.js +3 -3
- package/_abstract/_CardList.js +5 -5
- package/_abstract/_Quote.js +2 -2
- package/_abstract/_Table.d.ts +3 -3
- package/_abstract/_Table.js +3 -3
- 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/Alert.js +1 -1
- package/esm/AutosuggestSearch.d.ts +6 -0
- package/esm/AutosuggestSearch.js +19 -3
- package/esm/BasicTable.js +7 -7
- 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 +12 -5
- package/esm/Datepicker.d.ts +1 -0
- package/esm/Datepicker.js +52 -13
- package/esm/FileInput/_FileInput.utils.js +1 -1
- package/esm/FileInput.js +6 -7
- package/esm/{_abstract/_FocusTrap.d.ts → FocusTrap.d.ts} +5 -1
- package/esm/{_abstract/_FocusTrap.js → FocusTrap.js} +5 -1
- 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/Layout.d.ts +7 -3
- package/esm/Layout.js +8 -27
- package/esm/MainMenu.d.ts +52 -20
- package/esm/MainMenu.js +30 -8
- package/esm/MainMenu2.d.ts +114 -0
- package/esm/MainMenu2.js +229 -0
- package/esm/MobileMenuToggler/_useMobileMenuToggling.d.ts +21 -0
- package/esm/{utils/useMenuToggling.js → MobileMenuToggler/_useMobileMenuToggling.js} +32 -13
- package/esm/MobileMenuToggler.d.ts +21 -0
- package/esm/MobileMenuToggler.js +37 -0
- package/esm/Multiselect/_Multiselect.search.d.ts +1 -1
- package/esm/Multiselect.js +11 -5
- 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/TagPill.d.ts +2 -0
- 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 +2 -1
- package/esm/_abstract/_Blings.js +1 -1
- package/esm/_abstract/_Button.d.ts +3 -3
- package/esm/_abstract/_Button.js +3 -3
- package/esm/_abstract/_CardList.js +5 -5
- package/esm/_abstract/_Quote.js +2 -2
- package/esm/_abstract/_Table.d.ts +3 -3
- package/esm/_abstract/_Table.js +3 -3
- 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 +4 -0
- package/esm/utils/a11yHelpers.d.ts +2 -0
- package/esm/utils/a11yHelpers.js +11 -0
- package/esm/utils/browserSide.js +2 -6
- package/esm/utils/seenEffect.js +2 -2
- package/esm/utils/types.d.ts +4 -0
- package/esm/utils/useFormatMonitor.d.ts +4 -11
- package/esm/utils/useFormatMonitor.js +0 -10
- package/esm/utils/useLaggedState.js +1 -1
- package/esm/utils/useMixedControlState.js +9 -15
- package/esm/utils/useShortState.js +4 -1
- package/esm/utils.d.ts +7 -2
- package/esm/utils.js +8 -2
- package/index.d.ts +4 -0
- package/package.json +19 -3
- package/utils/a11yHelpers.d.ts +2 -0
- package/utils/a11yHelpers.js +15 -0
- package/utils/browserSide.js +2 -6
- package/utils/seenEffect.js +2 -2
- package/utils/types.d.ts +4 -0
- package/utils/useFormatMonitor.d.ts +4 -11
- package/utils/useFormatMonitor.js +0 -10
- package/utils/useMixedControlState.js +9 -15
- package/utils/useShortState.js +4 -1
- package/utils.d.ts +7 -2
- package/utils.js +9 -5
- package/esm/utils/HannaUIState.d.ts +0 -7
- package/esm/utils/HannaUIState.js +0 -7
- package/esm/utils/useMenuToggling.d.ts +0 -10
- package/utils/HannaUIState.d.ts +0 -7
- package/utils/HannaUIState.js +0 -11
- package/utils/useMenuToggling.d.ts +0 -10
package/AccordionList.js
CHANGED
|
@@ -18,7 +18,7 @@ const AccordionListItem = (props) => {
|
|
|
18
18
|
};
|
|
19
19
|
const AccordionList = (props) => {
|
|
20
20
|
const { items, ssr, wide, defaultOpen, wrapperProps } = props;
|
|
21
|
-
const [open, setOpenArray
|
|
21
|
+
const [open, setOpenArray /*, mode */] = (0, utils_js_1.useMixedControlState)(props, 'open', []);
|
|
22
22
|
const onToggle = (index) => {
|
|
23
23
|
setOpenArray((prevOpen) => {
|
|
24
24
|
const opened = !prevOpen.includes(index);
|
package/Alert.js
CHANGED
|
@@ -52,8 +52,8 @@ const Alert = (props) => {
|
|
|
52
52
|
closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, wrapperProps, } = props;
|
|
53
53
|
const autoClose = Math.max(props.autoClose || 0, 0);
|
|
54
54
|
const closing = (0, react_1.useRef)();
|
|
55
|
-
const [open, setOpen] = (0, react_1.useState)(!!ssr);
|
|
56
55
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
|
56
|
+
const [open, setOpen] = (0, react_1.useState)(!isBrowser);
|
|
57
57
|
const showCloseButton = closable && (isBrowser || closeUrl != null);
|
|
58
58
|
const { closeLabel, closeLabelLong } = (0, i18n_1.getTexts)(props, exports.defaultAlertTexts);
|
|
59
59
|
(0, react_1.useEffect)(() => {
|
package/AutosuggestSearch.d.ts
CHANGED
|
@@ -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/AutosuggestSearch.js
CHANGED
|
@@ -31,7 +31,7 @@ exports.defaultAutosuggestSearchTexts = {
|
|
|
31
31
|
},
|
|
32
32
|
};
|
|
33
33
|
const AutosuggestSearch = (props) => {
|
|
34
|
-
const { options, itemActionIcon, onInput, onSelected, onClearOptions, onSubmit, onButtonClick = onSubmit, button, getOptionValue = (opt) => typeof opt !== 'object' || !('value' in opt)
|
|
34
|
+
const { options, emptyMessage, itemActionIcon, onInput, onSelected, onClearOptions, onSubmit, onButtonClick = onSubmit, button, getOptionValue = (opt) => typeof opt !== 'object' || !('value' in opt)
|
|
35
35
|
? opt.toString()
|
|
36
36
|
: opt.value != null
|
|
37
37
|
? opt.value.toString()
|
|
@@ -41,6 +41,7 @@ const AutosuggestSearch = (props) => {
|
|
|
41
41
|
const [value, setValue] = (0, react_1.useState)('');
|
|
42
42
|
const inputRef = (0, react_1.useRef)(null);
|
|
43
43
|
const txt = (0, i18n_1.getTexts)(props, exports.defaultAutosuggestSearchTexts);
|
|
44
|
+
const showEmptyMessage = !options.length && emptyMessage;
|
|
44
45
|
return (react_1.default.createElement(react_autosuggest_1.default, { theme: {
|
|
45
46
|
container: 'AutosuggestSearch',
|
|
46
47
|
containerOpen: 'AutosuggestSearch--open',
|
|
@@ -49,11 +50,26 @@ const AutosuggestSearch = (props) => {
|
|
|
49
50
|
suggestionsList: (0, classUtils_1.modifiedClass)('AutosuggestSearch__list', itemActionIcon && `action--${itemActionIcon}`),
|
|
50
51
|
suggestion: 'AutosuggestSearch__item',
|
|
51
52
|
suggestionHighlighted: 'AutosuggestSearch__item--highlighted',
|
|
52
|
-
}, focusInputOnSuggestionClick: true, suggestions: options, onSuggestionsClearRequested: onClearOptions, onSuggestionsFetchRequested: ({ value }) => onInput(value), getSuggestionValue:
|
|
53
|
+
}, focusInputOnSuggestionClick: true, suggestions: showEmptyMessage ? [true] : options, onSuggestionsClearRequested: onClearOptions, onSuggestionsFetchRequested: ({ value }) => onInput(value), getSuggestionValue: showEmptyMessage
|
|
54
|
+
? () => value // Return the input value in case the user uses the up/down keys to select the hidden empty message
|
|
55
|
+
: getOptionValue, onSuggestionSelected: (event, data) => {
|
|
56
|
+
if (showEmptyMessage) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
53
60
|
onSelected({ value: data.suggestionValue, option: data.suggestion });
|
|
54
61
|
},
|
|
55
62
|
// onSuggestionHighlighted={onSuggestionHighlighted}
|
|
56
|
-
renderSuggestion: renderSuggestion, containerProps: Object.assign(Object.assign({}, wrapperProps), { 'aria-label': txt.label }), renderSuggestionsContainer: ({ containerProps, children }) =>
|
|
63
|
+
renderSuggestion: showEmptyMessage ? () => '' : renderSuggestion, containerProps: Object.assign(Object.assign({}, wrapperProps), { 'aria-label': txt.label }), renderSuggestionsContainer: ({ containerProps, children }) => {
|
|
64
|
+
let contents = children;
|
|
65
|
+
if (showEmptyMessage) {
|
|
66
|
+
const { message, type } = typeof emptyMessage === 'string' || !('message' in emptyMessage)
|
|
67
|
+
? { message: emptyMessage, type: 'empty' }
|
|
68
|
+
: emptyMessage;
|
|
69
|
+
contents = (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('AutosuggestSearch__emptyMessage', type !== 'empty' && type) }, message));
|
|
70
|
+
}
|
|
71
|
+
return (react_1.default.createElement("div", Object.assign({}, containerProps, { "aria-label": options.length ? txt.suggestionsLabel : undefined }), contents));
|
|
72
|
+
}, inputProps: {
|
|
57
73
|
ref: inputRef,
|
|
58
74
|
value: value,
|
|
59
75
|
onChange: (_, { newValue }) => {
|
package/BasicTable.js
CHANGED
|
@@ -11,22 +11,22 @@ const tableTypes = {
|
|
|
11
11
|
number: 'data--number',
|
|
12
12
|
};
|
|
13
13
|
const BasicTable = (props) => {
|
|
14
|
-
// eslint-disable-
|
|
15
|
-
|
|
14
|
+
const { align, fullWidth, type, tbody, tbodies, modifier, // eslint-disable-line deprecation/deprecation
|
|
15
|
+
thead, tfoot, tableProps, caption, rowProps, compact, cols, wrapperProps, } = props;
|
|
16
16
|
return (react_1.default.createElement(_ScrollWrapper_js_1.ScrollWrapper, { bem: "TableWrapper", modifier: [
|
|
17
17
|
'BasicTable',
|
|
18
|
-
modifier &&
|
|
18
|
+
modifier && `BasicTable--${modifier}`,
|
|
19
19
|
fullWidth
|
|
20
20
|
? 'BasicTable--fullwidth'
|
|
21
21
|
: align === 'right'
|
|
22
|
-
?
|
|
22
|
+
? `BasicTable--align--${align}`
|
|
23
23
|
: undefined,
|
|
24
|
-
], wrapperProps:
|
|
24
|
+
], wrapperProps: wrapperProps },
|
|
25
25
|
react_1.default.createElement(_Table_js_1.Table, Object.assign({ className: (0, classUtils_1.modifiedClass)('BasicTable', [
|
|
26
|
-
|
|
26
|
+
compact && 'compact',
|
|
27
27
|
type && tableTypes[type],
|
|
28
28
|
modifier,
|
|
29
|
-
]), cols:
|
|
29
|
+
]), cols: cols, caption: caption, thead: thead, tfoot: tfoot }, (tbody ? { tbody } : { tbodies }), { rowProps: rowProps, wrapperProps: tableProps }))));
|
|
30
30
|
};
|
|
31
31
|
exports.BasicTable = BasicTable;
|
|
32
32
|
exports.default = exports.BasicTable;
|
package/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/BgBox.js
CHANGED
|
@@ -5,7 +5,7 @@ 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 BgBox = (props) => {
|
|
8
|
-
const { className, children,
|
|
8
|
+
const { className, children, wrapperProps } = props;
|
|
9
9
|
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('BgBox', undefined,
|
|
10
10
|
// Prefer `className` over `wrapperProps.className`
|
|
11
11
|
className || (wrapperProps || {}).className) }), children));
|
package/Bling.js
CHANGED
|
@@ -38,10 +38,10 @@ const Bling = (props) => {
|
|
|
38
38
|
const imageUrl = type ? (0, assets_1.getBlingUrl)(type) : blingUrl;
|
|
39
39
|
const inlineSvg = (0, useGetSVGtext_js_1.useGetSVGtext)(imageUrl);
|
|
40
40
|
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('Bling', [
|
|
41
|
-
|
|
42
|
-
vertical && vertical in valigns &&
|
|
43
|
-
color && color in colors &&
|
|
44
|
-
parent && parent in parentOffset &&
|
|
41
|
+
`align--${align && align in aligns ? align : 'left'}`,
|
|
42
|
+
vertical && vertical in valigns && `vertical--${vertical}`,
|
|
43
|
+
color && color in colors && `color--${color}`,
|
|
44
|
+
parent && parent in parentOffset && `parent--${parent}`,
|
|
45
45
|
overlay && 'overlay',
|
|
46
46
|
],
|
|
47
47
|
// Prefer `className` over `wrapperProps.className`
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,42 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
+
## 0.10.114
|
|
8
|
+
|
|
9
|
+
_2023-12-13_
|
|
10
|
+
|
|
11
|
+
- feat: Add prop `emptyMessage` to `AutosuggestSearch`
|
|
12
|
+
- feat: Add component `Radio` as a standalone atomic widget
|
|
13
|
+
- feat: Add prop `hideLabel` to `Checkbox` for minimal/atomic use
|
|
14
|
+
- fix: Regression in `Checkbox`- and `Radio`-related option typing
|
|
15
|
+
|
|
16
|
+
## 0.10.113
|
|
17
|
+
|
|
18
|
+
_2023-12-08_
|
|
19
|
+
|
|
20
|
+
- feat: Add component `MainMenu2`
|
|
21
|
+
- feat: Make `Datepicker` more flexible when parsing manual input strings –
|
|
22
|
+
adds several, localized default formats.
|
|
23
|
+
- feat: Add accessibility helper component `FocusTrap`
|
|
24
|
+
- Decouple all mobile-menu toggling logic from the `Layout` component
|
|
25
|
+
- feat: Deprecate `useFormatMonitor` media flags `*Hamburger`, `*Topmenu`
|
|
26
|
+
- feat: Deprecate `useMenuToggling` hook
|
|
27
|
+
- feat: Add `.Layout__header__navlink`
|
|
28
|
+
- feat: Make `MainMenu` define its own toggler button and "Hamburger" mode
|
|
29
|
+
- feat: Add standalone `MobileMenuToggler` component
|
|
30
|
+
- `Multiselect`:
|
|
31
|
+
- fix: Suppress required asterisks on individual options
|
|
32
|
+
- fix: Deduplicate the currentvalues list
|
|
33
|
+
- fix: Manage focus after clicking remove buttons on currentvalues
|
|
34
|
+
- `BasicTable`:
|
|
35
|
+
- feat: Pass `rowData` as 3rd param to `rowProps` callbacks
|
|
36
|
+
- fix: Actually apply `rowProps` to the `<tr/>`s. (Awk)
|
|
37
|
+
- `ButtonPrimary`, `ButtonSecondary`, `ButtonTertiary`, `ButtonBack`,
|
|
38
|
+
`TextButton`:
|
|
39
|
+
- feat: Allow props `className` and `style`
|
|
40
|
+
- feat: Tweak `ContactBubble`'s show/hide scroll-distance thresholds
|
|
41
|
+
- fix: Suppress `MainMenu` server-rendering no-op `<button/>` elements
|
|
42
|
+
|
|
7
43
|
## 0.10.112
|
|
8
44
|
|
|
9
45
|
_2023-11-17_
|
|
@@ -156,7 +192,7 @@ _2023-07-26_
|
|
|
156
192
|
_2023-07-25_
|
|
157
193
|
|
|
158
194
|
- feat: Add optional `altText` parameter to `useGetSVGtext()`
|
|
159
|
-
- feat: Export `useMenuToggling` from
|
|
195
|
+
- feat: Export `useMenuToggling` from `utils` module
|
|
160
196
|
- feat: Export `SSRSupportProps` type
|
|
161
197
|
- perf: Reduce render thrashing of `Layout`'s navChildren
|
|
162
198
|
- fix: `Layout` components set `alt="Reykjavík"` text on their header logo
|
package/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/CarouselStepper.js
CHANGED
|
@@ -10,11 +10,11 @@ const defaultTexts = {
|
|
|
10
10
|
const array = new Array(50).join(' ').split('');
|
|
11
11
|
const CarouselStepper = (props) => {
|
|
12
12
|
const { current, itemCount, setCurrent, texts = defaultTexts, wrapperProps } = props;
|
|
13
|
-
const labelPrefix = texts.prefix ? texts.prefix
|
|
13
|
+
const labelPrefix = texts.prefix ? `${texts.prefix} ` : '';
|
|
14
14
|
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('CarouselStepper', null, (wrapperProps || {}).className) }), array.slice(0, itemCount).map((_, i) => {
|
|
15
15
|
const isCurrent = current === i || undefined;
|
|
16
16
|
const label = labelPrefix + (i + 1);
|
|
17
|
-
return (react_1.default.createElement("button", { key: i, className:
|
|
17
|
+
return (react_1.default.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));
|
|
18
18
|
})));
|
|
19
19
|
};
|
|
20
20
|
exports.CarouselStepper = CarouselStepper;
|
package/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/CityBlock.js
CHANGED
|
@@ -13,7 +13,7 @@ const types = {
|
|
|
13
13
|
const CityBlock = (props) => {
|
|
14
14
|
const align = props.align || 'right';
|
|
15
15
|
const type = !props.illustration && props.type; // The presence of illustration prop suppresses type
|
|
16
|
-
const modifier = [constants_js_1.aligns[align] &&
|
|
16
|
+
const modifier = [constants_js_1.aligns[align] && `align--${align}`, type && types[type] && type];
|
|
17
17
|
const imageProps = props.illustration != null
|
|
18
18
|
? { src: (0, assets_1.getIllustrationUrl)(props.illustration) }
|
|
19
19
|
: props.image;
|
package/ContactBubble.js
CHANGED
|
@@ -59,7 +59,9 @@ const ContactBubble = (props) => {
|
|
|
59
59
|
onToggle && onToggle(false);
|
|
60
60
|
setFocus !== false && (0, focusElm_1.focusElm)(wrapperRef.current);
|
|
61
61
|
},
|
|
62
|
-
}),
|
|
62
|
+
}),
|
|
63
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
+
[useLocalState, onToggle]);
|
|
63
65
|
(0, react_1.useEffect)(() => {
|
|
64
66
|
const wrapperElm = wrapperRef.current;
|
|
65
67
|
if (!wrapperElm) {
|
|
@@ -77,7 +79,8 @@ const ContactBubble = (props) => {
|
|
|
77
79
|
const scrollLength = scrollHeight - clientHeight;
|
|
78
80
|
// const f = scrollLength > 600 ? 1 : (scrollLength - 200) / 600;
|
|
79
81
|
const f = 1;
|
|
80
|
-
const show = scrollTop > f *
|
|
82
|
+
const show = scrollTop > f * 130 && // minimum distance from the top
|
|
83
|
+
scrollLength - scrollTop > f * 200; // ...and bottom
|
|
81
84
|
wrapperElm.dataset.show = String(show);
|
|
82
85
|
!show && closeBubble(false);
|
|
83
86
|
pending = 0;
|
|
@@ -98,7 +101,9 @@ const ContactBubble = (props) => {
|
|
|
98
101
|
document.removeEventListener('scroll', checkScroll);
|
|
99
102
|
document.documentElement.removeEventListener('scroll', checkScroll);
|
|
100
103
|
};
|
|
101
|
-
},
|
|
104
|
+
},
|
|
105
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
106
|
+
[isBrowser, alwaysShow, closeBubble /* , wrapperRef */]);
|
|
102
107
|
(0, react_1.useEffect)(() => {
|
|
103
108
|
const escHandler = (e) => e.key === 'Escape' && closeBubble();
|
|
104
109
|
const outsideClickHandler = (e) => {
|
|
@@ -121,7 +126,9 @@ const ContactBubble = (props) => {
|
|
|
121
126
|
document.removeEventListener('keydown', escHandler);
|
|
122
127
|
document.removeEventListener('click', outsideClickHandler, true);
|
|
123
128
|
};
|
|
124
|
-
},
|
|
129
|
+
},
|
|
130
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
131
|
+
[open, closeBubble /* , wrapperRef */]);
|
|
125
132
|
if (links.length === 0) {
|
|
126
133
|
return null;
|
|
127
134
|
}
|
|
@@ -130,7 +137,7 @@ const ContactBubble = (props) => {
|
|
|
130
137
|
react_1.default.createElement("ul", { className: "ContactBubble__list" }, links.map((linkInfo, i) => {
|
|
131
138
|
const { href, label, extraLabel, target, onClick } = linkInfo;
|
|
132
139
|
const icon = (0, exports.ensureIcon)(linkInfo.icon);
|
|
133
|
-
const itemClass = (0, classUtils_1.modifiedClass)('ContactBubble__item', icon &&
|
|
140
|
+
const itemClass = (0, classUtils_1.modifiedClass)('ContactBubble__item', icon && `type--${icon}`);
|
|
134
141
|
const onClickHandler = (e) => {
|
|
135
142
|
if (onClick) {
|
|
136
143
|
const doPreventDefault = onClick() !== true;
|
package/Datepicker.d.ts
CHANGED
package/Datepicker.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Datepicker = exports.getDateDiff = 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 i18n_1 = require("@reykjavik/hanna-utils/i18n");
|
|
7
7
|
// For more info on localization see: https://stackoverflow.com/questions/54399084/change-locale-in-react-datepicker/58306958#58306958
|
|
8
8
|
const index_js_1 = tslib_1.__importDefault(require("date-fns/locale/is/index.js"));
|
|
@@ -40,6 +40,16 @@ const defaultDatepickerTexts = {
|
|
|
40
40
|
monthAriaLabelPrefix: 'Mánuður:',
|
|
41
41
|
chooseDayAriaLabelPrefix: 'Veldu:',
|
|
42
42
|
disabledDayAriaLabelPrefix: 'Ekki í boði:',
|
|
43
|
+
dateFormats: [
|
|
44
|
+
'dd.MM.yyyy',
|
|
45
|
+
'dd.MM.yy',
|
|
46
|
+
'dd/MM/yyyy',
|
|
47
|
+
'dd/MM/yy',
|
|
48
|
+
'dd. MM. yyyy',
|
|
49
|
+
'dd. MM. yy',
|
|
50
|
+
'dd MM yyyy',
|
|
51
|
+
'dd MM yy',
|
|
52
|
+
],
|
|
43
53
|
},
|
|
44
54
|
// React-datepicker has its own (default) English translation built in.
|
|
45
55
|
// No need to repeat all of it here.
|
|
@@ -59,6 +69,16 @@ const defaultDatepickerTexts = {
|
|
|
59
69
|
monthAriaLabelPrefix: 'Month:',
|
|
60
70
|
chooseDayAriaLabelPrefix: 'Choose:',
|
|
61
71
|
disabledDayAriaLabelPrefix: 'Not available:',
|
|
72
|
+
dateFormats: [
|
|
73
|
+
'MM.dd.yyyy',
|
|
74
|
+
'MM.dd.yy',
|
|
75
|
+
'MM/dd/yyyy',
|
|
76
|
+
'MM/dd/yy',
|
|
77
|
+
'MM. dd. yyyy',
|
|
78
|
+
'MM. dd. yy',
|
|
79
|
+
'MM dd yyyy',
|
|
80
|
+
'MM dd yy',
|
|
81
|
+
],
|
|
62
82
|
},
|
|
63
83
|
pl: {
|
|
64
84
|
ariaLabelClose: 'Zamknij',
|
|
@@ -76,6 +96,16 @@ const defaultDatepickerTexts = {
|
|
|
76
96
|
monthAriaLabelPrefix: 'Miesiąc:',
|
|
77
97
|
chooseDayAriaLabelPrefix: 'Wybierać:',
|
|
78
98
|
disabledDayAriaLabelPrefix: 'Niedostępna:',
|
|
99
|
+
dateFormats: [
|
|
100
|
+
'dd.MM.yyyy',
|
|
101
|
+
'dd.MM.yy',
|
|
102
|
+
'dd/MM/yyyy',
|
|
103
|
+
'dd/MM/yy',
|
|
104
|
+
'dd. MM. yyyy',
|
|
105
|
+
'dd. MM. yy',
|
|
106
|
+
'dd MM yyyy',
|
|
107
|
+
'dd MM yy',
|
|
108
|
+
],
|
|
79
109
|
},
|
|
80
110
|
};
|
|
81
111
|
/**
|
|
@@ -84,7 +114,8 @@ const defaultDatepickerTexts = {
|
|
|
84
114
|
* Internally, this component uses the [`react-datepicker`](https://reactdatepicker.com/) component.
|
|
85
115
|
*/
|
|
86
116
|
const Datepicker = (props) => {
|
|
87
|
-
const { placeholder, dateFormat
|
|
117
|
+
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
|
|
118
|
+
fieldWrapperProps, } = (0, FormField_js_1.groupFormFieldWrapperProps)(props);
|
|
88
119
|
const [value, setValue] = utils_js_1.useMixedControlState.raw(props.value || props.initialDate, // eslint-disable-line deprecation/deprecation
|
|
89
120
|
props.defaultValue, 'value');
|
|
90
121
|
/*
|
|
@@ -96,6 +127,24 @@ const Datepicker = (props) => {
|
|
|
96
127
|
const txts = (0, i18n_1.getTexts)({ texts, lang }, defaultDatepickerTexts);
|
|
97
128
|
const filled = !!value;
|
|
98
129
|
const empty = !filled && !placeholder;
|
|
130
|
+
const normalizedDateFormats = (0, react_1.useMemo)(() => {
|
|
131
|
+
const dateFormatProp = !dateFormat
|
|
132
|
+
? ['d.M.yyyy']
|
|
133
|
+
: typeof dateFormat === 'string'
|
|
134
|
+
? [dateFormat]
|
|
135
|
+
: dateFormat.slice(0);
|
|
136
|
+
// NOTE: Force all dateFormat values into Array<string> to temporarily work around
|
|
137
|
+
// a bug in the current version of react-datepicker where invalid `string` values
|
|
138
|
+
// are re-parsed with `new Date()`, causing surprising (weird) false positives
|
|
139
|
+
// AND where Arrayed formats get parsed in order of "increasing priority".
|
|
140
|
+
//
|
|
141
|
+
// TODO: Revert back to the plain `dateFormat={dateFormat}` pass-through once
|
|
142
|
+
// https://github.com/Hacker0x01/react-datepicker/pull/3988 has been accepted and released.
|
|
143
|
+
return dateFormatProp
|
|
144
|
+
.concat(['yyyy-MM-dd'])
|
|
145
|
+
.concat(txts.dateFormats)
|
|
146
|
+
.concat(['P', 'PP', 'PPP']);
|
|
147
|
+
}, [dateFormat, txts]);
|
|
99
148
|
return (react_1.default.createElement(FormField_js_1.FormField, Object.assign({ extraClassName: "Datepicker", filled: filled, empty: empty }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => {
|
|
100
149
|
return (react_1.default.createElement("div", Object.assign({ className: className.input, onClick: ({ target, currentTarget }) => { var _a; return target === currentTarget && ((_a = currentTarget.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus()); }, ref: inputRef &&
|
|
101
150
|
((elm) => {
|
|
@@ -104,17 +153,7 @@ const Datepicker = (props) => {
|
|
|
104
153
|
return elm;
|
|
105
154
|
}) }, addFocusProps()),
|
|
106
155
|
isoMode && (react_1.default.createElement("input", { type: "hidden", name: name, value: value === null || value === void 0 ? void 0 : value.toISOString().slice(0, 10) })),
|
|
107
|
-
react_1.default.createElement(ReactDatepicker_js_1.ReactDatePicker, Object.assign({ id: domid, required: inputProps.required, disabled: inputProps.disabled, readOnly: inputProps.readOnly, selected: value, name: isoMode ? undefined : name, locale: lang, dateFormat:
|
|
108
|
-
// NOTE: Force all dateFormat values into Array<string> to temporarily work around
|
|
109
|
-
// a bug in the current version of react-datepicker where invalid `string` values
|
|
110
|
-
// are re-parsed with `new Date()`, causing surprising (weird) false positives
|
|
111
|
-
// AND where Arrayed formats get parsed in order of "increasing priority".
|
|
112
|
-
//
|
|
113
|
-
// TODO: Revert back to the plain `dateFormat={dateFormat}` pass-through once
|
|
114
|
-
// https://github.com/Hacker0x01/react-datepicker/pull/3988 has been accepted and released.
|
|
115
|
-
typeof dateFormat === 'string'
|
|
116
|
-
? [dateFormat]
|
|
117
|
-
: dateFormat.slice(0).reverse(), onChange: (date) => {
|
|
156
|
+
react_1.default.createElement(ReactDatepicker_js_1.ReactDatePicker, Object.assign({ id: domid, required: inputProps.required, disabled: inputProps.disabled, readOnly: inputProps.readOnly, selected: value, name: isoMode ? undefined : name, locale: lang, dateFormat: normalizedDateFormats, onChange: (date) => {
|
|
118
157
|
date = date || undefined;
|
|
119
158
|
setValue(date);
|
|
120
159
|
onChange && onChange(date);
|
|
@@ -36,7 +36,7 @@ const formatBytes = (bytes, lang = 'is', decimals = 2) => {
|
|
|
36
36
|
}
|
|
37
37
|
const i = Math.min(Math.floor(Math.log(Math.abs(bytes) / kThreshold) / Math.log(k)), units.length - 1);
|
|
38
38
|
const scaled = bytes / Math.pow(k, i);
|
|
39
|
-
const formatted =
|
|
39
|
+
const formatted = `${parseFloat(scaled.toFixed(decimals))}`.replace('.',
|
|
40
40
|
// NOTE: As of 2022-11 Chrome still doesn't support Icelandic
|
|
41
41
|
decimalSymbols[lang] || (1.1).toLocaleString(lang)[1]);
|
|
42
42
|
return `${formatted} ${units[i]}`;
|
package/FileInput.js
CHANGED
|
@@ -16,12 +16,11 @@ const defaultRemoveFileText = {
|
|
|
16
16
|
pl: 'Usuń',
|
|
17
17
|
};
|
|
18
18
|
const defaultOnFilesRejected = (rejectedFiles) => {
|
|
19
|
-
window.alert(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
.join(', '));
|
|
19
|
+
window.alert(`Error:\n${rejectedFiles
|
|
20
|
+
.map((elm) => {
|
|
21
|
+
return elm.name;
|
|
22
|
+
})
|
|
23
|
+
.join(', ')}`);
|
|
25
24
|
};
|
|
26
25
|
const arrayToFileList = (arr) => {
|
|
27
26
|
const fileList = new DataTransfer();
|
|
@@ -109,7 +108,7 @@ const FileInput = (props) => {
|
|
|
109
108
|
}
|
|
110
109
|
onFilesUpdated(fileList, diff);
|
|
111
110
|
};
|
|
112
|
-
return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: (0, classUtils_1.modifiedClass)('FileInput', [multiple && 'multi']) }, fieldWrapperProps, { id: domid
|
|
111
|
+
return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: (0, classUtils_1.modifiedClass)('FileInput', [multiple && 'multi']) }, fieldWrapperProps, { id: `${domid}-fake`, LabelTag: "h4", renderInput: (className, inputProps /* , addFocusProps */) => {
|
|
113
112
|
return (react_1.default.createElement("div", { className: className.control, ref: fileInputWrapper },
|
|
114
113
|
// Explicitly skip rendering of input element if no
|
|
115
114
|
// name prop is provided. This is implicitly what the
|
|
@@ -10,5 +10,9 @@ export type FocusTrapProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
depth?: number;
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* A focus trap element that can be used to keep keyboard focus within a container block.
|
|
15
|
+
*
|
|
16
|
+
* Make sure you only trap focus when a modal or
|
|
17
|
+
*/
|
|
14
18
|
export declare const FocusTrap: (props: FocusTrapProps) => JSX.Element;
|
|
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FocusTrap = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* A focus trap element that can be used to keep keyboard focus within a container block.
|
|
8
|
+
*
|
|
9
|
+
* Make sure you only trap focus when a modal or
|
|
10
|
+
*/
|
|
7
11
|
const FocusTrap = (props) => {
|
|
8
12
|
const Tag = props.Tag || 'span';
|
|
9
13
|
return (react_1.default.createElement(Tag, { tabIndex: 0, onFocus: (e) => {
|
package/Form.js
CHANGED
|
@@ -8,7 +8,7 @@ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
|
8
8
|
// it makes little sense to add support for `wrapperProps` on top.
|
|
9
9
|
const Form = (props) => {
|
|
10
10
|
const { children, align, wide, className } = props, formProps = tslib_1.__rest(props, ["children", "align", "wide", "className"]);
|
|
11
|
-
return (react_1.default.createElement("form", Object.assign({}, formProps, { className: (0, classUtils_1.modifiedClass)('Form', [align === 'right' &&
|
|
11
|
+
return (react_1.default.createElement("form", Object.assign({}, formProps, { className: (0, classUtils_1.modifiedClass)('Form', [align === 'right' && `align--${align}`, !align && wide && 'wide'], className) }), children));
|
|
12
12
|
};
|
|
13
13
|
exports.Form = Form;
|
|
14
14
|
exports.default = exports.Form;
|
package/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
|
};
|
package/FormField.js
CHANGED
|
@@ -64,7 +64,7 @@ const FormField = (props) => {
|
|
|
64
64
|
required: required,
|
|
65
65
|
readOnly: readOnly,
|
|
66
66
|
'aria-invalid': isInvalid,
|
|
67
|
-
'aria-describedby': assistTextId && errorId ? assistTextId
|
|
67
|
+
'aria-describedby': assistTextId && errorId ? `${assistTextId} ${errorId}` : assistTextId || errorId,
|
|
68
68
|
'aria-labelledby': labelId, // undefined if normalLabel
|
|
69
69
|
};
|
|
70
70
|
return (react_1.default.createElement("div", Object.assign({ ref: props.wrapperRef }, wrapperProps, { className: (0, classUtils_1.modifiedClass)('FormField', [
|
package/Heading.js
CHANGED
|
@@ -16,7 +16,7 @@ const Heading = (props) => {
|
|
|
16
16
|
const suppressWarning = process.env.NODE_ENV !== 'production' && Tag === 'h1' ? true : undefined;
|
|
17
17
|
return (react_1.default.createElement(Tag, Object.assign({}, wrapperProps, { "data-dev-forcedh1": suppressWarning, className: (0, classUtils_1.modifiedClass)('Heading', [
|
|
18
18
|
sizes[size],
|
|
19
|
-
align === 'right' &&
|
|
19
|
+
align === 'right' && `align--${align}`,
|
|
20
20
|
!align && wide && 'wide',
|
|
21
21
|
(wrapperProps || {}).className,
|
|
22
22
|
]) }), children));
|
package/IframeBlock.js
CHANGED
|
@@ -15,7 +15,7 @@ const iframe_resizer_react_1 = tslib_1.__importDefault(require("iframe-resizer-r
|
|
|
15
15
|
*/
|
|
16
16
|
const IframeBlock = (props) => {
|
|
17
17
|
const { title, src, framed, compact, align } = props;
|
|
18
|
-
const className = (0, classUtils_1.modifiedClass)('IframeBlock', [framed && 'framed', compact && 'compact', align === 'right' &&
|
|
18
|
+
const className = (0, classUtils_1.modifiedClass)('IframeBlock', [framed && 'framed', compact && 'compact', align === 'right' && `align--${align}`], (props.wrapperProps || {}).className);
|
|
19
19
|
if (typeof props.height === 'number') {
|
|
20
20
|
const { wrapperProps, scrolling, height } = props;
|
|
21
21
|
return (react_1.default.createElement("iframe", Object.assign({}, wrapperProps, { className: className, title: title, src: src,
|
package/InfoHero.js
CHANGED
|
@@ -74,7 +74,7 @@ const InfoHero = (props) => {
|
|
|
74
74
|
const blings = typeof blingType === 'object'
|
|
75
75
|
? blingType
|
|
76
76
|
: (blingType && blingOptions[blingType]) || blingOptions.waves; // default to `waves`
|
|
77
|
-
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('InfoHero',
|
|
77
|
+
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('InfoHero', `align--${alignment}`, (wrapperProps || {}).className) }),
|
|
78
78
|
react_1.default.createElement("div", { className: "InfoHero__content" },
|
|
79
79
|
react_1.default.createElement("h1", { className: "InfoHero__title" }, title),
|
|
80
80
|
titleBlurb && react_1.default.createElement("div", { className: "InfoHero__titleblurb" }, titleBlurb),
|
package/IslandBlock.js
CHANGED
|
@@ -15,7 +15,7 @@ const IslandBlock = (props) => {
|
|
|
15
15
|
content,
|
|
16
16
|
image: shapes ? { src: (0, assets_1.getFormheimurUrl)(shapes), inline: true } : image || {},
|
|
17
17
|
};
|
|
18
|
-
return (react_1.default.createElement(_Block_js_1.Block, Object.assign({ wrapperProps: wrapperProps, bem: "IslandBlock", modifier:
|
|
18
|
+
return (react_1.default.createElement(_Block_js_1.Block, Object.assign({ wrapperProps: wrapperProps, bem: "IslandBlock", modifier: `align--${alignment}` }, blockProps)));
|
|
19
19
|
};
|
|
20
20
|
exports.IslandBlock = IslandBlock;
|
|
21
21
|
exports.default = exports.IslandBlock;
|
package/IslandPageBlock.js
CHANGED
|
@@ -15,7 +15,7 @@ const IslandPageBlock = (props) => {
|
|
|
15
15
|
const { title, summary, buttons, illustration, image, align, background, wrapperProps, } = props;
|
|
16
16
|
const alignment = align && constants_js_1.aligns[align] ? align : 'right';
|
|
17
17
|
const bg = backgrounds[background || 'none'];
|
|
18
|
-
return (react_1.default.createElement(_Block_js_1.Block, { wrapperProps: wrapperProps, bem: "IslandPageBlock", modifier: [
|
|
18
|
+
return (react_1.default.createElement(_Block_js_1.Block, { wrapperProps: wrapperProps, bem: "IslandPageBlock", modifier: [`align--${alignment}`, bg && `background--${bg}`], content: { title, summary, buttons }, image: illustration ? { src: (0, assets_1.getIllustrationUrl)(illustration) } : image }));
|
|
19
19
|
};
|
|
20
20
|
exports.IslandPageBlock = IslandPageBlock;
|
|
21
21
|
exports.default = exports.IslandPageBlock;
|
package/Layout.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ import type { HannaColorTheme } from '@reykjavik/hanna-css';
|
|
|
3
3
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
4
4
|
import { DefaultTexts, HannaLang } from '@reykjavik/hanna-utils/i18n';
|
|
5
5
|
import { BemModifierProps } from './utils/types.js';
|
|
6
|
-
import {
|
|
6
|
+
import { SSRSupport, WrapperElmProps } from './utils.js';
|
|
7
7
|
export type LayoutI18n = {
|
|
8
8
|
skipLinkLabel: string;
|
|
9
|
-
|
|
9
|
+
/** @deprecated Not used (Will be removed in v0.11) */
|
|
10
|
+
closeMenuLabel?: string;
|
|
11
|
+
/** @deprecated Not used (Will be removed in v0.11) */
|
|
10
12
|
closeMenuLabelLong?: string;
|
|
11
13
|
/** @deprecated Not used (Will be removed in v0.11) */
|
|
12
14
|
lang?: string;
|
|
@@ -21,7 +23,9 @@ type LayoutProps = {
|
|
|
21
23
|
siteName?: string;
|
|
22
24
|
texts?: LayoutI18n;
|
|
23
25
|
lang?: HannaLang;
|
|
24
|
-
|
|
26
|
+
/** @deprecated Not used (Will be removed in v0.11) */
|
|
27
|
+
ssr?: SSRSupport;
|
|
28
|
+
} & WrapperElmProps & BemModifierProps & EitherObj<{
|
|
25
29
|
mainChildren: ReactNode;
|
|
26
30
|
}, {
|
|
27
31
|
children: ReactNode;
|