@m3ui-vue/m3ui-vue 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/{MMenuItem-B_5um6tj.js → MMenuItem-vSLbJGqe.js} +314 -230
- package/dist/MMenuItem-vSLbJGqe.js.map +1 -0
- package/dist/code-editor.d.ts +1 -0
- package/dist/code-editor.js +22 -7
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MCard.vue.d.ts +2 -0
- package/dist/components/MChatBubble.vue.d.ts +0 -1
- package/dist/components/MCheckbox.vue.d.ts +2 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +0 -1
- package/dist/components/MCodeEditor.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +3 -0
- package/dist/components/MDialog.vue.d.ts +23 -7
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MListItem.vue.d.ts +11 -6
- package/dist/components/MNavigationRail.vue.d.ts +17 -1
- package/dist/components/MSelect.vue.d.ts +1 -0
- package/dist/components/MSwitch.vue.d.ts +10 -0
- package/dist/components/MTabs.vue.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +2393 -2005
- package/dist/m3ui.js.map +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/styles/palettes.css +659 -0
- package/dist/styles/theme.css +2 -0
- package/dist/styles.css +1 -1
- package/package.json +13 -1
- package/src/__tests__/useColorPalette.test.ts +2 -2
- package/src/code-editor.ts +1 -0
- package/src/components/MAutocomplete.vue +35 -26
- package/src/components/MBadge.vue +1 -1
- package/src/components/MBottomSheet.vue +4 -4
- package/src/components/MButton.vue +48 -15
- package/src/components/MButtonGroup.vue +2 -2
- package/src/components/MCard.vue +83 -9
- package/src/components/MChatBubble.vue +0 -1
- package/src/components/MCheckbox.vue +78 -18
- package/src/components/MChip.vue +33 -4
- package/src/components/MCircleProgressBar.vue +7 -4
- package/src/components/MCodeEditor.vue +54 -8
- package/src/components/MColorPicker.vue +9 -8
- package/src/components/MColorPickerModal.vue +2 -2
- package/src/components/MCommandPalette.vue +1 -1
- package/src/components/MConfirmDialog.vue +4 -0
- package/src/components/MContextMenu.vue +23 -2
- package/src/components/MDatePicker.vue +11 -11
- package/src/components/MDatePickerModal.vue +5 -5
- package/src/components/MDateRangePicker.vue +12 -12
- package/src/components/MDateRangePickerModal.vue +3 -3
- package/src/components/MDialog.vue +103 -12
- package/src/components/MFab.vue +13 -8
- package/src/components/MFabMenu.vue +1 -1
- package/src/components/MIconButton.vue +50 -14
- package/src/components/MListItem.vue +35 -17
- package/src/components/MLoadingIndicator.vue +14 -7
- package/src/components/MMaskField.vue +14 -6
- package/src/components/MMenu.vue +28 -3
- package/src/components/MMenuItem.vue +2 -2
- package/src/components/MMultiAutocomplete.vue +41 -26
- package/src/components/MMultiSelect.vue +40 -22
- package/src/components/MNavigationBar.vue +5 -10
- package/src/components/MNavigationDrawer.vue +10 -9
- package/src/components/MNavigationRail.vue +335 -22
- package/src/components/MNumberField.vue +14 -6
- package/src/components/MOverlay.vue +1 -1
- package/src/components/MPinInput.vue +7 -4
- package/src/components/MProgressBar.vue +16 -10
- package/src/components/MRadio.vue +74 -30
- package/src/components/MSearchBar.vue +3 -2
- package/src/components/MSegmentedButton.vue +14 -9
- package/src/components/MSelect.vue +44 -32
- package/src/components/MSideSheet.vue +1 -1
- package/src/components/MSlider.vue +42 -20
- package/src/components/MSnackbar.vue +4 -4
- package/src/components/MSplitButton.vue +32 -17
- package/src/components/MSpotlightSearch.vue +1 -1
- package/src/components/MSwitch.vue +138 -33
- package/src/components/MTabs.vue +16 -12
- package/src/components/MTagInput.vue +33 -22
- package/src/components/MTextField.vue +14 -6
- package/src/components/MTimePicker.vue +9 -9
- package/src/components/MTimePickerModal.vue +16 -16
- package/src/components/MToolbar.vue +5 -3
- package/src/components/MTooltip.vue +4 -4
- package/src/components/MTopAppBar.vue +14 -6
- package/src/components/MTour.vue +1 -1
- package/src/composables/useColorPalette.ts +10 -0
- package/src/index.ts +1 -0
- package/src/styles/palettes.css +659 -0
- package/src/styles/theme.css +2 -0
- package/dist/MMenuItem-B_5um6tj.js.map +0 -1
|
@@ -111,22 +111,25 @@ const inputClasses = computed(() => {
|
|
|
111
111
|
const base = [
|
|
112
112
|
'peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent',
|
|
113
113
|
'transition-[border-color,border-width] duration-150',
|
|
114
|
-
'disabled:cursor-not-allowed disabled:
|
|
114
|
+
'disabled:cursor-not-allowed disabled:text-on-surface/38',
|
|
115
|
+
props.error ? 'caret-error' : 'caret-primary',
|
|
115
116
|
'h-14', pl, pr,
|
|
116
117
|
]
|
|
117
118
|
if (props.variant === 'outlined') {
|
|
118
119
|
return [...base,
|
|
119
|
-
'rounded-
|
|
120
|
+
'rounded-xs border bg-transparent py-4',
|
|
120
121
|
props.error
|
|
121
122
|
? 'border-error focus:border-2 focus:border-error'
|
|
122
123
|
: 'border-outline hover:border-on-surface focus:border-2 focus:border-primary',
|
|
124
|
+
'disabled:border-on-surface/12',
|
|
123
125
|
].join(' ')
|
|
124
126
|
}
|
|
125
127
|
return [...base,
|
|
126
|
-
'rounded-t-
|
|
128
|
+
'rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2',
|
|
127
129
|
props.error
|
|
128
130
|
? 'border-error focus:border-b-2 focus:border-error'
|
|
129
131
|
: 'border-on-surface-variant hover:border-on-surface focus:border-b-2 focus:border-primary',
|
|
132
|
+
'disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]',
|
|
130
133
|
].join(' ')
|
|
131
134
|
})
|
|
132
135
|
|
|
@@ -145,12 +148,14 @@ const labelClasses = computed(() => {
|
|
|
145
148
|
'peer-[&:not(:placeholder-shown)]:-top-2.5 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:right-auto peer-[&:not(:placeholder-shown)]:max-w-[calc(100%-1.5rem)]',
|
|
146
149
|
'peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1',
|
|
147
150
|
props.error ? 'text-error peer-focus:text-error' : 'text-on-surface-variant peer-focus:text-primary',
|
|
151
|
+
'peer-disabled:text-on-surface/38',
|
|
148
152
|
].join(' ')
|
|
149
153
|
}
|
|
150
154
|
return [...base,
|
|
151
155
|
'peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small',
|
|
152
156
|
'peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small',
|
|
153
157
|
props.error ? 'text-error peer-focus:text-error' : 'text-on-surface-variant peer-focus:text-primary',
|
|
158
|
+
'peer-disabled:text-on-surface/38',
|
|
154
159
|
].join(' ')
|
|
155
160
|
})
|
|
156
161
|
</script>
|
|
@@ -165,10 +170,13 @@ const labelClasses = computed(() => {
|
|
|
165
170
|
>
|
|
166
171
|
<div
|
|
167
172
|
v-if="leadingIcon"
|
|
168
|
-
class="pointer-events-none absolute left-3.5
|
|
169
|
-
:class="
|
|
173
|
+
class="pointer-events-none absolute left-3.5"
|
|
174
|
+
:class="[
|
|
175
|
+
variant === 'filled' ? 'top-4.5' : 'top-4',
|
|
176
|
+
disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
|
|
177
|
+
]"
|
|
170
178
|
>
|
|
171
|
-
<MIcon :name="leadingIcon" :size="
|
|
179
|
+
<MIcon :name="leadingIcon" :size="24" />
|
|
172
180
|
</div>
|
|
173
181
|
|
|
174
182
|
<input
|
package/src/components/MMenu.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, onMounted, onUnmounted, provide, ref } from 'vue'
|
|
2
|
+
import { computed, nextTick, onMounted, onUnmounted, provide, ref } from 'vue'
|
|
3
3
|
|
|
4
4
|
const props = withDefaults(
|
|
5
5
|
defineProps<{
|
|
@@ -39,9 +39,31 @@ function computePos() {
|
|
|
39
39
|
dropStyle.value = style
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
function focusableItems() {
|
|
43
|
+
if (!dropdownEl.value) return []
|
|
44
|
+
return Array.from(
|
|
45
|
+
dropdownEl.value.querySelectorAll<HTMLElement>('button:not(:disabled), a[href]'),
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function focusFirstItem() {
|
|
50
|
+
nextTick(() => focusableItems()[0]?.focus())
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function moveFocus(dir: 1 | -1) {
|
|
54
|
+
const items = focusableItems()
|
|
55
|
+
if (!items.length) return
|
|
56
|
+
const idx = items.indexOf(document.activeElement as HTMLElement)
|
|
57
|
+
const next = idx === -1
|
|
58
|
+
? (dir === 1 ? items[0] : items[items.length - 1])
|
|
59
|
+
: items[(idx + dir + items.length) % items.length]
|
|
60
|
+
next?.focus()
|
|
61
|
+
}
|
|
62
|
+
|
|
42
63
|
function toggle() {
|
|
43
64
|
if (!open.value) computePos()
|
|
44
65
|
open.value = !open.value
|
|
66
|
+
if (open.value) focusFirstItem()
|
|
45
67
|
}
|
|
46
68
|
|
|
47
69
|
function close() {
|
|
@@ -69,7 +91,10 @@ function onScroll(e: Event) {
|
|
|
69
91
|
}
|
|
70
92
|
|
|
71
93
|
function onKeydown(e: KeyboardEvent) {
|
|
72
|
-
if (e.key === 'Escape') close()
|
|
94
|
+
if (e.key === 'Escape') { close(); return }
|
|
95
|
+
if (!open.value) return
|
|
96
|
+
if (e.key === 'ArrowDown') { e.preventDefault(); moveFocus(1) }
|
|
97
|
+
else if (e.key === 'ArrowUp') { e.preventDefault(); moveFocus(-1) }
|
|
73
98
|
}
|
|
74
99
|
|
|
75
100
|
onMounted(() => {
|
|
@@ -106,7 +131,7 @@ const origin = computed(() =>
|
|
|
106
131
|
<div
|
|
107
132
|
v-if="open"
|
|
108
133
|
ref="dropdownEl"
|
|
109
|
-
class="fixed z-500 min-w-48 overflow-hidden rounded-
|
|
134
|
+
class="fixed z-500 min-w-48 overflow-hidden rounded-xs bg-surface-container shadow-elevation-2"
|
|
110
135
|
:style="{ ...dropStyle, transformOrigin: origin }"
|
|
111
136
|
>
|
|
112
137
|
<div class="overflow-y-auto py-1" :style="{ maxHeight: dropStyle.maxHeight }">
|
|
@@ -68,7 +68,7 @@ function onSubLeave(e: MouseEvent) {
|
|
|
68
68
|
:is="tag"
|
|
69
69
|
:to="to || undefined"
|
|
70
70
|
:type="to ? undefined : 'button'"
|
|
71
|
-
class="flex w-full items-center gap-3 px-4 py-2.5 text-left text-body-large transition-colors"
|
|
71
|
+
class="flex w-full items-center gap-3 px-4 py-2.5 text-left text-body-large transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary"
|
|
72
72
|
:class="[
|
|
73
73
|
disabled ? 'cursor-not-allowed opacity-[0.38] text-on-surface' : 'cursor-pointer',
|
|
74
74
|
!disabled && danger ? 'text-error hover:bg-error/8' : '',
|
|
@@ -93,7 +93,7 @@ function onSubLeave(e: MouseEvent) {
|
|
|
93
93
|
>
|
|
94
94
|
<div
|
|
95
95
|
v-if="showSub"
|
|
96
|
-
class="m3-submenu min-w-44 overflow-hidden rounded-
|
|
96
|
+
class="m3-submenu min-w-44 overflow-hidden rounded-xs bg-surface-container py-1 shadow-elevation-2"
|
|
97
97
|
:style="subStyle"
|
|
98
98
|
@mouseleave="onSubLeave"
|
|
99
99
|
>
|
|
@@ -135,6 +135,7 @@ function toggle(value: unknown) {
|
|
|
135
135
|
|
|
136
136
|
function removeChip(value: unknown, e: Event) {
|
|
137
137
|
e.stopPropagation()
|
|
138
|
+
if (props.disabled) return
|
|
138
139
|
emit('update:modelValue', props.modelValue.filter((v) => !eq(v, value)))
|
|
139
140
|
nextTick(() => inputEl.value?.focus())
|
|
140
141
|
}
|
|
@@ -297,23 +298,23 @@ const triggerClasses = computed(() => {
|
|
|
297
298
|
]
|
|
298
299
|
|
|
299
300
|
if (props.variant === 'outlined') {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
open.value
|
|
301
|
+
const border = props.disabled
|
|
302
|
+
? 'border-on-surface/12'
|
|
303
|
+
: open.value
|
|
304
304
|
? (props.error ? 'border-2 border-error' : 'border-2 border-primary')
|
|
305
|
-
: (props.error ? 'border-error' : 'border-outline hover:border-on-surface')
|
|
306
|
-
].join(' ')
|
|
305
|
+
: (props.error ? 'border-error' : 'border-outline hover:border-on-surface')
|
|
306
|
+
return [...base, 'rounded-xs border bg-transparent py-2', border].join(' ')
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
isFloated.value ? 'pt-7' : 'pt-4',
|
|
313
|
-
open.value
|
|
309
|
+
const border = props.disabled
|
|
310
|
+
? 'border-on-surface/38'
|
|
311
|
+
: open.value
|
|
314
312
|
? (props.error ? 'border-b-2 border-error' : 'border-b-2 border-primary')
|
|
315
|
-
: (props.error ? 'border-error' : 'border-on-surface-variant hover:border-on-surface')
|
|
316
|
-
|
|
313
|
+
: (props.error ? 'border-error' : 'border-on-surface-variant hover:border-on-surface')
|
|
314
|
+
const bg = props.disabled
|
|
315
|
+
? 'bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]'
|
|
316
|
+
: 'bg-surface-container-highest'
|
|
317
|
+
return [...base, 'rounded-t-xs border-b pb-2', isFloated.value ? 'pt-7' : 'pt-4', bg, border].join(' ')
|
|
317
318
|
})
|
|
318
319
|
|
|
319
320
|
const labelClasses = computed(() => {
|
|
@@ -333,9 +334,11 @@ const labelClasses = computed(() => {
|
|
|
333
334
|
'pointer-events-none absolute right-10 truncate transition-all duration-200',
|
|
334
335
|
left,
|
|
335
336
|
isFloated.value ? floated : unFloated,
|
|
336
|
-
|
|
337
|
-
?
|
|
338
|
-
:
|
|
337
|
+
props.disabled
|
|
338
|
+
? 'text-on-surface/38'
|
|
339
|
+
: open.value
|
|
340
|
+
? (props.error ? 'text-error' : 'text-primary')
|
|
341
|
+
: (props.error ? 'text-error' : 'text-on-surface-variant'),
|
|
339
342
|
].join(' ')
|
|
340
343
|
})
|
|
341
344
|
</script>
|
|
@@ -351,17 +354,20 @@ const labelClasses = computed(() => {
|
|
|
351
354
|
<!-- Leading icon -->
|
|
352
355
|
<div
|
|
353
356
|
v-if="leadingIcon"
|
|
354
|
-
class="pointer-events-none absolute left-3.5
|
|
355
|
-
:class="
|
|
357
|
+
class="pointer-events-none absolute left-3.5"
|
|
358
|
+
:class="[
|
|
359
|
+
variant === 'filled' ? 'top-4.5' : 'top-4',
|
|
360
|
+
disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
|
|
361
|
+
]"
|
|
356
362
|
>
|
|
357
|
-
<MIcon :name="leadingIcon" :size="
|
|
363
|
+
<MIcon :name="leadingIcon" :size="24" />
|
|
358
364
|
</div>
|
|
359
365
|
|
|
360
366
|
<!-- Trigger field with chips and inline input -->
|
|
361
367
|
<div
|
|
362
368
|
:class="[
|
|
363
369
|
triggerClasses,
|
|
364
|
-
disabled ? 'pointer-events-none
|
|
370
|
+
disabled ? 'pointer-events-none' : 'cursor-text',
|
|
365
371
|
]"
|
|
366
372
|
@click="inputEl?.focus()"
|
|
367
373
|
>
|
|
@@ -369,10 +375,12 @@ const labelClasses = computed(() => {
|
|
|
369
375
|
<span
|
|
370
376
|
v-for="(chip, i) in displayChips"
|
|
371
377
|
:key="i"
|
|
372
|
-
class="inline-flex items-center gap-1 rounded-full
|
|
378
|
+
class="inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-label-small"
|
|
379
|
+
:class="disabled ? 'bg-on-surface/12 text-on-surface/38' : 'bg-secondary-container text-on-secondary-container'"
|
|
373
380
|
>
|
|
374
381
|
{{ chip.label }}
|
|
375
382
|
<button
|
|
383
|
+
v-if="!disabled"
|
|
376
384
|
type="button"
|
|
377
385
|
class="flex h-4 w-4 items-center justify-center rounded-full hover:bg-on-secondary-container/20"
|
|
378
386
|
@click="removeChip(chip.value, $event)"
|
|
@@ -408,7 +416,11 @@ const labelClasses = computed(() => {
|
|
|
408
416
|
role="combobox"
|
|
409
417
|
:aria-expanded="open"
|
|
410
418
|
:aria-disabled="disabled"
|
|
411
|
-
class="
|
|
419
|
+
:class="[
|
|
420
|
+
'flex-1 min-w-[60px] bg-transparent text-body-large outline-none placeholder:text-on-surface-variant',
|
|
421
|
+
error ? 'caret-error' : 'caret-primary',
|
|
422
|
+
disabled ? 'text-on-surface/38' : 'text-on-surface',
|
|
423
|
+
]"
|
|
412
424
|
@focus="onInputFocus"
|
|
413
425
|
@blur="onInputBlur"
|
|
414
426
|
@input="onInput"
|
|
@@ -436,8 +448,11 @@ const labelClasses = computed(() => {
|
|
|
436
448
|
<MIcon
|
|
437
449
|
name="arrow_drop_down"
|
|
438
450
|
:size="24"
|
|
439
|
-
class="
|
|
440
|
-
:class="
|
|
451
|
+
class="transition-transform duration-200"
|
|
452
|
+
:class="[
|
|
453
|
+
open || modalOpen ? 'rotate-180' : '',
|
|
454
|
+
disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
|
|
455
|
+
]"
|
|
441
456
|
/>
|
|
442
457
|
</div>
|
|
443
458
|
</div>
|
|
@@ -459,7 +474,7 @@ const labelClasses = computed(() => {
|
|
|
459
474
|
<div
|
|
460
475
|
v-if="open && mode === 'docked'"
|
|
461
476
|
ref="dropdownEl"
|
|
462
|
-
class="fixed z-500 max-h-60 overflow-auto rounded-
|
|
477
|
+
class="fixed z-500 max-h-60 overflow-auto rounded-xs bg-surface-container shadow-elevation-2"
|
|
463
478
|
:style="dropPos"
|
|
464
479
|
>
|
|
465
480
|
<div class="flex flex-col py-1">
|
|
@@ -494,7 +509,7 @@ const labelClasses = computed(() => {
|
|
|
494
509
|
<Transition name="m3-mac-modal">
|
|
495
510
|
<div
|
|
496
511
|
v-if="modalOpen && mode === 'modal'"
|
|
497
|
-
class="fixed inset-0 z-50 flex items-center justify-center bg-
|
|
512
|
+
class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
|
|
498
513
|
@click.self="closeDropdown"
|
|
499
514
|
>
|
|
500
515
|
<div class="mac-modal-box flex max-h-[80vh] w-full max-w-sm flex-col overflow-hidden rounded-[28px] bg-surface-container-high shadow-elevation-3">
|
|
@@ -119,6 +119,7 @@ function toggle(value: unknown) {
|
|
|
119
119
|
|
|
120
120
|
function removeChip(value: unknown, e: Event) {
|
|
121
121
|
e.stopPropagation()
|
|
122
|
+
if (props.disabled) return
|
|
122
123
|
emit('update:modelValue', props.modelValue.filter((v) => !eq(v, value)))
|
|
123
124
|
}
|
|
124
125
|
|
|
@@ -191,28 +192,35 @@ onUnmounted(() => {
|
|
|
191
192
|
|
|
192
193
|
const triggerClasses = computed(() => {
|
|
193
194
|
const base = [
|
|
194
|
-
'flex min-h-[56px] w-full
|
|
195
|
+
'flex min-h-[56px] w-full items-center gap-1.5 flex-wrap',
|
|
195
196
|
'transition-[border-color,border-width] duration-150',
|
|
197
|
+
props.disabled ? 'cursor-not-allowed' : 'cursor-pointer',
|
|
196
198
|
props.leadingIcon ? 'pl-12 pr-10' : 'pl-4 pr-10',
|
|
197
199
|
]
|
|
198
200
|
|
|
199
201
|
if (props.variant === 'outlined') {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
open.value
|
|
202
|
+
const border = props.disabled
|
|
203
|
+
? 'border-on-surface/12'
|
|
204
|
+
: open.value
|
|
204
205
|
? (props.error ? 'border-2 border-error' : 'border-2 border-primary')
|
|
205
|
-
: (props.error ? 'border-error' : 'border-outline hover:border-on-surface')
|
|
206
|
-
].join(' ')
|
|
206
|
+
: (props.error ? 'border-error' : 'border-outline hover:border-on-surface')
|
|
207
|
+
return [...base, 'rounded-xs border bg-transparent py-2', border].join(' ')
|
|
207
208
|
}
|
|
208
209
|
|
|
210
|
+
const border = props.disabled
|
|
211
|
+
? 'border-on-surface/38'
|
|
212
|
+
: open.value
|
|
213
|
+
? (props.error ? 'border-b-2 border-error' : 'border-b-2 border-primary')
|
|
214
|
+
: (props.error ? 'border-error' : 'border-on-surface-variant hover:border-on-surface')
|
|
215
|
+
const bg = props.disabled
|
|
216
|
+
? 'bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]'
|
|
217
|
+
: 'bg-surface-container-highest'
|
|
209
218
|
return [
|
|
210
219
|
...base,
|
|
211
|
-
'rounded-t-
|
|
220
|
+
'rounded-t-xs border-b pb-2',
|
|
212
221
|
hasValue.value || open.value ? 'pt-7' : 'pt-4',
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
: (props.error ? 'border-error' : 'border-on-surface-variant hover:border-on-surface'),
|
|
222
|
+
bg,
|
|
223
|
+
border,
|
|
216
224
|
].join(' ')
|
|
217
225
|
})
|
|
218
226
|
|
|
@@ -234,9 +242,11 @@ const labelClasses = computed(() => {
|
|
|
234
242
|
'pointer-events-none absolute right-10 truncate transition-all duration-200',
|
|
235
243
|
left,
|
|
236
244
|
active ? floated : unFloated,
|
|
237
|
-
|
|
238
|
-
?
|
|
239
|
-
:
|
|
245
|
+
props.disabled
|
|
246
|
+
? 'text-on-surface/38'
|
|
247
|
+
: open.value
|
|
248
|
+
? (props.error ? 'text-error' : 'text-primary')
|
|
249
|
+
: (props.error ? 'text-error' : 'text-on-surface-variant'),
|
|
240
250
|
].join(' ')
|
|
241
251
|
})
|
|
242
252
|
</script>
|
|
@@ -251,10 +261,13 @@ const labelClasses = computed(() => {
|
|
|
251
261
|
>
|
|
252
262
|
<div
|
|
253
263
|
v-if="leadingIcon"
|
|
254
|
-
class="pointer-events-none absolute left-3.5
|
|
255
|
-
:class="
|
|
264
|
+
class="pointer-events-none absolute left-3.5"
|
|
265
|
+
:class="[
|
|
266
|
+
variant === 'filled' ? 'top-4.5' : 'top-4',
|
|
267
|
+
disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
|
|
268
|
+
]"
|
|
256
269
|
>
|
|
257
|
-
<MIcon :name="leadingIcon" :size="
|
|
270
|
+
<MIcon :name="leadingIcon" :size="24" />
|
|
258
271
|
</div>
|
|
259
272
|
|
|
260
273
|
<!-- Trigger field -->
|
|
@@ -274,10 +287,12 @@ const labelClasses = computed(() => {
|
|
|
274
287
|
<span
|
|
275
288
|
v-for="(chip, i) in displayChips"
|
|
276
289
|
:key="i"
|
|
277
|
-
class="inline-flex items-center gap-1 rounded-full
|
|
290
|
+
class="inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-label-small"
|
|
291
|
+
:class="disabled ? 'bg-on-surface/12 text-on-surface/38' : 'bg-secondary-container text-on-secondary-container'"
|
|
278
292
|
>
|
|
279
293
|
{{ chip.label }}
|
|
280
294
|
<button
|
|
295
|
+
v-if="!disabled"
|
|
281
296
|
type="button"
|
|
282
297
|
class="flex h-4 w-4 items-center justify-center rounded-full hover:bg-on-secondary-container/20"
|
|
283
298
|
@click="removeChip(chip.value, $event)"
|
|
@@ -323,8 +338,11 @@ const labelClasses = computed(() => {
|
|
|
323
338
|
<MIcon
|
|
324
339
|
name="arrow_drop_down"
|
|
325
340
|
:size="24"
|
|
326
|
-
class="
|
|
327
|
-
:class="
|
|
341
|
+
class="transition-transform duration-200"
|
|
342
|
+
:class="[
|
|
343
|
+
open || modalOpen ? 'rotate-180' : '',
|
|
344
|
+
disabled ? 'text-on-surface/38' : 'text-on-surface-variant',
|
|
345
|
+
]"
|
|
328
346
|
/>
|
|
329
347
|
</div>
|
|
330
348
|
</div>
|
|
@@ -346,7 +364,7 @@ const labelClasses = computed(() => {
|
|
|
346
364
|
<div
|
|
347
365
|
v-if="open && mode === 'docked'"
|
|
348
366
|
ref="dropdownEl"
|
|
349
|
-
class="fixed z-500 max-h-60 overflow-auto rounded-
|
|
367
|
+
class="fixed z-500 max-h-60 overflow-auto rounded-xs bg-surface-container shadow-elevation-2"
|
|
350
368
|
:style="dropPos"
|
|
351
369
|
>
|
|
352
370
|
<div v-if="searchable" class="sticky top-0 bg-surface-container px-3 py-2">
|
|
@@ -389,7 +407,7 @@ const labelClasses = computed(() => {
|
|
|
389
407
|
<Transition name="m3-ms-modal">
|
|
390
408
|
<div
|
|
391
409
|
v-if="modalOpen && mode === 'modal'"
|
|
392
|
-
class="fixed inset-0 z-50 flex items-center justify-center bg-
|
|
410
|
+
class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
|
|
393
411
|
@click.self="close"
|
|
394
412
|
>
|
|
395
413
|
<div class="ms-modal-box flex max-h-[80vh] w-full max-w-sm flex-col overflow-hidden rounded-[28px] bg-surface-container-high shadow-elevation-3">
|
|
@@ -19,17 +19,12 @@ defineEmits<{ 'update:modelValue': [string | number] }>()
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<template>
|
|
22
|
-
<nav class="flex h-20 w-full items-center justify-around border-t border-outline-variant bg-surface-container">
|
|
22
|
+
<nav class="flex h-20 w-full items-center justify-around border-t border-outline-variant bg-surface-container shadow-elevation-2">
|
|
23
23
|
<button
|
|
24
24
|
v-for="item in items"
|
|
25
25
|
:key="item.value"
|
|
26
26
|
type="button"
|
|
27
27
|
class="group flex flex-1 cursor-pointer flex-col items-center justify-center gap-1 self-stretch transition-colors focus-visible:outline-none"
|
|
28
|
-
:class="
|
|
29
|
-
item.value === modelValue
|
|
30
|
-
? 'text-on-secondary-container'
|
|
31
|
-
: 'text-on-surface-variant'
|
|
32
|
-
"
|
|
33
28
|
@click="$emit('update:modelValue', item.value)"
|
|
34
29
|
>
|
|
35
30
|
<!-- Pill indicator with icon -->
|
|
@@ -37,8 +32,8 @@ defineEmits<{ 'update:modelValue': [string | number] }>()
|
|
|
37
32
|
class="inline-flex h-8 items-center justify-center rounded-2xl transition-all duration-200"
|
|
38
33
|
:class="
|
|
39
34
|
item.value === modelValue
|
|
40
|
-
? 'w-16 bg-secondary-container'
|
|
41
|
-
: 'w-0 bg-secondary-container/0 group-hover:w-16 group-hover:bg-on-surface/8'
|
|
35
|
+
? 'w-16 bg-secondary-container text-on-secondary-container'
|
|
36
|
+
: 'w-0 bg-secondary-container/0 text-on-surface-variant group-hover:w-16 group-hover:bg-on-surface/8'
|
|
42
37
|
"
|
|
43
38
|
>
|
|
44
39
|
<MBadge v-if="item.badge != null" :count="item.badge">
|
|
@@ -52,8 +47,8 @@ defineEmits<{ 'update:modelValue': [string | number] }>()
|
|
|
52
47
|
|
|
53
48
|
<!-- Label -->
|
|
54
49
|
<span
|
|
55
|
-
class="text-label-medium
|
|
56
|
-
:class="item.value === modelValue ? '
|
|
50
|
+
class="text-label-medium font-medium"
|
|
51
|
+
:class="item.value === modelValue ? 'text-secondary' : 'text-on-surface-variant'"
|
|
57
52
|
>
|
|
58
53
|
{{ item.label }}
|
|
59
54
|
</span>
|
|
@@ -141,16 +141,17 @@ watch(
|
|
|
141
141
|
side === 'top' ? 'flex-col' : '',
|
|
142
142
|
]"
|
|
143
143
|
>
|
|
144
|
-
<div class="nd-scrim absolute inset-0 bg-
|
|
144
|
+
<div class="nd-scrim absolute inset-0 bg-scrim/32" @click="close" />
|
|
145
145
|
|
|
146
146
|
<nav
|
|
147
147
|
:class="[
|
|
148
|
-
'nd-panel relative flex flex-col bg-surface-container shadow-elevation-
|
|
148
|
+
'nd-panel relative flex flex-col bg-surface-container-low shadow-elevation-1',
|
|
149
149
|
`nd-panel-${side}`,
|
|
150
150
|
side === 'top' || side === 'bottom'
|
|
151
151
|
? 'w-full max-h-[85vh]'
|
|
152
152
|
: 'h-full max-w-[85vw]',
|
|
153
|
-
side === 'top' || side === 'bottom' || width ? '' : 'w-
|
|
153
|
+
side === 'top' || side === 'bottom' || width ? '' : 'w-[22.5rem]',
|
|
154
|
+
side === 'right' ? 'rounded-l-lg' : side === 'left' ? 'rounded-r-lg' : side === 'bottom' ? 'rounded-t-lg' : '',
|
|
154
155
|
]"
|
|
155
156
|
:style="side !== 'top' && side !== 'bottom' && width ? { width } : undefined"
|
|
156
157
|
>
|
|
@@ -208,7 +209,7 @@ watch(
|
|
|
208
209
|
:is="itemTag(item)"
|
|
209
210
|
:to="item.to && !item.disabled ? item.to : undefined"
|
|
210
211
|
:type="item.to ? undefined : 'button'"
|
|
211
|
-
class="flex w-full items-center gap-3 rounded-full py-
|
|
212
|
+
class="flex w-full items-center gap-3 rounded-full py-4 text-left transition-colors focus-visible:outline-none"
|
|
212
213
|
:class="[
|
|
213
214
|
section.collapsible ? 'pl-8 pr-3' : 'px-4',
|
|
214
215
|
item.disabled
|
|
@@ -271,14 +272,14 @@ watch(
|
|
|
271
272
|
<nav
|
|
272
273
|
class="nd-inline flex h-full shrink-0 flex-col bg-surface"
|
|
273
274
|
:class="[
|
|
274
|
-
inlineSide === 'right' ? 'border-l border-outline-variant' : 'border-r border-outline-variant',
|
|
275
|
+
inlineSide === 'right' ? 'border-l border-outline-variant rounded-l-lg' : 'border-r border-outline-variant rounded-r-lg',
|
|
275
276
|
!modelValue
|
|
276
277
|
? inlineSide === 'right' ? 'nd-hidden w-0 border-l-0' : 'nd-hidden w-0 border-r-0'
|
|
277
278
|
: collapsed
|
|
278
279
|
? 'nd-collapsed w-[72px]'
|
|
279
|
-
: width ? '' : 'w-
|
|
280
|
+
: width ? '' : 'w-[22.5rem]',
|
|
280
281
|
]"
|
|
281
|
-
:style="{ width: modelValue && !collapsed && width ? width : undefined, '--nd-width': width ?? '
|
|
282
|
+
:style="{ width: modelValue && !collapsed && width ? width : undefined, '--nd-width': width ?? '22.5rem' }"
|
|
282
283
|
>
|
|
283
284
|
<div v-if="$slots.toggle" class="nd-toggle shrink-0 border-b border-outline-variant">
|
|
284
285
|
<div class="nd-toggle-inner">
|
|
@@ -350,7 +351,7 @@ watch(
|
|
|
350
351
|
:to="item.to && !item.disabled ? item.to : undefined"
|
|
351
352
|
:type="item.to ? undefined : 'button'"
|
|
352
353
|
:title="collapsed ? item.label : undefined"
|
|
353
|
-
class="flex w-full shrink-0 items-center gap-3 overflow-hidden whitespace-nowrap rounded-full py-
|
|
354
|
+
class="flex w-full shrink-0 items-center gap-3 overflow-hidden whitespace-nowrap rounded-full py-4 text-left focus-visible:outline-none"
|
|
354
355
|
:class="[
|
|
355
356
|
section.collapsible && !collapsed ? 'pl-8 pr-3' : 'px-3',
|
|
356
357
|
item.disabled
|
|
@@ -487,7 +488,7 @@ watch(
|
|
|
487
488
|
|
|
488
489
|
/* Freeze layout so content clips like a curtain during open/close */
|
|
489
490
|
.nd-inline > * {
|
|
490
|
-
min-width: var(--nd-width,
|
|
491
|
+
min-width: var(--nd-width, 22.5rem);
|
|
491
492
|
}
|
|
492
493
|
/* Collapse-to-icons: let children adapt to 72px width */
|
|
493
494
|
.nd-inline.nd-collapsed > * {
|