@reykjavik/hanna-react 0.10.162 → 0.10.163
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 +7 -3
- package/Alert.js +2 -3
- package/CHANGELOG.md +6 -0
- package/esm/Alert.d.ts +7 -3
- package/esm/Alert.js +2 -3
- package/esm/utils/useLaggedState.d.ts +2 -1
- package/esm/utils/useLaggedState.js +2 -1
- package/esm/utils.d.ts +1 -0
- package/esm/utils.js +1 -0
- package/package.json +1 -1
- package/utils/useLaggedState.d.ts +2 -1
- package/utils/useLaggedState.js +2 -1
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
package/Alert.d.ts
CHANGED
|
@@ -11,8 +11,11 @@ type AlertType = 'info' | 'success' | 'warning' | 'error' | 'critical';
|
|
|
11
11
|
export declare const alertTypes: Record<string, 1>;
|
|
12
12
|
export type AlertProps = {
|
|
13
13
|
type: AlertType;
|
|
14
|
+
/** Defaults to `true` if an `onClose` handler or a `closeUrl` is passaed */
|
|
14
15
|
closable?: boolean;
|
|
16
|
+
/** The alert content */
|
|
15
17
|
children?: ReactNode;
|
|
18
|
+
/** UNSAFE raw HTML content for the Alert, e.g. one emitted by a CMS. */
|
|
16
19
|
childrenHTML?: string;
|
|
17
20
|
/** server-side anchor href */
|
|
18
21
|
closeUrl?: string;
|
|
@@ -21,8 +24,8 @@ export type AlertProps = {
|
|
|
21
24
|
/** Set to true to opt out of the opening transition */
|
|
22
25
|
instantShow?: boolean;
|
|
23
26
|
} & SSRSupportProps & EitherObj<{
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
27
|
+
/**
|
|
28
|
+
* Seconds until the Alert auto-closes.
|
|
26
29
|
* Mosueover and keyboard focus resets the timer.
|
|
27
30
|
*/
|
|
28
31
|
autoClose: number;
|
|
@@ -31,7 +34,8 @@ export type AlertProps = {
|
|
|
31
34
|
/** Callback that fires when the alert has closed/transitoned out */
|
|
32
35
|
onClosed: () => void;
|
|
33
36
|
}, {
|
|
34
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* NOTE: The signature with the `event` argument will be removed in hanna-react v0.11
|
|
35
39
|
*
|
|
36
40
|
* Return `false` to prevent the alert from closing
|
|
37
41
|
*/
|
package/Alert.js
CHANGED
|
@@ -48,8 +48,7 @@ exports.alertTypes = {
|
|
|
48
48
|
critical: 1,
|
|
49
49
|
};
|
|
50
50
|
const Alert = (props) => {
|
|
51
|
-
const { type, childrenHTML, children, onClose,
|
|
52
|
-
closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, instantShow, wrapperProps, } = props;
|
|
51
|
+
const { type, childrenHTML, children, onClose, closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, instantShow, wrapperProps, } = props;
|
|
53
52
|
const autoClose = Math.max(props.autoClose || 0, 0);
|
|
54
53
|
const closing = (0, react_1.useRef)();
|
|
55
54
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
|
|
@@ -62,7 +61,7 @@ const Alert = (props) => {
|
|
|
62
61
|
const closeAlert = (0, react_1.useCallback)((event) => {
|
|
63
62
|
const ret = onClose &&
|
|
64
63
|
// @ts-expect-error (@deprecated `event` parameter will be removed in v0.11)
|
|
65
|
-
onClose(event);
|
|
64
|
+
onClose(event);
|
|
66
65
|
if (ret !== false) {
|
|
67
66
|
setOpen(false);
|
|
68
67
|
if (closing.current) {
|
package/CHANGELOG.md
CHANGED
package/esm/Alert.d.ts
CHANGED
|
@@ -11,8 +11,11 @@ type AlertType = 'info' | 'success' | 'warning' | 'error' | 'critical';
|
|
|
11
11
|
export declare const alertTypes: Record<string, 1>;
|
|
12
12
|
export type AlertProps = {
|
|
13
13
|
type: AlertType;
|
|
14
|
+
/** Defaults to `true` if an `onClose` handler or a `closeUrl` is passaed */
|
|
14
15
|
closable?: boolean;
|
|
16
|
+
/** The alert content */
|
|
15
17
|
children?: ReactNode;
|
|
18
|
+
/** UNSAFE raw HTML content for the Alert, e.g. one emitted by a CMS. */
|
|
16
19
|
childrenHTML?: string;
|
|
17
20
|
/** server-side anchor href */
|
|
18
21
|
closeUrl?: string;
|
|
@@ -21,8 +24,8 @@ export type AlertProps = {
|
|
|
21
24
|
/** Set to true to opt out of the opening transition */
|
|
22
25
|
instantShow?: boolean;
|
|
23
26
|
} & SSRSupportProps & EitherObj<{
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
27
|
+
/**
|
|
28
|
+
* Seconds until the Alert auto-closes.
|
|
26
29
|
* Mosueover and keyboard focus resets the timer.
|
|
27
30
|
*/
|
|
28
31
|
autoClose: number;
|
|
@@ -31,7 +34,8 @@ export type AlertProps = {
|
|
|
31
34
|
/** Callback that fires when the alert has closed/transitoned out */
|
|
32
35
|
onClosed: () => void;
|
|
33
36
|
}, {
|
|
34
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* NOTE: The signature with the `event` argument will be removed in hanna-react v0.11
|
|
35
39
|
*
|
|
36
40
|
* Return `false` to prevent the alert from closing
|
|
37
41
|
*/
|
package/esm/Alert.js
CHANGED
|
@@ -44,8 +44,7 @@ export const alertTypes = {
|
|
|
44
44
|
critical: 1,
|
|
45
45
|
};
|
|
46
46
|
export const Alert = (props) => {
|
|
47
|
-
const { type, childrenHTML, children, onClose,
|
|
48
|
-
closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, instantShow, wrapperProps, } = props;
|
|
47
|
+
const { type, childrenHTML, children, onClose, closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, instantShow, wrapperProps, } = props;
|
|
49
48
|
const autoClose = Math.max(props.autoClose || 0, 0);
|
|
50
49
|
const closing = useRef();
|
|
51
50
|
const isBrowser = useIsBrowserSide(ssr);
|
|
@@ -58,7 +57,7 @@ export const Alert = (props) => {
|
|
|
58
57
|
const closeAlert = useCallback((event) => {
|
|
59
58
|
const ret = onClose &&
|
|
60
59
|
// @ts-expect-error (@deprecated `event` parameter will be removed in v0.11)
|
|
61
|
-
onClose(event);
|
|
60
|
+
onClose(event);
|
|
62
61
|
if (ret !== false) {
|
|
63
62
|
setOpen(false);
|
|
64
63
|
if (closing.current) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* An advanced `useState` alternative with in-built support for delayed
|
|
3
|
+
* (debounced) effect.
|
|
3
4
|
*
|
|
4
5
|
* This is especially useful when emulating "focusin"/"focusout" events,
|
|
5
6
|
* and a less jittery 'onMouseEnter'/'onMouseLeave' behavior.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
// ---------------------------------------------------------------------------
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* An advanced `useState` alternative with in-built support for delayed
|
|
5
|
+
* (debounced) effect.
|
|
5
6
|
*
|
|
6
7
|
* This is especially useful when emulating "focusin"/"focusout" events,
|
|
7
8
|
* and a less jittery 'onMouseEnter'/'onMouseLeave' behavior.
|
package/esm/utils.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './utils/useDidChange.js';
|
|
|
5
5
|
export * from './utils/useDomid.js';
|
|
6
6
|
export * from './utils/useFormatMonitor.js';
|
|
7
7
|
export * from './utils/useGetSVGtext.js';
|
|
8
|
+
export * from './utils/useLaggedState.js';
|
|
8
9
|
export * from './utils/useMixedControlState.js';
|
|
9
10
|
export * from './utils/useScrollbarWidthCSSVar.js';
|
|
10
11
|
/**
|
package/esm/utils.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from './utils/useDidChange.js';
|
|
|
4
4
|
export * from './utils/useDomid.js';
|
|
5
5
|
export * from './utils/useFormatMonitor.js';
|
|
6
6
|
export * from './utils/useGetSVGtext.js';
|
|
7
|
+
export * from './utils/useLaggedState.js';
|
|
7
8
|
export * from './utils/useMixedControlState.js';
|
|
8
9
|
export * from './utils/useScrollbarWidthCSSVar.js';
|
|
9
10
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* An advanced `useState` alternative with in-built support for delayed
|
|
3
|
+
* (debounced) effect.
|
|
3
4
|
*
|
|
4
5
|
* This is especially useful when emulating "focusin"/"focusout" events,
|
|
5
6
|
* and a less jittery 'onMouseEnter'/'onMouseLeave' behavior.
|
package/utils/useLaggedState.js
CHANGED
|
@@ -4,7 +4,8 @@ exports.useLaggedState = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* An advanced `useState` alternative with in-built support for delayed
|
|
8
|
+
* (debounced) effect.
|
|
8
9
|
*
|
|
9
10
|
* This is especially useful when emulating "focusin"/"focusout" events,
|
|
10
11
|
* and a less jittery 'onMouseEnter'/'onMouseLeave' behavior.
|
package/utils.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './utils/useDidChange.js';
|
|
|
5
5
|
export * from './utils/useDomid.js';
|
|
6
6
|
export * from './utils/useFormatMonitor.js';
|
|
7
7
|
export * from './utils/useGetSVGtext.js';
|
|
8
|
+
export * from './utils/useLaggedState.js';
|
|
8
9
|
export * from './utils/useMixedControlState.js';
|
|
9
10
|
export * from './utils/useScrollbarWidthCSSVar.js';
|
|
10
11
|
/**
|
package/utils.js
CHANGED
|
@@ -8,6 +8,7 @@ tslib_1.__exportStar(require("./utils/useDidChange.js"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./utils/useDomid.js"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./utils/useFormatMonitor.js"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./utils/useGetSVGtext.js"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./utils/useLaggedState.js"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./utils/useMixedControlState.js"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./utils/useScrollbarWidthCSSVar.js"), exports);
|
|
13
14
|
// ---------------------------------------------------------------------------
|