@agnos-ui/core 0.10.0-next.1 → 0.10.0-next.3
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-_zen-g8l.js → accordion-47EpOD36.js} +4 -3
- package/{accordion-B5LiN1uy.cjs → accordion-nxveC0GZ.cjs} +4 -3
- package/{alert-B-jQDQcB.cjs → alert-AhaliJ17.cjs} +1 -1
- package/{alert-gGz2CDS9.js → alert-anMaigvi.js} +1 -1
- package/{collapse-BV4kD3j9.js → collapse-CrfvGo_T.js} +2 -2
- package/{collapse-gLiT080Y.cjs → collapse-Da_27YUU.cjs} +2 -2
- package/{common-D3QcdJ6S.cjs → common-B5jS-Ih_.cjs} +1 -1
- package/{common-DK0ADNTX.js → common-CCxNtFNM.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 +2 -2
- package/components/carousel/index.js +2 -2
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.js +1 -1
- package/components/drawer/drawer.d.ts +32 -25
- package/components/drawer/index.cjs +1 -1
- package/components/drawer/index.js +1 -1
- package/components/modal/index.cjs +1 -1
- package/components/modal/index.js +1 -1
- 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/{dom-C2gi9OCP.cjs → dom-Cm9_uROp.cjs} +76 -6
- package/{dom-Bcg9ORcA.js → dom-DD1hAVZy.js} +76 -6
- package/drawer-Caz4Uypu.js +291 -0
- package/{drawer-DP7UPojk.cjs → drawer-DOi0TqZC.cjs} +131 -91
- package/index.cjs +16 -14
- package/index.js +21 -19
- package/{modal-DiXZXYjR.cjs → modal-B_3Uxplo.cjs} +5 -5
- package/{modal-CAvQW-vo.js → modal-cKd3qUn1.js} +5 -5
- package/package.json +1 -1
- package/{pagination-DvZ2rLsz.cjs → pagination-2Vor6JPZ.cjs} +2 -2
- package/{pagination-BKbMROV6.js → pagination-DlOyP_2C.js} +2 -2
- package/{progressbar-D8zIcm9n.js → progressbar-B5g76eMV.js} +2 -2
- package/{progressbar-i9xfAxb7.cjs → progressbar-DyBRINco.cjs} +2 -2
- package/{rating-DmG4oUkr.cjs → rating-C0y1j4SC.cjs} +2 -2
- package/{rating-DEXTGWCU.js → rating-C7C4-p4B.js} +2 -2
- package/{select-MFjAnIt7.cjs → select-Dhsb9msC.cjs} +1 -1
- package/{select-Bw68Xdu5.js → select-nnl00UWY.js} +1 -1
- package/services/floatingUI.cjs +1 -1
- package/services/floatingUI.js +1 -1
- package/services/focusElement.cjs +1 -1
- package/services/focusElement.js +1 -1
- 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 +1 -1
- package/services/navManager.js +1 -1
- package/services/pointerdownPosition.cjs +60 -0
- package/services/pointerdownPosition.d.ts +42 -0
- package/services/pointerdownPosition.js +60 -0
- package/services/portal.cjs +1 -1
- package/services/portal.js +1 -1
- package/services/resizeObserver.cjs +40 -20
- package/services/resizeObserver.d.ts +10 -2
- package/services/resizeObserver.js +41 -21
- package/services/siblingsInert.cjs +1 -1
- package/services/siblingsInert.js +1 -1
- package/services/transitions/baseTransitions.cjs +2 -2
- package/services/transitions/baseTransitions.js +2 -2
- package/services/transitions/collapse.cjs +11 -15
- package/services/transitions/collapse.js +11 -15
- package/services/transitions/cssTransitions.cjs +1 -1
- package/services/transitions/cssTransitions.js +1 -1
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-Cx50Eghd.js → slider-B4WrdTeE.js} +121 -170
- package/{slider-Dl4Trh32.cjs → slider-DTO58syz.cjs} +120 -169
- package/{toaster-_p1GTtHI.js → toaster-CRPErgI2.js} +3 -3
- package/{toaster-UDglac7x.cjs → toaster-CT148JSJ.cjs} +3 -3
- package/{tree-rGHtmCnS.cjs → tree-C4l2Wqny.cjs} +2 -2
- package/{tree-DV0tfPlZ.js → tree-CHpFqJPx.js} +2 -2
- package/types.cjs +2 -2
- package/types.d.ts +22 -3
- package/types.js +2 -2
- package/utils/directive.cjs +1 -1
- package/utils/directive.d.ts +2 -2
- package/utils/directive.js +1 -1
- package/utils/internal/dom.d.ts +2 -0
- package/utils/internal/ssrHTMLElement.d.ts +7 -1
- package/utils/stores.cjs +1 -1
- package/utils/stores.js +1 -1
- package/utils/writables.cjs +2 -1
- package/utils/writables.d.ts +7 -0
- package/utils/writables.js +6 -5
- package/{writables-DcGT98a7.cjs → writables-Dt68gADJ.cjs} +4 -0
- package/{writables-e0tyaQpe.js → writables-Is1bF1Vt.js} +10 -6
- package/drawer-D5SO73ew.js +0 -251
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { computed, writable, readable } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { l as createBrowserStoreDirective, h as createBrowserStoreArrayDirective, n as mergeDirectives, p as createAttributesDirective, b as browserDirective } from "./dom-
|
|
2
|
+
import { l as createBrowserStoreDirective, h as createBrowserStoreArrayDirective, n as mergeDirectives, p as createAttributesDirective, b as browserDirective } from "./dom-DD1hAVZy.js";
|
|
3
3
|
import { noop } from "./utils/func.js";
|
|
4
4
|
import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
|
|
5
|
-
import {
|
|
6
|
-
import { createResizeObserver } from "./services/resizeObserver.js";
|
|
5
|
+
import { j as typeArray, l as clamp, c as typeBoolean, b as typeNumberInRangeFactory, e as typeString, h as typeFunction, a as typeNumber } from "./writables-Is1bF1Vt.js";
|
|
6
|
+
import { createResizeObserver, createResizeObserverMap } from "./services/resizeObserver.js";
|
|
7
|
+
import { createPointerdownPositionDirective } from "./services/pointerdownPosition.js";
|
|
7
8
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
8
9
|
const decimalRegExp = /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
|
|
9
10
|
function getDecimalPrecision(number) {
|
|
@@ -175,7 +176,6 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
175
176
|
patch
|
|
176
177
|
] = writablesForProps(defaultSliderConfig, config, configValidator);
|
|
177
178
|
const { vertical$, disabled$, readonly$ } = stateProps;
|
|
178
|
-
let _prevCoordinate = -1;
|
|
179
179
|
const _handleElements = /* @__PURE__ */ new Map();
|
|
180
180
|
const min$ = computed(() => {
|
|
181
181
|
const _dirtyMinimum = _dirtyMinimum$(), _dirtyMaximum = _dirtyMaximum$();
|
|
@@ -238,20 +238,11 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
238
238
|
const { directive: sliderDirective, element$: sliderDom$ } = createBrowserStoreDirective();
|
|
239
239
|
const { directive: minLabelDomDirective, element$: minLabelDom$ } = createBrowserStoreDirective();
|
|
240
240
|
const { directive: maxLabelDomDirective, element$: maxLabelDom$ } = createBrowserStoreDirective();
|
|
241
|
-
const { directive: combinedLabelDomDirective, element$: combinedLabelDom$ } = createBrowserStoreDirective();
|
|
242
241
|
const { directive: handleLabelDirective, elements$: currentLabelDoms$ } = createBrowserStoreArrayDirective();
|
|
243
242
|
const { directive: resizeDirective, dimensions$ } = createResizeObserver();
|
|
243
|
+
const { directive: resizeLabelsDirective, dimensionsMap$: handleDimensions$ } = createResizeObserverMap();
|
|
244
|
+
const { directive: resizeCombineLabelDirective, dimensions$: combinedDimensions$ } = createResizeObserver();
|
|
244
245
|
const updateSliderSize$ = writable({});
|
|
245
|
-
const currentLabelDomsRect$ = computed(
|
|
246
|
-
() => {
|
|
247
|
-
dimensions$();
|
|
248
|
-
updateSliderSize$();
|
|
249
|
-
return currentLabelDoms$().map((element) => element.getBoundingClientRect());
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
equal: Object.is
|
|
253
|
-
}
|
|
254
|
-
);
|
|
255
246
|
const sliderDomRect$ = computed(
|
|
256
247
|
() => {
|
|
257
248
|
dimensions$();
|
|
@@ -282,8 +273,8 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
282
273
|
equal: (a, b) => Object.is(a, b)
|
|
283
274
|
}
|
|
284
275
|
);
|
|
285
|
-
const sliderDomRectOffset$ = computed(() => vertical$() ?
|
|
286
|
-
const sliderDomRectSize$ = computed(() => vertical$() ?
|
|
276
|
+
const sliderDomRectOffset$ = computed(() => sliderDomRect$()[vertical$() ? "top" : "left"]);
|
|
277
|
+
const sliderDomRectSize$ = computed(() => sliderDomRect$()[vertical$() ? "height" : "width"]);
|
|
287
278
|
const sortedValues$ = computed(() => [...values$()].sort((a, b) => a - b));
|
|
288
279
|
const _sortedHandlesValues$ = computed(() => {
|
|
289
280
|
return values$().map((val, index) => {
|
|
@@ -303,21 +294,15 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
303
294
|
});
|
|
304
295
|
const valuesPercent$ = computed(() => values$().map((val) => percentCompute(val)));
|
|
305
296
|
const sortedValuesPercent$ = computed(() => [...valuesPercent$()].sort((a, b) => a - b));
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
const maxLabelSize$ = computed(() => {
|
|
311
|
-
const maxLabelDomRect = maxLabelDomRect$();
|
|
312
|
-
return pixelToPercent(vertical$() ? maxLabelDomRect.height : maxLabelDomRect.width);
|
|
313
|
-
});
|
|
297
|
+
const activeDimension$ = computed(() => vertical$() ? "height" : "width");
|
|
298
|
+
const activePosition$ = computed(() => vertical$() ? "top" : "left");
|
|
299
|
+
const minLabelSize$ = computed(() => pixelToPercent(minLabelDomRect$()[activeDimension$()]));
|
|
300
|
+
const maxLabelSize$ = computed(() => pixelToPercent(maxLabelDomRect$()[activeDimension$()]));
|
|
314
301
|
const adjustedShowValueLabels$ = computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
|
|
315
302
|
const pixelToPercent = (pixels) => pixels ? pixels / sliderDomRectSize$() * 100 : 0;
|
|
316
|
-
const combinedLabelSize$ = computed(
|
|
317
|
-
() => pixelToPercent(vertical$() ? combinedLabelDom$()?.getBoundingClientRect().height : combinedLabelDom$()?.getBoundingClientRect().width)
|
|
318
|
-
);
|
|
303
|
+
const combinedLabelSize$ = computed(() => pixelToPercent(combinedDimensions$()?.contentRect[activeDimension$()]));
|
|
319
304
|
const combinedLabelPosition$ = computed(() => vertical$() ? combinedLabelPositionTop$() : combinedLabelPositionLeft$());
|
|
320
|
-
const currentLabelSizeByIndex = (index) => pixelToPercent(
|
|
305
|
+
const currentLabelSizeByIndex = (index) => pixelToPercent(handleDimensions$().get(currentLabelDoms$()[index])?.contentRect[activeDimension$()]);
|
|
321
306
|
const minValueLabelDisplay$ = computed(() => {
|
|
322
307
|
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
323
308
|
return false;
|
|
@@ -352,23 +337,34 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
352
337
|
const sortedValuesPercent = sortedValuesPercent$();
|
|
353
338
|
return rtl ? 100 - sortedValuesPercent[sortedValuesPercent.length - 1] - currentLabelSizeByIndex(0) / 2 > maxLabelSize + 1 : sortedValuesPercent[sortedValuesPercent.length - 1] + currentLabelSizeByIndex(sortedValuesPercent.length - 1) / 2 < 100 - maxLabelSize - 1;
|
|
354
339
|
});
|
|
355
|
-
const storedLabelSize$ = writable([]);
|
|
356
340
|
const combinedLabelDisplay$ = computed(() => {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
storedLabelSize$.set(values.map((_, index) => currentLabelSizeByIndex(index) / 2));
|
|
341
|
+
if (currentLabelDoms$().length == 2) {
|
|
342
|
+
return doLabelsIntersect();
|
|
360
343
|
}
|
|
361
|
-
|
|
362
|
-
const firstLabelSize = storedLabelSize?.[0] ?? 0;
|
|
363
|
-
const secondLabelSize = storedLabelSize?.[1] ?? 0;
|
|
364
|
-
const biggestLabelSize = Math.max(firstLabelSize, secondLabelSize);
|
|
365
|
-
const intersectionLimit = biggestLabelSize !== 50 ? biggestLabelSize * 2 + 2 : 15;
|
|
366
|
-
return values.length == 2 && values[1] - secondLabelSize - values[0] + firstLabelSize < intersectionLimit;
|
|
344
|
+
return false;
|
|
367
345
|
});
|
|
346
|
+
function doLabelsIntersect() {
|
|
347
|
+
const handleOptions = handleDisplayOptions$();
|
|
348
|
+
const activePosition = activePosition$();
|
|
349
|
+
const labelPosition1 = labelPosition(handleOptions[0][activePosition], currentLabelSizeByIndex(0));
|
|
350
|
+
const labelPosition2 = labelPosition(handleOptions[1][activePosition], currentLabelSizeByIndex(1));
|
|
351
|
+
const labelSize1 = currentLabelSizeByIndex(0);
|
|
352
|
+
const labelSize2 = currentLabelSizeByIndex(1);
|
|
353
|
+
if (labelSize1 === 100 || labelSize2 === 100) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
const labelStart1 = labelPosition1 - labelSize1;
|
|
357
|
+
const labelEnd1 = labelPosition1 + labelSize1;
|
|
358
|
+
const labelStart2 = labelPosition2 - labelSize2;
|
|
359
|
+
const labelEnd2 = labelPosition2 + labelSize2;
|
|
360
|
+
return !(labelEnd1 < labelStart2 || labelStart1 > labelEnd2);
|
|
361
|
+
}
|
|
368
362
|
const interactive$ = computed(() => !disabled$() && !readonly$());
|
|
369
363
|
const combinedLabelPositionLeft$ = computed(() => {
|
|
370
364
|
const sortedValuesPercent = sortedValuesPercent$();
|
|
371
|
-
const
|
|
365
|
+
const combinedLabelSize = combinedLabelSize$();
|
|
366
|
+
let combinedPosition = (sortedValuesPercent[0] + sortedValuesPercent[1]) / 2;
|
|
367
|
+
combinedPosition = labelPosition(combinedPosition, combinedLabelSize);
|
|
372
368
|
return vertical$() || sortedValuesPercent.length != 2 ? 0 : rtl$() ? 100 - combinedPosition : combinedPosition;
|
|
373
369
|
});
|
|
374
370
|
const combinedLabelPositionTop$ = computed(() => {
|
|
@@ -385,6 +381,7 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
385
381
|
};
|
|
386
382
|
});
|
|
387
383
|
});
|
|
384
|
+
const labelPosition = (initialPosition, labelSize) => clamp(initialPosition, 100 - labelSize / 2, labelSize / 2);
|
|
388
385
|
const progressDisplayOptions$ = computed(() => {
|
|
389
386
|
const vertical = vertical$(), sortedValuesPercent = sortedValuesPercent$(), rtl = rtl$();
|
|
390
387
|
if (sortedValuesPercent.length === 1) {
|
|
@@ -551,119 +548,76 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
551
548
|
destroy
|
|
552
549
|
};
|
|
553
550
|
});
|
|
554
|
-
const
|
|
555
|
-
event.preventDefault();
|
|
556
|
-
const currentTarget = handleId !== void 0 ? _handleElements.get(handleId) : event.target;
|
|
557
|
-
const handleDrag = (e) => {
|
|
558
|
-
e.preventDefault();
|
|
559
|
-
const newCoord = vertical$() ? e.clientY : e.clientX;
|
|
560
|
-
currentTarget?.focus();
|
|
561
|
-
if (_prevCoordinate !== newCoord) {
|
|
562
|
-
_prevCoordinate = newCoord;
|
|
563
|
-
adjustCoordinate(newCoord, handleId);
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
if (interactive$()) {
|
|
567
|
-
updateSliderSize$.set({});
|
|
568
|
-
currentTarget?.focus();
|
|
569
|
-
document.addEventListener("mousemove", handleDrag);
|
|
570
|
-
document.addEventListener(
|
|
571
|
-
"mouseup",
|
|
572
|
-
() => {
|
|
573
|
-
document.removeEventListener("mousemove", handleDrag);
|
|
574
|
-
},
|
|
575
|
-
{ once: true }
|
|
576
|
-
);
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
const touchStart = (event, handleId) => {
|
|
551
|
+
const pointerMoveStart = (event, handleId) => {
|
|
580
552
|
const currentTarget = handleId !== void 0 ? _handleElements.get(handleId) : event.target;
|
|
581
|
-
const handleDrag = (e) => {
|
|
582
|
-
e.preventDefault();
|
|
583
|
-
const newCoord = vertical$() ? e.touches[0].clientY : e.touches[0].clientX;
|
|
584
|
-
currentTarget?.focus();
|
|
585
|
-
if (_prevCoordinate !== newCoord) {
|
|
586
|
-
_prevCoordinate = newCoord;
|
|
587
|
-
adjustCoordinate(newCoord, handleId);
|
|
588
|
-
}
|
|
589
|
-
};
|
|
590
553
|
if (interactive$()) {
|
|
554
|
+
const vertical = vertical$();
|
|
555
|
+
const clientXorY = vertical ? "clientY" : "clientX";
|
|
556
|
+
let _prevCoordinate = event[clientXorY];
|
|
591
557
|
updateSliderSize$.set({});
|
|
592
558
|
currentTarget?.focus();
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
"touchcancel",
|
|
604
|
-
() => {
|
|
605
|
-
document.removeEventListener("touchmove", handleDrag);
|
|
606
|
-
document.removeEventListener("touchend", handleDrag);
|
|
607
|
-
},
|
|
608
|
-
{ once: true }
|
|
609
|
-
);
|
|
559
|
+
return {
|
|
560
|
+
onMove: (event2) => {
|
|
561
|
+
currentTarget?.focus();
|
|
562
|
+
const newCoord = event2[clientXorY];
|
|
563
|
+
if (_prevCoordinate !== newCoord) {
|
|
564
|
+
_prevCoordinate = newCoord;
|
|
565
|
+
adjustCoordinate(newCoord, handleId);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
};
|
|
610
569
|
}
|
|
570
|
+
return void 0;
|
|
611
571
|
};
|
|
612
|
-
const handleEventsDirective =
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
value
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
value
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
572
|
+
const handleEventsDirective = mergeDirectives(
|
|
573
|
+
createAttributesDirective((handleContext$) => ({
|
|
574
|
+
events: {
|
|
575
|
+
keydown: (event) => {
|
|
576
|
+
const handleIndex = handleContext$().item.id;
|
|
577
|
+
const { key } = event;
|
|
578
|
+
const rtl = rtl$(), stepSize = stepSize$(), min = min$(), max = max$(), vertical = vertical$();
|
|
579
|
+
if (interactive$()) {
|
|
580
|
+
switch (key) {
|
|
581
|
+
case "ArrowDown":
|
|
582
|
+
updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, true));
|
|
583
|
+
break;
|
|
584
|
+
case "ArrowLeft":
|
|
585
|
+
updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, false));
|
|
586
|
+
break;
|
|
587
|
+
case "ArrowUp":
|
|
588
|
+
updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, true));
|
|
589
|
+
break;
|
|
590
|
+
case "ArrowRight":
|
|
591
|
+
updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, false));
|
|
592
|
+
break;
|
|
593
|
+
case "Home":
|
|
594
|
+
values$.update((value) => {
|
|
595
|
+
value = [...value];
|
|
596
|
+
value[handleIndex] = min;
|
|
597
|
+
return value;
|
|
598
|
+
});
|
|
599
|
+
break;
|
|
600
|
+
case "End":
|
|
601
|
+
values$.update((value) => {
|
|
602
|
+
value = [...value];
|
|
603
|
+
value[handleIndex] = max;
|
|
604
|
+
return value;
|
|
605
|
+
});
|
|
606
|
+
break;
|
|
607
|
+
case "PageUp":
|
|
608
|
+
break;
|
|
609
|
+
case "PageDown":
|
|
610
|
+
break;
|
|
611
|
+
default:
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
event.preventDefault();
|
|
652
615
|
}
|
|
653
|
-
event.preventDefault();
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
mousedown: (event) => {
|
|
657
|
-
if (event.button !== 0) {
|
|
658
|
-
return;
|
|
659
616
|
}
|
|
660
|
-
mouseDown(event, handleContext$().item.id);
|
|
661
|
-
},
|
|
662
|
-
touchstart: (event) => {
|
|
663
|
-
touchStart(event, handleContext$().item.id);
|
|
664
617
|
}
|
|
665
|
-
}
|
|
666
|
-
|
|
618
|
+
})),
|
|
619
|
+
createPointerdownPositionDirective((position, { item: { id } }) => pointerMoveStart(position, id))
|
|
620
|
+
);
|
|
667
621
|
const widget = {
|
|
668
622
|
...stateStores({
|
|
669
623
|
min$,
|
|
@@ -705,30 +659,21 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
705
659
|
"au-slider-progress": true$
|
|
706
660
|
}
|
|
707
661
|
})),
|
|
708
|
-
clickableAreaDirective:
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
const clickedCoordinate = vertical$() ? event.clientY : event.clientX;
|
|
715
|
-
const closestHandle = getClosestSliderHandle(getClickedPercent(clickedCoordinate));
|
|
716
|
-
adjustCoordinate(clickedCoordinate, closestHandle);
|
|
717
|
-
mouseDown(event, closestHandle);
|
|
718
|
-
},
|
|
719
|
-
touchstart: (event) => {
|
|
720
|
-
const clickedCoordinate = vertical$() ? event.touches[0].clientY : event.touches[0].clientX;
|
|
721
|
-
const closestHandle = getClosestSliderHandle(getClickedPercent(clickedCoordinate));
|
|
722
|
-
adjustCoordinate(clickedCoordinate, closestHandle);
|
|
723
|
-
touchStart(event, closestHandle);
|
|
662
|
+
clickableAreaDirective: mergeDirectives(
|
|
663
|
+
createAttributesDirective(() => ({
|
|
664
|
+
classNames: {
|
|
665
|
+
"au-slider-clickable-area": horizontal$,
|
|
666
|
+
"au-slider-clickable-area-vertical": vertical$,
|
|
667
|
+
"au-slider-clickable-area-with-ticks": computed(() => showTicks$() && tickInterval$() === 0)
|
|
724
668
|
}
|
|
725
|
-
},
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
669
|
+
})),
|
|
670
|
+
createPointerdownPositionDirective((position) => {
|
|
671
|
+
const clickedCoordinate = vertical$() ? position.clientY : position.clientX;
|
|
672
|
+
const closestHandle = getClosestSliderHandle(getClickedPercent(clickedCoordinate));
|
|
673
|
+
adjustCoordinate(clickedCoordinate, closestHandle);
|
|
674
|
+
return pointerMoveStart(position, closestHandle);
|
|
675
|
+
})
|
|
676
|
+
),
|
|
732
677
|
handleEventsDirective,
|
|
733
678
|
handleDirective: mergeDirectives(
|
|
734
679
|
handleElementDirective,
|
|
@@ -761,7 +706,7 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
761
706
|
minLabelDirective: mergeDirectives(minLabelDomDirective, minLabelDirective),
|
|
762
707
|
maxLabelDirective: mergeDirectives(maxLabelDomDirective, maxLabelDirective),
|
|
763
708
|
combinedHandleLabelDisplayDirective: mergeDirectives(
|
|
764
|
-
|
|
709
|
+
resizeCombineLabelDirective,
|
|
765
710
|
createAttributesDirective(() => ({
|
|
766
711
|
classNames: {
|
|
767
712
|
"au-slider-label-vertical": vertical$,
|
|
@@ -780,6 +725,7 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
780
725
|
),
|
|
781
726
|
handleLabelDisplayDirective: mergeDirectives(
|
|
782
727
|
handleLabelDirective,
|
|
728
|
+
resizeLabelsDirective,
|
|
783
729
|
createAttributesDirective((labelDisplayContext$) => ({
|
|
784
730
|
classNames: {
|
|
785
731
|
"au-slider-label-vertical": vertical$,
|
|
@@ -788,8 +734,13 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
788
734
|
"au-slider-label-now": horizontal$
|
|
789
735
|
},
|
|
790
736
|
styles: {
|
|
791
|
-
left: computed(() =>
|
|
792
|
-
|
|
737
|
+
left: computed(() => {
|
|
738
|
+
const handleIndex = labelDisplayContext$().index;
|
|
739
|
+
const leftPosition = handleDisplayOptions$()[handleIndex].left;
|
|
740
|
+
return leftPosition === null ? "" : percent(labelPosition(leftPosition, currentLabelSizeByIndex(handleIndex)));
|
|
741
|
+
}),
|
|
742
|
+
top: computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top)),
|
|
743
|
+
opacity: computed(() => combinedLabelDisplay$() ? "0" : "1")
|
|
793
744
|
},
|
|
794
745
|
attributes: {
|
|
795
746
|
"aria-hidden": readable("true")
|