@agnos-ui/core 0.7.0 → 0.8.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-Lp-LEbZ2.cjs → accordion-DTQj-TQ1.cjs} +16 -18
- package/{accordion-BGv150k9.js → accordion-hVi2XRk-.js} +12 -14
- package/{alert-DJ2l7bcA.js → alert-BSixS_cz.js} +1 -1
- package/{alert-Bq101evB.cjs → alert-BrVkxOnA.cjs} +1 -1
- package/{common-DvPjK7SS.cjs → common-CcQOJ_hf.cjs} +5 -6
- package/{common-Banw3FYN.js → common-CuZAeECD.js} +2 -3
- package/components/accordion/accordion.d.ts +1 -1
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/common.d.ts +1 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/modal/index.cjs +1 -1
- package/components/modal/index.js +1 -1
- package/components/modal/modal.d.ts +2 -2
- 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 +84 -9
- 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 +3 -3
- package/config.js +1 -1
- package/{directive-CKEccryv.js → dom-BB9jLllr.js} +115 -102
- package/{directive-DdlwGFtf.cjs → dom-CuBx1JPZ.cjs} +116 -103
- package/index.cjs +14 -11
- package/index.js +15 -12
- package/{modal-DDHcrykD.cjs → modal-B7bYoubx.cjs} +12 -14
- package/{modal-DP-4I7vf.js → modal-BQcw6bnM.js} +6 -8
- package/package.json +4 -1
- package/{pagination-CBysiPUs.cjs → pagination-5YARuB3V.cjs} +8 -8
- package/{pagination-DwDRot6q.js → pagination-BwaZEokc.js} +8 -8
- package/{progressbar-DghzCJ6_.cjs → progressbar-BpSrg4HG.cjs} +2 -2
- package/{progressbar-CGmNq0cS.js → progressbar-b_kXzGPc.js} +3 -3
- package/{promise-CY2U8bTP.js → promise-CBh_HbSK.js} +1 -1
- package/{promise-BMJ8qhA8.cjs → promise-CxCD3NYv.cjs} +5 -5
- package/{rating-Da38uaZz.js → rating-B1JLZgIR.js} +8 -8
- package/{rating-DlfOuwuX.cjs → rating-C8tn9xTO.cjs} +9 -9
- package/{select-CAEPqdz1.js → select-Bb2RAVs0.js} +20 -20
- package/{select-LBVhNdrd.cjs → select-D1pBz4CM.cjs} +21 -21
- package/services/floatingUI.cjs +2 -2
- package/services/floatingUI.js +2 -2
- package/services/focustrack.cjs +1 -1
- package/services/focustrack.js +1 -1
- package/services/intersection.cjs +2 -2
- package/services/intersection.js +1 -1
- package/services/matchMedia.cjs +3 -2
- package/services/matchMedia.js +3 -2
- package/services/navManager.cjs +1 -1
- package/services/navManager.js +1 -1
- package/services/portal.cjs +1 -1
- package/services/portal.js +1 -1
- package/services/resizeObserver.cjs +3 -3
- package/services/resizeObserver.js +2 -2
- package/services/siblingsInert.cjs +4 -4
- package/services/siblingsInert.js +2 -2
- package/services/transitions/baseTransitions.cjs +7 -7
- package/services/transitions/baseTransitions.js +3 -3
- package/services/transitions/collapse.cjs +1 -1
- package/services/transitions/collapse.js +1 -1
- package/services/transitions/cssTransitions.cjs +4 -4
- package/services/transitions/cssTransitions.js +3 -3
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-1OSwok7u.cjs → slider-B2JFXDLt.cjs} +125 -24
- package/{slider-6LI4-f5s.js → slider-C-BSdQ0b.js} +126 -25
- package/{toast-CpvsibAI.js → toast-Bw2QSzBX.js} +9 -8
- package/{toast-D_uSrRZL.cjs → toast-CaIcB2sD.cjs} +8 -7
- package/{tree-Bb5KFqXp.cjs → tree-D4t2SOql.cjs} +7 -7
- package/{tree-B2Mr8b31.js → tree-DWv0zwFJ.js} +8 -8
- package/utils/directive.cjs +2 -3
- package/utils/directive.d.ts +7 -5
- package/utils/directive.js +2 -3
- package/{func-Qd3cD9a3.cjs → utils/func.cjs} +1 -0
- package/{func-DR0n-ShK.js → utils/func.js} +2 -2
- package/utils/stores.cjs +13 -3
- package/utils/stores.d.ts +9 -0
- package/utils/stores.js +12 -2
- /package/utils/{internal/func.d.ts → func.d.ts} +0 -0
|
@@ -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
|
|
4
|
+
const utils_func = require("../utils/func.cjs");
|
|
5
5
|
const utils_stores = require("../utils/stores.cjs");
|
|
6
6
|
const defaultValues = {
|
|
7
7
|
elements: [],
|
|
@@ -32,7 +32,7 @@ const createIntersection = (config) => {
|
|
|
32
32
|
observer.disconnect();
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return utils_func.noop;
|
|
36
36
|
},
|
|
37
37
|
/* @__PURE__ */ new Map()
|
|
38
38
|
);
|
package/services/intersection.js
CHANGED
package/services/matchMedia.cjs
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
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("../
|
|
5
|
+
const utils_directive = require("../dom-CuBx1JPZ.cjs");
|
|
6
|
+
const utils_stores = require("../utils/stores.cjs");
|
|
6
7
|
const createMatchMedia = (query) => esmEnv.BROWSER ? tansu.readable(false, {
|
|
7
8
|
onUse({ set }) {
|
|
8
9
|
const mql = window.matchMedia(query.trim());
|
|
9
10
|
set(mql.matches);
|
|
10
11
|
return utils_directive.addEvent(mql, "change", (val) => set(val.matches));
|
|
11
12
|
}
|
|
12
|
-
}) :
|
|
13
|
+
}) : utils_stores.false$;
|
|
13
14
|
exports.createMatchMedia = createMatchMedia;
|
package/services/matchMedia.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { readable } from "@amadeus-it-group/tansu";
|
|
2
2
|
import { BROWSER } from "esm-env";
|
|
3
|
-
import { u as addEvent } from "../
|
|
3
|
+
import { u as addEvent } from "../dom-BB9jLllr.js";
|
|
4
|
+
import { false$ } from "../utils/stores.js";
|
|
4
5
|
const createMatchMedia = (query) => BROWSER ? readable(false, {
|
|
5
6
|
onUse({ set }) {
|
|
6
7
|
const mql = window.matchMedia(query.trim());
|
|
7
8
|
set(mql.matches);
|
|
8
9
|
return addEvent(mql, "change", (val) => set(val.matches));
|
|
9
10
|
}
|
|
10
|
-
}) :
|
|
11
|
+
}) : false$;
|
|
11
12
|
export {
|
|
12
13
|
createMatchMedia
|
|
13
14
|
};
|
package/services/navManager.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("../
|
|
4
|
+
const utils_directive = require("../dom-CuBx1JPZ.cjs");
|
|
5
5
|
const isInertOrInvisible = (element) => {
|
|
6
6
|
let curElement = element;
|
|
7
7
|
while (curElement) {
|
package/services/navManager.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { writable, computed } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { r as registrationArray, y as computeCommonAncestor, b as browserDirective } from "../
|
|
2
|
+
import { r as registrationArray, y as computeCommonAncestor, b as browserDirective } from "../dom-BB9jLllr.js";
|
|
3
3
|
const isInertOrInvisible = (element) => {
|
|
4
4
|
let curElement = element;
|
|
5
5
|
while (curElement) {
|
package/services/portal.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const utils_directive = require("../
|
|
3
|
+
const utils_directive = require("../dom-CuBx1JPZ.cjs");
|
|
4
4
|
const portal = utils_directive.browserDirective((content, newArg) => {
|
|
5
5
|
let arg;
|
|
6
6
|
let replaceComment;
|
package/services/portal.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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("../
|
|
5
|
-
const
|
|
4
|
+
const utils_directive = require("../dom-CuBx1JPZ.cjs");
|
|
5
|
+
const utils_func = require("../utils/func.cjs");
|
|
6
6
|
const createResizeObserver = () => {
|
|
7
7
|
const { element$, directive } = utils_directive.createBrowserStoreDirective();
|
|
8
8
|
const observedElement$ = tansu.derived(
|
|
9
9
|
element$,
|
|
10
10
|
(element, set) => {
|
|
11
11
|
if (element === null) {
|
|
12
|
-
return
|
|
12
|
+
return utils_func.noop;
|
|
13
13
|
}
|
|
14
14
|
const observer = new ResizeObserver((entries) => {
|
|
15
15
|
set(entries[0]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { derived } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { j as createBrowserStoreDirective } from "../
|
|
3
|
-
import {
|
|
2
|
+
import { j as createBrowserStoreDirective } from "../dom-BB9jLllr.js";
|
|
3
|
+
import { noop } from "../utils/func.js";
|
|
4
4
|
const createResizeObserver = () => {
|
|
5
5
|
const { element$, directive } = createBrowserStoreDirective();
|
|
6
6
|
const observedElement$ = derived(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const tansu = require("@amadeus-it-group/tansu");
|
|
4
|
-
const
|
|
5
|
-
const utils_directive = require("../
|
|
4
|
+
const utils_func = require("../utils/func.cjs");
|
|
5
|
+
const utils_directive = require("../dom-CuBx1JPZ.cjs");
|
|
6
6
|
const internalSetSiblingsInert = (element) => {
|
|
7
7
|
const inertValues = /* @__PURE__ */ new Map();
|
|
8
8
|
const recursiveHelper = (element2) => {
|
|
@@ -22,10 +22,10 @@ const internalSetSiblingsInert = (element) => {
|
|
|
22
22
|
element2.toggleAttribute("inert", value);
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
let internalRevert =
|
|
25
|
+
let internalRevert = utils_func.noop;
|
|
26
26
|
const setSiblingsInert = (element) => {
|
|
27
27
|
internalRevert();
|
|
28
|
-
internalRevert = element ? internalSetSiblingsInert(element) :
|
|
28
|
+
internalRevert = element ? internalSetSiblingsInert(element) : utils_func.noop;
|
|
29
29
|
};
|
|
30
30
|
const { directive: storeArrayDirective, elements$ } = utils_directive.createBrowserStoreArrayDirective();
|
|
31
31
|
const lastElement$ = tansu.computed(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed } from "@amadeus-it-group/tansu";
|
|
2
|
-
import {
|
|
3
|
-
import { g as createBrowserStoreArrayDirective, k as mergeDirectives, d as directiveSubscribe } from "../
|
|
2
|
+
import { noop } from "../utils/func.js";
|
|
3
|
+
import { g as createBrowserStoreArrayDirective, k as mergeDirectives, d as directiveSubscribe } from "../dom-BB9jLllr.js";
|
|
4
4
|
const internalSetSiblingsInert = (element) => {
|
|
5
5
|
const inertValues = /* @__PURE__ */ new Map();
|
|
6
6
|
const recursiveHelper = (element2) => {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const tansu = require("@amadeus-it-group/tansu");
|
|
4
4
|
const utils_writables = require("../../writables-BPAJvaL_.cjs");
|
|
5
|
-
const promise = require("../../promise-
|
|
6
|
-
const
|
|
5
|
+
const promise = require("../../promise-CxCD3NYv.cjs");
|
|
6
|
+
const utils_func = require("../../utils/func.cjs");
|
|
7
7
|
const utils_stores = require("../../utils/stores.cjs");
|
|
8
|
-
const utils_directive = require("../../
|
|
9
|
-
const neverEndingPromise = new Promise(
|
|
8
|
+
const utils_directive = require("../../dom-CuBx1JPZ.cjs");
|
|
9
|
+
const neverEndingPromise = new Promise(utils_func.noop);
|
|
10
10
|
const noAnimation = (element, direction) => {
|
|
11
11
|
element.style.display = direction === "show" ? "" : "none";
|
|
12
12
|
};
|
|
@@ -16,9 +16,9 @@ const defaultValues = {
|
|
|
16
16
|
initDone: null,
|
|
17
17
|
visible: true,
|
|
18
18
|
transition: noAnimation,
|
|
19
|
-
onShown:
|
|
20
|
-
onHidden:
|
|
21
|
-
onVisibleChange:
|
|
19
|
+
onShown: utils_func.noop,
|
|
20
|
+
onHidden: utils_func.noop,
|
|
21
|
+
onVisibleChange: utils_func.noop
|
|
22
22
|
};
|
|
23
23
|
const configValidator = {
|
|
24
24
|
animated: utils_writables.typeBoolean,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { computed, writable, derived, batch } from "@amadeus-it-group/tansu";
|
|
2
2
|
import { c as typeBoolean, f as typeFunction, d as typeBooleanOrNull } from "../../writables-DCiBdIBK.js";
|
|
3
|
-
import { c as promiseWithResolve } from "../../promise-
|
|
4
|
-
import {
|
|
3
|
+
import { c as promiseWithResolve } from "../../promise-CBh_HbSK.js";
|
|
4
|
+
import { noop } from "../../utils/func.js";
|
|
5
5
|
import { writablesForProps, bindableDerived, stateStores } from "../../utils/stores.js";
|
|
6
|
-
import { h as createStoreDirective, k as mergeDirectives, d as directiveSubscribe } from "../../
|
|
6
|
+
import { h as createStoreDirective, k as mergeDirectives, d as directiveSubscribe } from "../../dom-BB9jLllr.js";
|
|
7
7
|
const neverEndingPromise = new Promise(noop);
|
|
8
8
|
const noAnimation = (element, direction) => {
|
|
9
9
|
element.style.display = direction === "show" ? "" : "none";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const utils_directive = require("../../
|
|
3
|
+
const utils_directive = require("../../dom-CuBx1JPZ.cjs");
|
|
4
4
|
const services_transitions_cssTransitions = require("./cssTransitions.cjs");
|
|
5
5
|
const createCollapseTransition = ({
|
|
6
6
|
dimension = "height",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isBrowserHTMLElement, v as removeClasses, w as addClasses, x as reflow } from "../../
|
|
1
|
+
import { i as isBrowserHTMLElement, v as removeClasses, w as addClasses, x as reflow } from "../../dom-BB9jLllr.js";
|
|
2
2
|
import { createCSSTransition } from "./cssTransitions.js";
|
|
3
3
|
const createCollapseTransition = ({
|
|
4
4
|
dimension = "height",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const utils_directive = require("../../
|
|
4
|
-
const
|
|
5
|
-
const promise = require("../../promise-
|
|
3
|
+
const utils_directive = require("../../dom-CuBx1JPZ.cjs");
|
|
4
|
+
const utils_func = require("../../utils/func.cjs");
|
|
5
|
+
const promise = require("../../promise-CxCD3NYv.cjs");
|
|
6
6
|
function hasTransition(element) {
|
|
7
7
|
return window.getComputedStyle(element).transitionProperty !== "none";
|
|
8
8
|
}
|
|
@@ -13,7 +13,7 @@ function getTransitionDurationMs(element) {
|
|
|
13
13
|
return (transitionDelaySec + transitionDurationSec) * 1e3;
|
|
14
14
|
}
|
|
15
15
|
const createCSSTransition = (start) => async (element, direction, animated, signal, context) => {
|
|
16
|
-
const endFn = start(element, direction, animated, context) ??
|
|
16
|
+
const endFn = start(element, direction, animated, context) ?? utils_func.noop;
|
|
17
17
|
if (utils_directive.isBrowserHTMLElement(element) && animated && hasTransition(element)) {
|
|
18
18
|
const abort = promise.promiseFromEvent(signal, "abort");
|
|
19
19
|
const transitionEnd = promise.promiseFromEvent(element, "transitionend");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as isBrowserHTMLElement } from "../../
|
|
2
|
-
import {
|
|
3
|
-
import { a as promiseFromEvent, b as promiseFromTimeout } from "../../promise-
|
|
1
|
+
import { i as isBrowserHTMLElement } from "../../dom-BB9jLllr.js";
|
|
2
|
+
import { noop } from "../../utils/func.js";
|
|
3
|
+
import { a as promiseFromEvent, b as promiseFromTimeout } from "../../promise-CBh_HbSK.js";
|
|
4
4
|
function hasTransition(element) {
|
|
5
5
|
return window.getComputedStyle(element).transitionProperty !== "none";
|
|
6
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const services_transitions_cssTransitions = require("./cssTransitions.cjs");
|
|
4
|
-
const utils_directive = require("../../
|
|
4
|
+
const utils_directive = require("../../dom-CuBx1JPZ.cjs");
|
|
5
5
|
const createSimpleClassTransition = (config) => {
|
|
6
6
|
const { animationPendingClasses, animationPendingShowClasses, animationPendingHideClasses, showClasses, hideClasses } = config;
|
|
7
7
|
return services_transitions_cssTransitions.createCSSTransition((element, direction, animated, context) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCSSTransition } from "./cssTransitions.js";
|
|
2
|
-
import { v as removeClasses, w as addClasses, x as reflow } from "../../
|
|
2
|
+
import { v as removeClasses, w as addClasses, x as reflow } from "../../dom-BB9jLllr.js";
|
|
3
3
|
const createSimpleClassTransition = (config) => {
|
|
4
4
|
const { animationPendingClasses, animationPendingShowClasses, animationPendingHideClasses, showClasses, hideClasses } = config;
|
|
5
5
|
return createCSSTransition((element, direction, animated, context) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const tansu = require("@amadeus-it-group/tansu");
|
|
3
|
-
const utils_directive = require("./
|
|
4
|
-
const
|
|
3
|
+
const utils_directive = require("./dom-CuBx1JPZ.cjs");
|
|
4
|
+
const utils_func = require("./utils/func.cjs");
|
|
5
5
|
const utils_stores = require("./utils/stores.cjs");
|
|
6
6
|
const utils_writables = require("./writables-BPAJvaL_.cjs");
|
|
7
7
|
const services_resizeObserver = require("./services/resizeObserver.cjs");
|
|
@@ -24,12 +24,16 @@ const defaultSliderConfig = {
|
|
|
24
24
|
disabled: false,
|
|
25
25
|
vertical: false,
|
|
26
26
|
className: "",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
ariaLabel: () => "Value",
|
|
28
|
+
ariaLabelledBy: () => "",
|
|
29
|
+
ariaValueText: () => "",
|
|
30
|
+
onValuesChange: utils_func.noop,
|
|
30
31
|
values: [0],
|
|
31
32
|
showValueLabels: true,
|
|
32
33
|
showMinMaxLabels: true,
|
|
34
|
+
showTicks: false,
|
|
35
|
+
showTickValues: true,
|
|
36
|
+
tickInterval: 0,
|
|
33
37
|
rtl: false
|
|
34
38
|
};
|
|
35
39
|
function getSliderDefaultConfig() {
|
|
@@ -42,12 +46,16 @@ const configValidator = {
|
|
|
42
46
|
readonly: utils_writables.typeBoolean,
|
|
43
47
|
disabled: utils_writables.typeBoolean,
|
|
44
48
|
vertical: utils_writables.typeBoolean,
|
|
45
|
-
|
|
49
|
+
ariaLabel: utils_writables.typeFunction,
|
|
50
|
+
ariaLabelledBy: utils_writables.typeFunction,
|
|
46
51
|
ariaValueText: utils_writables.typeFunction,
|
|
47
52
|
onValuesChange: utils_writables.typeFunction,
|
|
48
53
|
values: utils_writables.typeArray,
|
|
49
54
|
showValueLabels: utils_writables.typeBoolean,
|
|
50
55
|
showMinMaxLabels: utils_writables.typeBoolean,
|
|
56
|
+
showTicks: utils_writables.typeBoolean,
|
|
57
|
+
showTickValues: utils_writables.typeBoolean,
|
|
58
|
+
tickInterval: utils_writables.typeNumberInRangeFactory(0, Infinity, { strict: true }),
|
|
51
59
|
rtl: utils_writables.typeBoolean,
|
|
52
60
|
className: utils_writables.typeString
|
|
53
61
|
};
|
|
@@ -92,11 +100,15 @@ function createSlider(config) {
|
|
|
92
100
|
stepSize$,
|
|
93
101
|
rtl$,
|
|
94
102
|
values$: _dirtyValues$,
|
|
95
|
-
|
|
103
|
+
ariaLabel$,
|
|
104
|
+
ariaLabelledBy$,
|
|
96
105
|
ariaValueText$,
|
|
97
106
|
onValuesChange$,
|
|
98
107
|
showValueLabels$,
|
|
99
108
|
showMinMaxLabels$,
|
|
109
|
+
showTicks$,
|
|
110
|
+
showTickValues$,
|
|
111
|
+
tickInterval$,
|
|
100
112
|
...stateProps
|
|
101
113
|
},
|
|
102
114
|
patch
|
|
@@ -178,12 +190,13 @@ function createSlider(config) {
|
|
|
178
190
|
}).sort((a, b) => a.value - b.value);
|
|
179
191
|
});
|
|
180
192
|
const sortedHandles$ = tansu.computed(() => {
|
|
181
|
-
const ariaLabelHandle =
|
|
193
|
+
const ariaLabelHandle = ariaLabel$(), ariaValueText = ariaValueText$(), ariaLabelledBy = ariaLabelledBy$();
|
|
182
194
|
return _sortedHandlesValues$().map((sortedValue, index) => {
|
|
183
195
|
return {
|
|
184
196
|
...sortedValue,
|
|
185
|
-
ariaLabel: ariaLabelHandle(
|
|
186
|
-
|
|
197
|
+
ariaLabel: ariaLabelledBy(index) ? void 0 : ariaLabelHandle(index),
|
|
198
|
+
ariaLabelledBy: ariaLabelledBy(index) || void 0,
|
|
199
|
+
ariaValueText: ariaValueText(sortedValue.value, index) || void 0
|
|
187
200
|
};
|
|
188
201
|
});
|
|
189
202
|
});
|
|
@@ -191,8 +204,9 @@ function createSlider(config) {
|
|
|
191
204
|
const sortedValuesPercent$ = tansu.computed(() => [...valuesPercent$()].sort((a, b) => a - b));
|
|
192
205
|
const minLabelWidth$ = tansu.computed(() => minLabelDomRect$().width / sliderDomRectSize$() * 100);
|
|
193
206
|
const maxLabelWidth$ = tansu.computed(() => maxLabelDomRect$().width / sliderDomRectSize$() * 100);
|
|
207
|
+
const adjustedShowValueLabels$ = tansu.computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
|
|
194
208
|
const minValueLabelDisplay$ = tansu.computed(() => {
|
|
195
|
-
if (!showMinMaxLabels$()) {
|
|
209
|
+
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
196
210
|
return false;
|
|
197
211
|
} else if (!showValueLabels$()) {
|
|
198
212
|
return true;
|
|
@@ -201,7 +215,7 @@ function createSlider(config) {
|
|
|
201
215
|
return rtl$() ? !valuesPercent$().some((percent2) => 100 - percent2 > 100 - minLabelWidth - 1) : !valuesPercent$().some((percent2) => percent2 < minLabelWidth + 1);
|
|
202
216
|
});
|
|
203
217
|
const maxValueLabelDisplay$ = tansu.computed(() => {
|
|
204
|
-
if (!showMinMaxLabels$()) {
|
|
218
|
+
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
205
219
|
return false;
|
|
206
220
|
} else if (!showValueLabels$()) {
|
|
207
221
|
return true;
|
|
@@ -261,9 +275,48 @@ function createSlider(config) {
|
|
|
261
275
|
}).slice(0, sortedValuesPercent.length - 1);
|
|
262
276
|
}
|
|
263
277
|
});
|
|
264
|
-
const
|
|
278
|
+
const computeTicks$ = tansu.computed(() => {
|
|
279
|
+
if (!showTicks$()) {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
const vertical = vertical$();
|
|
265
283
|
const min = min$();
|
|
266
|
-
|
|
284
|
+
const max = max$();
|
|
285
|
+
const rtl = rtl$();
|
|
286
|
+
const showTickValues = showTickValues$();
|
|
287
|
+
const tickInterval = tickInterval$() || stepSize$();
|
|
288
|
+
const tickArray = [];
|
|
289
|
+
const intStepSize = _intStepSize$();
|
|
290
|
+
const decimalPrecision = _decimalPrecision$();
|
|
291
|
+
const positionCompute = (position) => {
|
|
292
|
+
return !!rtl !== !!vertical ? 100 - position : position;
|
|
293
|
+
};
|
|
294
|
+
for (let step = min; step < max; step += tickInterval) {
|
|
295
|
+
const cleanValue = computeCleanValue(step, min, max, intStepSize, decimalPrecision);
|
|
296
|
+
const stepPercent = percentCompute(cleanValue);
|
|
297
|
+
tickArray.push({ position: positionCompute(stepPercent), selected: false, value: cleanValue, displayLabel: showTickValues });
|
|
298
|
+
}
|
|
299
|
+
tickArray.push({ position: positionCompute(100), selected: false, value: max, displayLabel: showTickValues });
|
|
300
|
+
return tickArray;
|
|
301
|
+
});
|
|
302
|
+
const ticks$ = tansu.computed(() => {
|
|
303
|
+
const sortedValues = sortedValues$();
|
|
304
|
+
const isTickSelected = (value) => {
|
|
305
|
+
const isMultiHandle = sortedValues.length > 1;
|
|
306
|
+
const currentMax = isMultiHandle ? sortedValues[sortedValues.length - 1] : sortedValues[0];
|
|
307
|
+
const currentMin = isMultiHandle ? sortedValues[0] : 0;
|
|
308
|
+
return value <= currentMax && value >= currentMin;
|
|
309
|
+
};
|
|
310
|
+
return computeTicks$().map((tick) => {
|
|
311
|
+
return {
|
|
312
|
+
...tick,
|
|
313
|
+
selected: isTickSelected(tick.value)
|
|
314
|
+
};
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
const percentCompute = (value) => {
|
|
318
|
+
const min = min$(), max = max$();
|
|
319
|
+
return (value - min) * 100 / (max - min);
|
|
267
320
|
};
|
|
268
321
|
const getClosestSliderHandle = (clickedPercent) => {
|
|
269
322
|
const values = values$();
|
|
@@ -271,9 +324,11 @@ function createSlider(config) {
|
|
|
271
324
|
return 0;
|
|
272
325
|
}
|
|
273
326
|
const sortedValues = sortedValues$();
|
|
274
|
-
const closestBigger = sortedValues.find((sv) => sv > clickedPercent * 100);
|
|
327
|
+
const closestBigger = sortedValues.find((sv) => percentCompute(sv) > clickedPercent * 100);
|
|
275
328
|
const closestBiggerIndex = closestBigger ? sortedValues.indexOf(closestBigger) : sortedValues.length - 1;
|
|
276
|
-
const midPoint =
|
|
329
|
+
const midPoint = percentCompute(
|
|
330
|
+
sortedValues[closestBiggerIndex - 1] + (sortedValues[closestBiggerIndex] - sortedValues[closestBiggerIndex - 1]) / 2
|
|
331
|
+
);
|
|
277
332
|
const closestValue = sortedValues[clickedPercent * 100 <= midPoint ? closestBiggerIndex - 1 : closestBiggerIndex];
|
|
278
333
|
return values.indexOf(closestValue);
|
|
279
334
|
};
|
|
@@ -298,7 +353,7 @@ function createSlider(config) {
|
|
|
298
353
|
class: stateProps.className$
|
|
299
354
|
},
|
|
300
355
|
classNames: {
|
|
301
|
-
"au-slider": true
|
|
356
|
+
"au-slider": utils_stores.true$,
|
|
302
357
|
"au-slider-vertical": vertical$,
|
|
303
358
|
"au-slider-horizontal": horizontal$,
|
|
304
359
|
disabled: disabled$
|
|
@@ -312,6 +367,9 @@ function createSlider(config) {
|
|
|
312
367
|
"au-slider-label-min": horizontal$,
|
|
313
368
|
"au-slider-rtl": rtl$,
|
|
314
369
|
invisible: tansu.computed(() => !minValueLabelDisplay$())
|
|
370
|
+
},
|
|
371
|
+
attributes: {
|
|
372
|
+
"aria-hidden": tansu.readable("true")
|
|
315
373
|
}
|
|
316
374
|
}));
|
|
317
375
|
const maxLabelDirective = utils_directive.createAttributesDirective(() => ({
|
|
@@ -322,6 +380,9 @@ function createSlider(config) {
|
|
|
322
380
|
"au-slider-label-max": horizontal$,
|
|
323
381
|
"au-slider-rtl": rtl$,
|
|
324
382
|
invisible: tansu.computed(() => !maxValueLabelDisplay$())
|
|
383
|
+
},
|
|
384
|
+
attributes: {
|
|
385
|
+
"aria-hidden": tansu.readable("true")
|
|
325
386
|
}
|
|
326
387
|
}));
|
|
327
388
|
const handleEventsDirective = utils_directive.createAttributesDirective((handleContext$) => ({
|
|
@@ -366,7 +427,6 @@ function createSlider(config) {
|
|
|
366
427
|
return;
|
|
367
428
|
}
|
|
368
429
|
event.preventDefault();
|
|
369
|
-
event.stopPropagation();
|
|
370
430
|
}
|
|
371
431
|
},
|
|
372
432
|
mousedown: (event) => {
|
|
@@ -395,7 +455,6 @@ function createSlider(config) {
|
|
|
395
455
|
}
|
|
396
456
|
},
|
|
397
457
|
touchstart: (event) => {
|
|
398
|
-
event.preventDefault();
|
|
399
458
|
const handleDrag = (e) => {
|
|
400
459
|
e.preventDefault();
|
|
401
460
|
const newCoord = vertical$() ? e.touches[0].clientY : e.touches[0].clientX;
|
|
@@ -445,9 +504,11 @@ function createSlider(config) {
|
|
|
445
504
|
combinedLabelPositionTop$,
|
|
446
505
|
progressDisplayOptions$,
|
|
447
506
|
handleDisplayOptions$,
|
|
448
|
-
showValueLabels$,
|
|
507
|
+
showValueLabels$: adjustedShowValueLabels$,
|
|
449
508
|
showMinMaxLabels$,
|
|
509
|
+
showTicks$,
|
|
450
510
|
rtl$,
|
|
511
|
+
ticks$,
|
|
451
512
|
...stateProps
|
|
452
513
|
}),
|
|
453
514
|
patch,
|
|
@@ -464,7 +525,7 @@ function createSlider(config) {
|
|
|
464
525
|
height: tansu.computed(() => percent(progressContext$().option.height))
|
|
465
526
|
},
|
|
466
527
|
classNames: {
|
|
467
|
-
"au-slider-progress": true
|
|
528
|
+
"au-slider-progress": utils_stores.true$
|
|
468
529
|
}
|
|
469
530
|
})),
|
|
470
531
|
clickableAreaDirective: utils_directive.createAttributesDirective(() => ({
|
|
@@ -475,7 +536,8 @@ function createSlider(config) {
|
|
|
475
536
|
},
|
|
476
537
|
classNames: {
|
|
477
538
|
"au-slider-clickable-area": horizontal$,
|
|
478
|
-
"au-slider-clickable-area-vertical": vertical
|
|
539
|
+
"au-slider-clickable-area-vertical": vertical$,
|
|
540
|
+
"au-slider-clickable-area-with-ticks": tansu.computed(() => showTicks$() && tickInterval$() === 0)
|
|
479
541
|
}
|
|
480
542
|
})),
|
|
481
543
|
handleEventsDirective,
|
|
@@ -483,12 +545,13 @@ function createSlider(config) {
|
|
|
483
545
|
handleEventsDirective,
|
|
484
546
|
utils_directive.createAttributesDirective((handleContext$) => ({
|
|
485
547
|
attributes: {
|
|
486
|
-
role: "slider",
|
|
548
|
+
role: tansu.readable("slider"),
|
|
487
549
|
"aria-valuemin": min$,
|
|
488
550
|
"aria-valuemax": max$,
|
|
489
551
|
"aria-valuenow": tansu.computed(() => handleContext$().item.value),
|
|
490
552
|
"aria-valuetext": tansu.computed(() => handleContext$().item.ariaValueText),
|
|
491
553
|
"aria-label": tansu.computed(() => handleContext$().item.ariaLabel),
|
|
554
|
+
"aria-labelledBy": tansu.computed(() => handleContext$().item.ariaLabelledBy),
|
|
492
555
|
"aria-orientation": tansu.computed(() => vertical$() ? "vertical" : void 0),
|
|
493
556
|
"aria-disabled": tansu.computed(() => disabled$() ? "true" : void 0),
|
|
494
557
|
disabled: disabled$,
|
|
@@ -499,7 +562,7 @@ function createSlider(config) {
|
|
|
499
562
|
top: tansu.computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
|
|
500
563
|
},
|
|
501
564
|
classNames: {
|
|
502
|
-
"au-slider-handle": true
|
|
565
|
+
"au-slider-handle": utils_stores.true$,
|
|
503
566
|
"au-slider-handle-vertical": vertical$,
|
|
504
567
|
"au-slider-handle-horizontal": horizontal$
|
|
505
568
|
}
|
|
@@ -517,6 +580,9 @@ function createSlider(config) {
|
|
|
517
580
|
styles: {
|
|
518
581
|
left: tansu.computed(() => percent(combinedLabelPositionLeft$())),
|
|
519
582
|
top: tansu.computed(() => percent(combinedLabelPositionTop$()))
|
|
583
|
+
},
|
|
584
|
+
attributes: {
|
|
585
|
+
"aria-hidden": tansu.readable("true")
|
|
520
586
|
}
|
|
521
587
|
})),
|
|
522
588
|
handleLabelDisplayDirective: utils_directive.createAttributesDirective((labelDisplayContext$) => ({
|
|
@@ -529,6 +595,41 @@ function createSlider(config) {
|
|
|
529
595
|
styles: {
|
|
530
596
|
left: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
|
|
531
597
|
top: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top))
|
|
598
|
+
},
|
|
599
|
+
attributes: {
|
|
600
|
+
"aria-hidden": tansu.readable("true")
|
|
601
|
+
}
|
|
602
|
+
})),
|
|
603
|
+
tickDirective: utils_directive.createAttributesDirective((tickContext$) => ({
|
|
604
|
+
classNames: {
|
|
605
|
+
"au-slider-tick": utils_stores.true$,
|
|
606
|
+
"au-slider-tick-horizontal": horizontal$,
|
|
607
|
+
"au-slider-tick-vertical": vertical$
|
|
608
|
+
},
|
|
609
|
+
styles: {
|
|
610
|
+
left: tansu.computed(() => vertical$() ? null : percent(tickContext$().tick.position)),
|
|
611
|
+
top: tansu.computed(() => vertical$() ? percent(tickContext$().tick.position) : null)
|
|
612
|
+
},
|
|
613
|
+
events: {
|
|
614
|
+
click: (event) => {
|
|
615
|
+
adjustCoordinate(vertical$() ? event.clientY : event.clientX);
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
attributes: {
|
|
619
|
+
"aria-hidden": tansu.readable("true")
|
|
620
|
+
}
|
|
621
|
+
})),
|
|
622
|
+
tickLabelDirective: utils_directive.createAttributesDirective((tickContext$) => ({
|
|
623
|
+
classNames: {
|
|
624
|
+
"au-slider-tick-label": utils_stores.true$,
|
|
625
|
+
"au-slider-tick-label-vertical": vertical$
|
|
626
|
+
},
|
|
627
|
+
styles: {
|
|
628
|
+
left: tansu.computed(() => vertical$() ? null : percent(tickContext$().tick.position)),
|
|
629
|
+
top: tansu.computed(() => vertical$() ? percent(tickContext$().tick.position) : null)
|
|
630
|
+
},
|
|
631
|
+
attributes: {
|
|
632
|
+
"aria-hidden": tansu.readable("true")
|
|
532
633
|
}
|
|
533
634
|
}))
|
|
534
635
|
}
|