@m3ui-vue/m3ui-vue 1.4.0 → 1.4.2

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 (95) hide show
  1. package/dist/API.md +295 -11
  2. package/dist/{MButton-DQMTIlaV.js → MButton-D7M324r9.js} +2 -2
  3. package/dist/{MButton-DQMTIlaV.js.map → MButton-D7M324r9.js.map} +1 -1
  4. package/dist/{MDialog-cdgapGfZ.js → MDialog-DuOnNF9s.js} +2 -2
  5. package/dist/{MDialog-cdgapGfZ.js.map → MDialog-DuOnNF9s.js.map} +1 -1
  6. package/dist/{MListItem-ZkSGIIrb.js → MListItem-Bb84X6ex.js} +144 -120
  7. package/dist/{MListItem-ZkSGIIrb.js.map → MListItem-Bb84X6ex.js.map} +1 -1
  8. package/dist/{MLoadingIndicator-U6_oGx8z.js → MLoadingIndicator-BUGRo2Tu.js} +2 -2
  9. package/dist/{MLoadingIndicator-U6_oGx8z.js.map → MLoadingIndicator-BUGRo2Tu.js.map} +1 -1
  10. package/dist/{MSeekBar-DTZVizZg.js → MSeekBar-BQUvUqb9.js} +2 -2
  11. package/dist/{MSeekBar-DTZVizZg.js.map → MSeekBar-BQUvUqb9.js.map} +1 -1
  12. package/dist/{MSlider-CqJkEYRZ.js → MSlider-SFdjE1Hy.js} +2 -2
  13. package/dist/{MSlider-CqJkEYRZ.js.map → MSlider-SFdjE1Hy.js.map} +1 -1
  14. package/dist/{MSpinner-Btgc-0nb.js → MSpinner-DKGNN64_.js} +2 -2
  15. package/dist/{MSpinner-Btgc-0nb.js.map → MSpinner-DKGNN64_.js.map} +1 -1
  16. package/dist/{MTextField-B6M0gJEO.js → MTextField-Utsef6Kk.js} +2 -2
  17. package/dist/{MTextField-B6M0gJEO.js.map → MTextField-Utsef6Kk.js.map} +1 -1
  18. package/dist/{MTooltip-Dspji4XG.js → MTooltip-BhTFQ9Z2.js} +4 -4
  19. package/dist/{MTooltip-Dspji4XG.js.map → MTooltip-BhTFQ9Z2.js.map} +1 -1
  20. package/dist/api.json +1 -1
  21. package/dist/code-editor.js +1 -1
  22. package/dist/components/MAvailabilityCalendar.vue.d.ts +1 -1
  23. package/dist/components/MCalendarHeatmap.vue.d.ts +120 -0
  24. package/dist/components/MCountdown.vue.d.ts +80 -0
  25. package/dist/components/MDatePicker.vue.d.ts +5 -0
  26. package/dist/components/MDatePickerModal.vue.d.ts +5 -0
  27. package/dist/components/MDateRangePicker.vue.d.ts +5 -0
  28. package/dist/components/MDateRangePickerModal.vue.d.ts +5 -0
  29. package/dist/components/MLightbox.vue.d.ts +1 -1
  30. package/dist/components/MListItem.vue.d.ts +10 -6
  31. package/dist/components/MMeterGroup.vue.d.ts +98 -0
  32. package/dist/components/MPhoneInput.vue.d.ts +72 -0
  33. package/dist/components/MSeekBar.vue.d.ts +1 -1
  34. package/dist/components/MTreeTable.vue.d.ts +1 -1
  35. package/dist/components/MTypewriter.vue.d.ts +57 -0
  36. package/dist/components/MVideoPlayer.vue.d.ts +1 -1
  37. package/dist/components/_MMonthYearButton.vue.d.ts +16 -0
  38. package/dist/components/_MYearGrid.vue.d.ts +19 -0
  39. package/dist/composables/_useCalendarMonth.d.ts +7 -0
  40. package/dist/composables/phoneNumber.d.ts +39 -0
  41. package/dist/composables/useLocale.d.ts +18 -0
  42. package/dist/data/phone-countries.d.ts +2 -0
  43. package/dist/draw.js +2 -2
  44. package/dist/flow.js +1 -1
  45. package/dist/gantt.js +1 -1
  46. package/dist/index.d.ts +10 -0
  47. package/dist/locales/index.js +63 -0
  48. package/dist/locales/index.js.map +1 -1
  49. package/dist/m3ui-vue.css +1 -1
  50. package/dist/m3ui.js +5133 -3366
  51. package/dist/m3ui.js.map +1 -1
  52. package/dist/map.js +5 -5
  53. package/dist/media.js +4 -4
  54. package/dist/pdf.js +4 -4
  55. package/dist/rich-text-editor.js +4 -4
  56. package/dist/styles.css +1 -1
  57. package/dist/{useLocale-DLKJIRFi.js → useLocale-B8YKWg-H.js} +10 -1
  58. package/dist/useLocale-B8YKWg-H.js.map +1 -0
  59. package/package.json +1 -1
  60. package/src/__tests__/MCalendarHeatmap.test.ts +79 -0
  61. package/src/__tests__/MCountdown.test.ts +75 -0
  62. package/src/__tests__/MListItemNestedControl.test.ts +88 -0
  63. package/src/__tests__/MMeterGroup.test.ts +43 -0
  64. package/src/__tests__/MPhoneInput.test.ts +97 -0
  65. package/src/__tests__/MTypewriter.test.ts +50 -0
  66. package/src/__tests__/calendarMonth.test.ts +104 -0
  67. package/src/__tests__/clearToNull.test.ts +30 -0
  68. package/src/__tests__/ssr.test.ts +4 -0
  69. package/src/components/MAutocomplete.vue +2 -2
  70. package/src/components/MCalendarHeatmap.vue +349 -0
  71. package/src/components/MCountdown.vue +200 -0
  72. package/src/components/MDatePicker.vue +74 -34
  73. package/src/components/MDatePickerModal.vue +79 -36
  74. package/src/components/MDateRangePicker.vue +73 -33
  75. package/src/components/MDateRangePickerModal.vue +75 -35
  76. package/src/components/MListItem.vue +54 -8
  77. package/src/components/MMeterGroup.vue +196 -0
  78. package/src/components/MPhoneInput.vue +480 -0
  79. package/src/components/MSelect.vue +2 -2
  80. package/src/components/MTypewriter.vue +195 -0
  81. package/src/components/_MMonthYearButton.vue +36 -0
  82. package/src/components/_MYearGrid.vue +106 -0
  83. package/src/composables/_useCalendarMonth.ts +32 -2
  84. package/src/composables/phoneNumber.ts +137 -0
  85. package/src/composables/useLocale.ts +27 -0
  86. package/src/data/phone-countries.ts +62 -0
  87. package/src/index.ts +10 -0
  88. package/src/locales/de.ts +9 -0
  89. package/src/locales/es.ts +9 -0
  90. package/src/locales/fr.ts +9 -0
  91. package/src/locales/ja.ts +9 -0
  92. package/src/locales/ko.ts +9 -0
  93. package/src/locales/pt.ts +9 -0
  94. package/src/locales/zh.ts +9 -0
  95. package/dist/useLocale-DLKJIRFi.js.map +0 -1
@@ -7,7 +7,8 @@
7
7
  * @slot overline Custom overline content, replacing the overline prop
8
8
  * @slot default Custom content replacing the title/subtitle/description text block
9
9
  * @slot children Nested content revealed when expandable is set and the item is expanded
10
- * @slot trailing Custom trailing element, replacing the icon/text/switch/checkbox
10
+ * @slot trailing Custom trailing element, replacing the icon/text/switch/checkbox. On an expandable item it sits
11
+ * before the expand icon, and its controls (a switch, a button) don't open or close the item
11
12
  * @event click Fires on any click, including on an expandable item (right before it toggles)
12
13
  * @event update:trailingValue Fires when a trailing switch/checkbox is toggled (trailing='switch' | 'checkbox')
13
14
  * @event update:expanded Fires when an expandable item is toggled open/closed
@@ -72,6 +73,8 @@ const props = withDefaults(
72
73
  expandable?: boolean
73
74
  /** Control the expanded state (v-model:expanded) — otherwise managed internally */
74
75
  expanded?: boolean
76
+ /** Indent of the expanded #children: px, or any CSS length. Narrow it on small screens */
77
+ indent?: number | string
75
78
  }>(),
76
79
  { active: false, disabled: false, expandable: false },
77
80
  )
@@ -190,7 +193,7 @@ const containerClasses = computed(() => [
190
193
  ? 'py-1'
191
194
  : resolvedLines.value === 3 ? 'py-3' : 'py-2',
192
195
  minHeightClass.value,
193
- isClickable.value && !props.disabled && 'cursor-pointer transition-colors duration-150 hover:bg-on-surface/8 active:bg-on-surface/12',
196
+ isClickable.value && !props.disabled && 'cursor-pointer',
194
197
  // ListTokens: ItemSelectedContainerColor = SecondaryContainer, applies to any selected list
195
198
  // item, not just nav/segmented contexts.
196
199
  isActive.value && 'bg-secondary-container text-on-secondary-container',
@@ -247,10 +250,30 @@ const { snap } = useSpring(() => expressiveRadii.value, (v) => {
247
250
  // A change of place in the list (or of list style) isn't an interaction: jump there
248
251
  watch([segmentPosition, isNav], () => snap())
249
252
 
250
- function onPointerEnter(e: PointerEvent) { if (e.pointerType !== 'touch') hovered.value = true }
253
+ // A control inside the row (a button or switch in #trailing, a checkbox in #leading) has its own interaction
254
+ // surface, as in M3: hovering or pressing it leaves the row alone. The row's own built-in leading checkbox is
255
+ // part of the row (data-mli-part), so it still presses it.
256
+ const NESTED_CONTROL = 'button, a, input, select, textarea, label, [role="button"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], [tabindex]'
257
+ function onNestedControl(e: Event) {
258
+ const row = e.currentTarget as Element
259
+ const control = (e.target as Element | null)?.closest?.(NESTED_CONTROL)
260
+ return !!control && control !== row && row.contains(control) && !control.closest('[data-mli-part]')
261
+ }
262
+
263
+ function onPointerMove(e: PointerEvent) { if (e.pointerType !== 'touch') hovered.value = !onNestedControl(e) }
251
264
  function onPointerLeave() { hovered.value = false; pressed.value = false }
252
- function onPointerDown(e: PointerEvent) { if (e.button === 0) pressed.value = true }
265
+ function onPointerDown(e: PointerEvent) { if (e.button === 0 && !onNestedControl(e)) pressed.value = true }
253
266
  function onPointerUp() { pressed.value = false }
267
+
268
+ // The state layer (ListTokens: hover 8%, pressed 12% of the content color), drawn by JS so that pressing a nested
269
+ // control doesn't light up the row through CSS :active, which every ancestor of the pressed element matches
270
+ const stateLayerOpacity = computed(() => {
271
+ if (!isClickable.value || props.disabled) return 0
272
+ return pressed.value ? 0.12 : hovered.value ? 0.08 : 0
273
+ })
274
+ const indentStyle = computed(() =>
275
+ props.indent === undefined ? undefined : { paddingLeft: typeof props.indent === 'number' ? `${props.indent}px` : props.indent },
276
+ )
254
277
  function onFocus(e: FocusEvent) { focused.value = (e.currentTarget as Element).matches(':focus-visible') }
255
278
  function onBlur() { focused.value = false }
256
279
 
@@ -287,6 +310,8 @@ function toggleExpand(e: MouseEvent) {
287
310
  function handleClick(e: MouseEvent) {
288
311
  if (props.disabled) return
289
312
  if (props.expandable) {
313
+ // A switch or button in the header's #trailing works on its own
314
+ if (onNestedControl(e)) return
290
315
  toggleExpand(e)
291
316
  return
292
317
  }
@@ -316,12 +341,20 @@ function handleTrailingToggle() {
316
341
  @keydown="onHeaderKeyDown"
317
342
  @focus="onFocus"
318
343
  @blur="onBlur"
319
- @pointerenter="onPointerEnter"
344
+ @pointerenter="onPointerMove"
345
+ @pointermove="onPointerMove"
320
346
  @pointerleave="onPointerLeave"
321
347
  @pointerdown="onPointerDown"
322
348
  @pointerup="onPointerUp"
323
349
  @pointercancel="onPointerUp"
324
350
  >
351
+ <span
352
+ class="mli-state-layer pointer-events-none absolute inset-0 rounded-[inherit]"
353
+ :class="isActive ? 'bg-on-secondary-container' : 'bg-on-surface'"
354
+ :style="{ opacity: stateLayerOpacity }"
355
+ aria-hidden="true"
356
+ />
357
+
325
358
  <!-- Leading -->
326
359
  <slot name="leading">
327
360
  <MIcon v-if="resolvedLeading === 'icon'" :name="icon!" :size="24" class="shrink-0" :class="activeIconClass" />
@@ -340,6 +373,8 @@ function handleTrailingToggle() {
340
373
  </slot>
341
374
  </div>
342
375
 
376
+ <slot name="trailing" />
377
+
343
378
  <!-- Expand icon -->
344
379
  <MIcon
345
380
  :name="isExpanded ? 'expand_less' : 'expand_more'"
@@ -352,7 +387,7 @@ function handleTrailingToggle() {
352
387
  <!-- Children with collapse animation -->
353
388
  <Transition name="mli-expand">
354
389
  <div v-if="isExpanded" :id="childrenId" class="mli-expand-grid">
355
- <div class="mli-expand-body">
390
+ <div class="mli-expand-body" :style="indentStyle">
356
391
  <slot name="children" />
357
392
  </div>
358
393
  </div>
@@ -371,7 +406,8 @@ function handleTrailingToggle() {
371
406
  :aria-disabled="(isOption || isButton) && disabled ? 'true' : undefined"
372
407
  @click="handleClick"
373
408
  @keydown="onRowKeyDown"
374
- @pointerenter="onPointerEnter"
409
+ @pointerenter="onPointerMove"
410
+ @pointermove="onPointerMove"
375
411
  @pointerleave="onPointerLeave"
376
412
  @pointerdown="onPointerDown"
377
413
  @pointerup="onPointerUp"
@@ -379,6 +415,13 @@ function handleTrailingToggle() {
379
415
  @focus="onFocus"
380
416
  @blur="onBlur"
381
417
  >
418
+ <span
419
+ class="mli-state-layer pointer-events-none absolute inset-0 rounded-[inherit]"
420
+ :class="isActive ? 'bg-on-secondary-container' : 'bg-on-surface'"
421
+ :style="{ opacity: stateLayerOpacity }"
422
+ aria-hidden="true"
423
+ />
424
+
382
425
  <!-- Divider -->
383
426
  <div
384
427
  v-if="hasDivider"
@@ -406,7 +449,7 @@ function handleTrailingToggle() {
406
449
  <img :src="image" alt="" class="h-14 w-14 shrink-0 rounded-md object-cover">
407
450
  </template>
408
451
  <template v-else-if="resolvedLeading === 'checkbox'">
409
- <MCheckbox :model-value="isActive" class="shrink-0" />
452
+ <MCheckbox :model-value="isActive" class="shrink-0" data-mli-part />
410
453
  </template>
411
454
  </slot>
412
455
 
@@ -446,6 +489,9 @@ function handleTrailingToggle() {
446
489
  </template>
447
490
 
448
491
  <style>
492
+ .mli-state-layer {
493
+ transition: opacity 150ms;
494
+ }
449
495
  .mli-expand-grid {
450
496
  display: grid;
451
497
  grid-template-rows: 1fr;
@@ -0,0 +1,196 @@
1
+ <script lang="ts">
2
+ /** One part of the meter */
3
+ export interface MeterItem {
4
+ label: string
5
+ value: number
6
+ /** An M3 color role (`primary`, `tertiary`...) or any CSS color; defaults to the next of a set of roles */
7
+ color?: string
8
+ /** Material Symbol shown in the legend instead of the color dot */
9
+ icon?: string
10
+ }
11
+ </script>
12
+
13
+ <script setup lang="ts">
14
+ /**
15
+ * MMeterGroup — several values sharing one bar, like a phone's storage screen: photos, apps, system and what's left
16
+ * of the total. Each part is a segment with its own color, separated by a gap (M3's linear progress track gap),
17
+ * growing in on mount and sliding when values change; the legend lists each part with its value and share, and
18
+ * hovering a part highlights it in both places. Values over `max` are scaled to fit.
19
+ *
20
+ * @slot label Replaces the header's text on the left (defaults to `label`)
21
+ * @slot summary Replaces the header's text on the right (defaults to "used of max")
22
+ * @slot legend-item Replaces a legend entry; receives `item`, `percent`, `formatted` and `color`
23
+ * @event select Emitted with the item (and its index) when a segment or legend entry is clicked
24
+ */
25
+ import { computed, onMounted, ref } from 'vue'
26
+ import MIcon from './MIcon.vue'
27
+ import { useLocale } from '../composables/useLocale'
28
+
29
+ const props = withDefaults(
30
+ defineProps<{
31
+ items: MeterItem[]
32
+ /** The whole bar; defaults to the sum of the values (no remaining part) */
33
+ max?: number
34
+ /** Title above the bar */
35
+ label?: string
36
+ /** Unit appended to formatted values ("GB") */
37
+ unit?: string
38
+ /** Intl.NumberFormat options for values */
39
+ numberFormat?: Intl.NumberFormatOptions
40
+ /** Formats a value; overrides `unit` and `numberFormat` */
41
+ format?: (value: number) => string
42
+ /** Bar thickness */
43
+ size?: 'sm' | 'md' | 'lg'
44
+ /** Legend below the bar */
45
+ legend?: boolean
46
+ /** Show each part's share (%) in the legend */
47
+ percent?: boolean
48
+ /** With `max`, list what's left as a last legend entry (outlined dot) */
49
+ showRemaining?: boolean
50
+ /** The remaining entry's label; defaults to the locale's */
51
+ remainingLabel?: string
52
+ /** Show "used of max" on the right of the header */
53
+ summary?: boolean
54
+ /** Grow the segments in on mount (off with reduced motion) */
55
+ animate?: boolean
56
+ /** BCP-47 language for numbers; defaults to the app's locale */
57
+ locale?: string
58
+ }>(),
59
+ { size: 'md', legend: true, percent: false, showRemaining: true, summary: true, animate: true },
60
+ )
61
+
62
+ const emit = defineEmits<{ select: [item: MeterItem, index: number] }>()
63
+
64
+ const t = useLocale()
65
+ const lang = computed(() => props.locale ?? t.lang)
66
+
67
+ const ROLES = new Set(['primary', 'secondary', 'tertiary', 'error', 'success', 'on-surface', 'on-surface-variant', 'outline', 'inverse-primary', 'primary-container', 'secondary-container', 'tertiary-container'])
68
+ const CYCLE = ['primary', 'tertiary', 'secondary', 'error', 'success']
69
+ const colorOf = (item: MeterItem, i: number) => {
70
+ const c = item.color ?? CYCLE[i % CYCLE.length]!
71
+ return ROLES.has(c) ? `var(--color-${c})` : c
72
+ }
73
+
74
+ const used = computed(() => props.items.reduce((s, it) => s + Math.max(0, it.value), 0))
75
+ // The bar's whole: max, unless the values overflow it (then they're scaled to fit)
76
+ const whole = computed(() => Math.max(props.max ?? used.value, used.value) || 1)
77
+ const remaining = computed(() => (props.max != null ? Math.max(0, props.max - used.value) : 0))
78
+
79
+ const nf = computed(() => new Intl.NumberFormat(lang.value, props.numberFormat))
80
+ const pf = computed(() => new Intl.NumberFormat(lang.value, { style: 'percent', maximumFractionDigits: 1 }))
81
+ function fmt(v: number) {
82
+ if (props.format) return props.format(v)
83
+ return props.unit ? `${nf.value.format(v)} ${props.unit}` : nf.value.format(v)
84
+ }
85
+
86
+ const segments = computed(() =>
87
+ props.items
88
+ .map((item, index) => ({ item, index, share: Math.max(0, item.value) / whole.value, color: colorOf(item, index) }))
89
+ .filter((s) => s.share > 0),
90
+ )
91
+
92
+ const thickness = computed(() => ({ sm: 4, md: 12, lg: 20 })[props.size])
93
+ const gapPx = computed(() => (props.size === 'sm' ? 2 : 4))
94
+ // The track for what's left only shows when something is left; the gaps come off the segments' widths, so the
95
+ // shares stay exact and a full bar isn't clipped
96
+ const hasTrack = computed(() => used.value < whole.value)
97
+ const totalGap = computed(() => Math.max(0, segments.value.length + (hasTrack.value ? 1 : 0) - 1) * gapPx.value)
98
+ const widthOf = (share: number) => `calc((100% - ${totalGap.value}px) * ${share})`
99
+
100
+ // Grows in from zero on mount: the segments render at 0 and get their width one frame later
101
+ const reduced = typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
102
+ const shown = ref(!props.animate || reduced)
103
+ onMounted(() => {
104
+ if (!shown.value) requestAnimationFrame(() => requestAnimationFrame(() => { shown.value = true }))
105
+ })
106
+
107
+ const hovered = ref<number | null>(null)
108
+
109
+ const summaryText = computed(() =>
110
+ props.max != null ? t.meterUsedOf.replace('{used}', fmt(used.value)).replace('{max}', fmt(props.max)) : fmt(used.value),
111
+ )
112
+ const ariaText = computed(() =>
113
+ [props.label, ...props.items.map((it) => `${it.label}: ${fmt(it.value)}`), props.max != null ? `${props.remainingLabel ?? t.meterRemaining}: ${fmt(remaining.value)}` : '']
114
+ .filter(Boolean)
115
+ .join(', '),
116
+ )
117
+ </script>
118
+
119
+ <template>
120
+ <div class="m3-meter-group flex flex-col gap-3" role="group" :aria-label="label">
121
+ <!-- Header -->
122
+ <div v-if="label || $slots.label || summary || $slots.summary" class="flex items-baseline justify-between gap-4">
123
+ <span class="text-title-small font-medium text-on-surface"><slot name="label">{{ label }}</slot></span>
124
+ <span v-if="summary || $slots.summary" class="text-body-medium text-on-surface-variant tabular-nums">
125
+ <slot name="summary" :used="used" :max="max">{{ summaryText }}</slot>
126
+ </span>
127
+ </div>
128
+
129
+ <!-- Bar: the segments, then the track for what's left, 4dp gaps between them (M3 linear progress) -->
130
+ <div
131
+ class="flex w-full rounded-full"
132
+ :class="size !== 'sm' && 'overflow-hidden'"
133
+ :style="{ height: `${thickness}px`, gap: `${gapPx}px` }"
134
+ role="img"
135
+ :aria-label="ariaText"
136
+ >
137
+ <div
138
+ v-for="s in segments"
139
+ :key="s.index"
140
+ class="m3-meter-segment h-full shrink-0 cursor-pointer"
141
+ :class="[hovered !== null && hovered !== s.index && 'opacity-40', size === 'sm' && 'm3-meter-hit rounded-full']"
142
+ :style="{ width: shown ? widthOf(s.share) : '0px', backgroundColor: s.color }"
143
+ @mouseenter="hovered = s.index"
144
+ @mouseleave="hovered = null"
145
+ @click="emit('select', s.item, s.index)"
146
+ />
147
+ <div v-if="hasTrack || !shown" class="h-full min-w-0 flex-1 bg-secondary-container" :class="size === 'sm' && 'rounded-full'" />
148
+ </div>
149
+
150
+ <!-- Legend -->
151
+ <ul v-if="legend" class="flex flex-wrap gap-x-5 gap-y-2" aria-hidden="true">
152
+ <li
153
+ v-for="(item, i) in items"
154
+ :key="i"
155
+ class="flex cursor-pointer items-center gap-2 text-body-medium transition-opacity"
156
+ :class="hovered !== null && hovered !== i && 'opacity-40'"
157
+ @mouseenter="hovered = i"
158
+ @mouseleave="hovered = null"
159
+ @click="emit('select', item, i)"
160
+ >
161
+ <slot name="legend-item" :item="item" :percent="item.value / whole" :formatted="fmt(item.value)" :color="colorOf(item, i)">
162
+ <MIcon v-if="item.icon" :name="item.icon" :size="18" :style="{ color: colorOf(item, i) }" />
163
+ <span v-else class="size-2.5 shrink-0 rounded-full" :style="{ backgroundColor: colorOf(item, i) }" />
164
+ <span class="text-on-surface">{{ item.label }}</span>
165
+ <span class="text-on-surface-variant tabular-nums">
166
+ {{ fmt(item.value) }}<template v-if="percent"> · {{ pf.format(item.value / whole) }}</template>
167
+ </span>
168
+ </slot>
169
+ </li>
170
+ <li v-if="max != null && showRemaining" class="flex items-center gap-2 text-body-medium">
171
+ <span class="size-2.5 shrink-0 rounded-full border-2 border-secondary-container" />
172
+ <span class="text-on-surface">{{ remainingLabel ?? t.meterRemaining }}</span>
173
+ <span class="text-on-surface-variant tabular-nums">
174
+ {{ fmt(remaining) }}<template v-if="percent"> · {{ pf.format(remaining / whole) }}</template>
175
+ </span>
176
+ </li>
177
+ </ul>
178
+ </div>
179
+ </template>
180
+
181
+ <style>
182
+ /* sm is 4px tall: a taller invisible hit area, so the pointer finds a segment without aiming at a hairline */
183
+ .m3-meter-hit {
184
+ position: relative;
185
+ }
186
+ .m3-meter-hit::after {
187
+ content: '';
188
+ position: absolute;
189
+ inset: -8px 0;
190
+ }
191
+ .m3-meter-segment {
192
+ transition:
193
+ width 700ms cubic-bezier(0.2, 0, 0, 1),
194
+ opacity 150ms;
195
+ }
196
+ </style>