@agnos-ui/react-headless 0.9.3 → 0.10.0-next.0

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.
@@ -6,7 +6,7 @@ import type { PropsWithChildren } from 'react';
6
6
  * @param options - Optional toaster properties.
7
7
  * @returns An object containing toaster methods and properties.
8
8
  */
9
- export declare const useCreateToaster: <Props extends Partial<ToastProps>>(options?: ToasterProps) => {
9
+ export declare const useCreateToaster: <Props extends Partial<ToastProps>>(options?: Partial<ToasterProps>) => {
10
10
  toasts: import("@agnos-ui/core/components/toast").ToasterToast<Props>[];
11
11
  options: ToasterProps;
12
12
  addToast: (props: Props) => number;
package/config.cjs CHANGED
@@ -5,14 +5,14 @@ const types = require("@agnos-ui/core/types");
5
5
  const config = require("@agnos-ui/core/config");
6
6
  const tansu = require("@amadeus-it-group/tansu");
7
7
  const react = require("react");
8
- const widget = require("./widget-BkLUvh4T.cjs");
9
- const stores = require("./stores-DD819q-h.cjs");
8
+ const widget = require("./widget-ClcZWw9S.cjs");
9
+ const stores = require("./stores-DPOTvwx1.cjs");
10
10
  const widgetsConfigFactory = (WidgetsConfigContext2 = react.createContext(void 0)) => {
11
11
  const useWidgetContext2 = (widgetName, defaultConfig) => {
12
12
  const widgetsConfig = react.useContext(WidgetsConfigContext2);
13
13
  const defaultConfig$ = stores.usePropsAsStore(defaultConfig);
14
14
  return react.useMemo(
15
- () => tansu.computed(() => ({ ...defaultConfig$(), ...widgetName ? widgetsConfig == null ? void 0 : widgetsConfig()[widgetName] : void 0 })),
15
+ () => tansu.computed(() => ({ ...defaultConfig$(), ...widgetName ? widgetsConfig?.()[widgetName] : void 0 })),
16
16
  [defaultConfig$, widgetName, widgetsConfig]
17
17
  );
18
18
  };
package/config.js CHANGED
@@ -4,14 +4,14 @@ import { createWidgetsConfig } from "@agnos-ui/core/config";
4
4
  export * from "@agnos-ui/core/config";
5
5
  import { computed } from "@amadeus-it-group/tansu";
6
6
  import { createContext, useContext, useMemo } from "react";
7
- import { u as useWidgetWithConfig } from "./widget-DLB7vGCY.js";
8
- import { b as usePropsAsStore } from "./stores-DZalyTTa.js";
7
+ import { u as useWidgetWithConfig } from "./widget-D80Xk-XZ.js";
8
+ import { b as usePropsAsStore } from "./stores-BWQ6d_4B.js";
9
9
  const widgetsConfigFactory = (WidgetsConfigContext2 = createContext(void 0)) => {
10
10
  const useWidgetContext2 = (widgetName, defaultConfig) => {
11
11
  const widgetsConfig = useContext(WidgetsConfigContext2);
12
12
  const defaultConfig$ = usePropsAsStore(defaultConfig);
13
13
  return useMemo(
14
- () => computed(() => ({ ...defaultConfig$(), ...widgetName ? widgetsConfig == null ? void 0 : widgetsConfig()[widgetName] : void 0 })),
14
+ () => computed(() => ({ ...defaultConfig$(), ...widgetName ? widgetsConfig?.()[widgetName] : void 0 })),
15
15
  [defaultConfig$, widgetName, widgetsConfig]
16
16
  );
17
17
  };
@@ -15,7 +15,7 @@ function directiveAttributes(...directives) {
15
15
  for (const [name, value] of Object.entries(attributes)) {
16
16
  reactAttributes[attributesMap.get(name) ?? name] = value;
17
17
  }
18
- if (classNames == null ? void 0 : classNames.length) {
18
+ if (classNames?.length) {
19
19
  reactAttributes.className = classNames.join(" ");
20
20
  }
21
21
  if (Object.keys(style).length) {
@@ -25,7 +25,6 @@ function directiveAttributes(...directives) {
25
25
  }
26
26
  const ssrAttributes = esmEnv.BROWSER ? () => ({}) : directiveAttributes;
27
27
  const useDirective = esmEnv.BROWSER ? esmEnv.DEV ? (directive2, args) => {
28
- var _a, _b;
29
28
  const instance = react.useRef(void 0);
30
29
  const propsRef = react.useRef(void 0);
31
30
  const refCalledOnce = react.useRef(false);
@@ -41,9 +40,8 @@ const useDirective = esmEnv.BROWSER ? esmEnv.DEV ? (directive2, args) => {
41
40
  refCalledOnce.current = true;
42
41
  }
43
42
  return () => {
44
- var _a2, _b2;
45
43
  if (!refCalledOnce.current) {
46
- (_b2 = (_a2 = instance.current) == null ? void 0 : _a2.destroy) == null ? void 0 : _b2.call(_a2);
44
+ instance.current?.destroy?.();
47
45
  instance.current = void 0;
48
46
  }
49
47
  };
@@ -51,25 +49,23 @@ const useDirective = esmEnv.BROWSER ? esmEnv.DEV ? (directive2, args) => {
51
49
  [directive2]
52
50
  );
53
51
  propsRef.current = args;
54
- (_b = (_a = instance.current) == null ? void 0 : _a.update) == null ? void 0 : _b.call(_a, args);
52
+ instance.current?.update?.(args);
55
53
  return { ref };
56
54
  } : (directive2, args) => {
57
- var _a, _b;
58
55
  const instance = react.useRef(void 0);
59
56
  const propsRef = react.useRef(void 0);
60
57
  const ref = react.useCallback(
61
58
  (element) => {
62
59
  instance.current = directive2(element, propsRef.current);
63
60
  return () => {
64
- var _a2, _b2;
65
- (_b2 = (_a2 = instance.current) == null ? void 0 : _a2.destroy) == null ? void 0 : _b2.call(_a2);
61
+ instance.current?.destroy?.();
66
62
  instance.current = void 0;
67
63
  };
68
64
  },
69
65
  [directive2]
70
66
  );
71
67
  propsRef.current = args;
72
- (_b = (_a = instance.current) == null ? void 0 : _a.update) == null ? void 0 : _b.call(_a, args);
68
+ instance.current?.update?.(args);
73
69
  return { ref };
74
70
  } : (directive2, args) => ssrAttributes([directive2, args]);
75
71
  const useDirectives = esmEnv.BROWSER ? (...directives) => useDirective(directive.multiDirective, directives) : directiveAttributes;
@@ -14,7 +14,7 @@ function directiveAttributes(...directives) {
14
14
  for (const [name, value] of Object.entries(attributes)) {
15
15
  reactAttributes[attributesMap.get(name) ?? name] = value;
16
16
  }
17
- if (classNames == null ? void 0 : classNames.length) {
17
+ if (classNames?.length) {
18
18
  reactAttributes.className = classNames.join(" ");
19
19
  }
20
20
  if (Object.keys(style).length) {
@@ -24,7 +24,6 @@ function directiveAttributes(...directives) {
24
24
  }
25
25
  const ssrAttributes = BROWSER ? () => ({}) : directiveAttributes;
26
26
  const useDirective = BROWSER ? DEV ? (directive, args) => {
27
- var _a, _b;
28
27
  const instance = useRef(void 0);
29
28
  const propsRef = useRef(void 0);
30
29
  const refCalledOnce = useRef(false);
@@ -40,9 +39,8 @@ const useDirective = BROWSER ? DEV ? (directive, args) => {
40
39
  refCalledOnce.current = true;
41
40
  }
42
41
  return () => {
43
- var _a2, _b2;
44
42
  if (!refCalledOnce.current) {
45
- (_b2 = (_a2 = instance.current) == null ? void 0 : _a2.destroy) == null ? void 0 : _b2.call(_a2);
43
+ instance.current?.destroy?.();
46
44
  instance.current = void 0;
47
45
  }
48
46
  };
@@ -50,25 +48,23 @@ const useDirective = BROWSER ? DEV ? (directive, args) => {
50
48
  [directive]
51
49
  );
52
50
  propsRef.current = args;
53
- (_b = (_a = instance.current) == null ? void 0 : _a.update) == null ? void 0 : _b.call(_a, args);
51
+ instance.current?.update?.(args);
54
52
  return { ref };
55
53
  } : (directive, args) => {
56
- var _a, _b;
57
54
  const instance = useRef(void 0);
58
55
  const propsRef = useRef(void 0);
59
56
  const ref = useCallback(
60
57
  (element) => {
61
58
  instance.current = directive(element, propsRef.current);
62
59
  return () => {
63
- var _a2, _b2;
64
- (_b2 = (_a2 = instance.current) == null ? void 0 : _a2.destroy) == null ? void 0 : _b2.call(_a2);
60
+ instance.current?.destroy?.();
65
61
  instance.current = void 0;
66
62
  };
67
63
  },
68
64
  [directive]
69
65
  );
70
66
  propsRef.current = args;
71
- (_b = (_a = instance.current) == null ? void 0 : _a.update) == null ? void 0 : _b.call(_a, args);
67
+ instance.current?.update?.(args);
72
68
  return { ref };
73
69
  } : (directive, args) => ssrAttributes([directive, args]);
74
70
  const useDirectives = BROWSER ? (...directives) => useDirective(multiDirective, directives) : directiveAttributes;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const drawer = require("@agnos-ui/core/components/drawer");
4
+ Object.keys(drawer).forEach((k) => {
5
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
+ enumerable: true,
7
+ get: () => drawer[k]
8
+ });
9
+ });
@@ -0,0 +1 @@
1
+ export * from '@agnos-ui/core/components/drawer';
@@ -0,0 +1 @@
1
+ export * from "@agnos-ui/core/components/drawer";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const toasterProvider = require("../../../toasterProvider-BtIHSdiL.cjs");
3
+ const toasterProvider = require("../../../toasterProvider-CYgzar_d.cjs");
4
4
  const toast = require("@agnos-ui/core/components/toast");
5
5
  exports.ToasterProvider = toasterProvider.ToasterProvider;
6
6
  exports.useCreateToaster = toasterProvider.useCreateToaster;
@@ -1,4 +1,4 @@
1
- import { T, u, a } from "../../../toasterProvider-lT-AfOoK.js";
1
+ import { T, u, a } from "../../../toasterProvider-CzmXu8rV.js";
2
2
  export * from "@agnos-ui/core/components/toast";
3
3
  export {
4
4
  T as ToasterProvider,
@@ -6,6 +6,7 @@ export * from './services/matchMedia';
6
6
  export * from './services/intersection';
7
7
  export * from './services/hash';
8
8
  export * from './services/focustrack';
9
+ export * from './services/focusElement';
9
10
  export * from './services/floatingUI';
10
11
  export * from './services/extendWidget';
11
12
  export * from './services/transitions/simpleClassTransition';
@@ -27,8 +28,9 @@ export * from './components/rating/index';
27
28
  export * from './components/progressbar/index';
28
29
  export * from './components/pagination/index';
29
30
  export * from './components/modal/index';
30
- export * from './components/carousel/index';
31
+ export * from './components/drawer/index';
31
32
  export * from './components/collapse/index';
33
+ export * from './components/carousel/index';
32
34
  export * from './components/alert/index';
33
35
  export * from './components/accordion/index';
34
36
  export * from './utils/portal';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const focusElement = require("@agnos-ui/core/services/focusElement");
4
+ Object.keys(focusElement).forEach((k) => {
5
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
6
+ enumerable: true,
7
+ get: () => focusElement[k]
8
+ });
9
+ });
@@ -0,0 +1 @@
1
+ export * from '@agnos-ui/core/services/focusElement';
@@ -0,0 +1 @@
1
+ export * from "@agnos-ui/core/services/focusElement";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const directive = require("../../directive-3diaW3tS.cjs");
3
+ const directive = require("../../directive-C1WhTndu.cjs");
4
4
  const directive$1 = require("@agnos-ui/core/utils/directive");
5
5
  exports.directiveAttributes = directive.directiveAttributes;
6
6
  exports.ssrAttributes = directive.ssrAttributes;
@@ -1,4 +1,4 @@
1
- import { d, s, u, a } from "../../directive-CEErjM5c.js";
1
+ import { d, s, u, a } from "../../directive-Ds3K8r_f.js";
2
2
  export * from "@agnos-ui/core/utils/directive";
3
3
  export {
4
4
  d as directiveAttributes,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const stores = require("../../stores-DD819q-h.cjs");
3
+ const stores = require("../../stores-DPOTvwx1.cjs");
4
4
  const stores$1 = require("@agnos-ui/core/utils/stores");
5
5
  exports.useObservable = stores.useObservable;
6
6
  exports.useObservablesProxy = stores.useObservablesProxy;
@@ -1,4 +1,4 @@
1
- import { u, a, b } from "../../stores-DZalyTTa.js";
1
+ import { u, a, b } from "../../stores-BWQ6d_4B.js";
2
2
  export * from "@agnos-ui/core/utils/stores";
3
3
  export {
4
4
  u as useObservable,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const widget = require("../../widget-BkLUvh4T.cjs");
3
+ const widget = require("../../widget-ClcZWw9S.cjs");
4
4
  const widget$1 = require("@agnos-ui/core/utils/widget");
5
5
  exports.useWidgetWithConfig = widget.useWidgetWithConfig;
6
6
  Object.keys(widget$1).forEach((k) => {
@@ -1,4 +1,4 @@
1
- import { u } from "../../widget-DLB7vGCY.js";
1
+ import { u } from "../../widget-D80Xk-XZ.js";
2
2
  export * from "@agnos-ui/core/utils/widget";
3
3
  export {
4
4
  u as useWidgetWithConfig
package/index.cjs CHANGED
@@ -8,6 +8,7 @@ const matchMedia = require("@agnos-ui/core/services/matchMedia");
8
8
  const intersection = require("@agnos-ui/core/services/intersection");
9
9
  const hash = require("@agnos-ui/core/services/hash");
10
10
  const focustrack = require("@agnos-ui/core/services/focustrack");
11
+ const focusElement = require("@agnos-ui/core/services/focusElement");
11
12
  const floatingUI = require("@agnos-ui/core/services/floatingUI");
12
13
  const extendWidget = require("@agnos-ui/core/services/extendWidget");
13
14
  const simpleClassTransition = require("@agnos-ui/core/services/transitions/simpleClassTransition");
@@ -16,17 +17,17 @@ const collapse = require("@agnos-ui/core/services/transitions/collapse");
16
17
  const baseTransitions = require("@agnos-ui/core/services/transitions/baseTransitions");
17
18
  const writables = require("@agnos-ui/core/utils/writables");
18
19
  const widget$1 = require("@agnos-ui/core/utils/widget");
19
- const widget = require("./widget-BkLUvh4T.cjs");
20
+ const widget = require("./widget-ClcZWw9S.cjs");
20
21
  const stores$1 = require("@agnos-ui/core/utils/stores");
21
- const stores = require("./stores-DD819q-h.cjs");
22
+ const stores = require("./stores-DPOTvwx1.cjs");
22
23
  const func = require("@agnos-ui/core/utils/func");
23
24
  const directive$1 = require("@agnos-ui/core/utils/directive");
24
- const directive = require("./directive-3diaW3tS.cjs");
25
+ const directive = require("./directive-C1WhTndu.cjs");
25
26
  const types = require("@agnos-ui/core/types");
26
27
  const config$1 = require("@agnos-ui/core/config");
27
28
  const config = require("./config.cjs");
28
29
  const tree = require("@agnos-ui/core/components/tree");
29
- const toasterProvider = require("./toasterProvider-BtIHSdiL.cjs");
30
+ const toasterProvider = require("./toasterProvider-CYgzar_d.cjs");
30
31
  const toast = require("@agnos-ui/core/components/toast");
31
32
  const slider = require("@agnos-ui/core/components/slider");
32
33
  const select = require("@agnos-ui/core/components/select");
@@ -34,8 +35,9 @@ const rating = require("@agnos-ui/core/components/rating");
34
35
  const progressbar = require("@agnos-ui/core/components/progressbar");
35
36
  const pagination = require("@agnos-ui/core/components/pagination");
36
37
  const modal = require("@agnos-ui/core/components/modal");
37
- const carousel = require("@agnos-ui/core/components/carousel");
38
+ const drawer = require("@agnos-ui/core/components/drawer");
38
39
  const collapse$1 = require("@agnos-ui/core/components/collapse");
40
+ const carousel = require("@agnos-ui/core/components/carousel");
39
41
  const alert = require("@agnos-ui/core/components/alert");
40
42
  const accordion = require("@agnos-ui/core/components/accordion");
41
43
  const portal$1 = require("./portal-B0Q5KLrA.cjs");
@@ -106,6 +108,12 @@ Object.keys(focustrack).forEach((k) => {
106
108
  get: () => focustrack[k]
107
109
  });
108
110
  });
111
+ Object.keys(focusElement).forEach((k) => {
112
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
113
+ enumerable: true,
114
+ get: () => focusElement[k]
115
+ });
116
+ });
109
117
  Object.keys(floatingUI).forEach((k) => {
110
118
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
111
119
  enumerable: true,
@@ -232,10 +240,10 @@ Object.keys(modal).forEach((k) => {
232
240
  get: () => modal[k]
233
241
  });
234
242
  });
235
- Object.keys(carousel).forEach((k) => {
243
+ Object.keys(drawer).forEach((k) => {
236
244
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
237
245
  enumerable: true,
238
- get: () => carousel[k]
246
+ get: () => drawer[k]
239
247
  });
240
248
  });
241
249
  Object.keys(collapse$1).forEach((k) => {
@@ -244,6 +252,12 @@ Object.keys(collapse$1).forEach((k) => {
244
252
  get: () => collapse$1[k]
245
253
  });
246
254
  });
255
+ Object.keys(carousel).forEach((k) => {
256
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
257
+ enumerable: true,
258
+ get: () => carousel[k]
259
+ });
260
+ });
247
261
  Object.keys(alert).forEach((k) => {
248
262
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
249
263
  enumerable: true,
package/index.js CHANGED
@@ -6,6 +6,7 @@ export * from "@agnos-ui/core/services/matchMedia";
6
6
  export * from "@agnos-ui/core/services/intersection";
7
7
  export * from "@agnos-ui/core/services/hash";
8
8
  export * from "@agnos-ui/core/services/focustrack";
9
+ export * from "@agnos-ui/core/services/focusElement";
9
10
  export * from "@agnos-ui/core/services/floatingUI";
10
11
  export * from "@agnos-ui/core/services/extendWidget";
11
12
  export * from "@agnos-ui/core/services/transitions/simpleClassTransition";
@@ -14,17 +15,17 @@ export * from "@agnos-ui/core/services/transitions/collapse";
14
15
  export * from "@agnos-ui/core/services/transitions/baseTransitions";
15
16
  export * from "@agnos-ui/core/utils/writables";
16
17
  export * from "@agnos-ui/core/utils/widget";
17
- import { u } from "./widget-DLB7vGCY.js";
18
+ import { u } from "./widget-D80Xk-XZ.js";
18
19
  export * from "@agnos-ui/core/utils/stores";
19
- import { u as u2, a, b } from "./stores-DZalyTTa.js";
20
+ import { u as u2, a, b } from "./stores-BWQ6d_4B.js";
20
21
  export * from "@agnos-ui/core/utils/func";
21
22
  export * from "@agnos-ui/core/utils/directive";
22
- import { d, s, u as u3, a as a2 } from "./directive-CEErjM5c.js";
23
+ import { d, s, u as u3, a as a2 } from "./directive-Ds3K8r_f.js";
23
24
  export * from "@agnos-ui/core/types";
24
25
  export * from "@agnos-ui/core/config";
25
26
  import { WidgetsConfigContext, WidgetsDefaultConfig, useWidget, useWidgetContext, widgetsConfigFactory } from "./config.js";
26
27
  export * from "@agnos-ui/core/components/tree";
27
- import { T, u as u4, a as a3 } from "./toasterProvider-lT-AfOoK.js";
28
+ import { T, u as u4, a as a3 } from "./toasterProvider-CzmXu8rV.js";
28
29
  export * from "@agnos-ui/core/components/toast";
29
30
  export * from "@agnos-ui/core/components/slider";
30
31
  export * from "@agnos-ui/core/components/select";
@@ -32,8 +33,9 @@ export * from "@agnos-ui/core/components/rating";
32
33
  export * from "@agnos-ui/core/components/progressbar";
33
34
  export * from "@agnos-ui/core/components/pagination";
34
35
  export * from "@agnos-ui/core/components/modal";
35
- export * from "@agnos-ui/core/components/carousel";
36
+ export * from "@agnos-ui/core/components/drawer";
36
37
  export * from "@agnos-ui/core/components/collapse";
38
+ export * from "@agnos-ui/core/components/carousel";
37
39
  export * from "@agnos-ui/core/components/alert";
38
40
  export * from "@agnos-ui/core/components/accordion";
39
41
  import { P } from "./portal-CX8X69NK.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agnos-ui/react-headless",
3
3
  "description": "Headless component library for React.",
4
- "version": "0.9.3",
4
+ "version": "0.10.0-next.0",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
7
7
  "module": "./index.js",
@@ -49,7 +49,7 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@agnos-ui/core": "0.9.3"
52
+ "@agnos-ui/core": "0.10.0-next.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@amadeus-it-group/tansu": "^2.0.0",
@@ -78,14 +78,14 @@ function useObservablesProxy(stores) {
78
78
  if (store) {
79
79
  let storeInfo = internalState2.storeInfo[key];
80
80
  if (!storeInfo || storeInfo.store !== store) {
81
- const unsubscribe = storeInfo == null ? void 0 : storeInfo.unsubscribe;
81
+ const unsubscribe = storeInfo?.unsubscribe;
82
82
  storeInfo = {
83
83
  store,
84
84
  computedStore: createComputed(store, internalState2),
85
85
  unsubscribe: null
86
86
  };
87
87
  internalState2.storeInfo[key] = storeInfo;
88
- unsubscribe == null ? void 0 : unsubscribe();
88
+ unsubscribe?.();
89
89
  }
90
90
  if (internalState2.hasEffect && !storeInfo.unsubscribe) {
91
91
  storeInfo.unsubscribe = storeInfo.computedStore.subscribe(onStoreChange);
@@ -99,7 +99,7 @@ function useObservablesProxy(stores) {
99
99
  {
100
100
  get(_target, name) {
101
101
  const store = typeof name === "string" ? internalState2.checkStoreSubscribed(name) : null;
102
- return store == null ? void 0 : store();
102
+ return store?.();
103
103
  }
104
104
  }
105
105
  )
@@ -119,7 +119,7 @@ function useObservablesProxy(stores) {
119
119
  for (const info of Object.values(internalState.storeInfo)) {
120
120
  const unsubscribe = info.unsubscribe;
121
121
  info.unsubscribe = null;
122
- unsubscribe == null ? void 0 : unsubscribe();
122
+ unsubscribe?.();
123
123
  }
124
124
  };
125
125
  }, [stores]);
@@ -79,14 +79,14 @@ function useObservablesProxy(stores2) {
79
79
  if (store) {
80
80
  let storeInfo = internalState2.storeInfo[key];
81
81
  if (!storeInfo || storeInfo.store !== store) {
82
- const unsubscribe = storeInfo == null ? void 0 : storeInfo.unsubscribe;
82
+ const unsubscribe = storeInfo?.unsubscribe;
83
83
  storeInfo = {
84
84
  store,
85
85
  computedStore: createComputed(store, internalState2),
86
86
  unsubscribe: null
87
87
  };
88
88
  internalState2.storeInfo[key] = storeInfo;
89
- unsubscribe == null ? void 0 : unsubscribe();
89
+ unsubscribe?.();
90
90
  }
91
91
  if (internalState2.hasEffect && !storeInfo.unsubscribe) {
92
92
  storeInfo.unsubscribe = storeInfo.computedStore.subscribe(onStoreChange);
@@ -100,7 +100,7 @@ function useObservablesProxy(stores2) {
100
100
  {
101
101
  get(_target, name) {
102
102
  const store = typeof name === "string" ? internalState2.checkStoreSubscribed(name) : null;
103
- return store == null ? void 0 : store();
103
+ return store?.();
104
104
  }
105
105
  }
106
106
  )
@@ -120,7 +120,7 @@ function useObservablesProxy(stores2) {
120
120
  for (const info of Object.values(internalState.storeInfo)) {
121
121
  const unsubscribe = info.unsubscribe;
122
122
  info.unsubscribe = null;
123
- unsubscribe == null ? void 0 : unsubscribe();
123
+ unsubscribe?.();
124
124
  }
125
125
  };
126
126
  }, [stores2]);
@@ -1,12 +1,22 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const toast = require("@agnos-ui/core/components/toast");
4
+ const stores = require("@agnos-ui/core/utils/stores");
4
5
  const react = require("react");
5
- const stores = require("./stores-DD819q-h.cjs");
6
+ const stores$1 = require("./stores-DPOTvwx1.cjs");
6
7
  const useCreateToaster = (options) => {
7
- const toaster = react.useMemo(() => new toast.Toaster(options), [options]);
8
- const toasts = stores.useObservable(toaster.toasts);
9
- const toasterOptions = stores.useObservable(toaster.options);
8
+ const toaster = react.useMemo(() => new toast.Toaster(options), []);
9
+ options = options ?? {};
10
+ const previousOptions = react.useRef(options);
11
+ react.useMemo(() => {
12
+ const changedOptions = stores.findChangedProperties(previousOptions.current, options);
13
+ previousOptions.current = options;
14
+ if (changedOptions) {
15
+ toaster.options.update((v) => ({ ...v, ...changedOptions }));
16
+ }
17
+ }, [toaster.options, options]);
18
+ const toasts = stores$1.useObservable(toaster.toasts);
19
+ const toasterOptions = stores$1.useObservable(toaster.options);
10
20
  const addToast = react.useCallback((props) => toaster.addToast(props), [toaster]);
11
21
  const removeToast = toaster.removeToast;
12
22
  const eventsDirective = toaster.eventsDirective;
@@ -1,9 +1,19 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Toaster } from "@agnos-ui/core/components/toast";
3
- import { useMemo, useCallback, createContext, useContext } from "react";
4
- import { u as useObservable } from "./stores-DZalyTTa.js";
3
+ import { findChangedProperties } from "@agnos-ui/core/utils/stores";
4
+ import { useMemo, useRef, useCallback, createContext, useContext } from "react";
5
+ import { u as useObservable } from "./stores-BWQ6d_4B.js";
5
6
  const useCreateToaster = (options) => {
6
- const toaster = useMemo(() => new Toaster(options), [options]);
7
+ const toaster = useMemo(() => new Toaster(options), []);
8
+ options = options ?? {};
9
+ const previousOptions = useRef(options);
10
+ useMemo(() => {
11
+ const changedOptions = findChangedProperties(previousOptions.current, options);
12
+ previousOptions.current = options;
13
+ if (changedOptions) {
14
+ toaster.options.update((v) => ({ ...v, ...changedOptions }));
15
+ }
16
+ }, [toaster.options, options]);
7
17
  const toasts = useObservable(toaster.toasts);
8
18
  const toasterOptions = useObservable(toaster.options);
9
19
  const addToast = useCallback((props) => toaster.addToast(props), [toaster]);
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  const stores = require("@agnos-ui/core/utils/stores");
3
3
  const react = require("react");
4
- const stores$1 = require("./stores-DD819q-h.cjs");
4
+ const stores$1 = require("./stores-DPOTvwx1.cjs");
5
5
  require("@agnos-ui/core/utils/widget");
6
6
  function useWidgetWithConfig(factory, props = {}, propsConfig) {
7
- const coreWidget = react.useMemo(() => factory({ ...propsConfig, props: { ...propsConfig == null ? void 0 : propsConfig.props, ...props } }), []);
7
+ const coreWidget = react.useMemo(() => factory({ ...propsConfig, props: { ...propsConfig?.props, ...props } }), []);
8
8
  const previousProps = react.useRef(props);
9
9
  react.useMemo(() => {
10
10
  const changedProps = stores.findChangedProperties(previousProps.current, props);
@@ -1,9 +1,9 @@
1
1
  import { findChangedProperties } from "@agnos-ui/core/utils/stores";
2
2
  import { useMemo, useRef } from "react";
3
- import { a as useObservablesProxy } from "./stores-DZalyTTa.js";
3
+ import { a as useObservablesProxy } from "./stores-BWQ6d_4B.js";
4
4
  import "@agnos-ui/core/utils/widget";
5
5
  function useWidgetWithConfig(factory, props = {}, propsConfig) {
6
- const coreWidget = useMemo(() => factory({ ...propsConfig, props: { ...propsConfig == null ? void 0 : propsConfig.props, ...props } }), []);
6
+ const coreWidget = useMemo(() => factory({ ...propsConfig, props: { ...propsConfig?.props, ...props } }), []);
7
7
  const previousProps = useRef(props);
8
8
  useMemo(() => {
9
9
  const changedProps = findChangedProperties(previousProps.current, props);