@agnos-ui/core 0.4.3 → 0.5.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.
- package/README.md +2 -2
- package/{accordion-BnaSamoQ.js → accordion-BGv150k9.js} +10 -13
- package/{accordion-DmPT0O0j.cjs → accordion-Lp-LEbZ2.cjs} +10 -13
- package/{alert-CEFbEgvG.cjs → alert-Bq101evB.cjs} +1 -1
- package/{alert-DdGuK__c.js → alert-DJ2l7bcA.js} +1 -1
- package/{common-CO5b5G_J.js → common-Banw3FYN.js} +15 -14
- package/{common-nxv_hKNE.cjs → common-DvPjK7SS.cjs} +15 -14
- package/components/accordion/accordion.d.ts +35 -8
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/alert.d.ts +16 -1
- package/components/alert/common.d.ts +19 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/commonProps.d.ts +3 -0
- package/components/modal/index.cjs +1 -1
- package/components/modal/index.js +1 -1
- package/components/modal/modal.d.ts +3 -135
- package/components/pagination/index.cjs +1 -1
- package/components/pagination/index.js +1 -1
- package/components/pagination/pagination.d.ts +30 -217
- package/components/progressbar/index.cjs +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/progressbar/progressbar.d.ts +13 -3
- package/components/rating/index.cjs +1 -1
- package/components/rating/index.js +1 -1
- package/components/rating/rating.d.ts +26 -115
- package/components/select/index.cjs +1 -1
- package/components/select/index.js +1 -1
- package/components/select/select.d.ts +21 -148
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider.d.ts +31 -126
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +1 -1
- package/components/toast/toast.d.ts +16 -1
- package/config.d.ts +17 -1
- package/{directive-3-8yr-ZK.js → directive-CKEccryv.js} +11 -5
- package/{directive-j-xRk-h3.cjs → directive-DdlwGFtf.cjs} +11 -5
- package/index.cjs +13 -13
- package/index.js +15 -15
- package/{modal-D4d8sy85.cjs → modal-DDHcrykD.cjs} +10 -21
- package/{modal-CeTI4jxI.js → modal-DP-4I7vf.js} +11 -22
- package/package.json +6 -5
- package/{pagination-B9WFv70F.cjs → pagination-CBysiPUs.cjs} +23 -35
- package/{pagination-BpPHKQsH.js → pagination-DwDRot6q.js} +23 -35
- package/{progressbar-BybOg5FE.js → progressbar-CGmNq0cS.js} +3 -4
- package/{progressbar-DXCMeJvL.cjs → progressbar-DghzCJ6_.cjs} +3 -4
- package/{rating-D6Tv_4Vx.js → rating-Da38uaZz.js} +61 -54
- package/{rating-C2Y95r50.cjs → rating-DlfOuwuX.cjs} +61 -54
- package/{select-jUrt_lSn.js → select-CAEPqdz1.js} +92 -72
- package/{select-BBiF-m3N.cjs → select-LBVhNdrd.cjs} +92 -72
- package/services/extendWidget.d.ts +37 -4
- package/services/floatingUI.cjs +3 -2
- package/services/floatingUI.d.ts +28 -27
- package/services/floatingUI.js +3 -2
- package/services/focustrack.cjs +1 -1
- package/services/focustrack.d.ts +21 -0
- package/services/focustrack.js +1 -1
- package/services/hash.d.ts +2 -1
- package/services/intersection.cjs +1 -1
- package/services/intersection.d.ts +9 -13
- package/services/intersection.js +1 -1
- package/services/matchMedia.cjs +1 -1
- package/services/matchMedia.d.ts +2 -1
- package/services/matchMedia.js +1 -1
- package/services/navManager.cjs +1 -1
- package/services/navManager.d.ts +85 -41
- package/services/navManager.js +1 -1
- package/services/portal.cjs +1 -1
- package/services/portal.d.ts +3 -0
- package/services/portal.js +1 -1
- package/services/resizeObserver.cjs +2 -2
- package/services/resizeObserver.d.ts +2 -6
- package/services/resizeObserver.js +2 -2
- package/services/siblingsInert.cjs +3 -3
- package/services/siblingsInert.d.ts +3 -5
- package/services/siblingsInert.js +3 -3
- package/services/transitions/baseTransitions.cjs +4 -5
- package/services/transitions/baseTransitions.d.ts +21 -4
- package/services/transitions/baseTransitions.js +4 -5
- package/services/transitions/collapse.cjs +1 -1
- package/services/transitions/collapse.d.ts +6 -0
- package/services/transitions/collapse.js +1 -1
- package/services/transitions/cssTransitions.cjs +1 -1
- package/services/transitions/cssTransitions.d.ts +3 -0
- package/services/transitions/cssTransitions.js +1 -1
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.d.ts +9 -2
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-ByDkbyr1.js → slider-DYrwS7Mv.js} +118 -116
- package/{slider-BdsZpxJr.cjs → slider-DlOAawbZ.cjs} +118 -116
- package/{toast-BzxextBQ.js → toast-CpvsibAI.js} +3 -3
- package/{toast-Dy3ck2cM.cjs → toast-D_uSrRZL.cjs} +3 -3
- package/types.cjs +0 -8
- package/types.d.ts +151 -19
- package/types.js +1 -9
- package/utils/directive.cjs +1 -1
- package/utils/directive.d.ts +81 -32
- package/utils/directive.js +1 -1
- package/utils/internal/checks.d.ts +6 -0
- package/utils/internal/dom.d.ts +5 -5
- package/utils/internal/promise.d.ts +9 -0
- package/utils/internal/sort.d.ts +2 -2
- package/utils/internal/ssrHTMLElement.d.ts +4 -0
- package/utils/stores.cjs +1 -1
- package/utils/stores.d.ts +80 -42
- package/utils/stores.js +1 -1
- package/utils/writables.cjs +2 -1
- package/utils/writables.d.ts +52 -3
- package/utils/writables.js +2 -1
- package/{writables-D46sFgGK.cjs → writables-BPAJvaL_.cjs} +9 -0
- package/{writables-DoU_XYTX.js → writables-DCiBdIBK.js} +11 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed, writable } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { j as createBrowserStoreDirective, k as mergeDirectives, n as createAttributesDirective } from "./directive-
|
|
2
|
+
import { j as createBrowserStoreDirective, k as mergeDirectives, n as createAttributesDirective } from "./directive-CKEccryv.js";
|
|
3
3
|
import { n as noop } from "./func-DR0n-ShK.js";
|
|
4
4
|
import { writablesForProps, bindableProp, stateStores } from "./utils/stores.js";
|
|
5
|
-
import { h as typeArray, a as typeNumber, b as typeNumberInRangeFactory, c as typeBoolean, f as typeFunction } from "./writables-
|
|
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+))?$/;
|
|
8
8
|
function getDecimalPrecision(number) {
|
|
@@ -47,7 +47,8 @@ const configValidator = {
|
|
|
47
47
|
values: typeArray,
|
|
48
48
|
showValueLabels: typeBoolean,
|
|
49
49
|
showMinMaxLabels: typeBoolean,
|
|
50
|
-
rtl: typeBoolean
|
|
50
|
+
rtl: typeBoolean,
|
|
51
|
+
className: typeString
|
|
51
52
|
};
|
|
52
53
|
const computeCleanValue = (value, min, max, intStepSize, decimalPrecision) => {
|
|
53
54
|
const magnitude = Math.pow(10, decimalPrecision);
|
|
@@ -209,7 +210,7 @@ function createSlider(config) {
|
|
|
209
210
|
});
|
|
210
211
|
const combinedLabelDisplay$ = computed(() => {
|
|
211
212
|
const values = values$();
|
|
212
|
-
return values.length == 2 && Math.abs(values[0] - values[1]) < 10;
|
|
213
|
+
return values.length == 2 && Math.abs(values[0] - values[1]) * 100 / (max$() - min$()) < 10;
|
|
213
214
|
});
|
|
214
215
|
const interactive$ = computed(() => !disabled$() && !readonly$());
|
|
215
216
|
const combinedLabelPositionLeft$ = computed(() => {
|
|
@@ -224,7 +225,7 @@ function createSlider(config) {
|
|
|
224
225
|
});
|
|
225
226
|
const handleDisplayOptions$ = computed(() => {
|
|
226
227
|
const vertical = vertical$(), rtl = rtl$();
|
|
227
|
-
return valuesPercent$().map((vp
|
|
228
|
+
return valuesPercent$().map((vp) => {
|
|
228
229
|
return {
|
|
229
230
|
left: rtl ? vertical ? null : 100 - vp : vertical ? null : vp,
|
|
230
231
|
top: rtl ? vertical ? vp : null : vertical ? 100 - vp : null
|
|
@@ -320,113 +321,10 @@ function createSlider(config) {
|
|
|
320
321
|
invisible: computed(() => !maxValueLabelDisplay$())
|
|
321
322
|
}
|
|
322
323
|
}));
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
stepSize$,
|
|
328
|
-
values$,
|
|
329
|
-
sortedValues$,
|
|
330
|
-
sortedHandles$,
|
|
331
|
-
minValueLabelDisplay$,
|
|
332
|
-
maxValueLabelDisplay$,
|
|
333
|
-
combinedLabelDisplay$,
|
|
334
|
-
interactive$,
|
|
335
|
-
combinedLabelPositionLeft$,
|
|
336
|
-
combinedLabelPositionTop$,
|
|
337
|
-
progressDisplayOptions$,
|
|
338
|
-
handleDisplayOptions$,
|
|
339
|
-
showValueLabels$,
|
|
340
|
-
showMinMaxLabels$,
|
|
341
|
-
rtl$,
|
|
342
|
-
...stateProps
|
|
343
|
-
}),
|
|
344
|
-
patch,
|
|
345
|
-
api: {},
|
|
346
|
-
directives: {
|
|
347
|
-
sliderDirective: mergeDirectives(sliderDirective, resizeDirective, containerDirective),
|
|
348
|
-
progressDisplayDirective: createAttributesDirective((progressContext$) => ({
|
|
349
|
-
styles: {
|
|
350
|
-
left: computed(() => percent(progressContext$().option.left)),
|
|
351
|
-
right: computed(() => percent(progressContext$().option.right)),
|
|
352
|
-
top: computed(() => percent(progressContext$().option.top)),
|
|
353
|
-
bottom: computed(() => percent(progressContext$().option.bottom)),
|
|
354
|
-
width: computed(() => percent(progressContext$().option.width)),
|
|
355
|
-
height: computed(() => percent(progressContext$().option.height))
|
|
356
|
-
},
|
|
357
|
-
classNames: {
|
|
358
|
-
"au-slider-progress": true
|
|
359
|
-
}
|
|
360
|
-
})),
|
|
361
|
-
clickableAreaDirective: createAttributesDirective(() => ({
|
|
362
|
-
events: {
|
|
363
|
-
click: (event) => widget.actions.click(event)
|
|
364
|
-
},
|
|
365
|
-
classNames: {
|
|
366
|
-
"au-slider-clickable-area": horizontal$,
|
|
367
|
-
"au-slider-clickable-area-vertical": vertical$
|
|
368
|
-
}
|
|
369
|
-
})),
|
|
370
|
-
handleDirective: createAttributesDirective((handleContext$) => ({
|
|
371
|
-
events: {
|
|
372
|
-
keydown: (event) => widget.actions.keydown(event, handleContext$().item.id),
|
|
373
|
-
mousedown: (event) => widget.actions.mouseDown(event, handleContext$().item.id),
|
|
374
|
-
touchstart: (event) => widget.actions.touchStart(event, handleContext$().item.id)
|
|
375
|
-
},
|
|
376
|
-
attributes: {
|
|
377
|
-
role: "slider",
|
|
378
|
-
"aria-valuemin": min$,
|
|
379
|
-
"aria-valuemax": max$,
|
|
380
|
-
"aria-valuenow": computed(() => handleContext$().item.value),
|
|
381
|
-
"aria-valuetext": computed(() => handleContext$().item.ariaValueText),
|
|
382
|
-
"aria-label": computed(() => handleContext$().item.ariaLabel),
|
|
383
|
-
"aria-orientation": computed(() => vertical$() ? "vertical" : void 0),
|
|
384
|
-
"aria-disabled": computed(() => disabled$() ? "true" : void 0),
|
|
385
|
-
disabled: disabled$,
|
|
386
|
-
"aria-readonly": computed(() => readonly$() ? "true" : void 0)
|
|
387
|
-
},
|
|
388
|
-
styles: {
|
|
389
|
-
left: computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].left)),
|
|
390
|
-
top: computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
|
|
391
|
-
},
|
|
392
|
-
classNames: {
|
|
393
|
-
"au-slider-handle": true,
|
|
394
|
-
"au-slider-handle-vertical": vertical$,
|
|
395
|
-
"au-slider-handle-horizontal": horizontal$
|
|
396
|
-
}
|
|
397
|
-
})),
|
|
398
|
-
minLabelDirective: mergeDirectives(minLabelDomDirective, minLabelDirective),
|
|
399
|
-
maxLabelDirective: mergeDirectives(maxLabelDomDirective, maxLabelDirective),
|
|
400
|
-
combinedHandleLabelDisplayDirective: createAttributesDirective(() => ({
|
|
401
|
-
classNames: {
|
|
402
|
-
"au-slider-label-vertical": vertical$,
|
|
403
|
-
"au-slider-label-vertical-now": vertical$,
|
|
404
|
-
"au-slider-label": horizontal$,
|
|
405
|
-
"au-slider-label-now": horizontal$
|
|
406
|
-
},
|
|
407
|
-
styles: {
|
|
408
|
-
left: computed(() => percent(combinedLabelPositionLeft$())),
|
|
409
|
-
top: computed(() => percent(combinedLabelPositionTop$()))
|
|
410
|
-
}
|
|
411
|
-
})),
|
|
412
|
-
handleLabelDisplayDirective: createAttributesDirective((labelDisplayContext$) => ({
|
|
413
|
-
classNames: {
|
|
414
|
-
"au-slider-label-vertical": vertical$,
|
|
415
|
-
"au-slider-label-vertical-now": vertical$,
|
|
416
|
-
"au-slider-label": horizontal$,
|
|
417
|
-
"au-slider-label-now": horizontal$
|
|
418
|
-
},
|
|
419
|
-
styles: {
|
|
420
|
-
left: computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
|
|
421
|
-
top: computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top))
|
|
422
|
-
}
|
|
423
|
-
}))
|
|
424
|
-
},
|
|
425
|
-
actions: {
|
|
426
|
-
click(event) {
|
|
427
|
-
adjustCoordinate(vertical$() ? event.clientY : event.clientX);
|
|
428
|
-
},
|
|
429
|
-
keydown(event, handleIndex) {
|
|
324
|
+
const handleEventsDirective = createAttributesDirective((handleContext$) => ({
|
|
325
|
+
events: {
|
|
326
|
+
keydown: (event) => {
|
|
327
|
+
const handleIndex = handleContext$().item.id;
|
|
430
328
|
const { key } = event;
|
|
431
329
|
const rtl = rtl$(), stepSize = stepSize$(), min = min$(), max = max$(), vertical = vertical$();
|
|
432
330
|
if (interactive$()) {
|
|
@@ -468,7 +366,7 @@ function createSlider(config) {
|
|
|
468
366
|
event.stopPropagation();
|
|
469
367
|
}
|
|
470
368
|
},
|
|
471
|
-
|
|
369
|
+
mousedown: (event) => {
|
|
472
370
|
event.preventDefault();
|
|
473
371
|
const currentTarget = event.target;
|
|
474
372
|
const handleDrag = (e) => {
|
|
@@ -477,7 +375,7 @@ function createSlider(config) {
|
|
|
477
375
|
currentTarget.focus();
|
|
478
376
|
if (_prevCoordinate !== newCoord) {
|
|
479
377
|
_prevCoordinate = newCoord;
|
|
480
|
-
adjustCoordinate(newCoord,
|
|
378
|
+
adjustCoordinate(newCoord, handleContext$().item.id);
|
|
481
379
|
}
|
|
482
380
|
};
|
|
483
381
|
if (interactive$()) {
|
|
@@ -493,7 +391,7 @@ function createSlider(config) {
|
|
|
493
391
|
);
|
|
494
392
|
}
|
|
495
393
|
},
|
|
496
|
-
|
|
394
|
+
touchstart: (event) => {
|
|
497
395
|
event.preventDefault();
|
|
498
396
|
const handleDrag = (e) => {
|
|
499
397
|
e.preventDefault();
|
|
@@ -501,7 +399,7 @@ function createSlider(config) {
|
|
|
501
399
|
event.target.focus();
|
|
502
400
|
if (_prevCoordinate !== newCoord) {
|
|
503
401
|
_prevCoordinate = newCoord;
|
|
504
|
-
adjustCoordinate(newCoord,
|
|
402
|
+
adjustCoordinate(newCoord, handleContext$().item.id);
|
|
505
403
|
}
|
|
506
404
|
};
|
|
507
405
|
if (interactive$()) {
|
|
@@ -527,6 +425,110 @@ function createSlider(config) {
|
|
|
527
425
|
}
|
|
528
426
|
}
|
|
529
427
|
}
|
|
428
|
+
}));
|
|
429
|
+
const widget = {
|
|
430
|
+
...stateStores({
|
|
431
|
+
min$,
|
|
432
|
+
max$,
|
|
433
|
+
stepSize$,
|
|
434
|
+
values$,
|
|
435
|
+
sortedValues$,
|
|
436
|
+
sortedHandles$,
|
|
437
|
+
minValueLabelDisplay$,
|
|
438
|
+
maxValueLabelDisplay$,
|
|
439
|
+
combinedLabelDisplay$,
|
|
440
|
+
interactive$,
|
|
441
|
+
combinedLabelPositionLeft$,
|
|
442
|
+
combinedLabelPositionTop$,
|
|
443
|
+
progressDisplayOptions$,
|
|
444
|
+
handleDisplayOptions$,
|
|
445
|
+
showValueLabels$,
|
|
446
|
+
showMinMaxLabels$,
|
|
447
|
+
rtl$,
|
|
448
|
+
...stateProps
|
|
449
|
+
}),
|
|
450
|
+
patch,
|
|
451
|
+
api: {},
|
|
452
|
+
directives: {
|
|
453
|
+
sliderDirective: mergeDirectives(sliderDirective, resizeDirective, containerDirective),
|
|
454
|
+
progressDisplayDirective: createAttributesDirective((progressContext$) => ({
|
|
455
|
+
styles: {
|
|
456
|
+
left: computed(() => percent(progressContext$().option.left)),
|
|
457
|
+
right: computed(() => percent(progressContext$().option.right)),
|
|
458
|
+
top: computed(() => percent(progressContext$().option.top)),
|
|
459
|
+
bottom: computed(() => percent(progressContext$().option.bottom)),
|
|
460
|
+
width: computed(() => percent(progressContext$().option.width)),
|
|
461
|
+
height: computed(() => percent(progressContext$().option.height))
|
|
462
|
+
},
|
|
463
|
+
classNames: {
|
|
464
|
+
"au-slider-progress": true
|
|
465
|
+
}
|
|
466
|
+
})),
|
|
467
|
+
clickableAreaDirective: createAttributesDirective(() => ({
|
|
468
|
+
events: {
|
|
469
|
+
click: (event) => {
|
|
470
|
+
adjustCoordinate(vertical$() ? event.clientY : event.clientX);
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
classNames: {
|
|
474
|
+
"au-slider-clickable-area": horizontal$,
|
|
475
|
+
"au-slider-clickable-area-vertical": vertical$
|
|
476
|
+
}
|
|
477
|
+
})),
|
|
478
|
+
handleEventsDirective,
|
|
479
|
+
handleDirective: mergeDirectives(
|
|
480
|
+
handleEventsDirective,
|
|
481
|
+
createAttributesDirective((handleContext$) => ({
|
|
482
|
+
attributes: {
|
|
483
|
+
role: "slider",
|
|
484
|
+
"aria-valuemin": min$,
|
|
485
|
+
"aria-valuemax": max$,
|
|
486
|
+
"aria-valuenow": computed(() => handleContext$().item.value),
|
|
487
|
+
"aria-valuetext": computed(() => handleContext$().item.ariaValueText),
|
|
488
|
+
"aria-label": computed(() => handleContext$().item.ariaLabel),
|
|
489
|
+
"aria-orientation": computed(() => vertical$() ? "vertical" : void 0),
|
|
490
|
+
"aria-disabled": computed(() => disabled$() ? "true" : void 0),
|
|
491
|
+
disabled: disabled$,
|
|
492
|
+
"aria-readonly": computed(() => readonly$() ? "true" : void 0)
|
|
493
|
+
},
|
|
494
|
+
styles: {
|
|
495
|
+
left: computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].left)),
|
|
496
|
+
top: computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
|
|
497
|
+
},
|
|
498
|
+
classNames: {
|
|
499
|
+
"au-slider-handle": true,
|
|
500
|
+
"au-slider-handle-vertical": vertical$,
|
|
501
|
+
"au-slider-handle-horizontal": horizontal$
|
|
502
|
+
}
|
|
503
|
+
}))
|
|
504
|
+
),
|
|
505
|
+
minLabelDirective: mergeDirectives(minLabelDomDirective, minLabelDirective),
|
|
506
|
+
maxLabelDirective: mergeDirectives(maxLabelDomDirective, maxLabelDirective),
|
|
507
|
+
combinedHandleLabelDisplayDirective: createAttributesDirective(() => ({
|
|
508
|
+
classNames: {
|
|
509
|
+
"au-slider-label-vertical": vertical$,
|
|
510
|
+
"au-slider-label-vertical-now": vertical$,
|
|
511
|
+
"au-slider-label": horizontal$,
|
|
512
|
+
"au-slider-label-now": horizontal$
|
|
513
|
+
},
|
|
514
|
+
styles: {
|
|
515
|
+
left: computed(() => percent(combinedLabelPositionLeft$())),
|
|
516
|
+
top: computed(() => percent(combinedLabelPositionTop$()))
|
|
517
|
+
}
|
|
518
|
+
})),
|
|
519
|
+
handleLabelDisplayDirective: createAttributesDirective((labelDisplayContext$) => ({
|
|
520
|
+
classNames: {
|
|
521
|
+
"au-slider-label-vertical": vertical$,
|
|
522
|
+
"au-slider-label-vertical-now": vertical$,
|
|
523
|
+
"au-slider-label": horizontal$,
|
|
524
|
+
"au-slider-label-now": horizontal$
|
|
525
|
+
},
|
|
526
|
+
styles: {
|
|
527
|
+
left: computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
|
|
528
|
+
top: computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top))
|
|
529
|
+
}
|
|
530
|
+
}))
|
|
531
|
+
}
|
|
530
532
|
};
|
|
531
533
|
return widget;
|
|
532
534
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const tansu = require("@amadeus-it-group/tansu");
|
|
3
|
-
const utils_directive = require("./directive-
|
|
3
|
+
const utils_directive = require("./directive-DdlwGFtf.cjs");
|
|
4
4
|
const func = require("./func-Qd3cD9a3.cjs");
|
|
5
5
|
const utils_stores = require("./utils/stores.cjs");
|
|
6
|
-
const utils_writables = require("./writables-
|
|
6
|
+
const utils_writables = require("./writables-BPAJvaL_.cjs");
|
|
7
7
|
const services_resizeObserver = require("./services/resizeObserver.cjs");
|
|
8
8
|
const decimalRegExp = /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
|
|
9
9
|
function getDecimalPrecision(number) {
|
|
@@ -48,7 +48,8 @@ const configValidator = {
|
|
|
48
48
|
values: utils_writables.typeArray,
|
|
49
49
|
showValueLabels: utils_writables.typeBoolean,
|
|
50
50
|
showMinMaxLabels: utils_writables.typeBoolean,
|
|
51
|
-
rtl: utils_writables.typeBoolean
|
|
51
|
+
rtl: utils_writables.typeBoolean,
|
|
52
|
+
className: utils_writables.typeString
|
|
52
53
|
};
|
|
53
54
|
const computeCleanValue = (value, min, max, intStepSize, decimalPrecision) => {
|
|
54
55
|
const magnitude = Math.pow(10, decimalPrecision);
|
|
@@ -210,7 +211,7 @@ function createSlider(config) {
|
|
|
210
211
|
});
|
|
211
212
|
const combinedLabelDisplay$ = tansu.computed(() => {
|
|
212
213
|
const values = values$();
|
|
213
|
-
return values.length == 2 && Math.abs(values[0] - values[1]) < 10;
|
|
214
|
+
return values.length == 2 && Math.abs(values[0] - values[1]) * 100 / (max$() - min$()) < 10;
|
|
214
215
|
});
|
|
215
216
|
const interactive$ = tansu.computed(() => !disabled$() && !readonly$());
|
|
216
217
|
const combinedLabelPositionLeft$ = tansu.computed(() => {
|
|
@@ -225,7 +226,7 @@ function createSlider(config) {
|
|
|
225
226
|
});
|
|
226
227
|
const handleDisplayOptions$ = tansu.computed(() => {
|
|
227
228
|
const vertical = vertical$(), rtl = rtl$();
|
|
228
|
-
return valuesPercent$().map((vp
|
|
229
|
+
return valuesPercent$().map((vp) => {
|
|
229
230
|
return {
|
|
230
231
|
left: rtl ? vertical ? null : 100 - vp : vertical ? null : vp,
|
|
231
232
|
top: rtl ? vertical ? vp : null : vertical ? 100 - vp : null
|
|
@@ -321,113 +322,10 @@ function createSlider(config) {
|
|
|
321
322
|
invisible: tansu.computed(() => !maxValueLabelDisplay$())
|
|
322
323
|
}
|
|
323
324
|
}));
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
stepSize$,
|
|
329
|
-
values$,
|
|
330
|
-
sortedValues$,
|
|
331
|
-
sortedHandles$,
|
|
332
|
-
minValueLabelDisplay$,
|
|
333
|
-
maxValueLabelDisplay$,
|
|
334
|
-
combinedLabelDisplay$,
|
|
335
|
-
interactive$,
|
|
336
|
-
combinedLabelPositionLeft$,
|
|
337
|
-
combinedLabelPositionTop$,
|
|
338
|
-
progressDisplayOptions$,
|
|
339
|
-
handleDisplayOptions$,
|
|
340
|
-
showValueLabels$,
|
|
341
|
-
showMinMaxLabels$,
|
|
342
|
-
rtl$,
|
|
343
|
-
...stateProps
|
|
344
|
-
}),
|
|
345
|
-
patch,
|
|
346
|
-
api: {},
|
|
347
|
-
directives: {
|
|
348
|
-
sliderDirective: utils_directive.mergeDirectives(sliderDirective, resizeDirective, containerDirective),
|
|
349
|
-
progressDisplayDirective: utils_directive.createAttributesDirective((progressContext$) => ({
|
|
350
|
-
styles: {
|
|
351
|
-
left: tansu.computed(() => percent(progressContext$().option.left)),
|
|
352
|
-
right: tansu.computed(() => percent(progressContext$().option.right)),
|
|
353
|
-
top: tansu.computed(() => percent(progressContext$().option.top)),
|
|
354
|
-
bottom: tansu.computed(() => percent(progressContext$().option.bottom)),
|
|
355
|
-
width: tansu.computed(() => percent(progressContext$().option.width)),
|
|
356
|
-
height: tansu.computed(() => percent(progressContext$().option.height))
|
|
357
|
-
},
|
|
358
|
-
classNames: {
|
|
359
|
-
"au-slider-progress": true
|
|
360
|
-
}
|
|
361
|
-
})),
|
|
362
|
-
clickableAreaDirective: utils_directive.createAttributesDirective(() => ({
|
|
363
|
-
events: {
|
|
364
|
-
click: (event) => widget.actions.click(event)
|
|
365
|
-
},
|
|
366
|
-
classNames: {
|
|
367
|
-
"au-slider-clickable-area": horizontal$,
|
|
368
|
-
"au-slider-clickable-area-vertical": vertical$
|
|
369
|
-
}
|
|
370
|
-
})),
|
|
371
|
-
handleDirective: utils_directive.createAttributesDirective((handleContext$) => ({
|
|
372
|
-
events: {
|
|
373
|
-
keydown: (event) => widget.actions.keydown(event, handleContext$().item.id),
|
|
374
|
-
mousedown: (event) => widget.actions.mouseDown(event, handleContext$().item.id),
|
|
375
|
-
touchstart: (event) => widget.actions.touchStart(event, handleContext$().item.id)
|
|
376
|
-
},
|
|
377
|
-
attributes: {
|
|
378
|
-
role: "slider",
|
|
379
|
-
"aria-valuemin": min$,
|
|
380
|
-
"aria-valuemax": max$,
|
|
381
|
-
"aria-valuenow": tansu.computed(() => handleContext$().item.value),
|
|
382
|
-
"aria-valuetext": tansu.computed(() => handleContext$().item.ariaValueText),
|
|
383
|
-
"aria-label": tansu.computed(() => handleContext$().item.ariaLabel),
|
|
384
|
-
"aria-orientation": tansu.computed(() => vertical$() ? "vertical" : void 0),
|
|
385
|
-
"aria-disabled": tansu.computed(() => disabled$() ? "true" : void 0),
|
|
386
|
-
disabled: disabled$,
|
|
387
|
-
"aria-readonly": tansu.computed(() => readonly$() ? "true" : void 0)
|
|
388
|
-
},
|
|
389
|
-
styles: {
|
|
390
|
-
left: tansu.computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].left)),
|
|
391
|
-
top: tansu.computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
|
|
392
|
-
},
|
|
393
|
-
classNames: {
|
|
394
|
-
"au-slider-handle": true,
|
|
395
|
-
"au-slider-handle-vertical": vertical$,
|
|
396
|
-
"au-slider-handle-horizontal": horizontal$
|
|
397
|
-
}
|
|
398
|
-
})),
|
|
399
|
-
minLabelDirective: utils_directive.mergeDirectives(minLabelDomDirective, minLabelDirective),
|
|
400
|
-
maxLabelDirective: utils_directive.mergeDirectives(maxLabelDomDirective, maxLabelDirective),
|
|
401
|
-
combinedHandleLabelDisplayDirective: utils_directive.createAttributesDirective(() => ({
|
|
402
|
-
classNames: {
|
|
403
|
-
"au-slider-label-vertical": vertical$,
|
|
404
|
-
"au-slider-label-vertical-now": vertical$,
|
|
405
|
-
"au-slider-label": horizontal$,
|
|
406
|
-
"au-slider-label-now": horizontal$
|
|
407
|
-
},
|
|
408
|
-
styles: {
|
|
409
|
-
left: tansu.computed(() => percent(combinedLabelPositionLeft$())),
|
|
410
|
-
top: tansu.computed(() => percent(combinedLabelPositionTop$()))
|
|
411
|
-
}
|
|
412
|
-
})),
|
|
413
|
-
handleLabelDisplayDirective: utils_directive.createAttributesDirective((labelDisplayContext$) => ({
|
|
414
|
-
classNames: {
|
|
415
|
-
"au-slider-label-vertical": vertical$,
|
|
416
|
-
"au-slider-label-vertical-now": vertical$,
|
|
417
|
-
"au-slider-label": horizontal$,
|
|
418
|
-
"au-slider-label-now": horizontal$
|
|
419
|
-
},
|
|
420
|
-
styles: {
|
|
421
|
-
left: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
|
|
422
|
-
top: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top))
|
|
423
|
-
}
|
|
424
|
-
}))
|
|
425
|
-
},
|
|
426
|
-
actions: {
|
|
427
|
-
click(event) {
|
|
428
|
-
adjustCoordinate(vertical$() ? event.clientY : event.clientX);
|
|
429
|
-
},
|
|
430
|
-
keydown(event, handleIndex) {
|
|
325
|
+
const handleEventsDirective = utils_directive.createAttributesDirective((handleContext$) => ({
|
|
326
|
+
events: {
|
|
327
|
+
keydown: (event) => {
|
|
328
|
+
const handleIndex = handleContext$().item.id;
|
|
431
329
|
const { key } = event;
|
|
432
330
|
const rtl = rtl$(), stepSize = stepSize$(), min = min$(), max = max$(), vertical = vertical$();
|
|
433
331
|
if (interactive$()) {
|
|
@@ -469,7 +367,7 @@ function createSlider(config) {
|
|
|
469
367
|
event.stopPropagation();
|
|
470
368
|
}
|
|
471
369
|
},
|
|
472
|
-
|
|
370
|
+
mousedown: (event) => {
|
|
473
371
|
event.preventDefault();
|
|
474
372
|
const currentTarget = event.target;
|
|
475
373
|
const handleDrag = (e) => {
|
|
@@ -478,7 +376,7 @@ function createSlider(config) {
|
|
|
478
376
|
currentTarget.focus();
|
|
479
377
|
if (_prevCoordinate !== newCoord) {
|
|
480
378
|
_prevCoordinate = newCoord;
|
|
481
|
-
adjustCoordinate(newCoord,
|
|
379
|
+
adjustCoordinate(newCoord, handleContext$().item.id);
|
|
482
380
|
}
|
|
483
381
|
};
|
|
484
382
|
if (interactive$()) {
|
|
@@ -494,7 +392,7 @@ function createSlider(config) {
|
|
|
494
392
|
);
|
|
495
393
|
}
|
|
496
394
|
},
|
|
497
|
-
|
|
395
|
+
touchstart: (event) => {
|
|
498
396
|
event.preventDefault();
|
|
499
397
|
const handleDrag = (e) => {
|
|
500
398
|
e.preventDefault();
|
|
@@ -502,7 +400,7 @@ function createSlider(config) {
|
|
|
502
400
|
event.target.focus();
|
|
503
401
|
if (_prevCoordinate !== newCoord) {
|
|
504
402
|
_prevCoordinate = newCoord;
|
|
505
|
-
adjustCoordinate(newCoord,
|
|
403
|
+
adjustCoordinate(newCoord, handleContext$().item.id);
|
|
506
404
|
}
|
|
507
405
|
};
|
|
508
406
|
if (interactive$()) {
|
|
@@ -528,6 +426,110 @@ function createSlider(config) {
|
|
|
528
426
|
}
|
|
529
427
|
}
|
|
530
428
|
}
|
|
429
|
+
}));
|
|
430
|
+
const widget = {
|
|
431
|
+
...utils_stores.stateStores({
|
|
432
|
+
min$,
|
|
433
|
+
max$,
|
|
434
|
+
stepSize$,
|
|
435
|
+
values$,
|
|
436
|
+
sortedValues$,
|
|
437
|
+
sortedHandles$,
|
|
438
|
+
minValueLabelDisplay$,
|
|
439
|
+
maxValueLabelDisplay$,
|
|
440
|
+
combinedLabelDisplay$,
|
|
441
|
+
interactive$,
|
|
442
|
+
combinedLabelPositionLeft$,
|
|
443
|
+
combinedLabelPositionTop$,
|
|
444
|
+
progressDisplayOptions$,
|
|
445
|
+
handleDisplayOptions$,
|
|
446
|
+
showValueLabels$,
|
|
447
|
+
showMinMaxLabels$,
|
|
448
|
+
rtl$,
|
|
449
|
+
...stateProps
|
|
450
|
+
}),
|
|
451
|
+
patch,
|
|
452
|
+
api: {},
|
|
453
|
+
directives: {
|
|
454
|
+
sliderDirective: utils_directive.mergeDirectives(sliderDirective, resizeDirective, containerDirective),
|
|
455
|
+
progressDisplayDirective: utils_directive.createAttributesDirective((progressContext$) => ({
|
|
456
|
+
styles: {
|
|
457
|
+
left: tansu.computed(() => percent(progressContext$().option.left)),
|
|
458
|
+
right: tansu.computed(() => percent(progressContext$().option.right)),
|
|
459
|
+
top: tansu.computed(() => percent(progressContext$().option.top)),
|
|
460
|
+
bottom: tansu.computed(() => percent(progressContext$().option.bottom)),
|
|
461
|
+
width: tansu.computed(() => percent(progressContext$().option.width)),
|
|
462
|
+
height: tansu.computed(() => percent(progressContext$().option.height))
|
|
463
|
+
},
|
|
464
|
+
classNames: {
|
|
465
|
+
"au-slider-progress": true
|
|
466
|
+
}
|
|
467
|
+
})),
|
|
468
|
+
clickableAreaDirective: utils_directive.createAttributesDirective(() => ({
|
|
469
|
+
events: {
|
|
470
|
+
click: (event) => {
|
|
471
|
+
adjustCoordinate(vertical$() ? event.clientY : event.clientX);
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
classNames: {
|
|
475
|
+
"au-slider-clickable-area": horizontal$,
|
|
476
|
+
"au-slider-clickable-area-vertical": vertical$
|
|
477
|
+
}
|
|
478
|
+
})),
|
|
479
|
+
handleEventsDirective,
|
|
480
|
+
handleDirective: utils_directive.mergeDirectives(
|
|
481
|
+
handleEventsDirective,
|
|
482
|
+
utils_directive.createAttributesDirective((handleContext$) => ({
|
|
483
|
+
attributes: {
|
|
484
|
+
role: "slider",
|
|
485
|
+
"aria-valuemin": min$,
|
|
486
|
+
"aria-valuemax": max$,
|
|
487
|
+
"aria-valuenow": tansu.computed(() => handleContext$().item.value),
|
|
488
|
+
"aria-valuetext": tansu.computed(() => handleContext$().item.ariaValueText),
|
|
489
|
+
"aria-label": tansu.computed(() => handleContext$().item.ariaLabel),
|
|
490
|
+
"aria-orientation": tansu.computed(() => vertical$() ? "vertical" : void 0),
|
|
491
|
+
"aria-disabled": tansu.computed(() => disabled$() ? "true" : void 0),
|
|
492
|
+
disabled: disabled$,
|
|
493
|
+
"aria-readonly": tansu.computed(() => readonly$() ? "true" : void 0)
|
|
494
|
+
},
|
|
495
|
+
styles: {
|
|
496
|
+
left: tansu.computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].left)),
|
|
497
|
+
top: tansu.computed(() => percent(handleDisplayOptions$()[handleContext$().item.id].top))
|
|
498
|
+
},
|
|
499
|
+
classNames: {
|
|
500
|
+
"au-slider-handle": true,
|
|
501
|
+
"au-slider-handle-vertical": vertical$,
|
|
502
|
+
"au-slider-handle-horizontal": horizontal$
|
|
503
|
+
}
|
|
504
|
+
}))
|
|
505
|
+
),
|
|
506
|
+
minLabelDirective: utils_directive.mergeDirectives(minLabelDomDirective, minLabelDirective),
|
|
507
|
+
maxLabelDirective: utils_directive.mergeDirectives(maxLabelDomDirective, maxLabelDirective),
|
|
508
|
+
combinedHandleLabelDisplayDirective: utils_directive.createAttributesDirective(() => ({
|
|
509
|
+
classNames: {
|
|
510
|
+
"au-slider-label-vertical": vertical$,
|
|
511
|
+
"au-slider-label-vertical-now": vertical$,
|
|
512
|
+
"au-slider-label": horizontal$,
|
|
513
|
+
"au-slider-label-now": horizontal$
|
|
514
|
+
},
|
|
515
|
+
styles: {
|
|
516
|
+
left: tansu.computed(() => percent(combinedLabelPositionLeft$())),
|
|
517
|
+
top: tansu.computed(() => percent(combinedLabelPositionTop$()))
|
|
518
|
+
}
|
|
519
|
+
})),
|
|
520
|
+
handleLabelDisplayDirective: utils_directive.createAttributesDirective((labelDisplayContext$) => ({
|
|
521
|
+
classNames: {
|
|
522
|
+
"au-slider-label-vertical": vertical$,
|
|
523
|
+
"au-slider-label-vertical-now": vertical$,
|
|
524
|
+
"au-slider-label": horizontal$,
|
|
525
|
+
"au-slider-label-now": horizontal$
|
|
526
|
+
},
|
|
527
|
+
styles: {
|
|
528
|
+
left: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].left)),
|
|
529
|
+
top: tansu.computed(() => percent(handleDisplayOptions$()[labelDisplayContext$().index].top))
|
|
530
|
+
}
|
|
531
|
+
}))
|
|
532
|
+
}
|
|
531
533
|
};
|
|
532
534
|
return widget;
|
|
533
535
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed } from "@amadeus-it-group/tansu";
|
|
2
2
|
import { extendWidgetProps } from "./services/extendWidget.js";
|
|
3
|
-
import { d as directiveSubscribe, n as createAttributesDirective } from "./directive-
|
|
4
|
-
import { c as typeBoolean, b as typeNumberInRangeFactory } from "./writables-
|
|
5
|
-
import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-
|
|
3
|
+
import { d as directiveSubscribe, n as createAttributesDirective } from "./directive-CKEccryv.js";
|
|
4
|
+
import { c as typeBoolean, b as typeNumberInRangeFactory } from "./writables-DCiBdIBK.js";
|
|
5
|
+
import { g as getCommonAlertDefaultConfig, c as createCommonAlert } from "./common-Banw3FYN.js";
|
|
6
6
|
const toastDefaultConfig = {
|
|
7
7
|
autoHide: true,
|
|
8
8
|
delay: 5e3
|
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
5
|
-
const utils_writables = require("./writables-
|
|
6
|
-
const common = require("./common-
|
|
4
|
+
const utils_directive = require("./directive-DdlwGFtf.cjs");
|
|
5
|
+
const utils_writables = require("./writables-BPAJvaL_.cjs");
|
|
6
|
+
const common = require("./common-DvPjK7SS.cjs");
|
|
7
7
|
const toastDefaultConfig = {
|
|
8
8
|
autoHide: true,
|
|
9
9
|
delay: 5e3
|
package/types.cjs
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const toSlotContextWidget = (w) => ({
|
|
4
|
-
actions: w.actions,
|
|
5
|
-
api: w.api,
|
|
6
|
-
directives: w.directives,
|
|
7
|
-
state$: w.state$,
|
|
8
|
-
stores: w.stores
|
|
9
|
-
});
|
|
10
3
|
const INVALID_VALUE = Symbol();
|
|
11
4
|
exports.INVALID_VALUE = INVALID_VALUE;
|
|
12
|
-
exports.toSlotContextWidget = toSlotContextWidget;
|