@agnos-ui/core 0.10.0-next.2 → 0.10.0-next.4

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.
Files changed (102) hide show
  1. package/{accordion-DqnKGmbS.js → accordion-47EpOD36.js} +2 -2
  2. package/{accordion-DRIm0xHf.cjs → accordion-nxveC0GZ.cjs} +2 -2
  3. package/{alert-B-jQDQcB.cjs → alert-AhaliJ17.cjs} +1 -1
  4. package/{alert-gGz2CDS9.js → alert-anMaigvi.js} +1 -1
  5. package/{collapse-BV4kD3j9.js → collapse-CrfvGo_T.js} +2 -2
  6. package/{collapse-gLiT080Y.cjs → collapse-Da_27YUU.cjs} +2 -2
  7. package/{common-D3QcdJ6S.cjs → common-B5jS-Ih_.cjs} +1 -1
  8. package/{common-DK0ADNTX.js → common-CCxNtFNM.js} +1 -1
  9. package/components/accordion/index.cjs +1 -1
  10. package/components/accordion/index.js +1 -1
  11. package/components/alert/index.cjs +1 -1
  12. package/components/alert/index.js +1 -1
  13. package/components/carousel/index.cjs +2 -2
  14. package/components/carousel/index.js +2 -2
  15. package/components/collapse/index.cjs +1 -1
  16. package/components/collapse/index.js +1 -1
  17. package/components/drawer/drawer.d.ts +32 -25
  18. package/components/drawer/index.cjs +1 -1
  19. package/components/drawer/index.js +1 -1
  20. package/components/modal/index.cjs +1 -1
  21. package/components/modal/index.js +1 -1
  22. package/components/pagination/index.cjs +1 -1
  23. package/components/pagination/index.js +1 -1
  24. package/components/progressbar/index.cjs +1 -1
  25. package/components/progressbar/index.js +1 -1
  26. package/components/rating/index.cjs +1 -1
  27. package/components/rating/index.js +1 -1
  28. package/components/select/index.cjs +1 -1
  29. package/components/select/index.js +1 -1
  30. package/components/slider/index.cjs +1 -1
  31. package/components/slider/index.js +1 -1
  32. package/components/toast/index.cjs +1 -1
  33. package/components/toast/index.js +1 -1
  34. package/components/tree/index.cjs +1 -1
  35. package/components/tree/index.js +1 -1
  36. package/{dom-C2gi9OCP.cjs → dom-Cm9_uROp.cjs} +76 -6
  37. package/{dom-Bcg9ORcA.js → dom-DD1hAVZy.js} +76 -6
  38. package/drawer-B5Yaqpiu.cjs +297 -0
  39. package/drawer-CGHyRTM9.js +298 -0
  40. package/index.cjs +16 -14
  41. package/index.js +21 -19
  42. package/{modal-DiXZXYjR.cjs → modal-B_3Uxplo.cjs} +5 -5
  43. package/{modal-CAvQW-vo.js → modal-cKd3qUn1.js} +5 -5
  44. package/package.json +1 -1
  45. package/{pagination-DvZ2rLsz.cjs → pagination-2Vor6JPZ.cjs} +2 -2
  46. package/{pagination-BKbMROV6.js → pagination-DlOyP_2C.js} +2 -2
  47. package/{progressbar-D8zIcm9n.js → progressbar-B5g76eMV.js} +2 -2
  48. package/{progressbar-i9xfAxb7.cjs → progressbar-DyBRINco.cjs} +2 -2
  49. package/{rating-DmG4oUkr.cjs → rating-C0y1j4SC.cjs} +2 -2
  50. package/{rating-DEXTGWCU.js → rating-C7C4-p4B.js} +2 -2
  51. package/{select-MFjAnIt7.cjs → select-Dhsb9msC.cjs} +1 -1
  52. package/{select-Bw68Xdu5.js → select-nnl00UWY.js} +1 -1
  53. package/services/floatingUI.cjs +1 -1
  54. package/services/floatingUI.js +1 -1
  55. package/services/focusElement.cjs +1 -1
  56. package/services/focusElement.js +1 -1
  57. package/services/focustrack.cjs +1 -1
  58. package/services/focustrack.js +1 -1
  59. package/services/matchMedia.cjs +1 -1
  60. package/services/matchMedia.js +1 -1
  61. package/services/navManager.cjs +1 -1
  62. package/services/navManager.js +1 -1
  63. package/services/pointerdownPosition.cjs +60 -0
  64. package/services/pointerdownPosition.d.ts +42 -0
  65. package/services/pointerdownPosition.js +60 -0
  66. package/services/portal.cjs +1 -1
  67. package/services/portal.js +1 -1
  68. package/services/resizeObserver.cjs +40 -20
  69. package/services/resizeObserver.d.ts +10 -2
  70. package/services/resizeObserver.js +41 -21
  71. package/services/siblingsInert.cjs +1 -1
  72. package/services/siblingsInert.js +1 -1
  73. package/services/transitions/baseTransitions.cjs +2 -2
  74. package/services/transitions/baseTransitions.js +2 -2
  75. package/services/transitions/collapse.cjs +11 -15
  76. package/services/transitions/collapse.js +11 -15
  77. package/services/transitions/cssTransitions.cjs +1 -1
  78. package/services/transitions/cssTransitions.js +1 -1
  79. package/services/transitions/simpleClassTransition.cjs +1 -1
  80. package/services/transitions/simpleClassTransition.js +1 -1
  81. package/{slider-Cx50Eghd.js → slider-B4WrdTeE.js} +121 -170
  82. package/{slider-Dl4Trh32.cjs → slider-DTO58syz.cjs} +120 -169
  83. package/{toaster-_p1GTtHI.js → toaster-CRPErgI2.js} +3 -3
  84. package/{toaster-UDglac7x.cjs → toaster-CT148JSJ.cjs} +3 -3
  85. package/{tree-rGHtmCnS.cjs → tree-C4l2Wqny.cjs} +2 -2
  86. package/{tree-DV0tfPlZ.js → tree-CHpFqJPx.js} +2 -2
  87. package/types.cjs +2 -2
  88. package/types.d.ts +22 -3
  89. package/types.js +2 -2
  90. package/utils/directive.cjs +1 -1
  91. package/utils/directive.d.ts +2 -2
  92. package/utils/directive.js +1 -1
  93. package/utils/internal/ssrHTMLElement.d.ts +7 -1
  94. package/utils/stores.cjs +1 -1
  95. package/utils/stores.js +1 -1
  96. package/utils/writables.cjs +2 -1
  97. package/utils/writables.d.ts +7 -0
  98. package/utils/writables.js +6 -5
  99. package/{writables-DcGT98a7.cjs → writables-Dt68gADJ.cjs} +4 -0
  100. package/{writables-e0tyaQpe.js → writables-Is1bF1Vt.js} +10 -6
  101. package/drawer-D5SO73ew.js +0 -251
  102. package/drawer-DP7UPojk.cjs +0 -250
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  const tansu = require("@amadeus-it-group/tansu");
3
- const utils_directive = require("./dom-C2gi9OCP.cjs");
3
+ const utils_directive = require("./dom-Cm9_uROp.cjs");
4
4
  const utils_func = require("./utils/func.cjs");
5
5
  const utils_stores = require("./utils/stores.cjs");
6
- const utils_writables = require("./writables-DcGT98a7.cjs");
6
+ const utils_writables = require("./writables-Dt68gADJ.cjs");
7
7
  const services_resizeObserver = require("./services/resizeObserver.cjs");
8
+ const services_pointerdownPosition = require("./services/pointerdownPosition.cjs");
8
9
  const utils_widget = require("./utils/widget.cjs");
9
10
  const decimalRegExp = /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
10
11
  function getDecimalPrecision(number) {
@@ -176,7 +177,6 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
176
177
  patch
177
178
  ] = utils_stores.writablesForProps(defaultSliderConfig, config, configValidator);
178
179
  const { vertical$, disabled$, readonly$ } = stateProps;
179
- let _prevCoordinate = -1;
180
180
  const _handleElements = /* @__PURE__ */ new Map();
181
181
  const min$ = tansu.computed(() => {
182
182
  const _dirtyMinimum = _dirtyMinimum$(), _dirtyMaximum = _dirtyMaximum$();
@@ -239,20 +239,11 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
239
239
  const { directive: sliderDirective, element$: sliderDom$ } = utils_directive.createBrowserStoreDirective();
240
240
  const { directive: minLabelDomDirective, element$: minLabelDom$ } = utils_directive.createBrowserStoreDirective();
241
241
  const { directive: maxLabelDomDirective, element$: maxLabelDom$ } = utils_directive.createBrowserStoreDirective();
242
- const { directive: combinedLabelDomDirective, element$: combinedLabelDom$ } = utils_directive.createBrowserStoreDirective();
243
242
  const { directive: handleLabelDirective, elements$: currentLabelDoms$ } = utils_directive.createBrowserStoreArrayDirective();
244
243
  const { directive: resizeDirective, dimensions$ } = services_resizeObserver.createResizeObserver();
244
+ const { directive: resizeLabelsDirective, dimensionsMap$: handleDimensions$ } = services_resizeObserver.createResizeObserverMap();
245
+ const { directive: resizeCombineLabelDirective, dimensions$: combinedDimensions$ } = services_resizeObserver.createResizeObserver();
245
246
  const updateSliderSize$ = tansu.writable({});
246
- const currentLabelDomsRect$ = tansu.computed(
247
- () => {
248
- dimensions$();
249
- updateSliderSize$();
250
- return currentLabelDoms$().map((element) => element.getBoundingClientRect());
251
- },
252
- {
253
- equal: Object.is
254
- }
255
- );
256
247
  const sliderDomRect$ = tansu.computed(
257
248
  () => {
258
249
  dimensions$();
@@ -283,8 +274,8 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
283
274
  equal: (a, b) => Object.is(a, b)
284
275
  }
285
276
  );
286
- const sliderDomRectOffset$ = tansu.computed(() => vertical$() ? sliderDomRect$().top : sliderDomRect$().left);
287
- const sliderDomRectSize$ = tansu.computed(() => vertical$() ? sliderDomRect$().height : sliderDomRect$().width);
277
+ const sliderDomRectOffset$ = tansu.computed(() => sliderDomRect$()[vertical$() ? "top" : "left"]);
278
+ const sliderDomRectSize$ = tansu.computed(() => sliderDomRect$()[vertical$() ? "height" : "width"]);
288
279
  const sortedValues$ = tansu.computed(() => [...values$()].sort((a, b) => a - b));
289
280
  const _sortedHandlesValues$ = tansu.computed(() => {
290
281
  return values$().map((val, index) => {
@@ -304,21 +295,15 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
304
295
  });
305
296
  const valuesPercent$ = tansu.computed(() => values$().map((val) => percentCompute(val)));
306
297
  const sortedValuesPercent$ = tansu.computed(() => [...valuesPercent$()].sort((a, b) => a - b));
307
- const minLabelSize$ = tansu.computed(() => {
308
- const minLabelDomRect = minLabelDomRect$();
309
- return pixelToPercent(vertical$() ? minLabelDomRect.height : minLabelDomRect.width);
310
- });
311
- const maxLabelSize$ = tansu.computed(() => {
312
- const maxLabelDomRect = maxLabelDomRect$();
313
- return pixelToPercent(vertical$() ? maxLabelDomRect.height : maxLabelDomRect.width);
314
- });
298
+ const activeDimension$ = tansu.computed(() => vertical$() ? "height" : "width");
299
+ const activePosition$ = tansu.computed(() => vertical$() ? "top" : "left");
300
+ const minLabelSize$ = tansu.computed(() => pixelToPercent(minLabelDomRect$()[activeDimension$()]));
301
+ const maxLabelSize$ = tansu.computed(() => pixelToPercent(maxLabelDomRect$()[activeDimension$()]));
315
302
  const adjustedShowValueLabels$ = tansu.computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
316
303
  const pixelToPercent = (pixels) => pixels ? pixels / sliderDomRectSize$() * 100 : 0;
317
- const combinedLabelSize$ = tansu.computed(
318
- () => pixelToPercent(vertical$() ? combinedLabelDom$()?.getBoundingClientRect().height : combinedLabelDom$()?.getBoundingClientRect().width)
319
- );
304
+ const combinedLabelSize$ = tansu.computed(() => pixelToPercent(combinedDimensions$()?.contentRect[activeDimension$()]));
320
305
  const combinedLabelPosition$ = tansu.computed(() => vertical$() ? combinedLabelPositionTop$() : combinedLabelPositionLeft$());
321
- const currentLabelSizeByIndex = (index) => pixelToPercent(vertical$() ? currentLabelDomsRect$()[index]?.height : currentLabelDomsRect$()[index]?.width);
306
+ const currentLabelSizeByIndex = (index) => pixelToPercent(handleDimensions$().get(currentLabelDoms$()[index])?.contentRect[activeDimension$()]);
322
307
  const minValueLabelDisplay$ = tansu.computed(() => {
323
308
  if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
324
309
  return false;
@@ -353,23 +338,34 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
353
338
  const sortedValuesPercent = sortedValuesPercent$();
354
339
  return rtl ? 100 - sortedValuesPercent[sortedValuesPercent.length - 1] - currentLabelSizeByIndex(0) / 2 > maxLabelSize + 1 : sortedValuesPercent[sortedValuesPercent.length - 1] + currentLabelSizeByIndex(sortedValuesPercent.length - 1) / 2 < 100 - maxLabelSize - 1;
355
340
  });
356
- const storedLabelSize$ = tansu.writable([]);
357
341
  const combinedLabelDisplay$ = tansu.computed(() => {
358
- const values = sortedValuesPercent$();
359
- if (currentLabelDomsRect$().length === values.length) {
360
- storedLabelSize$.set(values.map((_, index) => currentLabelSizeByIndex(index) / 2));
342
+ if (currentLabelDoms$().length == 2) {
343
+ return doLabelsIntersect();
361
344
  }
362
- const storedLabelSize = storedLabelSize$();
363
- const firstLabelSize = storedLabelSize?.[0] ?? 0;
364
- const secondLabelSize = storedLabelSize?.[1] ?? 0;
365
- const biggestLabelSize = Math.max(firstLabelSize, secondLabelSize);
366
- const intersectionLimit = biggestLabelSize !== 50 ? biggestLabelSize * 2 + 2 : 15;
367
- return values.length == 2 && values[1] - secondLabelSize - values[0] + firstLabelSize < intersectionLimit;
345
+ return false;
368
346
  });
347
+ function doLabelsIntersect() {
348
+ const handleOptions = handleDisplayOptions$();
349
+ const activePosition = activePosition$();
350
+ const labelPosition1 = labelPosition(handleOptions[0][activePosition], currentLabelSizeByIndex(0));
351
+ const labelPosition2 = labelPosition(handleOptions[1][activePosition], currentLabelSizeByIndex(1));
352
+ const labelSize1 = currentLabelSizeByIndex(0);
353
+ const labelSize2 = currentLabelSizeByIndex(1);
354
+ if (labelSize1 === 100 || labelSize2 === 100) {
355
+ return false;
356
+ }
357
+ const labelStart1 = labelPosition1 - labelSize1;
358
+ const labelEnd1 = labelPosition1 + labelSize1;
359
+ const labelStart2 = labelPosition2 - labelSize2;
360
+ const labelEnd2 = labelPosition2 + labelSize2;
361
+ return !(labelEnd1 < labelStart2 || labelStart1 > labelEnd2);
362
+ }
369
363
  const interactive$ = tansu.computed(() => !disabled$() && !readonly$());
370
364
  const combinedLabelPositionLeft$ = tansu.computed(() => {
371
365
  const sortedValuesPercent = sortedValuesPercent$();
372
- const combinedPosition = (sortedValuesPercent[0] + sortedValuesPercent[1]) / 2;
366
+ const combinedLabelSize = combinedLabelSize$();
367
+ let combinedPosition = (sortedValuesPercent[0] + sortedValuesPercent[1]) / 2;
368
+ combinedPosition = labelPosition(combinedPosition, combinedLabelSize);
373
369
  return vertical$() || sortedValuesPercent.length != 2 ? 0 : rtl$() ? 100 - combinedPosition : combinedPosition;
374
370
  });
375
371
  const combinedLabelPositionTop$ = tansu.computed(() => {
@@ -386,6 +382,7 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
386
382
  };
387
383
  });
388
384
  });
385
+ const labelPosition = (initialPosition, labelSize) => utils_writables.clamp(initialPosition, 100 - labelSize / 2, labelSize / 2);
389
386
  const progressDisplayOptions$ = tansu.computed(() => {
390
387
  const vertical = vertical$(), sortedValuesPercent = sortedValuesPercent$(), rtl = rtl$();
391
388
  if (sortedValuesPercent.length === 1) {
@@ -552,119 +549,76 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
552
549
  destroy
553
550
  };
554
551
  });
555
- const mouseDown = (event, handleId) => {
556
- event.preventDefault();
557
- const currentTarget = handleId !== void 0 ? _handleElements.get(handleId) : event.target;
558
- const handleDrag = (e) => {
559
- e.preventDefault();
560
- const newCoord = vertical$() ? e.clientY : e.clientX;
561
- currentTarget?.focus();
562
- if (_prevCoordinate !== newCoord) {
563
- _prevCoordinate = newCoord;
564
- adjustCoordinate(newCoord, handleId);
565
- }
566
- };
567
- if (interactive$()) {
568
- updateSliderSize$.set({});
569
- currentTarget?.focus();
570
- document.addEventListener("mousemove", handleDrag);
571
- document.addEventListener(
572
- "mouseup",
573
- () => {
574
- document.removeEventListener("mousemove", handleDrag);
575
- },
576
- { once: true }
577
- );
578
- }
579
- };
580
- const touchStart = (event, handleId) => {
552
+ const pointerMoveStart = (event, handleId) => {
581
553
  const currentTarget = handleId !== void 0 ? _handleElements.get(handleId) : event.target;
582
- const handleDrag = (e) => {
583
- e.preventDefault();
584
- const newCoord = vertical$() ? e.touches[0].clientY : e.touches[0].clientX;
585
- currentTarget?.focus();
586
- if (_prevCoordinate !== newCoord) {
587
- _prevCoordinate = newCoord;
588
- adjustCoordinate(newCoord, handleId);
589
- }
590
- };
591
554
  if (interactive$()) {
555
+ const vertical = vertical$();
556
+ const clientXorY = vertical ? "clientY" : "clientX";
557
+ let _prevCoordinate = event[clientXorY];
592
558
  updateSliderSize$.set({});
593
559
  currentTarget?.focus();
594
- document.addEventListener("touchmove", handleDrag, { passive: false });
595
- document.addEventListener(
596
- "touchend",
597
- () => {
598
- document.removeEventListener("touchmove", handleDrag);
599
- document.removeEventListener("touchcancel", handleDrag);
600
- },
601
- { once: true }
602
- );
603
- document.addEventListener(
604
- "touchcancel",
605
- () => {
606
- document.removeEventListener("touchmove", handleDrag);
607
- document.removeEventListener("touchend", handleDrag);
608
- },
609
- { once: true }
610
- );
560
+ return {
561
+ onMove: (event2) => {
562
+ currentTarget?.focus();
563
+ const newCoord = event2[clientXorY];
564
+ if (_prevCoordinate !== newCoord) {
565
+ _prevCoordinate = newCoord;
566
+ adjustCoordinate(newCoord, handleId);
567
+ }
568
+ }
569
+ };
611
570
  }
571
+ return void 0;
612
572
  };
613
- const handleEventsDirective = utils_directive.createAttributesDirective((handleContext$) => ({
614
- events: {
615
- keydown: (event) => {
616
- const handleIndex = handleContext$().item.id;
617
- const { key } = event;
618
- const rtl = rtl$(), stepSize = stepSize$(), min = min$(), max = max$(), vertical = vertical$();
619
- if (interactive$()) {
620
- switch (key) {
621
- case "ArrowDown":
622
- updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, true));
623
- break;
624
- case "ArrowLeft":
625
- updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, false));
626
- break;
627
- case "ArrowUp":
628
- updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, true));
629
- break;
630
- case "ArrowRight":
631
- updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, false));
632
- break;
633
- case "Home":
634
- values$.update((value) => {
635
- value = [...value];
636
- value[handleIndex] = min;
637
- return value;
638
- });
639
- break;
640
- case "End":
641
- values$.update((value) => {
642
- value = [...value];
643
- value[handleIndex] = max;
644
- return value;
645
- });
646
- break;
647
- case "PageUp":
648
- break;
649
- case "PageDown":
650
- break;
651
- default:
652
- return;
573
+ const handleEventsDirective = utils_directive.mergeDirectives(
574
+ utils_directive.createAttributesDirective((handleContext$) => ({
575
+ events: {
576
+ keydown: (event) => {
577
+ const handleIndex = handleContext$().item.id;
578
+ const { key } = event;
579
+ const rtl = rtl$(), stepSize = stepSize$(), min = min$(), max = max$(), vertical = vertical$();
580
+ if (interactive$()) {
581
+ switch (key) {
582
+ case "ArrowDown":
583
+ updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, true));
584
+ break;
585
+ case "ArrowLeft":
586
+ updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, false));
587
+ break;
588
+ case "ArrowUp":
589
+ updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, true));
590
+ break;
591
+ case "ArrowRight":
592
+ updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, false));
593
+ break;
594
+ case "Home":
595
+ values$.update((value) => {
596
+ value = [...value];
597
+ value[handleIndex] = min;
598
+ return value;
599
+ });
600
+ break;
601
+ case "End":
602
+ values$.update((value) => {
603
+ value = [...value];
604
+ value[handleIndex] = max;
605
+ return value;
606
+ });
607
+ break;
608
+ case "PageUp":
609
+ break;
610
+ case "PageDown":
611
+ break;
612
+ default:
613
+ return;
614
+ }
615
+ event.preventDefault();
653
616
  }
654
- event.preventDefault();
655
- }
656
- },
657
- mousedown: (event) => {
658
- if (event.button !== 0) {
659
- return;
660
617
  }
661
- mouseDown(event, handleContext$().item.id);
662
- },
663
- touchstart: (event) => {
664
- touchStart(event, handleContext$().item.id);
665
618
  }
666
- }
667
- }));
619
+ })),
620
+ services_pointerdownPosition.createPointerdownPositionDirective((position, { item: { id } }) => pointerMoveStart(position, id))
621
+ );
668
622
  const widget = {
669
623
  ...utils_stores.stateStores({
670
624
  min$,
@@ -706,30 +660,21 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
706
660
  "au-slider-progress": utils_stores.true$
707
661
  }
708
662
  })),
709
- clickableAreaDirective: utils_directive.createAttributesDirective(() => ({
710
- events: {
711
- mousedown: (event) => {
712
- if (event.button !== 0) {
713
- return;
714
- }
715
- const clickedCoordinate = vertical$() ? event.clientY : event.clientX;
716
- const closestHandle = getClosestSliderHandle(getClickedPercent(clickedCoordinate));
717
- adjustCoordinate(clickedCoordinate, closestHandle);
718
- mouseDown(event, closestHandle);
719
- },
720
- touchstart: (event) => {
721
- const clickedCoordinate = vertical$() ? event.touches[0].clientY : event.touches[0].clientX;
722
- const closestHandle = getClosestSliderHandle(getClickedPercent(clickedCoordinate));
723
- adjustCoordinate(clickedCoordinate, closestHandle);
724
- touchStart(event, closestHandle);
663
+ clickableAreaDirective: utils_directive.mergeDirectives(
664
+ utils_directive.createAttributesDirective(() => ({
665
+ classNames: {
666
+ "au-slider-clickable-area": horizontal$,
667
+ "au-slider-clickable-area-vertical": vertical$,
668
+ "au-slider-clickable-area-with-ticks": tansu.computed(() => showTicks$() && tickInterval$() === 0)
725
669
  }
726
- },
727
- classNames: {
728
- "au-slider-clickable-area": horizontal$,
729
- "au-slider-clickable-area-vertical": vertical$,
730
- "au-slider-clickable-area-with-ticks": tansu.computed(() => showTicks$() && tickInterval$() === 0)
731
- }
732
- })),
670
+ })),
671
+ services_pointerdownPosition.createPointerdownPositionDirective((position) => {
672
+ const clickedCoordinate = vertical$() ? position.clientY : position.clientX;
673
+ const closestHandle = getClosestSliderHandle(getClickedPercent(clickedCoordinate));
674
+ adjustCoordinate(clickedCoordinate, closestHandle);
675
+ return pointerMoveStart(position, closestHandle);
676
+ })
677
+ ),
733
678
  handleEventsDirective,
734
679
  handleDirective: utils_directive.mergeDirectives(
735
680
  handleElementDirective,
@@ -762,7 +707,7 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
762
707
  minLabelDirective: utils_directive.mergeDirectives(minLabelDomDirective, minLabelDirective),
763
708
  maxLabelDirective: utils_directive.mergeDirectives(maxLabelDomDirective, maxLabelDirective),
764
709
  combinedHandleLabelDisplayDirective: utils_directive.mergeDirectives(
765
- combinedLabelDomDirective,
710
+ resizeCombineLabelDirective,
766
711
  utils_directive.createAttributesDirective(() => ({
767
712
  classNames: {
768
713
  "au-slider-label-vertical": vertical$,
@@ -781,6 +726,7 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
781
726
  ),
782
727
  handleLabelDisplayDirective: utils_directive.mergeDirectives(
783
728
  handleLabelDirective,
729
+ resizeLabelsDirective,
784
730
  utils_directive.createAttributesDirective((labelDisplayContext$) => ({
785
731
  classNames: {
786
732
  "au-slider-label-vertical": vertical$,
@@ -789,8 +735,13 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
789
735
  "au-slider-label-now": horizontal$
790
736
  },
791
737
  styles: {
792
- left: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
793
- top: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top))
738
+ left: tansu.computed(() => {
739
+ const handleIndex = labelDisplayContext$().index;
740
+ const leftPosition = handleDisplayOptions$()[handleIndex].left;
741
+ return leftPosition === null ? "" : percent(labelPosition(leftPosition, currentLabelSizeByIndex(handleIndex)));
742
+ }),
743
+ top: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top)),
744
+ opacity: tansu.computed(() => combinedLabelDisplay$() ? "0" : "1")
794
745
  },
795
746
  attributes: {
796
747
  "aria-hidden": tansu.readable("true")
@@ -1,9 +1,9 @@
1
1
  import { computed, readable, writable } from "@amadeus-it-group/tansu";
2
2
  import { extendWidgetProps } from "./services/extendWidget.js";
3
- import { p as createAttributesDirective, d as directiveSubscribe } from "./dom-Bcg9ORcA.js";
3
+ import { p as createAttributesDirective, d as directiveSubscribe } from "./dom-DD1hAVZy.js";
4
4
  import { true$ } from "./utils/stores.js";
5
- import { b as typeNumberInRangeFactory, c as typeBoolean } from "./writables-e0tyaQpe.js";
6
- import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-DK0ADNTX.js";
5
+ import { b as typeNumberInRangeFactory, c as typeBoolean } from "./writables-Is1bF1Vt.js";
6
+ import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-CCxNtFNM.js";
7
7
  import { createWidgetFactory } from "./utils/widget.js";
8
8
  const toastDefaultConfig = {
9
9
  autoHide: true,
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  const tansu = require("@amadeus-it-group/tansu");
3
3
  const services_extendWidget = require("./services/extendWidget.cjs");
4
- const utils_directive = require("./dom-C2gi9OCP.cjs");
4
+ const utils_directive = require("./dom-Cm9_uROp.cjs");
5
5
  const utils_stores = require("./utils/stores.cjs");
6
- const utils_writables = require("./writables-DcGT98a7.cjs");
7
- const common = require("./common-D3QcdJ6S.cjs");
6
+ const utils_writables = require("./writables-Dt68gADJ.cjs");
7
+ const common = require("./common-B5jS-Ih_.cjs");
8
8
  const utils_widget = require("./utils/widget.cjs");
9
9
  const toastDefaultConfig = {
10
10
  autoHide: true,
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  const tansu = require("@amadeus-it-group/tansu");
3
3
  const services_navManager = require("./services/navManager.cjs");
4
- const utils_directive = require("./dom-C2gi9OCP.cjs");
4
+ const utils_directive = require("./dom-Cm9_uROp.cjs");
5
5
  const utils_func = require("./utils/func.cjs");
6
6
  const utils_stores = require("./utils/stores.cjs");
7
- const utils_writables = require("./writables-DcGT98a7.cjs");
7
+ const utils_writables = require("./writables-Dt68gADJ.cjs");
8
8
  const utils_widget = require("./utils/widget.cjs");
9
9
  function getTreeDefaultConfig() {
10
10
  return {
@@ -1,9 +1,9 @@
1
1
  import { writable, computed, readable } from "@amadeus-it-group/tansu";
2
2
  import { createNavManager } from "./services/navManager.js";
3
- import { n as mergeDirectives, p as createAttributesDirective, b as browserDirective, a as bindDirective } from "./dom-Bcg9ORcA.js";
3
+ import { n as mergeDirectives, p as createAttributesDirective, b as browserDirective, a as bindDirective } from "./dom-DD1hAVZy.js";
4
4
  import { noop } from "./utils/func.js";
5
5
  import { writablesForProps, stateStores, true$ } from "./utils/stores.js";
6
- import { g as typeFunction, i as typeArray, e as typeString } from "./writables-e0tyaQpe.js";
6
+ import { h as typeFunction, j as typeArray, e as typeString } from "./writables-Is1bF1Vt.js";
7
7
  import { createWidgetFactory } from "./utils/widget.js";
8
8
  function getTreeDefaultConfig() {
9
9
  return {
package/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const FACTORY_WIDGET_NAME = Symbol();
4
- const INVALID_VALUE = Symbol();
3
+ const FACTORY_WIDGET_NAME = /* @__PURE__ */ Symbol();
4
+ const INVALID_VALUE = /* @__PURE__ */ Symbol();
5
5
  exports.FACTORY_WIDGET_NAME = FACTORY_WIDGET_NAME;
6
6
  exports.INVALID_VALUE = INVALID_VALUE;
package/types.d.ts CHANGED
@@ -135,7 +135,7 @@ export interface SSRHTMLElement extends Pick<HTMLElement, 'setAttribute' | 'remo
135
135
  /**
136
136
  * Object allowing to manipulate the style of the element.
137
137
  */
138
- style: Partial<Record<StyleKey, StyleValue>>;
138
+ style: Partial<Record<StyleKeyCamelCase | StyleKeyKebabCase, StyleValue>> & Pick<HTMLElement['style'], 'setProperty' | 'removeProperty'>;
139
139
  }
140
140
  /**
141
141
  * Represents a directive function that can be applied to an SSRHTMLElement.
@@ -227,13 +227,31 @@ export type ConfigValidator<T extends object> = {
227
227
  * Represents a value that can be assigned to an attribute.
228
228
  */
229
229
  export type AttributeValue = string | number | boolean | undefined;
230
+ type CamelToKebab<S extends string> = S extends `${infer Head}${infer Tail}` ? `${Head extends Lowercase<Head> ? Head : `-${Lowercase<Head>}`}${CamelToKebab<Tail>}` : S;
230
231
  /**
231
- * Represents a key of the CSSStyleDeclaration interface, excluding certain properties and methods.
232
+ * Represents a key of the CSSStyleDeclaration interface (in camelCase), excluding certain properties and methods.
232
233
  *
233
234
  * This is useful for scenarios where you need to work with CSS properties directly without
234
235
  * dealing with the methods and other non-style properties of CSSStyleDeclaration.
235
236
  */
236
- export type StyleKey = Exclude<keyof CSSStyleDeclaration, 'length' | 'item' | 'parentRule' | 'getPropertyValue' | 'getPropertyPriority' | 'setProperty' | 'removeProperty' | typeof Symbol.iterator | number | 'cssText'>;
237
+ export type StyleKeyCamelCase = Exclude<keyof CSSStyleDeclaration, 'length' | 'item' | 'parentRule' | 'getPropertyValue' | 'getPropertyPriority' | 'setProperty' | 'removeProperty' | typeof Symbol.iterator | number | 'cssText'>;
238
+ /**
239
+ * Represents a key of the CSSStyleDeclaration interface, converted to kebab-case, excluding certain properties and methods.
240
+ *
241
+ * This is useful for scenarios where you need to work with CSS properties directly without
242
+ * dealing with the methods and other non-style properties of CSSStyleDeclaration.
243
+ */
244
+ export type StyleKeyKebabCase = CamelToKebab<StyleKeyCamelCase>;
245
+ /**
246
+ * Represents a CSS custom property key.
247
+ * CSS custom properties are defined using the `--` prefix.
248
+ */
249
+ export type StyleKeyCustomProperty = `--${string}`;
250
+ /**
251
+ * Represents a key that can be used for styling purposes.
252
+ * This includes camelCase style keys, kebab-case style keys, and CSS custom property keys.
253
+ */
254
+ export type StyleKey = StyleKeyCamelCase | StyleKeyKebabCase | StyleKeyCustomProperty;
237
255
  /**
238
256
  * Represents a value that can be used for styling purposes.
239
257
  * @remarks
@@ -258,3 +276,4 @@ export type Extends<T, U> = T extends U ? 1 : 0;
258
276
  * @returns `T` if `T` is or extends `SlotContent<any>`, otherwise `0`.
259
277
  */
260
278
  export type IsSlotContent<T> = Extends<T, SlotContent<any>> | Extends<SlotContent<any>, T> extends 1 ? T : 0;
279
+ export {};
package/types.js CHANGED
@@ -1,5 +1,5 @@
1
- const FACTORY_WIDGET_NAME = Symbol();
2
- const INVALID_VALUE = Symbol();
1
+ const FACTORY_WIDGET_NAME = /* @__PURE__ */ Symbol();
2
+ const INVALID_VALUE = /* @__PURE__ */ Symbol();
3
3
  export {
4
4
  FACTORY_WIDGET_NAME,
5
5
  INVALID_VALUE
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("@amadeus-it-group/tansu");
4
4
  require("esm-env");
5
- const utils_directive = require("../dom-C2gi9OCP.cjs");
5
+ const utils_directive = require("../dom-Cm9_uROp.cjs");
6
6
  require("./func.cjs");
7
7
  exports.attributesData = utils_directive.attributesData;
8
8
  exports.bindDirective = utils_directive.bindDirective;
@@ -1,5 +1,5 @@
1
1
  import type { ReadableSignal } from '@amadeus-it-group/tansu';
2
- import type { AttributeValue, Directive, DirectivesAndOptParam, SSRHTMLElement, StyleKey, StyleValue } from '../types';
2
+ import type { AttributeValue, Directive, DirectivesAndOptParam, SSRHTMLElement, StyleKey, StyleKeyCustomProperty, StyleKeyKebabCase, StyleValue } from '../types';
3
3
  import { type ClassValue } from 'clsx';
4
4
  /**
5
5
  * On a browser environment, returns true if the given element is an HTMLElement.
@@ -311,7 +311,7 @@ export declare const createAttributesDirective: <T = void>(propsFn: (arg: Readab
311
311
  export declare const attributesData: <T extends any[]>(...directives: DirectivesAndOptParam<T>) => {
312
312
  attributes: Record<string, string>;
313
313
  classNames: string[];
314
- style: Partial<Record<StyleKey, StyleValue>>;
314
+ style: Partial<Record<StyleKeyKebabCase | StyleKeyCustomProperty, StyleValue>>;
315
315
  };
316
316
  /**
317
317
  * Directive that takes as an argument a string, array or object containing CSS classes to be put on the HTML element.
@@ -1,6 +1,6 @@
1
1
  import "@amadeus-it-group/tansu";
2
2
  import "esm-env";
3
- import { q, a, c, b, s, p, h, l, j, f, g, k, t, d, e, i, m, n, o, r, u } from "../dom-Bcg9ORcA.js";
3
+ import { q, a, c, b, s, p, h, l, j, f, g, k, t, d, e, i, m, n, o, r, u } from "../dom-DD1hAVZy.js";
4
4
  import "./func.js";
5
5
  export {
6
6
  q as attributesData,
@@ -1,4 +1,4 @@
1
- import type { SSRHTMLElement } from '../../types';
1
+ import type { SSRHTMLElement, StyleKeyCustomProperty, StyleKeyKebabCase, StyleValue } from '../../types';
2
2
  /**
3
3
  * A unique symbol used to represent the attributes and style of an SSR (Server-Side Rendering) HTML element.
4
4
  * This symbol can be used as a key for storing or retrieving attributes and styles associated with an SSR HTML element.
@@ -9,3 +9,9 @@ export declare const ssrHTMLElementAttributesAndStyle: unique symbol;
9
9
  * @returns the created SSRHTMLElement
10
10
  */
11
11
  export declare const ssrHTMLElement: () => SSRHTMLElement;
12
+ /**
13
+ * Converts a style object to a CSS text string.
14
+ * @param style - The style object to convert.
15
+ * @returns The CSS text string representation of the style object.
16
+ */
17
+ export declare const cssTextFromObject: (style: Partial<Record<StyleKeyKebabCase | StyleKeyCustomProperty, StyleValue>>) => string;
package/utils/stores.cjs CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tansu = require("@amadeus-it-group/tansu");
4
4
  const types = require("../types.cjs");
5
5
  const utils_func = require("./func.cjs");
6
- const utils_directive = require("../dom-C2gi9OCP.cjs");
6
+ const utils_directive = require("../dom-Cm9_uROp.cjs");
7
7
  function createPatch(stores) {
8
8
  return function(storesValues) {
9
9
  tansu.batch(() => {
package/utils/stores.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readable, writable, asWritable, equal, batch, computed, asReadable, get, derived } from "@amadeus-it-group/tansu";
2
2
  import { INVALID_VALUE } from "../types.js";
3
3
  import { identity } from "./func.js";
4
- import { v as generateId } from "../dom-Bcg9ORcA.js";
4
+ import { v as generateId } from "../dom-DD1hAVZy.js";
5
5
  function createPatch(stores) {
6
6
  return function(storesValues) {
7
7
  batch(() => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const utils_writables = require("../writables-DcGT98a7.cjs");
3
+ const utils_writables = require("../writables-Dt68gADJ.cjs");
4
4
  require("../types.cjs");
5
5
  exports.createTypeEnum = utils_writables.createTypeEnum;
6
6
  exports.testToNormalizeValue = utils_writables.testToNormalizeValue;
@@ -11,5 +11,6 @@ exports.typeFunction = utils_writables.typeFunction;
11
11
  exports.typeHTMLElementOrNull = utils_writables.typeHTMLElementOrNull;
12
12
  exports.typeNumber = utils_writables.typeNumber;
13
13
  exports.typeNumberInRangeFactory = utils_writables.typeNumberInRangeFactory;
14
+ exports.typeNumberOrNull = utils_writables.typeNumberOrNull;
14
15
  exports.typeString = utils_writables.typeString;
15
16
  exports.typeStringOrNull = utils_writables.typeStringOrNull;
@@ -63,6 +63,13 @@ export declare const typeString: WritableWithDefaultOptions<string>;
63
63
  * with the `isString` validator.
64
64
  */
65
65
  export declare const typeStringOrNull: WritableWithDefaultOptions<string | null>;
66
+ /**
67
+ * A writable with default options that normalizes its value to a number or null.
68
+ *
69
+ * This writable uses a normalization function that allows null values and ensures
70
+ * the value is a boolean.
71
+ */
72
+ export declare const typeNumberOrNull: WritableWithDefaultOptions<number | null>;
66
73
  /**
67
74
  * A writable object that holds a function type with default options.
68
75
  */