@reykjavik/hanna-react 0.10.162 → 0.10.164
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 +13 -5
- package/Alert.js +2 -3
- package/CHANGELOG.md +13 -0
- package/Icon.d.ts +1 -1
- package/_abstract/_Button.d.ts +1 -1
- package/esm/Alert.d.ts +13 -5
- package/esm/Alert.js +2 -3
- package/esm/Icon.d.ts +1 -1
- package/esm/_abstract/_Button.d.ts +1 -1
- 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 +2 -2
- 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,17 +24,22 @@ 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
|
-
*
|
|
26
|
-
* Mosueover and keyboard focus resets the timer.
|
|
27
|
+
/**
|
|
28
|
+
* Seconds until the Alert auto-closes.
|
|
29
|
+
* Mosueover and keyboard focus resets the timer. \
|
|
30
|
+
* NOTE: An `onClosed` handler is required when using this option.
|
|
27
31
|
*/
|
|
28
32
|
autoClose: number;
|
|
29
33
|
/** Return `false` to prevent the alert from closing. */
|
|
30
34
|
onClose?: () => void | boolean;
|
|
31
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Callback that fires when the alert has closed/transitoned out. \
|
|
37
|
+
* Required when `autoClose` is used.
|
|
38
|
+
*/
|
|
32
39
|
onClosed: () => void;
|
|
33
40
|
}, {
|
|
34
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* NOTE: The signature with the `event` argument will be removed in hanna-react v0.11
|
|
35
43
|
*
|
|
36
44
|
* Return `false` to prevent the alert from closing
|
|
37
45
|
*/
|
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
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
+
## 0.10.164
|
|
8
|
+
|
|
9
|
+
_2026-01-20_
|
|
10
|
+
|
|
11
|
+
- fix: Broken/missing `IconToken` type export due to bad import path — affects
|
|
12
|
+
both `Button*` and `Icon` components
|
|
13
|
+
|
|
14
|
+
## 0.10.163
|
|
15
|
+
|
|
16
|
+
_2026-01-20_
|
|
17
|
+
|
|
18
|
+
- feat: Add `useLaggedState` to `utils` for advanced delayed state updates
|
|
19
|
+
|
|
7
20
|
## 0.10.162
|
|
8
21
|
|
|
9
22
|
_2026-01-16_
|
package/Icon.d.ts
CHANGED
package/_abstract/_Button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { IconToken } from '
|
|
2
|
+
import { IconToken } from '@reykjavik/hanna-css';
|
|
3
3
|
import { BemModifierProps, BemProps } from '../utils/types.js';
|
|
4
4
|
type ButtonElmProps = {
|
|
5
5
|
href?: never;
|
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,17 +24,22 @@ 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
|
-
*
|
|
26
|
-
* Mosueover and keyboard focus resets the timer.
|
|
27
|
+
/**
|
|
28
|
+
* Seconds until the Alert auto-closes.
|
|
29
|
+
* Mosueover and keyboard focus resets the timer. \
|
|
30
|
+
* NOTE: An `onClosed` handler is required when using this option.
|
|
27
31
|
*/
|
|
28
32
|
autoClose: number;
|
|
29
33
|
/** Return `false` to prevent the alert from closing. */
|
|
30
34
|
onClose?: () => void | boolean;
|
|
31
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Callback that fires when the alert has closed/transitoned out. \
|
|
37
|
+
* Required when `autoClose` is used.
|
|
38
|
+
*/
|
|
32
39
|
onClosed: () => void;
|
|
33
40
|
}, {
|
|
34
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* NOTE: The signature with the `event` argument will be removed in hanna-react v0.11
|
|
35
43
|
*
|
|
36
44
|
* Return `false` to prevent the alert from closing
|
|
37
45
|
*/
|
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) {
|
package/esm/Icon.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { IconToken } from '
|
|
2
|
+
import { IconToken } from '@reykjavik/hanna-css';
|
|
3
3
|
import { BemModifierProps, BemProps } from '../utils/types.js';
|
|
4
4
|
type ButtonElmProps = {
|
|
5
5
|
href?: never;
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reykjavik/hanna-react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.164",
|
|
4
4
|
"author": "Reykjavík (http://www.reykjavik.is)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Hugsmiðjan ehf (http://www.hugsmidjan.is)",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@floating-ui/react": "^0.19.2",
|
|
18
18
|
"@hugsmidjan/qj": "^4.22.1",
|
|
19
19
|
"@hugsmidjan/react": "^0.4.32",
|
|
20
|
-
"@reykjavik/hanna-css": "^0.4.
|
|
20
|
+
"@reykjavik/hanna-css": "^0.4.26",
|
|
21
21
|
"@reykjavik/hanna-utils": "^0.2.21",
|
|
22
22
|
"@types/react-autosuggest": "^10.1.0",
|
|
23
23
|
"@types/react-datepicker": "^4.8.0",
|
|
@@ -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
|
// ---------------------------------------------------------------------------
|