@reykjavik/hanna-react 0.10.102 → 0.10.104
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 +2 -2
- package/Alert.d.ts +2 -2
- package/Alert.js +1 -0
- package/AutosuggestSearch.d.ts +40 -0
- package/AutosuggestSearch.js +70 -0
- package/BasicTable.d.ts +24 -4
- package/BasicTable.js +20 -19
- package/BreadCrumbs.d.ts +2 -2
- package/CHANGELOG.md +43 -0
- package/ContactBubble.d.ts +4 -3
- package/ContactBubble.js +7 -4
- package/Datepicker.d.ts +8 -3
- package/Datepicker.js +36 -14
- package/FileInput.d.ts +2 -1
- package/FileInput.js +2 -2
- package/FormField.js +2 -2
- package/Gallery.d.ts +2 -1
- package/Gallery.js +5 -0
- package/InfoHero.d.ts +2 -1
- package/InfoHero.js +3 -2
- package/Layout.d.ts +4 -3
- package/Layout.js +0 -3
- package/MainMenu/_PrimaryPanel.d.ts +3 -4
- package/MainMenu/_PrimaryPanel.js +1 -1
- package/MainMenu.d.ts +6 -4
- package/MainMenu.js +8 -16
- package/Multiselect.d.ts +2 -1
- package/Multiselect.js +4 -3
- package/NameCard.d.ts +2 -1
- package/NameCard.js +7 -0
- package/NewsHero.d.ts +2 -1
- package/NewsHero.js +4 -1
- package/Pagination.d.ts +2 -2
- package/ReadSpeakerPlayer.js +13 -5
- package/SearchInput.d.ts +24 -2
- package/SearchInput.js +13 -3
- package/SearchResults.d.ts +2 -1
- package/SearchResults.js +10 -2
- package/ShareButtons.d.ts +3 -2
- package/SiteSearchAutocomplete.d.ts +11 -11
- package/SiteSearchAutocomplete.js +21 -7
- package/SiteSearchCurtain.js +2 -2
- package/SiteSearchInput.d.ts +19 -10
- package/SiteSearchInput.js +9 -6
- package/Tabs.d.ts +1 -1
- package/Tabs.js +2 -2
- package/Tooltip.js +4 -3
- package/VerticalTabsTOC.js +3 -3
- package/_abstract/_Blings.d.ts +3 -2
- package/_abstract/_ScrollWrapper.d.ts +10 -0
- package/_abstract/_ScrollWrapper.js +21 -0
- package/_abstract/_Table.d.ts +71 -0
- package/_abstract/_Table.js +55 -0
- package/_abstract/_TogglerGroup.js +2 -2
- package/_abstract/_TogglerInput.js +2 -2
- package/_mixed_export_resolution_/ReactDatepicker.d.ts +3 -0
- package/esm/AccordionList.js +1 -1
- package/esm/Alert.d.ts +2 -2
- package/esm/Alert.js +1 -0
- package/esm/AutosuggestSearch.d.ts +40 -0
- package/esm/AutosuggestSearch.js +66 -0
- package/esm/BasicTable.d.ts +24 -4
- package/esm/BasicTable.js +19 -18
- package/esm/BreadCrumbs.d.ts +2 -2
- package/esm/ContactBubble.d.ts +4 -3
- package/esm/ContactBubble.js +6 -3
- package/esm/Datepicker.d.ts +8 -3
- package/esm/Datepicker.js +35 -13
- package/esm/FileInput.d.ts +2 -1
- package/esm/FileInput.js +1 -1
- package/esm/FormField.js +1 -1
- package/esm/Gallery.d.ts +2 -1
- package/esm/Gallery.js +5 -0
- package/esm/InfoHero.d.ts +2 -1
- package/esm/InfoHero.js +3 -2
- package/esm/Layout.d.ts +4 -3
- package/esm/Layout.js +0 -3
- package/esm/MainMenu/_PrimaryPanel.d.ts +3 -4
- package/esm/MainMenu/_PrimaryPanel.js +1 -1
- package/esm/MainMenu.d.ts +6 -4
- package/esm/MainMenu.js +8 -16
- package/esm/Multiselect.d.ts +2 -1
- package/esm/Multiselect.js +2 -1
- package/esm/NameCard.d.ts +2 -1
- package/esm/NameCard.js +7 -0
- package/esm/NewsHero.d.ts +2 -1
- package/esm/NewsHero.js +4 -1
- package/esm/Pagination.d.ts +2 -2
- package/esm/ReadSpeakerPlayer.js +13 -5
- package/esm/SearchInput.d.ts +24 -2
- package/esm/SearchInput.js +13 -3
- package/esm/SearchResults.d.ts +2 -1
- package/esm/SearchResults.js +9 -1
- package/esm/ShareButtons.d.ts +3 -2
- package/esm/SiteSearchAutocomplete.d.ts +11 -11
- package/esm/SiteSearchAutocomplete.js +21 -7
- package/esm/SiteSearchCurtain.js +1 -1
- package/esm/SiteSearchInput.d.ts +19 -10
- package/esm/SiteSearchInput.js +8 -6
- package/esm/Tabs.d.ts +1 -1
- package/esm/Tabs.js +2 -2
- package/esm/Tooltip.js +2 -1
- package/esm/VerticalTabsTOC.js +2 -2
- package/esm/_abstract/_Blings.d.ts +3 -2
- package/esm/_abstract/_ScrollWrapper.d.ts +10 -0
- package/esm/_abstract/_ScrollWrapper.js +16 -0
- package/esm/_abstract/_Table.d.ts +71 -0
- package/esm/_abstract/_Table.js +51 -0
- package/esm/_abstract/_TogglerGroup.js +1 -1
- package/esm/_abstract/_TogglerInput.js +1 -1
- package/esm/_mixed_export_resolution_/ReactDatepicker.d.ts +3 -0
- package/esm/index.d.ts +1 -0
- package/esm/utils/browserSide.d.ts +119 -1
- package/esm/utils/browserSide.js +152 -1
- package/esm/utils/config.d.ts +1 -14
- package/esm/utils/config.js +0 -2
- package/esm/utils/seenEffect.d.ts +2 -2
- package/esm/utils/useCallbackOnEsc.d.ts +6 -0
- package/esm/utils/useCallbackOnEsc.js +25 -0
- package/esm/utils/useDomid.d.ts +8 -0
- package/esm/utils/useDomid.js +17 -0
- package/esm/utils/useLaggedState.d.ts +18 -0
- package/esm/utils/useLaggedState.js +84 -0
- package/esm/utils/useOnClickOutside.d.ts +9 -0
- package/esm/utils/useOnClickOutside.js +32 -0
- package/esm/utils/useScrollEdgeDetect.d.ts +15 -0
- package/esm/utils/useScrollEdgeDetect.js +45 -0
- package/esm/utils/useShortState.d.ts +2 -0
- package/esm/utils/useShortState.js +34 -0
- package/esm/utils.d.ts +1 -0
- package/esm/utils.js +1 -0
- package/index.d.ts +1 -0
- package/package.json +6 -2
- package/utils/browserSide.d.ts +119 -1
- package/utils/browserSide.js +156 -4
- package/utils/config.d.ts +1 -14
- package/utils/config.js +1 -4
- package/utils/seenEffect.d.ts +2 -2
- package/utils/useCallbackOnEsc.d.ts +6 -0
- package/utils/useCallbackOnEsc.js +29 -0
- package/utils/useDomid.d.ts +8 -0
- package/utils/useDomid.js +21 -0
- package/utils/useLaggedState.d.ts +18 -0
- package/utils/useLaggedState.js +88 -0
- package/utils/useOnClickOutside.d.ts +9 -0
- package/utils/useOnClickOutside.js +35 -0
- package/utils/useScrollEdgeDetect.d.ts +15 -0
- package/utils/useScrollEdgeDetect.js +50 -0
- package/utils/useShortState.d.ts +2 -0
- package/utils/useShortState.js +38 -0
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
package/AccordionList.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.AccordionList = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
|
-
const
|
|
7
|
+
const useDomid_js_1 = require("./utils/useDomid.js");
|
|
8
8
|
const utils_js_1 = require("./utils.js");
|
|
9
9
|
const AccordionListItem = (props) => {
|
|
10
10
|
const { title, content, id, disabled = false, ssr, open, onToggle } = props;
|
|
11
11
|
const defaultOpen = (0, react_1.useRef)(props.defaultOpen);
|
|
12
|
-
const domid = (0,
|
|
12
|
+
const domid = (0, useDomid_js_1.useDomid)();
|
|
13
13
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
|
14
14
|
const itemDisabled = (isBrowser && disabled) || !content;
|
|
15
15
|
return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('AccordionList__item', [itemDisabled && 'disabled']), id: id, "data-start-open": defaultOpen.current, "data-sprinkled": isBrowser },
|
package/Alert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
3
|
-
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
3
|
+
import { DefaultTexts, HannaLang } from '@reykjavik/hanna-utils/i18n';
|
|
4
4
|
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
5
5
|
export type AlertI18n = {
|
|
6
6
|
closeLabel: string;
|
|
@@ -23,7 +23,7 @@ export type AlertProps = {
|
|
|
23
23
|
/** server-side anchor href */
|
|
24
24
|
closeUrl?: string;
|
|
25
25
|
texts?: AlertI18n;
|
|
26
|
-
lang?:
|
|
26
|
+
lang?: HannaLang;
|
|
27
27
|
} & SSRSupportProps & EitherObj<{
|
|
28
28
|
/** Seconds until the Alert auto-closes.
|
|
29
29
|
*
|
package/Alert.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RenderInputComponentProps } from 'react-autosuggest';
|
|
2
|
+
import { DefaultTexts, HannaLang } from '@reykjavik/hanna-utils/i18n';
|
|
3
|
+
import { SearchInputProps } from './SearchInput.js';
|
|
4
|
+
import { SiteSearchInputProps } from './SiteSearchInput.js';
|
|
5
|
+
import { WrapperElmProps } from './utils.js';
|
|
6
|
+
export type AutosuggestSearchI18n = {
|
|
7
|
+
/** Label for the autocomplete's combobox container div */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Label for the text input */
|
|
10
|
+
inputLabel: string;
|
|
11
|
+
/** Label for the search button */
|
|
12
|
+
buttonText: string;
|
|
13
|
+
/** Placeholder text for the text input */
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
/** Label for the suggestions item list container */
|
|
16
|
+
suggestionsLabel: string;
|
|
17
|
+
/** @deprecated Not used (Will be removed in v0.11) */
|
|
18
|
+
lang?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const defaultAutosuggestSearchTexts: DefaultTexts<AutosuggestSearchI18n>;
|
|
21
|
+
export type AutosuggestSearchProps<T extends string | object> = {
|
|
22
|
+
options: Array<T>;
|
|
23
|
+
onInput: (value: string) => void;
|
|
24
|
+
onSelected: (payload: {
|
|
25
|
+
value: string;
|
|
26
|
+
option: T;
|
|
27
|
+
}) => void;
|
|
28
|
+
onClearOptions: () => void;
|
|
29
|
+
getOptionValue?: (option: T) => string;
|
|
30
|
+
renderSuggestion?: (option: T, context: {
|
|
31
|
+
query: string;
|
|
32
|
+
isHighlighted: boolean;
|
|
33
|
+
}) => JSX.Element | string;
|
|
34
|
+
itemActionIcon?: 'search' | 'go';
|
|
35
|
+
InputComponent?: (props: SiteSearchInputProps & SearchInputProps) => JSX.Element;
|
|
36
|
+
renderInputField?: (inputProps: RenderInputComponentProps, texts: AutosuggestSearchI18n) => JSX.Element;
|
|
37
|
+
texts?: AutosuggestSearchI18n;
|
|
38
|
+
lang?: HannaLang;
|
|
39
|
+
} & Pick<SearchInputProps, 'onSubmit' | 'onButtonClick' | 'button'> & WrapperElmProps;
|
|
40
|
+
export declare const AutosuggestSearch: <T extends string | object>(props: AutosuggestSearchProps<T>) => JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutosuggestSearch = exports.defaultAutosuggestSearchTexts = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_autosuggest_1 = tslib_1.__importDefault(require("react-autosuggest"));
|
|
7
|
+
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
8
|
+
const i18n_1 = require("@reykjavik/hanna-utils/i18n");
|
|
9
|
+
const SearchInput_js_1 = tslib_1.__importDefault(require("./SearchInput.js"));
|
|
10
|
+
exports.defaultAutosuggestSearchTexts = {
|
|
11
|
+
is: {
|
|
12
|
+
label: 'Leit á vefnum',
|
|
13
|
+
inputLabel: 'Leitarorð',
|
|
14
|
+
buttonText: 'Leita',
|
|
15
|
+
placeholder: 'Sláðu inn leitarorð',
|
|
16
|
+
suggestionsLabel: 'Tillögur',
|
|
17
|
+
},
|
|
18
|
+
en: {
|
|
19
|
+
label: 'Site search',
|
|
20
|
+
inputLabel: 'Search terms',
|
|
21
|
+
buttonText: 'Search',
|
|
22
|
+
placeholder: 'Enter search terms',
|
|
23
|
+
suggestionsLabel: 'Suggestions',
|
|
24
|
+
},
|
|
25
|
+
pl: {
|
|
26
|
+
label: 'Wyszukiwanie na stronie',
|
|
27
|
+
inputLabel: 'Wyszukaj frazę',
|
|
28
|
+
buttonText: 'Szukaj',
|
|
29
|
+
placeholder: 'Wpisz frazę',
|
|
30
|
+
suggestionsLabel: 'Sugestie',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const AutosuggestSearch = (props) => {
|
|
34
|
+
const { options, itemActionIcon, onInput, onSelected, onClearOptions, onSubmit, onButtonClick = onSubmit, button, getOptionValue = (opt) => typeof opt !== 'object' || !('value' in opt)
|
|
35
|
+
? opt.toString()
|
|
36
|
+
: opt.value != null
|
|
37
|
+
? opt.value.toString()
|
|
38
|
+
: '', renderSuggestion = (opt) => typeof opt === 'object' && 'label' in opt && opt.label != null
|
|
39
|
+
? opt.label.toString()
|
|
40
|
+
: getOptionValue(opt), InputComponent = SearchInput_js_1.default, renderInputField, wrapperProps, } = props;
|
|
41
|
+
const [value, setValue] = (0, react_1.useState)('');
|
|
42
|
+
const inputRef = (0, react_1.createRef)();
|
|
43
|
+
const txt = (0, i18n_1.getTexts)(props, exports.defaultAutosuggestSearchTexts);
|
|
44
|
+
return (react_1.default.createElement(react_autosuggest_1.default, { theme: {
|
|
45
|
+
container: 'AutosuggestSearch',
|
|
46
|
+
containerOpen: 'AutosuggestSearch--open',
|
|
47
|
+
suggestionsContainer: 'AutosuggestSearch__container',
|
|
48
|
+
suggestionsContainerOpen: 'AutosuggestSearch__container--open',
|
|
49
|
+
suggestionsList: (0, classUtils_1.modifiedClass)('AutosuggestSearch__list', itemActionIcon && `action--${itemActionIcon}`),
|
|
50
|
+
suggestion: 'AutosuggestSearch__item',
|
|
51
|
+
suggestionHighlighted: 'AutosuggestSearch__item--highlighted',
|
|
52
|
+
}, focusInputOnSuggestionClick: true, suggestions: options, onSuggestionsClearRequested: onClearOptions, onSuggestionsFetchRequested: ({ value }) => onInput(value), getSuggestionValue: getOptionValue, onSuggestionSelected: (_event, data) => {
|
|
53
|
+
onSelected({ value: data.suggestionValue, option: data.suggestion });
|
|
54
|
+
},
|
|
55
|
+
// onSuggestionHighlighted={onSuggestionHighlighted}
|
|
56
|
+
renderSuggestion: renderSuggestion, containerProps: Object.assign(Object.assign({}, wrapperProps), { 'aria-label': txt.label }), renderSuggestionsContainer: ({ containerProps, children }) => (react_1.default.createElement("div", Object.assign({}, containerProps, { "aria-label": options.length ? txt.suggestionsLabel : undefined }), children)), inputProps: {
|
|
57
|
+
ref: inputRef,
|
|
58
|
+
value: value,
|
|
59
|
+
onChange: (_, { newValue }) => {
|
|
60
|
+
setValue(newValue);
|
|
61
|
+
},
|
|
62
|
+
}, renderInputComponent: renderInputField
|
|
63
|
+
? (inputProps) => renderInputField(inputProps, txt)
|
|
64
|
+
: (inputProps) => {
|
|
65
|
+
/* prettier-ignore */
|
|
66
|
+
const { className, type, disabled, readOnly, required, children } = inputProps, siteSearchProps = tslib_1.__rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
|
|
67
|
+
return (react_1.default.createElement(InputComponent, Object.assign({ lang: props.lang }, siteSearchProps, { button: button, label: txt.inputLabel, placeholder: txt.placeholder, buttonText: txt.buttonText, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
|
|
68
|
+
} }));
|
|
69
|
+
};
|
|
70
|
+
exports.AutosuggestSearch = AutosuggestSearch;
|
package/BasicTable.d.ts
CHANGED
|
@@ -1,15 +1,35 @@
|
|
|
1
|
-
import { TableProps } from '@hugsmidjan/react/Table';
|
|
2
1
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
2
|
+
import { TableProps } from './_abstract/_Table.js';
|
|
3
3
|
import { DeprecatedSeenProp } from './utils/seenEffect.js';
|
|
4
|
-
import {
|
|
4
|
+
import { HTMLProps, WrapperElmProps } from './utils.js';
|
|
5
|
+
type TableType = 'text' | 'number';
|
|
6
|
+
export type { TableBody, TableCell, TableCellData, TableCellMeta, TableCols, TableFoot, TableHead, TableRow, } from './_abstract/_Table.js';
|
|
5
7
|
export type BasicTableProps = {
|
|
6
8
|
compact?: boolean;
|
|
7
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The main/default cell-data type of the table
|
|
11
|
+
*
|
|
12
|
+
* Defaults to 'text'
|
|
13
|
+
*/
|
|
14
|
+
type?: TableType;
|
|
15
|
+
/**
|
|
16
|
+
* Custom HTML attributes for the component's `<table/>` element.
|
|
17
|
+
*
|
|
18
|
+
* Note, however, that some props may be intentionally
|
|
19
|
+
* excluded from the list.
|
|
20
|
+
*
|
|
21
|
+
* __WARNING:__
|
|
22
|
+
* In some cases props added this way can break the component, og hurt its
|
|
23
|
+
* accessibility. Also, some props may get ignored, or over-ridden by the
|
|
24
|
+
* component. User discretion is advised.
|
|
25
|
+
*/
|
|
26
|
+
tableProps?: HTMLProps<'table'>;
|
|
27
|
+
/** @deprecated Use `wrapperProps={{ className }}` and `tableProps={{ className }}` instead (Will be removed in v0.11) */
|
|
8
28
|
modifier?: string;
|
|
9
29
|
} & EitherObj<{
|
|
10
30
|
fullWidth?: boolean;
|
|
11
31
|
}, {
|
|
12
32
|
align?: 'right';
|
|
13
|
-
}> &
|
|
33
|
+
}> & WrapperElmProps & DeprecatedSeenProp & TableProps;
|
|
14
34
|
export declare const BasicTable: (props: BasicTableProps) => JSX.Element;
|
|
15
35
|
export default BasicTable;
|
package/BasicTable.js
CHANGED
|
@@ -4,29 +4,30 @@ exports.BasicTable = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const _ScrollWrapper_js_1 = require("./_abstract/_ScrollWrapper.js");
|
|
8
|
+
const _Table_js_1 = require("./_abstract/_Table.js");
|
|
9
|
+
const tableTypes = {
|
|
10
|
+
text: '',
|
|
11
|
+
number: 'data--number',
|
|
12
|
+
};
|
|
9
13
|
const BasicTable = (props) => {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
: { tbody: props.tbody || [] };
|
|
14
|
-
const modifier = props.modifier;
|
|
15
|
-
return (react_1.default.createElement(TableWrapper_1.default, { modifier: [
|
|
14
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
15
|
+
const { align, fullWidth, type, tbody, tbodies, modifier } = props;
|
|
16
|
+
return (react_1.default.createElement(_ScrollWrapper_js_1.ScrollWrapper, { bem: "TableWrapper", modifier: [
|
|
16
17
|
'BasicTable',
|
|
17
18
|
modifier && 'BasicTable--' + modifier,
|
|
18
|
-
fullWidth
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
fullWidth
|
|
20
|
+
? 'BasicTable--fullwidth'
|
|
21
|
+
: align === 'right'
|
|
22
|
+
? 'BasicTable--align--' + align
|
|
23
|
+
: undefined,
|
|
24
|
+
], wrapperProps: props.wrapperProps, innerWrap // TODO: Remove this once the CSS style-server has been updated
|
|
25
|
+
: true },
|
|
26
|
+
react_1.default.createElement(_Table_js_1.Table, Object.assign({ className: (0, classUtils_1.modifiedClass)('BasicTable', [
|
|
22
27
|
props.compact && 'compact',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
cols,
|
|
26
|
-
caption,
|
|
27
|
-
thead,
|
|
28
|
-
tfoot,
|
|
29
|
-
}, tbodyProps))));
|
|
28
|
+
type && tableTypes[type],
|
|
29
|
+
modifier,
|
|
30
|
+
]), cols: props.cols, caption: props.caption, thead: props.thead, tfoot: props.tfoot }, (tbody ? { tbody } : { tbodies }), { wrapperProps: props.tableProps }))));
|
|
30
31
|
};
|
|
31
32
|
exports.BasicTable = BasicTable;
|
|
32
33
|
exports.default = exports.BasicTable;
|
package/BreadCrumbs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
1
|
+
import { DefaultTexts, HannaLang } from '@reykjavik/hanna-utils/i18n';
|
|
2
2
|
import { WrapperElmProps } from './utils.js';
|
|
3
3
|
export type BreadCrumb = {
|
|
4
4
|
href?: string;
|
|
@@ -10,7 +10,7 @@ export declare const defaultBreadCrumbsTexts: DefaultTexts<{
|
|
|
10
10
|
}>;
|
|
11
11
|
export type BreadCrumbsProps = {
|
|
12
12
|
title?: string;
|
|
13
|
-
lang?:
|
|
13
|
+
lang?: HannaLang;
|
|
14
14
|
trail: BreadCrumbTrail;
|
|
15
15
|
} & WrapperElmProps<null, 'aria-label'>;
|
|
16
16
|
export declare const BreadCrumbs: (props: BreadCrumbsProps) => JSX.Element | null;
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,49 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
+
## 0.10.104
|
|
8
|
+
|
|
9
|
+
_2023-09-13_
|
|
10
|
+
|
|
11
|
+
- feat: Make all translated components respect `DEFAULT_LANG` from hanna-utils
|
|
12
|
+
- `BasicTable`:
|
|
13
|
+
- feat: Add props `wrapperProps`
|
|
14
|
+
- feat: Add prop `rowProps`
|
|
15
|
+
- feat: Export `Table*` types (`TableCell`, `TableRow`, etc.)
|
|
16
|
+
- feat: Allow `key` prop as part of `TableCellData`
|
|
17
|
+
- feat: Add component `AutosuggestSearch`
|
|
18
|
+
- `SiteSearchAutocomplete`:
|
|
19
|
+
- feat: Mark this component as deprecated, in favor of `AutosuggestSearch`
|
|
20
|
+
- fix: Add translation prop `buttonText` — (optional, but logs warning in
|
|
21
|
+
dev if missing.)
|
|
22
|
+
- fix: Spread `wrapperProps` on the wrapping `<div/>` element not the
|
|
23
|
+
contained `FormField`
|
|
24
|
+
- `SearchInput`:
|
|
25
|
+
- feat: Add prop `onSubmit` firing on `Enter` keypress
|
|
26
|
+
- feat: `onButtonClick` receives `value` as an argument
|
|
27
|
+
- feat: Use `onSubmit` as fallback for `onButtonClick`
|
|
28
|
+
- feat: Add prop `button` to toggle the button, ueses`onSubmit` as fallback
|
|
29
|
+
- fix: Minor prop and attribute assignment cleanup
|
|
30
|
+
- `SiteSearchInput`:
|
|
31
|
+
- feat: `onButtonClick` and `onSubmit` receive `value` as their argument
|
|
32
|
+
- feat: Add prop `button` to toggle the button, ueses`onSubmit` as fallback
|
|
33
|
+
- fix: Minor prop and attribute assignment cleanup
|
|
34
|
+
- `Datepicker`:
|
|
35
|
+
- feat: Add prop `lang`, deprecate `localeCode`
|
|
36
|
+
- feat: Add support for `hrefLang` values on `MainMenuItem` and
|
|
37
|
+
`MegaMenuItem`
|
|
38
|
+
- fix: Fix minor mistakes in aria-label translations
|
|
39
|
+
- feat: Add `useDomid` to `utils`
|
|
40
|
+
|
|
41
|
+
## 0.10.103
|
|
42
|
+
|
|
43
|
+
_2023-09-13_
|
|
44
|
+
|
|
45
|
+
- feat: Allow `BlingComboProps` values as `blingType` for `NewsHero` and
|
|
46
|
+
`InfoHero`
|
|
47
|
+
- fix: Correctly pass `ssr` prop down to sub-`Tabs`
|
|
48
|
+
- fix: Respect `ssr` passed to `VerticalTabsTOC`
|
|
49
|
+
|
|
7
50
|
## 0.10.102
|
|
8
51
|
|
|
9
52
|
_2023-09-04_
|
package/ContactBubble.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
2
|
+
import { DefaultTexts, HannaLang } from '@reykjavik/hanna-utils/i18n';
|
|
3
3
|
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
4
4
|
export type ContactBubbleI18n = {
|
|
5
|
-
lang?: string;
|
|
6
5
|
openBtn: string;
|
|
7
6
|
openBtnLong?: string;
|
|
8
7
|
closeBtn: string;
|
|
9
8
|
closeBtnLong?: string;
|
|
9
|
+
/** @deprecated Not used (Will be removed in v0.11) */
|
|
10
|
+
lang?: string;
|
|
10
11
|
};
|
|
11
12
|
export declare const defaultTexts: DefaultTexts<ContactBubbleI18n>;
|
|
12
13
|
declare const icons: {
|
|
@@ -46,7 +47,7 @@ export type ContactBubbleProps = {
|
|
|
46
47
|
*/
|
|
47
48
|
alwaysShow?: boolean;
|
|
48
49
|
texts?: ContactBubbleI18n;
|
|
49
|
-
lang?:
|
|
50
|
+
lang?: HannaLang;
|
|
50
51
|
} & SSRSupportProps & WrapperElmProps & ({
|
|
51
52
|
open?: boolean;
|
|
52
53
|
onToggle: (isOpen: boolean) => void;
|
package/ContactBubble.js
CHANGED
|
@@ -5,24 +5,27 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
7
|
const focusElm_1 = require("@hugsmidjan/qj/focusElm");
|
|
8
|
-
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
9
8
|
const i18n_1 = require("@reykjavik/hanna-utils/i18n");
|
|
10
9
|
const _Link_js_1 = require("./_abstract/_Link.js");
|
|
11
10
|
const breakOnNL_js_1 = require("./_abstract/breakOnNL.js");
|
|
11
|
+
const useDomid_js_1 = require("./utils/useDomid.js");
|
|
12
12
|
const utils_js_1 = require("./utils.js");
|
|
13
13
|
exports.defaultTexts = {
|
|
14
14
|
is: {
|
|
15
|
-
lang: 'is',
|
|
16
15
|
openBtn: 'Hafa samband',
|
|
17
16
|
closeBtn: 'Loka',
|
|
18
17
|
closeBtnLong: 'Loka valmynd',
|
|
19
18
|
},
|
|
20
19
|
en: {
|
|
21
|
-
lang: 'en',
|
|
22
20
|
openBtn: 'Contact us',
|
|
23
21
|
closeBtn: 'Close',
|
|
24
22
|
closeBtnLong: 'Close bubble',
|
|
25
23
|
},
|
|
24
|
+
pl: {
|
|
25
|
+
openBtn: 'Skontaktuj się z nami',
|
|
26
|
+
closeBtn: 'Zamknąć',
|
|
27
|
+
closeBtnLong: 'Zamknąć pęcherzyk',
|
|
28
|
+
},
|
|
26
29
|
};
|
|
27
30
|
// ---------------------------------------------------------------------------
|
|
28
31
|
const icons = {
|
|
@@ -43,7 +46,7 @@ const ContactBubble = (props) => {
|
|
|
43
46
|
const [localOpen, setLocalOpen] = (0, react_1.useState)(false);
|
|
44
47
|
const open = useLocalState ? localOpen : props.open;
|
|
45
48
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(props.ssr);
|
|
46
|
-
const domid = (0,
|
|
49
|
+
const domid = (0, useDomid_js_1.useDomid)();
|
|
47
50
|
const _wrapperRef = (0, react_1.useRef)(null);
|
|
48
51
|
const wrapperRef = wrapperProps.ref || _wrapperRef;
|
|
49
52
|
const { openBubble, closeBubble } = (0, react_1.useMemo)(() => ({
|
package/Datepicker.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
+
import { HannaLang } from '@reykjavik/hanna-utils/i18n';
|
|
2
3
|
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
4
|
export type DatepickerProps = {
|
|
4
5
|
small?: boolean;
|
|
@@ -28,14 +29,17 @@ export type DatepickerProps = {
|
|
|
28
29
|
* NOTE: This will be the default mode in v0.11.
|
|
29
30
|
*/
|
|
30
31
|
isoMode?: boolean;
|
|
31
|
-
|
|
32
|
+
texts?: DatepickerLocaleProps;
|
|
33
|
+
lang?: HannaLang;
|
|
32
34
|
dateFormat?: string | Array<string>;
|
|
33
35
|
isStartDate?: boolean;
|
|
34
36
|
isEndDate?: boolean;
|
|
35
37
|
inputRef?: RefObject<HTMLInputElement>;
|
|
36
38
|
onChange?: (date?: Date) => void;
|
|
37
39
|
datepickerExtraProps?: Record<string, unknown>;
|
|
38
|
-
/** @deprecated
|
|
40
|
+
/** @deprecated Use `lang` instead (Will be removed in v0.11) */
|
|
41
|
+
localeCode?: HannaLang;
|
|
42
|
+
/** @deprecated Use `value` or `defaultValue` instead. (Will be removed in v0.11) */
|
|
39
43
|
initialDate?: Date;
|
|
40
44
|
} & FormFieldWrappingProps;
|
|
41
45
|
/**
|
|
@@ -44,6 +48,7 @@ export type DatepickerProps = {
|
|
|
44
48
|
*/
|
|
45
49
|
export declare const getDateDiff: (refDate: Date, dayOffset: number) => Date;
|
|
46
50
|
export type DatepickerLocaleProps = {
|
|
51
|
+
ariaLabelClose: string;
|
|
47
52
|
nextMonthAriaLabel: string;
|
|
48
53
|
nextMonthButtonLabel: string;
|
|
49
54
|
nextYearAriaLabel: string;
|
|
@@ -54,8 +59,8 @@ export type DatepickerLocaleProps = {
|
|
|
54
59
|
previousYearButtonLabel: string;
|
|
55
60
|
timeInputLabel: string;
|
|
56
61
|
weekAriaLabelPrefix: string;
|
|
62
|
+
monthAriaLabelPrefix: string;
|
|
57
63
|
weekLabel: string;
|
|
58
|
-
ariaLabelPrefix: string;
|
|
59
64
|
chooseDayAriaLabelPrefix: string;
|
|
60
65
|
disabledDayAriaLabelPrefix: string;
|
|
61
66
|
};
|
package/Datepicker.js
CHANGED
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Datepicker = exports.getDateDiff = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
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"));
|
|
9
9
|
const index_js_2 = tslib_1.__importDefault(require("date-fns/locale/pl/index.js"));
|
|
10
10
|
const ReactDatepicker_js_1 = require("./_mixed_export_resolution_/ReactDatepicker.js"); // Docs: https://reactdatepicker.com/
|
|
11
|
+
const useDomid_js_1 = require("./utils/useDomid.js");
|
|
11
12
|
const FormField_js_1 = require("./FormField.js");
|
|
12
13
|
const utils_js_1 = require("./utils.js");
|
|
13
14
|
(0, ReactDatepicker_js_1.registerLocale)('is', index_js_1.default);
|
|
@@ -22,8 +23,9 @@ const getDateDiff = (refDate, dayOffset) => {
|
|
|
22
23
|
return newDate;
|
|
23
24
|
};
|
|
24
25
|
exports.getDateDiff = getDateDiff;
|
|
25
|
-
const
|
|
26
|
+
const defaultDatepickerTexts = {
|
|
26
27
|
is: {
|
|
28
|
+
ariaLabelClose: 'Loka',
|
|
27
29
|
nextMonthAriaLabel: 'Næsti mánuður',
|
|
28
30
|
nextMonthButtonLabel: 'Næsti mánuður',
|
|
29
31
|
nextYearAriaLabel: 'Næsta ár',
|
|
@@ -32,14 +34,34 @@ const i18n = {
|
|
|
32
34
|
previousMonthButtonLabel: 'Fyrri mánuður',
|
|
33
35
|
previousYearAriaLabel: 'Fyrra ár',
|
|
34
36
|
previousYearButtonLabel: 'Fyrra ár',
|
|
35
|
-
timeInputLabel: 'Tími:
|
|
36
|
-
weekAriaLabelPrefix: 'Vika:
|
|
37
|
+
timeInputLabel: 'Tími:',
|
|
38
|
+
weekAriaLabelPrefix: 'Vika:',
|
|
37
39
|
weekLabel: 'Vika',
|
|
38
|
-
|
|
40
|
+
monthAriaLabelPrefix: 'Mánuður:',
|
|
39
41
|
chooseDayAriaLabelPrefix: 'Veldu:',
|
|
40
|
-
disabledDayAriaLabelPrefix: '
|
|
42
|
+
disabledDayAriaLabelPrefix: 'Ekki í boði:',
|
|
43
|
+
},
|
|
44
|
+
// React-datepicker has its own (default) English translation built in.
|
|
45
|
+
// No need to repeat all of it here.
|
|
46
|
+
en: {
|
|
47
|
+
// ariaLabelClose: 'Close',
|
|
48
|
+
// nextMonthAriaLabel: 'Next month',
|
|
49
|
+
// nextMonthButtonLabel: 'Next month',
|
|
50
|
+
// nextYearAriaLabel: 'Next year',
|
|
51
|
+
// nextYearButtonLabel: 'Next year',
|
|
52
|
+
// previousMonthAriaLabel: 'Previous month',
|
|
53
|
+
// previousMonthButtonLabel: 'Previous month',
|
|
54
|
+
// previousYearAriaLabel: 'Previous year',
|
|
55
|
+
// previousYearButtonLabel: 'Previous year',
|
|
56
|
+
// timeInputLabel: 'Time:',
|
|
57
|
+
// weekAriaLabelPrefix: 'Week:',
|
|
58
|
+
// weekLabel: 'Week',
|
|
59
|
+
monthAriaLabelPrefix: 'Month:',
|
|
60
|
+
chooseDayAriaLabelPrefix: 'Choose:',
|
|
61
|
+
disabledDayAriaLabelPrefix: 'Not available:',
|
|
41
62
|
},
|
|
42
63
|
pl: {
|
|
64
|
+
ariaLabelClose: 'Zamknij',
|
|
43
65
|
nextMonthAriaLabel: 'Następny miesiącu',
|
|
44
66
|
nextMonthButtonLabel: 'Następny miesiącu',
|
|
45
67
|
nextYearAriaLabel: 'Następny rok',
|
|
@@ -48,12 +70,12 @@ const i18n = {
|
|
|
48
70
|
previousMonthButtonLabel: 'Poprzedni miesiac',
|
|
49
71
|
previousYearAriaLabel: 'Poprzedni rok',
|
|
50
72
|
previousYearButtonLabel: 'Poprzedni rok',
|
|
51
|
-
timeInputLabel: 'Czas:
|
|
52
|
-
weekAriaLabelPrefix: 'Tydzień:
|
|
73
|
+
timeInputLabel: 'Czas:',
|
|
74
|
+
weekAriaLabelPrefix: 'Tydzień:',
|
|
53
75
|
weekLabel: 'Tydzień',
|
|
54
|
-
|
|
76
|
+
monthAriaLabelPrefix: 'Miesiąc:',
|
|
55
77
|
chooseDayAriaLabelPrefix: 'Wybierać:',
|
|
56
|
-
disabledDayAriaLabelPrefix: '
|
|
78
|
+
disabledDayAriaLabelPrefix: 'Niedostępna:',
|
|
57
79
|
},
|
|
58
80
|
};
|
|
59
81
|
/**
|
|
@@ -62,7 +84,7 @@ const i18n = {
|
|
|
62
84
|
* Internally, this component uses the [`react-datepicker`](https://reactdatepicker.com/) component.
|
|
63
85
|
*/
|
|
64
86
|
const Datepicker = (props) => {
|
|
65
|
-
const { placeholder,
|
|
87
|
+
const { placeholder, dateFormat = 'd.M.yyyy', name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, inputRef, isoMode, texts, lang = props.localeCode, fieldWrapperProps, } = (0, FormField_js_1.groupFormFieldWrapperProps)(props);
|
|
66
88
|
const [value, setValue] = utils_js_1.useMixedControlState.raw(props.value || props.initialDate, // eslint-disable-line deprecation/deprecation
|
|
67
89
|
props.defaultValue, 'value');
|
|
68
90
|
/*
|
|
@@ -70,8 +92,8 @@ const Datepicker = (props) => {
|
|
|
70
92
|
and `props.initialDate` is removed:
|
|
71
93
|
*/
|
|
72
94
|
// const [value, setValue] = useMixedControlState(props, 'value');
|
|
73
|
-
const domid = (0,
|
|
74
|
-
const txts =
|
|
95
|
+
const domid = (0, useDomid_js_1.useDomid)(props.id);
|
|
96
|
+
const txts = (0, i18n_1.getTexts)({ texts, lang }, defaultDatepickerTexts);
|
|
75
97
|
const filled = !!value;
|
|
76
98
|
const empty = !filled && !placeholder;
|
|
77
99
|
return (react_1.default.createElement(FormField_js_1.FormField, Object.assign({ extraClassName: "Datepicker", filled: filled, empty: empty }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => {
|
|
@@ -82,7 +104,7 @@ const Datepicker = (props) => {
|
|
|
82
104
|
return elm;
|
|
83
105
|
}) }, addFocusProps()),
|
|
84
106
|
isoMode && (react_1.default.createElement("input", { type: "hidden", name: name, value: value === null || value === void 0 ? void 0 : value.toISOString().slice(0, 10) })),
|
|
85
|
-
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:
|
|
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:
|
|
86
108
|
// NOTE: Force all dateFormat values into Array<string> to temporarily work around
|
|
87
109
|
// a bug in the current version of react-datepicker where invalid `string` values
|
|
88
110
|
// are re-parsed with `new Date()`, causing surprising (weird) false positives
|
package/FileInput.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HannaLang } from '@reykjavik/hanna-utils/i18n';
|
|
1
2
|
import { FileListProps } from './FileInput/_FileInputFileList.js';
|
|
2
3
|
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
4
|
export type FileInputProps = FormFieldWrappingProps & {
|
|
@@ -15,7 +16,7 @@ export type FileInputProps = FormFieldWrappingProps & {
|
|
|
15
16
|
accept?: string | Array<string>;
|
|
16
17
|
dropzoneText: string | JSX.Element;
|
|
17
18
|
removeFileText?: string;
|
|
18
|
-
lang?:
|
|
19
|
+
lang?: HannaLang;
|
|
19
20
|
showFileSize?: boolean;
|
|
20
21
|
showImagePreviews?: boolean;
|
|
21
22
|
FileList?: false | ((props: FileListProps) => JSX.Element | null);
|
package/FileInput.js
CHANGED
|
@@ -4,11 +4,11 @@ exports.FileInput = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
|
-
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
8
7
|
const i18n_1 = require("@reykjavik/hanna-utils/i18n");
|
|
9
8
|
const ReactDropzone_js_1 = require("./_mixed_export_resolution_/ReactDropzone.js");
|
|
10
9
|
const _FileInput_utils_js_1 = require("./FileInput/_FileInput.utils.js");
|
|
11
10
|
const _FileInputFileList_js_1 = require("./FileInput/_FileInputFileList.js");
|
|
11
|
+
const useDomid_js_1 = require("./utils/useDomid.js");
|
|
12
12
|
const FormField_js_1 = tslib_1.__importStar(require("./FormField.js"));
|
|
13
13
|
const defaultRemoveFileText = {
|
|
14
14
|
is: 'Fjarlægja',
|
|
@@ -37,7 +37,7 @@ const FileInput = (props) => {
|
|
|
37
37
|
multiple = (_b = (_a = props.dropzoneProps) === null || _a === void 0 ? void 0 : _a.multiple) !== null && _b !== void 0 ? _b : true, // eslint-disable-line deprecation/deprecation
|
|
38
38
|
accept = (_c = props.dropzoneProps) === null || _c === void 0 ? void 0 : _c.accept, // eslint-disable-line deprecation/deprecation
|
|
39
39
|
dropzoneText, removeFileText = defaultRemoveFileText[lang] || defaultRemoveFileText[i18n_1.DEFAULT_LANG], FileList = _FileInputFileList_js_1.DefaultFileList, onFilesUpdated = () => undefined, onFilesRejected, showFileSize, showImagePreviews, value = [], fieldWrapperProps } = _d, inputElementProps = tslib_1.__rest(_d, ["dropzoneProps", "multiple", "accept", "dropzoneText", "removeFileText", "FileList", "onFilesUpdated", "onFilesRejected", "showFileSize", "showImagePreviews", "value", "fieldWrapperProps"]);
|
|
40
|
-
const domid = (0,
|
|
40
|
+
const domid = (0, useDomid_js_1.useDomid)(props.id);
|
|
41
41
|
const fileInputWrapper = (0, react_1.useRef)(null);
|
|
42
42
|
const fileInput = (0, react_1.useRef)(null);
|
|
43
43
|
const files = value;
|
package/FormField.js
CHANGED
|
@@ -4,8 +4,8 @@ exports.groupFormFieldWrapperProps = exports.getFormFieldWrapperProps = exports.
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const classUtils_1 = require("@hugsmidjan/qj/classUtils");
|
|
7
|
-
const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
8
7
|
const env_js_1 = require("./utils/env.js");
|
|
8
|
+
const useDomid_js_1 = require("./utils/useDomid.js");
|
|
9
9
|
const utils_js_1 = require("./utils.js");
|
|
10
10
|
const inputClassNames = {
|
|
11
11
|
bem: 'FormField',
|
|
@@ -20,7 +20,7 @@ const FormField = (props) => {
|
|
|
20
20
|
renderInput, id, ssr, wrapperProps, } = props;
|
|
21
21
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
|
22
22
|
const isInvalid = invalid || !!errorMessage || undefined;
|
|
23
|
-
const domid = (0,
|
|
23
|
+
const domid = (0, useDomid_js_1.useDomid)(id);
|
|
24
24
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
25
25
|
// @ts-expect-error (Duck knows why this errors?!)
|
|
26
26
|
const addFocusProps = (0, react_1.useCallback)((ownProps) => {
|
package/Gallery.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HannaLang } from '@reykjavik/hanna-utils/i18n';
|
|
1
2
|
import { GalleryItemProps } from './Gallery/_GalleryItem.js';
|
|
2
3
|
import { DeprecatedSeenProp } from './utils/seenEffect.js';
|
|
3
4
|
import { SSRSupportProps, WrapperElmProps } from './utils.js';
|
|
@@ -10,7 +11,7 @@ export type GalleryI18n = {
|
|
|
10
11
|
export type GalleryProps = {
|
|
11
12
|
items: Array<GalleryItemProps>;
|
|
12
13
|
texts?: GalleryI18n;
|
|
13
|
-
lang?:
|
|
14
|
+
lang?: HannaLang;
|
|
14
15
|
} & SSRSupportProps & WrapperElmProps & DeprecatedSeenProp;
|
|
15
16
|
export declare const Gallery: (props: GalleryProps) => JSX.Element;
|
|
16
17
|
export default Gallery;
|
package/Gallery.js
CHANGED
|
@@ -19,6 +19,11 @@ const defaultTexts = {
|
|
|
19
19
|
modalPrevLabel: 'Fyrri mynd',
|
|
20
20
|
modalCloseLabel: 'Til baka í grein',
|
|
21
21
|
},
|
|
22
|
+
pl: {
|
|
23
|
+
modalNextLabel: 'Następne zdjęcie',
|
|
24
|
+
modalPrevLabel: 'Poprzednie zdjęcie',
|
|
25
|
+
modalCloseLabel: 'Powrót do artykułu',
|
|
26
|
+
},
|
|
22
27
|
};
|
|
23
28
|
const Gallery = (props) => {
|
|
24
29
|
const { items, ssr } = props;
|
package/InfoHero.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlingComboProps } from './_abstract/_Blings.js';
|
|
1
2
|
import { ButtonProps } from './_abstract/_Button.js';
|
|
2
3
|
import { ImageProps } from './_abstract/_Image.js';
|
|
3
4
|
import { Alignment } from './constants.js';
|
|
@@ -13,7 +14,7 @@ export type InfoHeroProps = {
|
|
|
13
14
|
footer?: string | JSX.Element;
|
|
14
15
|
align?: Alignment;
|
|
15
16
|
image?: ImageProps;
|
|
16
|
-
blingType?: BlingOptions;
|
|
17
|
+
blingType?: BlingOptions | BlingComboProps;
|
|
17
18
|
} & WrapperElmProps;
|
|
18
19
|
export declare const InfoHero: (props: InfoHeroProps) => JSX.Element;
|
|
19
20
|
export default InfoHero;
|
package/InfoHero.js
CHANGED
|
@@ -71,8 +71,9 @@ const InfoHero = (props) => {
|
|
|
71
71
|
const { title, titleBlurb, subTitle, blurb, image, buttons = [], footer, align, blingType, wrapperProps, } = props;
|
|
72
72
|
const showButtons = Boolean(buttons.length);
|
|
73
73
|
const alignment = align && constants_js_1.aligns[align] ? align : 'right';
|
|
74
|
-
const blings =
|
|
75
|
-
|
|
74
|
+
const blings = typeof blingType === 'object'
|
|
75
|
+
? blingType
|
|
76
|
+
: (blingType && blingOptions[blingType]) || blingOptions.waves; // default to `waves`
|
|
76
77
|
return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('InfoHero', 'align--' + alignment, (wrapperProps || {}).className) }),
|
|
77
78
|
react_1.default.createElement("div", { className: "InfoHero__content" },
|
|
78
79
|
react_1.default.createElement("h1", { className: "InfoHero__title" }, title),
|