@agnos-ui/react-headless 0.9.2 → 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.
- package/components/toast/toasterProvider.d.ts +1 -1
- package/config.cjs +3 -3
- package/config.js +3 -3
- package/{directive-3diaW3tS.cjs → directive-C1WhTndu.cjs} +5 -9
- package/{directive-CEErjM5c.js → directive-Ds3K8r_f.js} +5 -9
- package/generated/components/collapse/index.cjs +9 -0
- package/generated/components/collapse/index.d.ts +1 -0
- package/generated/components/collapse/index.js +1 -0
- package/generated/components/drawer/index.cjs +9 -0
- package/generated/components/drawer/index.d.ts +1 -0
- package/generated/components/drawer/index.js +1 -0
- package/generated/components/toast/index.cjs +1 -1
- package/generated/components/toast/index.js +1 -1
- package/generated/index.d.ts +3 -0
- package/generated/services/focusElement.cjs +9 -0
- package/generated/services/focusElement.d.ts +1 -0
- package/generated/services/focusElement.js +1 -0
- package/generated/utils/directive.cjs +1 -1
- package/generated/utils/directive.js +1 -1
- package/generated/utils/stores.cjs +1 -1
- package/generated/utils/stores.js +1 -1
- package/generated/utils/widget.cjs +8 -1
- package/generated/utils/widget.js +2 -1
- package/index.cjs +32 -4
- package/index.js +8 -4
- package/package.json +2 -2
- package/{stores-DZalyTTa.js → stores-BWQ6d_4B.js} +4 -4
- package/{stores-DD819q-h.cjs → stores-DPOTvwx1.cjs} +4 -4
- package/{toasterProvider-BtIHSdiL.cjs → toasterProvider-CYgzar_d.cjs} +14 -4
- package/{toasterProvider-lT-AfOoK.js → toasterProvider-CzmXu8rV.js} +13 -3
- package/utils/widget.d.ts +1 -0
- package/{widget-CHGwSEgq.cjs → widget-ClcZWw9S.cjs} +3 -2
- package/{widget-BiWY_QJE.js → widget-D80Xk-XZ.js} +3 -2
|
@@ -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-
|
|
9
|
-
const stores = require("./stores-
|
|
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
|
|
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-
|
|
8
|
-
import { b as usePropsAsStore } from "./stores-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 collapse = require("@agnos-ui/core/components/collapse");
|
|
4
|
+
Object.keys(collapse).forEach((k) => {
|
|
5
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => collapse[k]
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@agnos-ui/core/components/collapse';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@agnos-ui/core/components/collapse";
|
|
@@ -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-
|
|
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;
|
package/generated/index.d.ts
CHANGED
|
@@ -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,6 +28,8 @@ 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';
|
|
31
|
+
export * from './components/drawer/index';
|
|
32
|
+
export * from './components/collapse/index';
|
|
30
33
|
export * from './components/carousel/index';
|
|
31
34
|
export * from './components/alert/index';
|
|
32
35
|
export * from './components/accordion/index';
|
|
@@ -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-
|
|
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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const stores = require("../../stores-
|
|
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,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const widget = require("../../widget-
|
|
3
|
+
const widget = require("../../widget-ClcZWw9S.cjs");
|
|
4
|
+
const widget$1 = require("@agnos-ui/core/utils/widget");
|
|
4
5
|
exports.useWidgetWithConfig = widget.useWidgetWithConfig;
|
|
6
|
+
Object.keys(widget$1).forEach((k) => {
|
|
7
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: () => widget$1[k]
|
|
10
|
+
});
|
|
11
|
+
});
|
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");
|
|
@@ -15,17 +16,18 @@ const cssTransitions = require("@agnos-ui/core/services/transitions/cssTransitio
|
|
|
15
16
|
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
|
-
const widget = require("
|
|
19
|
+
const widget$1 = require("@agnos-ui/core/utils/widget");
|
|
20
|
+
const widget = require("./widget-ClcZWw9S.cjs");
|
|
19
21
|
const stores$1 = require("@agnos-ui/core/utils/stores");
|
|
20
|
-
const stores = require("./stores-
|
|
22
|
+
const stores = require("./stores-DPOTvwx1.cjs");
|
|
21
23
|
const func = require("@agnos-ui/core/utils/func");
|
|
22
24
|
const directive$1 = require("@agnos-ui/core/utils/directive");
|
|
23
|
-
const directive = require("./directive-
|
|
25
|
+
const directive = require("./directive-C1WhTndu.cjs");
|
|
24
26
|
const types = require("@agnos-ui/core/types");
|
|
25
27
|
const config$1 = require("@agnos-ui/core/config");
|
|
26
28
|
const config = require("./config.cjs");
|
|
27
29
|
const tree = require("@agnos-ui/core/components/tree");
|
|
28
|
-
const toasterProvider = require("./toasterProvider-
|
|
30
|
+
const toasterProvider = require("./toasterProvider-CYgzar_d.cjs");
|
|
29
31
|
const toast = require("@agnos-ui/core/components/toast");
|
|
30
32
|
const slider = require("@agnos-ui/core/components/slider");
|
|
31
33
|
const select = require("@agnos-ui/core/components/select");
|
|
@@ -33,6 +35,8 @@ const rating = require("@agnos-ui/core/components/rating");
|
|
|
33
35
|
const progressbar = require("@agnos-ui/core/components/progressbar");
|
|
34
36
|
const pagination = require("@agnos-ui/core/components/pagination");
|
|
35
37
|
const modal = require("@agnos-ui/core/components/modal");
|
|
38
|
+
const drawer = require("@agnos-ui/core/components/drawer");
|
|
39
|
+
const collapse$1 = require("@agnos-ui/core/components/collapse");
|
|
36
40
|
const carousel = require("@agnos-ui/core/components/carousel");
|
|
37
41
|
const alert = require("@agnos-ui/core/components/alert");
|
|
38
42
|
const accordion = require("@agnos-ui/core/components/accordion");
|
|
@@ -104,6 +108,12 @@ Object.keys(focustrack).forEach((k) => {
|
|
|
104
108
|
get: () => focustrack[k]
|
|
105
109
|
});
|
|
106
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
|
+
});
|
|
107
117
|
Object.keys(floatingUI).forEach((k) => {
|
|
108
118
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
109
119
|
enumerable: true,
|
|
@@ -146,6 +156,12 @@ Object.keys(writables).forEach((k) => {
|
|
|
146
156
|
get: () => writables[k]
|
|
147
157
|
});
|
|
148
158
|
});
|
|
159
|
+
Object.keys(widget$1).forEach((k) => {
|
|
160
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: () => widget$1[k]
|
|
163
|
+
});
|
|
164
|
+
});
|
|
149
165
|
Object.keys(stores$1).forEach((k) => {
|
|
150
166
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
151
167
|
enumerable: true,
|
|
@@ -224,6 +240,18 @@ Object.keys(modal).forEach((k) => {
|
|
|
224
240
|
get: () => modal[k]
|
|
225
241
|
});
|
|
226
242
|
});
|
|
243
|
+
Object.keys(drawer).forEach((k) => {
|
|
244
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
get: () => drawer[k]
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
Object.keys(collapse$1).forEach((k) => {
|
|
250
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
get: () => collapse$1[k]
|
|
253
|
+
});
|
|
254
|
+
});
|
|
227
255
|
Object.keys(carousel).forEach((k) => {
|
|
228
256
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
229
257
|
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";
|
|
@@ -13,17 +14,18 @@ export * from "@agnos-ui/core/services/transitions/cssTransitions";
|
|
|
13
14
|
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";
|
|
18
|
+
import { u } from "./widget-D80Xk-XZ.js";
|
|
17
19
|
export * from "@agnos-ui/core/utils/stores";
|
|
18
|
-
import { u as u2, a, b } from "./stores-
|
|
20
|
+
import { u as u2, a, b } from "./stores-BWQ6d_4B.js";
|
|
19
21
|
export * from "@agnos-ui/core/utils/func";
|
|
20
22
|
export * from "@agnos-ui/core/utils/directive";
|
|
21
|
-
import { d, s, u as u3, a as a2 } from "./directive-
|
|
23
|
+
import { d, s, u as u3, a as a2 } from "./directive-Ds3K8r_f.js";
|
|
22
24
|
export * from "@agnos-ui/core/types";
|
|
23
25
|
export * from "@agnos-ui/core/config";
|
|
24
26
|
import { WidgetsConfigContext, WidgetsDefaultConfig, useWidget, useWidgetContext, widgetsConfigFactory } from "./config.js";
|
|
25
27
|
export * from "@agnos-ui/core/components/tree";
|
|
26
|
-
import { T, u as u4, a as a3 } from "./toasterProvider-
|
|
28
|
+
import { T, u as u4, a as a3 } from "./toasterProvider-CzmXu8rV.js";
|
|
27
29
|
export * from "@agnos-ui/core/components/toast";
|
|
28
30
|
export * from "@agnos-ui/core/components/slider";
|
|
29
31
|
export * from "@agnos-ui/core/components/select";
|
|
@@ -31,6 +33,8 @@ export * from "@agnos-ui/core/components/rating";
|
|
|
31
33
|
export * from "@agnos-ui/core/components/progressbar";
|
|
32
34
|
export * from "@agnos-ui/core/components/pagination";
|
|
33
35
|
export * from "@agnos-ui/core/components/modal";
|
|
36
|
+
export * from "@agnos-ui/core/components/drawer";
|
|
37
|
+
export * from "@agnos-ui/core/components/collapse";
|
|
34
38
|
export * from "@agnos-ui/core/components/carousel";
|
|
35
39
|
export * from "@agnos-ui/core/components/alert";
|
|
36
40
|
export * from "@agnos-ui/core/components/accordion";
|
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.
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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-
|
|
6
|
+
const stores$1 = require("./stores-DPOTvwx1.cjs");
|
|
6
7
|
const useCreateToaster = (options) => {
|
|
7
|
-
const toaster = react.useMemo(() => new toast.Toaster(options), [
|
|
8
|
-
|
|
9
|
-
const
|
|
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 {
|
|
4
|
-
import {
|
|
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), [
|
|
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]);
|
package/utils/widget.d.ts
CHANGED
|
@@ -1,9 +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-
|
|
4
|
+
const stores$1 = require("./stores-DPOTvwx1.cjs");
|
|
5
|
+
require("@agnos-ui/core/utils/widget");
|
|
5
6
|
function useWidgetWithConfig(factory, props = {}, propsConfig) {
|
|
6
|
-
const coreWidget = react.useMemo(() => factory({ ...propsConfig, props: { ...propsConfig
|
|
7
|
+
const coreWidget = react.useMemo(() => factory({ ...propsConfig, props: { ...propsConfig?.props, ...props } }), []);
|
|
7
8
|
const previousProps = react.useRef(props);
|
|
8
9
|
react.useMemo(() => {
|
|
9
10
|
const changedProps = stores.findChangedProperties(previousProps.current, props);
|
|
@@ -1,8 +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-
|
|
3
|
+
import { a as useObservablesProxy } from "./stores-BWQ6d_4B.js";
|
|
4
|
+
import "@agnos-ui/core/utils/widget";
|
|
4
5
|
function useWidgetWithConfig(factory, props = {}, propsConfig) {
|
|
5
|
-
const coreWidget = useMemo(() => factory({ ...propsConfig, props: { ...propsConfig
|
|
6
|
+
const coreWidget = useMemo(() => factory({ ...propsConfig, props: { ...propsConfig?.props, ...props } }), []);
|
|
6
7
|
const previousProps = useRef(props);
|
|
7
8
|
useMemo(() => {
|
|
8
9
|
const changedProps = findChangedProperties(previousProps.current, props);
|