@agnos-ui/core 0.9.2 → 0.10.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{accordion-CoM4efp-.js → accordion-CcirvrjR.js} +10 -15
- package/{accordion-cR5JqWJ8.cjs → accordion-yD-czBna.cjs} +10 -15
- package/{alert-DtDozJal.cjs → alert-B-jQDQcB.cjs} +1 -1
- package/{alert-YIlqdEPO.js → alert-gGz2CDS9.js} +1 -1
- package/collapse-BV4kD3j9.js +82 -0
- package/collapse-gLiT080Y.cjs +81 -0
- package/{common-BToNPUDq.cjs → common-D3QcdJ6S.cjs} +1 -1
- package/{common-BqUjUBPy.js → common-DK0ADNTX.js} +1 -1
- 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/index.cjs +10 -23
- package/components/carousel/index.js +10 -23
- package/components/collapse/collapse.d.ts +132 -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/drawer/drawer.d.ts +222 -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/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/config.cjs +2 -2
- package/config.d.ts +10 -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 +21 -12
- package/index.d.ts +2 -0
- package/index.js +54 -45
- 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
package/index.cjs
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const types = require("./types.cjs");
|
|
4
|
-
const accordion = require("./accordion-
|
|
5
|
-
const alert = require("./alert-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
4
|
+
const accordion = require("./accordion-yD-czBna.cjs");
|
|
5
|
+
const alert = require("./alert-B-jQDQcB.cjs");
|
|
6
|
+
const collapse = require("./collapse-gLiT080Y.cjs");
|
|
7
|
+
const modal = require("./modal-DiXZXYjR.cjs");
|
|
8
|
+
const pagination = require("./pagination-DvZ2rLsz.cjs");
|
|
9
|
+
const progressbar = require("./progressbar-i9xfAxb7.cjs");
|
|
10
|
+
const rating = require("./rating-DmG4oUkr.cjs");
|
|
11
|
+
const select = require("./select-MFjAnIt7.cjs");
|
|
12
|
+
const slider = require("./slider-Dl4Trh32.cjs");
|
|
13
|
+
const toaster = require("./toaster-UDglac7x.cjs");
|
|
14
|
+
const tree = require("./tree-rGHtmCnS.cjs");
|
|
15
|
+
const drawer = require("./drawer-DP7UPojk.cjs");
|
|
14
16
|
const config = require("./config.cjs");
|
|
15
17
|
const services_extendWidget = require("./services/extendWidget.cjs");
|
|
16
18
|
const services_floatingUI = require("./services/floatingUI.cjs");
|
|
@@ -25,9 +27,9 @@ const services_hash = require("./services/hash.cjs");
|
|
|
25
27
|
const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
|
|
26
28
|
const services_transitions_cssTransitions = require("./services/transitions/cssTransitions.cjs");
|
|
27
29
|
const services_transitions_simpleClassTransition = require("./services/transitions/simpleClassTransition.cjs");
|
|
28
|
-
const utils_directive = require("./dom-
|
|
30
|
+
const utils_directive = require("./dom-C2gi9OCP.cjs");
|
|
29
31
|
const utils_stores = require("./utils/stores.cjs");
|
|
30
|
-
const utils_writables = require("./writables-
|
|
32
|
+
const utils_writables = require("./writables-DcGT98a7.cjs");
|
|
31
33
|
exports.FACTORY_WIDGET_NAME = types.FACTORY_WIDGET_NAME;
|
|
32
34
|
exports.INVALID_VALUE = types.INVALID_VALUE;
|
|
33
35
|
exports.createAccordion = accordion.createAccordion;
|
|
@@ -36,9 +38,12 @@ exports.factoryCreateAccordion = accordion.factoryCreateAccordion;
|
|
|
36
38
|
exports.getAccordionDefaultConfig = accordion.getAccordionDefaultConfig;
|
|
37
39
|
exports.createAlert = alert.createAlert;
|
|
38
40
|
exports.getAlertDefaultConfig = alert.getAlertDefaultConfig;
|
|
41
|
+
exports.createCollapse = collapse.createCollapse;
|
|
42
|
+
exports.getCollapseDefaultConfig = collapse.getCollapseDefaultConfig;
|
|
39
43
|
exports.createModal = modal.createModal;
|
|
40
44
|
exports.getModalDefaultConfig = modal.getModalDefaultConfig;
|
|
41
45
|
exports.modalCloseButtonClick = modal.modalCloseButtonClick;
|
|
46
|
+
exports.modalCloseEscape = modal.modalCloseEscape;
|
|
42
47
|
exports.modalOutsideClick = modal.modalOutsideClick;
|
|
43
48
|
exports.createPagination = pagination.createPagination;
|
|
44
49
|
exports.getPaginationDefaultConfig = pagination.getPaginationDefaultConfig;
|
|
@@ -56,6 +61,8 @@ exports.defaultToasterProps = toaster.defaultToasterProps;
|
|
|
56
61
|
exports.getToastDefaultConfig = toaster.getToastDefaultConfig;
|
|
57
62
|
exports.createTree = tree.createTree;
|
|
58
63
|
exports.getTreeDefaultConfig = tree.getTreeDefaultConfig;
|
|
64
|
+
exports.createDrawer = drawer.createDrawer;
|
|
65
|
+
exports.getDrawerDefaultConfig = drawer.getDrawerDefaultConfig;
|
|
59
66
|
exports.createWidgetsConfig = config.createWidgetsConfig;
|
|
60
67
|
exports.mergeInto = config.mergeInto;
|
|
61
68
|
exports.extendWidgetProps = services_extendWidget.extendWidgetProps;
|
|
@@ -85,6 +92,8 @@ exports.classDirective = utils_directive.classDirective;
|
|
|
85
92
|
exports.createAttributesDirective = utils_directive.createAttributesDirective;
|
|
86
93
|
exports.createBrowserStoreArrayDirective = utils_directive.createBrowserStoreArrayDirective;
|
|
87
94
|
exports.createBrowserStoreDirective = utils_directive.createBrowserStoreDirective;
|
|
95
|
+
exports.createConditionalBrowserStoreArrayDirective = utils_directive.createConditionalBrowserStoreArrayDirective;
|
|
96
|
+
exports.createConditionalStoreArrayDirective = utils_directive.createConditionalStoreArrayDirective;
|
|
88
97
|
exports.createStoreArrayDirective = utils_directive.createStoreArrayDirective;
|
|
89
98
|
exports.createStoreDirective = utils_directive.createStoreDirective;
|
|
90
99
|
exports.directiveAttributes = utils_directive.directiveAttributes;
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export * from './components/accordion';
|
|
3
3
|
export * from './components/alert';
|
|
4
|
+
export * from './components/collapse';
|
|
4
5
|
export * from './components/modal';
|
|
5
6
|
export * from './components/pagination';
|
|
6
7
|
export * from './components/progressbar';
|
|
@@ -9,6 +10,7 @@ export * from './components/select';
|
|
|
9
10
|
export * from './components/slider';
|
|
10
11
|
export * from './components/toast';
|
|
11
12
|
export * from './components/tree';
|
|
13
|
+
export * from './components/drawer';
|
|
12
14
|
export * from './config';
|
|
13
15
|
export * from './services/extendWidget';
|
|
14
16
|
export * from './services/floatingUI';
|
package/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { FACTORY_WIDGET_NAME, INVALID_VALUE } from "./types.js";
|
|
2
|
-
import { a, c, f, g } from "./accordion-
|
|
3
|
-
import { c as c2, g as g2 } from "./alert-
|
|
4
|
-
import { c as c3, g as g3
|
|
5
|
-
import { c as c4, g as g4 } from "./
|
|
6
|
-
import { c as c5, g as g5 } from "./
|
|
7
|
-
import { c as c6, g as g6 } from "./
|
|
8
|
-
import { c as c7, g as g7 } from "./
|
|
9
|
-
import { c as c8, g as g8 } from "./
|
|
10
|
-
import {
|
|
11
|
-
import { c as c10, g as g10 } from "./
|
|
2
|
+
import { a, c, f, g } from "./accordion-CcirvrjR.js";
|
|
3
|
+
import { c as c2, g as g2 } from "./alert-gGz2CDS9.js";
|
|
4
|
+
import { c as c3, g as g3 } from "./collapse-BV4kD3j9.js";
|
|
5
|
+
import { c as c4, g as g4, a as a2, b, m } from "./modal-CAvQW-vo.js";
|
|
6
|
+
import { c as c5, g as g5 } from "./pagination-BKbMROV6.js";
|
|
7
|
+
import { c as c6, g as g6 } from "./progressbar-D8zIcm9n.js";
|
|
8
|
+
import { c as c7, g as g7 } from "./rating-DEXTGWCU.js";
|
|
9
|
+
import { c as c8, g as g8 } from "./select-Bw68Xdu5.js";
|
|
10
|
+
import { c as c9, g as g9 } from "./slider-Cx50Eghd.js";
|
|
11
|
+
import { T, c as c10, d, g as g10 } from "./toaster-_p1GTtHI.js";
|
|
12
|
+
import { c as c11, g as g11 } from "./tree-DV0tfPlZ.js";
|
|
13
|
+
import { c as c12, g as g12 } from "./drawer-D5SO73ew.js";
|
|
12
14
|
import { createWidgetsConfig, mergeInto } from "./config.js";
|
|
13
15
|
import { extendWidgetProps } from "./services/extendWidget.js";
|
|
14
16
|
import { createFloatingUI } from "./services/floatingUI.js";
|
|
@@ -23,51 +25,55 @@ import { hash$ } from "./services/hash.js";
|
|
|
23
25
|
import { createTransition, noAnimation } from "./services/transitions/baseTransitions.js";
|
|
24
26
|
import { createCSSTransition, getTransitionDurationMs, hasTransition } from "./services/transitions/cssTransitions.js";
|
|
25
27
|
import { createSimpleClassTransition } from "./services/transitions/simpleClassTransition.js";
|
|
26
|
-
import {
|
|
28
|
+
import { q, a as a3, c as c13, b as b2, s, p, h, l, j, f as f2, g as g13, k, t, d as d2, e, i, m as m2, n, o, r, u } from "./dom-Bcg9ORcA.js";
|
|
27
29
|
import { bindableDerived, bindableProp, createPatch, false$, findChangedProperties, idWithDefault, isStore, mergeConfigStores, normalizeConfigStores, stateStores, toReadableStore, toWritableStore, true$, writableWithDefault, writablesForProps, writablesWithDefault } from "./utils/stores.js";
|
|
28
|
-
import { j as j2, t, i as i2, c as
|
|
30
|
+
import { j as j2, t as t2, i as i2, c as c14, d as d3, g as g14, h as h2, a as a4, b as b3, e as e2, f as f3 } from "./writables-e0tyaQpe.js";
|
|
29
31
|
export {
|
|
30
32
|
FACTORY_WIDGET_NAME,
|
|
31
33
|
INVALID_VALUE,
|
|
32
34
|
T as Toaster,
|
|
33
35
|
activeElement$,
|
|
34
|
-
|
|
36
|
+
q as attributesData,
|
|
35
37
|
a3 as bindDirective,
|
|
36
|
-
|
|
38
|
+
c13 as bindDirectiveNoArg,
|
|
37
39
|
bindableDerived,
|
|
38
40
|
bindableProp,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
b2 as browserDirective,
|
|
42
|
+
s as classDirective,
|
|
41
43
|
a as createAccordion,
|
|
42
44
|
c as createAccordionItem,
|
|
43
45
|
c2 as createAlert,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
p as createAttributesDirective,
|
|
47
|
+
h as createBrowserStoreArrayDirective,
|
|
48
|
+
l as createBrowserStoreDirective,
|
|
47
49
|
createCSSTransition,
|
|
50
|
+
c3 as createCollapse,
|
|
51
|
+
j as createConditionalBrowserStoreArrayDirective,
|
|
52
|
+
f2 as createConditionalStoreArrayDirective,
|
|
53
|
+
c12 as createDrawer,
|
|
48
54
|
createFloatingUI,
|
|
49
55
|
createHasFocus,
|
|
50
56
|
createIntersection,
|
|
51
57
|
createMatchMedia,
|
|
52
|
-
|
|
58
|
+
c4 as createModal,
|
|
53
59
|
createNavManager,
|
|
54
|
-
|
|
60
|
+
c5 as createPagination,
|
|
55
61
|
createPatch,
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
c6 as createProgressbar,
|
|
63
|
+
c7 as createRating,
|
|
58
64
|
createResizeObserver,
|
|
59
|
-
|
|
65
|
+
c8 as createSelect,
|
|
60
66
|
createSimpleClassTransition,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
c9 as createSlider,
|
|
68
|
+
g13 as createStoreArrayDirective,
|
|
69
|
+
k as createStoreDirective,
|
|
70
|
+
c10 as createToast,
|
|
65
71
|
createTransition,
|
|
66
|
-
|
|
72
|
+
c11 as createTree,
|
|
67
73
|
j2 as createTypeEnum,
|
|
68
74
|
createWidgetsConfig,
|
|
69
75
|
d as defaultToasterProps,
|
|
70
|
-
|
|
76
|
+
t as directiveAttributes,
|
|
71
77
|
d2 as directiveSubscribe,
|
|
72
78
|
e as directiveUpdate,
|
|
73
79
|
extendWidgetProps,
|
|
@@ -76,16 +82,18 @@ export {
|
|
|
76
82
|
findChangedProperties,
|
|
77
83
|
g as getAccordionDefaultConfig,
|
|
78
84
|
g2 as getAlertDefaultConfig,
|
|
85
|
+
g3 as getCollapseDefaultConfig,
|
|
86
|
+
g12 as getDrawerDefaultConfig,
|
|
79
87
|
getKeyName,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
g4 as getModalDefaultConfig,
|
|
89
|
+
g5 as getPaginationDefaultConfig,
|
|
90
|
+
g6 as getProgressbarDefaultConfig,
|
|
91
|
+
g7 as getRatingDefaultConfig,
|
|
92
|
+
g8 as getSelectDefaultConfig,
|
|
93
|
+
g9 as getSliderDefaultConfig,
|
|
94
|
+
g10 as getToastDefaultConfig,
|
|
87
95
|
getTransitionDurationMs,
|
|
88
|
-
|
|
96
|
+
g11 as getTreeDefaultConfig,
|
|
89
97
|
hasTransition,
|
|
90
98
|
hash$,
|
|
91
99
|
idWithDefault,
|
|
@@ -94,29 +102,30 @@ export {
|
|
|
94
102
|
isStore,
|
|
95
103
|
m2 as mapDirectiveArg,
|
|
96
104
|
mergeConfigStores,
|
|
97
|
-
|
|
105
|
+
n as mergeDirectives,
|
|
98
106
|
mergeInto,
|
|
99
107
|
a2 as modalCloseButtonClick,
|
|
108
|
+
b as modalCloseEscape,
|
|
100
109
|
m as modalOutsideClick,
|
|
101
|
-
|
|
110
|
+
o as multiDirective,
|
|
102
111
|
noAnimation,
|
|
103
112
|
normalizeConfigStores,
|
|
104
113
|
portal,
|
|
105
114
|
r as registrationArray,
|
|
106
115
|
siblingsInert,
|
|
107
|
-
|
|
116
|
+
u as ssrAttributes,
|
|
108
117
|
stateStores,
|
|
109
|
-
|
|
118
|
+
t2 as testToNormalizeValue,
|
|
110
119
|
toReadableStore,
|
|
111
120
|
toWritableStore,
|
|
112
121
|
true$,
|
|
113
122
|
i2 as typeArray,
|
|
114
|
-
|
|
123
|
+
c14 as typeBoolean,
|
|
115
124
|
d3 as typeBooleanOrNull,
|
|
116
|
-
|
|
125
|
+
g14 as typeFunction,
|
|
117
126
|
h2 as typeHTMLElementOrNull,
|
|
118
127
|
a4 as typeNumber,
|
|
119
|
-
|
|
128
|
+
b3 as typeNumberInRangeFactory,
|
|
120
129
|
e2 as typeString,
|
|
121
130
|
f3 as typeStringOrNull,
|
|
122
131
|
writableWithDefault,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const isInertOrInvisible = (element) => {
|
|
2
|
+
let curElement = element;
|
|
3
|
+
while (curElement) {
|
|
4
|
+
const style = getComputedStyle(curElement);
|
|
5
|
+
if (curElement.inert || curElement.hidden || style.display === "none" || style.visibility === "hidden") {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
curElement = curElement.parentElement;
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
};
|
|
12
|
+
const checkNotDisabled = (element) => {
|
|
13
|
+
if (element.disabled) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const parentFieldset = element.parentElement?.closest("fieldset");
|
|
17
|
+
return parentFieldset ? checkNotDisabled(parentFieldset) : true;
|
|
18
|
+
};
|
|
19
|
+
const isFocusableOtherTags = (element) => element.isContentEditable || !!element.hasAttribute("tabindex");
|
|
20
|
+
const isFocusableByTagName = {
|
|
21
|
+
INPUT: (element) => element.type !== "hidden" && checkNotDisabled(element),
|
|
22
|
+
SELECT: checkNotDisabled,
|
|
23
|
+
TEXTAREA: checkNotDisabled,
|
|
24
|
+
BUTTON: checkNotDisabled,
|
|
25
|
+
A: (element) => !!element.href || isFocusableOtherTags(element)
|
|
26
|
+
};
|
|
27
|
+
const isFocusable = (element) => {
|
|
28
|
+
return document.contains(element) && !isInertOrInvisible(element) && (isFocusableByTagName[element.tagName] ?? isFocusableOtherTags)(element);
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
isFocusable as i
|
|
32
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const isInertOrInvisible = (element) => {
|
|
3
|
+
let curElement = element;
|
|
4
|
+
while (curElement) {
|
|
5
|
+
const style = getComputedStyle(curElement);
|
|
6
|
+
if (curElement.inert || curElement.hidden || style.display === "none" || style.visibility === "hidden") {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
curElement = curElement.parentElement;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
};
|
|
13
|
+
const checkNotDisabled = (element) => {
|
|
14
|
+
if (element.disabled) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const parentFieldset = element.parentElement?.closest("fieldset");
|
|
18
|
+
return parentFieldset ? checkNotDisabled(parentFieldset) : true;
|
|
19
|
+
};
|
|
20
|
+
const isFocusableOtherTags = (element) => element.isContentEditable || !!element.hasAttribute("tabindex");
|
|
21
|
+
const isFocusableByTagName = {
|
|
22
|
+
INPUT: (element) => element.type !== "hidden" && checkNotDisabled(element),
|
|
23
|
+
SELECT: checkNotDisabled,
|
|
24
|
+
TEXTAREA: checkNotDisabled,
|
|
25
|
+
BUTTON: checkNotDisabled,
|
|
26
|
+
A: (element) => !!element.href || isFocusableOtherTags(element)
|
|
27
|
+
};
|
|
28
|
+
const isFocusable = (element) => {
|
|
29
|
+
return document.contains(element) && !isInertOrInvisible(element) && (isFocusableByTagName[element.tagName] ?? isFocusableOtherTags)(element);
|
|
30
|
+
};
|
|
31
|
+
exports.isFocusable = isFocusable;
|
|
@@ -1,41 +1,18 @@
|
|
|
1
1
|
import { computed, readable } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { c as typeBoolean, g as typeFunction, e as typeString, h as typeHTMLElementOrNull } from "./writables-
|
|
2
|
+
import { c as typeBoolean, g as typeFunction, e as typeString, h as typeHTMLElementOrNull } from "./writables-e0tyaQpe.js";
|
|
3
3
|
import { writablesForProps, stateStores } from "./utils/stores.js";
|
|
4
4
|
import { createTransition } from "./services/transitions/baseTransitions.js";
|
|
5
|
-
import {
|
|
5
|
+
import { p as promiseFromStore } from "./promise-Y53vc4Ia.js";
|
|
6
6
|
import { noop } from "./utils/func.js";
|
|
7
|
-
import {
|
|
7
|
+
import { r as removeScrollbars, a as revertScrollbars } from "./scrollbars-CcxSrnCx.js";
|
|
8
|
+
import { a as bindDirective, r as registrationArray, p as createAttributesDirective, n as mergeDirectives, d as directiveSubscribe, c as bindDirectiveNoArg, b as browserDirective } from "./dom-Bcg9ORcA.js";
|
|
8
9
|
import { portal } from "./services/portal.js";
|
|
9
10
|
import { siblingsInert } from "./services/siblingsInert.js";
|
|
10
11
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
11
|
-
|
|
12
|
-
const scrollbarWidth = Math.abs(window.innerWidth - document.documentElement.clientWidth);
|
|
13
|
-
const body = document.body;
|
|
14
|
-
const bodyStyle = body.style;
|
|
15
|
-
const { overflow, paddingRight } = bodyStyle;
|
|
16
|
-
if (scrollbarWidth > 0) {
|
|
17
|
-
const actualPadding = parseFloat(window.getComputedStyle(body).paddingRight);
|
|
18
|
-
bodyStyle.paddingRight = `${actualPadding + scrollbarWidth}px`;
|
|
19
|
-
}
|
|
20
|
-
bodyStyle.overflow = "hidden";
|
|
21
|
-
return () => {
|
|
22
|
-
if (scrollbarWidth > 0) {
|
|
23
|
-
bodyStyle.paddingRight = paddingRight;
|
|
24
|
-
}
|
|
25
|
-
bodyStyle.overflow = overflow;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
let internalRevert = noop;
|
|
29
|
-
const removeScrollbars = () => {
|
|
30
|
-
internalRevert();
|
|
31
|
-
internalRevert = internalRemoveScrollbars();
|
|
32
|
-
};
|
|
33
|
-
const revertScrollbars = () => {
|
|
34
|
-
internalRevert();
|
|
35
|
-
internalRevert = noop;
|
|
36
|
-
};
|
|
12
|
+
import { focusElement } from "./services/focusElement.js";
|
|
37
13
|
const modalOutsideClick = Symbol();
|
|
38
14
|
const modalCloseButtonClick = Symbol();
|
|
15
|
+
const modalCloseEscape = Symbol();
|
|
39
16
|
const defaultConfig = {
|
|
40
17
|
animated: true,
|
|
41
18
|
ariaCloseButtonLabel: "Close",
|
|
@@ -160,7 +137,7 @@ const createModal = createWidgetFactory("modal", (config$) => {
|
|
|
160
137
|
const element = container ? modalTransition.stores.element$() : void 0;
|
|
161
138
|
return {
|
|
162
139
|
container,
|
|
163
|
-
insertBefore:
|
|
140
|
+
insertBefore: element?.parentElement === container ? element : void 0
|
|
164
141
|
};
|
|
165
142
|
})
|
|
166
143
|
);
|
|
@@ -187,13 +164,23 @@ const createModal = createWidgetFactory("modal", (config$) => {
|
|
|
187
164
|
}));
|
|
188
165
|
const modalAttributeDirective = createAttributesDirective(() => ({
|
|
189
166
|
attributes: {
|
|
190
|
-
class: className
|
|
167
|
+
class: className$,
|
|
168
|
+
tabIndex: readable("-1")
|
|
191
169
|
},
|
|
192
170
|
events: {
|
|
193
171
|
click: (event) => {
|
|
194
172
|
if (event.currentTarget === event.target && closeOnOutsideClick$()) {
|
|
195
173
|
close(modalOutsideClick);
|
|
196
174
|
}
|
|
175
|
+
},
|
|
176
|
+
keydown: (event) => {
|
|
177
|
+
const { key } = event;
|
|
178
|
+
switch (key) {
|
|
179
|
+
case "Escape":
|
|
180
|
+
close(modalCloseEscape);
|
|
181
|
+
event.stopPropagation();
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
197
184
|
}
|
|
198
185
|
}
|
|
199
186
|
}));
|
|
@@ -214,7 +201,13 @@ const createModal = createWidgetFactory("modal", (config$) => {
|
|
|
214
201
|
modalPortalDirective,
|
|
215
202
|
backdropPortalDirective,
|
|
216
203
|
backdropDirective: mergeDirectives(backdropTransition.directives.directive, backdropAttributeDirective),
|
|
217
|
-
modalDirective: mergeDirectives(
|
|
204
|
+
modalDirective: mergeDirectives(
|
|
205
|
+
modalTransition.directives.directive,
|
|
206
|
+
bindDirectiveNoArg(siblingsInert),
|
|
207
|
+
directiveSubscribe(action$),
|
|
208
|
+
modalAttributeDirective,
|
|
209
|
+
focusElement
|
|
210
|
+
),
|
|
218
211
|
closeButtonDirective,
|
|
219
212
|
dialogDirective: bindDirective(
|
|
220
213
|
browserDirective((dialog, visible) => {
|
|
@@ -248,6 +241,7 @@ const createModal = createWidgetFactory("modal", (config$) => {
|
|
|
248
241
|
});
|
|
249
242
|
export {
|
|
250
243
|
modalCloseButtonClick as a,
|
|
244
|
+
modalCloseEscape as b,
|
|
251
245
|
createModal as c,
|
|
252
246
|
getModalDefaultConfig as g,
|
|
253
247
|
modalOutsideClick as m
|
|
@@ -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";
|