@agnos-ui/core 0.9.3 → 0.10.0-next.1

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.
Files changed (113) hide show
  1. package/{accordion-cR5JqWJ8.cjs → accordion-B5LiN1uy.cjs} +15 -20
  2. package/{accordion-CoM4efp-.js → accordion-_zen-g8l.js} +15 -20
  3. package/{alert-DtDozJal.cjs → alert-B-jQDQcB.cjs} +1 -1
  4. package/{alert-YIlqdEPO.js → alert-gGz2CDS9.js} +1 -1
  5. package/{collapse-DwXz2kNw.js → collapse-BV4kD3j9.js} +2 -2
  6. package/{collapse-DRp53EuG.cjs → collapse-gLiT080Y.cjs} +2 -2
  7. package/{common-BToNPUDq.cjs → common-D3QcdJ6S.cjs} +1 -1
  8. package/{common-BqUjUBPy.js → common-DK0ADNTX.js} +1 -1
  9. package/components/accordion/accordion.d.ts +6 -6
  10. package/components/accordion/index.cjs +1 -1
  11. package/components/accordion/index.js +1 -1
  12. package/components/alert/index.cjs +1 -1
  13. package/components/alert/index.js +1 -1
  14. package/components/carousel/carousel.d.ts +15 -0
  15. package/components/carousel/index.cjs +10 -23
  16. package/components/carousel/index.js +10 -23
  17. package/components/collapse/collapse.d.ts +5 -2
  18. package/components/collapse/index.cjs +1 -1
  19. package/components/collapse/index.js +1 -1
  20. package/components/drawer/drawer.d.ts +242 -0
  21. package/components/drawer/index.cjs +5 -0
  22. package/components/drawer/index.d.ts +1 -0
  23. package/components/drawer/index.js +5 -0
  24. package/components/modal/index.cjs +2 -1
  25. package/components/modal/index.js +2 -1
  26. package/components/modal/modal.d.ts +5 -0
  27. package/components/pagination/index.cjs +1 -1
  28. package/components/pagination/index.js +1 -1
  29. package/components/progressbar/index.cjs +1 -1
  30. package/components/progressbar/index.js +1 -1
  31. package/components/rating/index.cjs +1 -1
  32. package/components/rating/index.js +1 -1
  33. package/components/select/index.cjs +1 -1
  34. package/components/select/index.js +1 -1
  35. package/components/slider/index.cjs +1 -1
  36. package/components/slider/index.js +1 -1
  37. package/components/slider/slider.d.ts +4 -4
  38. package/components/toast/index.cjs +1 -1
  39. package/components/toast/index.js +1 -1
  40. package/components/tree/index.cjs +1 -1
  41. package/components/tree/index.js +1 -1
  42. package/components/tree/tree.d.ts +0 -6
  43. package/config.cjs +2 -2
  44. package/config.d.ts +5 -0
  45. package/config.js +2 -2
  46. package/{dom-gfxqXJpK.js → dom-Bcg9ORcA.js} +64 -54
  47. package/{dom-CuBx1JPZ.cjs → dom-C2gi9OCP.cjs} +47 -37
  48. package/drawer-D5SO73ew.js +251 -0
  49. package/drawer-DP7UPojk.cjs +250 -0
  50. package/index.cjs +19 -13
  51. package/index.d.ts +1 -0
  52. package/index.js +36 -30
  53. package/isFocusable-Ckwus82R.js +32 -0
  54. package/isFocusable-DfzDLeAN.cjs +31 -0
  55. package/{modal-D3wGIDlj.js → modal-CAvQW-vo.js} +26 -32
  56. package/{modal-BEnQ6c5M.cjs → modal-DiXZXYjR.cjs} +27 -33
  57. package/package.json +1 -1
  58. package/{pagination-B97wBLok.js → pagination-BKbMROV6.js} +4 -4
  59. package/{pagination-C1TT-oea.cjs → pagination-DvZ2rLsz.cjs} +4 -4
  60. package/{progressbar-BWBlRk_Y.js → progressbar-D8zIcm9n.js} +2 -2
  61. package/{progressbar-CRvhNB5R.cjs → progressbar-i9xfAxb7.cjs} +2 -2
  62. package/{promise-XSP94FjG.js → promise-Y53vc4Ia.js} +5 -5
  63. package/{rating-BXvy9kXq.js → rating-DEXTGWCU.js} +2 -2
  64. package/{rating-DAb6nR67.cjs → rating-DmG4oUkr.cjs} +2 -2
  65. package/scrollbars-CT87iv_6.cjs +30 -0
  66. package/scrollbars-CcxSrnCx.js +31 -0
  67. package/{select-BdjpnE7_.js → select-Bw68Xdu5.js} +4 -5
  68. package/{select-C0rJJQfl.cjs → select-MFjAnIt7.cjs} +4 -5
  69. package/services/extendWidget.cjs +2 -2
  70. package/services/extendWidget.js +2 -2
  71. package/services/floatingUI.cjs +8 -29
  72. package/services/floatingUI.js +9 -30
  73. package/services/focusElement.cjs +46 -0
  74. package/services/focusElement.d.ts +9 -0
  75. package/services/focusElement.js +46 -0
  76. package/services/focustrack.cjs +1 -1
  77. package/services/focustrack.js +1 -1
  78. package/services/matchMedia.cjs +1 -1
  79. package/services/matchMedia.js +1 -1
  80. package/services/navManager.cjs +7 -37
  81. package/services/navManager.js +6 -36
  82. package/services/portal.cjs +7 -10
  83. package/services/portal.js +7 -10
  84. package/services/resizeObserver.cjs +2 -2
  85. package/services/resizeObserver.js +2 -2
  86. package/services/siblingsInert.cjs +9 -8
  87. package/services/siblingsInert.d.ts +13 -3
  88. package/services/siblingsInert.js +9 -8
  89. package/services/transitions/baseTransitions.cjs +9 -10
  90. package/services/transitions/baseTransitions.js +10 -11
  91. package/services/transitions/collapse.cjs +1 -1
  92. package/services/transitions/collapse.js +1 -1
  93. package/services/transitions/cssTransitions.cjs +1 -1
  94. package/services/transitions/cssTransitions.js +2 -2
  95. package/services/transitions/simpleClassTransition.cjs +1 -1
  96. package/services/transitions/simpleClassTransition.js +1 -1
  97. package/{slider-BmxQ3A_u.js → slider-Cx50Eghd.js} +14 -24
  98. package/{slider-DSx5CAce.cjs → slider-Dl4Trh32.cjs} +14 -24
  99. package/toaster-UDglac7x.cjs +187 -0
  100. package/toaster-_p1GTtHI.js +188 -0
  101. package/{tree-BFrXdJox.js → tree-DV0tfPlZ.js} +7 -11
  102. package/{tree-Pvr2rZ-D.cjs → tree-rGHtmCnS.cjs} +7 -11
  103. package/utils/directive.cjs +3 -1
  104. package/utils/directive.d.ts +47 -0
  105. package/utils/directive.js +14 -12
  106. package/utils/stores.cjs +8 -9
  107. package/utils/stores.js +8 -9
  108. package/utils/writables.cjs +1 -1
  109. package/utils/writables.js +1 -1
  110. package/{writables-Bn3uhKEG.cjs → writables-DcGT98a7.cjs} +1 -1
  111. package/{writables-CgpOQ4hA.js → writables-e0tyaQpe.js} +1 -1
  112. package/toaster-Cayg6Lbq.cjs +0 -209
  113. package/toaster-XfzHDqz_.js +0 -210
@@ -1,210 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __typeError = (msg) => {
3
- throw TypeError(msg);
4
- };
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
- var __privateWrapper = (obj, member, setter, getter) => ({
12
- set _(value) {
13
- __privateSet(obj, member, value, setter);
14
- },
15
- get _() {
16
- return __privateGet(obj, member, getter);
17
- }
18
- });
19
- var _idCount, _toasts, _timers;
20
- import { computed, readable, writable } from "@amadeus-it-group/tansu";
21
- import { extendWidgetProps } from "./services/extendWidget.js";
22
- import { n as createAttributesDirective, d as directiveSubscribe } from "./dom-gfxqXJpK.js";
23
- import { true$ } from "./utils/stores.js";
24
- import { b as typeNumberInRangeFactory, c as typeBoolean } from "./writables-CgpOQ4hA.js";
25
- import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-BqUjUBPy.js";
26
- import { createWidgetFactory } from "./utils/widget.js";
27
- const toastDefaultConfig = {
28
- autoHide: true,
29
- delay: 5e3
30
- };
31
- const toastConfigValidator = {
32
- autoHide: typeBoolean,
33
- delay: typeNumberInRangeFactory(0, Infinity, { strict: true })
34
- };
35
- function getToastDefaultConfig() {
36
- return { ...getCommonAlertDefaultConfig(), ...toastDefaultConfig };
37
- }
38
- const createToast = createWidgetFactory("toast", (config) => {
39
- let _timeout;
40
- const extendedAlert = extendWidgetProps(
41
- createCommonAlert,
42
- toastDefaultConfig,
43
- toastConfigValidator
44
- )(config);
45
- const time$ = computed(() => {
46
- clearTimeout(_timeout);
47
- if (extendedAlert.stores.autoHide$()) {
48
- _timeout = setTimeout(() => extendedAlert.api.close(), extendedAlert.stores.delay$());
49
- }
50
- });
51
- const bodyDirective = createAttributesDirective(() => ({
52
- attributes: {
53
- role: readable("alert"),
54
- "aria-atomic": readable("true"),
55
- class: computed(() => extendedAlert.stores.className$())
56
- },
57
- classNames: {
58
- "au-toast": true$,
59
- toast: true$
60
- }
61
- }));
62
- const closeButtonDirective = createAttributesDirective(() => ({
63
- attributes: {
64
- type: readable("button"),
65
- "aria-label": computed(() => extendedAlert.stores.ariaCloseButtonLabel$())
66
- },
67
- events: {
68
- click: extendedAlert.api.close
69
- }
70
- }));
71
- return {
72
- ...extendedAlert,
73
- directives: {
74
- ...extendedAlert.directives,
75
- autoHideDirective: directiveSubscribe(time$),
76
- bodyDirective,
77
- closeButtonDirective
78
- }
79
- };
80
- });
81
- const defaultToasterProps = {
82
- duration: 5e3,
83
- position: "bottomRight",
84
- dismissible: false
85
- };
86
- class Toaster {
87
- constructor(props) {
88
- __privateAdd(this, _idCount, 0);
89
- __privateAdd(this, _toasts, writable([]));
90
- /**
91
- * Get the toasts value from the store
92
- * @returns The array of toasts.
93
- */
94
- __publicField(this, "toasts", computed(
95
- () => __privateGet(this, _toasts).call(this).sort((a, b) => b.id - a.id).slice(0, this.options().limit)
96
- ));
97
- __publicField(this, "options", writable(defaultToasterProps));
98
- __privateAdd(this, _timers, /* @__PURE__ */ new Map());
99
- /**
100
- * Add timer for a toast
101
- * @param id Id of the toast
102
- * @param duration Duration of the timer, by default taken from options
103
- */
104
- __publicField(this, "addTimer", (id, duration = this.options().duration) => {
105
- if (duration > 0) {
106
- __privateGet(this, _timers).set(id, {
107
- timeout: setTimeout(() => this.removeToast(id), duration),
108
- started: performance.now(),
109
- duration
110
- });
111
- }
112
- });
113
- /**
114
- * Pause a timer for a toast
115
- * @param id Id of the toast
116
- */
117
- __publicField(this, "pauseTimer", (id) => {
118
- if (__privateGet(this, _timers).has(id)) {
119
- const timer = __privateGet(this, _timers).get(id);
120
- if (timer && timer.timeout) {
121
- clearTimeout(timer.timeout);
122
- timer.timeout = null;
123
- timer.paused = performance.now();
124
- }
125
- }
126
- });
127
- /**
128
- * Resume a timer for a toast
129
- * @param id Id of the toast
130
- */
131
- __publicField(this, "resumeTimer", (id) => {
132
- if (__privateGet(this, _timers).has(id)) {
133
- const timer = __privateGet(this, _timers).get(id);
134
- if (timer) {
135
- const paused = timer.paused ?? timer.started;
136
- const elapsed = paused - timer.started;
137
- const remaining = (timer.duration ?? 0) - elapsed;
138
- this.addTimer(id, remaining);
139
- timer.duration = remaining;
140
- timer.paused = void 0;
141
- }
142
- }
143
- });
144
- /**
145
- * Events directive is used to set events on the Toast component, to keep track for example of pointer enter/leave,
146
- * used to pause / resume the timer in case of duration and pauseOnHover are specified.
147
- */
148
- __publicField(this, "eventsDirective", createAttributesDirective((id) => ({
149
- events: {
150
- pointerenter: () => this.options().pauseOnHover && this.pauseTimer(id()),
151
- pointerleave: () => this.options().pauseOnHover && this.resumeTimer(id())
152
- }
153
- })));
154
- /**
155
- * Helper to add a toast to the viewport.
156
- * @param props Options for the toast.
157
- * @returns The ID of the added toast.
158
- */
159
- __publicField(this, "addToast", (props) => {
160
- const autoHide = props.autoHide ?? this.options().duration > 0;
161
- __privateGet(this, _toasts).update((toasts) => [...toasts, { id: __privateWrapper(this, _idCount)._++, props }]);
162
- if (autoHide) {
163
- this.addTimer(__privateGet(this, _idCount) - 1, props.delay);
164
- }
165
- return __privateGet(this, _idCount) - 1;
166
- });
167
- /**
168
- * Helper to remove a toast to the viewport.
169
- * @param id Id of the toast to remove.
170
- */
171
- __publicField(this, "removeToast", (id) => {
172
- __privateGet(this, _timers).delete(id);
173
- __privateGet(this, _toasts).update((toasts) => toasts.filter((toast) => toast.id !== id));
174
- });
175
- /** Helper to update toasts when options change */
176
- __publicField(this, "updateToasts", () => {
177
- if (this.options().duration === 0) {
178
- this.options().dismissible = true;
179
- }
180
- });
181
- /** Helper to close all toasts at once */
182
- __publicField(this, "closeAll", () => {
183
- __privateGet(this, _toasts).set([]);
184
- __privateGet(this, _timers).clear();
185
- });
186
- this.options.set({
187
- ...defaultToasterProps,
188
- ...props
189
- });
190
- this.options.subscribe(() => {
191
- this.updateToasts();
192
- });
193
- }
194
- /**
195
- * Get the timers value from the store
196
- * @returns The map of timers.
197
- */
198
- get timers() {
199
- return new Map(__privateGet(this, _timers));
200
- }
201
- }
202
- _idCount = new WeakMap();
203
- _toasts = new WeakMap();
204
- _timers = new WeakMap();
205
- export {
206
- Toaster as T,
207
- createToast as c,
208
- defaultToasterProps as d,
209
- getToastDefaultConfig as g
210
- };