@agnos-ui/core 0.8.0-next.1 → 0.8.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/{accordion-OTiJtxDi.js → accordion-BLVIYePx.js} +1 -1
- package/{accordion-DTQj-TQ1.cjs → accordion-vfnqMstG.cjs} +1 -1
- package/{alert-DH-mO6WX.js → alert-BpepSIHu.js} +1 -1
- package/{alert-BrVkxOnA.cjs → alert-D6W48Ffr.cjs} +1 -1
- package/{common-CcQOJ_hf.cjs → common-BToNPUDq.cjs} +1 -1
- package/{common-Bffx1jJO.js → common-BqUjUBPy.js} +1 -1
- 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 +232 -0
- package/components/carousel/index.cjs +288 -0
- package/components/carousel/index.d.ts +1 -0
- package/components/carousel/index.js +288 -0
- package/components/modal/index.cjs +1 -1
- package/components/modal/index.js +1 -1
- 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/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/toast/index.cjs +5 -3
- package/components/toast/index.d.ts +1 -0
- package/components/toast/index.js +3 -1
- package/components/toast/toaster.d.ts +128 -0
- package/components/tree/index.cjs +1 -1
- package/components/tree/index.js +1 -1
- package/config.d.ts +5 -0
- package/index.cjs +15 -12
- package/index.js +20 -17
- package/{modal-85Sw8xuV.js → modal-CGK3h9pR.js} +1 -1
- package/{modal-B7bYoubx.cjs → modal-Dw1MuWPV.cjs} +1 -1
- package/package.json +4 -1
- package/{pagination-5YARuB3V.cjs → pagination-BzyKulaI.cjs} +1 -1
- package/{pagination-4g3N8ktf.js → pagination-CRAKaOuh.js} +1 -1
- package/{progressbar-BoJsBPH1.js → progressbar-Csnqx_Pk.js} +1 -1
- package/{progressbar-BpSrg4HG.cjs → progressbar-D9rvrxXi.cjs} +1 -1
- package/{rating-C8tn9xTO.cjs → rating-C4c8Paz-.cjs} +1 -1
- package/{rating-B3xktzOf.js → rating-CvTnNxgN.js} +1 -1
- package/services/transitions/baseTransitions.cjs +1 -1
- package/services/transitions/baseTransitions.js +1 -1
- package/{slider-B2JFXDLt.cjs → slider-B0ZfAY0K.cjs} +200 -97
- package/{slider-Cs69pziL.js → slider-BF6a0eh_.js} +201 -98
- package/toaster-B2ibv38T.cjs +208 -0
- package/toaster-PwfLC7FH.js +209 -0
- package/{tree-C_goOyCv.js → tree-DUU_TWqy.js} +1 -1
- package/{tree-D4t2SOql.cjs → tree-Dwv2U0ea.cjs} +1 -1
- package/utils/writables.cjs +2 -1
- package/utils/writables.d.ts +7 -0
- package/utils/writables.js +7 -6
- package/{writables-BPAJvaL_.cjs → writables-Bn3uhKEG.cjs} +4 -0
- package/{writables-DCiBdIBK.js → writables-CgpOQ4hA.js} +10 -6
- package/toast-4HGIz3Bu.js +0 -64
- package/toast-CaIcB2sD.cjs +0 -63
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { writablesForProps, stateStores, true$ } from "../../utils/stores.js";
|
|
2
|
+
import { a as bindDirective, b as browserDirective, n as createAttributesDirective, k as mergeDirectives } from "../../dom-gfxqXJpK.js";
|
|
3
|
+
import EmblaCarousel from "embla-carousel";
|
|
4
|
+
import { writable, computed, asReadable, readable } from "@amadeus-it-group/tansu";
|
|
5
|
+
import { g as typeFunction, e as typeString, c as typeBoolean, a as typeNumber, j as createTypeEnum, f as typeStringOrNull, i as typeArray } from "../../writables-CgpOQ4hA.js";
|
|
6
|
+
import { createNavManager } from "../../services/navManager.js";
|
|
7
|
+
const defaultConfig = {
|
|
8
|
+
align: "center",
|
|
9
|
+
container: null,
|
|
10
|
+
containScroll: "trimSnaps",
|
|
11
|
+
direction: "ltr",
|
|
12
|
+
dragFree: false,
|
|
13
|
+
dragThreshold: 10,
|
|
14
|
+
duration: 25,
|
|
15
|
+
loop: false,
|
|
16
|
+
skipSnaps: false,
|
|
17
|
+
plugins: [],
|
|
18
|
+
showNavigationArrows: true,
|
|
19
|
+
showNavigationIndicators: true,
|
|
20
|
+
ariaPrevLabel: "Select previous slide",
|
|
21
|
+
ariaNextLabel: "Select next slide",
|
|
22
|
+
ariaIndicatorLabel: (index) => `Select slide ${index + 1}`
|
|
23
|
+
};
|
|
24
|
+
function getCarouselDefaultConfig() {
|
|
25
|
+
return { ...defaultConfig };
|
|
26
|
+
}
|
|
27
|
+
const configValidator = {
|
|
28
|
+
dragFree: typeBoolean,
|
|
29
|
+
plugins: typeArray,
|
|
30
|
+
align: createTypeEnum(["start", "center", "end"]),
|
|
31
|
+
container: typeStringOrNull,
|
|
32
|
+
containScroll: createTypeEnum([false, "trimSnaps", "keepSnaps"]),
|
|
33
|
+
direction: createTypeEnum(["ltr", "rtl"]),
|
|
34
|
+
dragThreshold: typeNumber,
|
|
35
|
+
duration: typeNumber,
|
|
36
|
+
loop: typeBoolean,
|
|
37
|
+
skipSnaps: typeBoolean,
|
|
38
|
+
showNavigationArrows: typeBoolean,
|
|
39
|
+
showNavigationIndicators: typeBoolean,
|
|
40
|
+
ariaPrevLabel: typeString,
|
|
41
|
+
ariaNextLabel: typeString,
|
|
42
|
+
ariaIndicatorLabel: typeFunction
|
|
43
|
+
};
|
|
44
|
+
function createEmblaCarousel(options$, plugins$) {
|
|
45
|
+
let emblaApi;
|
|
46
|
+
const scrolling$ = writable(false);
|
|
47
|
+
const canScrollPrev$ = writable(false);
|
|
48
|
+
const canScrollNext$ = writable(true);
|
|
49
|
+
const selectedScrollSnap$ = writable(0);
|
|
50
|
+
const initialized$ = writable(false);
|
|
51
|
+
const slideNodes$ = writable([]);
|
|
52
|
+
const directiveArgs$ = computed(() => ({
|
|
53
|
+
options: options$(),
|
|
54
|
+
plugins: plugins$ ? plugins$() : []
|
|
55
|
+
}));
|
|
56
|
+
return {
|
|
57
|
+
directive: bindDirective(
|
|
58
|
+
browserDirective((element, { options, plugins }) => {
|
|
59
|
+
if (emblaApi) {
|
|
60
|
+
throw new Error("Only one Embla directive can be attached per carousel widget !");
|
|
61
|
+
}
|
|
62
|
+
emblaApi = EmblaCarousel(element, options, plugins);
|
|
63
|
+
emblaApi.on("scroll", () => {
|
|
64
|
+
scrolling$.set(true);
|
|
65
|
+
});
|
|
66
|
+
emblaApi.on("settle", () => {
|
|
67
|
+
scrolling$.set(false);
|
|
68
|
+
});
|
|
69
|
+
emblaApi.on("select", (api) => {
|
|
70
|
+
canScrollNext$.set(api.canScrollNext());
|
|
71
|
+
canScrollPrev$.set(api.canScrollPrev());
|
|
72
|
+
selectedScrollSnap$.set(api.selectedScrollSnap());
|
|
73
|
+
});
|
|
74
|
+
emblaApi.on("init", () => {
|
|
75
|
+
initialized$.set(true);
|
|
76
|
+
});
|
|
77
|
+
emblaApi.on("reInit", (api) => {
|
|
78
|
+
canScrollNext$.set(api.canScrollNext());
|
|
79
|
+
canScrollPrev$.set(api.canScrollPrev());
|
|
80
|
+
scrolling$.set(false);
|
|
81
|
+
selectedScrollSnap$.set(api.selectedScrollSnap());
|
|
82
|
+
});
|
|
83
|
+
emblaApi.on("slidesChanged", (api) => {
|
|
84
|
+
slideNodes$.set(api.slideNodes());
|
|
85
|
+
});
|
|
86
|
+
canScrollNext$.set(emblaApi.canScrollNext());
|
|
87
|
+
canScrollPrev$.set(emblaApi.canScrollPrev());
|
|
88
|
+
slideNodes$.set(emblaApi.slideNodes());
|
|
89
|
+
return {
|
|
90
|
+
update: ({ options: options2, plugins: plugins2 }) => {
|
|
91
|
+
emblaApi.reInit(options2, plugins2);
|
|
92
|
+
},
|
|
93
|
+
destroy: () => {
|
|
94
|
+
emblaApi == null ? void 0 : emblaApi.destroy();
|
|
95
|
+
emblaApi = void 0;
|
|
96
|
+
initialized$.set(false);
|
|
97
|
+
scrolling$.set(false);
|
|
98
|
+
canScrollPrev$.set(false);
|
|
99
|
+
canScrollNext$.set(true);
|
|
100
|
+
selectedScrollSnap$.set(0);
|
|
101
|
+
slideNodes$.set([]);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}),
|
|
105
|
+
directiveArgs$
|
|
106
|
+
),
|
|
107
|
+
stores: {
|
|
108
|
+
scrolling$: asReadable(scrolling$),
|
|
109
|
+
canScrollPrev$: asReadable(canScrollPrev$),
|
|
110
|
+
canScrollNext$: asReadable(canScrollNext$),
|
|
111
|
+
selectedScrollSnap$: asReadable(selectedScrollSnap$),
|
|
112
|
+
initialized$: asReadable(initialized$),
|
|
113
|
+
slideNodes$: asReadable(slideNodes$)
|
|
114
|
+
},
|
|
115
|
+
get api() {
|
|
116
|
+
return emblaApi;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function createCarousel(config) {
|
|
121
|
+
const [
|
|
122
|
+
{
|
|
123
|
+
align$,
|
|
124
|
+
container$,
|
|
125
|
+
containScroll$,
|
|
126
|
+
direction$,
|
|
127
|
+
dragFree$,
|
|
128
|
+
dragThreshold$,
|
|
129
|
+
duration$,
|
|
130
|
+
loop$,
|
|
131
|
+
skipSnaps$,
|
|
132
|
+
plugins$,
|
|
133
|
+
ariaPrevLabel$,
|
|
134
|
+
ariaNextLabel$,
|
|
135
|
+
ariaIndicatorLabel$,
|
|
136
|
+
showNavigationIndicators$,
|
|
137
|
+
...stateProps
|
|
138
|
+
},
|
|
139
|
+
patch
|
|
140
|
+
] = writablesForProps(defaultConfig, config, configValidator);
|
|
141
|
+
const emblaOptions$ = computed(() => ({
|
|
142
|
+
align: align$(),
|
|
143
|
+
container: container$(),
|
|
144
|
+
containScroll: containScroll$(),
|
|
145
|
+
direction: direction$(),
|
|
146
|
+
dragFree: dragFree$(),
|
|
147
|
+
dragThreshold: dragThreshold$(),
|
|
148
|
+
duration: duration$(),
|
|
149
|
+
loop: loop$(),
|
|
150
|
+
skipSnaps: skipSnaps$()
|
|
151
|
+
}));
|
|
152
|
+
const emblaCarousel = createEmblaCarousel(emblaOptions$, plugins$);
|
|
153
|
+
const {
|
|
154
|
+
stores: { slideNodes$, ...emblaStores }
|
|
155
|
+
} = emblaCarousel;
|
|
156
|
+
const { directive: navDirective, refreshElements, focusPrevious, focusNext, focusFirst, focusLast } = createNavManager();
|
|
157
|
+
const navManagerConfig = {
|
|
158
|
+
keys: {
|
|
159
|
+
ArrowLeft: focusPrevious,
|
|
160
|
+
ArrowRight: focusNext,
|
|
161
|
+
Home: focusFirst,
|
|
162
|
+
End: focusLast
|
|
163
|
+
},
|
|
164
|
+
selector: (node) => node.querySelectorAll("[role='tab']")
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
...stateStores({
|
|
168
|
+
...emblaStores,
|
|
169
|
+
...stateProps,
|
|
170
|
+
direction$,
|
|
171
|
+
showNavigationIndicators$
|
|
172
|
+
}),
|
|
173
|
+
patch,
|
|
174
|
+
api: {
|
|
175
|
+
scrollPrev: (jump) => {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
(_b = (_a = emblaCarousel.api) == null ? void 0 : _a.scrollPrev) == null ? void 0 : _b.call(_a, jump);
|
|
178
|
+
},
|
|
179
|
+
scrollNext: (jump) => {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
(_b = (_a = emblaCarousel.api) == null ? void 0 : _a.scrollNext) == null ? void 0 : _b.call(_a, jump);
|
|
182
|
+
},
|
|
183
|
+
scrollTo: (index, jump) => {
|
|
184
|
+
var _a, _b;
|
|
185
|
+
(_b = (_a = emblaCarousel.api) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, index, jump);
|
|
186
|
+
},
|
|
187
|
+
plugins: () => {
|
|
188
|
+
var _a, _b;
|
|
189
|
+
return (_b = (_a = emblaCarousel.api) == null ? void 0 : _a.plugins) == null ? void 0 : _b.call(_a);
|
|
190
|
+
},
|
|
191
|
+
emblaApi: () => emblaCarousel.api
|
|
192
|
+
},
|
|
193
|
+
directives: {
|
|
194
|
+
root: mergeDirectives(
|
|
195
|
+
emblaCarousel.directive,
|
|
196
|
+
createAttributesDirective(() => ({
|
|
197
|
+
classNames: {
|
|
198
|
+
"au-carousel": true$
|
|
199
|
+
},
|
|
200
|
+
attributes: {
|
|
201
|
+
role: readable("region"),
|
|
202
|
+
"aria-roledescription": readable("carousel"),
|
|
203
|
+
dir: direction$
|
|
204
|
+
}
|
|
205
|
+
}))
|
|
206
|
+
),
|
|
207
|
+
scrollPrev: createAttributesDirective(() => ({
|
|
208
|
+
attributes: {
|
|
209
|
+
"aria-label": ariaPrevLabel$,
|
|
210
|
+
disabled: computed(() => !emblaCarousel.stores.canScrollPrev$() || void 0)
|
|
211
|
+
},
|
|
212
|
+
events: {
|
|
213
|
+
click: () => {
|
|
214
|
+
var _a;
|
|
215
|
+
return (_a = emblaCarousel.api) == null ? void 0 : _a.scrollPrev();
|
|
216
|
+
},
|
|
217
|
+
pointerdown: (event) => event.preventDefault(),
|
|
218
|
+
touchstart: (event) => event.stopPropagation()
|
|
219
|
+
}
|
|
220
|
+
})),
|
|
221
|
+
scrollNext: createAttributesDirective(() => ({
|
|
222
|
+
attributes: {
|
|
223
|
+
"aria-label": ariaNextLabel$,
|
|
224
|
+
disabled: computed(() => !emblaCarousel.stores.canScrollNext$() || void 0)
|
|
225
|
+
},
|
|
226
|
+
events: {
|
|
227
|
+
click: () => {
|
|
228
|
+
var _a;
|
|
229
|
+
return (_a = emblaCarousel.api) == null ? void 0 : _a.scrollNext();
|
|
230
|
+
},
|
|
231
|
+
pointerdown: (event) => event.preventDefault(),
|
|
232
|
+
touchstart: (event) => event.stopPropagation()
|
|
233
|
+
}
|
|
234
|
+
})),
|
|
235
|
+
tabList: mergeDirectives(
|
|
236
|
+
bindDirective(navDirective, readable(navManagerConfig)),
|
|
237
|
+
browserDirective(() => {
|
|
238
|
+
const unsubscribe = slideNodes$.subscribe(() => {
|
|
239
|
+
refreshElements();
|
|
240
|
+
});
|
|
241
|
+
return {
|
|
242
|
+
destroy: unsubscribe
|
|
243
|
+
};
|
|
244
|
+
}),
|
|
245
|
+
createAttributesDirective(() => ({
|
|
246
|
+
attributes: {
|
|
247
|
+
role: readable("tablist")
|
|
248
|
+
}
|
|
249
|
+
}))
|
|
250
|
+
),
|
|
251
|
+
tabIndicator: createAttributesDirective((slide$) => ({
|
|
252
|
+
events: {
|
|
253
|
+
click: () => {
|
|
254
|
+
var _a;
|
|
255
|
+
(_a = emblaCarousel.api) == null ? void 0 : _a.scrollTo(slide$().index, slide$().jump ?? true);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
attributes: {
|
|
259
|
+
"aria-label": computed(() => ariaIndicatorLabel$()(slide$().index)),
|
|
260
|
+
"aria-selected": computed(() => slide$().index === emblaCarousel.stores.selectedScrollSnap$() ? "true" : void 0),
|
|
261
|
+
"aria-controls": computed(() => slide$().id),
|
|
262
|
+
role: readable("tab"),
|
|
263
|
+
tabindex: computed(() => slide$().index === emblaCarousel.stores.selectedScrollSnap$() ? "0" : "-1")
|
|
264
|
+
}
|
|
265
|
+
})),
|
|
266
|
+
slide: createAttributesDirective((slide$) => {
|
|
267
|
+
const selected$ = computed(() => slide$().index === emblaCarousel.stores.selectedScrollSnap$());
|
|
268
|
+
return {
|
|
269
|
+
attributes: {
|
|
270
|
+
id: computed(() => slide$().id),
|
|
271
|
+
"aria-hidden": computed(() => selected$() ? void 0 : "true"),
|
|
272
|
+
role: computed(() => showNavigationIndicators$() ? "tabpanel" : "group"),
|
|
273
|
+
"aria-roledescription": computed(() => showNavigationIndicators$() ? void 0 : "slide"),
|
|
274
|
+
tabindex: computed(() => showNavigationIndicators$() && selected$() ? "0" : void 0)
|
|
275
|
+
},
|
|
276
|
+
classNames: {
|
|
277
|
+
"au-carousel-slide": true$
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
})
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
export {
|
|
285
|
+
createCarousel,
|
|
286
|
+
createEmblaCarousel,
|
|
287
|
+
getCarouselDefaultConfig
|
|
288
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const modal = require("../../modal-
|
|
3
|
+
const modal = require("../../modal-Dw1MuWPV.cjs");
|
|
4
4
|
exports.createModal = modal.createModal;
|
|
5
5
|
exports.getModalDefaultConfig = modal.getModalDefaultConfig;
|
|
6
6
|
exports.modalCloseButtonClick = modal.modalCloseButtonClick;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const pagination = require("../../pagination-
|
|
3
|
+
const pagination = require("../../pagination-BzyKulaI.cjs");
|
|
4
4
|
exports.createPagination = pagination.createPagination;
|
|
5
5
|
exports.getPaginationDefaultConfig = pagination.getPaginationDefaultConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const progressbar = require("../../progressbar-
|
|
3
|
+
const progressbar = require("../../progressbar-D9rvrxXi.cjs");
|
|
4
4
|
exports.createProgressbar = progressbar.createProgressbar;
|
|
5
5
|
exports.getProgressbarDefaultConfig = progressbar.getProgressbarDefaultConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const rating = require("../../rating-
|
|
3
|
+
const rating = require("../../rating-C4c8Paz-.cjs");
|
|
4
4
|
exports.createRating = rating.createRating;
|
|
5
5
|
exports.getRatingDefaultConfig = rating.getRatingDefaultConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const slider = require("../../slider-
|
|
3
|
+
const slider = require("../../slider-B0ZfAY0K.cjs");
|
|
4
4
|
exports.createSlider = slider.createSlider;
|
|
5
5
|
exports.getSliderDefaultConfig = slider.getSliderDefaultConfig;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
3
|
+
const toaster = require("../../toaster-B2ibv38T.cjs");
|
|
4
|
+
exports.Toaster = toaster.Toaster;
|
|
5
|
+
exports.createToast = toaster.createToast;
|
|
6
|
+
exports.defaultToasterProps = toaster.defaultToasterProps;
|
|
7
|
+
exports.getToastDefaultConfig = toaster.getToastDefaultConfig;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { type ToastProps } from './toast';
|
|
2
|
+
import type { Directive } from '../../types';
|
|
3
|
+
import type { ReadableSignal, WritableSignal } from '@amadeus-it-group/tansu';
|
|
4
|
+
/**
|
|
5
|
+
* Represents the possible positions for displaying a toast notification.
|
|
6
|
+
*
|
|
7
|
+
* The positions are defined based on a grid layout with three horizontal
|
|
8
|
+
* alignments (left, center, right) and three vertical alignments (top, middle, bottom).
|
|
9
|
+
*
|
|
10
|
+
* Available positions:
|
|
11
|
+
* - `topLeft`: Top-left corner of the screen.
|
|
12
|
+
* - `topCenter`: Top-center of the screen.
|
|
13
|
+
* - `topRight`: Top-right corner of the screen.
|
|
14
|
+
* - `middleLeft`: Middle-left side of the screen.
|
|
15
|
+
* - `middleCenter`: Center of the screen.
|
|
16
|
+
* - `middleRight`: Middle-right side of the screen.
|
|
17
|
+
* - `bottomLeft`: Bottom-left corner of the screen.
|
|
18
|
+
* - `bottomCenter`: Bottom-center of the screen.
|
|
19
|
+
* - `bottomRight`: Bottom-right corner of the screen.
|
|
20
|
+
*/
|
|
21
|
+
export type ToastPositions = 'topLeft' | 'topCenter' | 'topRight' | 'middleLeft' | 'middleCenter' | 'middleRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
22
|
+
/**
|
|
23
|
+
* Props of the toaster
|
|
24
|
+
*/
|
|
25
|
+
export interface ToasterProps {
|
|
26
|
+
/** How much time (ms) a toast is displayed; 0 means it won't be removed until a manual action */
|
|
27
|
+
duration: number;
|
|
28
|
+
/** Where to position the toasts */
|
|
29
|
+
position: ToastPositions;
|
|
30
|
+
/** Maximum number of toasts displayed */
|
|
31
|
+
limit?: number;
|
|
32
|
+
/** Pause toast when hover */
|
|
33
|
+
pauseOnHover?: boolean;
|
|
34
|
+
/** Display a dismiss button on each toast. When duration = 0, this is enforced to true */
|
|
35
|
+
dismissible: boolean;
|
|
36
|
+
/** Add a button to close all the toasts at once */
|
|
37
|
+
closeAll?: boolean;
|
|
38
|
+
/** Close all label */
|
|
39
|
+
closeAllLabel?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Toast object
|
|
43
|
+
* @template Props Type of the toast properties.
|
|
44
|
+
*/
|
|
45
|
+
export interface ToasterToast<Props> {
|
|
46
|
+
/** Identifier of the toasts in the toaster */
|
|
47
|
+
id: number;
|
|
48
|
+
/** Properties of the toast */
|
|
49
|
+
props: Props;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Represents a timer used by the toaster service.
|
|
53
|
+
*/
|
|
54
|
+
export interface ToasterTimer {
|
|
55
|
+
/**
|
|
56
|
+
* The timeout identifier returned by `setTimeout`.
|
|
57
|
+
*/
|
|
58
|
+
timeout: ReturnType<typeof setTimeout> | null;
|
|
59
|
+
/**
|
|
60
|
+
* The timestamp when the timer was started.
|
|
61
|
+
*/
|
|
62
|
+
started: number;
|
|
63
|
+
/**
|
|
64
|
+
* The timestamp when the timer was paused (optional).
|
|
65
|
+
*/
|
|
66
|
+
paused?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The duration for which the timer is set (optional). Used internally to compute the remaining time.
|
|
69
|
+
*/
|
|
70
|
+
duration: number;
|
|
71
|
+
}
|
|
72
|
+
export declare const defaultToasterProps: ToasterProps;
|
|
73
|
+
/**
|
|
74
|
+
* Create a toaster provider with helpers and state.
|
|
75
|
+
* @param props Options for the toaster.
|
|
76
|
+
* @template Props Type of the toast properties.
|
|
77
|
+
*/
|
|
78
|
+
export declare class Toaster<Props extends Partial<ToastProps> = ToastProps> {
|
|
79
|
+
#private;
|
|
80
|
+
/**
|
|
81
|
+
* Get the toasts value from the store
|
|
82
|
+
* @returns The array of toasts.
|
|
83
|
+
*/
|
|
84
|
+
readonly toasts: ReadableSignal<ToasterToast<Props>[]>;
|
|
85
|
+
readonly options: WritableSignal<ToasterProps>;
|
|
86
|
+
/**
|
|
87
|
+
* Get the timers value from the store
|
|
88
|
+
* @returns The map of timers.
|
|
89
|
+
*/
|
|
90
|
+
get timers(): ReadonlyMap<number, ToasterTimer>;
|
|
91
|
+
constructor(props?: Partial<ToasterProps>);
|
|
92
|
+
/**
|
|
93
|
+
* Add timer for a toast
|
|
94
|
+
* @param id Id of the toast
|
|
95
|
+
* @param duration Duration of the timer, by default taken from options
|
|
96
|
+
*/
|
|
97
|
+
readonly addTimer: (id: number, duration?: number) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Pause a timer for a toast
|
|
100
|
+
* @param id Id of the toast
|
|
101
|
+
*/
|
|
102
|
+
readonly pauseTimer: (id: number) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Resume a timer for a toast
|
|
105
|
+
* @param id Id of the toast
|
|
106
|
+
*/
|
|
107
|
+
readonly resumeTimer: (id: number) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Events directive is used to set events on the Toast component, to keep track for example of pointer enter/leave,
|
|
110
|
+
* used to pause / resume the timer in case of duration and pauseOnHover are specified.
|
|
111
|
+
*/
|
|
112
|
+
readonly eventsDirective: Directive<number>;
|
|
113
|
+
/**
|
|
114
|
+
* Helper to add a toast to the viewport.
|
|
115
|
+
* @param props Options for the toast.
|
|
116
|
+
* @returns The ID of the added toast.
|
|
117
|
+
*/
|
|
118
|
+
readonly addToast: (props: Props) => number;
|
|
119
|
+
/**
|
|
120
|
+
* Helper to remove a toast to the viewport.
|
|
121
|
+
* @param id Id of the toast to remove.
|
|
122
|
+
*/
|
|
123
|
+
readonly removeToast: (id: number) => void;
|
|
124
|
+
/** Helper to update toasts when options change */
|
|
125
|
+
readonly updateToasts: () => void;
|
|
126
|
+
/** Helper to close all toasts at once */
|
|
127
|
+
readonly closeAll: () => void;
|
|
128
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const tree = require("../../tree-
|
|
3
|
+
const tree = require("../../tree-Dwv2U0ea.cjs");
|
|
4
4
|
exports.createTree = tree.createTree;
|
|
5
5
|
exports.getTreeDefaultConfig = tree.getTreeDefaultConfig;
|
package/components/tree/index.js
CHANGED
package/config.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { ProgressbarProps } from './components/progressbar/progressbar';
|
|
|
9
9
|
import type { SliderProps } from './components/slider/slider';
|
|
10
10
|
import type { ToastProps } from './components/toast/toast';
|
|
11
11
|
import type { TreeProps } from './components/tree/tree';
|
|
12
|
+
import type { CarouselProps } from './components/carousel';
|
|
12
13
|
/**
|
|
13
14
|
* A utility type that makes all properties of an object type `T` optional,
|
|
14
15
|
* and also makes all properties of the nested objects within `T` optional.
|
|
@@ -104,4 +105,8 @@ export type WidgetsConfig = {
|
|
|
104
105
|
* tree widget config
|
|
105
106
|
*/
|
|
106
107
|
tree: TreeProps;
|
|
108
|
+
/**
|
|
109
|
+
* carousel widget config
|
|
110
|
+
*/
|
|
111
|
+
carousel: CarouselProps;
|
|
107
112
|
};
|
package/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const types = require("./types.cjs");
|
|
4
|
-
const accordion = require("./accordion-
|
|
5
|
-
const alert = require("./alert-
|
|
6
|
-
const modal = require("./modal-
|
|
7
|
-
const pagination = require("./pagination-
|
|
8
|
-
const progressbar = require("./progressbar-
|
|
9
|
-
const rating = require("./rating-
|
|
4
|
+
const accordion = require("./accordion-vfnqMstG.cjs");
|
|
5
|
+
const alert = require("./alert-D6W48Ffr.cjs");
|
|
6
|
+
const modal = require("./modal-Dw1MuWPV.cjs");
|
|
7
|
+
const pagination = require("./pagination-BzyKulaI.cjs");
|
|
8
|
+
const progressbar = require("./progressbar-D9rvrxXi.cjs");
|
|
9
|
+
const rating = require("./rating-C4c8Paz-.cjs");
|
|
10
10
|
const select = require("./select-D1pBz4CM.cjs");
|
|
11
|
-
const slider = require("./slider-
|
|
12
|
-
const
|
|
13
|
-
const tree = require("./tree-
|
|
11
|
+
const slider = require("./slider-B0ZfAY0K.cjs");
|
|
12
|
+
const toaster = require("./toaster-B2ibv38T.cjs");
|
|
13
|
+
const tree = require("./tree-Dwv2U0ea.cjs");
|
|
14
14
|
const config = require("./config.cjs");
|
|
15
15
|
const services_extendWidget = require("./services/extendWidget.cjs");
|
|
16
16
|
const services_floatingUI = require("./services/floatingUI.cjs");
|
|
@@ -27,7 +27,7 @@ const services_transitions_cssTransitions = require("./services/transitions/cssT
|
|
|
27
27
|
const services_transitions_simpleClassTransition = require("./services/transitions/simpleClassTransition.cjs");
|
|
28
28
|
const utils_directive = require("./dom-CuBx1JPZ.cjs");
|
|
29
29
|
const utils_stores = require("./utils/stores.cjs");
|
|
30
|
-
const utils_writables = require("./writables-
|
|
30
|
+
const utils_writables = require("./writables-Bn3uhKEG.cjs");
|
|
31
31
|
exports.INVALID_VALUE = types.INVALID_VALUE;
|
|
32
32
|
exports.createAccordion = accordion.createAccordion;
|
|
33
33
|
exports.createAccordionItem = accordion.createAccordionItem;
|
|
@@ -49,8 +49,10 @@ exports.createSelect = select.createSelect;
|
|
|
49
49
|
exports.getSelectDefaultConfig = select.getSelectDefaultConfig;
|
|
50
50
|
exports.createSlider = slider.createSlider;
|
|
51
51
|
exports.getSliderDefaultConfig = slider.getSliderDefaultConfig;
|
|
52
|
-
exports.
|
|
53
|
-
exports.
|
|
52
|
+
exports.Toaster = toaster.Toaster;
|
|
53
|
+
exports.createToast = toaster.createToast;
|
|
54
|
+
exports.defaultToasterProps = toaster.defaultToasterProps;
|
|
55
|
+
exports.getToastDefaultConfig = toaster.getToastDefaultConfig;
|
|
54
56
|
exports.createTree = tree.createTree;
|
|
55
57
|
exports.getTreeDefaultConfig = tree.getTreeDefaultConfig;
|
|
56
58
|
exports.createWidgetsConfig = config.createWidgetsConfig;
|
|
@@ -119,3 +121,4 @@ exports.typeHTMLElementOrNull = utils_writables.typeHTMLElementOrNull;
|
|
|
119
121
|
exports.typeNumber = utils_writables.typeNumber;
|
|
120
122
|
exports.typeNumberInRangeFactory = utils_writables.typeNumberInRangeFactory;
|
|
121
123
|
exports.typeString = utils_writables.typeString;
|
|
124
|
+
exports.typeStringOrNull = utils_writables.typeStringOrNull;
|