@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 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
- /** Seconds until the Alert auto-closes.
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
- /** @deprecated This signature with the `event` argument will be removed in hanna-react v0.11
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, // eslint-disable-line deprecation/deprecation
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); // eslint-disable-line deprecation/deprecation
64
+ onClose(event);
66
65
  if (ret !== false) {
67
66
  setOpen(false);
68
67
  if (closing.current) {
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
+ ## 0.10.163
8
+
9
+ _2026-01-20_
10
+
11
+ - feat: Add `useLaggedState` to `utils` for advanced delayed state updates
12
+
7
13
  ## 0.10.162
8
14
 
9
15
  _2026-01-16_
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
- /** Seconds until the Alert auto-closes.
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
- /** @deprecated This signature with the `event` argument will be removed in hanna-react v0.11
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, // eslint-disable-line deprecation/deprecation
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); // eslint-disable-line deprecation/deprecation
60
+ onClose(event);
62
61
  if (ret !== false) {
63
62
  setOpen(false);
64
63
  if (closing.current) {
@@ -1,5 +1,6 @@
1
1
  /**
2
- * A `useState` alternative with in-built support for delayed (debounced) effect.
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
- * A `useState` alternative with in-built support for delayed (debounced) effect.
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.162",
3
+ "version": "0.10.163",
4
4
  "author": "Reykjavík (http://www.reykjavik.is)",
5
5
  "contributors": [
6
6
  "Hugsmiðjan ehf (http://www.hugsmidjan.is)",
@@ -1,5 +1,6 @@
1
1
  /**
2
- * A `useState` alternative with in-built support for delayed (debounced) effect.
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.
@@ -4,7 +4,8 @@ exports.useLaggedState = void 0;
4
4
  const react_1 = require("react");
5
5
  // ---------------------------------------------------------------------------
6
6
  /**
7
- * A `useState` alternative with in-built support for delayed (debounced) effect.
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
  // ---------------------------------------------------------------------------