@reykjavik/hanna-react 0.10.135 → 0.10.136
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/Alert.d.ts +2 -0
- package/Alert.js +2 -2
- package/CHANGELOG.md +6 -0
- package/MainMenu2.js +0 -3
- package/_abstract/_AbstractCarousel.js +3 -3
- package/esm/Alert.d.ts +2 -0
- package/esm/Alert.js +2 -2
- package/esm/MainMenu2.js +0 -3
- package/esm/_abstract/_AbstractCarousel.js +3 -3
- package/package.json +1 -1
package/Alert.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export type AlertProps = {
|
|
|
24
24
|
closeUrl?: string;
|
|
25
25
|
texts?: AlertI18n;
|
|
26
26
|
lang?: HannaLang;
|
|
27
|
+
/** Set to true to opt out of the opening transition */
|
|
28
|
+
instantShow?: boolean;
|
|
27
29
|
} & SSRSupportProps & EitherObj<{
|
|
28
30
|
/** Seconds until the Alert auto-closes.
|
|
29
31
|
*
|
package/Alert.js
CHANGED
|
@@ -49,11 +49,11 @@ exports.alertTypes = {
|
|
|
49
49
|
};
|
|
50
50
|
const Alert = (props) => {
|
|
51
51
|
const { type, childrenHTML, children, onClose, // eslint-disable-line deprecation/deprecation
|
|
52
|
-
closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, wrapperProps, } = props;
|
|
52
|
+
closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, instantShow, wrapperProps, } = props;
|
|
53
53
|
const autoClose = Math.max(props.autoClose || 0, 0);
|
|
54
54
|
const closing = (0, react_1.useRef)();
|
|
55
55
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
|
56
|
-
const [open, setOpen] = (0, react_1.useState)(!isBrowser);
|
|
56
|
+
const [open, setOpen] = (0, react_1.useState)(instantShow || !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/CHANGELOG.md
CHANGED
package/MainMenu2.js
CHANGED
|
@@ -89,9 +89,6 @@ const getRenderers = (props) => {
|
|
|
89
89
|
size: 'small',
|
|
90
90
|
}
|
|
91
91
|
: undefined;
|
|
92
|
-
if (label === 'Græna planið') {
|
|
93
|
-
console.log('FOOBAR', icon, icon && iconMap[icon]);
|
|
94
|
-
}
|
|
95
92
|
return (react_1.default.createElement(Tag, { key: key, className: (0, classUtils_1.modifiedClass)(`${classPrefix}item`, item.modifier), "aria-current": item.current || undefined }, isBrowser && (onClick || href == null) ? (react_1.default.createElement(ButtonTag, Object.assign({}, commonProps, { type: "button", "aria-controls": controlsId, onClick: () => {
|
|
96
93
|
const keepOpen1 = onClick && onClick(item) === false;
|
|
97
94
|
const keepOpen2 = onItemClick && onItemClick(item) === false;
|
|
@@ -15,12 +15,12 @@ const utils_js_1 = require("../utils.js");
|
|
|
15
15
|
const scrollXBy = (elm, deltaX) => {
|
|
16
16
|
const left = elm.scrollLeft + deltaX;
|
|
17
17
|
elm.scrollTo(left, elm.scrollTop);
|
|
18
|
-
// NOTE 1:
|
|
19
|
-
// as `behavior: 'smooth'` starts some weird interactions with the browser's
|
|
20
|
-
// `scroll-snap-type` behavior.
|
|
18
|
+
// NOTE 1: The scroll behavior is left up to the CSS styles.
|
|
21
19
|
//
|
|
22
20
|
// NOTE 2: Both Chrome and Safari tend to snap hard to the nearest list item
|
|
23
21
|
// while Firefox is more smooth. Haven't found a way around that.
|
|
22
|
+
// (`behavior: 'smooth'` starts some weird interactions with the browser's
|
|
23
|
+
// CSS `scroll-snap-type` behavior.)
|
|
24
24
|
};
|
|
25
25
|
// eslint-disable-next-line complexity
|
|
26
26
|
const AbstractCarousel = (props) => {
|
package/esm/Alert.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export type AlertProps = {
|
|
|
24
24
|
closeUrl?: string;
|
|
25
25
|
texts?: AlertI18n;
|
|
26
26
|
lang?: HannaLang;
|
|
27
|
+
/** Set to true to opt out of the opening transition */
|
|
28
|
+
instantShow?: boolean;
|
|
27
29
|
} & SSRSupportProps & EitherObj<{
|
|
28
30
|
/** Seconds until the Alert auto-closes.
|
|
29
31
|
*
|
package/esm/Alert.js
CHANGED
|
@@ -45,11 +45,11 @@ export const alertTypes = {
|
|
|
45
45
|
};
|
|
46
46
|
export const Alert = (props) => {
|
|
47
47
|
const { type, childrenHTML, children, onClose, // eslint-disable-line deprecation/deprecation
|
|
48
|
-
closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, wrapperProps, } = props;
|
|
48
|
+
closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, instantShow, wrapperProps, } = props;
|
|
49
49
|
const autoClose = Math.max(props.autoClose || 0, 0);
|
|
50
50
|
const closing = useRef();
|
|
51
51
|
const isBrowser = useIsBrowserSide(ssr);
|
|
52
|
-
const [open, setOpen] = useState(!isBrowser);
|
|
52
|
+
const [open, setOpen] = useState(instantShow || !isBrowser);
|
|
53
53
|
const showCloseButton = closable && (isBrowser || closeUrl != null);
|
|
54
54
|
const { closeLabel, closeLabelLong } = getTexts(props, defaultAlertTexts);
|
|
55
55
|
useEffect(() => {
|
package/esm/MainMenu2.js
CHANGED
|
@@ -85,9 +85,6 @@ const getRenderers = (props) => {
|
|
|
85
85
|
size: 'small',
|
|
86
86
|
}
|
|
87
87
|
: undefined;
|
|
88
|
-
if (label === 'Græna planið') {
|
|
89
|
-
console.log('FOOBAR', icon, icon && iconMap[icon]);
|
|
90
|
-
}
|
|
91
88
|
return (React.createElement(Tag, { key: key, className: modifiedClass(`${classPrefix}item`, item.modifier), "aria-current": item.current || undefined }, isBrowser && (onClick || href == null) ? (React.createElement(ButtonTag, Object.assign({}, commonProps, { type: "button", "aria-controls": controlsId, onClick: () => {
|
|
92
89
|
const keepOpen1 = onClick && onClick(item) === false;
|
|
93
90
|
const keepOpen2 = onItemClick && onItemClick(item) === false;
|
|
@@ -11,12 +11,12 @@ import { useIsBrowserSide } from '../utils.js';
|
|
|
11
11
|
const scrollXBy = (elm, deltaX) => {
|
|
12
12
|
const left = elm.scrollLeft + deltaX;
|
|
13
13
|
elm.scrollTo(left, elm.scrollTop);
|
|
14
|
-
// NOTE 1:
|
|
15
|
-
// as `behavior: 'smooth'` starts some weird interactions with the browser's
|
|
16
|
-
// `scroll-snap-type` behavior.
|
|
14
|
+
// NOTE 1: The scroll behavior is left up to the CSS styles.
|
|
17
15
|
//
|
|
18
16
|
// NOTE 2: Both Chrome and Safari tend to snap hard to the nearest list item
|
|
19
17
|
// while Firefox is more smooth. Haven't found a way around that.
|
|
18
|
+
// (`behavior: 'smooth'` starts some weird interactions with the browser's
|
|
19
|
+
// CSS `scroll-snap-type` behavior.)
|
|
20
20
|
};
|
|
21
21
|
// eslint-disable-next-line complexity
|
|
22
22
|
export const AbstractCarousel = (props) => {
|