@agnos-ui/core 0.7.1 → 0.8.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-CJxsVQtv.cjs → accordion-DTQj-TQ1.cjs} +16 -18
- package/{accordion-D0oG0wQD.js → accordion-OTiJtxDi.js} +12 -14
- package/{alert-Bq101evB.cjs → alert-BrVkxOnA.cjs} +1 -1
- package/{alert-DJ2l7bcA.js → alert-DH-mO6WX.js} +1 -1
- package/{common-Banw3FYN.js → common-Bffx1jJO.js} +3 -4
- package/{common-DvPjK7SS.cjs → common-CcQOJ_hf.cjs} +5 -6
- 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 +64 -0
- 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-BtOvPrmt.cjs → dom-CuBx1JPZ.cjs} +100 -102
- package/{directive-DrDJkTS5.js → dom-gfxqXJpK.js} +99 -101
- package/index.cjs +14 -11
- package/index.js +15 -12
- package/{modal-Qr4sHBFG.js → modal-85Sw8xuV.js} +7 -9
- package/{modal-DtzgRa5j.cjs → modal-B7bYoubx.cjs} +12 -14
- package/package.json +1 -1
- package/{pagination-BigQwc8I.js → pagination-4g3N8ktf.js} +9 -9
- package/{pagination-ETXueztI.cjs → pagination-5YARuB3V.cjs} +8 -8
- package/{progressbar-arTsTc5c.js → progressbar-BoJsBPH1.js} +4 -4
- package/{progressbar-BSgE9udi.cjs → progressbar-BpSrg4HG.cjs} +2 -2
- package/{promise-BMJ8qhA8.cjs → promise-CxCD3NYv.cjs} +5 -5
- package/{promise-CY2U8bTP.js → promise-XSP94FjG.js} +2 -2
- package/{rating-CGv-KO_P.js → rating-B3xktzOf.js} +9 -9
- package/{rating-BV6lk1US.cjs → rating-C8tn9xTO.cjs} +9 -9
- package/{select-C5DIoZrO.js → select-C-77MJfC.js} +20 -20
- package/{select-C6gwSGbr.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 +4 -4
- 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-CkYsilwM.cjs → slider-B2JFXDLt.cjs} +109 -14
- package/{slider-DtQrcvim.js → slider-Cs69pziL.js} +111 -16
- package/{toast-4f-ZdK1Y.js → toast-4HGIz3Bu.js} +10 -9
- package/{toast-Vku2ZxoN.cjs → toast-CaIcB2sD.cjs} +8 -7
- package/{tree-DVsZP8ze.js → tree-C_goOyCv.js} +9 -9
- package/{tree-BaSMyGyv.cjs → tree-D4t2SOql.cjs} +7 -7
- package/utils/directive.cjs +2 -3
- package/utils/directive.d.ts +3 -3
- 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
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-gfxqXJpK.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-gfxqXJpK.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-gfxqXJpK.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-gfxqXJpK.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
|
-
import {
|
|
3
|
-
import { c as promiseWithResolve } from "../../promise-
|
|
4
|
-
import {
|
|
2
|
+
import { d as typeBooleanOrNull, f as typeFunction, c as typeBoolean } from "../../writables-DCiBdIBK.js";
|
|
3
|
+
import { c as promiseWithResolve } from "../../promise-XSP94FjG.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-gfxqXJpK.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-gfxqXJpK.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-gfxqXJpK.js";
|
|
2
|
+
import { noop } from "../../utils/func.js";
|
|
3
|
+
import { a as promiseFromEvent, b as promiseFromTimeout } from "../../promise-XSP94FjG.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-gfxqXJpK.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");
|
|
@@ -27,10 +27,13 @@ const defaultSliderConfig = {
|
|
|
27
27
|
ariaLabel: () => "Value",
|
|
28
28
|
ariaLabelledBy: () => "",
|
|
29
29
|
ariaValueText: () => "",
|
|
30
|
-
onValuesChange:
|
|
30
|
+
onValuesChange: utils_func.noop,
|
|
31
31
|
values: [0],
|
|
32
32
|
showValueLabels: true,
|
|
33
33
|
showMinMaxLabels: true,
|
|
34
|
+
showTicks: false,
|
|
35
|
+
showTickValues: true,
|
|
36
|
+
tickInterval: 0,
|
|
34
37
|
rtl: false
|
|
35
38
|
};
|
|
36
39
|
function getSliderDefaultConfig() {
|
|
@@ -50,6 +53,9 @@ const configValidator = {
|
|
|
50
53
|
values: utils_writables.typeArray,
|
|
51
54
|
showValueLabels: utils_writables.typeBoolean,
|
|
52
55
|
showMinMaxLabels: utils_writables.typeBoolean,
|
|
56
|
+
showTicks: utils_writables.typeBoolean,
|
|
57
|
+
showTickValues: utils_writables.typeBoolean,
|
|
58
|
+
tickInterval: utils_writables.typeNumberInRangeFactory(0, Infinity, { strict: true }),
|
|
53
59
|
rtl: utils_writables.typeBoolean,
|
|
54
60
|
className: utils_writables.typeString
|
|
55
61
|
};
|
|
@@ -100,6 +106,9 @@ function createSlider(config) {
|
|
|
100
106
|
onValuesChange$,
|
|
101
107
|
showValueLabels$,
|
|
102
108
|
showMinMaxLabels$,
|
|
109
|
+
showTicks$,
|
|
110
|
+
showTickValues$,
|
|
111
|
+
tickInterval$,
|
|
103
112
|
...stateProps
|
|
104
113
|
},
|
|
105
114
|
patch
|
|
@@ -195,8 +204,9 @@ function createSlider(config) {
|
|
|
195
204
|
const sortedValuesPercent$ = tansu.computed(() => [...valuesPercent$()].sort((a, b) => a - b));
|
|
196
205
|
const minLabelWidth$ = tansu.computed(() => minLabelDomRect$().width / sliderDomRectSize$() * 100);
|
|
197
206
|
const maxLabelWidth$ = tansu.computed(() => maxLabelDomRect$().width / sliderDomRectSize$() * 100);
|
|
207
|
+
const adjustedShowValueLabels$ = tansu.computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
|
|
198
208
|
const minValueLabelDisplay$ = tansu.computed(() => {
|
|
199
|
-
if (!showMinMaxLabels$()) {
|
|
209
|
+
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
200
210
|
return false;
|
|
201
211
|
} else if (!showValueLabels$()) {
|
|
202
212
|
return true;
|
|
@@ -205,7 +215,7 @@ function createSlider(config) {
|
|
|
205
215
|
return rtl$() ? !valuesPercent$().some((percent2) => 100 - percent2 > 100 - minLabelWidth - 1) : !valuesPercent$().some((percent2) => percent2 < minLabelWidth + 1);
|
|
206
216
|
});
|
|
207
217
|
const maxValueLabelDisplay$ = tansu.computed(() => {
|
|
208
|
-
if (!showMinMaxLabels$()) {
|
|
218
|
+
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
209
219
|
return false;
|
|
210
220
|
} else if (!showValueLabels$()) {
|
|
211
221
|
return true;
|
|
@@ -265,9 +275,48 @@ function createSlider(config) {
|
|
|
265
275
|
}).slice(0, sortedValuesPercent.length - 1);
|
|
266
276
|
}
|
|
267
277
|
});
|
|
268
|
-
const
|
|
278
|
+
const computeTicks$ = tansu.computed(() => {
|
|
279
|
+
if (!showTicks$()) {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
const vertical = vertical$();
|
|
269
283
|
const min = min$();
|
|
270
|
-
|
|
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);
|
|
271
320
|
};
|
|
272
321
|
const getClosestSliderHandle = (clickedPercent) => {
|
|
273
322
|
const values = values$();
|
|
@@ -304,7 +353,7 @@ function createSlider(config) {
|
|
|
304
353
|
class: stateProps.className$
|
|
305
354
|
},
|
|
306
355
|
classNames: {
|
|
307
|
-
"au-slider": true
|
|
356
|
+
"au-slider": utils_stores.true$,
|
|
308
357
|
"au-slider-vertical": vertical$,
|
|
309
358
|
"au-slider-horizontal": horizontal$,
|
|
310
359
|
disabled: disabled$
|
|
@@ -318,6 +367,9 @@ function createSlider(config) {
|
|
|
318
367
|
"au-slider-label-min": horizontal$,
|
|
319
368
|
"au-slider-rtl": rtl$,
|
|
320
369
|
invisible: tansu.computed(() => !minValueLabelDisplay$())
|
|
370
|
+
},
|
|
371
|
+
attributes: {
|
|
372
|
+
"aria-hidden": tansu.readable("true")
|
|
321
373
|
}
|
|
322
374
|
}));
|
|
323
375
|
const maxLabelDirective = utils_directive.createAttributesDirective(() => ({
|
|
@@ -328,6 +380,9 @@ function createSlider(config) {
|
|
|
328
380
|
"au-slider-label-max": horizontal$,
|
|
329
381
|
"au-slider-rtl": rtl$,
|
|
330
382
|
invisible: tansu.computed(() => !maxValueLabelDisplay$())
|
|
383
|
+
},
|
|
384
|
+
attributes: {
|
|
385
|
+
"aria-hidden": tansu.readable("true")
|
|
331
386
|
}
|
|
332
387
|
}));
|
|
333
388
|
const handleEventsDirective = utils_directive.createAttributesDirective((handleContext$) => ({
|
|
@@ -400,7 +455,6 @@ function createSlider(config) {
|
|
|
400
455
|
}
|
|
401
456
|
},
|
|
402
457
|
touchstart: (event) => {
|
|
403
|
-
event.preventDefault();
|
|
404
458
|
const handleDrag = (e) => {
|
|
405
459
|
e.preventDefault();
|
|
406
460
|
const newCoord = vertical$() ? e.touches[0].clientY : e.touches[0].clientX;
|
|
@@ -450,9 +504,11 @@ function createSlider(config) {
|
|
|
450
504
|
combinedLabelPositionTop$,
|
|
451
505
|
progressDisplayOptions$,
|
|
452
506
|
handleDisplayOptions$,
|
|
453
|
-
showValueLabels$,
|
|
507
|
+
showValueLabels$: adjustedShowValueLabels$,
|
|
454
508
|
showMinMaxLabels$,
|
|
509
|
+
showTicks$,
|
|
455
510
|
rtl$,
|
|
511
|
+
ticks$,
|
|
456
512
|
...stateProps
|
|
457
513
|
}),
|
|
458
514
|
patch,
|
|
@@ -469,7 +525,7 @@ function createSlider(config) {
|
|
|
469
525
|
height: tansu.computed(() => percent(progressContext$().option.height))
|
|
470
526
|
},
|
|
471
527
|
classNames: {
|
|
472
|
-
"au-slider-progress": true
|
|
528
|
+
"au-slider-progress": utils_stores.true$
|
|
473
529
|
}
|
|
474
530
|
})),
|
|
475
531
|
clickableAreaDirective: utils_directive.createAttributesDirective(() => ({
|
|
@@ -480,7 +536,8 @@ function createSlider(config) {
|
|
|
480
536
|
},
|
|
481
537
|
classNames: {
|
|
482
538
|
"au-slider-clickable-area": horizontal$,
|
|
483
|
-
"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)
|
|
484
541
|
}
|
|
485
542
|
})),
|
|
486
543
|
handleEventsDirective,
|
|
@@ -488,7 +545,7 @@ function createSlider(config) {
|
|
|
488
545
|
handleEventsDirective,
|
|
489
546
|
utils_directive.createAttributesDirective((handleContext$) => ({
|
|
490
547
|
attributes: {
|
|
491
|
-
role: "slider",
|
|
548
|
+
role: tansu.readable("slider"),
|
|
492
549
|
"aria-valuemin": min$,
|
|
493
550
|
"aria-valuemax": max$,
|
|
494
551
|
"aria-valuenow": tansu.computed(() => handleContext$().item.value),
|
|
@@ -505,7 +562,7 @@ function createSlider(config) {
|
|
|
505
562
|
top: tansu.computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
|
|
506
563
|
},
|
|
507
564
|
classNames: {
|
|
508
|
-
"au-slider-handle": true
|
|
565
|
+
"au-slider-handle": utils_stores.true$,
|
|
509
566
|
"au-slider-handle-vertical": vertical$,
|
|
510
567
|
"au-slider-handle-horizontal": horizontal$
|
|
511
568
|
}
|
|
@@ -523,6 +580,9 @@ function createSlider(config) {
|
|
|
523
580
|
styles: {
|
|
524
581
|
left: tansu.computed(() => percent(combinedLabelPositionLeft$())),
|
|
525
582
|
top: tansu.computed(() => percent(combinedLabelPositionTop$()))
|
|
583
|
+
},
|
|
584
|
+
attributes: {
|
|
585
|
+
"aria-hidden": tansu.readable("true")
|
|
526
586
|
}
|
|
527
587
|
})),
|
|
528
588
|
handleLabelDisplayDirective: utils_directive.createAttributesDirective((labelDisplayContext$) => ({
|
|
@@ -535,6 +595,41 @@ function createSlider(config) {
|
|
|
535
595
|
styles: {
|
|
536
596
|
left: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
|
|
537
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")
|
|
538
633
|
}
|
|
539
634
|
}))
|
|
540
635
|
}
|