@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.
Files changed (88) hide show
  1. package/{accordion-Lp-LEbZ2.cjs → accordion-DTQj-TQ1.cjs} +16 -18
  2. package/{accordion-BGv150k9.js → accordion-hVi2XRk-.js} +12 -14
  3. package/{alert-DJ2l7bcA.js → alert-BSixS_cz.js} +1 -1
  4. package/{alert-Bq101evB.cjs → alert-BrVkxOnA.cjs} +1 -1
  5. package/{common-DvPjK7SS.cjs → common-CcQOJ_hf.cjs} +5 -6
  6. package/{common-Banw3FYN.js → common-CuZAeECD.js} +2 -3
  7. package/components/accordion/accordion.d.ts +1 -1
  8. package/components/accordion/index.cjs +1 -1
  9. package/components/accordion/index.js +1 -1
  10. package/components/alert/common.d.ts +1 -1
  11. package/components/alert/index.cjs +1 -1
  12. package/components/alert/index.js +1 -1
  13. package/components/modal/index.cjs +1 -1
  14. package/components/modal/index.js +1 -1
  15. package/components/modal/modal.d.ts +2 -2
  16. package/components/pagination/index.cjs +1 -1
  17. package/components/pagination/index.js +1 -1
  18. package/components/progressbar/index.cjs +1 -1
  19. package/components/progressbar/index.js +1 -1
  20. package/components/rating/index.cjs +1 -1
  21. package/components/rating/index.js +1 -1
  22. package/components/select/index.cjs +1 -1
  23. package/components/select/index.js +1 -1
  24. package/components/slider/index.cjs +1 -1
  25. package/components/slider/index.js +1 -1
  26. package/components/slider/slider.d.ts +84 -9
  27. package/components/toast/index.cjs +1 -1
  28. package/components/toast/index.js +1 -1
  29. package/components/tree/index.cjs +1 -1
  30. package/components/tree/index.js +1 -1
  31. package/config.cjs +3 -3
  32. package/config.js +1 -1
  33. package/{directive-CKEccryv.js → dom-BB9jLllr.js} +115 -102
  34. package/{directive-DdlwGFtf.cjs → dom-CuBx1JPZ.cjs} +116 -103
  35. package/index.cjs +14 -11
  36. package/index.js +15 -12
  37. package/{modal-DDHcrykD.cjs → modal-B7bYoubx.cjs} +12 -14
  38. package/{modal-DP-4I7vf.js → modal-BQcw6bnM.js} +6 -8
  39. package/package.json +4 -1
  40. package/{pagination-CBysiPUs.cjs → pagination-5YARuB3V.cjs} +8 -8
  41. package/{pagination-DwDRot6q.js → pagination-BwaZEokc.js} +8 -8
  42. package/{progressbar-DghzCJ6_.cjs → progressbar-BpSrg4HG.cjs} +2 -2
  43. package/{progressbar-CGmNq0cS.js → progressbar-b_kXzGPc.js} +3 -3
  44. package/{promise-CY2U8bTP.js → promise-CBh_HbSK.js} +1 -1
  45. package/{promise-BMJ8qhA8.cjs → promise-CxCD3NYv.cjs} +5 -5
  46. package/{rating-Da38uaZz.js → rating-B1JLZgIR.js} +8 -8
  47. package/{rating-DlfOuwuX.cjs → rating-C8tn9xTO.cjs} +9 -9
  48. package/{select-CAEPqdz1.js → select-Bb2RAVs0.js} +20 -20
  49. package/{select-LBVhNdrd.cjs → select-D1pBz4CM.cjs} +21 -21
  50. package/services/floatingUI.cjs +2 -2
  51. package/services/floatingUI.js +2 -2
  52. package/services/focustrack.cjs +1 -1
  53. package/services/focustrack.js +1 -1
  54. package/services/intersection.cjs +2 -2
  55. package/services/intersection.js +1 -1
  56. package/services/matchMedia.cjs +3 -2
  57. package/services/matchMedia.js +3 -2
  58. package/services/navManager.cjs +1 -1
  59. package/services/navManager.js +1 -1
  60. package/services/portal.cjs +1 -1
  61. package/services/portal.js +1 -1
  62. package/services/resizeObserver.cjs +3 -3
  63. package/services/resizeObserver.js +2 -2
  64. package/services/siblingsInert.cjs +4 -4
  65. package/services/siblingsInert.js +2 -2
  66. package/services/transitions/baseTransitions.cjs +7 -7
  67. package/services/transitions/baseTransitions.js +3 -3
  68. package/services/transitions/collapse.cjs +1 -1
  69. package/services/transitions/collapse.js +1 -1
  70. package/services/transitions/cssTransitions.cjs +4 -4
  71. package/services/transitions/cssTransitions.js +3 -3
  72. package/services/transitions/simpleClassTransition.cjs +1 -1
  73. package/services/transitions/simpleClassTransition.js +1 -1
  74. package/{slider-1OSwok7u.cjs → slider-B2JFXDLt.cjs} +125 -24
  75. package/{slider-6LI4-f5s.js → slider-C-BSdQ0b.js} +126 -25
  76. package/{toast-CpvsibAI.js → toast-Bw2QSzBX.js} +9 -8
  77. package/{toast-D_uSrRZL.cjs → toast-CaIcB2sD.cjs} +8 -7
  78. package/{tree-Bb5KFqXp.cjs → tree-D4t2SOql.cjs} +7 -7
  79. package/{tree-B2Mr8b31.js → tree-DWv0zwFJ.js} +8 -8
  80. package/utils/directive.cjs +2 -3
  81. package/utils/directive.d.ts +7 -5
  82. package/utils/directive.js +2 -3
  83. package/{func-Qd3cD9a3.cjs → utils/func.cjs} +1 -0
  84. package/{func-DR0n-ShK.js → utils/func.js} +2 -2
  85. package/utils/stores.cjs +13 -3
  86. package/utils/stores.d.ts +9 -0
  87. package/utils/stores.js +12 -2
  88. /package/utils/{internal/func.d.ts → func.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
- import { computed, writable } from "@amadeus-it-group/tansu";
2
- import { j as createBrowserStoreDirective, k as mergeDirectives, n as createAttributesDirective } from "./directive-CKEccryv.js";
3
- import { n as noop } from "./func-DR0n-ShK.js";
4
- import { writablesForProps, bindableProp, stateStores } from "./utils/stores.js";
1
+ import { computed, writable, readable } from "@amadeus-it-group/tansu";
2
+ import { j as createBrowserStoreDirective, k as mergeDirectives, n as createAttributesDirective } from "./dom-BB9jLllr.js";
3
+ import { noop } from "./utils/func.js";
4
+ import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
5
5
  import { h as typeArray, a as typeNumber, b as typeNumberInRangeFactory, c as typeBoolean, f as typeFunction, e as typeString } from "./writables-DCiBdIBK.js";
6
6
  import { createResizeObserver } from "./services/resizeObserver.js";
7
7
  const decimalRegExp = /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
@@ -23,12 +23,16 @@ const defaultSliderConfig = {
23
23
  disabled: false,
24
24
  vertical: false,
25
25
  className: "",
26
- ariaLabelHandle: (value) => "" + value,
27
- ariaValueText: (value) => "" + value,
26
+ ariaLabel: () => "Value",
27
+ ariaLabelledBy: () => "",
28
+ ariaValueText: () => "",
28
29
  onValuesChange: noop,
29
30
  values: [0],
30
31
  showValueLabels: true,
31
32
  showMinMaxLabels: true,
33
+ showTicks: false,
34
+ showTickValues: true,
35
+ tickInterval: 0,
32
36
  rtl: false
33
37
  };
34
38
  function getSliderDefaultConfig() {
@@ -41,12 +45,16 @@ const configValidator = {
41
45
  readonly: typeBoolean,
42
46
  disabled: typeBoolean,
43
47
  vertical: typeBoolean,
44
- ariaLabelHandle: typeFunction,
48
+ ariaLabel: typeFunction,
49
+ ariaLabelledBy: typeFunction,
45
50
  ariaValueText: typeFunction,
46
51
  onValuesChange: typeFunction,
47
52
  values: typeArray,
48
53
  showValueLabels: typeBoolean,
49
54
  showMinMaxLabels: typeBoolean,
55
+ showTicks: typeBoolean,
56
+ showTickValues: typeBoolean,
57
+ tickInterval: typeNumberInRangeFactory(0, Infinity, { strict: true }),
50
58
  rtl: typeBoolean,
51
59
  className: typeString
52
60
  };
@@ -91,11 +99,15 @@ function createSlider(config) {
91
99
  stepSize$,
92
100
  rtl$,
93
101
  values$: _dirtyValues$,
94
- ariaLabelHandle$,
102
+ ariaLabel$,
103
+ ariaLabelledBy$,
95
104
  ariaValueText$,
96
105
  onValuesChange$,
97
106
  showValueLabels$,
98
107
  showMinMaxLabels$,
108
+ showTicks$,
109
+ showTickValues$,
110
+ tickInterval$,
99
111
  ...stateProps
100
112
  },
101
113
  patch
@@ -177,12 +189,13 @@ function createSlider(config) {
177
189
  }).sort((a, b) => a.value - b.value);
178
190
  });
179
191
  const sortedHandles$ = computed(() => {
180
- const ariaLabelHandle = ariaLabelHandle$(), ariaValueText = ariaValueText$();
192
+ const ariaLabelHandle = ariaLabel$(), ariaValueText = ariaValueText$(), ariaLabelledBy = ariaLabelledBy$();
181
193
  return _sortedHandlesValues$().map((sortedValue, index) => {
182
194
  return {
183
195
  ...sortedValue,
184
- ariaLabel: ariaLabelHandle(sortedValue.value, index, sortedValue.id),
185
- ariaValueText: ariaValueText(sortedValue.value, index, sortedValue.id)
196
+ ariaLabel: ariaLabelledBy(index) ? void 0 : ariaLabelHandle(index),
197
+ ariaLabelledBy: ariaLabelledBy(index) || void 0,
198
+ ariaValueText: ariaValueText(sortedValue.value, index) || void 0
186
199
  };
187
200
  });
188
201
  });
@@ -190,8 +203,9 @@ function createSlider(config) {
190
203
  const sortedValuesPercent$ = computed(() => [...valuesPercent$()].sort((a, b) => a - b));
191
204
  const minLabelWidth$ = computed(() => minLabelDomRect$().width / sliderDomRectSize$() * 100);
192
205
  const maxLabelWidth$ = computed(() => maxLabelDomRect$().width / sliderDomRectSize$() * 100);
206
+ const adjustedShowValueLabels$ = computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
193
207
  const minValueLabelDisplay$ = computed(() => {
194
- if (!showMinMaxLabels$()) {
208
+ if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
195
209
  return false;
196
210
  } else if (!showValueLabels$()) {
197
211
  return true;
@@ -200,7 +214,7 @@ function createSlider(config) {
200
214
  return rtl$() ? !valuesPercent$().some((percent2) => 100 - percent2 > 100 - minLabelWidth - 1) : !valuesPercent$().some((percent2) => percent2 < minLabelWidth + 1);
201
215
  });
202
216
  const maxValueLabelDisplay$ = computed(() => {
203
- if (!showMinMaxLabels$()) {
217
+ if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
204
218
  return false;
205
219
  } else if (!showValueLabels$()) {
206
220
  return true;
@@ -260,9 +274,48 @@ function createSlider(config) {
260
274
  }).slice(0, sortedValuesPercent.length - 1);
261
275
  }
262
276
  });
263
- const percentCompute = (value) => {
277
+ const computeTicks$ = computed(() => {
278
+ if (!showTicks$()) {
279
+ return [];
280
+ }
281
+ const vertical = vertical$();
264
282
  const min = min$();
265
- return (value - min) * 100 / (max$() - min);
283
+ const max = max$();
284
+ const rtl = rtl$();
285
+ const showTickValues = showTickValues$();
286
+ const tickInterval = tickInterval$() || stepSize$();
287
+ const tickArray = [];
288
+ const intStepSize = _intStepSize$();
289
+ const decimalPrecision = _decimalPrecision$();
290
+ const positionCompute = (position) => {
291
+ return !!rtl !== !!vertical ? 100 - position : position;
292
+ };
293
+ for (let step = min; step < max; step += tickInterval) {
294
+ const cleanValue = computeCleanValue(step, min, max, intStepSize, decimalPrecision);
295
+ const stepPercent = percentCompute(cleanValue);
296
+ tickArray.push({ position: positionCompute(stepPercent), selected: false, value: cleanValue, displayLabel: showTickValues });
297
+ }
298
+ tickArray.push({ position: positionCompute(100), selected: false, value: max, displayLabel: showTickValues });
299
+ return tickArray;
300
+ });
301
+ const ticks$ = computed(() => {
302
+ const sortedValues = sortedValues$();
303
+ const isTickSelected = (value) => {
304
+ const isMultiHandle = sortedValues.length > 1;
305
+ const currentMax = isMultiHandle ? sortedValues[sortedValues.length - 1] : sortedValues[0];
306
+ const currentMin = isMultiHandle ? sortedValues[0] : 0;
307
+ return value <= currentMax && value >= currentMin;
308
+ };
309
+ return computeTicks$().map((tick) => {
310
+ return {
311
+ ...tick,
312
+ selected: isTickSelected(tick.value)
313
+ };
314
+ });
315
+ });
316
+ const percentCompute = (value) => {
317
+ const min = min$(), max = max$();
318
+ return (value - min) * 100 / (max - min);
266
319
  };
267
320
  const getClosestSliderHandle = (clickedPercent) => {
268
321
  const values = values$();
@@ -270,9 +323,11 @@ function createSlider(config) {
270
323
  return 0;
271
324
  }
272
325
  const sortedValues = sortedValues$();
273
- const closestBigger = sortedValues.find((sv) => sv > clickedPercent * 100);
326
+ const closestBigger = sortedValues.find((sv) => percentCompute(sv) > clickedPercent * 100);
274
327
  const closestBiggerIndex = closestBigger ? sortedValues.indexOf(closestBigger) : sortedValues.length - 1;
275
- const midPoint = sortedValues[closestBiggerIndex - 1] + (sortedValues[closestBiggerIndex] - sortedValues[closestBiggerIndex - 1]) / 2;
328
+ const midPoint = percentCompute(
329
+ sortedValues[closestBiggerIndex - 1] + (sortedValues[closestBiggerIndex] - sortedValues[closestBiggerIndex - 1]) / 2
330
+ );
276
331
  const closestValue = sortedValues[clickedPercent * 100 <= midPoint ? closestBiggerIndex - 1 : closestBiggerIndex];
277
332
  return values.indexOf(closestValue);
278
333
  };
@@ -297,7 +352,7 @@ function createSlider(config) {
297
352
  class: stateProps.className$
298
353
  },
299
354
  classNames: {
300
- "au-slider": true,
355
+ "au-slider": true$,
301
356
  "au-slider-vertical": vertical$,
302
357
  "au-slider-horizontal": horizontal$,
303
358
  disabled: disabled$
@@ -311,6 +366,9 @@ function createSlider(config) {
311
366
  "au-slider-label-min": horizontal$,
312
367
  "au-slider-rtl": rtl$,
313
368
  invisible: computed(() => !minValueLabelDisplay$())
369
+ },
370
+ attributes: {
371
+ "aria-hidden": readable("true")
314
372
  }
315
373
  }));
316
374
  const maxLabelDirective = createAttributesDirective(() => ({
@@ -321,6 +379,9 @@ function createSlider(config) {
321
379
  "au-slider-label-max": horizontal$,
322
380
  "au-slider-rtl": rtl$,
323
381
  invisible: computed(() => !maxValueLabelDisplay$())
382
+ },
383
+ attributes: {
384
+ "aria-hidden": readable("true")
324
385
  }
325
386
  }));
326
387
  const handleEventsDirective = createAttributesDirective((handleContext$) => ({
@@ -365,7 +426,6 @@ function createSlider(config) {
365
426
  return;
366
427
  }
367
428
  event.preventDefault();
368
- event.stopPropagation();
369
429
  }
370
430
  },
371
431
  mousedown: (event) => {
@@ -394,7 +454,6 @@ function createSlider(config) {
394
454
  }
395
455
  },
396
456
  touchstart: (event) => {
397
- event.preventDefault();
398
457
  const handleDrag = (e) => {
399
458
  e.preventDefault();
400
459
  const newCoord = vertical$() ? e.touches[0].clientY : e.touches[0].clientX;
@@ -444,9 +503,11 @@ function createSlider(config) {
444
503
  combinedLabelPositionTop$,
445
504
  progressDisplayOptions$,
446
505
  handleDisplayOptions$,
447
- showValueLabels$,
506
+ showValueLabels$: adjustedShowValueLabels$,
448
507
  showMinMaxLabels$,
508
+ showTicks$,
449
509
  rtl$,
510
+ ticks$,
450
511
  ...stateProps
451
512
  }),
452
513
  patch,
@@ -463,7 +524,7 @@ function createSlider(config) {
463
524
  height: computed(() => percent(progressContext$().option.height))
464
525
  },
465
526
  classNames: {
466
- "au-slider-progress": true
527
+ "au-slider-progress": true$
467
528
  }
468
529
  })),
469
530
  clickableAreaDirective: createAttributesDirective(() => ({
@@ -474,7 +535,8 @@ function createSlider(config) {
474
535
  },
475
536
  classNames: {
476
537
  "au-slider-clickable-area": horizontal$,
477
- "au-slider-clickable-area-vertical": vertical$
538
+ "au-slider-clickable-area-vertical": vertical$,
539
+ "au-slider-clickable-area-with-ticks": computed(() => showTicks$() && tickInterval$() === 0)
478
540
  }
479
541
  })),
480
542
  handleEventsDirective,
@@ -482,12 +544,13 @@ function createSlider(config) {
482
544
  handleEventsDirective,
483
545
  createAttributesDirective((handleContext$) => ({
484
546
  attributes: {
485
- role: "slider",
547
+ role: readable("slider"),
486
548
  "aria-valuemin": min$,
487
549
  "aria-valuemax": max$,
488
550
  "aria-valuenow": computed(() => handleContext$().item.value),
489
551
  "aria-valuetext": computed(() => handleContext$().item.ariaValueText),
490
552
  "aria-label": computed(() => handleContext$().item.ariaLabel),
553
+ "aria-labelledBy": computed(() => handleContext$().item.ariaLabelledBy),
491
554
  "aria-orientation": computed(() => vertical$() ? "vertical" : void 0),
492
555
  "aria-disabled": computed(() => disabled$() ? "true" : void 0),
493
556
  disabled: disabled$,
@@ -498,7 +561,7 @@ function createSlider(config) {
498
561
  top: computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
499
562
  },
500
563
  classNames: {
501
- "au-slider-handle": true,
564
+ "au-slider-handle": true$,
502
565
  "au-slider-handle-vertical": vertical$,
503
566
  "au-slider-handle-horizontal": horizontal$
504
567
  }
@@ -516,6 +579,9 @@ function createSlider(config) {
516
579
  styles: {
517
580
  left: computed(() => percent(combinedLabelPositionLeft$())),
518
581
  top: computed(() => percent(combinedLabelPositionTop$()))
582
+ },
583
+ attributes: {
584
+ "aria-hidden": readable("true")
519
585
  }
520
586
  })),
521
587
  handleLabelDisplayDirective: createAttributesDirective((labelDisplayContext$) => ({
@@ -528,6 +594,41 @@ function createSlider(config) {
528
594
  styles: {
529
595
  left: computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
530
596
  top: computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top))
597
+ },
598
+ attributes: {
599
+ "aria-hidden": readable("true")
600
+ }
601
+ })),
602
+ tickDirective: createAttributesDirective((tickContext$) => ({
603
+ classNames: {
604
+ "au-slider-tick": true$,
605
+ "au-slider-tick-horizontal": horizontal$,
606
+ "au-slider-tick-vertical": vertical$
607
+ },
608
+ styles: {
609
+ left: computed(() => vertical$() ? null : percent(tickContext$().tick.position)),
610
+ top: computed(() => vertical$() ? percent(tickContext$().tick.position) : null)
611
+ },
612
+ events: {
613
+ click: (event) => {
614
+ adjustCoordinate(vertical$() ? event.clientY : event.clientX);
615
+ }
616
+ },
617
+ attributes: {
618
+ "aria-hidden": readable("true")
619
+ }
620
+ })),
621
+ tickLabelDirective: createAttributesDirective((tickContext$) => ({
622
+ classNames: {
623
+ "au-slider-tick-label": true$,
624
+ "au-slider-tick-label-vertical": vertical$
625
+ },
626
+ styles: {
627
+ left: computed(() => vertical$() ? null : percent(tickContext$().tick.position)),
628
+ top: computed(() => vertical$() ? percent(tickContext$().tick.position) : null)
629
+ },
630
+ attributes: {
631
+ "aria-hidden": readable("true")
531
632
  }
532
633
  }))
533
634
  }
@@ -1,8 +1,9 @@
1
- import { computed } from "@amadeus-it-group/tansu";
1
+ import { computed, readable } from "@amadeus-it-group/tansu";
2
2
  import { extendWidgetProps } from "./services/extendWidget.js";
3
- import { d as directiveSubscribe, n as createAttributesDirective } from "./directive-CKEccryv.js";
3
+ import { d as directiveSubscribe, n as createAttributesDirective } from "./dom-BB9jLllr.js";
4
+ import { true$ } from "./utils/stores.js";
4
5
  import { c as typeBoolean, b as typeNumberInRangeFactory } from "./writables-DCiBdIBK.js";
5
- import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-Banw3FYN.js";
6
+ import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-CuZAeECD.js";
6
7
  const toastDefaultConfig = {
7
8
  autoHide: true,
8
9
  delay: 5e3
@@ -29,18 +30,18 @@ function createToast(config) {
29
30
  });
30
31
  const bodyDirective = createAttributesDirective(() => ({
31
32
  attributes: {
32
- role: "alert",
33
- "aria-atomic": "true",
33
+ role: readable("alert"),
34
+ "aria-atomic": readable("true"),
34
35
  class: computed(() => extendedAlert.stores.className$())
35
36
  },
36
37
  classNames: {
37
- "au-toast": true,
38
- toast: true
38
+ "au-toast": true$,
39
+ toast: true$
39
40
  }
40
41
  }));
41
42
  const closeButtonDirective = createAttributesDirective(() => ({
42
43
  attributes: {
43
- type: "button",
44
+ type: readable("button"),
44
45
  "aria-label": computed(() => extendedAlert.stores.ariaCloseButtonLabel$())
45
46
  },
46
47
  events: {
@@ -1,9 +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("./directive-DdlwGFtf.cjs");
4
+ const utils_directive = require("./dom-CuBx1JPZ.cjs");
5
+ const utils_stores = require("./utils/stores.cjs");
5
6
  const utils_writables = require("./writables-BPAJvaL_.cjs");
6
- const common = require("./common-DvPjK7SS.cjs");
7
+ const common = require("./common-CcQOJ_hf.cjs");
7
8
  const toastDefaultConfig = {
8
9
  autoHide: true,
9
10
  delay: 5e3
@@ -30,18 +31,18 @@ function createToast(config) {
30
31
  });
31
32
  const bodyDirective = utils_directive.createAttributesDirective(() => ({
32
33
  attributes: {
33
- role: "alert",
34
- "aria-atomic": "true",
34
+ role: tansu.readable("alert"),
35
+ "aria-atomic": tansu.readable("true"),
35
36
  class: tansu.computed(() => extendedAlert.stores.className$())
36
37
  },
37
38
  classNames: {
38
- "au-toast": true,
39
- toast: true
39
+ "au-toast": utils_stores.true$,
40
+ toast: utils_stores.true$
40
41
  }
41
42
  }));
42
43
  const closeButtonDirective = utils_directive.createAttributesDirective(() => ({
43
44
  attributes: {
44
- type: "button",
45
+ type: tansu.readable("button"),
45
46
  "aria-label": tansu.computed(() => extendedAlert.stores.ariaCloseButtonLabel$())
46
47
  },
47
48
  events: {
@@ -1,8 +1,8 @@
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("./directive-DdlwGFtf.cjs");
5
- const func = require("./func-Qd3cD9a3.cjs");
4
+ const utils_directive = require("./dom-CuBx1JPZ.cjs");
5
+ const utils_func = require("./utils/func.cjs");
6
6
  const utils_stores = require("./utils/stores.cjs");
7
7
  const utils_writables = require("./writables-BPAJvaL_.cjs");
8
8
  function getTreeDefaultConfig() {
@@ -13,7 +13,7 @@ function getTreeDefaultConfig() {
13
13
  const defaultTreeConfig = {
14
14
  className: "",
15
15
  nodes: [],
16
- onExpandToggle: func.noop,
16
+ onExpandToggle: utils_func.noop,
17
17
  navSelector: (node) => node.querySelectorAll("button"),
18
18
  ariaLabelToggleFn: (label) => `Toggle ${label}`
19
19
  };
@@ -177,10 +177,10 @@ function createTree(config) {
177
177
  const { item } = treeItemContext$();
178
178
  return item === _lastFocusedTreeItem$() ? "0" : "-1";
179
179
  }),
180
- type: "button"
180
+ type: tansu.readable("button")
181
181
  },
182
182
  classNames: {
183
- "au-tree-expand-icon": true,
183
+ "au-tree-expand-icon": utils_stores.true$,
184
184
  "au-tree-expand-icon-expanded": tansu.computed(() => {
185
185
  _toggleChange$();
186
186
  const { item } = treeItemContext$();
@@ -206,8 +206,8 @@ function createTree(config) {
206
206
  itemToggleDirective: utils_directive.mergeDirectives(treeItemElementDirective, itemToggleAttributesDirective),
207
207
  itemAttributesDirective: utils_directive.createAttributesDirective((treeItemContext$) => ({
208
208
  attributes: {
209
- role: "treeitem",
210
- "aria-selected": "false",
209
+ role: tansu.readable("treeitem"),
210
+ "aria-selected": tansu.readable("false"),
211
211
  // TODO: adapt aria-selected to the actual selected state
212
212
  "aria-expanded": tansu.computed(() => {
213
213
  var _a;
@@ -1,8 +1,8 @@
1
- import { writable, computed } from "@amadeus-it-group/tansu";
1
+ import { writable, computed, readable } from "@amadeus-it-group/tansu";
2
2
  import { createNavManager } from "./services/navManager.js";
3
- import { a as bindDirective, k as mergeDirectives, n as createAttributesDirective, b as browserDirective } from "./directive-CKEccryv.js";
4
- import { n as noop } from "./func-DR0n-ShK.js";
5
- import { writablesForProps, stateStores } from "./utils/stores.js";
3
+ import { a as bindDirective, k as mergeDirectives, n as createAttributesDirective, b as browserDirective } from "./dom-BB9jLllr.js";
4
+ import { noop } from "./utils/func.js";
5
+ import { writablesForProps, stateStores, true$ } from "./utils/stores.js";
6
6
  import { e as typeString, h as typeArray, f as typeFunction } from "./writables-DCiBdIBK.js";
7
7
  function getTreeDefaultConfig() {
8
8
  return {
@@ -176,10 +176,10 @@ function createTree(config) {
176
176
  const { item } = treeItemContext$();
177
177
  return item === _lastFocusedTreeItem$() ? "0" : "-1";
178
178
  }),
179
- type: "button"
179
+ type: readable("button")
180
180
  },
181
181
  classNames: {
182
- "au-tree-expand-icon": true,
182
+ "au-tree-expand-icon": true$,
183
183
  "au-tree-expand-icon-expanded": computed(() => {
184
184
  _toggleChange$();
185
185
  const { item } = treeItemContext$();
@@ -205,8 +205,8 @@ function createTree(config) {
205
205
  itemToggleDirective: mergeDirectives(treeItemElementDirective, itemToggleAttributesDirective),
206
206
  itemAttributesDirective: createAttributesDirective((treeItemContext$) => ({
207
207
  attributes: {
208
- role: "treeitem",
209
- "aria-selected": "false",
208
+ role: readable("treeitem"),
209
+ "aria-selected": readable("false"),
210
210
  // TODO: adapt aria-selected to the actual selected state
211
211
  "aria-expanded": computed(() => {
212
212
  var _a;
@@ -2,9 +2,8 @@
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("../directive-DdlwGFtf.cjs");
6
- require("../func-Qd3cD9a3.cjs");
7
- require("./stores.cjs");
5
+ const utils_directive = require("../dom-CuBx1JPZ.cjs");
6
+ require("./func.cjs");
8
7
  exports.attributesData = utils_directive.attributesData;
9
8
  exports.bindDirective = utils_directive.bindDirective;
10
9
  exports.bindDirectiveNoArg = utils_directive.bindDirectiveNoArg;
@@ -1,5 +1,6 @@
1
1
  import type { ReadableSignal } from '@amadeus-it-group/tansu';
2
2
  import type { AttributeValue, Directive, DirectivesAndOptParam, SSRHTMLElement, StyleKey, StyleValue } from '../types';
3
+ import { type ClassValue } from 'clsx';
3
4
  /**
4
5
  * On a browser environment, returns true if the given element is an HTMLElement.
5
6
  * On a server environment, always returns false.
@@ -221,19 +222,19 @@ xw
221
222
  * @remarks
222
223
  * The `style` attribute must be added separately.
223
224
  */
224
- attributes?: Record<string, AttributeValue | ReadableSignal<AttributeValue>>;
225
+ attributes?: Record<string, ReadableSignal<AttributeValue>>;
225
226
  /**
226
227
  * Styles to be added to an HTML element.
227
228
  * @remarks
228
229
  * Key-value pairs where keys are CSS style properties and values are style values.
229
230
  */
230
- styles?: Partial<Record<StyleKey, StyleValue | ReadableSignal<StyleValue>>>;
231
+ styles?: Partial<Record<StyleKey, ReadableSignal<StyleValue>>>;
231
232
  /**
232
233
  * Class names to be added to an HTML element.
233
234
  * @remarks
234
235
  * Key-value pairs where keys are class names and values indicate whether the class should be added (true) or removed (false).
235
236
  */
236
- classNames?: Record<string, boolean | ReadableSignal<boolean>>;
237
+ classNames?: Record<string, ReadableSignal<boolean>>;
237
238
  }
238
239
  /**
239
240
  * Creates a directive that binds attributes, styles, class names, and events to a DOM node.
@@ -266,9 +267,10 @@ export declare const attributesData: <T extends any[]>(...directives: Directives
266
267
  style: Partial<Record<StyleKey, StyleValue>>;
267
268
  };
268
269
  /**
269
- * Directive that takes as an argument a string containing CSS classes to be put on the HTML element.
270
+ * Directive that takes as an argument a string, array or object containing CSS classes to be put on the HTML element.
271
+ * The class attribute is computed using the clsx library.
270
272
  */
271
- export declare const classDirective: Directive<string>;
273
+ export declare const classDirective: Directive<ClassValue>;
272
274
  /**
273
275
  * Combines multiple directives into a single attributes object.
274
276
  *
@@ -1,8 +1,7 @@
1
1
  import "@amadeus-it-group/tansu";
2
2
  import "esm-env";
3
- import { o, a, c, b, p, n, g, j, f, h, q, d, e, i, m, k, l, r, s } from "../directive-CKEccryv.js";
4
- import "../func-DR0n-ShK.js";
5
- import "./stores.js";
3
+ import { o, a, c, b, p, n, g, j, f, h, q, d, e, i, m, k, l, r, s } from "../dom-BB9jLllr.js";
4
+ import "./func.js";
6
5
  export {
7
6
  o as attributesData,
8
7
  a as bindDirective,
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
3
  const noop = () => {
3
4
  };
4
5
  const identity = (x) => x;
@@ -2,6 +2,6 @@ const noop = () => {
2
2
  };
3
3
  const identity = (x) => x;
4
4
  export {
5
- identity as i,
6
- noop as n
5
+ identity,
6
+ noop
7
7
  };
package/utils/stores.cjs CHANGED
@@ -2,7 +2,8 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tansu = require("@amadeus-it-group/tansu");
4
4
  const types = require("../types.cjs");
5
- const func = require("../func-Qd3cD9a3.cjs");
5
+ const utils_func = require("./func.cjs");
6
+ const utils_directive = require("../dom-CuBx1JPZ.cjs");
6
7
  function createPatch(stores) {
7
8
  return function(storesValues) {
8
9
  tansu.batch(() => {
@@ -30,7 +31,7 @@ function findChangedProperties(obj1, obj2) {
30
31
  return hasUpdate ? changedValues : null;
31
32
  }
32
33
  function writableWithDefault(defValue, config$ = tansu.readable(void 0), options = {}, own$ = tansu.writable(void 0)) {
33
- const { normalizeValue = func.identity, equal = Object.is } = options;
34
+ const { normalizeValue = utils_func.identity, equal = Object.is } = options;
34
35
  const getDefValue = () => defValue;
35
36
  const callNormalizeValue = (value, defValue2 = getDefValue) => {
36
37
  const normalizedValue = value === void 0 ? void 0 : normalizeValue(value);
@@ -138,7 +139,7 @@ const bindableDerived = (onChange$, stores, adjustValue = (arg) => arg[0], equal
138
139
  stores[0].set.bind(stores[0])
139
140
  );
140
141
  };
141
- const bindableProp = (store$, onChange$, adjustValue = func.identity, equal = tansu.equal) => tansu.asWritable(
142
+ const bindableProp = (store$, onChange$, adjustValue = utils_func.identity, equal = tansu.equal) => tansu.asWritable(
142
143
  tansu.computed(() => adjustValue(store$()), { equal }),
143
144
  (newValue) => {
144
145
  const adjustedValue = adjustValue(newValue);
@@ -148,16 +149,25 @@ const bindableProp = (store$, onChange$, adjustValue = func.identity, equal = ta
148
149
  }
149
150
  }
150
151
  );
152
+ function idWithDefault(id$) {
153
+ const autoId$ = tansu.computed(() => utils_directive.generateId());
154
+ return tansu.computed(() => id$() || autoId$());
155
+ }
156
+ const true$ = tansu.readable(true);
157
+ const false$ = tansu.readable(false);
151
158
  exports.bindableDerived = bindableDerived;
152
159
  exports.bindableProp = bindableProp;
153
160
  exports.createPatch = createPatch;
161
+ exports.false$ = false$;
154
162
  exports.findChangedProperties = findChangedProperties;
163
+ exports.idWithDefault = idWithDefault;
155
164
  exports.isStore = isStore;
156
165
  exports.mergeConfigStores = mergeConfigStores;
157
166
  exports.normalizeConfigStores = normalizeConfigStores;
158
167
  exports.stateStores = stateStores;
159
168
  exports.toReadableStore = toReadableStore;
160
169
  exports.toWritableStore = toWritableStore;
170
+ exports.true$ = true$;
161
171
  exports.writableWithDefault = writableWithDefault;
162
172
  exports.writablesForProps = writablesForProps;
163
173
  exports.writablesWithDefault = writablesWithDefault;
package/utils/stores.d.ts CHANGED
@@ -213,3 +213,12 @@ export declare const bindableDerived: <T, U extends [WritableSignal<T>, ...Store
213
213
  * @returns A writable signal that synchronizes with the provided store and triggers the onChange callback when updated.
214
214
  */
215
215
  export declare const bindableProp: <T>(store$: WritableSignal<T, T | undefined>, onChange$: ReadableSignal<(newValue: T) => void>, adjustValue?: (value: T) => T, equal?: (a: T, b: T) => boolean) => WritableSignal<T>;
216
+ /**
217
+ * Wraps an id store in a computed so that undefined and empty values are replaced by a generated id.
218
+ *
219
+ * @param id$ - the id store to use
220
+ * @returns the id store with a default generation if the id is not provided
221
+ */
222
+ export declare function idWithDefault(id$: ReadableSignal<string>): ReadableSignal<string>;
223
+ export declare const true$: ReadableSignal<true>;
224
+ export declare const false$: ReadableSignal<false>;
package/utils/stores.js CHANGED
@@ -1,6 +1,7 @@
1
- import { batch, computed, asWritable, readable, writable, asReadable, get, derived, equal } from "@amadeus-it-group/tansu";
1
+ import { readable, batch, computed, asWritable, writable, asReadable, get, derived, equal } from "@amadeus-it-group/tansu";
2
2
  import { INVALID_VALUE } from "../types.js";
3
- import { i as identity } from "../func-DR0n-ShK.js";
3
+ import { identity } from "./func.js";
4
+ import { t as generateId } from "../dom-BB9jLllr.js";
4
5
  function createPatch(stores) {
5
6
  return function(storesValues) {
6
7
  batch(() => {
@@ -146,17 +147,26 @@ const bindableProp = (store$, onChange$, adjustValue = identity, equal$1 = equal
146
147
  }
147
148
  }
148
149
  );
150
+ function idWithDefault(id$) {
151
+ const autoId$ = computed(() => generateId());
152
+ return computed(() => id$() || autoId$());
153
+ }
154
+ const true$ = readable(true);
155
+ const false$ = readable(false);
149
156
  export {
150
157
  bindableDerived,
151
158
  bindableProp,
152
159
  createPatch,
160
+ false$,
153
161
  findChangedProperties,
162
+ idWithDefault,
154
163
  isStore,
155
164
  mergeConfigStores,
156
165
  normalizeConfigStores,
157
166
  stateStores,
158
167
  toReadableStore,
159
168
  toWritableStore,
169
+ true$,
160
170
  writableWithDefault,
161
171
  writablesForProps,
162
172
  writablesWithDefault
File without changes