@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
package/utils/writables.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WritableWithDefaultOptions } from '../types';
|
|
1
|
+
import type { PickRequired, WritableWithDefaultOptions } from '../types';
|
|
2
2
|
import { INVALID_VALUE } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Check if a value respects a provided type guard.
|
|
@@ -9,11 +9,11 @@ import { INVALID_VALUE } from '../types';
|
|
|
9
9
|
* @returns A function that takes a value and returns the value if it passes the filter,
|
|
10
10
|
* otherwise returns `INVALID_VALUE`.
|
|
11
11
|
*/
|
|
12
|
-
export declare const testToNormalizeValue: <T>(filter: (value:
|
|
12
|
+
export declare const testToNormalizeValue: <T>(filter: (value: unknown) => value is T) => ((value: unknown) => T | typeof INVALID_VALUE);
|
|
13
13
|
/**
|
|
14
14
|
* A writable object with default options for handling numbers.
|
|
15
15
|
*/
|
|
16
|
-
export declare const typeNumber: WritableWithDefaultOptions<number>;
|
|
16
|
+
export declare const typeNumber: PickRequired<WritableWithDefaultOptions<number>, 'normalizeValue'>;
|
|
17
17
|
/**
|
|
18
18
|
* Options for specifying the behavior of number range validation.
|
|
19
19
|
*/
|
|
@@ -32,7 +32,7 @@ export interface TypeNumberInRangeOptions {
|
|
|
32
32
|
*
|
|
33
33
|
* @returns A type guard function that returns the clamp value or INVALID_VALUE depending on the provided options.
|
|
34
34
|
*/
|
|
35
|
-
export declare function typeNumberInRangeFactory(min: number, max: number, options?: TypeNumberInRangeOptions): WritableWithDefaultOptions<number>;
|
|
35
|
+
export declare function typeNumberInRangeFactory(min: number, max: number, options?: TypeNumberInRangeOptions): PickRequired<WritableWithDefaultOptions<number>, 'normalizeValue'>;
|
|
36
36
|
/**
|
|
37
37
|
* A writable object with default options for boolean values.
|
|
38
38
|
*
|
|
@@ -41,39 +41,39 @@ export declare function typeNumberInRangeFactory(min: number, max: number, optio
|
|
|
41
41
|
* function ensures that the value is properly validated and normalized
|
|
42
42
|
* as a boolean.
|
|
43
43
|
*/
|
|
44
|
-
export declare const typeBoolean: WritableWithDefaultOptions<boolean>;
|
|
44
|
+
export declare const typeBoolean: PickRequired<WritableWithDefaultOptions<boolean>, 'normalizeValue'>;
|
|
45
45
|
/**
|
|
46
46
|
* A writable with default options that normalizes its value to a boolean or null.
|
|
47
47
|
*
|
|
48
48
|
* This writable uses a normalization function that allows null values and ensures
|
|
49
49
|
* the value is a boolean.
|
|
50
50
|
*/
|
|
51
|
-
export declare const typeBooleanOrNull: WritableWithDefaultOptions<boolean | null>;
|
|
51
|
+
export declare const typeBooleanOrNull: PickRequired<WritableWithDefaultOptions<boolean | null>, 'normalizeValue'>;
|
|
52
52
|
/**
|
|
53
53
|
* A writable object with default options for string values.
|
|
54
54
|
*
|
|
55
55
|
* This object provides a normalized value for strings using the `testToNormalizeValue` function
|
|
56
56
|
* with the `isString` validator.
|
|
57
57
|
*/
|
|
58
|
-
export declare const typeString: WritableWithDefaultOptions<string>;
|
|
58
|
+
export declare const typeString: PickRequired<WritableWithDefaultOptions<string>, 'normalizeValue'>;
|
|
59
59
|
/**
|
|
60
60
|
* A writable with default options that normalizes its value to a string or null.
|
|
61
61
|
*
|
|
62
62
|
* This object provides a normalized value for strings using the `testToNormalizeValue` function
|
|
63
63
|
* with the `isString` validator.
|
|
64
64
|
*/
|
|
65
|
-
export declare const typeStringOrNull: WritableWithDefaultOptions<string | null>;
|
|
65
|
+
export declare const typeStringOrNull: PickRequired<WritableWithDefaultOptions<string | null>, 'normalizeValue'>;
|
|
66
66
|
/**
|
|
67
67
|
* A writable with default options that normalizes its value to a number or null.
|
|
68
68
|
*
|
|
69
69
|
* This writable uses a normalization function that allows null values and ensures
|
|
70
70
|
* the value is a boolean.
|
|
71
71
|
*/
|
|
72
|
-
export declare const typeNumberOrNull: WritableWithDefaultOptions<number | null>;
|
|
72
|
+
export declare const typeNumberOrNull: PickRequired<WritableWithDefaultOptions<number | null>, 'normalizeValue'>;
|
|
73
73
|
/**
|
|
74
74
|
* A writable object that holds a function type with default options.
|
|
75
75
|
*/
|
|
76
|
-
export declare const typeFunction: WritableWithDefaultOptions<(...args: any[]) => any>;
|
|
76
|
+
export declare const typeFunction: PickRequired<WritableWithDefaultOptions<(...args: any[]) => any>, 'normalizeValue' | 'equal'>;
|
|
77
77
|
/**
|
|
78
78
|
* A writable object with default options for handling values of type `HTMLElement` or `null`.
|
|
79
79
|
*
|
|
@@ -81,15 +81,29 @@ export declare const typeFunction: WritableWithDefaultOptions<(...args: any[]) =
|
|
|
81
81
|
* - `normalizeValue`: A function to normalize the value, ensuring it is either an `HTMLElement` or `null`.
|
|
82
82
|
* - `equal`: A function to compare two values for equality using `Object.is`.
|
|
83
83
|
*/
|
|
84
|
-
export declare const typeHTMLElementOrNull: WritableWithDefaultOptions<HTMLElement | null>;
|
|
84
|
+
export declare const typeHTMLElementOrNull: PickRequired<WritableWithDefaultOptions<HTMLElement | null>, 'normalizeValue' | 'equal'>;
|
|
85
85
|
/**
|
|
86
86
|
* A writable object with default options for handling arrays.
|
|
87
87
|
*/
|
|
88
|
-
export declare const typeArray: WritableWithDefaultOptions<any[]>;
|
|
88
|
+
export declare const typeArray: PickRequired<WritableWithDefaultOptions<any[]>, 'normalizeValue' | 'equal'>;
|
|
89
89
|
/**
|
|
90
90
|
* Build an enum normalizer
|
|
91
91
|
* @template T - the enum type
|
|
92
92
|
* @param enumList - list of enum values to check
|
|
93
93
|
* @returns the enum normalizer
|
|
94
94
|
*/
|
|
95
|
-
export declare function createTypeEnum<T>(enumList: T[]): WritableWithDefaultOptions<T>;
|
|
95
|
+
export declare function createTypeEnum<T>(enumList: T[]): PickRequired<WritableWithDefaultOptions<T>, 'normalizeValue'>;
|
|
96
|
+
/**
|
|
97
|
+
* Build a normalizer for space-separated string values.
|
|
98
|
+
*
|
|
99
|
+
* Accepts either a `T[]` array or a space-separated string (e.g. `"a b c"`).
|
|
100
|
+
* Each item is validated through the provided `normalizeItem` function, which
|
|
101
|
+
* may return a single value, an array of values (allowing one token to expand
|
|
102
|
+
* into multiple items), or `INVALID_VALUE` to reject the input.
|
|
103
|
+
*
|
|
104
|
+
* @template T - The string literal union type of valid items.
|
|
105
|
+
* @param normalizeItem - A function that validates and normalizes a single item string
|
|
106
|
+
* into one or more `T` values, or returns `INVALID_VALUE` if invalid.
|
|
107
|
+
* @returns A `WritableWithDefaultOptions` that normalizes `T[] | string` into `T[]`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function createTypeStringSpacedArray<T>(normalizeItem: (value: string) => T | T[] | typeof INVALID_VALUE): PickRequired<WritableWithDefaultOptions<T[]>, 'normalizeValue' | 'equal'>;
|
package/utils/writables.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { c,
|
|
1
|
+
import { c, a, t, b, d, e, f, g, h, i, j, k, l } from "../writables-_7BriMb2.js";
|
|
2
2
|
import "../types.js";
|
|
3
3
|
export {
|
|
4
4
|
c as createTypeEnum,
|
|
5
|
+
a as createTypeStringSpacedArray,
|
|
5
6
|
t as testToNormalizeValue,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
b as typeArray,
|
|
8
|
+
d as typeBoolean,
|
|
9
|
+
e as typeBooleanOrNull,
|
|
10
|
+
f as typeFunction,
|
|
11
|
+
g as typeHTMLElementOrNull,
|
|
12
|
+
h as typeNumber,
|
|
13
|
+
i as typeNumberInRangeFactory,
|
|
14
|
+
j as typeNumberOrNull,
|
|
15
|
+
k as typeString,
|
|
16
|
+
l as typeStringOrNull
|
|
16
17
|
};
|
|
@@ -85,19 +85,44 @@ function createTypeEnum(enumList) {
|
|
|
85
85
|
normalizeValue: testToNormalizeValue(isFromEnum(enumList))
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
function createTypeStringSpacedArray(normalizeItem) {
|
|
89
|
+
return {
|
|
90
|
+
normalizeValue: (value) => {
|
|
91
|
+
const trimmed = isString(value) ? value.trim() : void 0;
|
|
92
|
+
const items = trimmed !== void 0 ? trimmed === "" ? [] : trimmed.split(/\s+/) : isArray(value) ? value : void 0;
|
|
93
|
+
if (!items) {
|
|
94
|
+
return INVALID_VALUE;
|
|
95
|
+
}
|
|
96
|
+
const result = [];
|
|
97
|
+
for (const item of items) {
|
|
98
|
+
const normalized = normalizeItem(item);
|
|
99
|
+
if (normalized === INVALID_VALUE) {
|
|
100
|
+
return INVALID_VALUE;
|
|
101
|
+
} else if (isArray(normalized)) {
|
|
102
|
+
result.push(...normalized);
|
|
103
|
+
} else {
|
|
104
|
+
result.push(normalized);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
},
|
|
109
|
+
equal: typeArray.equal
|
|
110
|
+
};
|
|
111
|
+
}
|
|
88
112
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
113
|
+
createTypeStringSpacedArray as a,
|
|
114
|
+
typeArray as b,
|
|
91
115
|
createTypeEnum as c,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
116
|
+
typeBoolean as d,
|
|
117
|
+
typeBooleanOrNull as e,
|
|
118
|
+
typeFunction as f,
|
|
119
|
+
typeHTMLElementOrNull as g,
|
|
120
|
+
typeNumber as h,
|
|
121
|
+
typeNumberInRangeFactory as i,
|
|
122
|
+
typeNumberOrNull as j,
|
|
123
|
+
typeString as k,
|
|
124
|
+
typeStringOrNull as l,
|
|
125
|
+
clamp as m,
|
|
126
|
+
isNumber as n,
|
|
102
127
|
testToNormalizeValue as t
|
|
103
128
|
};
|
package/accordion-B0vs8JWM.cjs
DELETED
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const utils_stores = require("./utils/stores.cjs");
|
|
3
|
-
const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
|
|
4
|
-
const tansu = require("@amadeus-it-group/tansu");
|
|
5
|
-
const utils_func = require("./utils/func.cjs");
|
|
6
|
-
const utils_writables = require("./writables-Dt68gADJ.cjs");
|
|
7
|
-
const utils_directive = require("./directive-DyTodNPd.cjs");
|
|
8
|
-
const utils_widget = require("./utils/widget.cjs");
|
|
9
|
-
function adjustItemsCloseOthers(items, openItems, oldOpen) {
|
|
10
|
-
let keepOpen;
|
|
11
|
-
if (openItems.length == 2) {
|
|
12
|
-
oldOpen = oldOpen ?? openItems[0];
|
|
13
|
-
keepOpen = openItems.find((id) => id !== oldOpen);
|
|
14
|
-
} else if (openItems.length > 2) {
|
|
15
|
-
keepOpen = openItems[0];
|
|
16
|
-
}
|
|
17
|
-
if (keepOpen) {
|
|
18
|
-
items.forEach((item) => {
|
|
19
|
-
if (item.stores.id$() !== keepOpen && item.stores.visible$()) {
|
|
20
|
-
item.patch({ visible: false });
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return items;
|
|
25
|
-
}
|
|
26
|
-
function getItem(items, id) {
|
|
27
|
-
return items.find((item) => item.stores.id$() === id);
|
|
28
|
-
}
|
|
29
|
-
const defaultAccordionConfig = {
|
|
30
|
-
closeOthers: false,
|
|
31
|
-
onItemShown: utils_func.noop,
|
|
32
|
-
onItemHidden: utils_func.noop,
|
|
33
|
-
className: "",
|
|
34
|
-
itemDestroyOnHide: true,
|
|
35
|
-
itemAnimated: true,
|
|
36
|
-
itemTransition: utils_func.noop,
|
|
37
|
-
itemHeadingLevel: 2,
|
|
38
|
-
itemClassName: "",
|
|
39
|
-
itemHeaderClassName: "",
|
|
40
|
-
itemButtonClassName: "",
|
|
41
|
-
itemBodyContainerClassName: "",
|
|
42
|
-
itemBodyClassName: ""
|
|
43
|
-
};
|
|
44
|
-
const defaultItemConfig = {
|
|
45
|
-
id: "",
|
|
46
|
-
destroyOnHide: defaultAccordionConfig.itemDestroyOnHide,
|
|
47
|
-
disabled: false,
|
|
48
|
-
visible: false,
|
|
49
|
-
animated: defaultAccordionConfig.itemAnimated,
|
|
50
|
-
transition: defaultAccordionConfig.itemTransition,
|
|
51
|
-
onShown: utils_func.noop,
|
|
52
|
-
onHidden: utils_func.noop,
|
|
53
|
-
onVisibleChange: utils_func.noop,
|
|
54
|
-
className: defaultAccordionConfig.itemClassName,
|
|
55
|
-
headerClassName: defaultAccordionConfig.itemHeaderClassName,
|
|
56
|
-
buttonClassName: defaultAccordionConfig.itemButtonClassName,
|
|
57
|
-
bodyContainerClassName: defaultAccordionConfig.itemBodyContainerClassName,
|
|
58
|
-
bodyClassName: defaultAccordionConfig.itemBodyClassName,
|
|
59
|
-
headingLevel: defaultAccordionConfig.itemHeadingLevel
|
|
60
|
-
};
|
|
61
|
-
const coreAccordionItemProps = Object.keys(defaultItemConfig);
|
|
62
|
-
function getAccordionDefaultConfig() {
|
|
63
|
-
return { ...defaultAccordionConfig };
|
|
64
|
-
}
|
|
65
|
-
const configAccordionValidator = {
|
|
66
|
-
closeOthers: utils_writables.typeBoolean,
|
|
67
|
-
onItemShown: utils_writables.typeFunction,
|
|
68
|
-
onItemHidden: utils_writables.typeFunction,
|
|
69
|
-
className: utils_writables.typeString,
|
|
70
|
-
itemDestroyOnHide: utils_writables.typeBoolean,
|
|
71
|
-
itemAnimated: utils_writables.typeBoolean,
|
|
72
|
-
itemTransition: utils_writables.typeFunction,
|
|
73
|
-
itemClassName: utils_writables.typeString,
|
|
74
|
-
itemHeaderClassName: utils_writables.typeString,
|
|
75
|
-
itemButtonClassName: utils_writables.typeString,
|
|
76
|
-
itemBodyContainerClassName: utils_writables.typeString,
|
|
77
|
-
itemBodyClassName: utils_writables.typeString,
|
|
78
|
-
itemHeadingLevel: utils_writables.createTypeEnum([1, 2, 3, 4, 5, 6])
|
|
79
|
-
};
|
|
80
|
-
const configItemValidator = {
|
|
81
|
-
id: utils_writables.typeString,
|
|
82
|
-
destroyOnHide: utils_writables.typeBoolean,
|
|
83
|
-
disabled: utils_writables.typeBoolean,
|
|
84
|
-
visible: utils_writables.typeBoolean,
|
|
85
|
-
animated: utils_writables.typeBoolean,
|
|
86
|
-
transition: utils_writables.typeFunction,
|
|
87
|
-
onShown: utils_writables.typeFunction,
|
|
88
|
-
onHidden: utils_writables.typeFunction,
|
|
89
|
-
onVisibleChange: utils_writables.typeFunction,
|
|
90
|
-
className: utils_writables.typeString,
|
|
91
|
-
headerClassName: utils_writables.typeString,
|
|
92
|
-
buttonClassName: utils_writables.typeString,
|
|
93
|
-
bodyContainerClassName: utils_writables.typeString,
|
|
94
|
-
bodyClassName: utils_writables.typeString,
|
|
95
|
-
headingLevel: utils_writables.createTypeEnum([1, 2, 3, 4, 5, 6])
|
|
96
|
-
};
|
|
97
|
-
function createAccordionItem(config) {
|
|
98
|
-
const [
|
|
99
|
-
{
|
|
100
|
-
bodyClassName$,
|
|
101
|
-
buttonClassName$,
|
|
102
|
-
bodyContainerClassName$,
|
|
103
|
-
headerClassName$,
|
|
104
|
-
animated$,
|
|
105
|
-
transition$,
|
|
106
|
-
destroyOnHide$,
|
|
107
|
-
onShown$,
|
|
108
|
-
onHidden$,
|
|
109
|
-
onVisibleChange$,
|
|
110
|
-
visible$,
|
|
111
|
-
id$: _dirtyId$,
|
|
112
|
-
disabled$,
|
|
113
|
-
...stateProps
|
|
114
|
-
},
|
|
115
|
-
patch
|
|
116
|
-
] = utils_stores.writablesForProps(defaultItemConfig, config, configItemValidator);
|
|
117
|
-
const initDone$ = tansu.writable(false);
|
|
118
|
-
const id$ = utils_stores.idWithDefault(_dirtyId$);
|
|
119
|
-
const transition = services_transitions_baseTransitions.createTransition({
|
|
120
|
-
props: {
|
|
121
|
-
transition: transition$,
|
|
122
|
-
visible: visible$,
|
|
123
|
-
onVisibleChange: onVisibleChange$,
|
|
124
|
-
animated: animated$,
|
|
125
|
-
animatedOnInit: false,
|
|
126
|
-
initDone: initDone$,
|
|
127
|
-
onHidden: () => {
|
|
128
|
-
onHidden$()();
|
|
129
|
-
},
|
|
130
|
-
onShown: () => {
|
|
131
|
-
onShown$()();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
const shouldBeInDOM$ = tansu.computed(() => !destroyOnHide$() || !transition.stores.hidden$());
|
|
136
|
-
const toggleDirective = utils_directive.createAttributesDirective(() => ({
|
|
137
|
-
attributes: {
|
|
138
|
-
id: tansu.computed(() => `${id$()}-toggle`),
|
|
139
|
-
"aria-expanded": tansu.computed(() => `${visible$()}`),
|
|
140
|
-
"aria-disabled": tansu.computed(() => `${disabled$()}`),
|
|
141
|
-
"aria-controls": tansu.computed(() => `${id$()}-body-container`),
|
|
142
|
-
disabled: disabled$
|
|
143
|
-
},
|
|
144
|
-
classNames: { collapsed: tansu.computed(() => !visible$()) },
|
|
145
|
-
events: {
|
|
146
|
-
click: () => {
|
|
147
|
-
if (!disabled$()) {
|
|
148
|
-
void transition.api.toggle();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}));
|
|
153
|
-
const transitionDirective = transition.directives.directive;
|
|
154
|
-
const bodyContainerAttrsDirective = utils_directive.createAttributesDirective(() => ({
|
|
155
|
-
attributes: {
|
|
156
|
-
id: tansu.computed(() => `${id$()}-body-container`),
|
|
157
|
-
class: bodyContainerClassName$,
|
|
158
|
-
"aria-labelledby": tansu.computed(() => `${id$()}-toggle`),
|
|
159
|
-
role: tansu.readable("region")
|
|
160
|
-
}
|
|
161
|
-
}));
|
|
162
|
-
return {
|
|
163
|
-
...utils_stores.stateStores({
|
|
164
|
-
visible$,
|
|
165
|
-
id$,
|
|
166
|
-
shouldBeInDOM$,
|
|
167
|
-
disabled$,
|
|
168
|
-
bodyClassName$,
|
|
169
|
-
buttonClassName$,
|
|
170
|
-
bodyContainerClassName$,
|
|
171
|
-
headerClassName$,
|
|
172
|
-
...stateProps
|
|
173
|
-
}),
|
|
174
|
-
patch,
|
|
175
|
-
api: {
|
|
176
|
-
initDone: () => {
|
|
177
|
-
initDone$.set(true);
|
|
178
|
-
},
|
|
179
|
-
collapse: transition.api.hide,
|
|
180
|
-
expand: transition.api.show,
|
|
181
|
-
toggle: (animated) => transition.api.toggle(void 0, animated)
|
|
182
|
-
},
|
|
183
|
-
directives: {
|
|
184
|
-
toggleDirective,
|
|
185
|
-
buttonDirective: utils_directive.mergeDirectives(
|
|
186
|
-
toggleDirective,
|
|
187
|
-
utils_directive.createAttributesDirective(() => ({
|
|
188
|
-
attributes: {
|
|
189
|
-
type: tansu.readable("button"),
|
|
190
|
-
class: buttonClassName$
|
|
191
|
-
}
|
|
192
|
-
}))
|
|
193
|
-
),
|
|
194
|
-
headerDirective: utils_directive.createAttributesDirective(() => ({ attributes: { class: headerClassName$ } })),
|
|
195
|
-
bodyDirective: utils_directive.createAttributesDirective(() => ({ attributes: { class: bodyClassName$ } })),
|
|
196
|
-
transitionDirective,
|
|
197
|
-
bodyContainerAttrsDirective,
|
|
198
|
-
bodyContainerDirective: utils_directive.mergeDirectives(transitionDirective, bodyContainerAttrsDirective),
|
|
199
|
-
itemDirective: utils_func.noop
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
function factoryCreateAccordion(itemFactory = createAccordionItem, accordionItemProps = coreAccordionItemProps, accordionConfig = defaultAccordionConfig, accordionValidator = configAccordionValidator) {
|
|
204
|
-
return utils_widget.createWidgetFactory("accordion", (config) => {
|
|
205
|
-
const [writables, patch] = utils_stores.writablesForProps(accordionConfig, config, accordionValidator);
|
|
206
|
-
const { closeOthers$, onItemShown$, onItemHidden$, className$ } = writables;
|
|
207
|
-
const accordionItemConfig = Object.fromEntries(
|
|
208
|
-
Object.entries(writables).filter((entry) => entry[0].startsWith("item")).map((entry) => [entry[0].charAt(4).toLowerCase() + entry[0].slice(5, -1), entry[1]])
|
|
209
|
-
);
|
|
210
|
-
const itemWidgets$ = utils_directive.registrationArray();
|
|
211
|
-
const openItems$ = tansu.computed(() => {
|
|
212
|
-
const openItems = [];
|
|
213
|
-
itemWidgets$().forEach((item) => {
|
|
214
|
-
if (item.stores.visible$()) {
|
|
215
|
-
openItems.push(item.stores.id$());
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
return openItems;
|
|
219
|
-
});
|
|
220
|
-
const oldOpenItem$ = tansu.writable(openItems$()[0]);
|
|
221
|
-
const checkCloseOthersAction$ = tansu.computed(() => {
|
|
222
|
-
if (closeOthers$()) {
|
|
223
|
-
adjustItemsCloseOthers(itemWidgets$(), openItems$(), oldOpenItem$());
|
|
224
|
-
oldOpenItem$.set(openItems$()[0]);
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
const action$ = tansu.computed(() => {
|
|
228
|
-
checkCloseOthersAction$();
|
|
229
|
-
});
|
|
230
|
-
return {
|
|
231
|
-
...utils_stores.stateStores({ itemWidgets$, className$ }),
|
|
232
|
-
patch,
|
|
233
|
-
api: {
|
|
234
|
-
expand: async (id, animated) => {
|
|
235
|
-
await getItem(itemWidgets$(), id)?.api.expand(animated);
|
|
236
|
-
},
|
|
237
|
-
collapse: async (id, animated) => {
|
|
238
|
-
await getItem(itemWidgets$(), id)?.api.collapse(animated);
|
|
239
|
-
},
|
|
240
|
-
toggle: async (id, animated) => {
|
|
241
|
-
await getItem(itemWidgets$(), id)?.api.toggle(animated);
|
|
242
|
-
},
|
|
243
|
-
expandAll: async (animated) => {
|
|
244
|
-
await Promise.all(itemWidgets$().map((i) => i.api.expand(animated)));
|
|
245
|
-
},
|
|
246
|
-
collapseAll: async (animated) => {
|
|
247
|
-
await Promise.all(itemWidgets$().map((i) => i.api.collapse(animated)));
|
|
248
|
-
},
|
|
249
|
-
registerItem: (propsConfig) => {
|
|
250
|
-
const itemProps = accordionItemProps;
|
|
251
|
-
const config2 = utils_stores.mergeConfigStores(
|
|
252
|
-
itemProps,
|
|
253
|
-
utils_stores.normalizeConfigStores(itemProps, propsConfig?.config),
|
|
254
|
-
accordionItemConfig
|
|
255
|
-
);
|
|
256
|
-
const [{ onHidden$, onShown$ }] = utils_stores.writablesForProps(
|
|
257
|
-
{
|
|
258
|
-
onHidden: defaultItemConfig.onHidden,
|
|
259
|
-
onShown: defaultItemConfig.onShown
|
|
260
|
-
},
|
|
261
|
-
{ config: config2, props: propsConfig?.props }
|
|
262
|
-
);
|
|
263
|
-
const item = itemFactory({
|
|
264
|
-
config: config2,
|
|
265
|
-
props: {
|
|
266
|
-
...propsConfig?.props,
|
|
267
|
-
onHidden: tansu.asWritable(
|
|
268
|
-
tansu.readable(() => {
|
|
269
|
-
onItemHidden$()(item.stores.id$());
|
|
270
|
-
onHidden$()?.();
|
|
271
|
-
}),
|
|
272
|
-
(val) => {
|
|
273
|
-
onItemHidden$.set(val);
|
|
274
|
-
}
|
|
275
|
-
),
|
|
276
|
-
onShown: tansu.asWritable(
|
|
277
|
-
tansu.readable(() => {
|
|
278
|
-
onItemShown$()(item.stores.id$());
|
|
279
|
-
onShown$()?.();
|
|
280
|
-
}),
|
|
281
|
-
(val) => {
|
|
282
|
-
onItemShown$.set(val);
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
item.directives.itemDirective = utils_directive.mergeDirectives(
|
|
288
|
-
() => ({
|
|
289
|
-
destroy: itemWidgets$.register(item)
|
|
290
|
-
}),
|
|
291
|
-
utils_directive.createAttributesDirective(() => ({
|
|
292
|
-
attributes: { class: item.stores.className$, id: item.stores.id$ }
|
|
293
|
-
}))
|
|
294
|
-
);
|
|
295
|
-
return item;
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
directives: {
|
|
299
|
-
accordionDirective: utils_directive.mergeDirectives(
|
|
300
|
-
utils_directive.directiveSubscribe(action$),
|
|
301
|
-
utils_directive.createAttributesDirective(() => ({
|
|
302
|
-
attributes: { class: className$ },
|
|
303
|
-
classNames: { "au-accordion": utils_stores.true$ }
|
|
304
|
-
}))
|
|
305
|
-
)
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
const createAccordion = factoryCreateAccordion();
|
|
311
|
-
exports.createAccordion = createAccordion;
|
|
312
|
-
exports.createAccordionItem = createAccordionItem;
|
|
313
|
-
exports.factoryCreateAccordion = factoryCreateAccordion;
|
|
314
|
-
exports.getAccordionDefaultConfig = getAccordionDefaultConfig;
|
package/alert-AhaliJ17.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const common = require("./common-B5jS-Ih_.cjs");
|
|
3
|
-
const utils_widget = require("./utils/widget.cjs");
|
|
4
|
-
function getAlertDefaultConfig() {
|
|
5
|
-
return { ...common.getCommonAlertDefaultConfig() };
|
|
6
|
-
}
|
|
7
|
-
const createAlert = utils_widget.createWidgetFactory("alert", common.createCommonAlert);
|
|
8
|
-
exports.createAlert = createAlert;
|
|
9
|
-
exports.getAlertDefaultConfig = getAlertDefaultConfig;
|
package/alert-Cb9FhbFQ.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-DFyZvkII.js";
|
|
2
|
-
import { createWidgetFactory } from "./utils/widget.js";
|
|
3
|
-
function getAlertDefaultConfig() {
|
|
4
|
-
return { ...getCommonAlertDefaultConfig() };
|
|
5
|
-
}
|
|
6
|
-
const createAlert = createWidgetFactory("alert", createCommonAlert);
|
|
7
|
-
export {
|
|
8
|
-
createAlert as c,
|
|
9
|
-
getAlertDefaultConfig as g
|
|
10
|
-
};
|
package/collapse-BnWw4Hnc.cjs
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
|
|
3
|
-
const utils_stores = require("./utils/stores.cjs");
|
|
4
|
-
const utils_directive = require("./directive-DyTodNPd.cjs");
|
|
5
|
-
const utils_writables = require("./writables-Dt68gADJ.cjs");
|
|
6
|
-
const tansu = require("@amadeus-it-group/tansu");
|
|
7
|
-
const utils_func = require("./utils/func.cjs");
|
|
8
|
-
const utils_widget = require("./utils/widget.cjs");
|
|
9
|
-
const defaultCollapseConfig = {
|
|
10
|
-
visible: false,
|
|
11
|
-
onVisibleChange: utils_func.noop,
|
|
12
|
-
onShown: utils_func.noop,
|
|
13
|
-
onHidden: utils_func.noop,
|
|
14
|
-
animated: true,
|
|
15
|
-
animatedOnInit: false,
|
|
16
|
-
id: "",
|
|
17
|
-
transition: utils_func.noop
|
|
18
|
-
};
|
|
19
|
-
function getCollapseDefaultConfig() {
|
|
20
|
-
return { ...defaultCollapseConfig };
|
|
21
|
-
}
|
|
22
|
-
const commonCollapseConfigValidator = {
|
|
23
|
-
onVisibleChange: utils_writables.typeFunction,
|
|
24
|
-
onHidden: utils_writables.typeFunction,
|
|
25
|
-
onShown: utils_writables.typeFunction,
|
|
26
|
-
animatedOnInit: utils_writables.typeBoolean,
|
|
27
|
-
animated: utils_writables.typeBoolean,
|
|
28
|
-
visible: utils_writables.typeBoolean,
|
|
29
|
-
id: utils_writables.typeString,
|
|
30
|
-
transition: utils_writables.typeFunction
|
|
31
|
-
};
|
|
32
|
-
const createCollapse = utils_widget.createWidgetFactory(
|
|
33
|
-
"collapse",
|
|
34
|
-
(config) => {
|
|
35
|
-
const [
|
|
36
|
-
{
|
|
37
|
-
transition$,
|
|
38
|
-
animatedOnInit$,
|
|
39
|
-
animated$,
|
|
40
|
-
visible$: requestedVisible$,
|
|
41
|
-
onVisibleChange$,
|
|
42
|
-
onHidden$,
|
|
43
|
-
onShown$,
|
|
44
|
-
id$: _dirtyId$,
|
|
45
|
-
...stateProps
|
|
46
|
-
},
|
|
47
|
-
patch
|
|
48
|
-
] = utils_stores.writablesForProps(defaultCollapseConfig, config, commonCollapseConfigValidator);
|
|
49
|
-
const id$ = utils_stores.idWithDefault(_dirtyId$);
|
|
50
|
-
const transition = services_transitions_baseTransitions.createTransition({
|
|
51
|
-
props: {
|
|
52
|
-
transition: transition$,
|
|
53
|
-
visible: requestedVisible$,
|
|
54
|
-
animated: animated$,
|
|
55
|
-
animatedOnInit: animatedOnInit$,
|
|
56
|
-
onVisibleChange: onVisibleChange$,
|
|
57
|
-
onHidden: onHidden$,
|
|
58
|
-
onShown: onShown$
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const visible$ = transition.stores.visible$;
|
|
62
|
-
const hidden$ = transition.stores.hidden$;
|
|
63
|
-
return {
|
|
64
|
-
...utils_stores.stateStores({ ...stateProps, visible$, hidden$ }),
|
|
65
|
-
patch,
|
|
66
|
-
api: {
|
|
67
|
-
open: transition.api.show,
|
|
68
|
-
close: transition.api.hide,
|
|
69
|
-
toggle: (animated) => transition.api.toggle(void 0, animated)
|
|
70
|
-
},
|
|
71
|
-
directives: {
|
|
72
|
-
collapseDirective: utils_directive.mergeDirectives(
|
|
73
|
-
transition.directives.directive,
|
|
74
|
-
utils_directive.createAttributesDirective(() => ({
|
|
75
|
-
attributes: {
|
|
76
|
-
id: id$
|
|
77
|
-
}
|
|
78
|
-
}))
|
|
79
|
-
),
|
|
80
|
-
triggerDirective: utils_directive.createAttributesDirective(() => ({
|
|
81
|
-
attributes: {
|
|
82
|
-
"aria-expanded": tansu.computed(() => `${visible$()}`),
|
|
83
|
-
"aria-controls": id$
|
|
84
|
-
},
|
|
85
|
-
events: {
|
|
86
|
-
click: () => void transition.api.toggle()
|
|
87
|
-
}
|
|
88
|
-
}))
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
exports.createCollapse = createCollapse;
|
|
94
|
-
exports.getCollapseDefaultConfig = getCollapseDefaultConfig;
|