@zywave/zui-slider 4.4.0-pre.1 → 4.4.0-pre.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/zui-slider.fouc.css +1 -1
- package/dist/custom-elements.json +21 -6
- package/dist/zui-slider-css.js +1 -1
- package/dist/zui-slider-css.js.map +1 -1
- package/dist/zui-slider.d.ts +1 -2
- package/dist/zui-slider.js +45 -10
- package/dist/zui-slider.js.map +1 -1
- package/lab.html +0 -3
- package/package.json +2 -2
- package/src/css/zui-slider.fouc.scss +2 -1
- package/src/zui-slider-css.js +1 -1
- package/src/zui-slider.scss +74 -128
- package/src/zui-slider.ts +49 -10
- package/test/zui-slider.test.ts +143 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
zui-slider:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;--zui-slider-thumb-size: 0.875rem;position:relative;display:block;padding:calc(var(--zui-slider-thumb-size)/2) 0}zui-slider:not(:defined)::before{display:block;content:"";height:.25rem;background:linear-gradient(to right, transparent var(--zui-slider-thumb-size), var(--zui-blue) var(--zui-slider-thumb-size), var(--zui-blue) 50%, var(--zui-gray-200) 50%, var(--zui-gray-200) calc(100% - var(--zui-slider-thumb-size)), transparent calc(100% - var(--zui-slider-thumb-size)));border-radius:.1875rem}zui-slider:not(:defined)::after{position:absolute;top:50%;left:50%;content:"";width:var(--zui-slider-thumb-size);height:var(--zui-slider-thumb-size);background-color:var(--zui-blue);border-radius:50%;cursor:grab;transform:translate(-50%, -50%)}zui-slider:not(:defined):active::after{cursor:grabbing}zui-slider:not(:defined) *,zui-slider:not(:defined) *::before,zui-slider:not(:defined) *::after{box-sizing:inherit}zui-slider[range]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%}zui-slider[range]:not(:defined)::before{background:linear-gradient(to right, transparent var(--zui-slider-thumb-size), var(--zui-blue) var(--zui-slider-thumb-size), var(--zui-blue) calc(100% - var(--zui-slider-thumb-size)), transparent calc(100% - var(--zui-slider-thumb-size)))}zui-slider[range]:not(:defined)::after{display:none}zui-slider[range]:not(:defined) *,zui-slider[range]:not(:defined) *::before,zui-slider[range]:not(:defined) *::after{box-sizing:inherit}zui-slider[disabled]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;cursor:not-allowed}zui-slider[disabled]:not(:defined)::before{background:var(--zui-gray-200)}zui-slider[disabled]:not(:defined)::after{background-color:var(--zui-gray);cursor:not-allowed}zui-slider[disabled]:not(:defined) *,zui-slider[disabled]:not(:defined) *::before,zui-slider[disabled]:not(:defined) *::after{box-sizing:inherit}zui-slider[range][disabled]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%}zui-slider[range][disabled]:not(:defined)::before{background:var(--zui-gray-200)}zui-slider[range][disabled]:not(:defined) *,zui-slider[range][disabled]:not(:defined) *::before,zui-slider[range][disabled]:not(:defined) *::after{box-sizing:inherit}
|
|
1
|
+
zui-slider:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;--zui-slider-thumb-size: 0.875rem;position:relative;display:block;margin:0 calc(var(--zui-slider-thumb-size)*-1);padding:calc(var(--zui-slider-thumb-size)/2 - 0.125rem) 0}zui-slider:not(:defined)::before{display:block;content:"";height:.25rem;background:linear-gradient(to right, transparent var(--zui-slider-thumb-size), var(--zui-blue) var(--zui-slider-thumb-size), var(--zui-blue) 50%, var(--zui-gray-200) 50%, var(--zui-gray-200) calc(100% - var(--zui-slider-thumb-size)), transparent calc(100% - var(--zui-slider-thumb-size)));border-radius:.1875rem}zui-slider:not(:defined)::after{position:absolute;top:50%;left:50%;content:"";width:var(--zui-slider-thumb-size);height:var(--zui-slider-thumb-size);background-color:var(--zui-blue);border-radius:50%;cursor:grab;transform:translate(-50%, -50%)}zui-slider:not(:defined):active::after{cursor:grabbing}zui-slider:not(:defined) *,zui-slider:not(:defined) *::before,zui-slider:not(:defined) *::after{box-sizing:inherit}zui-slider[range]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%}zui-slider[range]:not(:defined)::before{background:linear-gradient(to right, transparent var(--zui-slider-thumb-size), var(--zui-blue) var(--zui-slider-thumb-size), var(--zui-blue) calc(100% - var(--zui-slider-thumb-size)), transparent calc(100% - var(--zui-slider-thumb-size)))}zui-slider[range]:not(:defined)::after{display:none}zui-slider[range]:not(:defined) *,zui-slider[range]:not(:defined) *::before,zui-slider[range]:not(:defined) *::after{box-sizing:inherit}zui-slider[disabled]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;cursor:not-allowed}zui-slider[disabled]:not(:defined)::before{background:var(--zui-gray-200)}zui-slider[disabled]:not(:defined)::after{background-color:var(--zui-gray);cursor:not-allowed}zui-slider[disabled]:not(:defined) *,zui-slider[disabled]:not(:defined) *::before,zui-slider[disabled]:not(:defined) *::after{box-sizing:inherit}zui-slider[range][disabled]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%}zui-slider[range][disabled]:not(:defined)::before{background:var(--zui-gray-200)}zui-slider[range][disabled]:not(:defined) *,zui-slider[range][disabled]:not(:defined) *::before,zui-slider[range][disabled]:not(:defined) *::after{box-sizing:inherit}
|
|
@@ -12,12 +12,7 @@
|
|
|
12
12
|
"name": "ZuiSlider",
|
|
13
13
|
"cssProperties": [
|
|
14
14
|
{
|
|
15
|
-
"description": "
|
|
16
|
-
"name": "--zui-slider-thumb-size",
|
|
17
|
-
"default": "0.875rem (14px)"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"description": "Width of the floating value input above each thumb",
|
|
15
|
+
"description": "Width of the floating value input above each slider thumb",
|
|
21
16
|
"name": "--zui-slider-input-width",
|
|
22
17
|
"default": "7ch"
|
|
23
18
|
}
|
|
@@ -423,6 +418,13 @@
|
|
|
423
418
|
"type": {
|
|
424
419
|
"text": "'start' | 'end'"
|
|
425
420
|
}
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"name": "trackBg",
|
|
424
|
+
"optional": true,
|
|
425
|
+
"type": {
|
|
426
|
+
"text": "string"
|
|
427
|
+
}
|
|
426
428
|
}
|
|
427
429
|
]
|
|
428
430
|
},
|
|
@@ -577,6 +579,19 @@
|
|
|
577
579
|
"name": "#onRangeChange",
|
|
578
580
|
"privacy": "private"
|
|
579
581
|
},
|
|
582
|
+
{
|
|
583
|
+
"kind": "method",
|
|
584
|
+
"name": "#onTrackClick",
|
|
585
|
+
"privacy": "private",
|
|
586
|
+
"parameters": [
|
|
587
|
+
{
|
|
588
|
+
"name": "e",
|
|
589
|
+
"type": {
|
|
590
|
+
"text": "MouseEvent"
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
]
|
|
594
|
+
},
|
|
580
595
|
{
|
|
581
596
|
"kind": "method",
|
|
582
597
|
"name": "#showThumbInput",
|
package/dist/zui-slider-css.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css `:host .thumb-input input[type=number]{display:inline-block;width:100%;min-height:2.625rem;vertical-align:middle;padding:0 .625rem;background-color:#fff;border:.0625rem solid var(--zui-gray-200);border-radius:.25rem;font:inherit;color:inherit;transition:border 100ms ease-in-out,box-shadow 100ms ease-in-out;box-sizing:border-box;appearance:textfield}:host .thumb-input input[type=number]::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input[type=number]:hover{border-color:var(--zui-gray-400)}:host .thumb-input input[type=number]:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled][type=number]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled][type=number]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly][type=number]{outline:none}:host{--zui-slider-thumb-size: 0.875rem;--zui-slider-input-width: 8ch;position:relative;display:block
|
|
2
|
+
export const style = css `:host .thumb-input input[type=number]{display:inline-block;width:100%;min-height:2.625rem;vertical-align:middle;padding:0 .625rem;background-color:#fff;border:.0625rem solid var(--zui-gray-200);border-radius:.25rem;font:inherit;color:inherit;transition:border 100ms ease-in-out,box-shadow 100ms ease-in-out;box-sizing:border-box;appearance:textfield}:host .thumb-input input[type=number]::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input[type=number]:hover{border-color:var(--zui-gray-400)}:host .thumb-input input[type=number]:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled][type=number]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled][type=number]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly][type=number]{outline:none}:host{--zui-slider-thumb-size: 0.875rem;--zui-slider-input-width: 8ch;position:relative;display:block}:host .single-wrapper,:host .range-wrapper{position:relative;display:flex;height:var(--zui-slider-thumb-size);align-items:center;margin:0 calc(var(--zui-slider-thumb-size)*-1)}:host input[type=range]{width:100%;height:var(--zui-slider-thumb-size);margin:0;background:rgba(0,0,0,0);outline:none;cursor:grab;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host input[type=range]::-webkit-slider-runnable-track{height:.25rem;background:var(--zui-slider-track-bg)}:host input[type=range]::-moz-range-track{height:.25rem;background:var(--zui-slider-track-bg)}:host input[type=range]::-webkit-slider-thumb{width:calc(var(--zui-slider-thumb-size)*3);height:calc(var(--zui-slider-thumb-size)*3);background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));border-radius:50%;box-shadow:none;cursor:grab;transition:background 100ms ease-out,box-shadow 100ms ease-out}:host input[type=range]::-webkit-slider-thumb:hover{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]::-moz-range-thumb{width:calc(var(--zui-slider-thumb-size)*3);height:calc(var(--zui-slider-thumb-size)*3);background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));border-radius:50%;box-shadow:none;cursor:grab;transition:background 100ms ease-out,box-shadow 100ms ease-out}:host input[type=range]::-moz-range-thumb:hover{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]::-webkit-slider-thumb{transform:translateY(calc(-50% + 0.125rem));-webkit-appearance:none;appearance:none}:host input[type=range]::-moz-range-thumb{border:0}:host input[type=range]:hover::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2))}:host input[type=range]:hover::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2))}:host input[type=range]:focus::-webkit-slider-thumb{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]:focus::-moz-range-thumb{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]:active::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16);cursor:grabbing}:host input[type=range]:active::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16);cursor:grabbing}:host .thumb-input{position:absolute;bottom:calc(var(--zui-slider-thumb-size)*2 + 0.25rem);opacity:0;z-index:10;transform:translateX(-50%);transition:opacity 100ms ease-out;pointer-events:none}:host .thumb-input--visible,:host .thumb-input:focus-within{opacity:1;pointer-events:all}:host .thumb-input input[type=number]{width:var(--zui-slider-input-width);text-align:center}:host .thumb-input input[type=number]::-webkit-inner-spin-button,:host .thumb-input input[type=number]::-webkit-outer-spin-button{appearance:none}:host .step-dots{position:absolute;top:50%;left:0;width:100%;height:0;pointer-events:none}:host .step-dots .step-dot{position:absolute;width:.375rem;height:.375rem;background-color:var(--zui-blue);border-radius:50%;transform:translate(-50%, -50%)}:host .step-dots .step-dot:first-child,:host .step-dots .step-dot:last-child{width:.125rem;height:1rem;border-radius:.125rem}:host .range-wrapper{cursor:grab}:host .range-wrapper:active{cursor:grabbing}:host .range-wrapper input[type=range]{position:absolute;pointer-events:none}:host .range-wrapper input[type=range]::-webkit-slider-thumb{pointer-events:all}:host .range-wrapper input[type=range]::-moz-range-thumb{pointer-events:all}:host .range-wrapper input[type=range]::-moz-range-progress{background:rgba(0,0,0,0)}:host .min-max-labels{display:flex;justify-content:space-between}:host .min-max-labels .min-max-label{font-weight:600;color:var(--zui-gray-600)}:host([range]) .min-max-labels{margin-top:.3125rem}:host([readonly]) input[type=range]:disabled{cursor:default}:host([readonly]) input[type=range]:disabled::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:default}:host([readonly]) input[type=range]:disabled::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:default}:host([disabled]){cursor:not-allowed}:host([disabled]) input[type=range]:disabled{cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-webkit-slider-thumb:hover{box-shadow:none}:host([disabled]) input[type=range]:disabled::-moz-range-thumb{background:radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-moz-range-thumb:hover{box-shadow:none}:host([disabled]) .step-dot{background-color:var(--zui-gray)}:host([disabled]) .range-wrapper{cursor:not-allowed}`;
|
|
3
3
|
//# sourceMappingURL=zui-slider-css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zui-slider-css.js","sourceRoot":"","sources":["../src/zui-slider-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,
|
|
1
|
+
{"version":3,"file":"zui-slider-css.js","sourceRoot":"","sources":["../src/zui-slider-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,+pOAA+pO,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host .thumb-input input[type=number]{display:inline-block;width:100%;min-height:2.625rem;vertical-align:middle;padding:0 .625rem;background-color:#fff;border:.0625rem solid var(--zui-gray-200);border-radius:.25rem;font:inherit;color:inherit;transition:border 100ms ease-in-out,box-shadow 100ms ease-in-out;box-sizing:border-box;appearance:textfield}:host .thumb-input input[type=number]::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input[type=number]:hover{border-color:var(--zui-gray-400)}:host .thumb-input input[type=number]:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled][type=number]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled][type=number]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly][type=number]{outline:none}:host{--zui-slider-thumb-size: 0.875rem;--zui-slider-input-width: 8ch;position:relative;display:block}:host .single-wrapper,:host .range-wrapper{position:relative;display:flex;height:var(--zui-slider-thumb-size);align-items:center;margin:0 calc(var(--zui-slider-thumb-size)*-1)}:host input[type=range]{width:100%;height:var(--zui-slider-thumb-size);margin:0;background:rgba(0,0,0,0);outline:none;cursor:grab;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host input[type=range]::-webkit-slider-runnable-track{height:.25rem;background:var(--zui-slider-track-bg)}:host input[type=range]::-moz-range-track{height:.25rem;background:var(--zui-slider-track-bg)}:host input[type=range]::-webkit-slider-thumb{width:calc(var(--zui-slider-thumb-size)*3);height:calc(var(--zui-slider-thumb-size)*3);background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));border-radius:50%;box-shadow:none;cursor:grab;transition:background 100ms ease-out,box-shadow 100ms ease-out}:host input[type=range]::-webkit-slider-thumb:hover{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]::-moz-range-thumb{width:calc(var(--zui-slider-thumb-size)*3);height:calc(var(--zui-slider-thumb-size)*3);background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));border-radius:50%;box-shadow:none;cursor:grab;transition:background 100ms ease-out,box-shadow 100ms ease-out}:host input[type=range]::-moz-range-thumb:hover{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]::-webkit-slider-thumb{transform:translateY(calc(-50% + 0.125rem));-webkit-appearance:none;appearance:none}:host input[type=range]::-moz-range-thumb{border:0}:host input[type=range]:hover::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2))}:host input[type=range]:hover::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2))}:host input[type=range]:focus::-webkit-slider-thumb{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]:focus::-moz-range-thumb{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]:active::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16);cursor:grabbing}:host input[type=range]:active::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16);cursor:grabbing}:host .thumb-input{position:absolute;bottom:calc(var(--zui-slider-thumb-size)*2 + 0.25rem);opacity:0;z-index:10;transform:translateX(-50%);transition:opacity 100ms ease-out;pointer-events:none}:host .thumb-input--visible,:host .thumb-input:focus-within{opacity:1;pointer-events:all}:host .thumb-input input[type=number]{width:var(--zui-slider-input-width);text-align:center}:host .thumb-input input[type=number]::-webkit-inner-spin-button,:host .thumb-input input[type=number]::-webkit-outer-spin-button{appearance:none}:host .step-dots{position:absolute;top:50%;left:0;width:100%;height:0;pointer-events:none}:host .step-dots .step-dot{position:absolute;width:.375rem;height:.375rem;background-color:var(--zui-blue);border-radius:50%;transform:translate(-50%, -50%)}:host .step-dots .step-dot:first-child,:host .step-dots .step-dot:last-child{width:.125rem;height:1rem;border-radius:.125rem}:host .range-wrapper{cursor:grab}:host .range-wrapper:active{cursor:grabbing}:host .range-wrapper input[type=range]{position:absolute;pointer-events:none}:host .range-wrapper input[type=range]::-webkit-slider-thumb{pointer-events:all}:host .range-wrapper input[type=range]::-moz-range-thumb{pointer-events:all}:host .range-wrapper input[type=range]::-moz-range-progress{background:rgba(0,0,0,0)}:host .min-max-labels{display:flex;justify-content:space-between}:host .min-max-labels .min-max-label{font-weight:600;color:var(--zui-gray-600)}:host([range]) .min-max-labels{margin-top:.3125rem}:host([readonly]) input[type=range]:disabled{cursor:default}:host([readonly]) input[type=range]:disabled::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:default}:host([readonly]) input[type=range]:disabled::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:default}:host([disabled]){cursor:not-allowed}:host([disabled]) input[type=range]:disabled{cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-webkit-slider-thumb:hover{box-shadow:none}:host([disabled]) input[type=range]:disabled::-moz-range-thumb{background:radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-moz-range-thumb:hover{box-shadow:none}:host([disabled]) .step-dot{background-color:var(--zui-gray)}:host([disabled]) .range-wrapper{cursor:not-allowed}`;\n"]}
|
package/dist/zui-slider.d.ts
CHANGED
|
@@ -34,8 +34,7 @@ import { TemplateResult } from 'lit';
|
|
|
34
34
|
* @prop {number} [step=0] - Represents the stepping interval; 0 means any value is allowed
|
|
35
35
|
* @prop {boolean} [showMinMax=false] - Shows the min and max values beneath the slider
|
|
36
36
|
*
|
|
37
|
-
* @cssprop [--zui-slider-
|
|
38
|
-
* @cssprop [--zui-slider-input-width=7ch] - Width of the floating value input above each thumb
|
|
37
|
+
* @cssprop [--zui-slider-input-width=7ch] - Width of the floating value input above each slider thumb
|
|
39
38
|
*
|
|
40
39
|
* @event {CustomEvent} change - Fires when value changes; in single mode detail is the value string; in range mode detail is { valueStart, valueEnd }
|
|
41
40
|
*/
|
package/dist/zui-slider.js
CHANGED
|
@@ -46,8 +46,7 @@ import { style } from './zui-slider-css.js';
|
|
|
46
46
|
* @prop {number} [step=0] - Represents the stepping interval; 0 means any value is allowed
|
|
47
47
|
* @prop {boolean} [showMinMax=false] - Shows the min and max values beneath the slider
|
|
48
48
|
*
|
|
49
|
-
* @cssprop [--zui-slider-
|
|
50
|
-
* @cssprop [--zui-slider-input-width=7ch] - Width of the floating value input above each thumb
|
|
49
|
+
* @cssprop [--zui-slider-input-width=7ch] - Width of the floating value input above each slider thumb
|
|
51
50
|
*
|
|
52
51
|
* @event {CustomEvent} change - Fires when value changes; in single mode detail is the value string; in range mode detail is { valueStart, valueEnd }
|
|
53
52
|
*/
|
|
@@ -325,7 +324,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
325
324
|
<div class="single-wrapper">
|
|
326
325
|
<input
|
|
327
326
|
aria-label="Slider value"
|
|
328
|
-
style=${styleMap({
|
|
327
|
+
style=${styleMap({ '--zui-slider-track-bg': this.#singleTrackBackground(progress) })}
|
|
329
328
|
type="range"
|
|
330
329
|
.min="${String(this.min)}"
|
|
331
330
|
.max="${String(this.max)}"
|
|
@@ -339,8 +338,8 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
339
338
|
@focus="${this.#h.thumb.show}"
|
|
340
339
|
@blur="${this.#h.thumb.hide}"
|
|
341
340
|
/>
|
|
342
|
-
${this.#renderStepDots()}
|
|
343
341
|
${this.#renderFloatingInput(this.#value, this.#onThumbFloatingInput, this.#onThumbFloatingChange, 'thumb', this.#isVisible('thumb'), progress)}
|
|
342
|
+
${this.#renderStepDots()}
|
|
344
343
|
</div>
|
|
345
344
|
`;
|
|
346
345
|
}
|
|
@@ -348,18 +347,16 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
348
347
|
const progressStart = this.progressStart;
|
|
349
348
|
const progressEnd = this.progressEnd;
|
|
350
349
|
return html `
|
|
351
|
-
<div
|
|
352
|
-
|
|
353
|
-
style=${styleMap({ background: this.#rangeTrackBackground(progressStart, progressEnd) })}
|
|
354
|
-
>
|
|
355
|
-
${this.#renderStepDots()}${this.#renderRangeInput('start')}
|
|
350
|
+
<div class="range-wrapper" @click="${this.#onTrackClick}">
|
|
351
|
+
${this.#renderRangeInput('start', this.#rangeTrackBackground(progressStart, progressEnd))}
|
|
356
352
|
${this.#renderFloatingInput(this.#valueStart, this.#onStartThumbFloatingInput, this.#onStartThumbFloatingChange, 'startThumb', this.#isVisible('startThumb'), progressStart)}
|
|
357
353
|
${this.#renderRangeInput('end')}
|
|
358
354
|
${this.#renderFloatingInput(this.#valueEnd, this.#onEndThumbFloatingInput, this.#onEndThumbFloatingChange, 'endThumb', this.#isVisible('endThumb'), progressEnd)}
|
|
355
|
+
${this.#renderStepDots()}
|
|
359
356
|
</div>
|
|
360
357
|
`;
|
|
361
358
|
}
|
|
362
|
-
#renderRangeInput(which) {
|
|
359
|
+
#renderRangeInput(which, trackBg) {
|
|
363
360
|
const flag = which === 'start' ? 'startThumb' : 'endThumb';
|
|
364
361
|
const val = which === 'start' ? this.#valueStart : this.#valueEnd;
|
|
365
362
|
const onInput = which === 'start' ? this.#onRangeStartInput : this.#onRangeEndInput;
|
|
@@ -372,6 +369,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
372
369
|
aria-label="${which === 'start' ? 'Range start' : 'Range end'}"
|
|
373
370
|
class="range-${which}"
|
|
374
371
|
type="range"
|
|
372
|
+
style=${trackBg ? styleMap({ '--zui-slider-track-bg': trackBg }) : nothing}
|
|
375
373
|
.min="${String(this.min)}"
|
|
376
374
|
.max="${String(this.max)}"
|
|
377
375
|
.step="${this.step > 0 ? String(this.step) : '1'}"
|
|
@@ -529,6 +527,43 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
529
527
|
bubbles: true,
|
|
530
528
|
}));
|
|
531
529
|
}
|
|
530
|
+
#onTrackClick(e) {
|
|
531
|
+
if (this.disabled || this.readOnly) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const wrapper = e.currentTarget;
|
|
535
|
+
const rect = wrapper.getBoundingClientRect();
|
|
536
|
+
// Thumb diameter is 3× the custom property; radius is 1.5×. Track is inset by one radius each side.
|
|
537
|
+
const thumbRadius = 1.5 * parseFloat(getComputedStyle(this).getPropertyValue('--zui-slider-thumb-size'));
|
|
538
|
+
const trackLeft = rect.left + thumbRadius;
|
|
539
|
+
const effectiveWidth = rect.width - 2 * thumbRadius;
|
|
540
|
+
const fraction = Math.max(0, Math.min(1, (e.clientX - trackLeft) / effectiveWidth));
|
|
541
|
+
const rawValue = this.min + fraction * (this.max - this.min);
|
|
542
|
+
// Ignore clicks that land within a thumb's hit area — those bubble up from native input
|
|
543
|
+
// interactions and should not be treated as track clicks.
|
|
544
|
+
const startX = trackLeft + (this.progressStart / 100) * effectiveWidth;
|
|
545
|
+
const endX = trackLeft + (this.progressEnd / 100) * effectiveWidth;
|
|
546
|
+
if (Math.abs(e.clientX - startX) <= thumbRadius || Math.abs(e.clientX - endX) <= thumbRadius) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const snappedStr = this.#processFloatingValue(rawValue);
|
|
550
|
+
const snapped = parseFloat(snappedStr);
|
|
551
|
+
const startNum = parseFloat(this.#valueStart);
|
|
552
|
+
const endNum = parseFloat(this.#valueEnd);
|
|
553
|
+
// Move whichever thumb is closer to the click; prefer start on a tie
|
|
554
|
+
if (Math.abs(rawValue - startNum) <= Math.abs(rawValue - endNum)) {
|
|
555
|
+
if (snapped < endNum) {
|
|
556
|
+
this.valueStart = snappedStr;
|
|
557
|
+
this.#onRangeChange();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
if (snapped > startNum) {
|
|
562
|
+
this.valueEnd = snappedStr;
|
|
563
|
+
this.#onRangeChange();
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
532
567
|
#showThumbInput(flag) {
|
|
533
568
|
if (this.disabled) {
|
|
534
569
|
return;
|
package/dist/zui-slider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zui-slider.js","sourceRoot":"","sources":["../src/zui-slider.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACv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AAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;6CAAoB;AA6V7E,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { ZuiFormAssociatedElement } from '@zywave/zui-base';\nimport { html, nothing, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { live } from 'lit/directives/live.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { style } from './zui-slider-css.js';\n\ntype ThumbFlag = 'thumb' | 'startThumb' | 'endThumb';\n\n/**\n * A range form control for choosing values along a slider.\n * @element zui-slider\n *\n * @attr {string | null} [name=null] - The name of this element that is associated with form submission\n * @attr {boolean} [disabled=false] - Represents whether a user can make changes to this element; if true, the value of this element will be excluded from the form submission\n * @attr {boolean} [readonly=false] - Represents whether a user can make changes to this element; the value of this element will still be included in the form submission\n * @attr {boolean} [autofocus=false] - If true, this element will be focused when connected to the document\n * @attr {number} [value=50] - Represents the value of the input (single mode). Can be set to a default value, and will reflect the value provided by the user when interactive with the control\n * @attr {boolean} [range=false] - Enables range mode with two thumbs for selecting a range\n * @attr {number} [value-start=0] - Represents the start (lower) value in range mode\n * @attr {number} [value-end=100] - Represents the end (upper) value in range mode\n * @attr {number} [min=0] - Represents the minimum permitted value\n * @attr {number} [max=100] - Represents the maximum permitted value\n * @attr {number} [step=0] - Represents the stepping interval; 0 means any value is allowed\n * @attr {boolean} [show-min-max=false] - Shows the min and max values beneath the slider\n *\n * @prop {string | null} [name=null] - The name of this element that is associated with form submission\n * @prop {boolean} [disabled=false] - Represents whether a user can make changes to this element; if true, the value of this element will be excluded from the form submission\n * @prop {boolean} [readOnly=false] - Represents whether a user can make changes to this element; the value of this element will still be included in the form submission\n * @prop {boolean} [autofocus=false] - If true, this element will be focused when connected to the document\n * @prop {number} [valueAsNumber=50] - Returns the value as a number. Invalid or non-numeric values are clamped to min; empty string (representing an in-progress edit) returns NaN\n * @prop {string} [value='50'] - Represents the value of the input (single mode). Can be set to a default value, and will reflect the value provided by the user when interactive with the control\n * @prop {number} [progress=50] - Determines visual placement of the slider thumb along the line (single mode)\n * @prop {boolean} [range=false] - Enables range mode with two thumbs for selecting a range\n * @prop {string} [valueStart='0'] - Represents the start (lower) value in range mode\n * @prop {string} [valueEnd='100'] - Represents the end (upper) value in range mode\n * @prop {number} [progressStart=0] - Determines visual placement of the start thumb in range mode\n * @prop {number} [progressEnd=100] - Determines visual placement of the end thumb in range mode\n * @prop {number} [min=0] - Represents the minimum permitted value\n * @prop {number} [max=100] - Represents the maximum permitted value\n * @prop {number} [step=0] - Represents the stepping interval; 0 means any value is allowed\n * @prop {boolean} [showMinMax=false] - Shows the min and max values beneath the slider\n *\n * @cssprop [--zui-slider-thumb-size=0.875rem (14px)] - Controls the visual dot size and thumb hit-area (hit area is 3× this value)\n * @cssprop [--zui-slider-input-width=7ch] - Width of the floating value input above each thumb\n *\n * @event {CustomEvent} change - Fires when value changes; in single mode detail is the value string; in range mode detail is { valueStart, valueEnd }\n */\nexport class ZuiSlider extends ZuiFormAssociatedElement {\n #defaultValue: string = '50';\n #defaultValueStart: string = '0';\n #defaultValueEnd: string = '100';\n\n #value: string = '50';\n #valueStart: string = '0';\n #valueEnd: string = '100';\n\n #thumbInputState = new Map<\n ThumbFlag,\n {\n visible: boolean;\n focused: boolean;\n timer?: ReturnType<typeof setTimeout>;\n debounceTimer?: ReturnType<typeof setTimeout>;\n }\n >([\n ['thumb', { visible: false, focused: false }],\n ['startThumb', { visible: false, focused: false }],\n ['endThumb', { visible: false, focused: false }],\n ]);\n\n // Pre-bound floating input handlers cached to avoid new function references on every render\n #onThumbFloatingInput = this.#onFloatingInput('thumb', (v) => (this.value = v));\n #onStartThumbFloatingInput = this.#onFloatingInput('startThumb', (v) => (this.valueStart = v));\n #onEndThumbFloatingInput = this.#onFloatingInput('endThumb', (v) => (this.valueEnd = v));\n\n // Cached floating input change handlers — flush debounce and dispatch immediately on commit (Enter/blur)\n #onThumbFloatingChange = this.#makeFloatingChange(\n 'thumb',\n (v) => (this.value = v),\n () => this.#onChange()\n );\n #onStartThumbFloatingChange = this.#makeFloatingChange(\n 'startThumb',\n (v) => (this.valueStart = v),\n () => this.#onRangeChange()\n );\n #onEndThumbFloatingChange = this.#makeFloatingChange(\n 'endThumb',\n (v) => (this.valueEnd = v),\n () => this.#onRangeChange()\n );\n\n // Cached range drag input handlers\n #onRangeStartInput = this.#onRangeInput('start');\n #onRangeEndInput = this.#onRangeInput('end');\n\n // Cached pointer/focus handlers per thumb — prevents new closures on every render\n #h: Record<ThumbFlag, { show: () => void; hide: () => void; focus: () => void; blur: () => void }> = {\n thumb: {\n show: () => this.#showThumbInput('thumb'),\n hide: () => this.#scheduleHideThumbInput('thumb'),\n focus: () => this.#focusFloatingInput('thumb'),\n blur: () => this.#blurFloatingInput('thumb'),\n },\n startThumb: {\n show: () => this.#showThumbInput('startThumb'),\n hide: () => this.#scheduleHideThumbInput('startThumb'),\n focus: () => this.#focusFloatingInput('startThumb'),\n blur: () => this.#blurFloatingInput('startThumb'),\n },\n endThumb: {\n show: () => this.#showThumbInput('endThumb'),\n hide: () => this.#scheduleHideThumbInput('endThumb'),\n focus: () => this.#focusFloatingInput('endThumb'),\n blur: () => this.#blurFloatingInput('endThumb'),\n },\n };\n\n static get styles() {\n return [super.styles, style];\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.updateComplete.then(() => {\n if (this.range) {\n const [startInput, endInput] = this.#rangeInputs();\n this.#valueStart = startInput.value;\n this.#valueEnd = endInput.value;\n this.#defaultValueStart = startInput.value;\n this.#defaultValueEnd = endInput.value;\n this._setFormValue(`${startInput.value},${endInput.value}`);\n } else {\n const input = this.#singleInput();\n this.#value = input.value;\n this.#defaultValue = input.value;\n this._setFormValue(input.value);\n }\n });\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.#clearAllThumbInputState();\n // Schedule a re-render so the cleared visibility state is reflected in the DOM.\n // Lit defers this render until the element reconnects if it is currently disconnected.\n this.requestUpdate();\n }\n\n protected updated(changed: Map<PropertyKey, unknown>) {\n if (changed.has('disabled') && this.disabled) {\n this.#clearAllThumbInputState();\n }\n if (changed.has('min') || changed.has('max')) {\n // The native inputs have already clamped (and step-snapped) their values to the new bounds.\n // Read them back and sync internal state + form value. If the value changed, request a\n // re-render so the floating input (which binds to #value/#valueStart/#valueEnd) stays in sync.\n if (this.range) {\n const [startInput, endInput] = this.#rangeInputs();\n const newStart = startInput.value;\n const newEnd = endInput.value;\n if (newStart !== this.#valueStart || newEnd !== this.#valueEnd) {\n this.#valueStart = newStart;\n this.#valueEnd = newEnd;\n this.requestUpdate();\n }\n this._setFormValue(`${this.#valueStart},${this.#valueEnd}`);\n } else {\n const newValue = this.#singleInput().value;\n if (newValue !== this.#value) {\n this.#value = newValue;\n this.requestUpdate();\n }\n this._setFormValue(this.#value);\n }\n }\n }\n\n #singleInput(): HTMLInputElement {\n return this.shadowRoot!.querySelector<HTMLInputElement>('input[type=\"range\"]')!;\n }\n\n #rangeInputs(): [HTMLInputElement, HTMLInputElement] {\n const inputs = this.shadowRoot!.querySelectorAll<HTMLInputElement>('input[type=\"range\"]');\n return [inputs[0], inputs[1]];\n }\n\n protected get _focusControlSelector() {\n return 'input';\n }\n\n protected get _formValue() {\n return this.range ? `${this.#valueStart},${this.#valueEnd}` : this.#value;\n }\n\n protected formResetCallback() {\n this.#clearAllThumbInputState();\n // Always request a re-render so the cleared thumb visibility is reflected even when the\n // reset value equals the current value (the named setter requestUpdate would be a no-op).\n this.requestUpdate();\n if (this.range) {\n this.valueStart = this.#defaultValueStart;\n this.valueEnd = this.#defaultValueEnd;\n } else {\n this.value = this.#defaultValue;\n }\n }\n\n #clearAllThumbInputState() {\n for (const entry of this.#thumbInputState.values()) {\n clearTimeout(entry.timer);\n clearTimeout(entry.debounceTimer);\n entry.timer = undefined;\n entry.debounceTimer = undefined;\n entry.visible = false;\n entry.focused = false;\n }\n }\n\n /**\n * Clamps a raw string value to the current [min, max] range.\n * Empty string is passed through unchanged (represents an in-progress floating input edit).\n * Non-numeric strings are passed through unchanged.\n */\n #clampToRange(rawVal: string): string {\n if (rawVal === '') {\n return rawVal;\n }\n const num = parseFloat(rawVal);\n if (isNaN(num)) {\n return rawVal;\n }\n return String(Math.min(this.max, Math.max(this.min, num)));\n }\n\n @property()\n get value() {\n return this.#value;\n }\n\n set value(rawVal: string) {\n rawVal = this.#clampToRange(rawVal);\n const oldVal = this.#value;\n this.#value = rawVal;\n this._setFormValue(rawVal);\n this.requestUpdate('value', oldVal);\n }\n\n get valueAsNumber() {\n return parseFloat(this.#value);\n }\n\n /**\n * Enables range mode with two thumbs for selecting a value range\n */\n @property({ type: Boolean }) range = false;\n\n @property({ attribute: 'value-start' })\n get valueStart() {\n return this.#valueStart;\n }\n\n set valueStart(rawVal: string) {\n rawVal = this.#clampToRange(rawVal);\n const oldVal = this.#valueStart;\n this.#valueStart = rawVal;\n this._setFormValue(`${rawVal},${this.#valueEnd}`);\n this.requestUpdate('valueStart', oldVal);\n }\n\n @property({ attribute: 'value-end' })\n get valueEnd() {\n return this.#valueEnd;\n }\n\n set valueEnd(rawVal: string) {\n rawVal = this.#clampToRange(rawVal);\n const oldVal = this.#valueEnd;\n this.#valueEnd = rawVal;\n this._setFormValue(`${this.#valueStart},${rawVal}`);\n this.requestUpdate('valueEnd', oldVal);\n }\n\n /**\n * Represents the minimum permitted value\n */\n @property({ type: Number }) min = 0;\n\n /**\n * Represents the maximum permitted value\n */\n @property({ type: Number }) max = 100;\n\n /**\n * Represents the stepping interval, used both for user interface and validation purposes\n */\n @property({ type: Number }) step = 0;\n\n /**\n * Shows the min and max values beneath the slider\n */\n @property({ type: Boolean, attribute: 'show-min-max' }) showMinMax = false;\n\n get #range() {\n return this.max - this.min;\n }\n\n get #progressColor() {\n return this.disabled ? 'var(--zui-gray)' : 'var(--zui-blue)';\n }\n\n #isVisible(flag: ThumbFlag): boolean {\n return this.#thumbInputState.get(flag)!.visible && !this.disabled;\n }\n\n get progress() {\n return this.#computeProgress(this.#value);\n }\n\n get progressStart() {\n return this.#computeProgress(this.#valueStart);\n }\n\n get progressEnd() {\n return this.#computeProgress(this.#valueEnd);\n }\n\n #computeProgress(rawValue: string): number {\n if (this.#range === 0) {\n return 0;\n }\n const num = parseFloat(rawValue);\n return isNaN(num) ? 0 : parseFloat((((num - this.min) / this.#range) * 100).toFixed(4));\n }\n\n #singleTrackBackground(progress: number): string {\n const c = this.#progressColor;\n const stop = ZuiSlider.#thumbPositionCSS(progress);\n return `linear-gradient(to right, transparent var(--zui-slider-thumb-size), ${c} var(--zui-slider-thumb-size), ${c} ${stop}, var(--zui-gray-200) ${stop}, var(--zui-gray-200) calc(100% - var(--zui-slider-thumb-size)), transparent calc(100% - var(--zui-slider-thumb-size)))`;\n }\n\n #rangeTrackBackground(progressStart: number, progressEnd: number): string {\n const c = this.#progressColor;\n const startStop = ZuiSlider.#thumbPositionCSS(progressStart);\n const endStop = ZuiSlider.#thumbPositionCSS(progressEnd);\n return `linear-gradient(to right, transparent var(--zui-slider-thumb-size), var(--zui-gray-200) var(--zui-slider-thumb-size), var(--zui-gray-200) ${startStop}, ${c} ${startStop}, ${c} ${endStop}, var(--zui-gray-200) ${endStop}, var(--zui-gray-200) calc(100% - var(--zui-slider-thumb-size)), transparent calc(100% - var(--zui-slider-thumb-size)))`;\n }\n\n render() {\n return html`${this.range ? this.#renderRange() : this.#renderSingle()}${this.#renderMinMaxLabels()}`;\n }\n\n #renderSingle() {\n const progress = this.progress;\n return html`\n <div class=\"single-wrapper\">\n <input\n aria-label=\"Slider value\"\n style=${styleMap({ background: this.#singleTrackBackground(progress) })}\n type=\"range\"\n .min=\"${String(this.min)}\"\n .max=\"${String(this.max)}\"\n .step=\"${this.step > 0 ? String(this.step) : '1'}\"\n .value=\"${this.#value}\"\n ?disabled=\"${this.disabled || this.readOnly}\"\n @input=\"${this.#onInput}\"\n @change=\"${this.#onChange}\"\n @pointerenter=\"${this.#h.thumb.show}\"\n @pointerleave=\"${this.#h.thumb.hide}\"\n @focus=\"${this.#h.thumb.show}\"\n @blur=\"${this.#h.thumb.hide}\"\n />\n ${this.#renderStepDots()}\n ${this.#renderFloatingInput(\n this.#value,\n this.#onThumbFloatingInput,\n this.#onThumbFloatingChange,\n 'thumb',\n this.#isVisible('thumb'),\n progress\n )}\n </div>\n `;\n }\n\n #renderRange() {\n const progressStart = this.progressStart;\n const progressEnd = this.progressEnd;\n return html`\n <div\n class=\"range-wrapper\"\n style=${styleMap({ background: this.#rangeTrackBackground(progressStart, progressEnd) })}\n >\n ${this.#renderStepDots()}${this.#renderRangeInput('start')}\n ${this.#renderFloatingInput(\n this.#valueStart,\n this.#onStartThumbFloatingInput,\n this.#onStartThumbFloatingChange,\n 'startThumb',\n this.#isVisible('startThumb'),\n progressStart\n )}\n ${this.#renderRangeInput('end')}\n ${this.#renderFloatingInput(\n this.#valueEnd,\n this.#onEndThumbFloatingInput,\n this.#onEndThumbFloatingChange,\n 'endThumb',\n this.#isVisible('endThumb'),\n progressEnd\n )}\n </div>\n `;\n }\n\n #renderRangeInput(which: 'start' | 'end') {\n const flag: ThumbFlag = which === 'start' ? 'startThumb' : 'endThumb';\n const val = which === 'start' ? this.#valueStart : this.#valueEnd;\n const onInput = which === 'start' ? this.#onRangeStartInput : this.#onRangeEndInput;\n const h = this.#h[flag];\n // live() is required: when #onRangeInput snaps the DOM value back via direct input.value\n // assignment (drag past the other thumb), there is no state change → no re-render. live()\n // forces Lit to re-read the current DOM value and re-sync it on every render.\n return html`\n <input\n aria-label=\"${which === 'start' ? 'Range start' : 'Range end'}\"\n class=\"range-${which}\"\n type=\"range\"\n .min=\"${String(this.min)}\"\n .max=\"${String(this.max)}\"\n .step=\"${this.step > 0 ? String(this.step) : '1'}\"\n .value=\"${live(val)}\"\n ?disabled=\"${this.disabled || this.readOnly}\"\n @input=\"${onInput}\"\n @change=\"${this.#onRangeChange}\"\n @pointerenter=\"${h.show}\"\n @pointerleave=\"${h.hide}\"\n @focus=\"${h.show}\"\n @blur=\"${h.hide}\"\n />\n `;\n }\n\n #renderFloatingInput(\n val: string,\n onInput: (e: Event) => void,\n onFloatingChange: (e: Event) => void,\n flag: ThumbFlag,\n visible: boolean,\n progress: number\n ) {\n const h = this.#h[flag];\n // live() is required on the number input: when the debounced setter clamps a value to the\n // same string it already holds (e.g. typing 150 when max=100 clamps back to '100'), no\n // reactive property change occurs and Lit skips the DOM update. live() forces a re-read.\n return html`\n <div\n class=${classMap({ 'thumb-input': true, 'thumb-input--visible': visible })}\n style=${styleMap({ left: ZuiSlider.#thumbPositionCSS(progress) })}\n @pointerenter=\"${h.show}\"\n @pointerleave=\"${h.hide}\"\n >\n <input\n aria-label=\"${flag === 'startThumb'\n ? 'Range start value'\n : flag === 'endThumb'\n ? 'Range end value'\n : 'Slider value'}\"\n type=\"number\"\n .value=\"${live(val)}\"\n .min=\"${String(this.min)}\"\n .max=\"${String(this.max)}\"\n .step=\"${this.step > 0 ? String(this.step) : '1'}\"\n ?disabled=\"${this.disabled}\"\n ?readonly=\"${this.readOnly}\"\n @input=\"${onInput}\"\n @change=\"${onFloatingChange}\"\n @focus=\"${h.focus}\"\n @blur=\"${h.blur}\"\n />\n </div>\n `;\n }\n\n #renderStepDots() {\n if (this.step <= 0 || this.#range === 0) {\n return nothing;\n }\n const count = Math.round(this.#range / this.step);\n if (count > 100) {\n return nothing;\n }\n const dots: TemplateResult[] = [];\n for (let i = 0; i <= count; i++) {\n let left: string;\n if (i === 0) {\n left = 'var(--zui-slider-thumb-size)';\n } else if (i === count) {\n left = 'calc(100% - var(--zui-slider-thumb-size))';\n } else {\n const pos = parseFloat((((i * this.step) / this.#range) * 100).toFixed(4));\n left = ZuiSlider.#thumbPositionCSS(pos);\n }\n dots.push(html`<span class=\"step-dot\" style=\"left: ${left}\"></span>`);\n }\n return html`<div class=\"step-dots\">${dots}</div>`;\n }\n\n #renderMinMaxLabels() {\n if (!this.showMinMax) {\n return nothing;\n }\n return html`\n <div class=\"min-max-labels\">\n <span class=\"min-max-label\">${this.min}</span>\n <span class=\"min-max-label\">${this.max}</span>\n </div>\n `;\n }\n\n #onInput(e: Event) {\n if (this.readOnly) {\n return;\n }\n this.value = (e.target as HTMLInputElement).value;\n }\n\n #onChange() {\n this.dispatchEvent(new CustomEvent('change', { detail: this.#value, bubbles: true }));\n }\n\n #processFloatingValue(raw: number): string {\n const stepDecimals = this.step > 0 ? (String(this.step).split('.')[1] ?? '').length : 0;\n const stepped = this.step > 0 ? Math.round((raw - this.min) / this.step) * this.step + this.min : raw;\n const clamped = Math.min(this.max, Math.max(this.min, stepped));\n return stepDecimals > 0 ? clamped.toFixed(stepDecimals) : String(Math.round(clamped));\n }\n\n #makeFloatingChange(flag: ThumbFlag, setter: (val: string) => void, dispatch: () => void) {\n return (e: Event) => {\n if (this.readOnly) {\n return;\n }\n const input = e.target as HTMLInputElement;\n if (input.value === '') {\n return;\n }\n const entry = this.#thumbInputState.get(flag)!;\n clearTimeout(entry.debounceTimer);\n entry.debounceTimer = undefined;\n setter(this.#processFloatingValue(parseFloat(input.value)));\n dispatch();\n };\n }\n\n #onFloatingInput(flag: ThumbFlag, setter: (val: string) => void) {\n return (e: Event) => {\n if (this.readOnly) {\n return;\n }\n const input = e.target as HTMLInputElement;\n if (input.value === '') {\n return;\n }\n const raw = parseFloat(input.value);\n const entry = this.#thumbInputState.get(flag)!;\n clearTimeout(entry.debounceTimer);\n entry.debounceTimer = setTimeout(() => setter(this.#processFloatingValue(raw)), 300);\n };\n }\n\n #onRangeInput(which: 'start' | 'end') {\n return (e: Event) => {\n if (this.readOnly) {\n return;\n }\n const input = e.target as HTMLInputElement;\n if (which === 'start') {\n if (parseFloat(input.value) >= parseFloat(this.#valueEnd)) {\n input.value = this.#valueStart;\n return;\n }\n this.valueStart = input.value;\n } else {\n if (parseFloat(input.value) <= parseFloat(this.#valueStart)) {\n input.value = this.#valueEnd;\n return;\n }\n this.valueEnd = input.value;\n }\n };\n }\n\n #onRangeChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: { valueStart: this.#valueStart, valueEnd: this.#valueEnd },\n bubbles: true,\n })\n );\n }\n\n #showThumbInput(flag: ThumbFlag) {\n if (this.disabled) {\n return;\n }\n const entry = this.#thumbInputState.get(flag)!;\n clearTimeout(entry.timer);\n entry.timer = undefined;\n entry.visible = true;\n this.requestUpdate();\n }\n\n #scheduleHideThumbInput(flag: ThumbFlag) {\n const entry = this.#thumbInputState.get(flag)!;\n clearTimeout(entry.timer);\n entry.timer = setTimeout(() => {\n if (!entry.focused) {\n entry.visible = false;\n this.requestUpdate();\n }\n }, 100);\n }\n\n #focusFloatingInput(flag: ThumbFlag) {\n if (this.disabled) {\n return;\n }\n this.#showThumbInput(flag);\n this.#thumbInputState.get(flag)!.focused = true;\n }\n\n #blurFloatingInput(flag: ThumbFlag) {\n const entry = this.#thumbInputState.get(flag)!;\n entry.focused = false;\n this.#scheduleHideThumbInput(flag);\n }\n\n // Maps a 0–100 progress value to a CSS multiplier for --zui-slider-thumb-size so that\n // `progress% + thumbSize * offset` lands on the thumb center within the inset wrapper.\n // At 0%: offset=1.5 → thumbSize*1.5 (thumb center at min). At 100%: offset=-1.5 → -thumbSize*1.5 (thumb center at max).\n static #thumbCenterOffset(progress: number): number {\n return 1.5 - (3 * progress) / 100;\n }\n\n static #thumbPositionCSS(progress: number): string {\n return `calc(${progress}% + var(--zui-slider-thumb-size) * ${ZuiSlider.#thumbCenterOffset(progress)})`;\n }\n}\n\nwindow.customElements.define('zui-slider', ZuiSlider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-slider': ZuiSlider;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"zui-slider.js","sourceRoot":"","sources":["../src/zui-slider.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,OAAO,E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othing, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { live } from 'lit/directives/live.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { style } from './zui-slider-css.js';\n\ntype ThumbFlag = 'thumb' | 'startThumb' | 'endThumb';\n\n/**\n * A range form control for choosing values along a slider.\n * @element zui-slider\n *\n * @attr {string | null} [name=null] - The name of this element that is associated with form submission\n * @attr {boolean} [disabled=false] - Represents whether a user can make changes to this element; if true, the value of this element will be excluded from the form submission\n * @attr {boolean} [readonly=false] - Represents whether a user can make changes to this element; the value of this element will still be included in the form submission\n * @attr {boolean} [autofocus=false] - If true, this element will be focused when connected to the document\n * @attr {number} [value=50] - Represents the value of the input (single mode). Can be set to a default value, and will reflect the value provided by the user when interactive with the control\n * @attr {boolean} [range=false] - Enables range mode with two thumbs for selecting a range\n * @attr {number} [value-start=0] - Represents the start (lower) value in range mode\n * @attr {number} [value-end=100] - Represents the end (upper) value in range mode\n * @attr {number} [min=0] - Represents the minimum permitted value\n * @attr {number} [max=100] - Represents the maximum permitted value\n * @attr {number} [step=0] - Represents the stepping interval; 0 means any value is allowed\n * @attr {boolean} [show-min-max=false] - Shows the min and max values beneath the slider\n *\n * @prop {string | null} [name=null] - The name of this element that is associated with form submission\n * @prop {boolean} [disabled=false] - Represents whether a user can make changes to this element; if true, the value of this element will be excluded from the form submission\n * @prop {boolean} [readOnly=false] - Represents whether a user can make changes to this element; the value of this element will still be included in the form submission\n * @prop {boolean} [autofocus=false] - If true, this element will be focused when connected to the document\n * @prop {number} [valueAsNumber=50] - Returns the value as a number. Invalid or non-numeric values are clamped to min; empty string (representing an in-progress edit) returns NaN\n * @prop {string} [value='50'] - Represents the value of the input (single mode). Can be set to a default value, and will reflect the value provided by the user when interactive with the control\n * @prop {number} [progress=50] - Determines visual placement of the slider thumb along the line (single mode)\n * @prop {boolean} [range=false] - Enables range mode with two thumbs for selecting a range\n * @prop {string} [valueStart='0'] - Represents the start (lower) value in range mode\n * @prop {string} [valueEnd='100'] - Represents the end (upper) value in range mode\n * @prop {number} [progressStart=0] - Determines visual placement of the start thumb in range mode\n * @prop {number} [progressEnd=100] - Determines visual placement of the end thumb in range mode\n * @prop {number} [min=0] - Represents the minimum permitted value\n * @prop {number} [max=100] - Represents the maximum permitted value\n * @prop {number} [step=0] - Represents the stepping interval; 0 means any value is allowed\n * @prop {boolean} [showMinMax=false] - Shows the min and max values beneath the slider\n *\n * @cssprop [--zui-slider-input-width=7ch] - Width of the floating value input above each slider thumb\n *\n * @event {CustomEvent} change - Fires when value changes; in single mode detail is the value string; in range mode detail is { valueStart, valueEnd }\n */\nexport class ZuiSlider extends ZuiFormAssociatedElement {\n #defaultValue: string = '50';\n #defaultValueStart: string = '0';\n #defaultValueEnd: string = '100';\n\n #value: string = '50';\n #valueStart: string = '0';\n #valueEnd: string = '100';\n\n #thumbInputState = new Map<\n ThumbFlag,\n {\n visible: boolean;\n focused: boolean;\n timer?: ReturnType<typeof setTimeout>;\n debounceTimer?: ReturnType<typeof setTimeout>;\n }\n >([\n ['thumb', { visible: false, focused: false }],\n ['startThumb', { visible: false, focused: false }],\n ['endThumb', { visible: false, focused: false }],\n ]);\n\n // Pre-bound floating input handlers cached to avoid new function references on every render\n #onThumbFloatingInput = this.#onFloatingInput('thumb', (v) => (this.value = v));\n #onStartThumbFloatingInput = this.#onFloatingInput('startThumb', (v) => (this.valueStart = v));\n #onEndThumbFloatingInput = this.#onFloatingInput('endThumb', (v) => (this.valueEnd = v));\n\n // Cached floating input change handlers — flush debounce and dispatch immediately on commit (Enter/blur)\n #onThumbFloatingChange = this.#makeFloatingChange(\n 'thumb',\n (v) => (this.value = v),\n () => this.#onChange()\n );\n #onStartThumbFloatingChange = this.#makeFloatingChange(\n 'startThumb',\n (v) => (this.valueStart = v),\n () => this.#onRangeChange()\n );\n #onEndThumbFloatingChange = this.#makeFloatingChange(\n 'endThumb',\n (v) => (this.valueEnd = v),\n () => this.#onRangeChange()\n );\n\n // Cached range drag input handlers\n #onRangeStartInput = this.#onRangeInput('start');\n #onRangeEndInput = this.#onRangeInput('end');\n\n // Cached pointer/focus handlers per thumb — prevents new closures on every render\n #h: Record<ThumbFlag, { show: () => void; hide: () => void; focus: () => void; blur: () => void }> = {\n thumb: {\n show: () => this.#showThumbInput('thumb'),\n hide: () => this.#scheduleHideThumbInput('thumb'),\n focus: () => this.#focusFloatingInput('thumb'),\n blur: () => this.#blurFloatingInput('thumb'),\n },\n startThumb: {\n show: () => this.#showThumbInput('startThumb'),\n hide: () => this.#scheduleHideThumbInput('startThumb'),\n focus: () => this.#focusFloatingInput('startThumb'),\n blur: () => this.#blurFloatingInput('startThumb'),\n },\n endThumb: {\n show: () => this.#showThumbInput('endThumb'),\n hide: () => this.#scheduleHideThumbInput('endThumb'),\n focus: () => this.#focusFloatingInput('endThumb'),\n blur: () => this.#blurFloatingInput('endThumb'),\n },\n };\n\n static get styles() {\n return [super.styles, style];\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.updateComplete.then(() => {\n if (this.range) {\n const [startInput, endInput] = this.#rangeInputs();\n this.#valueStart = startInput.value;\n this.#valueEnd = endInput.value;\n this.#defaultValueStart = startInput.value;\n this.#defaultValueEnd = endInput.value;\n this._setFormValue(`${startInput.value},${endInput.value}`);\n } else {\n const input = this.#singleInput();\n this.#value = input.value;\n this.#defaultValue = input.value;\n this._setFormValue(input.value);\n }\n });\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.#clearAllThumbInputState();\n // Schedule a re-render so the cleared visibility state is reflected in the DOM.\n // Lit defers this render until the element reconnects if it is currently disconnected.\n this.requestUpdate();\n }\n\n protected updated(changed: Map<PropertyKey, unknown>) {\n if (changed.has('disabled') && this.disabled) {\n this.#clearAllThumbInputState();\n }\n if (changed.has('min') || changed.has('max')) {\n // The native inputs have already clamped (and step-snapped) their values to the new bounds.\n // Read them back and sync internal state + form value. If the value changed, request a\n // re-render so the floating input (which binds to #value/#valueStart/#valueEnd) stays in sync.\n if (this.range) {\n const [startInput, endInput] = this.#rangeInputs();\n const newStart = startInput.value;\n const newEnd = endInput.value;\n if (newStart !== this.#valueStart || newEnd !== this.#valueEnd) {\n this.#valueStart = newStart;\n this.#valueEnd = newEnd;\n this.requestUpdate();\n }\n this._setFormValue(`${this.#valueStart},${this.#valueEnd}`);\n } else {\n const newValue = this.#singleInput().value;\n if (newValue !== this.#value) {\n this.#value = newValue;\n this.requestUpdate();\n }\n this._setFormValue(this.#value);\n }\n }\n }\n\n #singleInput(): HTMLInputElement {\n return this.shadowRoot!.querySelector<HTMLInputElement>('input[type=\"range\"]')!;\n }\n\n #rangeInputs(): [HTMLInputElement, HTMLInputElement] {\n const inputs = this.shadowRoot!.querySelectorAll<HTMLInputElement>('input[type=\"range\"]');\n return [inputs[0], inputs[1]];\n }\n\n protected get _focusControlSelector() {\n return 'input';\n }\n\n protected get _formValue() {\n return this.range ? `${this.#valueStart},${this.#valueEnd}` : this.#value;\n }\n\n protected formResetCallback() {\n this.#clearAllThumbInputState();\n // Always request a re-render so the cleared thumb visibility is reflected even when the\n // reset value equals the current value (the named setter requestUpdate would be a no-op).\n this.requestUpdate();\n if (this.range) {\n this.valueStart = this.#defaultValueStart;\n this.valueEnd = this.#defaultValueEnd;\n } else {\n this.value = this.#defaultValue;\n }\n }\n\n #clearAllThumbInputState() {\n for (const entry of this.#thumbInputState.values()) {\n clearTimeout(entry.timer);\n clearTimeout(entry.debounceTimer);\n entry.timer = undefined;\n entry.debounceTimer = undefined;\n entry.visible = false;\n entry.focused = false;\n }\n }\n\n /**\n * Clamps a raw string value to the current [min, max] range.\n * Empty string is passed through unchanged (represents an in-progress floating input edit).\n * Non-numeric strings are passed through unchanged.\n */\n #clampToRange(rawVal: string): string {\n if (rawVal === '') {\n return rawVal;\n }\n const num = parseFloat(rawVal);\n if (isNaN(num)) {\n return rawVal;\n }\n return String(Math.min(this.max, Math.max(this.min, num)));\n }\n\n @property()\n get value() {\n return this.#value;\n }\n\n set value(rawVal: string) {\n rawVal = this.#clampToRange(rawVal);\n const oldVal = this.#value;\n this.#value = rawVal;\n this._setFormValue(rawVal);\n this.requestUpdate('value', oldVal);\n }\n\n get valueAsNumber() {\n return parseFloat(this.#value);\n }\n\n /**\n * Enables range mode with two thumbs for selecting a value range\n */\n @property({ type: Boolean }) range = false;\n\n @property({ attribute: 'value-start' })\n get valueStart() {\n return this.#valueStart;\n }\n\n set valueStart(rawVal: string) {\n rawVal = this.#clampToRange(rawVal);\n const oldVal = this.#valueStart;\n this.#valueStart = rawVal;\n this._setFormValue(`${rawVal},${this.#valueEnd}`);\n this.requestUpdate('valueStart', oldVal);\n }\n\n @property({ attribute: 'value-end' })\n get valueEnd() {\n return this.#valueEnd;\n }\n\n set valueEnd(rawVal: string) {\n rawVal = this.#clampToRange(rawVal);\n const oldVal = this.#valueEnd;\n this.#valueEnd = rawVal;\n this._setFormValue(`${this.#valueStart},${rawVal}`);\n this.requestUpdate('valueEnd', oldVal);\n }\n\n /**\n * Represents the minimum permitted value\n */\n @property({ type: Number }) min = 0;\n\n /**\n * Represents the maximum permitted value\n */\n @property({ type: Number }) max = 100;\n\n /**\n * Represents the stepping interval, used both for user interface and validation purposes\n */\n @property({ type: Number }) step = 0;\n\n /**\n * Shows the min and max values beneath the slider\n */\n @property({ type: Boolean, attribute: 'show-min-max' }) showMinMax = false;\n\n get #range() {\n return this.max - this.min;\n }\n\n get #progressColor() {\n return this.disabled ? 'var(--zui-gray)' : 'var(--zui-blue)';\n }\n\n #isVisible(flag: ThumbFlag): boolean {\n return this.#thumbInputState.get(flag)!.visible && !this.disabled;\n }\n\n get progress() {\n return this.#computeProgress(this.#value);\n }\n\n get progressStart() {\n return this.#computeProgress(this.#valueStart);\n }\n\n get progressEnd() {\n return this.#computeProgress(this.#valueEnd);\n }\n\n #computeProgress(rawValue: string): number {\n if (this.#range === 0) {\n return 0;\n }\n const num = parseFloat(rawValue);\n return isNaN(num) ? 0 : parseFloat((((num - this.min) / this.#range) * 100).toFixed(4));\n }\n\n #singleTrackBackground(progress: number): string {\n const c = this.#progressColor;\n const stop = ZuiSlider.#thumbPositionCSS(progress);\n return `linear-gradient(to right, transparent var(--zui-slider-thumb-size), ${c} var(--zui-slider-thumb-size), ${c} ${stop}, var(--zui-gray-200) ${stop}, var(--zui-gray-200) calc(100% - var(--zui-slider-thumb-size)), transparent calc(100% - var(--zui-slider-thumb-size)))`;\n }\n\n #rangeTrackBackground(progressStart: number, progressEnd: number): string {\n const c = this.#progressColor;\n const startStop = ZuiSlider.#thumbPositionCSS(progressStart);\n const endStop = ZuiSlider.#thumbPositionCSS(progressEnd);\n return `linear-gradient(to right, transparent var(--zui-slider-thumb-size), var(--zui-gray-200) var(--zui-slider-thumb-size), var(--zui-gray-200) ${startStop}, ${c} ${startStop}, ${c} ${endStop}, var(--zui-gray-200) ${endStop}, var(--zui-gray-200) calc(100% - var(--zui-slider-thumb-size)), transparent calc(100% - var(--zui-slider-thumb-size)))`;\n }\n\n render() {\n return html`${this.range ? this.#renderRange() : this.#renderSingle()}${this.#renderMinMaxLabels()}`;\n }\n\n #renderSingle() {\n const progress = this.progress;\n return html`\n <div class=\"single-wrapper\">\n <input\n aria-label=\"Slider value\"\n style=${styleMap({ '--zui-slider-track-bg': this.#singleTrackBackground(progress) })}\n type=\"range\"\n .min=\"${String(this.min)}\"\n .max=\"${String(this.max)}\"\n .step=\"${this.step > 0 ? String(this.step) : '1'}\"\n .value=\"${this.#value}\"\n ?disabled=\"${this.disabled || this.readOnly}\"\n @input=\"${this.#onInput}\"\n @change=\"${this.#onChange}\"\n @pointerenter=\"${this.#h.thumb.show}\"\n @pointerleave=\"${this.#h.thumb.hide}\"\n @focus=\"${this.#h.thumb.show}\"\n @blur=\"${this.#h.thumb.hide}\"\n />\n ${this.#renderFloatingInput(\n this.#value,\n this.#onThumbFloatingInput,\n this.#onThumbFloatingChange,\n 'thumb',\n this.#isVisible('thumb'),\n progress\n )}\n ${this.#renderStepDots()}\n </div>\n `;\n }\n\n #renderRange() {\n const progressStart = this.progressStart;\n const progressEnd = this.progressEnd;\n return html`\n <div class=\"range-wrapper\" @click=\"${this.#onTrackClick}\">\n ${this.#renderRangeInput('start', this.#rangeTrackBackground(progressStart, progressEnd))}\n ${this.#renderFloatingInput(\n this.#valueStart,\n this.#onStartThumbFloatingInput,\n this.#onStartThumbFloatingChange,\n 'startThumb',\n this.#isVisible('startThumb'),\n progressStart\n )}\n ${this.#renderRangeInput('end')}\n ${this.#renderFloatingInput(\n this.#valueEnd,\n this.#onEndThumbFloatingInput,\n this.#onEndThumbFloatingChange,\n 'endThumb',\n this.#isVisible('endThumb'),\n progressEnd\n )}\n ${this.#renderStepDots()}\n </div>\n `;\n }\n\n #renderRangeInput(which: 'start' | 'end', trackBg?: string) {\n const flag: ThumbFlag = which === 'start' ? 'startThumb' : 'endThumb';\n const val = which === 'start' ? this.#valueStart : this.#valueEnd;\n const onInput = which === 'start' ? this.#onRangeStartInput : this.#onRangeEndInput;\n const h = this.#h[flag];\n // live() is required: when #onRangeInput snaps the DOM value back via direct input.value\n // assignment (drag past the other thumb), there is no state change → no re-render. live()\n // forces Lit to re-read the current DOM value and re-sync it on every render.\n return html`\n <input\n aria-label=\"${which === 'start' ? 'Range start' : 'Range end'}\"\n class=\"range-${which}\"\n type=\"range\"\n style=${trackBg ? styleMap({ '--zui-slider-track-bg': trackBg }) : nothing}\n .min=\"${String(this.min)}\"\n .max=\"${String(this.max)}\"\n .step=\"${this.step > 0 ? String(this.step) : '1'}\"\n .value=\"${live(val)}\"\n ?disabled=\"${this.disabled || this.readOnly}\"\n @input=\"${onInput}\"\n @change=\"${this.#onRangeChange}\"\n @pointerenter=\"${h.show}\"\n @pointerleave=\"${h.hide}\"\n @focus=\"${h.show}\"\n @blur=\"${h.hide}\"\n />\n `;\n }\n\n #renderFloatingInput(\n val: string,\n onInput: (e: Event) => void,\n onFloatingChange: (e: Event) => void,\n flag: ThumbFlag,\n visible: boolean,\n progress: number\n ) {\n const h = this.#h[flag];\n // live() is required on the number input: when the debounced setter clamps a value to the\n // same string it already holds (e.g. typing 150 when max=100 clamps back to '100'), no\n // reactive property change occurs and Lit skips the DOM update. live() forces a re-read.\n return html`\n <div\n class=${classMap({ 'thumb-input': true, 'thumb-input--visible': visible })}\n style=${styleMap({ left: ZuiSlider.#thumbPositionCSS(progress) })}\n @pointerenter=\"${h.show}\"\n @pointerleave=\"${h.hide}\"\n >\n <input\n aria-label=\"${flag === 'startThumb'\n ? 'Range start value'\n : flag === 'endThumb'\n ? 'Range end value'\n : 'Slider value'}\"\n type=\"number\"\n .value=\"${live(val)}\"\n .min=\"${String(this.min)}\"\n .max=\"${String(this.max)}\"\n .step=\"${this.step > 0 ? String(this.step) : '1'}\"\n ?disabled=\"${this.disabled}\"\n ?readonly=\"${this.readOnly}\"\n @input=\"${onInput}\"\n @change=\"${onFloatingChange}\"\n @focus=\"${h.focus}\"\n @blur=\"${h.blur}\"\n />\n </div>\n `;\n }\n\n #renderStepDots() {\n if (this.step <= 0 || this.#range === 0) {\n return nothing;\n }\n const count = Math.round(this.#range / this.step);\n if (count > 100) {\n return nothing;\n }\n const dots: TemplateResult[] = [];\n for (let i = 0; i <= count; i++) {\n let left: string;\n if (i === 0) {\n left = 'var(--zui-slider-thumb-size)';\n } else if (i === count) {\n left = 'calc(100% - var(--zui-slider-thumb-size))';\n } else {\n const pos = parseFloat((((i * this.step) / this.#range) * 100).toFixed(4));\n left = ZuiSlider.#thumbPositionCSS(pos);\n }\n dots.push(html`<span class=\"step-dot\" style=\"left: ${left}\"></span>`);\n }\n return html`<div class=\"step-dots\">${dots}</div>`;\n }\n\n #renderMinMaxLabels() {\n if (!this.showMinMax) {\n return nothing;\n }\n return html`\n <div class=\"min-max-labels\">\n <span class=\"min-max-label\">${this.min}</span>\n <span class=\"min-max-label\">${this.max}</span>\n </div>\n `;\n }\n\n #onInput(e: Event) {\n if (this.readOnly) {\n return;\n }\n this.value = (e.target as HTMLInputElement).value;\n }\n\n #onChange() {\n this.dispatchEvent(new CustomEvent('change', { detail: this.#value, bubbles: true }));\n }\n\n #processFloatingValue(raw: number): string {\n const stepDecimals = this.step > 0 ? (String(this.step).split('.')[1] ?? '').length : 0;\n const stepped = this.step > 0 ? Math.round((raw - this.min) / this.step) * this.step + this.min : raw;\n const clamped = Math.min(this.max, Math.max(this.min, stepped));\n return stepDecimals > 0 ? clamped.toFixed(stepDecimals) : String(Math.round(clamped));\n }\n\n #makeFloatingChange(flag: ThumbFlag, setter: (val: string) => void, dispatch: () => void) {\n return (e: Event) => {\n if (this.readOnly) {\n return;\n }\n const input = e.target as HTMLInputElement;\n if (input.value === '') {\n return;\n }\n const entry = this.#thumbInputState.get(flag)!;\n clearTimeout(entry.debounceTimer);\n entry.debounceTimer = undefined;\n setter(this.#processFloatingValue(parseFloat(input.value)));\n dispatch();\n };\n }\n\n #onFloatingInput(flag: ThumbFlag, setter: (val: string) => void) {\n return (e: Event) => {\n if (this.readOnly) {\n return;\n }\n const input = e.target as HTMLInputElement;\n if (input.value === '') {\n return;\n }\n const raw = parseFloat(input.value);\n const entry = this.#thumbInputState.get(flag)!;\n clearTimeout(entry.debounceTimer);\n entry.debounceTimer = setTimeout(() => setter(this.#processFloatingValue(raw)), 300);\n };\n }\n\n #onRangeInput(which: 'start' | 'end') {\n return (e: Event) => {\n if (this.readOnly) {\n return;\n }\n const input = e.target as HTMLInputElement;\n if (which === 'start') {\n if (parseFloat(input.value) >= parseFloat(this.#valueEnd)) {\n input.value = this.#valueStart;\n return;\n }\n this.valueStart = input.value;\n } else {\n if (parseFloat(input.value) <= parseFloat(this.#valueStart)) {\n input.value = this.#valueEnd;\n return;\n }\n this.valueEnd = input.value;\n }\n };\n }\n\n #onRangeChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: { valueStart: this.#valueStart, valueEnd: this.#valueEnd },\n bubbles: true,\n })\n );\n }\n\n #onTrackClick(e: MouseEvent) {\n if (this.disabled || this.readOnly) {\n return;\n }\n\n const wrapper = e.currentTarget as HTMLElement;\n const rect = wrapper.getBoundingClientRect();\n // Thumb diameter is 3× the custom property; radius is 1.5×. Track is inset by one radius each side.\n const thumbRadius = 1.5 * parseFloat(getComputedStyle(this).getPropertyValue('--zui-slider-thumb-size'));\n const trackLeft = rect.left + thumbRadius;\n const effectiveWidth = rect.width - 2 * thumbRadius;\n const fraction = Math.max(0, Math.min(1, (e.clientX - trackLeft) / effectiveWidth));\n const rawValue = this.min + fraction * (this.max - this.min);\n\n // Ignore clicks that land within a thumb's hit area — those bubble up from native input\n // interactions and should not be treated as track clicks.\n const startX = trackLeft + (this.progressStart / 100) * effectiveWidth;\n const endX = trackLeft + (this.progressEnd / 100) * effectiveWidth;\n if (Math.abs(e.clientX - startX) <= thumbRadius || Math.abs(e.clientX - endX) <= thumbRadius) {\n return;\n }\n\n const snappedStr = this.#processFloatingValue(rawValue);\n const snapped = parseFloat(snappedStr);\n const startNum = parseFloat(this.#valueStart);\n const endNum = parseFloat(this.#valueEnd);\n\n // Move whichever thumb is closer to the click; prefer start on a tie\n if (Math.abs(rawValue - startNum) <= Math.abs(rawValue - endNum)) {\n if (snapped < endNum) {\n this.valueStart = snappedStr;\n this.#onRangeChange();\n }\n } else {\n if (snapped > startNum) {\n this.valueEnd = snappedStr;\n this.#onRangeChange();\n }\n }\n }\n\n #showThumbInput(flag: ThumbFlag) {\n if (this.disabled) {\n return;\n }\n const entry = this.#thumbInputState.get(flag)!;\n clearTimeout(entry.timer);\n entry.timer = undefined;\n entry.visible = true;\n this.requestUpdate();\n }\n\n #scheduleHideThumbInput(flag: ThumbFlag) {\n const entry = this.#thumbInputState.get(flag)!;\n clearTimeout(entry.timer);\n entry.timer = setTimeout(() => {\n if (!entry.focused) {\n entry.visible = false;\n this.requestUpdate();\n }\n }, 100);\n }\n\n #focusFloatingInput(flag: ThumbFlag) {\n if (this.disabled) {\n return;\n }\n this.#showThumbInput(flag);\n this.#thumbInputState.get(flag)!.focused = true;\n }\n\n #blurFloatingInput(flag: ThumbFlag) {\n const entry = this.#thumbInputState.get(flag)!;\n entry.focused = false;\n this.#scheduleHideThumbInput(flag);\n }\n\n // Maps a 0–100 progress value to a CSS multiplier for --zui-slider-thumb-size so that\n // `progress% + thumbSize * offset` lands on the thumb center within the inset wrapper.\n // At 0%: offset=1.5 → thumbSize*1.5 (thumb center at min). At 100%: offset=-1.5 → -thumbSize*1.5 (thumb center at max).\n static #thumbCenterOffset(progress: number): number {\n return 1.5 - (3 * progress) / 100;\n }\n\n static #thumbPositionCSS(progress: number): string {\n return `calc(${progress}% + var(--zui-slider-thumb-size) * ${ZuiSlider.#thumbCenterOffset(progress)})`;\n }\n}\n\nwindow.customElements.define('zui-slider', ZuiSlider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-slider': ZuiSlider;\n }\n}\n"]}
|
package/lab.html
CHANGED
|
@@ -46,9 +46,6 @@
|
|
|
46
46
|
<h3>zui slider negative values</h3>
|
|
47
47
|
<zui-slider id="negative" value="0" min="-50" max="50"></zui-slider>
|
|
48
48
|
|
|
49
|
-
<h3>zui slider decimals + custom thumb size</h3>
|
|
50
|
-
<zui-slider id="decimals" step="0.01" value="50.01"></zui-slider>
|
|
51
|
-
|
|
52
49
|
<h3>zui slider no text</h3>
|
|
53
50
|
<zui-slider id="text" no-text></zui-slider>
|
|
54
51
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zywave/zui-slider",
|
|
3
|
-
"version": "4.4.0-pre.
|
|
3
|
+
"version": "4.4.0-pre.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zywave/zui-input": "^4.2.3"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "a50a61d9903db3e0a032d894708c2f3a9c5ffb39"
|
|
31
31
|
}
|
|
@@ -6,7 +6,8 @@ zui-slider {
|
|
|
6
6
|
|
|
7
7
|
position: relative;
|
|
8
8
|
display: block;
|
|
9
|
-
|
|
9
|
+
margin: 0 calc(var(--zui-slider-thumb-size) * -1);
|
|
10
|
+
padding: calc(var(--zui-slider-thumb-size) / 2 - #{rem(2)}) 0;
|
|
10
11
|
|
|
11
12
|
// Track — filled to default 50% (CSS cannot read the value attribute for positioning)
|
|
12
13
|
&::before {
|
package/src/zui-slider-css.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
export const style = css`:host .thumb-input input[type=number]{display:inline-block;width:100%;min-height:2.625rem;vertical-align:middle;padding:0 .625rem;background-color:#fff;border:.0625rem solid var(--zui-gray-200);border-radius:.25rem;font:inherit;color:inherit;transition:border 100ms ease-in-out,box-shadow 100ms ease-in-out;box-sizing:border-box;appearance:textfield}:host .thumb-input input[type=number]::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input[type=number]:hover{border-color:var(--zui-gray-400)}:host .thumb-input input[type=number]:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled][type=number]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled][type=number]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly][type=number]{outline:none}:host{--zui-slider-thumb-size: 0.875rem;--zui-slider-input-width: 8ch;position:relative;display:block
|
|
3
|
+
export const style = css`:host .thumb-input input[type=number]{display:inline-block;width:100%;min-height:2.625rem;vertical-align:middle;padding:0 .625rem;background-color:#fff;border:.0625rem solid var(--zui-gray-200);border-radius:.25rem;font:inherit;color:inherit;transition:border 100ms ease-in-out,box-shadow 100ms ease-in-out;box-sizing:border-box;appearance:textfield}:host .thumb-input input[type=number]::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input[type=number]:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input[type=number]:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input[type=number]:hover{border-color:var(--zui-gray-400)}:host .thumb-input input[type=number]:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled][type=number]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled][type=number]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly][type=number]{outline:none}:host{--zui-slider-thumb-size: 0.875rem;--zui-slider-input-width: 8ch;position:relative;display:block}:host .single-wrapper,:host .range-wrapper{position:relative;display:flex;height:var(--zui-slider-thumb-size);align-items:center;margin:0 calc(var(--zui-slider-thumb-size)*-1)}:host input[type=range]{width:100%;height:var(--zui-slider-thumb-size);margin:0;background:rgba(0,0,0,0);outline:none;cursor:grab;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host input[type=range]::-webkit-slider-runnable-track{height:.25rem;background:var(--zui-slider-track-bg)}:host input[type=range]::-moz-range-track{height:.25rem;background:var(--zui-slider-track-bg)}:host input[type=range]::-webkit-slider-thumb{width:calc(var(--zui-slider-thumb-size)*3);height:calc(var(--zui-slider-thumb-size)*3);background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));border-radius:50%;box-shadow:none;cursor:grab;transition:background 100ms ease-out,box-shadow 100ms ease-out}:host input[type=range]::-webkit-slider-thumb:hover{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]::-moz-range-thumb{width:calc(var(--zui-slider-thumb-size)*3);height:calc(var(--zui-slider-thumb-size)*3);background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));border-radius:50%;box-shadow:none;cursor:grab;transition:background 100ms ease-out,box-shadow 100ms ease-out}:host input[type=range]::-moz-range-thumb:hover{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]::-webkit-slider-thumb{transform:translateY(calc(-50% + 0.125rem));-webkit-appearance:none;appearance:none}:host input[type=range]::-moz-range-thumb{border:0}:host input[type=range]:hover::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2))}:host input[type=range]:hover::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2))}:host input[type=range]:focus::-webkit-slider-thumb{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]:focus::-moz-range-thumb{box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16)}:host input[type=range]:active::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16);cursor:grabbing}:host input[type=range]:active::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));box-shadow:inset 0 0 0 var(--zui-slider-thumb-size) rgba(120,120,140,.16);cursor:grabbing}:host .thumb-input{position:absolute;bottom:calc(var(--zui-slider-thumb-size)*2 + 0.25rem);opacity:0;z-index:10;transform:translateX(-50%);transition:opacity 100ms ease-out;pointer-events:none}:host .thumb-input--visible,:host .thumb-input:focus-within{opacity:1;pointer-events:all}:host .thumb-input input[type=number]{width:var(--zui-slider-input-width);text-align:center}:host .thumb-input input[type=number]::-webkit-inner-spin-button,:host .thumb-input input[type=number]::-webkit-outer-spin-button{appearance:none}:host .step-dots{position:absolute;top:50%;left:0;width:100%;height:0;pointer-events:none}:host .step-dots .step-dot{position:absolute;width:.375rem;height:.375rem;background-color:var(--zui-blue);border-radius:50%;transform:translate(-50%, -50%)}:host .step-dots .step-dot:first-child,:host .step-dots .step-dot:last-child{width:.125rem;height:1rem;border-radius:.125rem}:host .range-wrapper{cursor:grab}:host .range-wrapper:active{cursor:grabbing}:host .range-wrapper input[type=range]{position:absolute;pointer-events:none}:host .range-wrapper input[type=range]::-webkit-slider-thumb{pointer-events:all}:host .range-wrapper input[type=range]::-moz-range-thumb{pointer-events:all}:host .range-wrapper input[type=range]::-moz-range-progress{background:rgba(0,0,0,0)}:host .min-max-labels{display:flex;justify-content:space-between}:host .min-max-labels .min-max-label{font-weight:600;color:var(--zui-gray-600)}:host([range]) .min-max-labels{margin-top:.3125rem}:host([readonly]) input[type=range]:disabled{cursor:default}:host([readonly]) input[type=range]:disabled::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:default}:host([readonly]) input[type=range]:disabled::-moz-range-thumb{background:radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:default}:host([disabled]){cursor:not-allowed}:host([disabled]) input[type=range]:disabled{cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-webkit-slider-thumb{background:radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-webkit-slider-thumb:hover{box-shadow:none}:host([disabled]) input[type=range]:disabled::-moz-range-thumb{background:radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - 0.0625rem), transparent calc(var(--zui-slider-thumb-size) / 2));cursor:not-allowed}:host([disabled]) input[type=range]:disabled::-moz-range-thumb:hover{box-shadow:none}:host([disabled]) .step-dot{background-color:var(--zui-gray)}:host([disabled]) .range-wrapper{cursor:not-allowed}`;
|
package/src/zui-slider.scss
CHANGED
|
@@ -1,19 +1,45 @@
|
|
|
1
1
|
@use '@zywave/zui-sass-scripts' as *;
|
|
2
2
|
@use '@zywave/zui-input/src/input' as *;
|
|
3
3
|
|
|
4
|
+
@mixin on-thumb {
|
|
5
|
+
&::-webkit-slider-thumb {
|
|
6
|
+
@content;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&::-moz-range-thumb {
|
|
10
|
+
@content;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@mixin on-track {
|
|
15
|
+
&::-webkit-slider-runnable-track {
|
|
16
|
+
@content;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&::-moz-range-track {
|
|
20
|
+
@content;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@mixin thumb-bg($color) {
|
|
25
|
+
background: radial-gradient(circle, $color calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
|
|
26
|
+
}
|
|
27
|
+
|
|
4
28
|
:host {
|
|
5
29
|
--zui-slider-thumb-size: #{rem(14)};
|
|
6
30
|
--zui-slider-input-width: 8ch;
|
|
7
31
|
|
|
8
32
|
$thumb-ring-color: rgba(120, 120, 140, 0.16);
|
|
33
|
+
$thumb-ring-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
|
|
34
|
+
$track-height: rem(4);
|
|
9
35
|
|
|
10
36
|
position: relative;
|
|
11
37
|
display: block;
|
|
12
|
-
padding: calc(var(--zui-slider-thumb-size) / 2) 0;
|
|
13
38
|
|
|
14
39
|
// Single mode
|
|
15
40
|
|
|
16
|
-
.single-wrapper
|
|
41
|
+
.single-wrapper,
|
|
42
|
+
.range-wrapper {
|
|
17
43
|
position: relative;
|
|
18
44
|
display: flex;
|
|
19
45
|
height: var(--zui-slider-thumb-size);
|
|
@@ -25,98 +51,63 @@
|
|
|
25
51
|
|
|
26
52
|
input[type='range'] {
|
|
27
53
|
width: 100%;
|
|
28
|
-
height:
|
|
54
|
+
height: var(--zui-slider-thumb-size);
|
|
29
55
|
margin: 0;
|
|
30
|
-
background:
|
|
31
|
-
border-radius: rem(3);
|
|
56
|
+
background: transparent;
|
|
32
57
|
outline: none;
|
|
33
58
|
cursor: grab;
|
|
34
59
|
-webkit-appearance: none;
|
|
35
60
|
-moz-appearance: none;
|
|
36
61
|
appearance: none;
|
|
37
62
|
|
|
38
|
-
|
|
63
|
+
@include on-track {
|
|
64
|
+
height: $track-height;
|
|
65
|
+
background: var(--zui-slider-track-bg);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@include on-thumb {
|
|
39
69
|
width: calc(var(--zui-slider-thumb-size) * 3);
|
|
40
70
|
height: calc(var(--zui-slider-thumb-size) * 3);
|
|
41
|
-
|
|
71
|
+
@include thumb-bg(var(--zui-blue));
|
|
42
72
|
border-radius: 50%;
|
|
43
73
|
box-shadow: none;
|
|
74
|
+
cursor: grab;
|
|
44
75
|
transition: background 100ms ease-out, box-shadow 100ms ease-out;
|
|
45
|
-
-webkit-appearance: none;
|
|
46
|
-
appearance: none;
|
|
47
76
|
|
|
48
77
|
&:hover {
|
|
49
|
-
box-shadow:
|
|
78
|
+
box-shadow: $thumb-ring-shadow;
|
|
50
79
|
}
|
|
51
80
|
}
|
|
52
81
|
|
|
82
|
+
&::-webkit-slider-thumb {
|
|
83
|
+
transform: translateY(calc(-50% + #{rem(2)}));
|
|
84
|
+
-webkit-appearance: none;
|
|
85
|
+
appearance: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
53
88
|
&::-moz-range-thumb {
|
|
54
|
-
width: calc(var(--zui-slider-thumb-size) * 3);
|
|
55
|
-
height: calc(var(--zui-slider-thumb-size) * 3);
|
|
56
|
-
background: radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
|
|
57
89
|
border: 0;
|
|
58
|
-
border-radius: 50%;
|
|
59
|
-
box-shadow: none;
|
|
60
|
-
transition: background 100ms ease-out, box-shadow 100ms ease-out;
|
|
61
|
-
|
|
62
|
-
&:hover {
|
|
63
|
-
box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
|
|
64
|
-
}
|
|
65
90
|
}
|
|
66
91
|
|
|
67
92
|
&:hover {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&::-moz-range-thumb {
|
|
73
|
-
background: radial-gradient(circle, var(--zui-blue-400) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
|
|
93
|
+
@include on-thumb {
|
|
94
|
+
@include thumb-bg(var(--zui-blue-400));
|
|
74
95
|
}
|
|
75
96
|
}
|
|
76
97
|
|
|
77
98
|
&:focus {
|
|
78
|
-
|
|
79
|
-
box-shadow:
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&::-moz-range-thumb {
|
|
83
|
-
box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
|
|
99
|
+
@include on-thumb {
|
|
100
|
+
box-shadow: $thumb-ring-shadow;
|
|
84
101
|
}
|
|
85
102
|
}
|
|
86
103
|
|
|
87
104
|
&:active {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
box-shadow:
|
|
91
|
-
cursor: grabbing;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&::-moz-range-thumb {
|
|
95
|
-
background: radial-gradient(circle, var(--zui-blue-600) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
|
|
96
|
-
box-shadow: inset 0 0 0 var(--zui-slider-thumb-size) $thumb-ring-color;
|
|
105
|
+
@include on-thumb {
|
|
106
|
+
@include thumb-bg(var(--zui-blue-600));
|
|
107
|
+
box-shadow: $thumb-ring-shadow;
|
|
97
108
|
cursor: grabbing;
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
|
-
|
|
101
|
-
&:disabled {
|
|
102
|
-
cursor: not-allowed;
|
|
103
|
-
|
|
104
|
-
&::-webkit-slider-thumb {
|
|
105
|
-
background: radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
|
|
106
|
-
|
|
107
|
-
&:hover {
|
|
108
|
-
box-shadow: none;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&::-moz-range-thumb {
|
|
113
|
-
background: radial-gradient(circle, var(--zui-gray) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
|
|
114
|
-
|
|
115
|
-
&:hover {
|
|
116
|
-
box-shadow: none;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
111
|
}
|
|
121
112
|
|
|
122
113
|
// Shared: floating input above the thumb
|
|
@@ -178,76 +169,23 @@
|
|
|
178
169
|
// Range mode
|
|
179
170
|
|
|
180
171
|
.range-wrapper {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
margin: rem(5) calc(var(--zui-slider-thumb-size) * -1);
|
|
172
|
+
cursor: grab;
|
|
173
|
+
|
|
174
|
+
&:active {
|
|
175
|
+
cursor: grabbing;
|
|
176
|
+
}
|
|
187
177
|
|
|
188
178
|
input[type='range'] {
|
|
189
179
|
position: absolute;
|
|
190
|
-
width: 100%;
|
|
191
|
-
height: var(--zui-slider-thumb-size);
|
|
192
|
-
background: transparent;
|
|
193
|
-
transform: translateY(-50%);
|
|
194
180
|
pointer-events: none;
|
|
195
181
|
|
|
196
|
-
@
|
|
197
|
-
top: 50%;
|
|
198
|
-
left: 0;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
&::-webkit-slider-runnable-track {
|
|
202
|
-
height: rem(4);
|
|
203
|
-
background: transparent;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
&::-webkit-slider-thumb {
|
|
207
|
-
margin-top: rem(2);
|
|
208
|
-
cursor: grab;
|
|
182
|
+
@include on-thumb {
|
|
209
183
|
pointer-events: all;
|
|
210
184
|
}
|
|
211
185
|
|
|
212
|
-
&::-moz-range-track {
|
|
213
|
-
height: rem(4);
|
|
214
|
-
background: transparent;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
186
|
&::-moz-range-progress {
|
|
218
187
|
background: transparent;
|
|
219
188
|
}
|
|
220
|
-
|
|
221
|
-
&::-moz-range-thumb {
|
|
222
|
-
cursor: grab;
|
|
223
|
-
pointer-events: all;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
&:active {
|
|
227
|
-
&::-webkit-slider-thumb {
|
|
228
|
-
cursor: grabbing;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
&::-moz-range-thumb {
|
|
232
|
-
cursor: grabbing;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
&:disabled {
|
|
237
|
-
&::-webkit-slider-thumb {
|
|
238
|
-
cursor: not-allowed;
|
|
239
|
-
pointer-events: all;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
&::-moz-range-thumb {
|
|
243
|
-
cursor: not-allowed;
|
|
244
|
-
pointer-events: all;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.thumb-input {
|
|
250
|
-
bottom: calc(var(--zui-slider-thumb-size) * 2 - #{rem(1)});
|
|
251
189
|
}
|
|
252
190
|
}
|
|
253
191
|
|
|
@@ -276,13 +214,8 @@
|
|
|
276
214
|
input[type='range']:disabled {
|
|
277
215
|
cursor: default;
|
|
278
216
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
cursor: default;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
&::-moz-range-thumb {
|
|
285
|
-
background: radial-gradient(circle, var(--zui-blue) calc(var(--zui-slider-thumb-size) / 2 - #{rem(1)}), transparent calc(var(--zui-slider-thumb-size) / 2));
|
|
217
|
+
@include on-thumb {
|
|
218
|
+
@include thumb-bg(var(--zui-blue));
|
|
286
219
|
cursor: default;
|
|
287
220
|
}
|
|
288
221
|
}
|
|
@@ -291,11 +224,24 @@
|
|
|
291
224
|
:host([disabled]) {
|
|
292
225
|
cursor: not-allowed;
|
|
293
226
|
|
|
294
|
-
|
|
227
|
+
input[type='range']:disabled {
|
|
295
228
|
cursor: not-allowed;
|
|
229
|
+
|
|
230
|
+
@include on-thumb {
|
|
231
|
+
@include thumb-bg(var(--zui-gray));
|
|
232
|
+
cursor: not-allowed;
|
|
233
|
+
|
|
234
|
+
&:hover {
|
|
235
|
+
box-shadow: none;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
296
238
|
}
|
|
297
239
|
|
|
298
240
|
.step-dot {
|
|
299
241
|
background-color: var(--zui-gray);
|
|
300
242
|
}
|
|
243
|
+
|
|
244
|
+
.range-wrapper {
|
|
245
|
+
cursor: not-allowed;
|
|
246
|
+
}
|
|
301
247
|
}
|
package/src/zui-slider.ts
CHANGED
|
@@ -42,8 +42,7 @@ type ThumbFlag = 'thumb' | 'startThumb' | 'endThumb';
|
|
|
42
42
|
* @prop {number} [step=0] - Represents the stepping interval; 0 means any value is allowed
|
|
43
43
|
* @prop {boolean} [showMinMax=false] - Shows the min and max values beneath the slider
|
|
44
44
|
*
|
|
45
|
-
* @cssprop [--zui-slider-
|
|
46
|
-
* @cssprop [--zui-slider-input-width=7ch] - Width of the floating value input above each thumb
|
|
45
|
+
* @cssprop [--zui-slider-input-width=7ch] - Width of the floating value input above each slider thumb
|
|
47
46
|
*
|
|
48
47
|
* @event {CustomEvent} change - Fires when value changes; in single mode detail is the value string; in range mode detail is { valueStart, valueEnd }
|
|
49
48
|
*/
|
|
@@ -358,7 +357,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
358
357
|
<div class="single-wrapper">
|
|
359
358
|
<input
|
|
360
359
|
aria-label="Slider value"
|
|
361
|
-
style=${styleMap({
|
|
360
|
+
style=${styleMap({ '--zui-slider-track-bg': this.#singleTrackBackground(progress) })}
|
|
362
361
|
type="range"
|
|
363
362
|
.min="${String(this.min)}"
|
|
364
363
|
.max="${String(this.max)}"
|
|
@@ -372,7 +371,6 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
372
371
|
@focus="${this.#h.thumb.show}"
|
|
373
372
|
@blur="${this.#h.thumb.hide}"
|
|
374
373
|
/>
|
|
375
|
-
${this.#renderStepDots()}
|
|
376
374
|
${this.#renderFloatingInput(
|
|
377
375
|
this.#value,
|
|
378
376
|
this.#onThumbFloatingInput,
|
|
@@ -381,6 +379,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
381
379
|
this.#isVisible('thumb'),
|
|
382
380
|
progress
|
|
383
381
|
)}
|
|
382
|
+
${this.#renderStepDots()}
|
|
384
383
|
</div>
|
|
385
384
|
`;
|
|
386
385
|
}
|
|
@@ -389,11 +388,8 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
389
388
|
const progressStart = this.progressStart;
|
|
390
389
|
const progressEnd = this.progressEnd;
|
|
391
390
|
return html`
|
|
392
|
-
<div
|
|
393
|
-
|
|
394
|
-
style=${styleMap({ background: this.#rangeTrackBackground(progressStart, progressEnd) })}
|
|
395
|
-
>
|
|
396
|
-
${this.#renderStepDots()}${this.#renderRangeInput('start')}
|
|
391
|
+
<div class="range-wrapper" @click="${this.#onTrackClick}">
|
|
392
|
+
${this.#renderRangeInput('start', this.#rangeTrackBackground(progressStart, progressEnd))}
|
|
397
393
|
${this.#renderFloatingInput(
|
|
398
394
|
this.#valueStart,
|
|
399
395
|
this.#onStartThumbFloatingInput,
|
|
@@ -411,11 +407,12 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
411
407
|
this.#isVisible('endThumb'),
|
|
412
408
|
progressEnd
|
|
413
409
|
)}
|
|
410
|
+
${this.#renderStepDots()}
|
|
414
411
|
</div>
|
|
415
412
|
`;
|
|
416
413
|
}
|
|
417
414
|
|
|
418
|
-
#renderRangeInput(which: 'start' | 'end') {
|
|
415
|
+
#renderRangeInput(which: 'start' | 'end', trackBg?: string) {
|
|
419
416
|
const flag: ThumbFlag = which === 'start' ? 'startThumb' : 'endThumb';
|
|
420
417
|
const val = which === 'start' ? this.#valueStart : this.#valueEnd;
|
|
421
418
|
const onInput = which === 'start' ? this.#onRangeStartInput : this.#onRangeEndInput;
|
|
@@ -428,6 +425,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
428
425
|
aria-label="${which === 'start' ? 'Range start' : 'Range end'}"
|
|
429
426
|
class="range-${which}"
|
|
430
427
|
type="range"
|
|
428
|
+
style=${trackBg ? styleMap({ '--zui-slider-track-bg': trackBg }) : nothing}
|
|
431
429
|
.min="${String(this.min)}"
|
|
432
430
|
.max="${String(this.max)}"
|
|
433
431
|
.step="${this.step > 0 ? String(this.step) : '1'}"
|
|
@@ -602,6 +600,47 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
|
|
|
602
600
|
);
|
|
603
601
|
}
|
|
604
602
|
|
|
603
|
+
#onTrackClick(e: MouseEvent) {
|
|
604
|
+
if (this.disabled || this.readOnly) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
const wrapper = e.currentTarget as HTMLElement;
|
|
609
|
+
const rect = wrapper.getBoundingClientRect();
|
|
610
|
+
// Thumb diameter is 3× the custom property; radius is 1.5×. Track is inset by one radius each side.
|
|
611
|
+
const thumbRadius = 1.5 * parseFloat(getComputedStyle(this).getPropertyValue('--zui-slider-thumb-size'));
|
|
612
|
+
const trackLeft = rect.left + thumbRadius;
|
|
613
|
+
const effectiveWidth = rect.width - 2 * thumbRadius;
|
|
614
|
+
const fraction = Math.max(0, Math.min(1, (e.clientX - trackLeft) / effectiveWidth));
|
|
615
|
+
const rawValue = this.min + fraction * (this.max - this.min);
|
|
616
|
+
|
|
617
|
+
// Ignore clicks that land within a thumb's hit area — those bubble up from native input
|
|
618
|
+
// interactions and should not be treated as track clicks.
|
|
619
|
+
const startX = trackLeft + (this.progressStart / 100) * effectiveWidth;
|
|
620
|
+
const endX = trackLeft + (this.progressEnd / 100) * effectiveWidth;
|
|
621
|
+
if (Math.abs(e.clientX - startX) <= thumbRadius || Math.abs(e.clientX - endX) <= thumbRadius) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
const snappedStr = this.#processFloatingValue(rawValue);
|
|
626
|
+
const snapped = parseFloat(snappedStr);
|
|
627
|
+
const startNum = parseFloat(this.#valueStart);
|
|
628
|
+
const endNum = parseFloat(this.#valueEnd);
|
|
629
|
+
|
|
630
|
+
// Move whichever thumb is closer to the click; prefer start on a tie
|
|
631
|
+
if (Math.abs(rawValue - startNum) <= Math.abs(rawValue - endNum)) {
|
|
632
|
+
if (snapped < endNum) {
|
|
633
|
+
this.valueStart = snappedStr;
|
|
634
|
+
this.#onRangeChange();
|
|
635
|
+
}
|
|
636
|
+
} else {
|
|
637
|
+
if (snapped > startNum) {
|
|
638
|
+
this.valueEnd = snappedStr;
|
|
639
|
+
this.#onRangeChange();
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
605
644
|
#showThumbInput(flag: ThumbFlag) {
|
|
606
645
|
if (this.disabled) {
|
|
607
646
|
return;
|
package/test/zui-slider.test.ts
CHANGED
|
@@ -102,13 +102,13 @@ suite('zui-slider', () => {
|
|
|
102
102
|
await element.updateComplete;
|
|
103
103
|
const input = element.shadowRoot!.querySelector<HTMLInputElement>('input[type="range"]')!;
|
|
104
104
|
const thumbDiv = element.shadowRoot!.querySelector<HTMLElement>('.thumb-input')!;
|
|
105
|
-
const bgBefore = input.style.
|
|
105
|
+
const bgBefore = input.style.getPropertyValue('--zui-slider-track-bg');
|
|
106
106
|
input.value = '75';
|
|
107
107
|
input.dispatchEvent(new Event('input'));
|
|
108
108
|
await element.updateComplete;
|
|
109
109
|
assert.include(thumbDiv.style.left, '75%');
|
|
110
|
-
assert.notEqual(input.style.
|
|
111
|
-
assert.include(input.style.
|
|
110
|
+
assert.notEqual(input.style.getPropertyValue('--zui-slider-track-bg'), bgBefore);
|
|
111
|
+
assert.include(input.style.getPropertyValue('--zui-slider-track-bg'), '75%');
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
test('floating input change fires component change event', async () => {
|
|
@@ -232,7 +232,7 @@ suite('zui-slider', () => {
|
|
|
232
232
|
test('single mode input has inline linear-gradient background with transparent insets', async () => {
|
|
233
233
|
await element.updateComplete;
|
|
234
234
|
const input = element.shadowRoot!.querySelector<HTMLInputElement>('input[type="range"]')!;
|
|
235
|
-
const bg = input.style.
|
|
235
|
+
const bg = input.style.getPropertyValue('--zui-slider-track-bg');
|
|
236
236
|
assert.include(bg, 'linear-gradient');
|
|
237
237
|
assert.include(bg, 'transparent var(--zui-slider-thumb-size)');
|
|
238
238
|
assert.include(bg, 'transparent calc(100% - var(--zui-slider-thumb-size))');
|
|
@@ -242,13 +242,13 @@ suite('zui-slider', () => {
|
|
|
242
242
|
element.disabled = true;
|
|
243
243
|
await element.updateComplete;
|
|
244
244
|
const input = element.shadowRoot!.querySelector<HTMLInputElement>('input[type="range"]')!;
|
|
245
|
-
assert.include(input.style.
|
|
246
|
-
assert.notInclude(input.style.
|
|
245
|
+
assert.include(input.style.getPropertyValue('--zui-slider-track-bg'), 'var(--zui-gray)');
|
|
246
|
+
assert.notInclude(input.style.getPropertyValue('--zui-slider-track-bg'), 'var(--zui-blue)');
|
|
247
247
|
|
|
248
248
|
element.disabled = false;
|
|
249
249
|
await element.updateComplete;
|
|
250
|
-
assert.include(input.style.
|
|
251
|
-
assert.notInclude(input.style.
|
|
250
|
+
assert.include(input.style.getPropertyValue('--zui-slider-track-bg'), 'var(--zui-blue)');
|
|
251
|
+
assert.notInclude(input.style.getPropertyValue('--zui-slider-track-bg'), 'var(--zui-gray)');
|
|
252
252
|
});
|
|
253
253
|
|
|
254
254
|
test('single mode gradient progress stop shifts when value changes', async () => {
|
|
@@ -256,13 +256,22 @@ suite('zui-slider', () => {
|
|
|
256
256
|
element.value = '50';
|
|
257
257
|
await element.updateComplete;
|
|
258
258
|
const input = element.shadowRoot!.querySelector<HTMLInputElement>('input[type="range"]')!;
|
|
259
|
-
assert.include(
|
|
259
|
+
assert.include(
|
|
260
|
+
input.style.getPropertyValue('--zui-slider-track-bg'),
|
|
261
|
+
'calc(50% + var(--zui-slider-thumb-size) * 0)'
|
|
262
|
+
);
|
|
260
263
|
|
|
261
264
|
// At value=75 (progress=75): offset = 1.5 - (3*75)/100 = -0.75
|
|
262
265
|
element.value = '75';
|
|
263
266
|
await element.updateComplete;
|
|
264
|
-
assert.include(
|
|
265
|
-
|
|
267
|
+
assert.include(
|
|
268
|
+
input.style.getPropertyValue('--zui-slider-track-bg'),
|
|
269
|
+
'calc(75% + var(--zui-slider-thumb-size) * -0.75)'
|
|
270
|
+
);
|
|
271
|
+
assert.notInclude(
|
|
272
|
+
input.style.getPropertyValue('--zui-slider-track-bg'),
|
|
273
|
+
'calc(50% + var(--zui-slider-thumb-size) * 0)'
|
|
274
|
+
);
|
|
266
275
|
});
|
|
267
276
|
|
|
268
277
|
test('form reset hides visible floating input', async () => {
|
|
@@ -912,14 +921,13 @@ suite('zui-slider range', () => {
|
|
|
912
921
|
await element.updateComplete;
|
|
913
922
|
const startInput = element.shadowRoot!.querySelector<HTMLInputElement>('input.range-start')!;
|
|
914
923
|
const thumbInputDivs = element.shadowRoot!.querySelectorAll<HTMLElement>('.thumb-input');
|
|
915
|
-
const
|
|
916
|
-
const bgBefore = wrapper.style.background;
|
|
924
|
+
const bgBefore = startInput.style.getPropertyValue('--zui-slider-track-bg');
|
|
917
925
|
startInput.value = '30';
|
|
918
926
|
startInput.dispatchEvent(new Event('input'));
|
|
919
927
|
await element.updateComplete;
|
|
920
928
|
assert.include(thumbInputDivs[0].style.left, '30%');
|
|
921
|
-
assert.notEqual(
|
|
922
|
-
assert.include(
|
|
929
|
+
assert.notEqual(startInput.style.getPropertyValue('--zui-slider-track-bg'), bgBefore);
|
|
930
|
+
assert.include(startInput.style.getPropertyValue('--zui-slider-track-bg'), '30%');
|
|
923
931
|
});
|
|
924
932
|
|
|
925
933
|
test('change event fires with valueStart and valueEnd detail on range-start change', async () => {
|
|
@@ -1021,14 +1029,14 @@ suite('zui-slider range', () => {
|
|
|
1021
1029
|
test('range-wrapper gradient uses gray when disabled and reverts to blue when re-enabled', async () => {
|
|
1022
1030
|
element.disabled = true;
|
|
1023
1031
|
await element.updateComplete;
|
|
1024
|
-
const
|
|
1025
|
-
assert.include(
|
|
1026
|
-
assert.notInclude(
|
|
1032
|
+
const startInput = element.shadowRoot!.querySelector<HTMLInputElement>('input.range-start')!;
|
|
1033
|
+
assert.include(startInput.style.getPropertyValue('--zui-slider-track-bg'), 'var(--zui-gray)');
|
|
1034
|
+
assert.notInclude(startInput.style.getPropertyValue('--zui-slider-track-bg'), 'var(--zui-blue)');
|
|
1027
1035
|
|
|
1028
1036
|
element.disabled = false;
|
|
1029
1037
|
await element.updateComplete;
|
|
1030
|
-
assert.include(
|
|
1031
|
-
assert.notInclude(
|
|
1038
|
+
assert.include(startInput.style.getPropertyValue('--zui-slider-track-bg'), 'var(--zui-blue)');
|
|
1039
|
+
assert.notInclude(startInput.style.getPropertyValue('--zui-slider-track-bg'), 'var(--zui-gray)');
|
|
1032
1040
|
});
|
|
1033
1041
|
|
|
1034
1042
|
test('form reset hides visible floating inputs in range mode', async () => {
|
|
@@ -1072,8 +1080,8 @@ suite('zui-slider range', () => {
|
|
|
1072
1080
|
|
|
1073
1081
|
test('range-wrapper gradient insets are transparent outside thumb-size bounds', async () => {
|
|
1074
1082
|
await element.updateComplete;
|
|
1075
|
-
const
|
|
1076
|
-
const bg =
|
|
1083
|
+
const startInput = element.shadowRoot!.querySelector<HTMLInputElement>('input.range-start')!;
|
|
1084
|
+
const bg = startInput.style.getPropertyValue('--zui-slider-track-bg');
|
|
1077
1085
|
assert.include(bg, 'transparent var(--zui-slider-thumb-size)');
|
|
1078
1086
|
assert.include(bg, 'transparent calc(100% - var(--zui-slider-thumb-size))');
|
|
1079
1087
|
});
|
|
@@ -1098,13 +1106,13 @@ suite('zui-slider range', () => {
|
|
|
1098
1106
|
element.valueStart = '25';
|
|
1099
1107
|
element.valueEnd = '75';
|
|
1100
1108
|
await element.updateComplete;
|
|
1101
|
-
const
|
|
1102
|
-
const bg25 =
|
|
1109
|
+
const startInput = element.shadowRoot!.querySelector<HTMLInputElement>('input.range-start')!;
|
|
1110
|
+
const bg25 = startInput.style.getPropertyValue('--zui-slider-track-bg');
|
|
1103
1111
|
|
|
1104
1112
|
element.valueStart = '10';
|
|
1105
1113
|
element.valueEnd = '90';
|
|
1106
1114
|
await element.updateComplete;
|
|
1107
|
-
const bg10 =
|
|
1115
|
+
const bg10 = startInput.style.getPropertyValue('--zui-slider-track-bg');
|
|
1108
1116
|
|
|
1109
1117
|
assert.notEqual(bg25, bg10);
|
|
1110
1118
|
});
|
|
@@ -1195,6 +1203,116 @@ suite('zui-slider range', () => {
|
|
|
1195
1203
|
});
|
|
1196
1204
|
});
|
|
1197
1205
|
|
|
1206
|
+
// Dispatches a click at a given 0–1 fraction of the effective track, matching the
|
|
1207
|
+
// coordinate math in #onTrackClick so the component computes the same fraction back.
|
|
1208
|
+
function clickAtFraction(element: ZuiSlider, fraction: number): void {
|
|
1209
|
+
const wrapper = element.shadowRoot!.querySelector<HTMLElement>('.range-wrapper')!;
|
|
1210
|
+
const rect = wrapper.getBoundingClientRect();
|
|
1211
|
+
const thumbRadius = 1.5 * parseFloat(getComputedStyle(element).getPropertyValue('--zui-slider-thumb-size'));
|
|
1212
|
+
const effectiveWidth = rect.width - 2 * thumbRadius;
|
|
1213
|
+
const clientX = rect.left + thumbRadius + fraction * effectiveWidth;
|
|
1214
|
+
wrapper.dispatchEvent(new MouseEvent('click', { bubbles: true, clientX }));
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
suite('zui-slider range track click', () => {
|
|
1218
|
+
let element: ZuiSlider;
|
|
1219
|
+
let form: HTMLFormElement;
|
|
1220
|
+
|
|
1221
|
+
setup(() => {
|
|
1222
|
+
element = document.createElement('zui-slider') as ZuiSlider;
|
|
1223
|
+
element.setAttribute('range', '');
|
|
1224
|
+
form = buildForm({ enableSubmit: false, appendChildren: [element] });
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
teardown(() => {
|
|
1228
|
+
document.body.removeChild(form);
|
|
1229
|
+
});
|
|
1230
|
+
|
|
1231
|
+
test('moves start thumb when clicking left of both thumbs', async () => {
|
|
1232
|
+
await element.updateComplete;
|
|
1233
|
+
clickAtFraction(element, 0.25);
|
|
1234
|
+
assert.equal(element.valueStart, '25');
|
|
1235
|
+
assert.equal(element.valueEnd, '100');
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1238
|
+
test('moves end thumb when clicking right of both thumbs', async () => {
|
|
1239
|
+
await element.updateComplete;
|
|
1240
|
+
clickAtFraction(element, 0.75);
|
|
1241
|
+
assert.equal(element.valueStart, '0');
|
|
1242
|
+
assert.equal(element.valueEnd, '75');
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
test('moves start thumb when closer to start than end', async () => {
|
|
1246
|
+
element.valueStart = '20';
|
|
1247
|
+
element.valueEnd = '60';
|
|
1248
|
+
await element.updateComplete;
|
|
1249
|
+
clickAtFraction(element, 0.3);
|
|
1250
|
+
assert.equal(element.valueStart, '30');
|
|
1251
|
+
assert.equal(element.valueEnd, '60');
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
test('moves end thumb when closer to end than start', async () => {
|
|
1255
|
+
element.valueStart = '20';
|
|
1256
|
+
element.valueEnd = '60';
|
|
1257
|
+
await element.updateComplete;
|
|
1258
|
+
clickAtFraction(element, 0.5);
|
|
1259
|
+
assert.equal(element.valueStart, '20');
|
|
1260
|
+
assert.equal(element.valueEnd, '50');
|
|
1261
|
+
});
|
|
1262
|
+
|
|
1263
|
+
test('prefers start thumb when equidistant from both', async () => {
|
|
1264
|
+
await element.updateComplete;
|
|
1265
|
+
clickAtFraction(element, 0.5);
|
|
1266
|
+
assert.equal(element.valueStart, '50');
|
|
1267
|
+
assert.equal(element.valueEnd, '100');
|
|
1268
|
+
});
|
|
1269
|
+
|
|
1270
|
+
test('does nothing when disabled', async () => {
|
|
1271
|
+
element.disabled = true;
|
|
1272
|
+
await element.updateComplete;
|
|
1273
|
+
clickAtFraction(element, 0.25);
|
|
1274
|
+
assert.equal(element.valueStart, '0');
|
|
1275
|
+
assert.equal(element.valueEnd, '100');
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
test('does nothing when readonly', async () => {
|
|
1279
|
+
element.setAttribute('readonly', '');
|
|
1280
|
+
await element.updateComplete;
|
|
1281
|
+
clickAtFraction(element, 0.25);
|
|
1282
|
+
assert.equal(element.valueStart, '0');
|
|
1283
|
+
assert.equal(element.valueEnd, '100');
|
|
1284
|
+
});
|
|
1285
|
+
|
|
1286
|
+
test('fires change event with valueStart and valueEnd detail', async () => {
|
|
1287
|
+
await element.updateComplete;
|
|
1288
|
+
let detail: { valueStart: string; valueEnd: string } | undefined;
|
|
1289
|
+
element.addEventListener('change', (e: Event) => {
|
|
1290
|
+
detail = (e as CustomEvent).detail;
|
|
1291
|
+
});
|
|
1292
|
+
clickAtFraction(element, 0.25);
|
|
1293
|
+
assert.deepEqual(detail, { valueStart: '25', valueEnd: '100' });
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
test('snaps clicked value to nearest step', async () => {
|
|
1297
|
+
element.step = 10;
|
|
1298
|
+
await element.updateComplete;
|
|
1299
|
+
clickAtFraction(element, 0.23);
|
|
1300
|
+
assert.equal(element.valueStart, '20');
|
|
1301
|
+
assert.equal(element.valueEnd, '100');
|
|
1302
|
+
});
|
|
1303
|
+
|
|
1304
|
+
test('does not move start thumb when snapped value would equal end', async () => {
|
|
1305
|
+
element.valueStart = '40';
|
|
1306
|
+
element.valueEnd = '50';
|
|
1307
|
+
element.step = 10;
|
|
1308
|
+
await element.updateComplete;
|
|
1309
|
+
// 45% is equidistant (tie → start preferred), but snaps to 50 which is not < endNum=50 → no move
|
|
1310
|
+
clickAtFraction(element, 0.45);
|
|
1311
|
+
assert.equal(element.valueStart, '40');
|
|
1312
|
+
assert.equal(element.valueEnd, '50');
|
|
1313
|
+
});
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1198
1316
|
suite('zui-slider step dots', () => {
|
|
1199
1317
|
let element: ZuiSlider;
|
|
1200
1318
|
|