@m3ui-vue/m3ui-vue 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +1 -1
  2. package/dist/API.md +70 -8
  3. package/dist/{MMenuItem-BckcR0nW.js → MMenuItem-BfjqwcYP.js} +84 -63
  4. package/dist/MMenuItem-BfjqwcYP.js.map +1 -0
  5. package/dist/MSlider-JflHJ70q.js +1525 -0
  6. package/dist/MSlider-JflHJ70q.js.map +1 -0
  7. package/dist/{MTextField-FCPOTB0o.js → MTextField-NaIB6RbM.js} +5 -4
  8. package/dist/MTextField-NaIB6RbM.js.map +1 -0
  9. package/dist/api.json +1 -1
  10. package/dist/code-editor.js +1 -1
  11. package/dist/components/MAnimatedNumber.vue.d.ts +3 -1
  12. package/dist/components/MButton.vue.d.ts +2 -0
  13. package/dist/components/MContainerTransform.vue.d.ts +59 -0
  14. package/dist/components/MDialog.vue.d.ts +8 -5
  15. package/dist/components/MFlex.vue.d.ts +1 -1
  16. package/dist/components/MIconButton.vue.d.ts +2 -0
  17. package/dist/components/MListItem.vue.d.ts +5 -5
  18. package/dist/components/MNavigationRail.vue.d.ts +1 -1
  19. package/dist/components/MSplitter.vue.d.ts +1 -1
  20. package/dist/components/MStack.vue.d.ts +1 -1
  21. package/dist/components/MToolbar.vue.d.ts +32 -5
  22. package/dist/components/_MToolbarFab.vue.d.ts +16 -0
  23. package/dist/composables/_containerTransform.d.ts +48 -0
  24. package/dist/composables/useContainerTransform.d.ts +30 -0
  25. package/dist/composables/useLocale.d.ts +3 -0
  26. package/dist/index.d.ts +3 -0
  27. package/dist/locales/index.js +14 -0
  28. package/dist/locales/index.js.map +1 -1
  29. package/dist/m3ui-vue.css +1 -1
  30. package/dist/m3ui.js +4217 -3713
  31. package/dist/m3ui.js.map +1 -1
  32. package/dist/map.js +38 -38
  33. package/dist/rich-text-editor.js +10 -10
  34. package/dist/styles.css +1 -1
  35. package/dist/{useLocale-SfQHnJfp.js → useLocale-CXibICQA.js} +3 -1
  36. package/dist/useLocale-CXibICQA.js.map +1 -0
  37. package/package.json +2 -1
  38. package/src/__tests__/MAnimatedNumber.test.ts +24 -2
  39. package/src/__tests__/MContainerTransform.test.ts +279 -0
  40. package/src/__tests__/MDialog.test.ts +27 -0
  41. package/src/__tests__/MListItemExpandable.test.ts +48 -0
  42. package/src/__tests__/MListItemShape.test.ts +9 -6
  43. package/src/__tests__/MListKeyboard.test.ts +90 -0
  44. package/src/__tests__/MMapTools.test.ts +2 -1
  45. package/src/__tests__/MNavigationRail.test.ts +33 -0
  46. package/src/__tests__/MSlider.test.ts +161 -0
  47. package/src/__tests__/MToolbar.test.ts +157 -0
  48. package/src/__tests__/attrsFallthrough.test.ts +6 -0
  49. package/src/__tests__/hydration.test.ts +25 -0
  50. package/src/components/MAnimatedNumber.vue +32 -6
  51. package/src/components/MButton.vue +4 -2
  52. package/src/components/MContainerTransform.vue +321 -0
  53. package/src/components/MDialog.vue +31 -6
  54. package/src/components/MFab.vue +10 -5
  55. package/src/components/MIconButton.vue +3 -1
  56. package/src/components/MList.vue +26 -2
  57. package/src/components/MListItem.vue +138 -84
  58. package/src/components/MNavigationRail.vue +40 -10
  59. package/src/components/MSlider.vue +161 -42
  60. package/src/components/MToolbar.vue +256 -15
  61. package/src/components/_MToolbarFab.vue +14 -0
  62. package/src/composables/_containerTransform.ts +179 -0
  63. package/src/composables/_useEscapeStack.ts +2 -0
  64. package/src/composables/useContainerTransform.ts +59 -0
  65. package/src/composables/useLocale.ts +5 -0
  66. package/src/index.ts +3 -0
  67. package/src/locales/de.ts +2 -0
  68. package/src/locales/es.ts +2 -0
  69. package/src/locales/fr.ts +2 -0
  70. package/src/locales/ja.ts +2 -0
  71. package/src/locales/ko.ts +2 -0
  72. package/src/locales/pt.ts +2 -0
  73. package/src/locales/zh.ts +2 -0
  74. package/dist/MMenuItem-BckcR0nW.js.map +0 -1
  75. package/dist/MSlider-LyH_gy8D.js +0 -1411
  76. package/dist/MSlider-LyH_gy8D.js.map +0 -1
  77. package/dist/MTextField-FCPOTB0o.js.map +0 -1
  78. package/dist/useLocale-SfQHnJfp.js.map +0 -1
@@ -6,8 +6,9 @@
6
6
  * @event update:modelValue Emitted while dragging and on key presses, with the new value (a `[low, high]` pair
7
7
  * for the range variant).
8
8
  */
9
- import { computed, onBeforeUnmount, ref } from 'vue'
9
+ import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
10
10
  import MIcon from './MIcon.vue'
11
+ import { useLocale } from '../composables/useLocale'
11
12
 
12
13
  const props = withDefaults(
13
14
  defineProps<{
@@ -63,9 +64,30 @@ const props = withDefaults(
63
64
 
64
65
  const emit = defineEmits<{ 'update:modelValue': [number | [number, number]] }>()
65
66
 
67
+ const t = useLocale()
66
68
  const trackEl = ref<HTMLElement>()
69
+ const thumbEls = ref<HTMLElement[]>([])
70
+ // Range: 0 = the start (low) thumb, 1 = the end (high) one
67
71
  const dragging = ref<false | 'single' | 0 | 1>(false)
68
72
  const focused = ref(false)
73
+ const focusedThumb = ref<0 | 1 | null>(null)
74
+ // Range: a press focuses the thumb it moves (so the arrows move that one next), from script, which browsers take as
75
+ // :focus-visible. The ring is ours instead: only for focus from the keyboard, or once the keys are used after a press
76
+ const keyboardThumb = ref<0 | 1 | null>(null)
77
+ let focusingFromPointer = false
78
+ function focusThumb(idx: 0 | 1) {
79
+ focusingFromPointer = true
80
+ thumbEls.value[idx]?.focus({ preventScroll: true })
81
+ focusingFromPointer = false
82
+ }
83
+ function onThumbFocus(idx: 0 | 1) {
84
+ focusedThumb.value = idx
85
+ keyboardThumb.value = focusingFromPointer ? null : idx
86
+ }
87
+ function onThumbBlur() {
88
+ focusedThumb.value = null
89
+ keyboardThumb.value = null
90
+ }
69
91
  const isVertical = computed(() => props.orientation === 'vertical')
70
92
  const isRange = computed(() => props.variant === 'range')
71
93
  const isCentered = computed(() => props.variant === 'centered')
@@ -92,16 +114,56 @@ const centerPct = computed(() => toPct(0))
92
114
  // Standard never gets a start indicator at all (matches the official M3
93
115
  // slider: only the far/unreached end is ever marked).
94
116
  const startDotHidden = computed(() => {
117
+ if (startLen.value < s.value.dotInset + s.value.dot / 2) return true
95
118
  if (props.variant === 'centered') return Math.min(pctLo.value, centerPct.value) <= 0
96
119
  if (props.variant === 'range') return pctLo.value <= 0
97
120
  return true
98
121
  })
99
122
  const endDotHidden = computed(() => {
123
+ if (endLen.value < s.value.dotInset + s.value.dot / 2) return true
100
124
  if (props.variant === 'centered') return Math.max(pctLo.value, centerPct.value) >= 100
101
125
  if (props.variant === 'range') return pctHi.value >= 100
102
126
  return pctLo.value >= 100
103
127
  })
104
128
 
129
+ // Near the ends, the inactive piece between a thumb and the track's end gets shorter than its own corner: like
130
+ // Compose's Slider (drawTrack only draws an inactive piece longer than its corner radius, with its stop indicator),
131
+ // it goes, and the dot goes as soon as it no longer fits inside it (it was left floating in the thumb's gap).
132
+ // Needs the track's length in px, measured; before that (server render) both behave as before.
133
+ const trackLen = ref(0)
134
+ let resizeObserver: ResizeObserver | undefined
135
+ const measureTrack = () => {
136
+ const el = trackEl.value
137
+ if (el) trackLen.value = isVertical.value ? el.offsetHeight : el.offsetWidth
138
+ }
139
+ onMounted(() => {
140
+ measureTrack()
141
+ if (typeof ResizeObserver === 'undefined' || !trackEl.value) return
142
+ resizeObserver = new ResizeObserver(measureTrack)
143
+ resizeObserver.observe(trackEl.value)
144
+ })
145
+ onBeforeUnmount(() => resizeObserver?.disconnect())
146
+ /** A thumb's clamped position (clampedPos) in px from the start */
147
+ const posPx = (pct: number) => {
148
+ const inset = s.value.thumbInset
149
+ return Math.min(Math.max((pct / 100) * trackLen.value, inset), trackLen.value - inset)
150
+ }
151
+ // Length of the inactive piece at each end that a thumb bounds (Infinity where no thumb does, or before measuring)
152
+ const startLen = computed(() => {
153
+ if (!trackLen.value) return Infinity
154
+ if (props.variant === 'range') return posPx(pctLo.value) - gap.value
155
+ if (props.variant === 'centered' && pctLo.value <= centerPct.value) return posPx(pctLo.value) - gap.value
156
+ return Infinity
157
+ })
158
+ const endLen = computed(() => {
159
+ if (!trackLen.value) return Infinity
160
+ if (props.variant === 'range') return trackLen.value - posPx(pctHi.value) - gap.value
161
+ if (props.variant === 'centered' && pctLo.value < centerPct.value) return Infinity
162
+ return trackLen.value - posPx(pctLo.value) - gap.value
163
+ })
164
+ const startPieceHidden = computed(() => startLen.value <= fullR.value)
165
+ const endPieceHidden = computed(() => endLen.value <= fullR.value)
166
+
105
167
  const sizeMap = {
106
168
  // thumbH 44 matches SliderTokens.HandleHeight exactly — hitArea bumped from
107
169
  // 38 to 46 to keep containing it (was sized for the old 32px handle).
@@ -177,19 +239,33 @@ function valueFromEvent(e: PointerEvent) {
177
239
  return clamp(props.min + ratioFromEvent(e) * (props.max - props.min))
178
240
  }
179
241
 
242
+ // Range: like Compose's RangeSlider, a thumb never passes the other (start ∈ [min, end], end ∈ [start, max]), so
243
+ // the emitted pair is always [low, high]. A press takes the thumb on its side; on two overlapping thumbs, the
244
+ // first move's direction picks one (Compose's fix for taps and drags when thumbs overlap).
245
+ let overlapPress = false
246
+ function rangeValue(idx: 0 | 1, v: number): [number, number] {
247
+ const { lo, hi } = val.value
248
+ return idx === 0 ? [Math.min(v, hi), hi] : [lo, Math.max(v, lo)]
249
+ }
250
+
180
251
  function onPointerDown(e: PointerEvent) {
181
252
  if (props.disabled) return
182
253
  e.preventDefault()
183
254
  const v = valueFromEvent(e)
184
255
  if (isRange.value) {
185
- const cur = props.modelValue as [number, number]
186
- const dist0 = Math.abs(v - cur[0])
187
- const dist1 = Math.abs(v - cur[1])
188
- const idx: 0 | 1 = dist0 <= dist1 ? 0 : 1
256
+ const { lo, hi } = val.value
257
+ overlapPress = false
258
+ let idx: 0 | 1
259
+ if (v <= lo && v < hi) idx = 0
260
+ else if (v >= hi && v > lo) idx = 1
261
+ else if (lo === hi) {
262
+ // Right on two overlapping thumbs: wait for the drag's direction
263
+ idx = 0
264
+ overlapPress = true
265
+ } else idx = Math.abs(v - lo) <= Math.abs(v - hi) ? 0 : 1
189
266
  dragging.value = idx
190
- const next: [number, number] = [cur[0], cur[1]]
191
- next[idx] = v
192
- emit('update:modelValue', next)
267
+ focusThumb(idx)
268
+ if (!overlapPress) emit('update:modelValue', rangeValue(idx, v))
193
269
  } else {
194
270
  dragging.value = 'single'
195
271
  emit('update:modelValue', v)
@@ -203,10 +279,13 @@ function onPointerMove(e: PointerEvent) {
203
279
  if (dragging.value === false) return
204
280
  const v = valueFromEvent(e)
205
281
  if (isRange.value) {
206
- const cur = props.modelValue as [number, number]
207
- const next: [number, number] = [cur[0], cur[1]]
208
- next[dragging.value as 0 | 1] = v
209
- emit('update:modelValue', next)
282
+ if (overlapPress) {
283
+ if (v === val.value.lo) return
284
+ overlapPress = false
285
+ dragging.value = v > val.value.lo ? 1 : 0
286
+ focusThumb(dragging.value)
287
+ }
288
+ emit('update:modelValue', rangeValue(dragging.value as 0 | 1, v))
210
289
  } else {
211
290
  emit('update:modelValue', v)
212
291
  }
@@ -214,26 +293,39 @@ function onPointerMove(e: PointerEvent) {
214
293
 
215
294
  function onPointerUp() {
216
295
  dragging.value = false
296
+ overlapPress = false
217
297
  window.removeEventListener('pointermove', onPointerMove)
218
298
  window.removeEventListener('pointerup', onPointerUp)
219
299
  window.removeEventListener('pointercancel', onPointerUp)
220
300
  }
221
301
 
302
+ const KEY_DELTA: Record<string, number> = { ArrowRight: 1, ArrowUp: 1, ArrowLeft: -1, ArrowDown: -1 }
303
+
222
304
  function onKeyDown(e: KeyboardEvent) {
223
305
  if (props.disabled) return
224
- const d: Record<string, number> = { ArrowRight: 1, ArrowUp: 1, ArrowLeft: -1, ArrowDown: -1 }
225
- const delta = d[e.key]
306
+ const delta = KEY_DELTA[e.key]
226
307
  if (delta !== undefined) {
227
308
  e.preventDefault()
228
- if (isRange.value) {
229
- const cur = props.modelValue as [number, number]
230
- emit('update:modelValue', [clamp(cur[0] + delta * props.step), cur[1]])
231
- } else {
232
- emit('update:modelValue', clamp((props.modelValue as number) + delta * props.step))
233
- }
309
+ emit('update:modelValue', clamp((props.modelValue as number) + delta * props.step))
234
310
  }
235
- if (e.key === 'Home') { e.preventDefault(); emit('update:modelValue', isRange.value ? [props.min, (props.modelValue as [number, number])[1]] : props.min) }
236
- if (e.key === 'End') { e.preventDefault(); emit('update:modelValue', isRange.value ? [(props.modelValue as [number, number])[0], props.max] : props.max) }
311
+ if (e.key === 'Home') { e.preventDefault(); emit('update:modelValue', props.min) }
312
+ if (e.key === 'End') { e.preventDefault(); emit('update:modelValue', props.max) }
313
+ }
314
+
315
+ // Range: each thumb is a slider of its own, moved by its keys within the other thumb
316
+ function onThumbKeyDown(idx: 0 | 1, e: KeyboardEvent) {
317
+ if (props.disabled) return
318
+ const { lo, hi } = val.value
319
+ const cur = idx === 0 ? lo : hi
320
+ const delta = KEY_DELTA[e.key]
321
+ let next: number | undefined
322
+ if (delta !== undefined) next = clamp(cur + delta * props.step)
323
+ else if (e.key === 'Home') next = idx === 0 ? props.min : lo
324
+ else if (e.key === 'End') next = idx === 0 ? hi : props.max
325
+ if (next === undefined) return
326
+ e.preventDefault()
327
+ keyboardThumb.value = idx
328
+ emit('update:modelValue', rangeValue(idx, next))
237
329
  }
238
330
 
239
331
  onBeforeUnmount(() => {
@@ -266,6 +358,7 @@ function fillActiveSize(pct: number) {
266
358
  return `calc(${clampedPos(pct)} - ${gap.value}px)`
267
359
  }
268
360
  function fillInactiveSize(pct: number) {
361
+ if (endPieceHidden.value) return '0px'
269
362
  return `calc(100% - ${clampedPos(pct)} - ${gap.value}px)`
270
363
  }
271
364
 
@@ -276,6 +369,7 @@ function fillInactiveSize(pct: number) {
276
369
 
277
370
  // Range: both pctLo and pctHi are thumbs.
278
371
  function rangeInactiveBeforeSize() {
372
+ if (startPieceHidden.value) return '0px'
279
373
  return `calc(${clampedPos(pctLo.value)} - ${gap.value}px)`
280
374
  }
281
375
  function rangeActiveStart() {
@@ -285,6 +379,7 @@ function rangeActiveSize() {
285
379
  return `calc(${clampedPos(pctHi.value)} - ${clampedPos(pctLo.value)} - ${gap.value * 2}px)`
286
380
  }
287
381
  function rangeInactiveAfterSize() {
382
+ if (endPieceHidden.value) return '0px'
288
383
  return `calc(100% - ${clampedPos(pctHi.value)} - ${gap.value}px)`
289
384
  }
290
385
 
@@ -300,11 +395,13 @@ function centeredActiveSize() {
300
395
  : `calc(${centerPct.value}% - ${clampedPos(pctLo.value)} - ${gap.value}px)`
301
396
  }
302
397
  function centeredFarInactiveSize() {
398
+ if (endPieceHidden.value) return '0px'
303
399
  return pctLo.value >= centerPct.value
304
400
  ? `calc(100% - ${clampedPos(pctLo.value)} - ${gap.value}px)`
305
401
  : `calc(100% - ${centerPct.value}% - ${gap.value}px)`
306
402
  }
307
403
  function centeredNearInactiveSize() {
404
+ if (startPieceHidden.value) return '0px'
308
405
  return pctLo.value <= centerPct.value
309
406
  ? `calc(${clampedPos(pctLo.value)} - ${gap.value}px)`
310
407
  : `calc(${centerPct.value}% - ${gap.value}px)`
@@ -350,7 +447,7 @@ function clampedPos(pct: number) {
350
447
  return `clamp(${inset}px, ${pct}%, calc(100% - ${inset}px))`
351
448
  }
352
449
 
353
- function thumbPos(pct: number) {
450
+ function thumbPos(pct: number, idx: 0 | 1 = 0) {
354
451
  const tw = isVertical.value ? s.value.thumbH : s.value.thumbW
355
452
  const th = isVertical.value ? s.value.thumbW : s.value.thumbH
356
453
  const br = Math.min(tw, th) / 2
@@ -361,6 +458,8 @@ function thumbPos(pct: number) {
361
458
  height: `${th}px`,
362
459
  borderRadius: `${br}px`,
363
460
  backgroundColor: thumbCt.value.active,
461
+ // The keyboard focus ring takes the thumb's color (color, thumbColor), not a fixed primary
462
+ '--tw-ring-color': thumbCt.value.active,
364
463
  zIndex: '2',
365
464
  transition: nd.value ? 'left 75ms ease, bottom 75ms ease, transform 80ms ease' : 'transform 80ms ease',
366
465
  }
@@ -369,8 +468,8 @@ function thumbPos(pct: number) {
369
468
  // ratio matches SliderTokens.PressedHandleWidth/FocusHandleWidth = 2dp,
370
469
  // i.e. half of the base 4dp width — applies on keyboard focus too, not
371
470
  // just an active pointer drag (Compose's isFocused covers both).
372
- const isNarrowed = isDragging || focused.value
373
- const grow = isDragging ? 1.08 : 1
471
+ const isNarrowed = isRange.value ? dragging.value === idx || focusedThumb.value === idx : isDragging || focused.value
472
+ const grow = (isRange.value ? dragging.value === idx : isDragging) ? 1.08 : 1
374
473
  const narrow = isNarrowed ? 0.5 : 1
375
474
  if (isVertical.value) {
376
475
  base.left = '50%'
@@ -392,6 +491,7 @@ function thumbIconPos(pct: number) {
392
491
  const base: Record<string, string> = {
393
492
  position: 'absolute',
394
493
  color: thumbCt.value.active,
494
+ '--tw-ring-color': thumbCt.value.active,
395
495
  zIndex: '2',
396
496
  transition: nd.value ? 'left 75ms ease, bottom 75ms ease, transform 80ms ease' : 'transform 80ms ease',
397
497
  }
@@ -423,13 +523,13 @@ const displayValue = computed(() => {
423
523
 
424
524
  const tooltipValue = computed(() => {
425
525
  if (isRange.value && typeof dragging.value === 'number')
426
- return (props.modelValue as [number, number])[dragging.value]
526
+ return dragging.value === 0 ? val.value.lo : val.value.hi
427
527
  return props.modelValue
428
528
  })
429
529
 
430
530
  const tooltipPct = computed(() => {
431
531
  if (isRange.value && typeof dragging.value === 'number')
432
- return toPct((props.modelValue as [number, number])[dragging.value])
532
+ return dragging.value === 0 ? pctLo.value : pctHi.value
433
533
  return pctLo.value
434
534
  })
435
535
  </script>
@@ -445,13 +545,14 @@ const tooltipPct = computed(() => {
445
545
  <!-- Track area -->
446
546
  <div
447
547
  ref="trackEl"
448
- role="slider"
449
- tabindex="0"
548
+ :role="isRange ? 'group' : 'slider'"
549
+ :tabindex="isRange ? undefined : 0"
550
+ :aria-label="isRange ? label : undefined"
450
551
  :aria-valuenow="isRange ? undefined : (modelValue as number)"
451
- :aria-valuemin="min"
452
- :aria-valuemax="max"
552
+ :aria-valuemin="isRange ? undefined : min"
553
+ :aria-valuemax="isRange ? undefined : max"
453
554
  :aria-disabled="disabled || undefined"
454
- :aria-orientation="orientation"
555
+ :aria-orientation="isRange ? undefined : orientation"
455
556
  class="group relative touch-none cursor-pointer outline-none"
456
557
  :class="disabled && 'cursor-not-allowed'"
457
558
  :style="isVertical
@@ -459,8 +560,8 @@ const tooltipPct = computed(() => {
459
560
  : { height: `${s.hitArea}px`, width: '100%' }
460
561
  "
461
562
  @pointerdown="onPointerDown"
462
- @keydown="onKeyDown"
463
- @focus="focused = true"
563
+ @keydown="!isRange && onKeyDown($event)"
564
+ @focus="focused = !isRange"
464
565
  @blur="focused = false"
465
566
  >
466
567
  <!-- Track container -->
@@ -606,16 +707,34 @@ const tooltipPct = computed(() => {
606
707
  </template>
607
708
  </div>
608
709
 
609
- <!-- Thumb(s) — only the pctLo thumb takes keyboard input (arrow keys only
610
- move index 0 in range mode, see onKeyDown), so it's the only one that
611
- gets the focus-visible ring. -->
612
- <template v-if="thumbIcon">
613
- <MIcon :name="thumbIcon" :size="s.thumbIconSize" class="pointer-events-none rounded-full group-focus-visible:ring-2 group-focus-visible:ring-primary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface" :style="thumbIconPos(pctLo)" />
614
- <MIcon v-if="isRange" :name="thumbIcon" :size="s.thumbIconSize" class="pointer-events-none" :style="thumbIconPos(pctHi)" />
710
+ <!-- Thumb(s). Standard/centered: the track is the slider and its focus rings the thumb. Range: each thumb
711
+ is a slider of its own (Compose's two semantics nodes), focusable, with its own keys and ring. -->
712
+ <template v-if="!isRange">
713
+ <MIcon v-if="thumbIcon" :name="thumbIcon" :size="s.thumbIconSize" class="pointer-events-none rounded-full group-focus-visible:ring-2 group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface" :style="thumbIconPos(pctLo)" />
714
+ <div v-else class="pointer-events-none group-focus-visible:ring-2 group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface" :style="thumbPos(pctLo)" />
615
715
  </template>
616
716
  <template v-else>
617
- <div class="pointer-events-none group-focus-visible:ring-2 group-focus-visible:ring-primary group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-surface" :style="thumbPos(pctLo)" />
618
- <div v-if="isRange" class="pointer-events-none" :style="thumbPos(pctHi)" />
717
+ <div
718
+ v-for="idx in ([0, 1] as const)"
719
+ :key="idx"
720
+ :ref="(el) => { if (el) thumbEls[idx] = el as HTMLElement }"
721
+ role="slider"
722
+ :tabindex="disabled ? -1 : 0"
723
+ :aria-label="idx === 0 ? t.sliderRangeStart : t.sliderRangeEnd"
724
+ :aria-valuenow="idx === 0 ? val.lo : val.hi"
725
+ :aria-valuemin="idx === 0 ? min : val.lo"
726
+ :aria-valuemax="idx === 0 ? val.hi : max"
727
+ :aria-disabled="disabled || undefined"
728
+ :aria-orientation="orientation"
729
+ class="pointer-events-none flex items-center justify-center rounded-full outline-none"
730
+ :class="keyboardThumb === idx && 'ring-2 ring-offset-2 ring-offset-surface'"
731
+ :style="thumbIcon ? thumbIconPos(idx === 0 ? pctLo : pctHi) : thumbPos(idx === 0 ? pctLo : pctHi, idx)"
732
+ @keydown="onThumbKeyDown(idx, $event)"
733
+ @focus="onThumbFocus(idx)"
734
+ @blur="onThumbBlur"
735
+ >
736
+ <MIcon v-if="thumbIcon" :name="thumbIcon" :size="s.thumbIconSize" />
737
+ </div>
619
738
  </template>
620
739
 
621
740
  <!-- Tooltip -->