@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.
- package/{accordion-cR5JqWJ8.cjs → accordion-B5LiN1uy.cjs} +15 -20
- package/{accordion-CoM4efp-.js → accordion-_zen-g8l.js} +15 -20
- package/{alert-DtDozJal.cjs → alert-B-jQDQcB.cjs} +1 -1
- package/{alert-YIlqdEPO.js → alert-gGz2CDS9.js} +1 -1
- package/{collapse-DwXz2kNw.js → collapse-BV4kD3j9.js} +2 -2
- package/{collapse-DRp53EuG.cjs → collapse-gLiT080Y.cjs} +2 -2
- package/{common-BToNPUDq.cjs → common-D3QcdJ6S.cjs} +1 -1
- package/{common-BqUjUBPy.js → common-DK0ADNTX.js} +1 -1
- package/components/accordion/accordion.d.ts +6 -6
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/carousel/carousel.d.ts +15 -0
- package/components/carousel/index.cjs +10 -23
- package/components/carousel/index.js +10 -23
- package/components/collapse/collapse.d.ts +5 -2
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.js +1 -1
- package/components/drawer/drawer.d.ts +242 -0
- package/components/drawer/index.cjs +5 -0
- package/components/drawer/index.d.ts +1 -0
- package/components/drawer/index.js +5 -0
- package/components/modal/index.cjs +2 -1
- package/components/modal/index.js +2 -1
- package/components/modal/modal.d.ts +5 -0
- package/components/pagination/index.cjs +1 -1
- package/components/pagination/index.js +1 -1
- package/components/progressbar/index.cjs +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/rating/index.cjs +1 -1
- package/components/rating/index.js +1 -1
- package/components/select/index.cjs +1 -1
- package/components/select/index.js +1 -1
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider.d.ts +4 -4
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +1 -1
- package/components/tree/index.cjs +1 -1
- package/components/tree/index.js +1 -1
- package/components/tree/tree.d.ts +0 -6
- package/config.cjs +2 -2
- package/config.d.ts +5 -0
- package/config.js +2 -2
- package/{dom-gfxqXJpK.js → dom-Bcg9ORcA.js} +64 -54
- package/{dom-CuBx1JPZ.cjs → dom-C2gi9OCP.cjs} +47 -37
- package/drawer-D5SO73ew.js +251 -0
- package/drawer-DP7UPojk.cjs +250 -0
- package/index.cjs +19 -13
- package/index.d.ts +1 -0
- package/index.js +36 -30
- package/isFocusable-Ckwus82R.js +32 -0
- package/isFocusable-DfzDLeAN.cjs +31 -0
- package/{modal-D3wGIDlj.js → modal-CAvQW-vo.js} +26 -32
- package/{modal-BEnQ6c5M.cjs → modal-DiXZXYjR.cjs} +27 -33
- package/package.json +1 -1
- package/{pagination-B97wBLok.js → pagination-BKbMROV6.js} +4 -4
- package/{pagination-C1TT-oea.cjs → pagination-DvZ2rLsz.cjs} +4 -4
- package/{progressbar-BWBlRk_Y.js → progressbar-D8zIcm9n.js} +2 -2
- package/{progressbar-CRvhNB5R.cjs → progressbar-i9xfAxb7.cjs} +2 -2
- package/{promise-XSP94FjG.js → promise-Y53vc4Ia.js} +5 -5
- package/{rating-BXvy9kXq.js → rating-DEXTGWCU.js} +2 -2
- package/{rating-DAb6nR67.cjs → rating-DmG4oUkr.cjs} +2 -2
- package/scrollbars-CT87iv_6.cjs +30 -0
- package/scrollbars-CcxSrnCx.js +31 -0
- package/{select-BdjpnE7_.js → select-Bw68Xdu5.js} +4 -5
- package/{select-C0rJJQfl.cjs → select-MFjAnIt7.cjs} +4 -5
- package/services/extendWidget.cjs +2 -2
- package/services/extendWidget.js +2 -2
- package/services/floatingUI.cjs +8 -29
- package/services/floatingUI.js +9 -30
- package/services/focusElement.cjs +46 -0
- package/services/focusElement.d.ts +9 -0
- package/services/focusElement.js +46 -0
- package/services/focustrack.cjs +1 -1
- package/services/focustrack.js +1 -1
- package/services/matchMedia.cjs +1 -1
- package/services/matchMedia.js +1 -1
- package/services/navManager.cjs +7 -37
- package/services/navManager.js +6 -36
- package/services/portal.cjs +7 -10
- package/services/portal.js +7 -10
- package/services/resizeObserver.cjs +2 -2
- package/services/resizeObserver.js +2 -2
- package/services/siblingsInert.cjs +9 -8
- package/services/siblingsInert.d.ts +13 -3
- package/services/siblingsInert.js +9 -8
- package/services/transitions/baseTransitions.cjs +9 -10
- package/services/transitions/baseTransitions.js +10 -11
- package/services/transitions/collapse.cjs +1 -1
- package/services/transitions/collapse.js +1 -1
- package/services/transitions/cssTransitions.cjs +1 -1
- package/services/transitions/cssTransitions.js +2 -2
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-BmxQ3A_u.js → slider-Cx50Eghd.js} +14 -24
- package/{slider-DSx5CAce.cjs → slider-Dl4Trh32.cjs} +14 -24
- package/toaster-UDglac7x.cjs +187 -0
- package/toaster-_p1GTtHI.js +188 -0
- package/{tree-BFrXdJox.js → tree-DV0tfPlZ.js} +7 -11
- package/{tree-Pvr2rZ-D.cjs → tree-rGHtmCnS.cjs} +7 -11
- package/utils/directive.cjs +3 -1
- package/utils/directive.d.ts +47 -0
- package/utils/directive.js +14 -12
- package/utils/stores.cjs +8 -9
- package/utils/stores.js +8 -9
- package/utils/writables.cjs +1 -1
- package/utils/writables.js +1 -1
- package/{writables-Bn3uhKEG.cjs → writables-DcGT98a7.cjs} +1 -1
- package/{writables-CgpOQ4hA.js → writables-e0tyaQpe.js} +1 -1
- package/toaster-Cayg6Lbq.cjs +0 -209
- package/toaster-XfzHDqz_.js +0 -210
package/toaster-XfzHDqz_.js
DELETED
|
@@ -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
|
-
};
|