@agnos-ui/core 0.7.1 → 0.8.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{accordion-CJxsVQtv.cjs → accordion-DTQj-TQ1.cjs} +16 -18
- package/{accordion-D0oG0wQD.js → accordion-OTiJtxDi.js} +12 -14
- package/{alert-Bq101evB.cjs → alert-BrVkxOnA.cjs} +1 -1
- package/{alert-DJ2l7bcA.js → alert-DH-mO6WX.js} +1 -1
- package/{common-Banw3FYN.js → common-Bffx1jJO.js} +3 -4
- package/{common-DvPjK7SS.cjs → common-CcQOJ_hf.cjs} +5 -6
- package/components/accordion/accordion.d.ts +1 -1
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/common.d.ts +1 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/modal/index.cjs +1 -1
- package/components/modal/index.js +1 -1
- package/components/modal/modal.d.ts +2 -2
- package/components/pagination/index.cjs +1 -1
- package/components/pagination/index.js +1 -1
- package/components/progressbar/index.cjs +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/rating/index.cjs +1 -1
- package/components/rating/index.js +1 -1
- package/components/select/index.cjs +1 -1
- package/components/select/index.js +1 -1
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider.d.ts +64 -0
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +1 -1
- package/components/tree/index.cjs +1 -1
- package/components/tree/index.js +1 -1
- package/config.cjs +3 -3
- package/config.js +1 -1
- package/{directive-BtOvPrmt.cjs → dom-CuBx1JPZ.cjs} +100 -102
- package/{directive-DrDJkTS5.js → dom-gfxqXJpK.js} +99 -101
- package/index.cjs +14 -11
- package/index.js +15 -12
- package/{modal-Qr4sHBFG.js → modal-85Sw8xuV.js} +7 -9
- package/{modal-DtzgRa5j.cjs → modal-B7bYoubx.cjs} +12 -14
- package/package.json +1 -1
- package/{pagination-BigQwc8I.js → pagination-4g3N8ktf.js} +9 -9
- package/{pagination-ETXueztI.cjs → pagination-5YARuB3V.cjs} +8 -8
- package/{progressbar-arTsTc5c.js → progressbar-BoJsBPH1.js} +4 -4
- package/{progressbar-BSgE9udi.cjs → progressbar-BpSrg4HG.cjs} +2 -2
- package/{promise-BMJ8qhA8.cjs → promise-CxCD3NYv.cjs} +5 -5
- package/{promise-CY2U8bTP.js → promise-XSP94FjG.js} +2 -2
- package/{rating-CGv-KO_P.js → rating-B3xktzOf.js} +9 -9
- package/{rating-BV6lk1US.cjs → rating-C8tn9xTO.cjs} +9 -9
- package/{select-C5DIoZrO.js → select-C-77MJfC.js} +20 -20
- package/{select-C6gwSGbr.cjs → select-D1pBz4CM.cjs} +21 -21
- package/services/floatingUI.cjs +2 -2
- package/services/floatingUI.js +2 -2
- package/services/focustrack.cjs +1 -1
- package/services/focustrack.js +1 -1
- package/services/intersection.cjs +2 -2
- package/services/intersection.js +1 -1
- package/services/matchMedia.cjs +3 -2
- package/services/matchMedia.js +3 -2
- package/services/navManager.cjs +1 -1
- package/services/navManager.js +1 -1
- package/services/portal.cjs +1 -1
- package/services/portal.js +1 -1
- package/services/resizeObserver.cjs +3 -3
- package/services/resizeObserver.js +2 -2
- package/services/siblingsInert.cjs +4 -4
- package/services/siblingsInert.js +2 -2
- package/services/transitions/baseTransitions.cjs +7 -7
- package/services/transitions/baseTransitions.js +4 -4
- package/services/transitions/collapse.cjs +1 -1
- package/services/transitions/collapse.js +1 -1
- package/services/transitions/cssTransitions.cjs +4 -4
- package/services/transitions/cssTransitions.js +3 -3
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-CkYsilwM.cjs → slider-B2JFXDLt.cjs} +109 -14
- package/{slider-DtQrcvim.js → slider-Cs69pziL.js} +111 -16
- package/{toast-4f-ZdK1Y.js → toast-4HGIz3Bu.js} +10 -9
- package/{toast-Vku2ZxoN.cjs → toast-CaIcB2sD.cjs} +8 -7
- package/{tree-DVsZP8ze.js → tree-C_goOyCv.js} +9 -9
- package/{tree-BaSMyGyv.cjs → tree-D4t2SOql.cjs} +7 -7
- package/utils/directive.cjs +2 -3
- package/utils/directive.d.ts +3 -3
- package/utils/directive.js +2 -3
- package/{func-Qd3cD9a3.cjs → utils/func.cjs} +1 -0
- package/{func-DR0n-ShK.js → utils/func.js} +2 -2
- package/utils/stores.cjs +13 -3
- package/utils/stores.d.ts +9 -0
- package/utils/stores.js +12 -2
- /package/utils/{internal/func.d.ts → func.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { computed, writable } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { j as createBrowserStoreDirective, k as mergeDirectives, n as createAttributesDirective } from "./
|
|
3
|
-
import {
|
|
4
|
-
import { writablesForProps, bindableProp, stateStores } from "./utils/stores.js";
|
|
5
|
-
import { h as typeArray,
|
|
1
|
+
import { computed, writable, readable } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { j as createBrowserStoreDirective, k as mergeDirectives, n as createAttributesDirective } from "./dom-gfxqXJpK.js";
|
|
3
|
+
import { noop } from "./utils/func.js";
|
|
4
|
+
import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
|
|
5
|
+
import { h as typeArray, e as typeString, c as typeBoolean, b as typeNumberInRangeFactory, f as typeFunction, a as typeNumber } from "./writables-DCiBdIBK.js";
|
|
6
6
|
import { createResizeObserver } from "./services/resizeObserver.js";
|
|
7
7
|
const decimalRegExp = /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
|
|
8
8
|
function getDecimalPrecision(number) {
|
|
@@ -30,6 +30,9 @@ const defaultSliderConfig = {
|
|
|
30
30
|
values: [0],
|
|
31
31
|
showValueLabels: true,
|
|
32
32
|
showMinMaxLabels: true,
|
|
33
|
+
showTicks: false,
|
|
34
|
+
showTickValues: true,
|
|
35
|
+
tickInterval: 0,
|
|
33
36
|
rtl: false
|
|
34
37
|
};
|
|
35
38
|
function getSliderDefaultConfig() {
|
|
@@ -49,6 +52,9 @@ const configValidator = {
|
|
|
49
52
|
values: typeArray,
|
|
50
53
|
showValueLabels: typeBoolean,
|
|
51
54
|
showMinMaxLabels: typeBoolean,
|
|
55
|
+
showTicks: typeBoolean,
|
|
56
|
+
showTickValues: typeBoolean,
|
|
57
|
+
tickInterval: typeNumberInRangeFactory(0, Infinity, { strict: true }),
|
|
52
58
|
rtl: typeBoolean,
|
|
53
59
|
className: typeString
|
|
54
60
|
};
|
|
@@ -99,6 +105,9 @@ function createSlider(config) {
|
|
|
99
105
|
onValuesChange$,
|
|
100
106
|
showValueLabels$,
|
|
101
107
|
showMinMaxLabels$,
|
|
108
|
+
showTicks$,
|
|
109
|
+
showTickValues$,
|
|
110
|
+
tickInterval$,
|
|
102
111
|
...stateProps
|
|
103
112
|
},
|
|
104
113
|
patch
|
|
@@ -194,8 +203,9 @@ function createSlider(config) {
|
|
|
194
203
|
const sortedValuesPercent$ = computed(() => [...valuesPercent$()].sort((a, b) => a - b));
|
|
195
204
|
const minLabelWidth$ = computed(() => minLabelDomRect$().width / sliderDomRectSize$() * 100);
|
|
196
205
|
const maxLabelWidth$ = computed(() => maxLabelDomRect$().width / sliderDomRectSize$() * 100);
|
|
206
|
+
const adjustedShowValueLabels$ = computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
|
|
197
207
|
const minValueLabelDisplay$ = computed(() => {
|
|
198
|
-
if (!showMinMaxLabels$()) {
|
|
208
|
+
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
199
209
|
return false;
|
|
200
210
|
} else if (!showValueLabels$()) {
|
|
201
211
|
return true;
|
|
@@ -204,7 +214,7 @@ function createSlider(config) {
|
|
|
204
214
|
return rtl$() ? !valuesPercent$().some((percent2) => 100 - percent2 > 100 - minLabelWidth - 1) : !valuesPercent$().some((percent2) => percent2 < minLabelWidth + 1);
|
|
205
215
|
});
|
|
206
216
|
const maxValueLabelDisplay$ = computed(() => {
|
|
207
|
-
if (!showMinMaxLabels$()) {
|
|
217
|
+
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
208
218
|
return false;
|
|
209
219
|
} else if (!showValueLabels$()) {
|
|
210
220
|
return true;
|
|
@@ -264,9 +274,48 @@ function createSlider(config) {
|
|
|
264
274
|
}).slice(0, sortedValuesPercent.length - 1);
|
|
265
275
|
}
|
|
266
276
|
});
|
|
267
|
-
const
|
|
277
|
+
const computeTicks$ = computed(() => {
|
|
278
|
+
if (!showTicks$()) {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
const vertical = vertical$();
|
|
268
282
|
const min = min$();
|
|
269
|
-
|
|
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);
|
|
270
319
|
};
|
|
271
320
|
const getClosestSliderHandle = (clickedPercent) => {
|
|
272
321
|
const values = values$();
|
|
@@ -303,7 +352,7 @@ function createSlider(config) {
|
|
|
303
352
|
class: stateProps.className$
|
|
304
353
|
},
|
|
305
354
|
classNames: {
|
|
306
|
-
"au-slider": true
|
|
355
|
+
"au-slider": true$,
|
|
307
356
|
"au-slider-vertical": vertical$,
|
|
308
357
|
"au-slider-horizontal": horizontal$,
|
|
309
358
|
disabled: disabled$
|
|
@@ -317,6 +366,9 @@ function createSlider(config) {
|
|
|
317
366
|
"au-slider-label-min": horizontal$,
|
|
318
367
|
"au-slider-rtl": rtl$,
|
|
319
368
|
invisible: computed(() => !minValueLabelDisplay$())
|
|
369
|
+
},
|
|
370
|
+
attributes: {
|
|
371
|
+
"aria-hidden": readable("true")
|
|
320
372
|
}
|
|
321
373
|
}));
|
|
322
374
|
const maxLabelDirective = createAttributesDirective(() => ({
|
|
@@ -327,6 +379,9 @@ function createSlider(config) {
|
|
|
327
379
|
"au-slider-label-max": horizontal$,
|
|
328
380
|
"au-slider-rtl": rtl$,
|
|
329
381
|
invisible: computed(() => !maxValueLabelDisplay$())
|
|
382
|
+
},
|
|
383
|
+
attributes: {
|
|
384
|
+
"aria-hidden": readable("true")
|
|
330
385
|
}
|
|
331
386
|
}));
|
|
332
387
|
const handleEventsDirective = createAttributesDirective((handleContext$) => ({
|
|
@@ -399,7 +454,6 @@ function createSlider(config) {
|
|
|
399
454
|
}
|
|
400
455
|
},
|
|
401
456
|
touchstart: (event) => {
|
|
402
|
-
event.preventDefault();
|
|
403
457
|
const handleDrag = (e) => {
|
|
404
458
|
e.preventDefault();
|
|
405
459
|
const newCoord = vertical$() ? e.touches[0].clientY : e.touches[0].clientX;
|
|
@@ -449,9 +503,11 @@ function createSlider(config) {
|
|
|
449
503
|
combinedLabelPositionTop$,
|
|
450
504
|
progressDisplayOptions$,
|
|
451
505
|
handleDisplayOptions$,
|
|
452
|
-
showValueLabels$,
|
|
506
|
+
showValueLabels$: adjustedShowValueLabels$,
|
|
453
507
|
showMinMaxLabels$,
|
|
508
|
+
showTicks$,
|
|
454
509
|
rtl$,
|
|
510
|
+
ticks$,
|
|
455
511
|
...stateProps
|
|
456
512
|
}),
|
|
457
513
|
patch,
|
|
@@ -468,7 +524,7 @@ function createSlider(config) {
|
|
|
468
524
|
height: computed(() => percent(progressContext$().option.height))
|
|
469
525
|
},
|
|
470
526
|
classNames: {
|
|
471
|
-
"au-slider-progress": true
|
|
527
|
+
"au-slider-progress": true$
|
|
472
528
|
}
|
|
473
529
|
})),
|
|
474
530
|
clickableAreaDirective: createAttributesDirective(() => ({
|
|
@@ -479,7 +535,8 @@ function createSlider(config) {
|
|
|
479
535
|
},
|
|
480
536
|
classNames: {
|
|
481
537
|
"au-slider-clickable-area": horizontal$,
|
|
482
|
-
"au-slider-clickable-area-vertical": vertical
|
|
538
|
+
"au-slider-clickable-area-vertical": vertical$,
|
|
539
|
+
"au-slider-clickable-area-with-ticks": computed(() => showTicks$() && tickInterval$() === 0)
|
|
483
540
|
}
|
|
484
541
|
})),
|
|
485
542
|
handleEventsDirective,
|
|
@@ -487,7 +544,7 @@ function createSlider(config) {
|
|
|
487
544
|
handleEventsDirective,
|
|
488
545
|
createAttributesDirective((handleContext$) => ({
|
|
489
546
|
attributes: {
|
|
490
|
-
role: "slider",
|
|
547
|
+
role: readable("slider"),
|
|
491
548
|
"aria-valuemin": min$,
|
|
492
549
|
"aria-valuemax": max$,
|
|
493
550
|
"aria-valuenow": computed(() => handleContext$().item.value),
|
|
@@ -504,7 +561,7 @@ function createSlider(config) {
|
|
|
504
561
|
top: computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
|
|
505
562
|
},
|
|
506
563
|
classNames: {
|
|
507
|
-
"au-slider-handle": true
|
|
564
|
+
"au-slider-handle": true$,
|
|
508
565
|
"au-slider-handle-vertical": vertical$,
|
|
509
566
|
"au-slider-handle-horizontal": horizontal$
|
|
510
567
|
}
|
|
@@ -522,6 +579,9 @@ function createSlider(config) {
|
|
|
522
579
|
styles: {
|
|
523
580
|
left: computed(() => percent(combinedLabelPositionLeft$())),
|
|
524
581
|
top: computed(() => percent(combinedLabelPositionTop$()))
|
|
582
|
+
},
|
|
583
|
+
attributes: {
|
|
584
|
+
"aria-hidden": readable("true")
|
|
525
585
|
}
|
|
526
586
|
})),
|
|
527
587
|
handleLabelDisplayDirective: createAttributesDirective((labelDisplayContext$) => ({
|
|
@@ -534,6 +594,41 @@ function createSlider(config) {
|
|
|
534
594
|
styles: {
|
|
535
595
|
left: computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
|
|
536
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")
|
|
537
632
|
}
|
|
538
633
|
}))
|
|
539
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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { n as createAttributesDirective, d as directiveSubscribe } from "./dom-gfxqXJpK.js";
|
|
4
|
+
import { true$ } from "./utils/stores.js";
|
|
5
|
+
import { b as typeNumberInRangeFactory, c as typeBoolean } from "./writables-DCiBdIBK.js";
|
|
6
|
+
import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-Bffx1jJO.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("./
|
|
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-
|
|
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,9 +1,9 @@
|
|
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
import { writablesForProps, stateStores } from "./utils/stores.js";
|
|
6
|
-
import {
|
|
3
|
+
import { k as mergeDirectives, n as createAttributesDirective, b as browserDirective, a as bindDirective } from "./dom-gfxqXJpK.js";
|
|
4
|
+
import { noop } from "./utils/func.js";
|
|
5
|
+
import { writablesForProps, stateStores, true$ } from "./utils/stores.js";
|
|
6
|
+
import { f as typeFunction, h as typeArray, e as typeString } from "./writables-DCiBdIBK.js";
|
|
7
7
|
function getTreeDefaultConfig() {
|
|
8
8
|
return {
|
|
9
9
|
...defaultTreeConfig
|
|
@@ -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;
|
|
@@ -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("./
|
|
5
|
-
const
|
|
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:
|
|
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;
|
package/utils/directive.cjs
CHANGED
|
@@ -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("../
|
|
6
|
-
require("
|
|
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;
|
package/utils/directive.d.ts
CHANGED
|
@@ -222,19 +222,19 @@ xw
|
|
|
222
222
|
* @remarks
|
|
223
223
|
* The `style` attribute must be added separately.
|
|
224
224
|
*/
|
|
225
|
-
attributes?: Record<string,
|
|
225
|
+
attributes?: Record<string, ReadableSignal<AttributeValue>>;
|
|
226
226
|
/**
|
|
227
227
|
* Styles to be added to an HTML element.
|
|
228
228
|
* @remarks
|
|
229
229
|
* Key-value pairs where keys are CSS style properties and values are style values.
|
|
230
230
|
*/
|
|
231
|
-
styles?: Partial<Record<StyleKey,
|
|
231
|
+
styles?: Partial<Record<StyleKey, ReadableSignal<StyleValue>>>;
|
|
232
232
|
/**
|
|
233
233
|
* Class names to be added to an HTML element.
|
|
234
234
|
* @remarks
|
|
235
235
|
* Key-value pairs where keys are class names and values indicate whether the class should be added (true) or removed (false).
|
|
236
236
|
*/
|
|
237
|
-
classNames?: Record<string,
|
|
237
|
+
classNames?: Record<string, ReadableSignal<boolean>>;
|
|
238
238
|
}
|
|
239
239
|
/**
|
|
240
240
|
* Creates a directive that binds attributes, styles, class names, and events to a DOM node.
|
package/utils/directive.js
CHANGED
|
@@ -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 "../
|
|
4
|
-
import "
|
|
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-gfxqXJpK.js";
|
|
4
|
+
import "./func.js";
|
|
6
5
|
export {
|
|
7
6
|
o as attributesData,
|
|
8
7
|
a as bindDirective,
|
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
|
|
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 =
|
|
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 =
|
|
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 {
|
|
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
|
-
import {
|
|
3
|
+
import { identity } from "./func.js";
|
|
4
|
+
import { t as generateId } from "../dom-gfxqXJpK.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
|