@design-factory/core 21.1.0-next.1 → 22.0.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/{accordion-D9ba0XYq.js → accordion-B5RqDwi3.js} +76 -15
- package/alert-Db6cG6JE.js +125 -0
- package/{collapse-Bn8iHKrd.js → collapse-D8Jo56k9.js} +2 -2
- package/{common-DFyZvkII.js → common-CP4amR0Z.js} +2 -2
- package/components/accordion/accordion.d.ts +73 -15
- package/components/accordion/index.js +1 -1
- package/components/alert/alert.d.ts +77 -8
- package/components/alert/common.d.ts +9 -9
- package/components/alert/index.js +2 -3
- package/components/carousel/index.js +2 -2
- package/components/collapse/index.js +1 -1
- package/components/drawer/drawer.d.ts +6 -0
- package/components/drawer/index.js +1 -1
- package/components/dropdown/dropdown.d.ts +110 -0
- package/components/dropdown/index.d.ts +1 -0
- package/components/dropdown/index.js +5 -0
- package/components/modal/index.js +1 -1
- package/components/pagination/index.js +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/rating/index.js +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider.d.ts +23 -4
- package/components/toast/index.js +1 -1
- package/components/tooltip/index.d.ts +1 -0
- package/components/tooltip/index.js +174 -0
- package/components/tooltip/tooltip.d.ts +63 -0
- package/components/tree/index.js +1 -1
- package/{directive-CNNSo5Yn.js → directive-CMT2vEDg.js} +7 -4
- package/{drawer-BIIfJa0F.js → drawer-CpGnS2ln.js} +12 -5
- package/dropdown-Bjj2ql6d.js +246 -0
- package/index.d.ts +3 -1
- package/index.js +44 -37
- package/isFocusable-C2iRr0zh.js +72 -0
- package/{modal-C13G13jV.js → modal-CQWh2Sm5.js} +4 -4
- package/package.json +1 -1
- package/{pagination-BQWusWXN.js → pagination-DIRcpdRE.js} +2 -2
- package/{progressbar-S1pNn5rM.js → progressbar-Bth8r3Qu.js} +2 -2
- package/{promise-D-RZVPuv.js → promise-CkIc0KKt.js} +3 -3
- package/{rating-DWgGgwk3.js → rating-DLsgFSyB.js} +2 -2
- package/{scrollbars-CcxSrnCx.js → scrollbars-ChGk75QR.js} +3 -0
- package/services/extendWidget.d.ts +1 -1
- package/services/focusElement.js +2 -2
- package/services/focustrack.js +2 -2
- package/services/matchMedia.js +1 -1
- package/services/mousetrack.d.ts +34 -0
- package/services/mousetrack.js +41 -0
- package/services/navManager.js +2 -2
- package/services/pointerdownPosition.js +1 -1
- package/services/portal.js +1 -1
- package/services/positioning.d.ts +101 -0
- package/services/positioning.js +104 -0
- package/services/resizeObserver.js +1 -1
- package/services/siblingsInert.js +1 -1
- package/services/transitions/baseTransitions.js +3 -3
- package/services/transitions/collapse.js +4 -7
- package/services/transitions/cssTransitions.js +2 -2
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-Br_Qiopx.js → slider-b9cVFNAL.js} +96 -58
- package/{toaster-BUBzFeJM.js → toaster-BS9qeRLF.js} +3 -3
- package/{tree-vD7ZkV8Z.js → tree-DW6iLxdw.js} +2 -2
- package/types.d.ts +8 -1
- package/utils/debounceSignal.d.ts +11 -0
- package/utils/debounceSignal.js +18 -0
- package/utils/directive.js +1 -1
- package/utils/edgeState.d.ts +23 -0
- package/utils/edgeState.js +43 -0
- package/utils/internal/isFocusable.d.ts +40 -0
- package/utils/stores.d.ts +1 -1
- package/utils/stores.js +4 -1
- package/utils/writables.d.ts +27 -13
- package/utils/writables.js +12 -11
- package/{writables-DYGjj5T3.js → writables-_7BriMb2.js} +37 -12
- package/accordion-B0vs8JWM.cjs +0 -314
- package/alert-AhaliJ17.cjs +0 -9
- package/alert-Cb9FhbFQ.js +0 -10
- package/collapse-BnWw4Hnc.cjs +0 -94
- package/common-B5jS-Ih_.cjs +0 -73
- package/components/accordion/index.cjs +0 -7
- package/components/alert/index.cjs +0 -5
- package/components/carousel/index.cjs +0 -292
- package/components/collapse/index.cjs +0 -5
- package/components/drawer/index.cjs +0 -5
- package/components/modal/index.cjs +0 -8
- package/components/pagination/index.cjs +0 -5
- package/components/progressbar/index.cjs +0 -5
- package/components/rating/index.cjs +0 -5
- package/components/slider/index.cjs +0 -5
- package/components/toast/index.cjs +0 -7
- package/components/tree/index.cjs +0 -5
- package/config.cjs +0 -36
- package/directive-DyTodNPd.cjs +0 -523
- package/drawer-C8ojtwIn.cjs +0 -328
- package/index.cjs +0 -134
- package/isFocusable-Ckwus82R.js +0 -32
- package/isFocusable-DfzDLeAN.cjs +0 -31
- package/modal-DWv0VqiG.cjs +0 -252
- package/pagination-BLVa1UsZ.cjs +0 -254
- package/progressbar-RopgvVeA.cjs +0 -86
- package/promise-CxCD3NYv.cjs +0 -118
- package/rating-DZ3OQgtt.cjs +0 -183
- package/scrollbars-CT87iv_6.cjs +0 -30
- package/services/extendWidget.cjs +0 -41
- package/services/floatingUI.cjs +0 -111
- package/services/floatingUI.d.ts +0 -76
- package/services/floatingUI.js +0 -111
- package/services/focusElement.cjs +0 -46
- package/services/focustrack.cjs +0 -47
- package/services/hash.cjs +0 -15
- package/services/intersection.cjs +0 -53
- package/services/matchMedia.cjs +0 -14
- package/services/navManager.cjs +0 -166
- package/services/pointerdownPosition.cjs +0 -60
- package/services/portal.cjs +0 -42
- package/services/resizeObserver.cjs +0 -54
- package/services/siblingsInert.cjs +0 -44
- package/services/transitions/baseTransitions.cjs +0 -186
- package/services/transitions/collapse.cjs +0 -40
- package/services/transitions/cssTransitions.cjs +0 -32
- package/services/transitions/simpleClassTransition.cjs +0 -37
- package/slider-pgDq1V5r.cjs +0 -807
- package/textDirection-zqcZ5-eK.cjs +0 -3
- package/toaster-Dlube4Ya.cjs +0 -161
- package/tree-Chcy4ulJ.cjs +0 -228
- package/types.cjs +0 -6
- package/utils/directive.cjs +0 -28
- package/utils/func.cjs +0 -7
- package/utils/id.cjs +0 -5
- package/utils/stores.cjs +0 -172
- package/utils/widget.cjs +0 -8
- package/utils/writables.cjs +0 -16
- package/writables-Dt68gADJ.cjs +0 -102
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { writablesForProps, idWithDefault, stateStores,
|
|
1
|
+
import { writablesForProps, idWithDefault, stateStores, mergeConfigStores, normalizeConfigStores } from "./utils/stores.js";
|
|
2
2
|
import { createTransition } from "./services/transitions/baseTransitions.js";
|
|
3
|
+
import { createCollapseTransition } from "./services/transitions/collapse.js";
|
|
3
4
|
import { writable, computed, readable, asWritable } from "@amadeus-it-group/tansu";
|
|
4
5
|
import { noop } from "./utils/func.js";
|
|
5
|
-
import {
|
|
6
|
-
import { s as mergeDirectives, g as createAttributesDirective, u as registrationArray, o as directiveSubscribe } from "./directive-
|
|
6
|
+
import { k as typeString, d as typeBoolean, f as typeFunction, c as createTypeEnum } from "./writables-_7BriMb2.js";
|
|
7
|
+
import { s as mergeDirectives, g as createAttributesDirective, u as registrationArray, o as directiveSubscribe } from "./directive-CMT2vEDg.js";
|
|
7
8
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
8
9
|
function adjustItemsCloseOthers(items, openItems, oldOpen) {
|
|
9
10
|
let keepOpen;
|
|
@@ -25,27 +26,40 @@ function adjustItemsCloseOthers(items, openItems, oldOpen) {
|
|
|
25
26
|
function getItem(items, id) {
|
|
26
27
|
return items.find((item) => item.stores.id$() === id);
|
|
27
28
|
}
|
|
29
|
+
const accordionItemCollapseTransition = createCollapseTransition({
|
|
30
|
+
showClasses: ["df-collapse-show"],
|
|
31
|
+
hideClasses: ["df-collapse-hide"],
|
|
32
|
+
animationPendingClasses: ["df-collapse-collapsing"]
|
|
33
|
+
});
|
|
28
34
|
const defaultAccordionConfig = {
|
|
29
35
|
closeOthers: false,
|
|
36
|
+
selectable: false,
|
|
30
37
|
onItemShown: noop,
|
|
31
38
|
onItemHidden: noop,
|
|
32
39
|
className: "",
|
|
33
40
|
itemDestroyOnHide: true,
|
|
34
|
-
|
|
41
|
+
animated: true,
|
|
35
42
|
itemTransition: noop,
|
|
36
43
|
itemHeadingLevel: 2,
|
|
37
44
|
itemClassName: "",
|
|
38
45
|
itemHeaderClassName: "",
|
|
39
46
|
itemButtonClassName: "",
|
|
40
47
|
itemBodyContainerClassName: "",
|
|
41
|
-
itemBodyClassName: ""
|
|
48
|
+
itemBodyClassName: "",
|
|
49
|
+
size: "md",
|
|
50
|
+
arrowPosition: "end",
|
|
51
|
+
addon: "none",
|
|
52
|
+
subtitleType: "none",
|
|
53
|
+
separator: false,
|
|
54
|
+
ariaToggleButtonLabel: "Toggle item",
|
|
55
|
+
id: ""
|
|
42
56
|
};
|
|
43
57
|
const defaultItemConfig = {
|
|
44
58
|
id: "",
|
|
45
59
|
destroyOnHide: defaultAccordionConfig.itemDestroyOnHide,
|
|
46
60
|
disabled: false,
|
|
47
61
|
visible: false,
|
|
48
|
-
animated: defaultAccordionConfig.
|
|
62
|
+
animated: defaultAccordionConfig.animated,
|
|
49
63
|
transition: defaultAccordionConfig.itemTransition,
|
|
50
64
|
onShown: noop,
|
|
51
65
|
onHidden: noop,
|
|
@@ -63,18 +77,26 @@ function getAccordionDefaultConfig() {
|
|
|
63
77
|
}
|
|
64
78
|
const configAccordionValidator = {
|
|
65
79
|
closeOthers: typeBoolean,
|
|
80
|
+
selectable: typeBoolean,
|
|
66
81
|
onItemShown: typeFunction,
|
|
67
82
|
onItemHidden: typeFunction,
|
|
68
83
|
className: typeString,
|
|
69
84
|
itemDestroyOnHide: typeBoolean,
|
|
70
|
-
|
|
85
|
+
animated: typeBoolean,
|
|
71
86
|
itemTransition: typeFunction,
|
|
72
87
|
itemClassName: typeString,
|
|
73
88
|
itemHeaderClassName: typeString,
|
|
74
89
|
itemButtonClassName: typeString,
|
|
75
90
|
itemBodyContainerClassName: typeString,
|
|
76
91
|
itemBodyClassName: typeString,
|
|
77
|
-
itemHeadingLevel: createTypeEnum([1, 2, 3, 4, 5, 6])
|
|
92
|
+
itemHeadingLevel: createTypeEnum([1, 2, 3, 4, 5, 6]),
|
|
93
|
+
size: createTypeEnum(["sm", "md", "lg"]),
|
|
94
|
+
arrowPosition: createTypeEnum(["start", "end"]),
|
|
95
|
+
addon: createTypeEnum(["none", "icon", "number"]),
|
|
96
|
+
subtitleType: createTypeEnum(["none", "inline", "block"]),
|
|
97
|
+
separator: typeBoolean,
|
|
98
|
+
ariaToggleButtonLabel: typeString,
|
|
99
|
+
id: typeString
|
|
78
100
|
};
|
|
79
101
|
const configItemValidator = {
|
|
80
102
|
id: typeString,
|
|
@@ -140,7 +162,7 @@ function createAccordionItem(config) {
|
|
|
140
162
|
"aria-controls": computed(() => `${id$()}-body-container`),
|
|
141
163
|
disabled: disabled$
|
|
142
164
|
},
|
|
143
|
-
classNames: { collapsed: computed(() => !visible$()) },
|
|
165
|
+
classNames: { "df-collapsed": computed(() => !visible$()) },
|
|
144
166
|
events: {
|
|
145
167
|
click: () => {
|
|
146
168
|
if (!disabled$()) {
|
|
@@ -202,10 +224,30 @@ function createAccordionItem(config) {
|
|
|
202
224
|
function factoryCreateAccordion(itemFactory = createAccordionItem, accordionItemProps = coreAccordionItemProps, accordionConfig = defaultAccordionConfig, accordionValidator = configAccordionValidator) {
|
|
203
225
|
return createWidgetFactory("accordion", (config) => {
|
|
204
226
|
const [writables, patch] = writablesForProps(accordionConfig, config, accordionValidator);
|
|
205
|
-
const {
|
|
227
|
+
const {
|
|
228
|
+
closeOthers$,
|
|
229
|
+
selectable$,
|
|
230
|
+
onItemShown$,
|
|
231
|
+
onItemHidden$,
|
|
232
|
+
className$,
|
|
233
|
+
size$,
|
|
234
|
+
addon$,
|
|
235
|
+
subtitleType$,
|
|
236
|
+
separator$,
|
|
237
|
+
animated$,
|
|
238
|
+
id$: _dirtyId$,
|
|
239
|
+
...stateStores$
|
|
240
|
+
} = writables;
|
|
241
|
+
const id$ = idWithDefault(_dirtyId$);
|
|
206
242
|
const accordionItemConfig = Object.fromEntries(
|
|
207
243
|
Object.entries(writables).filter((entry) => entry[0].startsWith("item")).map((entry) => [entry[0].charAt(4).toLowerCase() + entry[0].slice(5, -1), entry[1]])
|
|
208
244
|
);
|
|
245
|
+
const accordionClassName$ = computed(() => {
|
|
246
|
+
const size = size$();
|
|
247
|
+
const sizeClass = size === "sm" ? "df-accordion-sm " : size === "lg" ? "df-accordion-lg " : "";
|
|
248
|
+
const separatorClass = separator$() ? "df-accordion-separator " : "";
|
|
249
|
+
return `${sizeClass}${separatorClass}`.trim();
|
|
250
|
+
});
|
|
209
251
|
const itemWidgets$ = registrationArray();
|
|
210
252
|
const openItems$ = computed(() => {
|
|
211
253
|
const openItems = [];
|
|
@@ -218,7 +260,7 @@ function factoryCreateAccordion(itemFactory = createAccordionItem, accordionItem
|
|
|
218
260
|
});
|
|
219
261
|
const oldOpenItem$ = writable(openItems$()[0]);
|
|
220
262
|
const checkCloseOthersAction$ = computed(() => {
|
|
221
|
-
if (closeOthers$()) {
|
|
263
|
+
if (selectable$() || closeOthers$()) {
|
|
222
264
|
adjustItemsCloseOthers(itemWidgets$(), openItems$(), oldOpenItem$());
|
|
223
265
|
oldOpenItem$.set(openItems$()[0]);
|
|
224
266
|
}
|
|
@@ -227,22 +269,39 @@ function factoryCreateAccordion(itemFactory = createAccordionItem, accordionItem
|
|
|
227
269
|
checkCloseOthersAction$();
|
|
228
270
|
});
|
|
229
271
|
return {
|
|
230
|
-
...stateStores({
|
|
272
|
+
...stateStores({
|
|
273
|
+
itemWidgets$,
|
|
274
|
+
className$,
|
|
275
|
+
size$,
|
|
276
|
+
addon$,
|
|
277
|
+
subtitleType$,
|
|
278
|
+
separator$,
|
|
279
|
+
animated$,
|
|
280
|
+
accordionClassName$,
|
|
281
|
+
id$,
|
|
282
|
+
...stateStores$
|
|
283
|
+
}),
|
|
231
284
|
patch,
|
|
232
285
|
api: {
|
|
233
286
|
expand: async (id, animated) => {
|
|
234
287
|
await getItem(itemWidgets$(), id)?.api.expand(animated);
|
|
235
288
|
},
|
|
236
289
|
collapse: async (id, animated) => {
|
|
290
|
+
if (selectable$()) return;
|
|
237
291
|
await getItem(itemWidgets$(), id)?.api.collapse(animated);
|
|
238
292
|
},
|
|
239
293
|
toggle: async (id, animated) => {
|
|
240
|
-
|
|
294
|
+
if (selectable$()) {
|
|
295
|
+
await getItem(itemWidgets$(), id)?.api.expand(animated);
|
|
296
|
+
} else {
|
|
297
|
+
await getItem(itemWidgets$(), id)?.api.toggle(animated);
|
|
298
|
+
}
|
|
241
299
|
},
|
|
242
300
|
expandAll: async (animated) => {
|
|
243
301
|
await Promise.all(itemWidgets$().map((i) => i.api.expand(animated)));
|
|
244
302
|
},
|
|
245
303
|
collapseAll: async (animated) => {
|
|
304
|
+
if (selectable$()) return;
|
|
246
305
|
await Promise.all(itemWidgets$().map((i) => i.api.collapse(animated)));
|
|
247
306
|
},
|
|
248
307
|
registerItem: (propsConfig) => {
|
|
@@ -257,12 +316,15 @@ function factoryCreateAccordion(itemFactory = createAccordionItem, accordionItem
|
|
|
257
316
|
onHidden: defaultItemConfig.onHidden,
|
|
258
317
|
onShown: defaultItemConfig.onShown
|
|
259
318
|
},
|
|
319
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
260
320
|
{ config: config2, props: propsConfig?.props }
|
|
261
321
|
);
|
|
262
322
|
const item = itemFactory({
|
|
263
323
|
config: config2,
|
|
264
324
|
props: {
|
|
325
|
+
transition: accordionItemCollapseTransition,
|
|
265
326
|
...propsConfig?.props,
|
|
327
|
+
animated: animated$,
|
|
266
328
|
onHidden: asWritable(
|
|
267
329
|
readable(() => {
|
|
268
330
|
onItemHidden$()(item.stores.id$());
|
|
@@ -298,8 +360,7 @@ function factoryCreateAccordion(itemFactory = createAccordionItem, accordionItem
|
|
|
298
360
|
accordionDirective: mergeDirectives(
|
|
299
361
|
directiveSubscribe(action$),
|
|
300
362
|
createAttributesDirective(() => ({
|
|
301
|
-
attributes: { class: className$ }
|
|
302
|
-
classNames: { "au-accordion": true$ }
|
|
363
|
+
attributes: { class: className$ }
|
|
303
364
|
}))
|
|
304
365
|
)
|
|
305
366
|
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { computed } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { c as createCommonAlert } from "./common-CP4amR0Z.js";
|
|
3
|
+
import { c as createCollapse } from "./collapse-D8Jo56k9.js";
|
|
4
|
+
import { createCollapseTransition } from "./services/transitions/collapse.js";
|
|
5
|
+
import { createSimpleClassTransition } from "./services/transitions/simpleClassTransition.js";
|
|
6
|
+
import { extendWidgetProps } from "./services/extendWidget.js";
|
|
7
|
+
import { noop } from "./utils/func.js";
|
|
8
|
+
import { stateStores } from "./utils/stores.js";
|
|
9
|
+
import { f as typeFunction, d as typeBoolean, k as typeString, c as createTypeEnum, t as testToNormalizeValue } from "./writables-_7BriMb2.js";
|
|
10
|
+
import { createWidgetFactory } from "./utils/widget.js";
|
|
11
|
+
const alertRoles = {
|
|
12
|
+
success: "status",
|
|
13
|
+
info: "status",
|
|
14
|
+
tip: "status",
|
|
15
|
+
warning: "alert",
|
|
16
|
+
danger: "alert"
|
|
17
|
+
};
|
|
18
|
+
const typeIcons = {
|
|
19
|
+
normalizeValue: testToNormalizeValue(
|
|
20
|
+
(value) => !!value && typeof value === "object" && !Array.isArray(value)
|
|
21
|
+
)
|
|
22
|
+
};
|
|
23
|
+
const alertCollapseTransition = createCollapseTransition({
|
|
24
|
+
showClasses: ["df-collapse-show"],
|
|
25
|
+
hideClasses: ["df-collapse-hide"],
|
|
26
|
+
animationPendingClasses: ["df-collapse-collapsing"]
|
|
27
|
+
});
|
|
28
|
+
const alertFadeTransition = createSimpleClassTransition({
|
|
29
|
+
animationPendingClasses: ["df-fade"],
|
|
30
|
+
animationPendingShowClasses: ["df-show"],
|
|
31
|
+
showClasses: ["df-show", "df-fade"],
|
|
32
|
+
hideClasses: ["df-hidden", "df-fade"]
|
|
33
|
+
});
|
|
34
|
+
const alertDefaultConfig = {
|
|
35
|
+
type: "warning",
|
|
36
|
+
appearance: "default",
|
|
37
|
+
size: "md",
|
|
38
|
+
icons: {
|
|
39
|
+
success: "fa-solid fa-check-circle",
|
|
40
|
+
warning: "fa-solid fa-exclamation-triangle",
|
|
41
|
+
danger: "fa-solid fa-octagon-xmark",
|
|
42
|
+
tip: "fa-solid fa-lightbulb",
|
|
43
|
+
info: "fa-solid fa-info-circle",
|
|
44
|
+
default: "fa-solid fa-info-circle"
|
|
45
|
+
},
|
|
46
|
+
collapseIcon: "fa-light fa-chevron-up",
|
|
47
|
+
expandIcon: "fa-light fa-chevron-down",
|
|
48
|
+
expandLabel: "Show more",
|
|
49
|
+
collapseLabel: "See less",
|
|
50
|
+
expandable: false,
|
|
51
|
+
expanded: false,
|
|
52
|
+
onCollapsed: noop,
|
|
53
|
+
onExpanded: noop
|
|
54
|
+
};
|
|
55
|
+
const alertConfigValidator = {
|
|
56
|
+
type: createTypeEnum(["success", "info", "warning", "danger", "tip"]),
|
|
57
|
+
appearance: createTypeEnum(["default", "banner"]),
|
|
58
|
+
size: createTypeEnum(["sm", "md", "lg"]),
|
|
59
|
+
icons: typeIcons,
|
|
60
|
+
collapseIcon: typeString,
|
|
61
|
+
expandIcon: typeString,
|
|
62
|
+
expandLabel: typeString,
|
|
63
|
+
collapseLabel: typeString,
|
|
64
|
+
expandable: typeBoolean,
|
|
65
|
+
expanded: typeBoolean,
|
|
66
|
+
onCollapsed: typeFunction,
|
|
67
|
+
onExpanded: typeFunction
|
|
68
|
+
};
|
|
69
|
+
const createExtendedAlert = extendWidgetProps(
|
|
70
|
+
createCommonAlert,
|
|
71
|
+
alertDefaultConfig,
|
|
72
|
+
alertConfigValidator,
|
|
73
|
+
{
|
|
74
|
+
transition: alertFadeTransition
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
const createAlert = createWidgetFactory(
|
|
78
|
+
"alert",
|
|
79
|
+
(config) => {
|
|
80
|
+
const extendedAlert = createExtendedAlert(config);
|
|
81
|
+
const { onCollapsed$, onExpanded$, ...extendedAlertStores } = extendedAlert.stores;
|
|
82
|
+
const { icons$, type$, animated$, expandable$, expanded$: requestedExpanded$ } = extendedAlertStores;
|
|
83
|
+
const collapse = createCollapse({
|
|
84
|
+
config: {
|
|
85
|
+
visible: computed(() => expandable$() ? requestedExpanded$() : true),
|
|
86
|
+
animated: animated$,
|
|
87
|
+
animatedOnInit: false,
|
|
88
|
+
transition: alertCollapseTransition,
|
|
89
|
+
onHidden: () => {
|
|
90
|
+
if (expandable$()) {
|
|
91
|
+
onCollapsed$()();
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
onShown: () => {
|
|
95
|
+
if (expandable$()) {
|
|
96
|
+
onExpanded$()();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const expanded$ = computed(() => expandable$() ? collapse.stores.visible$() : false);
|
|
102
|
+
const icon$ = computed(() => {
|
|
103
|
+
const icons = icons$();
|
|
104
|
+
return icons[type$()] ?? icons.default ?? "";
|
|
105
|
+
});
|
|
106
|
+
const role$ = computed(() => alertRoles[type$()]);
|
|
107
|
+
return {
|
|
108
|
+
...extendedAlert,
|
|
109
|
+
...stateStores({
|
|
110
|
+
...extendedAlertStores,
|
|
111
|
+
expanded$,
|
|
112
|
+
icon$,
|
|
113
|
+
role$
|
|
114
|
+
}),
|
|
115
|
+
directives: {
|
|
116
|
+
...extendedAlert.directives,
|
|
117
|
+
collapseDirective: collapse.directives.collapseDirective,
|
|
118
|
+
collapseTriggerDirective: collapse.directives.triggerDirective
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
export {
|
|
124
|
+
createAlert as c
|
|
125
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createTransition } from "./services/transitions/baseTransitions.js";
|
|
2
2
|
import { writablesForProps, idWithDefault, stateStores } from "./utils/stores.js";
|
|
3
|
-
import { g as createAttributesDirective, s as mergeDirectives } from "./directive-
|
|
4
|
-
import {
|
|
3
|
+
import { g as createAttributesDirective, s as mergeDirectives } from "./directive-CMT2vEDg.js";
|
|
4
|
+
import { f as typeFunction, k as typeString, d as typeBoolean } from "./writables-_7BriMb2.js";
|
|
5
5
|
import { computed } from "@amadeus-it-group/tansu";
|
|
6
6
|
import { noop } from "./utils/func.js";
|
|
7
7
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createTransition } from "./services/transitions/baseTransitions.js";
|
|
2
2
|
import { noop } from "./utils/func.js";
|
|
3
3
|
import { writablesForProps, stateStores } from "./utils/stores.js";
|
|
4
|
-
import {
|
|
4
|
+
import { k as typeString, d as typeBoolean, f as typeFunction } from "./writables-_7BriMb2.js";
|
|
5
5
|
const defaultCommonAlertConfig = {
|
|
6
6
|
visible: true,
|
|
7
7
|
dismissible: true,
|
|
@@ -57,7 +57,7 @@ function createCommonAlert(config) {
|
|
|
57
57
|
const visible$ = transition.stores.visible$;
|
|
58
58
|
const hidden$ = transition.stores.hidden$;
|
|
59
59
|
return {
|
|
60
|
-
...stateStores({ ...stateProps, visible$, hidden$ }),
|
|
60
|
+
...stateStores({ ...stateProps, animated$, visible$, hidden$ }),
|
|
61
61
|
patch,
|
|
62
62
|
api: {
|
|
63
63
|
open: transition.api.show,
|
|
@@ -1,16 +1,82 @@
|
|
|
1
1
|
import type { TransitionFn } from '../../services/transitions/baseTransitions';
|
|
2
2
|
import type { ConfigValidator, Directive, PropsConfig, Widget, WidgetFactory } from '../../types';
|
|
3
3
|
import type { WidgetsCommonPropsAndState } from '../commonProps';
|
|
4
|
+
/**
|
|
5
|
+
* Interface representing the common properties and state for an accordion.
|
|
6
|
+
*/
|
|
7
|
+
interface AccordionCommonPropsAndState extends WidgetsCommonPropsAndState {
|
|
8
|
+
/**
|
|
9
|
+
* Defines how the subtitle is displayed on accordion items.
|
|
10
|
+
*
|
|
11
|
+
* @defaultValue `'none'`
|
|
12
|
+
*/
|
|
13
|
+
subtitleType: 'none' | 'inline' | 'block';
|
|
14
|
+
/**
|
|
15
|
+
* The HTML heading level to use for the accordion-item-header.
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue `2`
|
|
18
|
+
*/
|
|
19
|
+
itemHeadingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
20
|
+
/**
|
|
21
|
+
* Accessibility label for the accordion-item toggle button in the interactive variant.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue `'Toggle item'`
|
|
24
|
+
*/
|
|
25
|
+
ariaToggleButtonLabel: string;
|
|
26
|
+
/**
|
|
27
|
+
* The size of the accordion.
|
|
28
|
+
*
|
|
29
|
+
* @defaultValue `'md'`
|
|
30
|
+
*/
|
|
31
|
+
size: 'sm' | 'md' | 'lg';
|
|
32
|
+
/**
|
|
33
|
+
* Position of the expandable icon on the accordion header.
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue `'end'`
|
|
36
|
+
*/
|
|
37
|
+
arrowPosition: 'start' | 'end';
|
|
38
|
+
/**
|
|
39
|
+
* Addon type to show on the left side of the accordion header.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue `'none'`
|
|
42
|
+
*/
|
|
43
|
+
addon: 'none' | 'icon' | 'number';
|
|
44
|
+
/**
|
|
45
|
+
* When an item is visible (expanded), a separator line is shown below the item header.
|
|
46
|
+
*
|
|
47
|
+
* @defaultValue `false`
|
|
48
|
+
*/
|
|
49
|
+
separator: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The id of the accordion. It is used in the accordion selectable variant.
|
|
52
|
+
*
|
|
53
|
+
* @defaultValue `dfId-[number]`
|
|
54
|
+
*/
|
|
55
|
+
id: string;
|
|
56
|
+
/**
|
|
57
|
+
* If `true`, accordion items will be animated.
|
|
58
|
+
*
|
|
59
|
+
* @defaultValue `true`
|
|
60
|
+
*/
|
|
61
|
+
animated: boolean;
|
|
62
|
+
}
|
|
4
63
|
/**
|
|
5
64
|
* Properties for the Accordion component.
|
|
6
65
|
*/
|
|
7
|
-
export interface AccordionProps extends
|
|
66
|
+
export interface AccordionProps extends AccordionCommonPropsAndState {
|
|
8
67
|
/**
|
|
9
68
|
* If `true`, only one accordion-item at the time can stay open.
|
|
10
69
|
*
|
|
11
70
|
* @defaultValue `false`
|
|
12
71
|
*/
|
|
13
72
|
closeOthers: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* If `true`, the accordion uses a radio-group pattern: `closeOthers` is always enforced
|
|
75
|
+
* and the last open item cannot be collapsed.
|
|
76
|
+
*
|
|
77
|
+
* @defaultValue `false`
|
|
78
|
+
*/
|
|
79
|
+
selectable: boolean;
|
|
14
80
|
/**
|
|
15
81
|
* An event fired when an item is shown.
|
|
16
82
|
*
|
|
@@ -39,12 +105,6 @@ export interface AccordionProps extends WidgetsCommonPropsAndState {
|
|
|
39
105
|
* @defaultValue `true`
|
|
40
106
|
*/
|
|
41
107
|
itemDestroyOnHide: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* If `true`, accordion-item will be animated.
|
|
44
|
-
*
|
|
45
|
-
* @defaultValue `true`
|
|
46
|
-
*/
|
|
47
|
-
itemAnimated: boolean;
|
|
48
108
|
/**
|
|
49
109
|
* The transition to use for the accordion-item body-container when the accordion-item is toggled.
|
|
50
110
|
*
|
|
@@ -85,21 +145,19 @@ export interface AccordionProps extends WidgetsCommonPropsAndState {
|
|
|
85
145
|
* @defaultValue `''`
|
|
86
146
|
*/
|
|
87
147
|
itemBodyClassName: string;
|
|
88
|
-
/**
|
|
89
|
-
* The html heading level to use for the accordion-item-header.
|
|
90
|
-
*
|
|
91
|
-
* @defaultValue `2`
|
|
92
|
-
*/
|
|
93
|
-
itemHeadingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
94
148
|
}
|
|
95
149
|
/**
|
|
96
150
|
* Represents the state of an Accordion component.
|
|
97
151
|
*/
|
|
98
|
-
export interface AccordionState extends
|
|
152
|
+
export interface AccordionState extends AccordionCommonPropsAndState {
|
|
99
153
|
/**
|
|
100
154
|
* Array containing all the accordion-items contained in the accordion.
|
|
101
155
|
*/
|
|
102
156
|
itemWidgets: AccordionItemWidget[];
|
|
157
|
+
/**
|
|
158
|
+
* Computed CSS class name for the accordion based on its visual configuration.
|
|
159
|
+
*/
|
|
160
|
+
accordionClassName: string;
|
|
103
161
|
}
|
|
104
162
|
/**
|
|
105
163
|
* Interface representing the API for an accordion component.
|
|
@@ -254,7 +312,7 @@ interface AccordionItemCommonPropsAndState extends WidgetsCommonPropsAndState {
|
|
|
254
312
|
*/
|
|
255
313
|
bodyClassName: string;
|
|
256
314
|
/**
|
|
257
|
-
* The
|
|
315
|
+
* The HTML heading level to use for the accordion-item-header.
|
|
258
316
|
*/
|
|
259
317
|
headingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
260
318
|
}
|
|
@@ -1,14 +1,79 @@
|
|
|
1
1
|
import type { CommonAlertApi, CommonAlertDirectives, CommonAlertProps, CommonAlertState } from './common';
|
|
2
|
-
import type { Widget, WidgetFactory } from '../../types';
|
|
2
|
+
import type { Directive, Widget, WidgetFactory } from '../../types';
|
|
3
|
+
export type AlertSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type AlertType = 'success' | 'info' | 'warning' | 'danger' | 'tip';
|
|
5
|
+
export type AlertRole = 'alert' | 'status';
|
|
6
|
+
export type AlertAppearance = 'default' | 'banner';
|
|
7
|
+
type AlertIcons = Record<AlertType | 'default', string>;
|
|
8
|
+
interface AlertExtraPropsAndState {
|
|
9
|
+
/**
|
|
10
|
+
* Type of the alert.
|
|
11
|
+
*/
|
|
12
|
+
type: AlertType;
|
|
13
|
+
/**
|
|
14
|
+
* Visual appearance variant for alert chrome.
|
|
15
|
+
*/
|
|
16
|
+
appearance: AlertAppearance;
|
|
17
|
+
/**
|
|
18
|
+
* Size of the alert.
|
|
19
|
+
*/
|
|
20
|
+
size: AlertSize;
|
|
21
|
+
/**
|
|
22
|
+
* Icon classes by alert type.
|
|
23
|
+
*/
|
|
24
|
+
icons: AlertIcons;
|
|
25
|
+
/**
|
|
26
|
+
* Icon class for the collapse action.
|
|
27
|
+
*/
|
|
28
|
+
collapseIcon: string;
|
|
29
|
+
/**
|
|
30
|
+
* Icon class for the expand action.
|
|
31
|
+
*/
|
|
32
|
+
expandIcon: string;
|
|
33
|
+
/**
|
|
34
|
+
* Label shown when alert details can be expanded.
|
|
35
|
+
*/
|
|
36
|
+
expandLabel: string;
|
|
37
|
+
/**
|
|
38
|
+
* Label shown when alert details can be collapsed.
|
|
39
|
+
*/
|
|
40
|
+
collapseLabel: string;
|
|
41
|
+
/**
|
|
42
|
+
* If `true`, alert details can be toggled with a collapse trigger.
|
|
43
|
+
*/
|
|
44
|
+
expandable: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* If `true`, the collapsible content is shown.
|
|
47
|
+
*/
|
|
48
|
+
expanded: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface AlertExtraProps extends AlertExtraPropsAndState {
|
|
51
|
+
/**
|
|
52
|
+
* Callback called when collapsible content is hidden.
|
|
53
|
+
*/
|
|
54
|
+
onCollapsed: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* Callback called when collapsible content is shown.
|
|
57
|
+
*/
|
|
58
|
+
onExpanded: () => void;
|
|
59
|
+
}
|
|
3
60
|
/**
|
|
4
61
|
* Represents the state of an alert component.
|
|
5
62
|
*/
|
|
6
|
-
export interface AlertState extends CommonAlertState {
|
|
63
|
+
export interface AlertState extends CommonAlertState, AlertExtraPropsAndState {
|
|
64
|
+
/**
|
|
65
|
+
* Computed icon class for current alert type.
|
|
66
|
+
*/
|
|
67
|
+
icon: string;
|
|
68
|
+
/**
|
|
69
|
+
* Computed ARIA live region role for current alert type.
|
|
70
|
+
*/
|
|
71
|
+
role: AlertRole;
|
|
7
72
|
}
|
|
8
73
|
/**
|
|
9
74
|
* Represents the properties for the alert component.
|
|
10
75
|
*/
|
|
11
|
-
export interface AlertProps extends CommonAlertProps {
|
|
76
|
+
export interface AlertProps extends CommonAlertProps, AlertExtraProps {
|
|
12
77
|
}
|
|
13
78
|
/**
|
|
14
79
|
* Represents the API for an alert component.
|
|
@@ -19,19 +84,23 @@ export interface AlertApi extends CommonAlertApi {
|
|
|
19
84
|
* Represents the directives for an alert component.
|
|
20
85
|
*/
|
|
21
86
|
export interface AlertDirectives extends CommonAlertDirectives {
|
|
87
|
+
/**
|
|
88
|
+
* Directive to apply the collapse animation to alert details.
|
|
89
|
+
*/
|
|
90
|
+
collapseDirective: Directive;
|
|
91
|
+
/**
|
|
92
|
+
* Directive to apply on the collapse trigger element.
|
|
93
|
+
*/
|
|
94
|
+
collapseTriggerDirective: Directive;
|
|
22
95
|
}
|
|
23
96
|
/**
|
|
24
97
|
* Represents an alert widget with specific properties, state, API, and directives.
|
|
25
98
|
*/
|
|
26
99
|
export type AlertWidget = Widget<AlertProps, AlertState, AlertApi, AlertDirectives>;
|
|
27
|
-
/**
|
|
28
|
-
* Retrieve a shallow copy of the default alert config
|
|
29
|
-
* @returns the default alert config
|
|
30
|
-
*/
|
|
31
|
-
export declare function getAlertDefaultConfig(): AlertProps;
|
|
32
100
|
/**
|
|
33
101
|
* Create an AlertWidget with given config props
|
|
34
102
|
* @param config - an optional alert config
|
|
35
103
|
* @returns an AlertWidget
|
|
36
104
|
*/
|
|
37
105
|
export declare const createAlert: WidgetFactory<AlertWidget>;
|
|
106
|
+
export {};
|
|
@@ -24,6 +24,15 @@ export interface CommonAlertCommonPropsAndState extends WidgetsCommonPropsAndSta
|
|
|
24
24
|
* @defaultValue `'Close'`
|
|
25
25
|
*/
|
|
26
26
|
ariaCloseButtonLabel: string;
|
|
27
|
+
/**
|
|
28
|
+
* If `true`, the alert closing will be animated.
|
|
29
|
+
*
|
|
30
|
+
* Animation is triggered when clicked on the close button (×),
|
|
31
|
+
* via the `.close()` function or the visible prop is changed
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue `true`
|
|
34
|
+
*/
|
|
35
|
+
animated: boolean;
|
|
27
36
|
}
|
|
28
37
|
/**
|
|
29
38
|
* Represents the state of a common alert component.
|
|
@@ -85,15 +94,6 @@ export interface CommonAlertProps extends CommonAlertCommonPropsAndState {
|
|
|
85
94
|
* @defaultValue `false`
|
|
86
95
|
*/
|
|
87
96
|
animatedOnInit: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* If `true`, alert closing will be animated.
|
|
90
|
-
*
|
|
91
|
-
* Animation is triggered when clicked on the close button (×),
|
|
92
|
-
* via the `.close()` function or the visible prop is changed
|
|
93
|
-
*
|
|
94
|
-
* @defaultValue `true`
|
|
95
|
-
*/
|
|
96
|
-
animated: boolean;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Interface representing the common API for alert components.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { writablesForProps, true$, stateStores } from "../../utils/stores.js";
|
|
2
|
-
import { b as bindDirective, d as browserDirective, g as createAttributesDirective, s as mergeDirectives } from "../../directive-
|
|
2
|
+
import { b as bindDirective, d as browserDirective, g as createAttributesDirective, s as mergeDirectives } from "../../directive-CMT2vEDg.js";
|
|
3
3
|
import EmblaCarousel from "embla-carousel";
|
|
4
4
|
import { writable, computed, asReadable, readable } from "@amadeus-it-group/tansu";
|
|
5
|
-
import {
|
|
5
|
+
import { f as typeFunction, k as typeString, d as typeBoolean, h as typeNumber, l as typeStringOrNull, b as typeArray, c as createTypeEnum } from "../../writables-_7BriMb2.js";
|
|
6
6
|
import { createNavManager } from "../../services/navManager.js";
|
|
7
7
|
import { createWidgetFactory } from "../../utils/widget.js";
|
|
8
8
|
const defaultConfig = {
|
|
@@ -125,6 +125,12 @@ export interface DrawerProps extends DrawerCommonPropsAndState {
|
|
|
125
125
|
* @defaultValue `true`
|
|
126
126
|
*/
|
|
127
127
|
backdrop: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* If `true` the drawer will be closed when clicking on the backdrop, otherwise the backdrop is static and non iteractive.
|
|
130
|
+
*
|
|
131
|
+
* @defaultValue `true`
|
|
132
|
+
*/
|
|
133
|
+
closeOnBackdropClick: boolean;
|
|
128
134
|
/**
|
|
129
135
|
* If `true` allows body scrolling when the drawer is open.
|
|
130
136
|
*
|