@agnos-ui/core 0.9.3 → 0.10.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/{accordion-cR5JqWJ8.cjs → accordion-B5LiN1uy.cjs} +15 -20
- package/{accordion-CoM4efp-.js → accordion-_zen-g8l.js} +15 -20
- package/{alert-DtDozJal.cjs → alert-B-jQDQcB.cjs} +1 -1
- package/{alert-YIlqdEPO.js → alert-gGz2CDS9.js} +1 -1
- package/{collapse-DwXz2kNw.js → collapse-BV4kD3j9.js} +2 -2
- package/{collapse-DRp53EuG.cjs → collapse-gLiT080Y.cjs} +2 -2
- package/{common-BToNPUDq.cjs → common-D3QcdJ6S.cjs} +1 -1
- package/{common-BqUjUBPy.js → common-DK0ADNTX.js} +1 -1
- package/components/accordion/accordion.d.ts +6 -6
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/carousel/carousel.d.ts +15 -0
- package/components/carousel/index.cjs +10 -23
- package/components/carousel/index.js +10 -23
- package/components/collapse/collapse.d.ts +5 -2
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.js +1 -1
- package/components/drawer/drawer.d.ts +242 -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 +2 -1
- package/components/modal/index.js +2 -1
- package/components/modal/modal.d.ts +5 -0
- package/components/pagination/index.cjs +1 -1
- package/components/pagination/index.js +1 -1
- package/components/progressbar/index.cjs +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/rating/index.cjs +1 -1
- package/components/rating/index.js +1 -1
- package/components/select/index.cjs +1 -1
- package/components/select/index.js +1 -1
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider.d.ts +4 -4
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +1 -1
- package/components/tree/index.cjs +1 -1
- package/components/tree/index.js +1 -1
- package/components/tree/tree.d.ts +0 -6
- package/config.cjs +2 -2
- package/config.d.ts +5 -0
- package/config.js +2 -2
- package/{dom-gfxqXJpK.js → dom-Bcg9ORcA.js} +64 -54
- package/{dom-CuBx1JPZ.cjs → dom-C2gi9OCP.cjs} +47 -37
- package/drawer-D5SO73ew.js +251 -0
- package/drawer-DP7UPojk.cjs +250 -0
- package/index.cjs +19 -13
- package/index.d.ts +1 -0
- package/index.js +36 -30
- package/isFocusable-Ckwus82R.js +32 -0
- package/isFocusable-DfzDLeAN.cjs +31 -0
- package/{modal-D3wGIDlj.js → modal-CAvQW-vo.js} +26 -32
- package/{modal-BEnQ6c5M.cjs → modal-DiXZXYjR.cjs} +27 -33
- package/package.json +1 -1
- package/{pagination-B97wBLok.js → pagination-BKbMROV6.js} +4 -4
- package/{pagination-C1TT-oea.cjs → pagination-DvZ2rLsz.cjs} +4 -4
- package/{progressbar-BWBlRk_Y.js → progressbar-D8zIcm9n.js} +2 -2
- package/{progressbar-CRvhNB5R.cjs → progressbar-i9xfAxb7.cjs} +2 -2
- package/{promise-XSP94FjG.js → promise-Y53vc4Ia.js} +5 -5
- package/{rating-BXvy9kXq.js → rating-DEXTGWCU.js} +2 -2
- package/{rating-DAb6nR67.cjs → rating-DmG4oUkr.cjs} +2 -2
- package/scrollbars-CT87iv_6.cjs +30 -0
- package/scrollbars-CcxSrnCx.js +31 -0
- package/{select-BdjpnE7_.js → select-Bw68Xdu5.js} +4 -5
- package/{select-C0rJJQfl.cjs → select-MFjAnIt7.cjs} +4 -5
- package/services/extendWidget.cjs +2 -2
- package/services/extendWidget.js +2 -2
- package/services/floatingUI.cjs +8 -29
- package/services/floatingUI.js +9 -30
- package/services/focusElement.cjs +46 -0
- package/services/focusElement.d.ts +9 -0
- package/services/focusElement.js +46 -0
- package/services/focustrack.cjs +1 -1
- package/services/focustrack.js +1 -1
- package/services/matchMedia.cjs +1 -1
- package/services/matchMedia.js +1 -1
- package/services/navManager.cjs +7 -37
- package/services/navManager.js +6 -36
- package/services/portal.cjs +7 -10
- package/services/portal.js +7 -10
- package/services/resizeObserver.cjs +2 -2
- package/services/resizeObserver.js +2 -2
- package/services/siblingsInert.cjs +9 -8
- package/services/siblingsInert.d.ts +13 -3
- package/services/siblingsInert.js +9 -8
- package/services/transitions/baseTransitions.cjs +9 -10
- package/services/transitions/baseTransitions.js +10 -11
- package/services/transitions/collapse.cjs +1 -1
- package/services/transitions/collapse.js +1 -1
- package/services/transitions/cssTransitions.cjs +1 -1
- package/services/transitions/cssTransitions.js +2 -2
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-BmxQ3A_u.js → slider-Cx50Eghd.js} +14 -24
- package/{slider-DSx5CAce.cjs → slider-Dl4Trh32.cjs} +14 -24
- package/toaster-UDglac7x.cjs +187 -0
- package/toaster-_p1GTtHI.js +188 -0
- package/{tree-BFrXdJox.js → tree-DV0tfPlZ.js} +7 -11
- package/{tree-Pvr2rZ-D.cjs → tree-rGHtmCnS.cjs} +7 -11
- package/utils/directive.cjs +3 -1
- package/utils/directive.d.ts +47 -0
- package/utils/directive.js +14 -12
- package/utils/stores.cjs +8 -9
- package/utils/stores.js +8 -9
- package/utils/writables.cjs +1 -1
- package/utils/writables.js +1 -1
- package/{writables-Bn3uhKEG.cjs → writables-DcGT98a7.cjs} +1 -1
- package/{writables-CgpOQ4hA.js → writables-e0tyaQpe.js} +1 -1
- package/toaster-Cayg6Lbq.cjs +0 -209
- package/toaster-XfzHDqz_.js +0 -210
|
@@ -1,42 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const tansu = require("@amadeus-it-group/tansu");
|
|
3
|
-
const utils_writables = require("./writables-
|
|
3
|
+
const utils_writables = require("./writables-DcGT98a7.cjs");
|
|
4
4
|
const utils_stores = require("./utils/stores.cjs");
|
|
5
5
|
const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
|
|
6
6
|
const promise = require("./promise-CxCD3NYv.cjs");
|
|
7
7
|
const utils_func = require("./utils/func.cjs");
|
|
8
|
-
const
|
|
8
|
+
const scrollbars = require("./scrollbars-CT87iv_6.cjs");
|
|
9
|
+
const utils_directive = require("./dom-C2gi9OCP.cjs");
|
|
9
10
|
const services_portal = require("./services/portal.cjs");
|
|
10
11
|
const services_siblingsInert = require("./services/siblingsInert.cjs");
|
|
11
12
|
const utils_widget = require("./utils/widget.cjs");
|
|
12
|
-
const
|
|
13
|
-
const scrollbarWidth = Math.abs(window.innerWidth - document.documentElement.clientWidth);
|
|
14
|
-
const body = document.body;
|
|
15
|
-
const bodyStyle = body.style;
|
|
16
|
-
const { overflow, paddingRight } = bodyStyle;
|
|
17
|
-
if (scrollbarWidth > 0) {
|
|
18
|
-
const actualPadding = parseFloat(window.getComputedStyle(body).paddingRight);
|
|
19
|
-
bodyStyle.paddingRight = `${actualPadding + scrollbarWidth}px`;
|
|
20
|
-
}
|
|
21
|
-
bodyStyle.overflow = "hidden";
|
|
22
|
-
return () => {
|
|
23
|
-
if (scrollbarWidth > 0) {
|
|
24
|
-
bodyStyle.paddingRight = paddingRight;
|
|
25
|
-
}
|
|
26
|
-
bodyStyle.overflow = overflow;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
let internalRevert = utils_func.noop;
|
|
30
|
-
const removeScrollbars = () => {
|
|
31
|
-
internalRevert();
|
|
32
|
-
internalRevert = internalRemoveScrollbars();
|
|
33
|
-
};
|
|
34
|
-
const revertScrollbars = () => {
|
|
35
|
-
internalRevert();
|
|
36
|
-
internalRevert = utils_func.noop;
|
|
37
|
-
};
|
|
13
|
+
const services_focusElement = require("./services/focusElement.cjs");
|
|
38
14
|
const modalOutsideClick = Symbol();
|
|
39
15
|
const modalCloseButtonClick = Symbol();
|
|
16
|
+
const modalCloseEscape = Symbol();
|
|
40
17
|
const defaultConfig = {
|
|
41
18
|
animated: true,
|
|
42
19
|
ariaCloseButtonLabel: "Close",
|
|
@@ -78,9 +55,9 @@ const modals$ = utils_directive.registrationArray();
|
|
|
78
55
|
const hasModals$ = tansu.computed(() => modals$().length > 0);
|
|
79
56
|
const scrollbarsAction$ = tansu.computed(() => {
|
|
80
57
|
if (hasModals$()) {
|
|
81
|
-
removeScrollbars();
|
|
58
|
+
scrollbars.removeScrollbars();
|
|
82
59
|
} else {
|
|
83
|
-
revertScrollbars();
|
|
60
|
+
scrollbars.revertScrollbars();
|
|
84
61
|
}
|
|
85
62
|
});
|
|
86
63
|
const modalsAction$ = tansu.computed(() => {
|
|
@@ -161,7 +138,7 @@ const createModal = utils_widget.createWidgetFactory("modal", (config$) => {
|
|
|
161
138
|
const element = container ? modalTransition.stores.element$() : void 0;
|
|
162
139
|
return {
|
|
163
140
|
container,
|
|
164
|
-
insertBefore:
|
|
141
|
+
insertBefore: element?.parentElement === container ? element : void 0
|
|
165
142
|
};
|
|
166
143
|
})
|
|
167
144
|
);
|
|
@@ -188,13 +165,23 @@ const createModal = utils_widget.createWidgetFactory("modal", (config$) => {
|
|
|
188
165
|
}));
|
|
189
166
|
const modalAttributeDirective = utils_directive.createAttributesDirective(() => ({
|
|
190
167
|
attributes: {
|
|
191
|
-
class: className
|
|
168
|
+
class: className$,
|
|
169
|
+
tabIndex: tansu.readable("-1")
|
|
192
170
|
},
|
|
193
171
|
events: {
|
|
194
172
|
click: (event) => {
|
|
195
173
|
if (event.currentTarget === event.target && closeOnOutsideClick$()) {
|
|
196
174
|
close(modalOutsideClick);
|
|
197
175
|
}
|
|
176
|
+
},
|
|
177
|
+
keydown: (event) => {
|
|
178
|
+
const { key } = event;
|
|
179
|
+
switch (key) {
|
|
180
|
+
case "Escape":
|
|
181
|
+
close(modalCloseEscape);
|
|
182
|
+
event.stopPropagation();
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
198
185
|
}
|
|
199
186
|
}
|
|
200
187
|
}));
|
|
@@ -215,7 +202,13 @@ const createModal = utils_widget.createWidgetFactory("modal", (config$) => {
|
|
|
215
202
|
modalPortalDirective,
|
|
216
203
|
backdropPortalDirective,
|
|
217
204
|
backdropDirective: utils_directive.mergeDirectives(backdropTransition.directives.directive, backdropAttributeDirective),
|
|
218
|
-
modalDirective: utils_directive.mergeDirectives(
|
|
205
|
+
modalDirective: utils_directive.mergeDirectives(
|
|
206
|
+
modalTransition.directives.directive,
|
|
207
|
+
utils_directive.bindDirectiveNoArg(services_siblingsInert.siblingsInert),
|
|
208
|
+
utils_directive.directiveSubscribe(action$),
|
|
209
|
+
modalAttributeDirective,
|
|
210
|
+
services_focusElement.focusElement
|
|
211
|
+
),
|
|
219
212
|
closeButtonDirective,
|
|
220
213
|
dialogDirective: utils_directive.bindDirective(
|
|
221
214
|
utils_directive.browserDirective((dialog, visible) => {
|
|
@@ -250,4 +243,5 @@ const createModal = utils_widget.createWidgetFactory("modal", (config$) => {
|
|
|
250
243
|
exports.createModal = createModal;
|
|
251
244
|
exports.getModalDefaultConfig = getModalDefaultConfig;
|
|
252
245
|
exports.modalCloseButtonClick = modalCloseButtonClick;
|
|
246
|
+
exports.modalCloseEscape = modalCloseEscape;
|
|
253
247
|
exports.modalOutsideClick = modalOutsideClick;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed } from "@amadeus-it-group/tansu";
|
|
2
2
|
import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
|
|
3
|
-
import { l as isNumber, e as typeString, g as typeFunction, c as typeBoolean, a as typeNumber, k as clamp } from "./writables-
|
|
3
|
+
import { l as isNumber, e as typeString, g as typeFunction, c as typeBoolean, a as typeNumber, k as clamp } from "./writables-e0tyaQpe.js";
|
|
4
4
|
import { noop } from "./utils/func.js";
|
|
5
|
-
import {
|
|
5
|
+
import { p as createAttributesDirective } from "./dom-Bcg9ORcA.js";
|
|
6
6
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
7
7
|
const PAGE_LINK_DEFAULT = "#";
|
|
8
8
|
const defaultConfig = {
|
|
@@ -110,10 +110,10 @@ const createPagination = createWidgetFactory("pagination", (config) => {
|
|
|
110
110
|
const ariaLiveLabelText$ = computed(() => ariaLiveLabel$()(page$(), pageCount$()));
|
|
111
111
|
function handleNavigation(pageNumber, event) {
|
|
112
112
|
if (pagesHrefs$()[pageNumber - 1] === PAGE_LINK_DEFAULT) {
|
|
113
|
-
event
|
|
113
|
+
event?.preventDefault();
|
|
114
114
|
}
|
|
115
115
|
if (!event || !(event.ctrlKey || event.metaKey)) {
|
|
116
|
-
event
|
|
116
|
+
event?.preventDefault();
|
|
117
117
|
page$.set(pageNumber);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const tansu = require("@amadeus-it-group/tansu");
|
|
3
3
|
const utils_stores = require("./utils/stores.cjs");
|
|
4
|
-
const utils_writables = require("./writables-
|
|
4
|
+
const utils_writables = require("./writables-DcGT98a7.cjs");
|
|
5
5
|
const utils_func = require("./utils/func.cjs");
|
|
6
|
-
const utils_directive = require("./dom-
|
|
6
|
+
const utils_directive = require("./dom-C2gi9OCP.cjs");
|
|
7
7
|
const utils_widget = require("./utils/widget.cjs");
|
|
8
8
|
const PAGE_LINK_DEFAULT = "#";
|
|
9
9
|
const defaultConfig = {
|
|
@@ -111,10 +111,10 @@ const createPagination = utils_widget.createWidgetFactory("pagination", (config)
|
|
|
111
111
|
const ariaLiveLabelText$ = tansu.computed(() => ariaLiveLabel$()(page$(), pageCount$()));
|
|
112
112
|
function handleNavigation(pageNumber, event) {
|
|
113
113
|
if (pagesHrefs$()[pageNumber - 1] === PAGE_LINK_DEFAULT) {
|
|
114
|
-
event
|
|
114
|
+
event?.preventDefault();
|
|
115
115
|
}
|
|
116
116
|
if (!event || !(event.ctrlKey || event.metaKey)) {
|
|
117
|
-
event
|
|
117
|
+
event?.preventDefault();
|
|
118
118
|
page$.set(pageNumber);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { k as clamp, g as typeFunction, e as typeString, a as typeNumber } from "./writables-
|
|
1
|
+
import { k as clamp, g as typeFunction, e as typeString, a as typeNumber } from "./writables-e0tyaQpe.js";
|
|
2
2
|
import { writablesForProps, stateStores } from "./utils/stores.js";
|
|
3
3
|
import { computed, readable } from "@amadeus-it-group/tansu";
|
|
4
|
-
import {
|
|
4
|
+
import { p as createAttributesDirective } from "./dom-Bcg9ORcA.js";
|
|
5
5
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
6
6
|
const defaultConfig = {
|
|
7
7
|
min: 0,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const utils_writables = require("./writables-
|
|
2
|
+
const utils_writables = require("./writables-DcGT98a7.cjs");
|
|
3
3
|
const utils_stores = require("./utils/stores.cjs");
|
|
4
4
|
const tansu = require("@amadeus-it-group/tansu");
|
|
5
|
-
const utils_directive = require("./dom-
|
|
5
|
+
const utils_directive = require("./dom-C2gi9OCP.cjs");
|
|
6
6
|
const utils_widget = require("./utils/widget.cjs");
|
|
7
7
|
const defaultConfig = {
|
|
8
8
|
min: 0,
|
|
@@ -111,9 +111,9 @@ const promiseWithResolve = () => {
|
|
|
111
111
|
return { promise, resolve };
|
|
112
112
|
};
|
|
113
113
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
promiseStoreToValueStore as a,
|
|
115
|
+
promiseFromEvent as b,
|
|
116
|
+
promiseFromTimeout as c,
|
|
117
|
+
promiseWithResolve as d,
|
|
118
|
+
promiseFromStore as p
|
|
119
119
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, writable, readable } from "@amadeus-it-group/tansu";
|
|
2
2
|
import { INVALID_VALUE } from "./types.js";
|
|
3
|
-
import {
|
|
4
|
-
import { e as typeString, g as typeFunction, c as typeBoolean, a as typeNumber, k as clamp, l as isNumber } from "./writables-
|
|
3
|
+
import { p as createAttributesDirective } from "./dom-Bcg9ORcA.js";
|
|
4
|
+
import { e as typeString, g as typeFunction, c as typeBoolean, a as typeNumber, k as clamp, l as isNumber } from "./writables-e0tyaQpe.js";
|
|
5
5
|
import { noop } from "./utils/func.js";
|
|
6
6
|
import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
|
|
7
7
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const tansu = require("@amadeus-it-group/tansu");
|
|
3
3
|
const types = require("./types.cjs");
|
|
4
|
-
const utils_directive = require("./dom-
|
|
5
|
-
const utils_writables = require("./writables-
|
|
4
|
+
const utils_directive = require("./dom-C2gi9OCP.cjs");
|
|
5
|
+
const utils_writables = require("./writables-DcGT98a7.cjs");
|
|
6
6
|
const utils_func = require("./utils/func.cjs");
|
|
7
7
|
const utils_stores = require("./utils/stores.cjs");
|
|
8
8
|
const utils_widget = require("./utils/widget.cjs");
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const utils_func = require("./utils/func.cjs");
|
|
3
|
+
const internalRemoveScrollbars = () => {
|
|
4
|
+
const scrollbarWidth = Math.abs(window.innerWidth - document.documentElement.clientWidth);
|
|
5
|
+
const body = document.body;
|
|
6
|
+
const bodyStyle = body.style;
|
|
7
|
+
const { overflow, paddingRight } = bodyStyle;
|
|
8
|
+
if (scrollbarWidth > 0) {
|
|
9
|
+
const actualPadding = parseFloat(window.getComputedStyle(body).paddingRight);
|
|
10
|
+
bodyStyle.paddingRight = `${actualPadding + scrollbarWidth}px`;
|
|
11
|
+
}
|
|
12
|
+
bodyStyle.overflow = "hidden";
|
|
13
|
+
return () => {
|
|
14
|
+
if (scrollbarWidth > 0) {
|
|
15
|
+
bodyStyle.paddingRight = paddingRight;
|
|
16
|
+
}
|
|
17
|
+
bodyStyle.overflow = overflow;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
let internalRevert = utils_func.noop;
|
|
21
|
+
const removeScrollbars = () => {
|
|
22
|
+
internalRevert();
|
|
23
|
+
internalRevert = internalRemoveScrollbars();
|
|
24
|
+
};
|
|
25
|
+
const revertScrollbars = () => {
|
|
26
|
+
internalRevert();
|
|
27
|
+
internalRevert = utils_func.noop;
|
|
28
|
+
};
|
|
29
|
+
exports.removeScrollbars = removeScrollbars;
|
|
30
|
+
exports.revertScrollbars = revertScrollbars;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { noop } from "./utils/func.js";
|
|
2
|
+
const internalRemoveScrollbars = () => {
|
|
3
|
+
const scrollbarWidth = Math.abs(window.innerWidth - document.documentElement.clientWidth);
|
|
4
|
+
const body = document.body;
|
|
5
|
+
const bodyStyle = body.style;
|
|
6
|
+
const { overflow, paddingRight } = bodyStyle;
|
|
7
|
+
if (scrollbarWidth > 0) {
|
|
8
|
+
const actualPadding = parseFloat(window.getComputedStyle(body).paddingRight);
|
|
9
|
+
bodyStyle.paddingRight = `${actualPadding + scrollbarWidth}px`;
|
|
10
|
+
}
|
|
11
|
+
bodyStyle.overflow = "hidden";
|
|
12
|
+
return () => {
|
|
13
|
+
if (scrollbarWidth > 0) {
|
|
14
|
+
bodyStyle.paddingRight = paddingRight;
|
|
15
|
+
}
|
|
16
|
+
bodyStyle.overflow = overflow;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
let internalRevert = noop;
|
|
20
|
+
const removeScrollbars = () => {
|
|
21
|
+
internalRevert();
|
|
22
|
+
internalRevert = internalRemoveScrollbars();
|
|
23
|
+
};
|
|
24
|
+
const revertScrollbars = () => {
|
|
25
|
+
internalRevert();
|
|
26
|
+
internalRevert = noop;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
revertScrollbars as a,
|
|
30
|
+
removeScrollbars as r
|
|
31
|
+
};
|
|
@@ -3,7 +3,7 @@ import { offset, autoPlacement, size } from "@floating-ui/dom";
|
|
|
3
3
|
import { createFloatingUI } from "./services/floatingUI.js";
|
|
4
4
|
import { createHasFocus } from "./services/focustrack.js";
|
|
5
5
|
import { createNavManager } from "./services/navManager.js";
|
|
6
|
-
import {
|
|
6
|
+
import { v as generateId, n as mergeDirectives, p as createAttributesDirective, a as bindDirective } from "./dom-Bcg9ORcA.js";
|
|
7
7
|
import { noop } from "./utils/func.js";
|
|
8
8
|
import { writablesForProps, bindableProp, bindableDerived, stateStores, true$ } from "./utils/stores.js";
|
|
9
9
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
@@ -70,7 +70,7 @@ const createSelect = createWidgetFactory("select", (config) => {
|
|
|
70
70
|
return selectedItemsContext;
|
|
71
71
|
});
|
|
72
72
|
const selectedContexts$ = computed(() => [...selectedContextsMap$().values()]);
|
|
73
|
-
const highlightedIndex$ = function() {
|
|
73
|
+
const highlightedIndex$ = (function() {
|
|
74
74
|
const store = writable(0);
|
|
75
75
|
return asWritable(store, (index) => {
|
|
76
76
|
const { length } = visibleItems$();
|
|
@@ -85,7 +85,7 @@ const createSelect = createWidgetFactory("select", (config) => {
|
|
|
85
85
|
}
|
|
86
86
|
store.set(index);
|
|
87
87
|
});
|
|
88
|
-
}();
|
|
88
|
+
})();
|
|
89
89
|
const itemContexts$ = computed(() => {
|
|
90
90
|
const itemContexts = /* @__PURE__ */ new Map();
|
|
91
91
|
if (open$()) {
|
|
@@ -318,7 +318,6 @@ const createSelect = createWidgetFactory("select", (config) => {
|
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
320
320
|
selected$.update((selectedItems) => {
|
|
321
|
-
var _a;
|
|
322
321
|
selectedItems = [...selectedItems];
|
|
323
322
|
if (selected && !isInSelected) {
|
|
324
323
|
selectedItems.push(item);
|
|
@@ -326,7 +325,7 @@ const createSelect = createWidgetFactory("select", (config) => {
|
|
|
326
325
|
const index = selectedItems.findIndex((item2) => itemIdFn(item2) === itemId);
|
|
327
326
|
selectedItems.splice(index, 1);
|
|
328
327
|
}
|
|
329
|
-
|
|
328
|
+
onSelectedChange$()?.(selectedItems);
|
|
330
329
|
return selectedItems;
|
|
331
330
|
});
|
|
332
331
|
},
|
|
@@ -4,7 +4,7 @@ const dom = require("@floating-ui/dom");
|
|
|
4
4
|
const services_floatingUI = require("./services/floatingUI.cjs");
|
|
5
5
|
const services_focustrack = require("./services/focustrack.cjs");
|
|
6
6
|
const services_navManager = require("./services/navManager.cjs");
|
|
7
|
-
const utils_directive = require("./dom-
|
|
7
|
+
const utils_directive = require("./dom-C2gi9OCP.cjs");
|
|
8
8
|
const utils_func = require("./utils/func.cjs");
|
|
9
9
|
const utils_stores = require("./utils/stores.cjs");
|
|
10
10
|
const utils_widget = require("./utils/widget.cjs");
|
|
@@ -71,7 +71,7 @@ const createSelect = utils_widget.createWidgetFactory("select", (config) => {
|
|
|
71
71
|
return selectedItemsContext;
|
|
72
72
|
});
|
|
73
73
|
const selectedContexts$ = tansu.computed(() => [...selectedContextsMap$().values()]);
|
|
74
|
-
const highlightedIndex$ = function() {
|
|
74
|
+
const highlightedIndex$ = (function() {
|
|
75
75
|
const store = tansu.writable(0);
|
|
76
76
|
return tansu.asWritable(store, (index) => {
|
|
77
77
|
const { length } = visibleItems$();
|
|
@@ -86,7 +86,7 @@ const createSelect = utils_widget.createWidgetFactory("select", (config) => {
|
|
|
86
86
|
}
|
|
87
87
|
store.set(index);
|
|
88
88
|
});
|
|
89
|
-
}();
|
|
89
|
+
})();
|
|
90
90
|
const itemContexts$ = tansu.computed(() => {
|
|
91
91
|
const itemContexts = /* @__PURE__ */ new Map();
|
|
92
92
|
if (open$()) {
|
|
@@ -319,7 +319,6 @@ const createSelect = utils_widget.createWidgetFactory("select", (config) => {
|
|
|
319
319
|
return;
|
|
320
320
|
}
|
|
321
321
|
selected$.update((selectedItems) => {
|
|
322
|
-
var _a;
|
|
323
322
|
selectedItems = [...selectedItems];
|
|
324
323
|
if (selected && !isInSelected) {
|
|
325
324
|
selectedItems.push(item);
|
|
@@ -327,7 +326,7 @@ const createSelect = utils_widget.createWidgetFactory("select", (config) => {
|
|
|
327
326
|
const index = selectedItems.findIndex((item2) => itemIdFn(item2) === itemId);
|
|
328
327
|
selectedItems.splice(index, 1);
|
|
329
328
|
}
|
|
330
|
-
|
|
329
|
+
onSelectedChange$()?.(selectedItems);
|
|
331
330
|
return selectedItems;
|
|
332
331
|
});
|
|
333
332
|
},
|
|
@@ -6,9 +6,9 @@ const types = require("../types.cjs");
|
|
|
6
6
|
const extendWidgetProps = (factory, extraPropsDefaults, extraPropsConfig, overrideDefaults) => {
|
|
7
7
|
const extendedFactory = (propsConfig) => {
|
|
8
8
|
const extraPropsWritables = utils_stores.writablesWithDefault(extraPropsDefaults, propsConfig, extraPropsConfig);
|
|
9
|
-
const propsConfigConfig = propsConfig
|
|
9
|
+
const propsConfigConfig = propsConfig?.config;
|
|
10
10
|
const config = utils_stores.isStore(propsConfigConfig) ? tansu.computed(() => ({ ...overrideDefaults, ...propsConfigConfig() })) : { ...overrideDefaults, ...propsConfigConfig ?? {} };
|
|
11
|
-
const widget = factory({ props: propsConfig
|
|
11
|
+
const widget = factory({ props: propsConfig?.props, config });
|
|
12
12
|
return {
|
|
13
13
|
...widget,
|
|
14
14
|
...utils_stores.stateStores({ ...widget.stores, ...extraPropsWritables }),
|
package/services/extendWidget.js
CHANGED
|
@@ -4,9 +4,9 @@ import { FACTORY_WIDGET_NAME } from "../types.js";
|
|
|
4
4
|
const extendWidgetProps = (factory, extraPropsDefaults, extraPropsConfig, overrideDefaults) => {
|
|
5
5
|
const extendedFactory = (propsConfig) => {
|
|
6
6
|
const extraPropsWritables = writablesWithDefault(extraPropsDefaults, propsConfig, extraPropsConfig);
|
|
7
|
-
const propsConfigConfig = propsConfig
|
|
7
|
+
const propsConfigConfig = propsConfig?.config;
|
|
8
8
|
const config = isStore(propsConfigConfig) ? computed(() => ({ ...overrideDefaults, ...propsConfigConfig() })) : { ...overrideDefaults, ...propsConfigConfig ?? {} };
|
|
9
|
-
const widget = factory({ props: propsConfig
|
|
9
|
+
const widget = factory({ props: propsConfig?.props, config });
|
|
10
10
|
return {
|
|
11
11
|
...widget,
|
|
12
12
|
...stateStores({ ...widget.stores, ...extraPropsWritables }),
|
package/services/floatingUI.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const tansu = require("@amadeus-it-group/tansu");
|
|
4
4
|
const dom = require("@floating-ui/dom");
|
|
5
|
-
const utils_directive = require("../dom-
|
|
5
|
+
const utils_directive = require("../dom-C2gi9OCP.cjs");
|
|
6
6
|
const promise = require("../promise-CxCD3NYv.cjs");
|
|
7
7
|
const utils_stores = require("../utils/stores.cjs");
|
|
8
8
|
const defaultConfig = {
|
|
@@ -59,34 +59,13 @@ const createFloatingUI = (propsConfig) => {
|
|
|
59
59
|
null
|
|
60
60
|
);
|
|
61
61
|
const position$ = promise.promiseStoreToValueStore(promisePosition$, null);
|
|
62
|
-
const placement$ = tansu.computed(() =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
const x$ = tansu.computed(() => {
|
|
71
|
-
var _a;
|
|
72
|
-
return (_a = position$()) == null ? void 0 : _a.x;
|
|
73
|
-
});
|
|
74
|
-
const y$ = tansu.computed(() => {
|
|
75
|
-
var _a;
|
|
76
|
-
return (_a = position$()) == null ? void 0 : _a.y;
|
|
77
|
-
});
|
|
78
|
-
const strategy$ = tansu.computed(() => {
|
|
79
|
-
var _a;
|
|
80
|
-
return (_a = position$()) == null ? void 0 : _a.strategy;
|
|
81
|
-
});
|
|
82
|
-
const arrowX$ = tansu.computed(() => {
|
|
83
|
-
var _a, _b;
|
|
84
|
-
return (_b = (_a = middlewareData$()) == null ? void 0 : _a.arrow) == null ? void 0 : _b.x;
|
|
85
|
-
});
|
|
86
|
-
const arrowY$ = tansu.computed(() => {
|
|
87
|
-
var _a, _b;
|
|
88
|
-
return (_b = (_a = middlewareData$()) == null ? void 0 : _a.arrow) == null ? void 0 : _b.y;
|
|
89
|
-
});
|
|
62
|
+
const placement$ = tansu.computed(() => position$()?.placement);
|
|
63
|
+
const middlewareData$ = tansu.computed(() => position$()?.middlewareData);
|
|
64
|
+
const x$ = tansu.computed(() => position$()?.x);
|
|
65
|
+
const y$ = tansu.computed(() => position$()?.y);
|
|
66
|
+
const strategy$ = tansu.computed(() => position$()?.strategy);
|
|
67
|
+
const arrowX$ = tansu.computed(() => middlewareData$()?.arrow?.x);
|
|
68
|
+
const arrowY$ = tansu.computed(() => middlewareData$()?.arrow?.y);
|
|
90
69
|
const floatingStyleApplyAction$ = tansu.computed(() => {
|
|
91
70
|
const floatingElement = floatingElement$();
|
|
92
71
|
if (floatingElement) {
|
package/services/floatingUI.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, derived } from "@amadeus-it-group/tansu";
|
|
2
2
|
import { arrow, autoUpdate, computePosition } from "@floating-ui/dom";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { l as createBrowserStoreDirective, n as mergeDirectives, d as directiveSubscribe } from "../dom-Bcg9ORcA.js";
|
|
4
|
+
import { a as promiseStoreToValueStore } from "../promise-Y53vc4Ia.js";
|
|
5
5
|
import { writablesForProps, stateStores } from "../utils/stores.js";
|
|
6
6
|
const defaultConfig = {
|
|
7
7
|
computePositionOptions: {},
|
|
@@ -57,34 +57,13 @@ const createFloatingUI = (propsConfig) => {
|
|
|
57
57
|
null
|
|
58
58
|
);
|
|
59
59
|
const position$ = promiseStoreToValueStore(promisePosition$, null);
|
|
60
|
-
const placement$ = computed(() =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
const x$ = computed(() => {
|
|
69
|
-
var _a;
|
|
70
|
-
return (_a = position$()) == null ? void 0 : _a.x;
|
|
71
|
-
});
|
|
72
|
-
const y$ = computed(() => {
|
|
73
|
-
var _a;
|
|
74
|
-
return (_a = position$()) == null ? void 0 : _a.y;
|
|
75
|
-
});
|
|
76
|
-
const strategy$ = computed(() => {
|
|
77
|
-
var _a;
|
|
78
|
-
return (_a = position$()) == null ? void 0 : _a.strategy;
|
|
79
|
-
});
|
|
80
|
-
const arrowX$ = computed(() => {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
return (_b = (_a = middlewareData$()) == null ? void 0 : _a.arrow) == null ? void 0 : _b.x;
|
|
83
|
-
});
|
|
84
|
-
const arrowY$ = computed(() => {
|
|
85
|
-
var _a, _b;
|
|
86
|
-
return (_b = (_a = middlewareData$()) == null ? void 0 : _a.arrow) == null ? void 0 : _b.y;
|
|
87
|
-
});
|
|
60
|
+
const placement$ = computed(() => position$()?.placement);
|
|
61
|
+
const middlewareData$ = computed(() => position$()?.middlewareData);
|
|
62
|
+
const x$ = computed(() => position$()?.x);
|
|
63
|
+
const y$ = computed(() => position$()?.y);
|
|
64
|
+
const strategy$ = computed(() => position$()?.strategy);
|
|
65
|
+
const arrowX$ = computed(() => middlewareData$()?.arrow?.x);
|
|
66
|
+
const arrowY$ = computed(() => middlewareData$()?.arrow?.y);
|
|
88
67
|
const floatingStyleApplyAction$ = computed(() => {
|
|
89
68
|
const floatingElement = floatingElement$();
|
|
90
69
|
if (floatingElement) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const utils_directive = require("../dom-C2gi9OCP.cjs");
|
|
4
|
+
const isFocusable = require("../isFocusable-DfzDLeAN.cjs");
|
|
5
|
+
const stack = [];
|
|
6
|
+
let stackProcessPlanned = false;
|
|
7
|
+
const processStack = () => {
|
|
8
|
+
stackProcessPlanned = false;
|
|
9
|
+
const candidates = [];
|
|
10
|
+
while (stack.length > 0) {
|
|
11
|
+
const top = stack[stack.length - 1];
|
|
12
|
+
if (top.element) {
|
|
13
|
+
candidates.push(top.element);
|
|
14
|
+
break;
|
|
15
|
+
} else {
|
|
16
|
+
if (top.previousElement) {
|
|
17
|
+
candidates.push(top.previousElement);
|
|
18
|
+
}
|
|
19
|
+
stack.pop();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
for (const candidate of candidates) {
|
|
23
|
+
if (isFocusable.isFocusable(candidate)) {
|
|
24
|
+
candidate.focus();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const planProcessStack = () => {
|
|
30
|
+
if (!stackProcessPlanned) {
|
|
31
|
+
stackProcessPlanned = true;
|
|
32
|
+
setTimeout(processStack, 0);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const focusElement = utils_directive.browserDirective((element) => {
|
|
36
|
+
const stackEntry = { element, previousElement: document.activeElement };
|
|
37
|
+
stack.push(stackEntry);
|
|
38
|
+
planProcessStack();
|
|
39
|
+
return {
|
|
40
|
+
destroy() {
|
|
41
|
+
stackEntry.element = null;
|
|
42
|
+
planProcessStack();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
exports.focusElement = focusElement;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Directive } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Directive to focus an element and manage focus stack.
|
|
4
|
+
* When the element is destroyed, focus returns to the previous focusable element in the stack.
|
|
5
|
+
*
|
|
6
|
+
* @param element - The HTML element to focus.
|
|
7
|
+
* @returns An object with a destroy method to remove the element from the focus stack.
|
|
8
|
+
*/
|
|
9
|
+
export declare const focusElement: Directive;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { b as browserDirective } from "../dom-Bcg9ORcA.js";
|
|
2
|
+
import { i as isFocusable } from "../isFocusable-Ckwus82R.js";
|
|
3
|
+
const stack = [];
|
|
4
|
+
let stackProcessPlanned = false;
|
|
5
|
+
const processStack = () => {
|
|
6
|
+
stackProcessPlanned = false;
|
|
7
|
+
const candidates = [];
|
|
8
|
+
while (stack.length > 0) {
|
|
9
|
+
const top = stack[stack.length - 1];
|
|
10
|
+
if (top.element) {
|
|
11
|
+
candidates.push(top.element);
|
|
12
|
+
break;
|
|
13
|
+
} else {
|
|
14
|
+
if (top.previousElement) {
|
|
15
|
+
candidates.push(top.previousElement);
|
|
16
|
+
}
|
|
17
|
+
stack.pop();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
for (const candidate of candidates) {
|
|
21
|
+
if (isFocusable(candidate)) {
|
|
22
|
+
candidate.focus();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const planProcessStack = () => {
|
|
28
|
+
if (!stackProcessPlanned) {
|
|
29
|
+
stackProcessPlanned = true;
|
|
30
|
+
setTimeout(processStack, 0);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const focusElement = browserDirective((element) => {
|
|
34
|
+
const stackEntry = { element, previousElement: document.activeElement };
|
|
35
|
+
stack.push(stackEntry);
|
|
36
|
+
planProcessStack();
|
|
37
|
+
return {
|
|
38
|
+
destroy() {
|
|
39
|
+
stackEntry.element = null;
|
|
40
|
+
planProcessStack();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
export {
|
|
45
|
+
focusElement
|
|
46
|
+
};
|
package/services/focustrack.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const tansu = require("@amadeus-it-group/tansu");
|
|
4
|
-
const utils_directive = require("../dom-
|
|
4
|
+
const utils_directive = require("../dom-C2gi9OCP.cjs");
|
|
5
5
|
const esmEnv = require("esm-env");
|
|
6
6
|
const evtFocusIn = "focusin";
|
|
7
7
|
const evtFocusOut = "focusout";
|
package/services/focustrack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readable, computed } from "@amadeus-it-group/tansu";
|
|
2
|
-
import {
|
|
2
|
+
import { h as createBrowserStoreArrayDirective } from "../dom-Bcg9ORcA.js";
|
|
3
3
|
import { BROWSER } from "esm-env";
|
|
4
4
|
const evtFocusIn = "focusin";
|
|
5
5
|
const evtFocusOut = "focusout";
|
package/services/matchMedia.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const tansu = require("@amadeus-it-group/tansu");
|
|
4
4
|
const esmEnv = require("esm-env");
|
|
5
|
-
const utils_directive = require("../dom-
|
|
5
|
+
const utils_directive = require("../dom-C2gi9OCP.cjs");
|
|
6
6
|
const utils_stores = require("../utils/stores.cjs");
|
|
7
7
|
const createMatchMedia = (query) => esmEnv.BROWSER ? tansu.readable(false, {
|
|
8
8
|
onUse({ set }) {
|