@design-factory/angular 21.0.4 → 21.1.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/drawer/README.md +54 -0
- package/fesm2022/design-factory-angular-drawer.mjs +202 -67
- package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
- package/fesm2022/design-factory-angular-internals.mjs +439 -17
- package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
- package/fesm2022/design-factory-angular-sidenav.mjs +223 -210
- package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
- package/fesm2022/design-factory-angular-theme.mjs +198 -0
- package/fesm2022/design-factory-angular-theme.mjs.map +1 -0
- package/fesm2022/design-factory-angular-topnav.mjs +1538 -0
- package/fesm2022/design-factory-angular-topnav.mjs.map +1 -0
- package/node_modules/@agnos-ui/core/README.md +5 -0
- package/node_modules/@agnos-ui/core/accordion-BC_9xn23.cjs +314 -0
- package/node_modules/@agnos-ui/core/accordion-Ca_0T8Bc.js +315 -0
- package/node_modules/@agnos-ui/core/alert-AhaliJ17.cjs +9 -0
- package/node_modules/@agnos-ui/core/alert-Cb9FhbFQ.js +10 -0
- package/node_modules/@agnos-ui/core/collapse-COriZO7o.cjs +94 -0
- package/node_modules/@agnos-ui/core/collapse-CP79atna.js +95 -0
- package/node_modules/@agnos-ui/core/common-B5jS-Ih_.cjs +73 -0
- package/node_modules/@agnos-ui/core/common-DFyZvkII.js +74 -0
- package/node_modules/@agnos-ui/core/components/accordion/accordion.d.ts +333 -0
- package/node_modules/@agnos-ui/core/components/accordion/index.cjs +7 -0
- package/node_modules/@agnos-ui/core/components/accordion/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/accordion/index.js +7 -0
- package/node_modules/@agnos-ui/core/components/alert/alert.d.ts +37 -0
- package/node_modules/@agnos-ui/core/components/alert/common.d.ts +138 -0
- package/node_modules/@agnos-ui/core/components/alert/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/alert/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/alert/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/carousel/carousel.d.ts +247 -0
- package/node_modules/@agnos-ui/core/components/carousel/index.cjs +292 -0
- package/node_modules/@agnos-ui/core/components/carousel/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/carousel/index.js +292 -0
- package/node_modules/@agnos-ui/core/components/collapse/collapse.d.ts +135 -0
- package/node_modules/@agnos-ui/core/components/collapse/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/collapse/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/collapse/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/commonProps.d.ts +11 -0
- package/node_modules/@agnos-ui/core/components/drawer/drawer.d.ts +279 -0
- package/node_modules/@agnos-ui/core/components/drawer/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/drawer/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/drawer/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/modal/index.cjs +8 -0
- package/node_modules/@agnos-ui/core/components/modal/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/modal/index.js +8 -0
- package/node_modules/@agnos-ui/core/components/modal/modal.d.ts +245 -0
- package/node_modules/@agnos-ui/core/components/pagination/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/pagination/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/pagination/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/pagination/pagination.d.ts +313 -0
- package/node_modules/@agnos-ui/core/components/progressbar/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/progressbar/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/progressbar/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/progressbar/progressbar.d.ts +91 -0
- package/node_modules/@agnos-ui/core/components/rating/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/rating/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/rating/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/rating/rating.d.ts +191 -0
- package/node_modules/@agnos-ui/core/components/slider/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/slider/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/slider/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/slider/slider-utils.d.ts +25 -0
- package/node_modules/@agnos-ui/core/components/slider/slider.d.ts +383 -0
- package/node_modules/@agnos-ui/core/components/toast/index.cjs +7 -0
- package/node_modules/@agnos-ui/core/components/toast/index.d.ts +2 -0
- package/node_modules/@agnos-ui/core/components/toast/index.js +7 -0
- package/node_modules/@agnos-ui/core/components/toast/toast.d.ts +66 -0
- package/node_modules/@agnos-ui/core/components/toast/toaster.d.ts +128 -0
- package/node_modules/@agnos-ui/core/components/tree/index.cjs +5 -0
- package/node_modules/@agnos-ui/core/components/tree/index.d.ts +1 -0
- package/node_modules/@agnos-ui/core/components/tree/index.js +5 -0
- package/node_modules/@agnos-ui/core/components/tree/tree.d.ts +143 -0
- package/node_modules/@agnos-ui/core/config.cjs +36 -0
- package/node_modules/@agnos-ui/core/config.d.ts +117 -0
- package/node_modules/@agnos-ui/core/config.js +36 -0
- package/node_modules/@agnos-ui/core/directive-Bsreu2z1.js +523 -0
- package/node_modules/@agnos-ui/core/directive-DCaXmRe_.cjs +522 -0
- package/node_modules/@agnos-ui/core/drawer-BbFAHV07.cjs +328 -0
- package/node_modules/@agnos-ui/core/drawer-C6Qa0xEu.js +329 -0
- package/node_modules/@agnos-ui/core/index.cjs +134 -0
- package/node_modules/@agnos-ui/core/index.d.ts +29 -0
- package/node_modules/@agnos-ui/core/index.js +134 -0
- package/node_modules/@agnos-ui/core/isFocusable-Ckwus82R.js +32 -0
- package/node_modules/@agnos-ui/core/isFocusable-DfzDLeAN.cjs +31 -0
- package/node_modules/@agnos-ui/core/modal-BsNuHhT7.cjs +252 -0
- package/node_modules/@agnos-ui/core/modal-CgzY8ezz.js +253 -0
- package/node_modules/@agnos-ui/core/package.json +57 -0
- package/node_modules/@agnos-ui/core/pagination-ZxGaNWZz.js +255 -0
- package/node_modules/@agnos-ui/core/pagination-xbcOHnhd.cjs +254 -0
- package/node_modules/@agnos-ui/core/progressbar-CRbMKp4b.cjs +86 -0
- package/node_modules/@agnos-ui/core/progressbar-CSEIFnlD.js +87 -0
- package/node_modules/@agnos-ui/core/promise-CxCD3NYv.cjs +118 -0
- package/node_modules/@agnos-ui/core/promise-D-RZVPuv.js +119 -0
- package/node_modules/@agnos-ui/core/rating-BIdiiPUo.js +184 -0
- package/node_modules/@agnos-ui/core/rating-qx1xaBmz.cjs +183 -0
- package/node_modules/@agnos-ui/core/scrollbars-CT87iv_6.cjs +30 -0
- package/node_modules/@agnos-ui/core/scrollbars-CcxSrnCx.js +31 -0
- package/node_modules/@agnos-ui/core/services/extendWidget.cjs +41 -0
- package/node_modules/@agnos-ui/core/services/extendWidget.d.ts +31 -0
- package/node_modules/@agnos-ui/core/services/extendWidget.js +41 -0
- package/node_modules/@agnos-ui/core/services/floatingUI.cjs +111 -0
- package/node_modules/@agnos-ui/core/services/floatingUI.d.ts +76 -0
- package/node_modules/@agnos-ui/core/services/floatingUI.js +111 -0
- package/node_modules/@agnos-ui/core/services/focusElement.cjs +46 -0
- package/node_modules/@agnos-ui/core/services/focusElement.d.ts +9 -0
- package/node_modules/@agnos-ui/core/services/focusElement.js +46 -0
- package/node_modules/@agnos-ui/core/services/focustrack.cjs +47 -0
- package/node_modules/@agnos-ui/core/services/focustrack.d.ts +40 -0
- package/node_modules/@agnos-ui/core/services/focustrack.js +47 -0
- package/node_modules/@agnos-ui/core/services/hash.cjs +15 -0
- package/node_modules/@agnos-ui/core/services/hash.d.ts +3 -0
- package/node_modules/@agnos-ui/core/services/hash.js +15 -0
- package/node_modules/@agnos-ui/core/services/intersection.cjs +53 -0
- package/node_modules/@agnos-ui/core/services/intersection.d.ts +30 -0
- package/node_modules/@agnos-ui/core/services/intersection.js +53 -0
- package/node_modules/@agnos-ui/core/services/matchMedia.cjs +14 -0
- package/node_modules/@agnos-ui/core/services/matchMedia.d.ts +8 -0
- package/node_modules/@agnos-ui/core/services/matchMedia.js +14 -0
- package/node_modules/@agnos-ui/core/services/navManager.cjs +166 -0
- package/node_modules/@agnos-ui/core/services/navManager.d.ts +144 -0
- package/node_modules/@agnos-ui/core/services/navManager.js +166 -0
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.cjs +60 -0
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.d.ts +42 -0
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.js +60 -0
- package/node_modules/@agnos-ui/core/services/portal.cjs +42 -0
- package/node_modules/@agnos-ui/core/services/portal.d.ts +16 -0
- package/node_modules/@agnos-ui/core/services/portal.js +42 -0
- package/node_modules/@agnos-ui/core/services/resizeObserver.cjs +54 -0
- package/node_modules/@agnos-ui/core/services/resizeObserver.d.ts +18 -0
- package/node_modules/@agnos-ui/core/services/resizeObserver.js +54 -0
- package/node_modules/@agnos-ui/core/services/siblingsInert.cjs +44 -0
- package/node_modules/@agnos-ui/core/services/siblingsInert.d.ts +16 -0
- package/node_modules/@agnos-ui/core/services/siblingsInert.js +44 -0
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.cjs +186 -0
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.d.ts +166 -0
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.js +186 -0
- package/node_modules/@agnos-ui/core/services/transitions/collapse.cjs +40 -0
- package/node_modules/@agnos-ui/core/services/transitions/collapse.d.ts +49 -0
- package/node_modules/@agnos-ui/core/services/transitions/collapse.js +40 -0
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.cjs +32 -0
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.d.ts +25 -0
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.js +32 -0
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.cjs +37 -0
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.d.ts +47 -0
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.js +37 -0
- package/node_modules/@agnos-ui/core/slider-B93hE0ag.cjs +807 -0
- package/node_modules/@agnos-ui/core/slider-Cjiq9FgI.js +808 -0
- package/node_modules/@agnos-ui/core/textDirection-cNgt24LJ.js +4 -0
- package/node_modules/@agnos-ui/core/textDirection-zqcZ5-eK.cjs +3 -0
- package/node_modules/@agnos-ui/core/toaster-BQWqxYv-.cjs +190 -0
- package/node_modules/@agnos-ui/core/toaster-BzEkshT2.js +191 -0
- package/node_modules/@agnos-ui/core/tree-DY04XPPg.cjs +228 -0
- package/node_modules/@agnos-ui/core/tree-HwcvZ0_p.js +229 -0
- package/node_modules/@agnos-ui/core/types.cjs +6 -0
- package/node_modules/@agnos-ui/core/types.d.ts +246 -0
- package/node_modules/@agnos-ui/core/types.js +6 -0
- package/node_modules/@agnos-ui/core/utils/directive.cjs +28 -0
- package/node_modules/@agnos-ui/core/utils/directive.d.ts +352 -0
- package/node_modules/@agnos-ui/core/utils/directive.js +28 -0
- package/node_modules/@agnos-ui/core/utils/func.cjs +7 -0
- package/node_modules/@agnos-ui/core/utils/func.d.ts +11 -0
- package/node_modules/@agnos-ui/core/utils/func.js +7 -0
- package/node_modules/@agnos-ui/core/utils/id.cjs +5 -0
- package/node_modules/@agnos-ui/core/utils/id.d.ts +6 -0
- package/node_modules/@agnos-ui/core/utils/id.js +5 -0
- package/node_modules/@agnos-ui/core/utils/internal/assign.d.ts +10 -0
- package/node_modules/@agnos-ui/core/utils/internal/checks.d.ts +57 -0
- package/node_modules/@agnos-ui/core/utils/internal/dom.d.ts +75 -0
- package/node_modules/@agnos-ui/core/utils/internal/isFocusable.d.ts +9 -0
- package/node_modules/@agnos-ui/core/utils/internal/math.d.ts +5 -0
- package/node_modules/@agnos-ui/core/utils/internal/promise.d.ts +98 -0
- package/node_modules/@agnos-ui/core/utils/internal/scrollbars.d.ts +8 -0
- package/node_modules/@agnos-ui/core/utils/internal/sort.d.ts +16 -0
- package/node_modules/@agnos-ui/core/utils/internal/ssrHTMLElement.d.ts +17 -0
- package/node_modules/@agnos-ui/core/utils/internal/textDirection.d.ts +7 -0
- package/node_modules/@agnos-ui/core/utils/internal/traversal.d.ts +54 -0
- package/node_modules/@agnos-ui/core/utils/stores.cjs +172 -0
- package/node_modules/@agnos-ui/core/utils/stores.d.ts +224 -0
- package/node_modules/@agnos-ui/core/utils/stores.js +172 -0
- package/node_modules/@agnos-ui/core/utils/widget.cjs +8 -0
- package/node_modules/@agnos-ui/core/utils/widget.d.ts +11 -0
- package/node_modules/@agnos-ui/core/utils/widget.js +8 -0
- package/node_modules/@agnos-ui/core/utils/writables.cjs +16 -0
- package/node_modules/@agnos-ui/core/utils/writables.d.ts +95 -0
- package/node_modules/@agnos-ui/core/utils/writables.js +16 -0
- package/node_modules/@agnos-ui/core/writables-DYGjj5T3.js +103 -0
- package/node_modules/@agnos-ui/core/writables-Dt68gADJ.cjs +102 -0
- package/package.json +25 -6
- package/schematics/collection.json +1 -1
- package/types/design-factory-angular-drawer.d.ts +71 -13
- package/types/design-factory-angular-internals.d.ts +220 -31
- package/types/design-factory-angular-sidenav.d.ts +15 -7
- package/types/design-factory-angular-theme.d.ts +122 -0
- package/types/design-factory-angular-topnav.d.ts +435 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { computed, readable } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { b as typeBoolean, e as typeFunction, j as typeString, f as typeHTMLElementOrNull } from "./writables-DYGjj5T3.js";
|
|
3
|
+
import { writablesForProps, stateStores } from "./utils/stores.js";
|
|
4
|
+
import { createTransition } from "./services/transitions/baseTransitions.js";
|
|
5
|
+
import { p as promiseFromStore } from "./promise-D-RZVPuv.js";
|
|
6
|
+
import { noop } from "./utils/func.js";
|
|
7
|
+
import { r as removeScrollbars, a as revertScrollbars } from "./scrollbars-CcxSrnCx.js";
|
|
8
|
+
import { u as registrationArray, b as bindDirective, g as createAttributesDirective, d as browserDirective, s as mergeDirectives, o as directiveSubscribe, c as bindDirectiveNoArg } from "./directive-Bsreu2z1.js";
|
|
9
|
+
import { portal } from "./services/portal.js";
|
|
10
|
+
import { siblingsInert } from "./services/siblingsInert.js";
|
|
11
|
+
import { createWidgetFactory } from "./utils/widget.js";
|
|
12
|
+
import { focusElement } from "./services/focusElement.js";
|
|
13
|
+
const modalOutsideClick = /* @__PURE__ */ Symbol();
|
|
14
|
+
const modalCloseButtonClick = /* @__PURE__ */ Symbol();
|
|
15
|
+
const modalCloseEscape = /* @__PURE__ */ Symbol();
|
|
16
|
+
const defaultConfig = {
|
|
17
|
+
animated: true,
|
|
18
|
+
ariaCloseButtonLabel: "Close",
|
|
19
|
+
backdrop: true,
|
|
20
|
+
backdropClass: "",
|
|
21
|
+
backdropTransition: noop,
|
|
22
|
+
closeButton: true,
|
|
23
|
+
closeOnOutsideClick: true,
|
|
24
|
+
container: typeof window !== "undefined" ? document.body : null,
|
|
25
|
+
className: "",
|
|
26
|
+
modalTransition: noop,
|
|
27
|
+
onBeforeClose: noop,
|
|
28
|
+
onVisibleChange: noop,
|
|
29
|
+
onHidden: noop,
|
|
30
|
+
onShown: noop,
|
|
31
|
+
visible: false
|
|
32
|
+
};
|
|
33
|
+
const configValidator = {
|
|
34
|
+
animated: typeBoolean,
|
|
35
|
+
ariaCloseButtonLabel: typeString,
|
|
36
|
+
backdrop: typeBoolean,
|
|
37
|
+
backdropClass: typeString,
|
|
38
|
+
backdropTransition: typeFunction,
|
|
39
|
+
closeButton: typeBoolean,
|
|
40
|
+
closeOnOutsideClick: typeBoolean,
|
|
41
|
+
container: typeHTMLElementOrNull,
|
|
42
|
+
className: typeString,
|
|
43
|
+
modalTransition: typeFunction,
|
|
44
|
+
onBeforeClose: typeFunction,
|
|
45
|
+
onVisibleChange: typeFunction,
|
|
46
|
+
onHidden: typeFunction,
|
|
47
|
+
onShown: typeFunction,
|
|
48
|
+
visible: typeBoolean
|
|
49
|
+
};
|
|
50
|
+
function getModalDefaultConfig() {
|
|
51
|
+
return { ...defaultConfig };
|
|
52
|
+
}
|
|
53
|
+
const modals$ = registrationArray();
|
|
54
|
+
const hasModals$ = computed(() => modals$().length > 0);
|
|
55
|
+
const scrollbarsAction$ = computed(() => {
|
|
56
|
+
if (hasModals$()) {
|
|
57
|
+
removeScrollbars();
|
|
58
|
+
} else {
|
|
59
|
+
revertScrollbars();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const modalsAction$ = computed(() => {
|
|
63
|
+
scrollbarsAction$();
|
|
64
|
+
});
|
|
65
|
+
const createModal = createWidgetFactory(
|
|
66
|
+
"modal",
|
|
67
|
+
(config$) => {
|
|
68
|
+
const [
|
|
69
|
+
{
|
|
70
|
+
animated$,
|
|
71
|
+
backdrop$,
|
|
72
|
+
backdropTransition$,
|
|
73
|
+
closeOnOutsideClick$,
|
|
74
|
+
container$,
|
|
75
|
+
modalTransition$,
|
|
76
|
+
onBeforeClose$,
|
|
77
|
+
onVisibleChange$,
|
|
78
|
+
onHidden$,
|
|
79
|
+
onShown$,
|
|
80
|
+
ariaCloseButtonLabel$,
|
|
81
|
+
className$,
|
|
82
|
+
backdropClass$,
|
|
83
|
+
visible$: requestedVisible$,
|
|
84
|
+
...stateProps
|
|
85
|
+
},
|
|
86
|
+
patch
|
|
87
|
+
] = writablesForProps(defaultConfig, config$, configValidator);
|
|
88
|
+
const modalTransition = createTransition({
|
|
89
|
+
props: {
|
|
90
|
+
transition: modalTransition$,
|
|
91
|
+
visible: requestedVisible$,
|
|
92
|
+
animated: animated$,
|
|
93
|
+
animatedOnInit: animated$,
|
|
94
|
+
onVisibleChange: onVisibleChange$,
|
|
95
|
+
// TODO: for onHidden and onShown, should we combine with information from the backdrop transition?
|
|
96
|
+
// (especially in case one of the two transitions takes more time than the other)
|
|
97
|
+
onHidden: onHidden$,
|
|
98
|
+
onShown: onShown$
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const visible$ = modalTransition.stores.visible$;
|
|
102
|
+
const backdropTransition = createTransition({
|
|
103
|
+
props: {
|
|
104
|
+
transition: backdropTransition$,
|
|
105
|
+
visible: requestedVisible$,
|
|
106
|
+
animated: animated$,
|
|
107
|
+
animatedOnInit: animated$
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const transitioning$ = computed(
|
|
111
|
+
() => modalTransition.stores.transitioning$() || backdrop$() && backdropTransition.stores.transitioning$()
|
|
112
|
+
);
|
|
113
|
+
const hidden$ = computed(() => !transitioning$() && !visible$());
|
|
114
|
+
const backdropHidden$ = computed(() => !backdrop$() || hidden$());
|
|
115
|
+
let hideResult;
|
|
116
|
+
const close = (result) => {
|
|
117
|
+
hideResult = result;
|
|
118
|
+
const beforeCloseEvent = {
|
|
119
|
+
get result() {
|
|
120
|
+
return hideResult;
|
|
121
|
+
},
|
|
122
|
+
set result(value) {
|
|
123
|
+
hideResult = value;
|
|
124
|
+
},
|
|
125
|
+
cancel: false
|
|
126
|
+
};
|
|
127
|
+
onBeforeClose$()(beforeCloseEvent);
|
|
128
|
+
if (beforeCloseEvent.cancel) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
patch({ visible: false });
|
|
132
|
+
};
|
|
133
|
+
const modalPortalDirective = bindDirective(
|
|
134
|
+
portal,
|
|
135
|
+
computed(() => ({ container: container$() }))
|
|
136
|
+
);
|
|
137
|
+
const backdropPortalDirective = bindDirective(
|
|
138
|
+
portal,
|
|
139
|
+
computed(() => {
|
|
140
|
+
const container = container$();
|
|
141
|
+
const element = container ? modalTransition.stores.element$() : void 0;
|
|
142
|
+
return {
|
|
143
|
+
container,
|
|
144
|
+
insertBefore: element?.parentElement === container ? element : void 0
|
|
145
|
+
};
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
const registerModalAction$ = readable(void 0, () => modals$.register(res));
|
|
149
|
+
const action$ = computed(() => {
|
|
150
|
+
if (modalTransition.stores.elementPresent$() && !hidden$()) {
|
|
151
|
+
registerModalAction$();
|
|
152
|
+
}
|
|
153
|
+
modalsAction$();
|
|
154
|
+
});
|
|
155
|
+
const closeButtonDirective = createAttributesDirective(() => ({
|
|
156
|
+
attributes: {
|
|
157
|
+
type: readable("button"),
|
|
158
|
+
"aria-label": ariaCloseButtonLabel$
|
|
159
|
+
},
|
|
160
|
+
events: {
|
|
161
|
+
click: () => close(modalCloseButtonClick)
|
|
162
|
+
}
|
|
163
|
+
}));
|
|
164
|
+
const backdropAttributeDirective = createAttributesDirective(() => ({
|
|
165
|
+
attributes: {
|
|
166
|
+
class: backdropClass$
|
|
167
|
+
}
|
|
168
|
+
}));
|
|
169
|
+
const modalAttributeDirective = createAttributesDirective(() => ({
|
|
170
|
+
attributes: {
|
|
171
|
+
class: className$,
|
|
172
|
+
tabIndex: readable("-1")
|
|
173
|
+
},
|
|
174
|
+
events: {
|
|
175
|
+
click: (event) => {
|
|
176
|
+
if (event.currentTarget === event.target && closeOnOutsideClick$()) {
|
|
177
|
+
close(modalOutsideClick);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
keydown: (event) => {
|
|
181
|
+
const { key } = event;
|
|
182
|
+
switch (key) {
|
|
183
|
+
case "Escape":
|
|
184
|
+
close(modalCloseEscape);
|
|
185
|
+
event.stopPropagation();
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}));
|
|
191
|
+
const res = {
|
|
192
|
+
...stateStores({
|
|
193
|
+
backdropHidden$,
|
|
194
|
+
container$,
|
|
195
|
+
hidden$,
|
|
196
|
+
transitioning$,
|
|
197
|
+
visible$,
|
|
198
|
+
modalElement$: modalTransition.stores.element$,
|
|
199
|
+
ariaCloseButtonLabel$,
|
|
200
|
+
className$,
|
|
201
|
+
backdropClass$,
|
|
202
|
+
...stateProps
|
|
203
|
+
}),
|
|
204
|
+
directives: {
|
|
205
|
+
modalPortalDirective,
|
|
206
|
+
backdropPortalDirective,
|
|
207
|
+
backdropDirective: mergeDirectives(backdropTransition.directives.directive, backdropAttributeDirective),
|
|
208
|
+
modalDirective: mergeDirectives(
|
|
209
|
+
modalTransition.directives.directive,
|
|
210
|
+
bindDirectiveNoArg(siblingsInert),
|
|
211
|
+
directiveSubscribe(action$),
|
|
212
|
+
modalAttributeDirective,
|
|
213
|
+
focusElement
|
|
214
|
+
),
|
|
215
|
+
closeButtonDirective,
|
|
216
|
+
dialogDirective: bindDirective(
|
|
217
|
+
browserDirective((dialog, visible) => {
|
|
218
|
+
const update = (visible2) => {
|
|
219
|
+
if (visible2) {
|
|
220
|
+
dialog.showModal();
|
|
221
|
+
} else {
|
|
222
|
+
dialog.close();
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
update(visible);
|
|
226
|
+
return {
|
|
227
|
+
update
|
|
228
|
+
};
|
|
229
|
+
}),
|
|
230
|
+
visible$
|
|
231
|
+
)
|
|
232
|
+
},
|
|
233
|
+
patch,
|
|
234
|
+
api: {
|
|
235
|
+
close,
|
|
236
|
+
async open() {
|
|
237
|
+
patch({ visible: true });
|
|
238
|
+
await promiseFromStore(hidden$).promise;
|
|
239
|
+
return hideResult;
|
|
240
|
+
},
|
|
241
|
+
patch
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
return res;
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
export {
|
|
248
|
+
modalCloseEscape as a,
|
|
249
|
+
modalOutsideClick as b,
|
|
250
|
+
createModal as c,
|
|
251
|
+
getModalDefaultConfig as g,
|
|
252
|
+
modalCloseButtonClick as m
|
|
253
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agnos-ui/core",
|
|
3
|
+
"description": "Framework-agnostic headless component library.",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./index.cjs",
|
|
8
|
+
"module": "./index.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"require": "./index.cjs",
|
|
14
|
+
"default": "./index.js"
|
|
15
|
+
},
|
|
16
|
+
"./components/*": {
|
|
17
|
+
"types": "./components/*/index.d.ts",
|
|
18
|
+
"require": "./components/*/index.cjs",
|
|
19
|
+
"default": "./components/*/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./config": {
|
|
22
|
+
"types": "./config.d.ts",
|
|
23
|
+
"require": "./config.cjs",
|
|
24
|
+
"default": "./config.js"
|
|
25
|
+
},
|
|
26
|
+
"./types": {
|
|
27
|
+
"types": "./types.d.ts",
|
|
28
|
+
"require": "./types.cjs",
|
|
29
|
+
"default": "./types.js"
|
|
30
|
+
},
|
|
31
|
+
"./services/*": {
|
|
32
|
+
"types": "./services/*.d.ts",
|
|
33
|
+
"require": "./services/*.cjs",
|
|
34
|
+
"default": "./services/*.js"
|
|
35
|
+
},
|
|
36
|
+
"./services/transitions/*": {
|
|
37
|
+
"types": "./services/transitions/*.d.ts",
|
|
38
|
+
"require": "./services/transitions/*.cjs",
|
|
39
|
+
"default": "./services/transitions/*.js"
|
|
40
|
+
},
|
|
41
|
+
"./utils/*": {
|
|
42
|
+
"types": "./utils/*.d.ts",
|
|
43
|
+
"require": "./utils/*.cjs",
|
|
44
|
+
"default": "./utils/*.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"clsx": "^2.1.1"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@amadeus-it-group/tansu": "^2.0.0",
|
|
52
|
+
"@floating-ui/dom": "^1.6.12",
|
|
53
|
+
"embla-carousel": "^8.5.2",
|
|
54
|
+
"esm-env": "^1.2.1"
|
|
55
|
+
},
|
|
56
|
+
"sideEffects": false
|
|
57
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { computed } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
|
|
3
|
+
import { j as typeString, e as typeFunction, b as typeBoolean, g as typeNumber, l as clamp, m as isNumber } from "./writables-DYGjj5T3.js";
|
|
4
|
+
import { noop } from "./utils/func.js";
|
|
5
|
+
import { g as createAttributesDirective } from "./directive-Bsreu2z1.js";
|
|
6
|
+
import { createWidgetFactory } from "./utils/widget.js";
|
|
7
|
+
const PAGE_LINK_DEFAULT = "#";
|
|
8
|
+
const defaultConfig = {
|
|
9
|
+
page: 1,
|
|
10
|
+
collectionSize: 0,
|
|
11
|
+
pageSize: 10,
|
|
12
|
+
disabled: false,
|
|
13
|
+
directionLinks: true,
|
|
14
|
+
boundaryLinks: false,
|
|
15
|
+
onPageChange: noop,
|
|
16
|
+
pagesFactory: (_page, pageCount) => {
|
|
17
|
+
const pages = [];
|
|
18
|
+
for (let i = 1; i <= pageCount; i++) {
|
|
19
|
+
pages.push(i);
|
|
20
|
+
}
|
|
21
|
+
return pages;
|
|
22
|
+
},
|
|
23
|
+
ariaLabel: "Page navigation",
|
|
24
|
+
activeLabel: "(current)",
|
|
25
|
+
ariaPageLabel: (processPage, pageCount) => `Page ${processPage} of ${pageCount}`,
|
|
26
|
+
ariaFirstLabel: "Action link for first page",
|
|
27
|
+
ariaPreviousLabel: "Action link for previous page",
|
|
28
|
+
ariaNextLabel: "Action link for next page",
|
|
29
|
+
ariaLastLabel: "Action link for last page",
|
|
30
|
+
ariaEllipsisLabel: "Ellipsis page element",
|
|
31
|
+
ariaLiveLabel: (currentPage) => `Current page is ${currentPage}`,
|
|
32
|
+
className: "",
|
|
33
|
+
pageLink: (_page) => PAGE_LINK_DEFAULT
|
|
34
|
+
};
|
|
35
|
+
function getPaginationDefaultConfig() {
|
|
36
|
+
return { ...defaultConfig };
|
|
37
|
+
}
|
|
38
|
+
const configValidator = {
|
|
39
|
+
page: typeNumber,
|
|
40
|
+
collectionSize: typeNumber,
|
|
41
|
+
pageSize: typeNumber,
|
|
42
|
+
disabled: typeBoolean,
|
|
43
|
+
directionLinks: typeBoolean,
|
|
44
|
+
boundaryLinks: typeBoolean,
|
|
45
|
+
onPageChange: typeFunction,
|
|
46
|
+
pagesFactory: typeFunction,
|
|
47
|
+
ariaLabel: typeString,
|
|
48
|
+
activeLabel: typeString,
|
|
49
|
+
ariaPageLabel: typeFunction,
|
|
50
|
+
ariaFirstLabel: typeString,
|
|
51
|
+
ariaPreviousLabel: typeString,
|
|
52
|
+
ariaNextLabel: typeString,
|
|
53
|
+
ariaLastLabel: typeString,
|
|
54
|
+
ariaLiveLabel: typeFunction,
|
|
55
|
+
className: typeString,
|
|
56
|
+
pageLink: typeFunction,
|
|
57
|
+
ariaEllipsisLabel: typeString
|
|
58
|
+
};
|
|
59
|
+
const createPagination = createWidgetFactory(
|
|
60
|
+
"pagination",
|
|
61
|
+
(config) => {
|
|
62
|
+
const [
|
|
63
|
+
{
|
|
64
|
+
// dirty inputs that need adjustment:
|
|
65
|
+
page$: _dirtyPage$,
|
|
66
|
+
// clean inputs with value validation:
|
|
67
|
+
collectionSize$,
|
|
68
|
+
pageSize$,
|
|
69
|
+
onPageChange$,
|
|
70
|
+
pagesFactory$,
|
|
71
|
+
ariaPageLabel$,
|
|
72
|
+
ariaLiveLabel$,
|
|
73
|
+
pageLink$,
|
|
74
|
+
disabled$,
|
|
75
|
+
ariaFirstLabel$,
|
|
76
|
+
ariaLastLabel$,
|
|
77
|
+
ariaNextLabel$,
|
|
78
|
+
ariaPreviousLabel$,
|
|
79
|
+
...stateProps
|
|
80
|
+
},
|
|
81
|
+
patch
|
|
82
|
+
] = writablesForProps(defaultConfig, config, configValidator);
|
|
83
|
+
const pageCount$ = computed(() => {
|
|
84
|
+
let pageCount = Math.ceil(collectionSize$() / pageSize$());
|
|
85
|
+
if (!isNumber(pageCount) || pageCount < 1) {
|
|
86
|
+
pageCount = 1;
|
|
87
|
+
}
|
|
88
|
+
return pageCount;
|
|
89
|
+
});
|
|
90
|
+
const page$ = bindableProp(_dirtyPage$, onPageChange$, (dirtyPage) => clamp(dirtyPage, pageCount$(), 1));
|
|
91
|
+
const pages$ = computed(() => pagesFactory$()(page$(), pageCount$()));
|
|
92
|
+
const nextDisabled$ = computed(() => page$() === pageCount$() || disabled$());
|
|
93
|
+
const previousDisabled$ = computed(() => page$() === 1 || disabled$());
|
|
94
|
+
const pagesLabel$ = computed(() => {
|
|
95
|
+
const ariaPageLabel = ariaPageLabel$();
|
|
96
|
+
const pageCount = pageCount$();
|
|
97
|
+
return pages$().map((page) => ariaPageLabel(page, pageCount));
|
|
98
|
+
});
|
|
99
|
+
const pagesHrefs$ = computed(() => {
|
|
100
|
+
const pageLinkFactory = pageLink$();
|
|
101
|
+
const pageCount = pageCount$();
|
|
102
|
+
return Array.from({ length: pageCount }, (_, index) => pageLinkFactory(index + 1));
|
|
103
|
+
});
|
|
104
|
+
const directionsHrefs$ = computed(() => {
|
|
105
|
+
const pagesHrefs = pagesHrefs$();
|
|
106
|
+
const pageIndex = page$() - 1;
|
|
107
|
+
return {
|
|
108
|
+
previous: pagesHrefs.at(pageIndex > 0 ? pageIndex - 1 : 0),
|
|
109
|
+
next: pagesHrefs.at(pageIndex + 1) ?? pagesHrefs.at(-1)
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
const ariaLiveLabelText$ = computed(() => ariaLiveLabel$()(page$(), pageCount$()));
|
|
113
|
+
function handleNavigation(pageNumber, event) {
|
|
114
|
+
if (pagesHrefs$()[pageNumber - 1] === PAGE_LINK_DEFAULT) {
|
|
115
|
+
event?.preventDefault();
|
|
116
|
+
}
|
|
117
|
+
if (!event || !(event.ctrlKey || event.metaKey)) {
|
|
118
|
+
event?.preventDefault();
|
|
119
|
+
page$.set(pageNumber);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const widget = {
|
|
123
|
+
...stateStores({
|
|
124
|
+
pageCount$,
|
|
125
|
+
page$,
|
|
126
|
+
pages$,
|
|
127
|
+
nextDisabled$,
|
|
128
|
+
previousDisabled$,
|
|
129
|
+
pagesLabel$,
|
|
130
|
+
pagesHrefs$,
|
|
131
|
+
directionsHrefs$,
|
|
132
|
+
disabled$,
|
|
133
|
+
ariaFirstLabel$,
|
|
134
|
+
ariaLastLabel$,
|
|
135
|
+
ariaNextLabel$,
|
|
136
|
+
ariaPreviousLabel$,
|
|
137
|
+
ariaLiveLabelText$,
|
|
138
|
+
...stateProps
|
|
139
|
+
}),
|
|
140
|
+
patch,
|
|
141
|
+
api: {
|
|
142
|
+
/**
|
|
143
|
+
* Set the current page pageNumber (starting from 1)
|
|
144
|
+
* @param pageNumber - Current page number to set.
|
|
145
|
+
* Value is normalized between 1 and the number of page
|
|
146
|
+
*/
|
|
147
|
+
select(pageNumber) {
|
|
148
|
+
page$.set(pageNumber);
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Select the first page
|
|
152
|
+
*/
|
|
153
|
+
first() {
|
|
154
|
+
page$.set(1);
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* Select the previous page
|
|
158
|
+
*/
|
|
159
|
+
previous() {
|
|
160
|
+
page$.update((p) => p - 1);
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* Select the next page
|
|
164
|
+
*/
|
|
165
|
+
next() {
|
|
166
|
+
page$.update((p) => p + 1);
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Select the last page
|
|
170
|
+
*/
|
|
171
|
+
last() {
|
|
172
|
+
page$.set(pageCount$());
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
directives: {
|
|
176
|
+
pageLink: createAttributesDirective((pageLinkContext$) => ({
|
|
177
|
+
events: {
|
|
178
|
+
click: (e) => handleNavigation(pageLinkContext$().page, e)
|
|
179
|
+
},
|
|
180
|
+
attributes: {
|
|
181
|
+
"aria-current": computed(() => page$() === pageLinkContext$().page ? "page" : void 0),
|
|
182
|
+
"aria-label": computed(() => pagesLabel$()[pageLinkContext$().page - 1]),
|
|
183
|
+
href: computed(() => pagesHrefs$()[pageLinkContext$().page - 1]),
|
|
184
|
+
tabindex: computed(() => disabled$() ? "-1" : void 0),
|
|
185
|
+
"aria-disabled": computed(() => disabled$() ? "true" : void 0)
|
|
186
|
+
},
|
|
187
|
+
classNames: {
|
|
188
|
+
"au-page": true$
|
|
189
|
+
}
|
|
190
|
+
})),
|
|
191
|
+
pageFirst: createAttributesDirective(() => ({
|
|
192
|
+
events: {
|
|
193
|
+
click: (e) => handleNavigation(1, e)
|
|
194
|
+
},
|
|
195
|
+
attributes: {
|
|
196
|
+
"aria-label": ariaFirstLabel$,
|
|
197
|
+
href: computed(() => pagesHrefs$()[0]),
|
|
198
|
+
tabindex: computed(() => previousDisabled$() ? "-1" : void 0),
|
|
199
|
+
"aria-disabled": computed(() => previousDisabled$() ? "true" : void 0)
|
|
200
|
+
},
|
|
201
|
+
classNames: {
|
|
202
|
+
"au-first": true$
|
|
203
|
+
}
|
|
204
|
+
})),
|
|
205
|
+
pagePrev: createAttributesDirective(() => ({
|
|
206
|
+
events: {
|
|
207
|
+
click: (e) => handleNavigation(page$() - 1, e)
|
|
208
|
+
},
|
|
209
|
+
attributes: {
|
|
210
|
+
"aria-label": ariaPreviousLabel$,
|
|
211
|
+
href: computed(() => directionsHrefs$().previous),
|
|
212
|
+
tabindex: computed(() => previousDisabled$() ? "-1" : void 0),
|
|
213
|
+
"aria-disabled": computed(() => previousDisabled$() ? "true" : void 0)
|
|
214
|
+
},
|
|
215
|
+
classNames: {
|
|
216
|
+
"au-previous": true$
|
|
217
|
+
}
|
|
218
|
+
})),
|
|
219
|
+
pageNext: createAttributesDirective(() => ({
|
|
220
|
+
events: {
|
|
221
|
+
click: (e) => handleNavigation(page$() + 1, e)
|
|
222
|
+
},
|
|
223
|
+
attributes: {
|
|
224
|
+
"aria-label": ariaNextLabel$,
|
|
225
|
+
href: computed(() => directionsHrefs$().next),
|
|
226
|
+
tabindex: computed(() => nextDisabled$() ? "-1" : void 0),
|
|
227
|
+
"aria-disabled": computed(() => nextDisabled$() ? "true" : void 0)
|
|
228
|
+
},
|
|
229
|
+
classNames: {
|
|
230
|
+
"au-next": true$
|
|
231
|
+
}
|
|
232
|
+
})),
|
|
233
|
+
pageLast: createAttributesDirective(() => ({
|
|
234
|
+
events: {
|
|
235
|
+
click: (e) => handleNavigation(pageCount$(), e)
|
|
236
|
+
},
|
|
237
|
+
attributes: {
|
|
238
|
+
"aria-label": ariaLastLabel$,
|
|
239
|
+
href: computed(() => pagesHrefs$().at(-1)),
|
|
240
|
+
tabindex: computed(() => nextDisabled$() ? "-1" : void 0),
|
|
241
|
+
"aria-disabled": computed(() => nextDisabled$() ? "true" : void 0)
|
|
242
|
+
},
|
|
243
|
+
classNames: {
|
|
244
|
+
"au-last": true$
|
|
245
|
+
}
|
|
246
|
+
}))
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
return widget;
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
export {
|
|
253
|
+
createPagination as c,
|
|
254
|
+
getPaginationDefaultConfig as g
|
|
255
|
+
};
|