@design-factory/core 21.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/accordion-B0vs8JWM.cjs +314 -0
- package/accordion-D9ba0XYq.js +315 -0
- package/alert-AhaliJ17.cjs +9 -0
- package/alert-Cb9FhbFQ.js +10 -0
- package/collapse-Bn8iHKrd.js +95 -0
- package/collapse-BnWw4Hnc.cjs +94 -0
- package/common-B5jS-Ih_.cjs +73 -0
- package/common-DFyZvkII.js +74 -0
- package/components/accordion/accordion.d.ts +333 -0
- package/components/accordion/index.cjs +7 -0
- package/components/accordion/index.d.ts +1 -0
- package/components/accordion/index.js +7 -0
- package/components/alert/alert.d.ts +37 -0
- package/components/alert/common.d.ts +138 -0
- package/components/alert/index.cjs +5 -0
- package/components/alert/index.d.ts +1 -0
- package/components/alert/index.js +5 -0
- package/components/carousel/carousel.d.ts +247 -0
- package/components/carousel/index.cjs +292 -0
- package/components/carousel/index.d.ts +1 -0
- package/components/carousel/index.js +292 -0
- package/components/collapse/collapse.d.ts +135 -0
- package/components/collapse/index.cjs +5 -0
- package/components/collapse/index.d.ts +1 -0
- package/components/collapse/index.js +5 -0
- package/components/commonProps.d.ts +11 -0
- package/components/drawer/drawer.d.ts +279 -0
- package/components/drawer/index.cjs +5 -0
- package/components/drawer/index.d.ts +1 -0
- package/components/drawer/index.js +5 -0
- package/components/modal/index.cjs +8 -0
- package/components/modal/index.d.ts +1 -0
- package/components/modal/index.js +8 -0
- package/components/modal/modal.d.ts +245 -0
- package/components/pagination/index.cjs +5 -0
- package/components/pagination/index.d.ts +1 -0
- package/components/pagination/index.js +5 -0
- package/components/pagination/pagination.d.ts +313 -0
- package/components/progressbar/index.cjs +5 -0
- package/components/progressbar/index.d.ts +1 -0
- package/components/progressbar/index.js +5 -0
- package/components/progressbar/progressbar.d.ts +91 -0
- package/components/rating/index.cjs +5 -0
- package/components/rating/index.d.ts +1 -0
- package/components/rating/index.js +5 -0
- package/components/rating/rating.d.ts +191 -0
- package/components/slider/index.cjs +5 -0
- package/components/slider/index.d.ts +1 -0
- package/components/slider/index.js +5 -0
- package/components/slider/slider-utils.d.ts +25 -0
- package/components/slider/slider.d.ts +383 -0
- package/components/toast/index.cjs +7 -0
- package/components/toast/index.d.ts +2 -0
- package/components/toast/index.js +7 -0
- package/components/toast/toast.d.ts +66 -0
- package/components/toast/toaster.d.ts +128 -0
- package/components/tree/index.cjs +5 -0
- package/components/tree/index.d.ts +1 -0
- package/components/tree/index.js +5 -0
- package/components/tree/tree.d.ts +143 -0
- package/config.cjs +36 -0
- package/config.d.ts +117 -0
- package/config.js +36 -0
- package/directive-CNNSo5Yn.js +524 -0
- package/directive-DyTodNPd.cjs +523 -0
- package/drawer-BIIfJa0F.js +329 -0
- package/drawer-C8ojtwIn.cjs +328 -0
- package/index.cjs +134 -0
- package/index.d.ts +29 -0
- package/index.js +134 -0
- package/isFocusable-Ckwus82R.js +32 -0
- package/isFocusable-DfzDLeAN.cjs +31 -0
- package/modal-C13G13jV.js +253 -0
- package/modal-DWv0VqiG.cjs +252 -0
- package/package.json +56 -0
- package/pagination-BLVa1UsZ.cjs +254 -0
- package/pagination-BQWusWXN.js +255 -0
- package/progressbar-RopgvVeA.cjs +86 -0
- package/progressbar-S1pNn5rM.js +87 -0
- package/promise-CxCD3NYv.cjs +118 -0
- package/promise-D-RZVPuv.js +119 -0
- package/rating-DWgGgwk3.js +184 -0
- package/rating-DZ3OQgtt.cjs +183 -0
- package/scrollbars-CT87iv_6.cjs +30 -0
- package/scrollbars-CcxSrnCx.js +31 -0
- package/services/extendWidget.cjs +41 -0
- package/services/extendWidget.d.ts +31 -0
- package/services/extendWidget.js +41 -0
- package/services/floatingUI.cjs +111 -0
- package/services/floatingUI.d.ts +76 -0
- package/services/floatingUI.js +111 -0
- package/services/focusElement.cjs +46 -0
- package/services/focusElement.d.ts +9 -0
- package/services/focusElement.js +46 -0
- package/services/focustrack.cjs +47 -0
- package/services/focustrack.d.ts +40 -0
- package/services/focustrack.js +47 -0
- package/services/hash.cjs +15 -0
- package/services/hash.d.ts +3 -0
- package/services/hash.js +15 -0
- package/services/intersection.cjs +53 -0
- package/services/intersection.d.ts +30 -0
- package/services/intersection.js +53 -0
- package/services/matchMedia.cjs +14 -0
- package/services/matchMedia.d.ts +8 -0
- package/services/matchMedia.js +14 -0
- package/services/navManager.cjs +166 -0
- package/services/navManager.d.ts +144 -0
- package/services/navManager.js +166 -0
- package/services/pointerdownPosition.cjs +60 -0
- package/services/pointerdownPosition.d.ts +42 -0
- package/services/pointerdownPosition.js +60 -0
- package/services/portal.cjs +42 -0
- package/services/portal.d.ts +16 -0
- package/services/portal.js +42 -0
- package/services/resizeObserver.cjs +54 -0
- package/services/resizeObserver.d.ts +18 -0
- package/services/resizeObserver.js +54 -0
- package/services/siblingsInert.cjs +44 -0
- package/services/siblingsInert.d.ts +16 -0
- package/services/siblingsInert.js +44 -0
- package/services/transitions/baseTransitions.cjs +186 -0
- package/services/transitions/baseTransitions.d.ts +166 -0
- package/services/transitions/baseTransitions.js +186 -0
- package/services/transitions/collapse.cjs +40 -0
- package/services/transitions/collapse.d.ts +49 -0
- package/services/transitions/collapse.js +40 -0
- package/services/transitions/cssTransitions.cjs +32 -0
- package/services/transitions/cssTransitions.d.ts +25 -0
- package/services/transitions/cssTransitions.js +32 -0
- package/services/transitions/simpleClassTransition.cjs +37 -0
- package/services/transitions/simpleClassTransition.d.ts +47 -0
- package/services/transitions/simpleClassTransition.js +37 -0
- package/slider-Br_Qiopx.js +808 -0
- package/slider-pgDq1V5r.cjs +807 -0
- package/textDirection-cNgt24LJ.js +4 -0
- package/textDirection-zqcZ5-eK.cjs +3 -0
- package/toaster-BUBzFeJM.js +162 -0
- package/toaster-Dlube4Ya.cjs +161 -0
- package/tree-Chcy4ulJ.cjs +228 -0
- package/tree-vD7ZkV8Z.js +229 -0
- package/types.cjs +6 -0
- package/types.d.ts +246 -0
- package/types.js +6 -0
- package/utils/directive.cjs +28 -0
- package/utils/directive.d.ts +352 -0
- package/utils/directive.js +28 -0
- package/utils/func.cjs +7 -0
- package/utils/func.d.ts +11 -0
- package/utils/func.js +7 -0
- package/utils/id.cjs +5 -0
- package/utils/id.d.ts +6 -0
- package/utils/id.js +5 -0
- package/utils/internal/assign.d.ts +10 -0
- package/utils/internal/checks.d.ts +57 -0
- package/utils/internal/dom.d.ts +75 -0
- package/utils/internal/isFocusable.d.ts +9 -0
- package/utils/internal/math.d.ts +5 -0
- package/utils/internal/promise.d.ts +98 -0
- package/utils/internal/scrollbars.d.ts +8 -0
- package/utils/internal/sort.d.ts +16 -0
- package/utils/internal/ssrHTMLElement.d.ts +17 -0
- package/utils/internal/textDirection.d.ts +7 -0
- package/utils/internal/traversal.d.ts +54 -0
- package/utils/stores.cjs +172 -0
- package/utils/stores.d.ts +224 -0
- package/utils/stores.js +172 -0
- package/utils/widget.cjs +8 -0
- package/utils/widget.d.ts +11 -0
- package/utils/widget.js +8 -0
- package/utils/writables.cjs +16 -0
- package/utils/writables.d.ts +95 -0
- package/utils/writables.js +16 -0
- package/writables-DYGjj5T3.js +103 -0
- package/writables-Dt68gADJ.cjs +102 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createTransition } from "./services/transitions/baseTransitions.js";
|
|
2
|
+
import { writablesForProps, idWithDefault, stateStores } from "./utils/stores.js";
|
|
3
|
+
import { g as createAttributesDirective, s as mergeDirectives } from "./directive-CNNSo5Yn.js";
|
|
4
|
+
import { e as typeFunction, j as typeString, b as typeBoolean } from "./writables-DYGjj5T3.js";
|
|
5
|
+
import { computed } from "@amadeus-it-group/tansu";
|
|
6
|
+
import { noop } from "./utils/func.js";
|
|
7
|
+
import { createWidgetFactory } from "./utils/widget.js";
|
|
8
|
+
const defaultCollapseConfig = {
|
|
9
|
+
visible: false,
|
|
10
|
+
onVisibleChange: noop,
|
|
11
|
+
onShown: noop,
|
|
12
|
+
onHidden: noop,
|
|
13
|
+
animated: true,
|
|
14
|
+
animatedOnInit: false,
|
|
15
|
+
id: "",
|
|
16
|
+
transition: noop
|
|
17
|
+
};
|
|
18
|
+
function getCollapseDefaultConfig() {
|
|
19
|
+
return { ...defaultCollapseConfig };
|
|
20
|
+
}
|
|
21
|
+
const commonCollapseConfigValidator = {
|
|
22
|
+
onVisibleChange: typeFunction,
|
|
23
|
+
onHidden: typeFunction,
|
|
24
|
+
onShown: typeFunction,
|
|
25
|
+
animatedOnInit: typeBoolean,
|
|
26
|
+
animated: typeBoolean,
|
|
27
|
+
visible: typeBoolean,
|
|
28
|
+
id: typeString,
|
|
29
|
+
transition: typeFunction
|
|
30
|
+
};
|
|
31
|
+
const createCollapse = createWidgetFactory(
|
|
32
|
+
"collapse",
|
|
33
|
+
(config) => {
|
|
34
|
+
const [
|
|
35
|
+
{
|
|
36
|
+
transition$,
|
|
37
|
+
animatedOnInit$,
|
|
38
|
+
animated$,
|
|
39
|
+
visible$: requestedVisible$,
|
|
40
|
+
onVisibleChange$,
|
|
41
|
+
onHidden$,
|
|
42
|
+
onShown$,
|
|
43
|
+
id$: _dirtyId$,
|
|
44
|
+
...stateProps
|
|
45
|
+
},
|
|
46
|
+
patch
|
|
47
|
+
] = writablesForProps(defaultCollapseConfig, config, commonCollapseConfigValidator);
|
|
48
|
+
const id$ = idWithDefault(_dirtyId$);
|
|
49
|
+
const transition = createTransition({
|
|
50
|
+
props: {
|
|
51
|
+
transition: transition$,
|
|
52
|
+
visible: requestedVisible$,
|
|
53
|
+
animated: animated$,
|
|
54
|
+
animatedOnInit: animatedOnInit$,
|
|
55
|
+
onVisibleChange: onVisibleChange$,
|
|
56
|
+
onHidden: onHidden$,
|
|
57
|
+
onShown: onShown$
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const visible$ = transition.stores.visible$;
|
|
61
|
+
const hidden$ = transition.stores.hidden$;
|
|
62
|
+
return {
|
|
63
|
+
...stateStores({ ...stateProps, visible$, hidden$ }),
|
|
64
|
+
patch,
|
|
65
|
+
api: {
|
|
66
|
+
open: transition.api.show,
|
|
67
|
+
close: transition.api.hide,
|
|
68
|
+
toggle: (animated) => transition.api.toggle(void 0, animated)
|
|
69
|
+
},
|
|
70
|
+
directives: {
|
|
71
|
+
collapseDirective: mergeDirectives(
|
|
72
|
+
transition.directives.directive,
|
|
73
|
+
createAttributesDirective(() => ({
|
|
74
|
+
attributes: {
|
|
75
|
+
id: id$
|
|
76
|
+
}
|
|
77
|
+
}))
|
|
78
|
+
),
|
|
79
|
+
triggerDirective: createAttributesDirective(() => ({
|
|
80
|
+
attributes: {
|
|
81
|
+
"aria-expanded": computed(() => `${visible$()}`),
|
|
82
|
+
"aria-controls": id$
|
|
83
|
+
},
|
|
84
|
+
events: {
|
|
85
|
+
click: () => void transition.api.toggle()
|
|
86
|
+
}
|
|
87
|
+
}))
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
export {
|
|
93
|
+
createCollapse as c,
|
|
94
|
+
getCollapseDefaultConfig as g
|
|
95
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
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;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
|
|
3
|
+
const utils_func = require("./utils/func.cjs");
|
|
4
|
+
const utils_stores = require("./utils/stores.cjs");
|
|
5
|
+
const utils_writables = require("./writables-Dt68gADJ.cjs");
|
|
6
|
+
const defaultCommonAlertConfig = {
|
|
7
|
+
visible: true,
|
|
8
|
+
dismissible: true,
|
|
9
|
+
ariaCloseButtonLabel: "Close",
|
|
10
|
+
onVisibleChange: utils_func.noop,
|
|
11
|
+
onShown: utils_func.noop,
|
|
12
|
+
onHidden: utils_func.noop,
|
|
13
|
+
animated: true,
|
|
14
|
+
animatedOnInit: false,
|
|
15
|
+
transition: utils_func.noop,
|
|
16
|
+
className: ""
|
|
17
|
+
};
|
|
18
|
+
function getCommonAlertDefaultConfig() {
|
|
19
|
+
return { ...defaultCommonAlertConfig };
|
|
20
|
+
}
|
|
21
|
+
const commonAlertConfigValidator = {
|
|
22
|
+
dismissible: utils_writables.typeBoolean,
|
|
23
|
+
onVisibleChange: utils_writables.typeFunction,
|
|
24
|
+
onHidden: utils_writables.typeFunction,
|
|
25
|
+
onShown: utils_writables.typeFunction,
|
|
26
|
+
transition: utils_writables.typeFunction,
|
|
27
|
+
animatedOnInit: utils_writables.typeBoolean,
|
|
28
|
+
animated: utils_writables.typeBoolean,
|
|
29
|
+
visible: utils_writables.typeBoolean,
|
|
30
|
+
ariaCloseButtonLabel: utils_writables.typeString,
|
|
31
|
+
className: utils_writables.typeString
|
|
32
|
+
};
|
|
33
|
+
function createCommonAlert(config) {
|
|
34
|
+
const [
|
|
35
|
+
{
|
|
36
|
+
transition$,
|
|
37
|
+
animatedOnInit$,
|
|
38
|
+
animated$,
|
|
39
|
+
visible$: requestedVisible$,
|
|
40
|
+
onVisibleChange$,
|
|
41
|
+
onHidden$,
|
|
42
|
+
onShown$,
|
|
43
|
+
...stateProps
|
|
44
|
+
},
|
|
45
|
+
patch
|
|
46
|
+
] = utils_stores.writablesForProps(defaultCommonAlertConfig, config, commonAlertConfigValidator);
|
|
47
|
+
const transition = services_transitions_baseTransitions.createTransition({
|
|
48
|
+
props: {
|
|
49
|
+
transition: transition$,
|
|
50
|
+
visible: requestedVisible$,
|
|
51
|
+
animated: animated$,
|
|
52
|
+
animatedOnInit: animatedOnInit$,
|
|
53
|
+
onVisibleChange: onVisibleChange$,
|
|
54
|
+
onHidden: onHidden$,
|
|
55
|
+
onShown: onShown$
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const visible$ = transition.stores.visible$;
|
|
59
|
+
const hidden$ = transition.stores.hidden$;
|
|
60
|
+
return {
|
|
61
|
+
...utils_stores.stateStores({ ...stateProps, visible$, hidden$ }),
|
|
62
|
+
patch,
|
|
63
|
+
api: {
|
|
64
|
+
open: transition.api.show,
|
|
65
|
+
close: transition.api.hide
|
|
66
|
+
},
|
|
67
|
+
directives: {
|
|
68
|
+
transitionDirective: transition.directives.directive
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
exports.createCommonAlert = createCommonAlert;
|
|
73
|
+
exports.getCommonAlertDefaultConfig = getCommonAlertDefaultConfig;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createTransition } from "./services/transitions/baseTransitions.js";
|
|
2
|
+
import { noop } from "./utils/func.js";
|
|
3
|
+
import { writablesForProps, stateStores } from "./utils/stores.js";
|
|
4
|
+
import { j as typeString, b as typeBoolean, e as typeFunction } from "./writables-DYGjj5T3.js";
|
|
5
|
+
const defaultCommonAlertConfig = {
|
|
6
|
+
visible: true,
|
|
7
|
+
dismissible: true,
|
|
8
|
+
ariaCloseButtonLabel: "Close",
|
|
9
|
+
onVisibleChange: noop,
|
|
10
|
+
onShown: noop,
|
|
11
|
+
onHidden: noop,
|
|
12
|
+
animated: true,
|
|
13
|
+
animatedOnInit: false,
|
|
14
|
+
transition: noop,
|
|
15
|
+
className: ""
|
|
16
|
+
};
|
|
17
|
+
function getCommonAlertDefaultConfig() {
|
|
18
|
+
return { ...defaultCommonAlertConfig };
|
|
19
|
+
}
|
|
20
|
+
const commonAlertConfigValidator = {
|
|
21
|
+
dismissible: typeBoolean,
|
|
22
|
+
onVisibleChange: typeFunction,
|
|
23
|
+
onHidden: typeFunction,
|
|
24
|
+
onShown: typeFunction,
|
|
25
|
+
transition: typeFunction,
|
|
26
|
+
animatedOnInit: typeBoolean,
|
|
27
|
+
animated: typeBoolean,
|
|
28
|
+
visible: typeBoolean,
|
|
29
|
+
ariaCloseButtonLabel: typeString,
|
|
30
|
+
className: typeString
|
|
31
|
+
};
|
|
32
|
+
function createCommonAlert(config) {
|
|
33
|
+
const [
|
|
34
|
+
{
|
|
35
|
+
transition$,
|
|
36
|
+
animatedOnInit$,
|
|
37
|
+
animated$,
|
|
38
|
+
visible$: requestedVisible$,
|
|
39
|
+
onVisibleChange$,
|
|
40
|
+
onHidden$,
|
|
41
|
+
onShown$,
|
|
42
|
+
...stateProps
|
|
43
|
+
},
|
|
44
|
+
patch
|
|
45
|
+
] = writablesForProps(defaultCommonAlertConfig, config, commonAlertConfigValidator);
|
|
46
|
+
const transition = createTransition({
|
|
47
|
+
props: {
|
|
48
|
+
transition: transition$,
|
|
49
|
+
visible: requestedVisible$,
|
|
50
|
+
animated: animated$,
|
|
51
|
+
animatedOnInit: animatedOnInit$,
|
|
52
|
+
onVisibleChange: onVisibleChange$,
|
|
53
|
+
onHidden: onHidden$,
|
|
54
|
+
onShown: onShown$
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const visible$ = transition.stores.visible$;
|
|
58
|
+
const hidden$ = transition.stores.hidden$;
|
|
59
|
+
return {
|
|
60
|
+
...stateStores({ ...stateProps, visible$, hidden$ }),
|
|
61
|
+
patch,
|
|
62
|
+
api: {
|
|
63
|
+
open: transition.api.show,
|
|
64
|
+
close: transition.api.hide
|
|
65
|
+
},
|
|
66
|
+
directives: {
|
|
67
|
+
transitionDirective: transition.directives.directive
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
createCommonAlert as c,
|
|
73
|
+
getCommonAlertDefaultConfig as g
|
|
74
|
+
};
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import type { TransitionFn } from '../../services/transitions/baseTransitions';
|
|
2
|
+
import type { ConfigValidator, Directive, PropsConfig, Widget, WidgetFactory } from '../../types';
|
|
3
|
+
import type { WidgetsCommonPropsAndState } from '../commonProps';
|
|
4
|
+
/**
|
|
5
|
+
* Properties for the Accordion component.
|
|
6
|
+
*/
|
|
7
|
+
export interface AccordionProps extends WidgetsCommonPropsAndState {
|
|
8
|
+
/**
|
|
9
|
+
* If `true`, only one accordion-item at the time can stay open.
|
|
10
|
+
*
|
|
11
|
+
* @defaultValue `false`
|
|
12
|
+
*/
|
|
13
|
+
closeOthers: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* An event fired when an item is shown.
|
|
16
|
+
*
|
|
17
|
+
* Event payload is the id of the item.
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue
|
|
20
|
+
* ```ts
|
|
21
|
+
* () => {}
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
onItemShown: (itemId: string) => void;
|
|
25
|
+
/**
|
|
26
|
+
* An event fired when an item is hidden.
|
|
27
|
+
*
|
|
28
|
+
* Event payload is the id of the item.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue
|
|
31
|
+
* ```ts
|
|
32
|
+
* () => {}
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
onItemHidden: (itemId: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* If `true`, the accordion-item body container will be removed from the DOM when the accordion-item is collapsed. It will be just hidden otherwise.
|
|
38
|
+
*
|
|
39
|
+
* @defaultValue `true`
|
|
40
|
+
*/
|
|
41
|
+
itemDestroyOnHide: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If `true`, accordion-item will be animated.
|
|
44
|
+
*
|
|
45
|
+
* @defaultValue `true`
|
|
46
|
+
*/
|
|
47
|
+
itemAnimated: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The transition to use for the accordion-item body-container when the accordion-item is toggled.
|
|
50
|
+
*
|
|
51
|
+
* @defaultValue
|
|
52
|
+
* ```ts
|
|
53
|
+
* () => {}
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
itemTransition: TransitionFn;
|
|
57
|
+
/**
|
|
58
|
+
* CSS classes to add on the accordion-item DOM element.
|
|
59
|
+
*
|
|
60
|
+
* @defaultValue `''`
|
|
61
|
+
*/
|
|
62
|
+
itemClassName: string;
|
|
63
|
+
/**
|
|
64
|
+
* CSS classes to add on the accordion-item header DOM element.
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue `''`
|
|
67
|
+
*/
|
|
68
|
+
itemHeaderClassName: string;
|
|
69
|
+
/**
|
|
70
|
+
* CSS classes to add on the accordion-item toggle button DOM element.
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue `''`
|
|
73
|
+
*/
|
|
74
|
+
itemButtonClassName: string;
|
|
75
|
+
/**
|
|
76
|
+
* CSS classes to add on the accordion-item body container DOM element.
|
|
77
|
+
* The accordion-item body container is the DOM element on what the itemTransition is applied.
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue `''`
|
|
80
|
+
*/
|
|
81
|
+
itemBodyContainerClassName: string;
|
|
82
|
+
/**
|
|
83
|
+
* CSS classes to add on the accordion-item body DOM element.
|
|
84
|
+
*
|
|
85
|
+
* @defaultValue `''`
|
|
86
|
+
*/
|
|
87
|
+
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
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Represents the state of an Accordion component.
|
|
97
|
+
*/
|
|
98
|
+
export interface AccordionState extends WidgetsCommonPropsAndState {
|
|
99
|
+
/**
|
|
100
|
+
* Array containing all the accordion-items contained in the accordion.
|
|
101
|
+
*/
|
|
102
|
+
itemWidgets: AccordionItemWidget[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Interface representing the API for an accordion component.
|
|
106
|
+
*/
|
|
107
|
+
export interface AccordionApi {
|
|
108
|
+
/**
|
|
109
|
+
* Given the itemId, will expand the corresponding accordion-item.
|
|
110
|
+
*
|
|
111
|
+
* If the itemId is not valid, nothing will happen.
|
|
112
|
+
* @returns A promise that resolves when the expand operation is completed.
|
|
113
|
+
*/
|
|
114
|
+
expand(itemId: string, animated?: boolean): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Given the itemId, will collapse the corresponding accordion-item.
|
|
117
|
+
*
|
|
118
|
+
* If the itemId is not valid, nothing will happen.
|
|
119
|
+
* @returns A promise that resolves when the collapse operation is completed.
|
|
120
|
+
*/
|
|
121
|
+
collapse(itemId: string, animated?: boolean): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Given the itemId, will toggle the corresponding accordion-item.
|
|
124
|
+
*
|
|
125
|
+
* @returns A promise that resolves when the toggle operation is completed.
|
|
126
|
+
* If the itemId is not valid, nothing will happen.
|
|
127
|
+
*/
|
|
128
|
+
toggle(itemId: string): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* It will expand all the items in the accordion.
|
|
131
|
+
*
|
|
132
|
+
* If `closeOthers` is `true` it will expand only the last accordion-item.
|
|
133
|
+
*
|
|
134
|
+
* @returns A promise that resolves when all the expand operations are completed.
|
|
135
|
+
*/
|
|
136
|
+
expandAll(animated?: boolean): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* It will collapse all the accordion-items in the accordion.
|
|
139
|
+
*
|
|
140
|
+
* @returns A promise that resolves when all the collapse operations are completed.
|
|
141
|
+
*/
|
|
142
|
+
collapseAll(animated?: boolean): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Creates a new accordionItem.
|
|
145
|
+
*/
|
|
146
|
+
registerItem(itemConfig?: PropsConfig<AccordionItemProps>): AccordionItemWidget;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Interface representing the directives used in the Accordion component.
|
|
150
|
+
*/
|
|
151
|
+
export interface AccordionDirectives {
|
|
152
|
+
/**
|
|
153
|
+
* Directive to put on the accordion DOM element
|
|
154
|
+
*/
|
|
155
|
+
accordionDirective: Directive;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Represents an Accordion widget with specific properties, state, API, and directives.
|
|
159
|
+
*/
|
|
160
|
+
export type AccordionWidget = Widget<AccordionProps, AccordionState, AccordionApi, AccordionDirectives>;
|
|
161
|
+
/**
|
|
162
|
+
* Interface representing the API for an accordion item.
|
|
163
|
+
*/
|
|
164
|
+
export interface AccordionItemApi {
|
|
165
|
+
/**
|
|
166
|
+
* It will collapse the accordion-item.
|
|
167
|
+
* @returns A promise that resolves when the collapse operation is completed.
|
|
168
|
+
*/
|
|
169
|
+
collapse(animated?: boolean): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* It will expand the accordion-item.
|
|
172
|
+
* @returns A promise that resolves when the expand operation is completed.
|
|
173
|
+
*/
|
|
174
|
+
expand(animated?: boolean): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* It will toggle the accordion-item.
|
|
177
|
+
* @returns A promise that resolves when the toggle operation is completed.
|
|
178
|
+
*/
|
|
179
|
+
toggle(animated?: boolean): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Method to be called after the initialization to allow animations.
|
|
182
|
+
*/
|
|
183
|
+
initDone(): void;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Interface representing the directives used in an accordion item.
|
|
187
|
+
*/
|
|
188
|
+
export interface AccordionItemDirectives {
|
|
189
|
+
/**
|
|
190
|
+
* Directive to use in special cases, if the accordion header does not use a button element to control the collapsing.
|
|
191
|
+
*/
|
|
192
|
+
toggleDirective: Directive;
|
|
193
|
+
/**
|
|
194
|
+
* Directive to put on the button element that will control the collapsing of the accordion-item.
|
|
195
|
+
*/
|
|
196
|
+
buttonDirective: Directive;
|
|
197
|
+
/**
|
|
198
|
+
* Directive to put on the accordion-item header that will contain the button element.
|
|
199
|
+
*/
|
|
200
|
+
headerDirective: Directive;
|
|
201
|
+
/**
|
|
202
|
+
* Directive to put on the accordion-item body.
|
|
203
|
+
*/
|
|
204
|
+
bodyDirective: Directive;
|
|
205
|
+
/**
|
|
206
|
+
* Directive to apply the itemTransition
|
|
207
|
+
*/
|
|
208
|
+
transitionDirective: Directive;
|
|
209
|
+
/**
|
|
210
|
+
* Directive to apply aria attributes to the expanded body panel
|
|
211
|
+
*/
|
|
212
|
+
bodyContainerAttrsDirective: Directive;
|
|
213
|
+
/**
|
|
214
|
+
* Directive to be put on the accordion-item body container. It will handle the animation.
|
|
215
|
+
*/
|
|
216
|
+
bodyContainerDirective: Directive;
|
|
217
|
+
/**
|
|
218
|
+
* Directive to be put on the accordion-item. It will handle adding the accordion-item to the accordion.
|
|
219
|
+
*/
|
|
220
|
+
itemDirective: Directive;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Interface representing the common properties and state for an accordion item.
|
|
224
|
+
*/
|
|
225
|
+
interface AccordionItemCommonPropsAndState extends WidgetsCommonPropsAndState {
|
|
226
|
+
/**
|
|
227
|
+
* If `true`, the accordion-item will be visible (expanded). Otherwise, it will be hidden (collapsed).
|
|
228
|
+
*/
|
|
229
|
+
visible: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* If `true`, the accordion-item will be disabled.
|
|
232
|
+
* It will not react to user's clicks, but still will be possible to toggle programmatically.
|
|
233
|
+
*/
|
|
234
|
+
disabled: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* The id of the accordion-item. It can be used for controlling the accordion-item via the accordion api.
|
|
237
|
+
*/
|
|
238
|
+
id: string;
|
|
239
|
+
/**
|
|
240
|
+
* CSS classes to add on the accordion-item header DOM element.
|
|
241
|
+
*/
|
|
242
|
+
headerClassName: string;
|
|
243
|
+
/**
|
|
244
|
+
* CSS classes to add on the accordion-item collapse DOM element.
|
|
245
|
+
*/
|
|
246
|
+
buttonClassName: string;
|
|
247
|
+
/**
|
|
248
|
+
* CSS classes to add on the accordion-item body container DOM element.
|
|
249
|
+
* The accordion-item body container is the DOM element on what the itemTransition is applied.
|
|
250
|
+
*/
|
|
251
|
+
bodyContainerClassName: string;
|
|
252
|
+
/**
|
|
253
|
+
* CSS classes to add on the accordion-item body DOM element.
|
|
254
|
+
*/
|
|
255
|
+
bodyClassName: string;
|
|
256
|
+
/**
|
|
257
|
+
* The html heading level to use for the accordion-item-header.
|
|
258
|
+
*/
|
|
259
|
+
headingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Properties for an AccordionItem component.
|
|
263
|
+
*/
|
|
264
|
+
export interface AccordionItemProps extends AccordionItemCommonPropsAndState {
|
|
265
|
+
/**
|
|
266
|
+
* If `true`, accordion-item will be animated.
|
|
267
|
+
*/
|
|
268
|
+
animated: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* The transition to use for the accordion-item body-container when the accordion-item is toggled.
|
|
271
|
+
*/
|
|
272
|
+
transition: TransitionFn;
|
|
273
|
+
/**
|
|
274
|
+
* If `true`, the accordion-item body container will be removed from the DOM when the accordion-item is collapsed. It will be just hidden otherwise.
|
|
275
|
+
*/
|
|
276
|
+
destroyOnHide: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* An event fired when an item is shown.
|
|
279
|
+
*/
|
|
280
|
+
onShown: () => void;
|
|
281
|
+
/**
|
|
282
|
+
* An event fired when an item is hidden.
|
|
283
|
+
*/
|
|
284
|
+
onHidden: () => void;
|
|
285
|
+
/**
|
|
286
|
+
* An event fired when the `visible` value changes.
|
|
287
|
+
*
|
|
288
|
+
* Event payload is the new value of visible.
|
|
289
|
+
*/
|
|
290
|
+
onVisibleChange: (visible: boolean) => void;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Represents the state of an accordion item.
|
|
294
|
+
*/
|
|
295
|
+
export interface AccordionItemState extends AccordionItemCommonPropsAndState {
|
|
296
|
+
/**
|
|
297
|
+
* If `true` the content of the accordion-item collapse should be in DOM. Its value depends on the
|
|
298
|
+
* value of the `visible` and `destroyOnHide`.
|
|
299
|
+
*/
|
|
300
|
+
shouldBeInDOM: boolean;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Represents a widget for an accordion item.
|
|
304
|
+
*/
|
|
305
|
+
export type AccordionItemWidget = Widget<AccordionItemProps, AccordionItemState, AccordionItemApi, AccordionItemDirectives>;
|
|
306
|
+
/**
|
|
307
|
+
* Retrieve a shallow copy of the default accordion config
|
|
308
|
+
* @returns the default accordion config
|
|
309
|
+
*/
|
|
310
|
+
export declare function getAccordionDefaultConfig(): AccordionProps;
|
|
311
|
+
/**
|
|
312
|
+
* Creates a new AccordionItem widget instance.
|
|
313
|
+
* @param config - config of the accordion item, either as a store or as an object containing values or stores.
|
|
314
|
+
* @returns a new accordion item widget instance
|
|
315
|
+
*/
|
|
316
|
+
export declare function createAccordionItem(config?: PropsConfig<AccordionItemProps>): AccordionItemWidget;
|
|
317
|
+
/**
|
|
318
|
+
* Create an accordion WidgetFactory based on an item factory and the list of item props that should inherit from the parent accordion
|
|
319
|
+
*
|
|
320
|
+
* @param itemFactory - the item factory
|
|
321
|
+
* @param accordionItemProps - the list of item props
|
|
322
|
+
* @param accordionConfig - the default accordion config
|
|
323
|
+
* @param accordionValidator - the validator of props
|
|
324
|
+
* @returns the accordion widget factory
|
|
325
|
+
*/
|
|
326
|
+
export declare function factoryCreateAccordion(itemFactory?: WidgetFactory<AccordionItemWidget>, accordionItemProps?: string[], accordionConfig?: AccordionProps, accordionValidator?: ConfigValidator<AccordionProps>): WidgetFactory<AccordionWidget>;
|
|
327
|
+
/**
|
|
328
|
+
* Creates a new Accordion widget instance.
|
|
329
|
+
* @param config - config of the accordion, either as a store or as an object containing values or stores.
|
|
330
|
+
* @returns a new accordion widget instance
|
|
331
|
+
*/
|
|
332
|
+
export declare const createAccordion: WidgetFactory<AccordionWidget>;
|
|
333
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const accordion = require("../../accordion-B0vs8JWM.cjs");
|
|
4
|
+
exports.createAccordion = accordion.createAccordion;
|
|
5
|
+
exports.createAccordionItem = accordion.createAccordionItem;
|
|
6
|
+
exports.factoryCreateAccordion = accordion.factoryCreateAccordion;
|
|
7
|
+
exports.getAccordionDefaultConfig = accordion.getAccordionDefaultConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './accordion';
|