@zywave/zui-slider 4.4.0-pre.4 → 4.4.0-pre.6

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.
@@ -94,46 +94,41 @@
94
94
  "kind": "field",
95
95
  "name": "#thumbInputState",
96
96
  "privacy": "private",
97
- "default": "new Map< ThumbFlag, { visible: boolean; focused: boolean; timer?: ReturnType<typeof setTimeout>; debounceTimer?: ReturnType<typeof setTimeout>; } >([ ['thumb', { visible: false, focused: false }], ['startThumb', { visible: false, focused: false }], ['endThumb', { visible: false, focused: false }], ])"
97
+ "default": "new Map< ThumbFlag, { visible: boolean; focused: boolean; committed: boolean; timer?: ReturnType<typeof setTimeout>; } >([ ['thumb', { visible: false, focused: false, committed: false }], ['startThumb', { visible: false, focused: false, committed: false }], ['endThumb', { visible: false, focused: false, committed: false }], ])"
98
98
  },
99
99
  {
100
100
  "kind": "field",
101
- "name": "#onThumbFloatingInput",
102
- "privacy": "private"
103
- },
104
- {
105
- "kind": "field",
106
- "name": "#onStartThumbFloatingInput",
101
+ "name": "#onThumbFloatingChange",
107
102
  "privacy": "private"
108
103
  },
109
104
  {
110
105
  "kind": "field",
111
- "name": "#onEndThumbFloatingInput",
106
+ "name": "#onStartThumbFloatingChange",
112
107
  "privacy": "private"
113
108
  },
114
109
  {
115
110
  "kind": "field",
116
- "name": "#onThumbFloatingChange",
111
+ "name": "#onEndThumbFloatingChange",
117
112
  "privacy": "private"
118
113
  },
119
114
  {
120
115
  "kind": "field",
121
- "name": "#onStartThumbFloatingChange",
116
+ "name": "#onFloatingInputKeydown",
122
117
  "privacy": "private"
123
118
  },
124
119
  {
125
120
  "kind": "field",
126
- "name": "#onEndThumbFloatingChange",
121
+ "name": "#onRangeStartInput",
127
122
  "privacy": "private"
128
123
  },
129
124
  {
130
125
  "kind": "field",
131
- "name": "#onRangeStartInput",
126
+ "name": "#onRangeEndInput",
132
127
  "privacy": "private"
133
128
  },
134
129
  {
135
130
  "kind": "field",
136
- "name": "#onRangeEndInput",
131
+ "name": "#stopClickPropagation",
137
132
  "privacy": "private"
138
133
  },
139
134
  {
@@ -141,9 +136,9 @@
141
136
  "name": "#h",
142
137
  "privacy": "private",
143
138
  "type": {
144
- "text": "Record<ThumbFlag, { show: () => void; hide: () => void; focus: () => void; blur: () => void }>"
139
+ "text": "Record<\n ThumbFlag,\n { show: () => void; hide: () => void; focus: () => void; input: () => void; blurCommit: (e: FocusEvent) => void }\n >"
145
140
  },
146
- "default": "{ thumb: { show: () => this.#showThumbInput('thumb'), hide: () => this.#scheduleHideThumbInput('thumb'), focus: () => this.#focusFloatingInput('thumb'), blur: () => this.#blurFloatingInput('thumb'), }, startThumb: { show: () => this.#showThumbInput('startThumb'), hide: () => this.#scheduleHideThumbInput('startThumb'), focus: () => this.#focusFloatingInput('startThumb'), blur: () => this.#blurFloatingInput('startThumb'), }, endThumb: { show: () => this.#showThumbInput('endThumb'), hide: () => this.#scheduleHideThumbInput('endThumb'), focus: () => this.#focusFloatingInput('endThumb'), blur: () => this.#blurFloatingInput('endThumb'), }, }"
141
+ "default": "{ thumb: this.#makeThumbHandlers('thumb'), startThumb: this.#makeThumbHandlers('startThumb'), endThumb: this.#makeThumbHandlers('endThumb'), }"
147
142
  },
148
143
  {
149
144
  "kind": "field",
@@ -593,12 +588,6 @@
593
588
  "text": "string"
594
589
  }
595
590
  },
596
- {
597
- "name": "onInput",
598
- "type": {
599
- "text": "(e: Event) => void"
600
- }
601
- },
602
591
  {
603
592
  "name": "onFloatingChange",
604
593
  "type": {
@@ -691,7 +680,7 @@
691
680
  },
692
681
  {
693
682
  "kind": "method",
694
- "name": "#makeFloatingChange",
683
+ "name": "#makeThumbHandlers",
695
684
  "privacy": "private",
696
685
  "parameters": [
697
686
  {
@@ -699,24 +688,12 @@
699
688
  "type": {
700
689
  "text": "ThumbFlag"
701
690
  }
702
- },
703
- {
704
- "name": "setter",
705
- "type": {
706
- "text": "(val: string) => void"
707
- }
708
- },
709
- {
710
- "name": "dispatch",
711
- "type": {
712
- "text": "() => void"
713
- }
714
691
  }
715
692
  ]
716
693
  },
717
694
  {
718
695
  "kind": "method",
719
- "name": "#onFloatingInput",
696
+ "name": "#makeFloatingChange",
720
697
  "privacy": "private",
721
698
  "parameters": [
722
699
  {
@@ -730,6 +707,12 @@
730
707
  "type": {
731
708
  "text": "(val: string) => void"
732
709
  }
710
+ },
711
+ {
712
+ "name": "dispatch",
713
+ "type": {
714
+ "text": "() => void"
715
+ }
733
716
  }
734
717
  ]
735
718
  },
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host .thumb-input input{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::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input:hover{border-color:var(--zui-gray-400)}:host .thumb-input input:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly]{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;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:auto}:host .thumb-input input{width:var(--zui-slider-input-width);text-align:center}:host .thumb-input input::-webkit-inner-spin-button,:host .thumb-input input::-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,:host .step-dots .step-dot--last{width:.125rem;height:1rem;border-radius:.125rem}:host .step-dots .step-dot-label{position:absolute;top:.375rem;font-weight:600;white-space:nowrap;color:var(--zui-gray-600);transform:translateX(-50%);user-select:none}:host .step-dots .step-dot-label:nth-child(2){transform:none}:host .step-dots .step-dot-label:last-child{transform:translateX(-100%)}: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;user-select:none}: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}`;
2
+ export const style = css `:host .thumb-input input{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::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input:hover{border-color:var(--zui-gray-400)}:host .thumb-input input:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly]{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;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:auto}:host .thumb-input input{width:var(--zui-slider-input-width);text-align:center}:host .thumb-input input::-webkit-inner-spin-button,:host .thumb-input input::-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,:host .step-dots .step-dot--last{width:.125rem;height:1rem;border-radius:.125rem}:host .step-dots .step-dot-label{position:absolute;top:.375rem;font-size:.6875rem;font-weight:600;white-space:nowrap;color:var(--zui-gray-600);transform:translateX(-50%);user-select:none}:host .step-dots .step-dot-label:nth-child(2){transform:none}:host .step-dots .step-dot-label:last-child{transform:translateX(-100%)}: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;user-select:none}:host .min-max-labels .min-max-label{font-size:.6875rem;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,ozOAAozO,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host .thumb-input input{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::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input:hover{border-color:var(--zui-gray-400)}:host .thumb-input input:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly]{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;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:auto}:host .thumb-input input{width:var(--zui-slider-input-width);text-align:center}:host .thumb-input input::-webkit-inner-spin-button,:host .thumb-input input::-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,:host .step-dots .step-dot--last{width:.125rem;height:1rem;border-radius:.125rem}:host .step-dots .step-dot-label{position:absolute;top:.375rem;font-weight:600;white-space:nowrap;color:var(--zui-gray-600);transform:translateX(-50%);user-select:none}:host .step-dots .step-dot-label:nth-child(2){transform:none}:host .step-dots .step-dot-label:last-child{transform:translateX(-100%)}: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;user-select:none}: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"]}
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,01OAA01O,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host .thumb-input input{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::-webkit-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input::-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input:-moz-placeholder{opacity:1;color:var(--zui-gray-200)}:host .thumb-input input:-ms-input-placeholder{color:var(--zui-gray-200)}:host .thumb-input input:not(output):-moz-ui-invalid{box-shadow:none}:host .thumb-input input:hover{border-color:var(--zui-gray-400)}:host .thumb-input input:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:none}:host .thumb-input input[disabled]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray-300)}:host .thumb-input input[disabled]:hover{border:.0625rem solid var(--zui-gray-200)}:host .thumb-input input[readonly]{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;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:auto}:host .thumb-input input{width:var(--zui-slider-input-width);text-align:center}:host .thumb-input input::-webkit-inner-spin-button,:host .thumb-input input::-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,:host .step-dots .step-dot--last{width:.125rem;height:1rem;border-radius:.125rem}:host .step-dots .step-dot-label{position:absolute;top:.375rem;font-size:.6875rem;font-weight:600;white-space:nowrap;color:var(--zui-gray-600);transform:translateX(-50%);user-select:none}:host .step-dots .step-dot-label:nth-child(2){transform:none}:host .step-dots .step-dot-label:last-child{transform:translateX(-100%)}: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;user-select:none}:host .min-max-labels .min-max-label{font-size:.6875rem;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"]}
@@ -65,41 +65,29 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
65
65
  this.#cachedNormalizedSteps = null;
66
66
  this.#cachedNumericValues = null;
67
67
  this.#thumbInputState = new Map([
68
- ['thumb', { visible: false, focused: false }],
69
- ['startThumb', { visible: false, focused: false }],
70
- ['endThumb', { visible: false, focused: false }],
68
+ ['thumb', { visible: false, focused: false, committed: false }],
69
+ ['startThumb', { visible: false, focused: false, committed: false }],
70
+ ['endThumb', { visible: false, focused: false, committed: false }],
71
71
  ]);
72
- // Pre-bound floating input handlers cached to avoid new function references on every render
73
- this.#onThumbFloatingInput = this.#onFloatingInput('thumb', (v) => (this.value = v));
74
- this.#onStartThumbFloatingInput = this.#onFloatingInput('startThumb', (v) => (this.valueStart = v));
75
- this.#onEndThumbFloatingInput = this.#onFloatingInput('endThumb', (v) => (this.valueEnd = v));
76
- // Cached floating input change handlers; flush debounce and dispatch immediately on commit (Enter/blur)
77
72
  this.#onThumbFloatingChange = this.#makeFloatingChange('thumb', (v) => (this.value = v), () => this.#onChange());
78
73
  this.#onStartThumbFloatingChange = this.#makeFloatingChange('startThumb', (v) => (this.valueStart = v), () => this.#onRangeChange());
79
74
  this.#onEndThumbFloatingChange = this.#makeFloatingChange('endThumb', (v) => (this.valueEnd = v), () => this.#onRangeChange());
80
- // Cached range drag input handlers
75
+ // Cached keydown handler: Enter commits the floating input value in both number and text modes.
76
+ this.#onFloatingInputKeydown = (e) => {
77
+ if (e.key === 'Enter') {
78
+ e.preventDefault();
79
+ const input = e.target;
80
+ input.dispatchEvent(new Event('change'));
81
+ }
82
+ };
81
83
  this.#onRangeStartInput = this.#onRangeInput('start');
82
84
  this.#onRangeEndInput = this.#onRangeInput('end');
85
+ this.#stopClickPropagation = (e) => e.stopPropagation();
83
86
  // Cached pointer/focus handlers per thumb; prevents new closures on every render
84
87
  this.#h = {
85
- thumb: {
86
- show: () => this.#showThumbInput('thumb'),
87
- hide: () => this.#scheduleHideThumbInput('thumb'),
88
- focus: () => this.#focusFloatingInput('thumb'),
89
- blur: () => this.#blurFloatingInput('thumb'),
90
- },
91
- startThumb: {
92
- show: () => this.#showThumbInput('startThumb'),
93
- hide: () => this.#scheduleHideThumbInput('startThumb'),
94
- focus: () => this.#focusFloatingInput('startThumb'),
95
- blur: () => this.#blurFloatingInput('startThumb'),
96
- },
97
- endThumb: {
98
- show: () => this.#showThumbInput('endThumb'),
99
- hide: () => this.#scheduleHideThumbInput('endThumb'),
100
- focus: () => this.#focusFloatingInput('endThumb'),
101
- blur: () => this.#blurFloatingInput('endThumb'),
102
- },
88
+ thumb: this.#makeThumbHandlers('thumb'),
89
+ startThumb: this.#makeThumbHandlers('startThumb'),
90
+ endThumb: this.#makeThumbHandlers('endThumb'),
103
91
  };
104
92
  this.steps = [];
105
93
  this.stepParser = null;
@@ -119,17 +107,14 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
119
107
  #cachedNormalizedSteps;
120
108
  #cachedNumericValues;
121
109
  #thumbInputState;
122
- // Pre-bound floating input handlers cached to avoid new function references on every render
123
- #onThumbFloatingInput;
124
- #onStartThumbFloatingInput;
125
- #onEndThumbFloatingInput;
126
- // Cached floating input change handlers; flush debounce and dispatch immediately on commit (Enter/blur)
127
110
  #onThumbFloatingChange;
128
111
  #onStartThumbFloatingChange;
129
112
  #onEndThumbFloatingChange;
130
- // Cached range drag input handlers
113
+ // Cached keydown handler: Enter commits the floating input value in both number and text modes.
114
+ #onFloatingInputKeydown;
131
115
  #onRangeStartInput;
132
116
  #onRangeEndInput;
117
+ #stopClickPropagation;
133
118
  // Cached pointer/focus handlers per thumb; prevents new closures on every render
134
119
  #h;
135
120
  static get styles() {
@@ -233,11 +218,10 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
233
218
  #clearAllThumbInputState() {
234
219
  for (const entry of this.#thumbInputState.values()) {
235
220
  clearTimeout(entry.timer);
236
- clearTimeout(entry.debounceTimer);
237
221
  entry.timer = undefined;
238
- entry.debounceTimer = undefined;
239
222
  entry.visible = false;
240
223
  entry.focused = false;
224
+ entry.committed = false;
241
225
  }
242
226
  }
243
227
  #syncValuesToSteps() {
@@ -471,6 +455,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
471
455
  #renderSingle() {
472
456
  const progress = this.progress;
473
457
  const { nativeMin, nativeMax, nativeStep } = this.#nativeRangeAttrs;
458
+ // live() required: direct DOM writes during drag don't trigger a state change, so Lit won't re-sync without it.
474
459
  const nativeValue = this.#stepsMode ? String(Math.max(0, this.#stepsIndexOf(this.#value))) : this.#value;
475
460
  return html `
476
461
  <div class="single-wrapper">
@@ -481,7 +466,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
481
466
  .min="${nativeMin}"
482
467
  .max="${nativeMax}"
483
468
  .step="${nativeStep}"
484
- .value="${nativeValue}"
469
+ .value="${live(nativeValue)}"
485
470
  ?disabled="${this.disabled || this.readOnly}"
486
471
  @input="${this.#onInput}"
487
472
  @change="${this.#onChange}"
@@ -490,7 +475,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
490
475
  @focus="${this.#h.thumb.show}"
491
476
  @blur="${this.#h.thumb.hide}"
492
477
  />
493
- ${this.#renderFloatingInput(this.#value, this.#onThumbFloatingInput, this.#onThumbFloatingChange, 'thumb', this.#isVisible('thumb'), progress)}
478
+ ${this.#renderFloatingInput(this.#value, this.#onThumbFloatingChange, 'thumb', this.#isVisible('thumb'), progress)}
494
479
  ${this.#renderStepDots()}
495
480
  </div>
496
481
  `;
@@ -501,9 +486,9 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
501
486
  return html `
502
487
  <div class="range-wrapper" @click="${this.#onTrackClick}">
503
488
  ${this.#renderRangeInput('start', this.#rangeTrackBackground(progressStart, progressEnd))}
504
- ${this.#renderFloatingInput(this.#valueStart, this.#onStartThumbFloatingInput, this.#onStartThumbFloatingChange, 'startThumb', this.#isVisible('startThumb'), progressStart)}
489
+ ${this.#renderFloatingInput(this.#valueStart, this.#onStartThumbFloatingChange, 'startThumb', this.#isVisible('startThumb'), progressStart)}
505
490
  ${this.#renderRangeInput('end')}
506
- ${this.#renderFloatingInput(this.#valueEnd, this.#onEndThumbFloatingInput, this.#onEndThumbFloatingChange, 'endThumb', this.#isVisible('endThumb'), progressEnd)}
491
+ ${this.#renderFloatingInput(this.#valueEnd, this.#onEndThumbFloatingChange, 'endThumb', this.#isVisible('endThumb'), progressEnd)}
507
492
  ${this.#renderStepDots()}
508
493
  </div>
509
494
  `;
@@ -527,6 +512,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
527
512
  .step="${nativeStep}"
528
513
  .value="${live(nativeValue)}"
529
514
  ?disabled="${this.disabled || this.readOnly}"
515
+ @click="${this.#stopClickPropagation}"
530
516
  @input="${onInput}"
531
517
  @change="${this.#onRangeChange}"
532
518
  @pointerenter="${h.show}"
@@ -536,15 +522,16 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
536
522
  />
537
523
  `;
538
524
  }
539
- #renderFloatingInput(val, onInput, onFloatingChange, flag, visible, progress) {
525
+ #renderFloatingInput(val, onFloatingChange, flag, visible, progress) {
540
526
  const h = this.#h[flag];
541
527
  // type="text" in steps mode to allow label and stepParser input.
542
- // live() required: same-value debounce resolutions skip reactive updates, so Lit won't re-sync without it.
528
+ // live() required: commits that snap/clamp to the current value skip reactive updates, so Lit won't re-sync without it.
543
529
  const ariaLabel = flag === 'startThumb' ? 'Range start value' : flag === 'endThumb' ? 'Range end value' : 'Slider value';
544
530
  return html `
545
531
  <div
546
532
  class=${classMap({ 'thumb-input': true, 'thumb-input--visible': visible })}
547
533
  style=${styleMap({ left: _a.#thumbPositionCSS(progress) })}
534
+ @click="${this.#stopClickPropagation}"
548
535
  @pointerenter="${h.show}"
549
536
  @pointerleave="${h.hide}"
550
537
  >
@@ -557,10 +544,11 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
557
544
  .step="${this.#stepsMode ? '' : this.step > 0 ? String(this.step) : '1'}"
558
545
  ?disabled="${this.disabled}"
559
546
  ?readonly="${this.readOnly}"
560
- @input="${onInput}"
547
+ @keydown="${this.#onFloatingInputKeydown}"
548
+ @input="${h.input}"
561
549
  @change="${onFloatingChange}"
562
550
  @focus="${h.focus}"
563
- @blur="${h.blur}"
551
+ @blur="${h.blurCommit}"
564
552
  />
565
553
  </div>
566
554
  `;
@@ -616,7 +604,7 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
616
604
  const normalized = this.#normalizedSteps;
617
605
  const minLabel = this.#stepsMode ? normalized[0]?.label ?? '' : String(this.min);
618
606
  const maxLabel = this.#stepsMode ? normalized[normalized.length - 1]?.label ?? '' : String(this.max);
619
- const hidden = this.showStepLabels && this.#stepsMode;
607
+ const hidden = this.showStepLabels;
620
608
  return html `
621
609
  <div
622
610
  class="min-max-labels"
@@ -659,66 +647,86 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
659
647
  }
660
648
  return this.#value;
661
649
  }
650
+ #makeThumbHandlers(flag) {
651
+ return {
652
+ show: () => this.#showThumbInput(flag),
653
+ hide: () => this.#scheduleHideThumbInput(flag),
654
+ focus: () => this.#focusFloatingInput(flag),
655
+ input: () => {
656
+ this.#thumbInputState.get(flag).committed = false;
657
+ },
658
+ blurCommit: (e) => {
659
+ const entry = this.#thumbInputState.get(flag);
660
+ if (!entry.committed) {
661
+ e.target.dispatchEvent(new Event('change'));
662
+ }
663
+ entry.committed = false;
664
+ this.#blurFloatingInput(flag);
665
+ },
666
+ };
667
+ }
662
668
  #makeFloatingChange(flag, setter, dispatch) {
663
669
  return (e) => {
664
670
  if (this.readOnly) {
665
671
  return;
666
672
  }
667
673
  const input = e.target;
668
- const entry = this.#thumbInputState.get(flag);
669
- clearTimeout(entry.debounceTimer);
670
- entry.debounceTimer = undefined;
671
674
  if (input.value === '') {
672
675
  input.value = this.#currentValueForFlag(flag);
673
676
  return;
674
677
  }
678
+ const before = this.#currentValueForFlag(flag);
679
+ const commit = (value) => {
680
+ setter(value);
681
+ this.#thumbInputState.get(flag).committed = true;
682
+ if (this.#currentValueForFlag(flag) !== before) {
683
+ dispatch();
684
+ }
685
+ };
675
686
  if (this.#stepsMode) {
676
687
  const resolved = this.#resolveFloatingInput(input.value);
677
688
  if (resolved !== null) {
678
- setter(resolved);
679
- this.requestUpdate();
680
- dispatch();
689
+ let finalResolved = resolved;
690
+ if (flag !== 'thumb') {
691
+ const resolvedIdx = this.#stepsIndexOf(resolved);
692
+ const endIdx = Math.max(0, this.#stepsIndexOf(this.#valueEnd));
693
+ const startIdx = Math.max(0, this.#stepsIndexOf(this.#valueStart));
694
+ if (flag === 'startThumb' && resolvedIdx >= endIdx) {
695
+ const nudgedIdx = endIdx - 1;
696
+ finalResolved = nudgedIdx >= 0 ? this.#stepAt(nudgedIdx) : this.#currentValueForFlag(flag);
697
+ }
698
+ else if (flag === 'endThumb' && resolvedIdx <= startIdx) {
699
+ const nudgedIdx = startIdx + 1;
700
+ finalResolved =
701
+ nudgedIdx < this.#normalizedSteps.length ? this.#stepAt(nudgedIdx) : this.#currentValueForFlag(flag);
702
+ }
703
+ }
704
+ commit(finalResolved);
681
705
  }
682
706
  else {
683
707
  input.value = this.#currentValueForFlag(flag);
684
708
  }
685
709
  }
686
710
  else {
687
- setter(this.#processFloatingValue(parseFloat(input.value)));
688
- this.requestUpdate();
689
- dispatch();
690
- }
691
- };
692
- }
693
- #onFloatingInput(flag, setter) {
694
- return (e) => {
695
- if (this.readOnly) {
696
- return;
697
- }
698
- const input = e.target;
699
- const entry = this.#thumbInputState.get(flag);
700
- clearTimeout(entry.debounceTimer);
701
- entry.debounceTimer = undefined;
702
- if (input.value === '') {
703
- return;
704
- }
705
- if (this.#stepsMode) {
706
- // Capture raw string at event time so the debounce closure reads the right value
707
- const raw = input.value;
708
- entry.debounceTimer = setTimeout(() => {
709
- const resolved = this.#resolveFloatingInput(raw);
710
- if (resolved !== null) {
711
- setter(resolved);
712
- this.requestUpdate();
711
+ let processed = this.#processFloatingValue(parseFloat(input.value));
712
+ if (flag !== 'thumb') {
713
+ const effectiveStep = this.step > 0 ? this.step : 1;
714
+ if (flag === 'startThumb') {
715
+ const endNum = parseFloat(this.#valueEnd);
716
+ if (parseFloat(processed) >= endNum) {
717
+ const nudged = this.#processFloatingValue(endNum - effectiveStep);
718
+ processed = parseFloat(nudged) < endNum ? nudged : this.#currentValueForFlag(flag);
719
+ }
713
720
  }
714
- }, 500);
715
- }
716
- else {
717
- const raw = parseFloat(input.value);
718
- entry.debounceTimer = setTimeout(() => {
719
- setter(this.#processFloatingValue(raw));
720
- this.requestUpdate();
721
- }, 500);
721
+ else {
722
+ const startNum = parseFloat(this.#valueStart);
723
+ if (parseFloat(processed) <= startNum) {
724
+ const nudged = this.#processFloatingValue(startNum + effectiveStep);
725
+ processed = parseFloat(nudged) > startNum ? nudged : this.#currentValueForFlag(flag);
726
+ }
727
+ }
728
+ }
729
+ commit(processed);
722
730
  }
723
731
  };
724
732
  }
@@ -861,7 +869,9 @@ export class ZuiSlider extends ZuiFormAssociatedElement {
861
869
  return;
862
870
  }
863
871
  this.#showThumbInput(flag);
864
- this.#thumbInputState.get(flag).focused = true;
872
+ const entry = this.#thumbInputState.get(flag);
873
+ entry.focused = true;
874
+ entry.committed = false;
865
875
  }
866
876
  #blurFloatingInput(flag) {
867
877
  const entry = this.#thumbInputState.get(flag);