@m3ui-vue/m3ui-vue 0.8.5 → 0.8.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.
- package/README.md +1 -1
- package/dist/{MMenuItem-BXIxwIdM.js → MMenuItem-BmPLAyv5.js} +2 -2
- package/dist/{MMenuItem-BXIxwIdM.js.map → MMenuItem-BmPLAyv5.js.map} +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MChatBubble.vue.d.ts +4 -2
- package/dist/components/MCheckbox.vue.d.ts +2 -0
- package/dist/components/MDragDropList.vue.d.ts +19 -6
- package/dist/components/MFileUpload.vue.d.ts +16 -4
- package/dist/components/MKanban.vue.d.ts +15 -6
- package/dist/components/MTransferList.vue.d.ts +9 -3
- package/dist/components/_MTransferPane.vue.d.ts +39 -0
- package/dist/composables/useLocale.d.ts +24 -0
- package/dist/locales/index.js +175 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +3576 -2679
- package/dist/m3ui.js.map +1 -1
- package/dist/rich-text-editor.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/{useLocale-DbREg9Zn.js → useLocale-4afAzuuP.js} +26 -2
- package/dist/useLocale-4afAzuuP.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MChatBubble.test.ts +33 -0
- package/src/__tests__/MDragDropList.test.ts +194 -0
- package/src/__tests__/MFileUpload.test.ts +78 -0
- package/src/__tests__/MKanban.test.ts +150 -0
- package/src/__tests__/MPullToRefresh.test.ts +67 -0
- package/src/__tests__/MRating.test.ts +72 -0
- package/src/__tests__/MTransferList.test.ts +76 -0
- package/src/components/MChatBubble.vue +107 -20
- package/src/components/MCheckbox.vue +3 -0
- package/src/components/MDragDropList.vue +485 -56
- package/src/components/MFileUpload.vue +56 -20
- package/src/components/MKanban.vue +720 -78
- package/src/components/MNavigationRail.vue +35 -23
- package/src/components/MPullToRefresh.vue +101 -35
- package/src/components/MRating.vue +163 -67
- package/src/components/MResult.vue +19 -9
- package/src/components/MTransferList.vue +133 -130
- package/src/components/_MTransferPane.vue +182 -0
- package/src/composables/useLocale.ts +68 -0
- package/src/locales/de.ts +34 -0
- package/src/locales/es.ts +34 -0
- package/src/locales/fr.ts +34 -0
- package/src/locales/ja.ts +34 -0
- package/src/locales/ko.ts +34 -0
- package/src/locales/pt.ts +34 -0
- package/src/locales/zh.ts +34 -0
- package/dist/useLocale-DbREg9Zn.js.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
|
-
import MIcon from './MIcon.vue'
|
|
4
3
|
import MIconButton from './MIconButton.vue'
|
|
5
|
-
import
|
|
4
|
+
import MTransferPane from './_MTransferPane.vue'
|
|
6
5
|
import { useLocale } from '../composables/useLocale'
|
|
7
6
|
|
|
8
7
|
const locale = useLocale()
|
|
@@ -11,10 +10,14 @@ export interface TransferItem {
|
|
|
11
10
|
value: string | number
|
|
12
11
|
label: string
|
|
13
12
|
icon?: string
|
|
13
|
+
/** Optional second line under the label (an email, a role, a short description). */
|
|
14
|
+
description?: string
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
type Value = string | number
|
|
18
|
+
|
|
16
19
|
const props = withDefaults(defineProps<{
|
|
17
|
-
modelValue:
|
|
20
|
+
modelValue: Value[]
|
|
18
21
|
items: TransferItem[]
|
|
19
22
|
sourceTitle?: string
|
|
20
23
|
targetTitle?: string
|
|
@@ -25,172 +28,172 @@ const props = withDefaults(defineProps<{
|
|
|
25
28
|
moveRightLabel?: string
|
|
26
29
|
moveLeftLabel?: string
|
|
27
30
|
moveAllLeftLabel?: string
|
|
31
|
+
/** Height of each list's scroll area (any CSS length). */
|
|
32
|
+
listHeight?: string
|
|
28
33
|
}>(), {
|
|
29
34
|
filterable: false,
|
|
35
|
+
listHeight: '280px',
|
|
30
36
|
})
|
|
31
37
|
|
|
32
|
-
const emit = defineEmits<{ 'update:modelValue': [
|
|
38
|
+
const emit = defineEmits<{ 'update:modelValue': [Value[]] }>()
|
|
33
39
|
|
|
34
|
-
const checkedSource = ref<Set<
|
|
35
|
-
const checkedTarget = ref<Set<
|
|
40
|
+
const checkedSource = ref<Set<Value>>(new Set())
|
|
41
|
+
const checkedTarget = ref<Set<Value>>(new Set())
|
|
36
42
|
const sourceSearch = ref('')
|
|
37
43
|
const targetSearch = ref('')
|
|
38
44
|
|
|
45
|
+
function matches(item: TransferItem, q: string) {
|
|
46
|
+
if (!q) return true
|
|
47
|
+
const needle = q.toLowerCase()
|
|
48
|
+
return item.label.toLowerCase().includes(needle) || !!item.description?.toLowerCase().includes(needle)
|
|
49
|
+
}
|
|
50
|
+
|
|
39
51
|
const sourceItems = computed(() => {
|
|
40
52
|
const selected = new Set(props.modelValue)
|
|
41
|
-
|
|
42
|
-
if (sourceSearch.value) {
|
|
43
|
-
const q = sourceSearch.value.toLowerCase()
|
|
44
|
-
list = list.filter(i => i.label.toLowerCase().includes(q))
|
|
45
|
-
}
|
|
46
|
-
return list
|
|
53
|
+
return props.items.filter((i) => !selected.has(i.value) && matches(i, sourceSearch.value))
|
|
47
54
|
})
|
|
48
55
|
|
|
49
56
|
const targetItems = computed(() => {
|
|
50
57
|
const selected = new Set(props.modelValue)
|
|
51
|
-
|
|
52
|
-
if (targetSearch.value) {
|
|
53
|
-
const q = targetSearch.value.toLowerCase()
|
|
54
|
-
list = list.filter(i => i.label.toLowerCase().includes(q))
|
|
55
|
-
}
|
|
56
|
-
return list
|
|
58
|
+
return props.items.filter((i) => selected.has(i.value) && matches(i, targetSearch.value))
|
|
57
59
|
})
|
|
58
60
|
|
|
59
|
-
function
|
|
60
|
-
const s = new Set(
|
|
61
|
+
function toggleIn(set: typeof checkedSource, value: Value) {
|
|
62
|
+
const s = new Set(set.value)
|
|
61
63
|
s.has(value) ? s.delete(value) : s.add(value)
|
|
62
|
-
|
|
64
|
+
set.value = s
|
|
63
65
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
|
|
67
|
+
// Select-all acts on what's visible (i.e. what the search left).
|
|
68
|
+
function toggleAllIn(set: typeof checkedSource, visible: TransferItem[]) {
|
|
69
|
+
const allChecked = visible.length > 0 && visible.every((i) => set.value.has(i.value))
|
|
70
|
+
const s = new Set(set.value)
|
|
71
|
+
for (const i of visible) allChecked ? s.delete(i.value) : s.add(i.value)
|
|
72
|
+
set.value = s
|
|
68
73
|
}
|
|
69
74
|
|
|
75
|
+
const toggleSource = (v: Value) => toggleIn(checkedSource, v)
|
|
76
|
+
const toggleTarget = (v: Value) => toggleIn(checkedTarget, v)
|
|
77
|
+
const toggleAllSource = () => toggleAllIn(checkedSource, sourceItems.value)
|
|
78
|
+
const toggleAllTarget = () => toggleAllIn(checkedTarget, targetItems.value)
|
|
79
|
+
|
|
70
80
|
function moveRight() {
|
|
71
|
-
|
|
72
|
-
emit('update:modelValue', next)
|
|
81
|
+
emit('update:modelValue', [...props.modelValue, ...checkedSource.value])
|
|
73
82
|
checkedSource.value = new Set()
|
|
74
83
|
}
|
|
75
84
|
function moveLeft() {
|
|
76
85
|
const remove = checkedTarget.value
|
|
77
|
-
emit('update:modelValue', props.modelValue.filter(v => !remove.has(v)))
|
|
86
|
+
emit('update:modelValue', props.modelValue.filter((v) => !remove.has(v)))
|
|
78
87
|
checkedTarget.value = new Set()
|
|
79
88
|
}
|
|
80
89
|
function moveAllRight() {
|
|
81
|
-
|
|
82
|
-
emit('update:modelValue', [...props.modelValue, ...all])
|
|
90
|
+
emit('update:modelValue', [...props.modelValue, ...sourceItems.value.map((i) => i.value)])
|
|
83
91
|
checkedSource.value = new Set()
|
|
84
92
|
}
|
|
85
93
|
function moveAllLeft() {
|
|
86
|
-
const
|
|
87
|
-
emit('update:modelValue', props.modelValue.filter(v => !
|
|
94
|
+
const remove = new Set(targetItems.value.map((i) => i.value))
|
|
95
|
+
emit('update:modelValue', props.modelValue.filter((v) => !remove.has(v)))
|
|
88
96
|
checkedTarget.value = new Set()
|
|
89
97
|
}
|
|
98
|
+
|
|
99
|
+
// Double-click / Enter on a row moves just that item across.
|
|
100
|
+
function activateSource(value: Value) {
|
|
101
|
+
emit('update:modelValue', [...props.modelValue, value])
|
|
102
|
+
const s = new Set(checkedSource.value)
|
|
103
|
+
s.delete(value)
|
|
104
|
+
checkedSource.value = s
|
|
105
|
+
}
|
|
106
|
+
function activateTarget(value: Value) {
|
|
107
|
+
emit('update:modelValue', props.modelValue.filter((v) => v !== value))
|
|
108
|
+
const s = new Set(checkedTarget.value)
|
|
109
|
+
s.delete(value)
|
|
110
|
+
checkedTarget.value = s
|
|
111
|
+
}
|
|
90
112
|
</script>
|
|
91
113
|
|
|
92
114
|
<template>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</button>
|
|
120
|
-
<slot v-if="!sourceItems.length" name="source-empty">
|
|
121
|
-
<p class="px-3 py-4 text-center text-body-small text-on-surface-variant">
|
|
122
|
-
{{ emptyText ?? locale.noItems }}
|
|
123
|
-
</p>
|
|
124
|
-
</slot>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
115
|
+
<!--
|
|
116
|
+
Container query, not a viewport breakpoint: the panes sit side by side whenever the
|
|
117
|
+
component itself is wide enough (@xl = 36rem), and stack with up/down arrows otherwise,
|
|
118
|
+
whatever the screen size.
|
|
119
|
+
-->
|
|
120
|
+
<div class="@container">
|
|
121
|
+
<div class="flex flex-col items-stretch gap-3 @xl:flex-row">
|
|
122
|
+
<MTransferPane
|
|
123
|
+
:title="sourceTitle ?? locale.available"
|
|
124
|
+
:items="sourceItems"
|
|
125
|
+
:checked="checkedSource"
|
|
126
|
+
:filterable="filterable"
|
|
127
|
+
:search="sourceSearch"
|
|
128
|
+
:search-placeholder="searchPlaceholder ?? locale.search"
|
|
129
|
+
:empty-text="emptyText ?? locale.noItems"
|
|
130
|
+
:list-height="listHeight"
|
|
131
|
+
enter-from="end"
|
|
132
|
+
:select-all-label="locale.selectAll"
|
|
133
|
+
:clear-search-label="locale.clearSearch"
|
|
134
|
+
@toggle="toggleSource"
|
|
135
|
+
@toggle-all="toggleAllSource"
|
|
136
|
+
@activate="activateSource"
|
|
137
|
+
@update:search="sourceSearch = $event"
|
|
138
|
+
>
|
|
139
|
+
<template v-if="$slots['source-empty']" #empty><slot name="source-empty" /></template>
|
|
140
|
+
</MTransferPane>
|
|
127
141
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<!-- Target list -->
|
|
163
|
-
<div class="flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-outline-variant">
|
|
164
|
-
<div class="flex items-center justify-between border-b border-outline-variant bg-surface-container px-3 py-2">
|
|
165
|
-
<span class="text-label-large font-medium text-on-surface">{{ targetTitle ?? locale.selected }}</span>
|
|
166
|
-
<span class="text-label-small text-on-surface-variant">{{ targetItems.length }}</span>
|
|
167
|
-
</div>
|
|
168
|
-
<div v-if="filterable" class="border-b border-outline-variant px-3 py-2">
|
|
169
|
-
<input
|
|
170
|
-
v-model="targetSearch"
|
|
171
|
-
type="text"
|
|
172
|
-
:placeholder="searchPlaceholder ?? locale.search"
|
|
173
|
-
class="w-full bg-transparent text-body-medium text-on-surface outline-none placeholder:text-on-surface-variant/50"
|
|
142
|
+
<!-- Transfer buttons: tonal for the checked items, outlined for "all" -->
|
|
143
|
+
<div class="flex items-center justify-center gap-2 @xl:flex-col">
|
|
144
|
+
<MIconButton
|
|
145
|
+
icon="keyboard_double_arrow_right"
|
|
146
|
+
variant="outlined"
|
|
147
|
+
class="rotate-90 @xl:rotate-0"
|
|
148
|
+
:label="moveAllRightLabel ?? locale.moveAllRight"
|
|
149
|
+
:disabled="!sourceItems.length"
|
|
150
|
+
@click="moveAllRight"
|
|
151
|
+
/>
|
|
152
|
+
<MIconButton
|
|
153
|
+
icon="chevron_right"
|
|
154
|
+
variant="tonal"
|
|
155
|
+
class="rotate-90 @xl:rotate-0"
|
|
156
|
+
:label="moveRightLabel ?? locale.moveRight"
|
|
157
|
+
:disabled="!checkedSource.size"
|
|
158
|
+
@click="moveRight"
|
|
159
|
+
/>
|
|
160
|
+
<MIconButton
|
|
161
|
+
icon="chevron_left"
|
|
162
|
+
variant="tonal"
|
|
163
|
+
class="rotate-90 @xl:rotate-0"
|
|
164
|
+
:label="moveLeftLabel ?? locale.moveLeft"
|
|
165
|
+
:disabled="!checkedTarget.size"
|
|
166
|
+
@click="moveLeft"
|
|
167
|
+
/>
|
|
168
|
+
<MIconButton
|
|
169
|
+
icon="keyboard_double_arrow_left"
|
|
170
|
+
variant="outlined"
|
|
171
|
+
class="rotate-90 @xl:rotate-0"
|
|
172
|
+
:label="moveAllLeftLabel ?? locale.moveAllLeft"
|
|
173
|
+
:disabled="!targetItems.length"
|
|
174
|
+
@click="moveAllLeft"
|
|
174
175
|
/>
|
|
175
176
|
</div>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
177
|
+
|
|
178
|
+
<MTransferPane
|
|
179
|
+
:title="targetTitle ?? locale.selected"
|
|
180
|
+
:items="targetItems"
|
|
181
|
+
:checked="checkedTarget"
|
|
182
|
+
:filterable="filterable"
|
|
183
|
+
:search="targetSearch"
|
|
184
|
+
:search-placeholder="searchPlaceholder ?? locale.search"
|
|
185
|
+
:empty-text="emptyText ?? locale.noItems"
|
|
186
|
+
:list-height="listHeight"
|
|
187
|
+
enter-from="start"
|
|
188
|
+
:select-all-label="locale.selectAll"
|
|
189
|
+
:clear-search-label="locale.clearSearch"
|
|
190
|
+
@toggle="toggleTarget"
|
|
191
|
+
@toggle-all="toggleAllTarget"
|
|
192
|
+
@activate="activateTarget"
|
|
193
|
+
@update:search="targetSearch = $event"
|
|
194
|
+
>
|
|
195
|
+
<template v-if="$slots['target-empty']" #empty><slot name="target-empty" /></template>
|
|
196
|
+
</MTransferPane>
|
|
194
197
|
</div>
|
|
195
198
|
</div>
|
|
196
199
|
</template>
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Private helper for MTransferList: one pane (header with select-all, search, list).
|
|
3
|
+
// Both panes render through this so the source and target never drift apart.
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import MIcon from './MIcon.vue'
|
|
6
|
+
import MCheckbox from './MCheckbox.vue'
|
|
7
|
+
import type { TransferItem } from './MTransferList.vue'
|
|
8
|
+
|
|
9
|
+
type Value = string | number
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
title: string
|
|
13
|
+
items: TransferItem[]
|
|
14
|
+
checked: Set<Value>
|
|
15
|
+
filterable: boolean
|
|
16
|
+
search: string
|
|
17
|
+
searchPlaceholder: string
|
|
18
|
+
emptyText: string
|
|
19
|
+
listHeight: string
|
|
20
|
+
/** Side new items slide in from: the source pane receives from the end, the target from the start. */
|
|
21
|
+
enterFrom: 'start' | 'end'
|
|
22
|
+
selectAllLabel: string
|
|
23
|
+
clearSearchLabel: string
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits<{
|
|
27
|
+
toggle: [Value]
|
|
28
|
+
toggleAll: []
|
|
29
|
+
activate: [Value]
|
|
30
|
+
'update:search': [string]
|
|
31
|
+
}>()
|
|
32
|
+
|
|
33
|
+
const checkedVisible = computed(() => props.items.filter((i) => props.checked.has(i.value)).length)
|
|
34
|
+
const allChecked = computed(() => props.items.length > 0 && checkedVisible.value === props.items.length)
|
|
35
|
+
const someChecked = computed(() => checkedVisible.value > 0 && !allChecked.value)
|
|
36
|
+
|
|
37
|
+
function onRowClick(e: MouseEvent, value: Value) {
|
|
38
|
+
// The checkbox handles its own clicks (its label + input); toggling here too is exactly
|
|
39
|
+
// the old double-toggle bug, where the box showed checked but the state wasn't.
|
|
40
|
+
if ((e.target as Element).closest('label')) return
|
|
41
|
+
emit('toggle', value)
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<section class="flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-container-low">
|
|
47
|
+
<!-- Header: select-all + title + count -->
|
|
48
|
+
<header class="flex items-center gap-4 px-4 pt-3 pb-2">
|
|
49
|
+
<MCheckbox
|
|
50
|
+
:model-value="allChecked"
|
|
51
|
+
:indeterminate="someChecked"
|
|
52
|
+
:disabled="!items.length"
|
|
53
|
+
:aria-label="selectAllLabel"
|
|
54
|
+
@update:model-value="emit('toggleAll')"
|
|
55
|
+
/>
|
|
56
|
+
<h3 class="min-w-0 flex-1 truncate text-title-medium text-on-surface">{{ title }}</h3>
|
|
57
|
+
<span class="shrink-0 text-label-medium tabular-nums text-on-surface-variant">
|
|
58
|
+
{{ checkedVisible }}/{{ items.length }}
|
|
59
|
+
</span>
|
|
60
|
+
</header>
|
|
61
|
+
|
|
62
|
+
<!-- Search -->
|
|
63
|
+
<div v-if="filterable" class="px-3 pb-2">
|
|
64
|
+
<div
|
|
65
|
+
class="flex h-10 items-center gap-2 rounded-full bg-surface-container-high pr-1 pl-3 focus-within:ring-2 focus-within:ring-secondary"
|
|
66
|
+
>
|
|
67
|
+
<MIcon name="search" :size="20" class="shrink-0 text-on-surface-variant" />
|
|
68
|
+
<input
|
|
69
|
+
:value="search"
|
|
70
|
+
type="text"
|
|
71
|
+
:placeholder="searchPlaceholder"
|
|
72
|
+
class="min-w-0 flex-1 bg-transparent text-body-medium text-on-surface caret-primary outline-none placeholder:text-on-surface-variant"
|
|
73
|
+
@input="emit('update:search', ($event.target as HTMLInputElement).value)"
|
|
74
|
+
/>
|
|
75
|
+
<button
|
|
76
|
+
v-if="search"
|
|
77
|
+
type="button"
|
|
78
|
+
class="flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-on-surface-variant transition-colors hover:bg-on-surface/8"
|
|
79
|
+
:aria-label="clearSearchLabel"
|
|
80
|
+
@click="emit('update:search', '')"
|
|
81
|
+
>
|
|
82
|
+
<MIcon name="close" :size="18" />
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<!-- List -->
|
|
88
|
+
<div class="relative overflow-y-auto overscroll-contain" :style="{ height: listHeight }">
|
|
89
|
+
<TransitionGroup tag="ul" :name="`m3-tl-${enterFrom}`" class="relative py-1">
|
|
90
|
+
<li
|
|
91
|
+
v-for="item in items"
|
|
92
|
+
:key="item.value"
|
|
93
|
+
class="group relative flex min-h-14 cursor-pointer select-none items-center gap-4 px-4 py-2 transition-colors duration-150"
|
|
94
|
+
:class="checked.has(item.value) ? 'bg-secondary-container' : ''"
|
|
95
|
+
@click="onRowClick($event, item.value)"
|
|
96
|
+
@dblclick="emit('activate', item.value)"
|
|
97
|
+
@keydown.enter.prevent="emit('activate', item.value)"
|
|
98
|
+
>
|
|
99
|
+
<span
|
|
100
|
+
aria-hidden="true"
|
|
101
|
+
class="pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-150 group-hover:opacity-[0.08]"
|
|
102
|
+
:class="checked.has(item.value) ? 'bg-on-secondary-container' : 'bg-on-surface'"
|
|
103
|
+
/>
|
|
104
|
+
<MCheckbox
|
|
105
|
+
class="relative"
|
|
106
|
+
:model-value="checked.has(item.value)"
|
|
107
|
+
:aria-label="item.label"
|
|
108
|
+
@update:model-value="emit('toggle', item.value)"
|
|
109
|
+
/>
|
|
110
|
+
<span
|
|
111
|
+
v-if="item.icon"
|
|
112
|
+
class="relative flex h-10 w-10 shrink-0 items-center justify-center rounded-full transition-colors duration-150"
|
|
113
|
+
:class="checked.has(item.value) ? 'bg-secondary text-on-secondary' : 'bg-surface-container-highest text-on-surface-variant'"
|
|
114
|
+
>
|
|
115
|
+
<MIcon :name="item.icon" :size="20" />
|
|
116
|
+
</span>
|
|
117
|
+
<span class="relative min-w-0 flex-1">
|
|
118
|
+
<span
|
|
119
|
+
class="block truncate text-body-large"
|
|
120
|
+
:class="checked.has(item.value) ? 'text-on-secondary-container' : 'text-on-surface'"
|
|
121
|
+
>{{ item.label }}</span>
|
|
122
|
+
<span
|
|
123
|
+
v-if="item.description"
|
|
124
|
+
class="block truncate text-body-medium"
|
|
125
|
+
:class="checked.has(item.value) ? 'text-on-secondary-container/80' : 'text-on-surface-variant'"
|
|
126
|
+
>{{ item.description }}</span>
|
|
127
|
+
</span>
|
|
128
|
+
</li>
|
|
129
|
+
</TransitionGroup>
|
|
130
|
+
|
|
131
|
+
<div
|
|
132
|
+
v-if="!items.length"
|
|
133
|
+
class="absolute inset-0 flex flex-col items-center justify-center gap-2 p-6 text-center"
|
|
134
|
+
>
|
|
135
|
+
<slot name="empty">
|
|
136
|
+
<MIcon :name="search ? 'search_off' : 'inbox'" :size="32" class="text-on-surface-variant/60" />
|
|
137
|
+
<p class="text-body-medium text-on-surface-variant">{{ emptyText }}</p>
|
|
138
|
+
</slot>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</section>
|
|
142
|
+
</template>
|
|
143
|
+
|
|
144
|
+
<style scoped>
|
|
145
|
+
.m3-tl-start-move,
|
|
146
|
+
.m3-tl-end-move {
|
|
147
|
+
transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
|
|
148
|
+
}
|
|
149
|
+
.m3-tl-start-enter-active,
|
|
150
|
+
.m3-tl-end-enter-active {
|
|
151
|
+
transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.2, 0, 0, 1);
|
|
152
|
+
}
|
|
153
|
+
.m3-tl-start-leave-active,
|
|
154
|
+
.m3-tl-end-leave-active {
|
|
155
|
+
transition: opacity 0.15s ease;
|
|
156
|
+
position: absolute;
|
|
157
|
+
left: 0;
|
|
158
|
+
right: 0;
|
|
159
|
+
}
|
|
160
|
+
.m3-tl-start-enter-from {
|
|
161
|
+
opacity: 0;
|
|
162
|
+
transform: translateX(-16px);
|
|
163
|
+
}
|
|
164
|
+
.m3-tl-end-enter-from {
|
|
165
|
+
opacity: 0;
|
|
166
|
+
transform: translateX(16px);
|
|
167
|
+
}
|
|
168
|
+
.m3-tl-start-leave-to,
|
|
169
|
+
.m3-tl-end-leave-to {
|
|
170
|
+
opacity: 0;
|
|
171
|
+
}
|
|
172
|
+
@media (prefers-reduced-motion: reduce) {
|
|
173
|
+
.m3-tl-start-move,
|
|
174
|
+
.m3-tl-end-move,
|
|
175
|
+
.m3-tl-start-enter-active,
|
|
176
|
+
.m3-tl-end-enter-active,
|
|
177
|
+
.m3-tl-start-leave-active,
|
|
178
|
+
.m3-tl-end-leave-active {
|
|
179
|
+
transition: none;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -104,6 +104,40 @@ export interface M3Locale {
|
|
|
104
104
|
// JSON viewer
|
|
105
105
|
jsonElements: string
|
|
106
106
|
jsonFields: string
|
|
107
|
+
|
|
108
|
+
// Result
|
|
109
|
+
resultSuccessTitle: string
|
|
110
|
+
resultSuccessDesc: string
|
|
111
|
+
resultErrorTitle: string
|
|
112
|
+
resultErrorDesc: string
|
|
113
|
+
resultWarningTitle: string
|
|
114
|
+
resultWarningDesc: string
|
|
115
|
+
resultInfoTitle: string
|
|
116
|
+
resultInfoDesc: string
|
|
117
|
+
result404Title: string
|
|
118
|
+
result404Desc: string
|
|
119
|
+
result403Title: string
|
|
120
|
+
result403Desc: string
|
|
121
|
+
result500Title: string
|
|
122
|
+
result500Desc: string
|
|
123
|
+
|
|
124
|
+
// Chat bubble
|
|
125
|
+
chatTyping: string
|
|
126
|
+
chatRecordingAudio: string
|
|
127
|
+
|
|
128
|
+
// Drag & drop list ({pos}/{total} are replaced at runtime)
|
|
129
|
+
reorderHandle: string
|
|
130
|
+
reorderGrabbed: string
|
|
131
|
+
reorderMoved: string
|
|
132
|
+
reorderDropped: string
|
|
133
|
+
reorderCancelled: string
|
|
134
|
+
|
|
135
|
+
// Transfer list (panes)
|
|
136
|
+
selectAll: string
|
|
137
|
+
clearSearch: string
|
|
138
|
+
|
|
139
|
+
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
140
|
+
kanbanMoved: string
|
|
107
141
|
}
|
|
108
142
|
|
|
109
143
|
export const defaultLocale: M3Locale = {
|
|
@@ -196,6 +230,40 @@ export const defaultLocale: M3Locale = {
|
|
|
196
230
|
|
|
197
231
|
jsonElements: 'elements',
|
|
198
232
|
jsonFields: 'fields',
|
|
233
|
+
|
|
234
|
+
// Result
|
|
235
|
+
resultSuccessTitle: 'Success',
|
|
236
|
+
resultSuccessDesc: 'The action was completed successfully.',
|
|
237
|
+
resultErrorTitle: 'Something went wrong',
|
|
238
|
+
resultErrorDesc: 'An unexpected error occurred. Please try again.',
|
|
239
|
+
resultWarningTitle: 'Warning',
|
|
240
|
+
resultWarningDesc: 'Something needs your attention.',
|
|
241
|
+
resultInfoTitle: 'Information',
|
|
242
|
+
resultInfoDesc: 'Here is something you should know.',
|
|
243
|
+
result404Title: 'Page not found',
|
|
244
|
+
result404Desc: 'The page you are looking for does not exist or has been moved.',
|
|
245
|
+
result403Title: 'Access denied',
|
|
246
|
+
result403Desc: 'You don\'t have permission to view this resource.',
|
|
247
|
+
result500Title: 'Server error',
|
|
248
|
+
result500Desc: 'The server could not process the request.',
|
|
249
|
+
|
|
250
|
+
// Chat bubble
|
|
251
|
+
chatTyping: 'Typing…',
|
|
252
|
+
chatRecordingAudio: 'Recording audio…',
|
|
253
|
+
|
|
254
|
+
// Drag & drop list ({pos}/{total} are replaced at runtime)
|
|
255
|
+
reorderHandle: 'Reorder',
|
|
256
|
+
reorderGrabbed: 'Item grabbed, position {pos} of {total}. Use the arrow keys to move it, Space to drop it, Escape to cancel.',
|
|
257
|
+
reorderMoved: 'Moved to position {pos} of {total}.',
|
|
258
|
+
reorderDropped: 'Item dropped at position {pos} of {total}.',
|
|
259
|
+
reorderCancelled: 'Reorder cancelled.',
|
|
260
|
+
|
|
261
|
+
// Transfer list (panes)
|
|
262
|
+
selectAll: 'Select all',
|
|
263
|
+
clearSearch: 'Clear search',
|
|
264
|
+
|
|
265
|
+
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
266
|
+
kanbanMoved: 'Moved to {column}, position {pos} of {total}.',
|
|
199
267
|
}
|
|
200
268
|
|
|
201
269
|
export const M3_LOCALE_KEY: InjectionKey<MaybeRef<Partial<M3Locale>>> = Symbol('m3-locale')
|
package/src/locales/de.ts
CHANGED
|
@@ -103,4 +103,38 @@ export const deLocale: M3Locale = {
|
|
|
103
103
|
// JSON viewer
|
|
104
104
|
jsonElements: 'Elemente',
|
|
105
105
|
jsonFields: 'Felder',
|
|
106
|
+
|
|
107
|
+
// Result
|
|
108
|
+
resultSuccessTitle: 'Erfolgreich',
|
|
109
|
+
resultSuccessDesc: 'Die Aktion wurde erfolgreich abgeschlossen.',
|
|
110
|
+
resultErrorTitle: 'Etwas ist schiefgelaufen',
|
|
111
|
+
resultErrorDesc: 'Ein unerwarteter Fehler ist aufgetreten. Bitte versuche es erneut.',
|
|
112
|
+
resultWarningTitle: 'Achtung',
|
|
113
|
+
resultWarningDesc: 'Etwas erfordert deine Aufmerksamkeit.',
|
|
114
|
+
resultInfoTitle: 'Information',
|
|
115
|
+
resultInfoDesc: 'Hier ist etwas, das du wissen solltest.',
|
|
116
|
+
result404Title: 'Seite nicht gefunden',
|
|
117
|
+
result404Desc: 'Die gesuchte Seite existiert nicht oder wurde verschoben.',
|
|
118
|
+
result403Title: 'Zugriff verweigert',
|
|
119
|
+
result403Desc: 'Du hast keine Berechtigung, diese Ressource anzuzeigen.',
|
|
120
|
+
result500Title: 'Serverfehler',
|
|
121
|
+
result500Desc: 'Der Server konnte die Anfrage nicht verarbeiten.',
|
|
122
|
+
|
|
123
|
+
// Chat bubble
|
|
124
|
+
chatTyping: 'Schreibt…',
|
|
125
|
+
chatRecordingAudio: 'Nimmt Audio auf…',
|
|
126
|
+
|
|
127
|
+
// Drag & drop list ({pos}/{total} are replaced at runtime)
|
|
128
|
+
reorderHandle: 'Neu anordnen',
|
|
129
|
+
reorderGrabbed: 'Element aufgenommen, Position {pos} von {total}. Mit den Pfeiltasten verschieben, mit Leertaste ablegen, mit Escape abbrechen.',
|
|
130
|
+
reorderMoved: 'Auf Position {pos} von {total} verschoben.',
|
|
131
|
+
reorderDropped: 'Element auf Position {pos} von {total} abgelegt.',
|
|
132
|
+
reorderCancelled: 'Neuanordnung abgebrochen.',
|
|
133
|
+
|
|
134
|
+
// Transfer list (panes)
|
|
135
|
+
selectAll: 'Alle auswählen',
|
|
136
|
+
clearSearch: 'Suche löschen',
|
|
137
|
+
|
|
138
|
+
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
|
+
kanbanMoved: 'Nach {column} verschoben, Position {pos} von {total}.',
|
|
106
140
|
}
|
package/src/locales/es.ts
CHANGED
|
@@ -103,4 +103,38 @@ export const esLocale: M3Locale = {
|
|
|
103
103
|
// JSON viewer
|
|
104
104
|
jsonElements: 'elementos',
|
|
105
105
|
jsonFields: 'campos',
|
|
106
|
+
|
|
107
|
+
// Result
|
|
108
|
+
resultSuccessTitle: 'Operación exitosa',
|
|
109
|
+
resultSuccessDesc: 'La acción se completó correctamente.',
|
|
110
|
+
resultErrorTitle: 'Algo salió mal',
|
|
111
|
+
resultErrorDesc: 'Ocurrió un error inesperado. Inténtalo de nuevo.',
|
|
112
|
+
resultWarningTitle: 'Atención',
|
|
113
|
+
resultWarningDesc: 'Hay algo que requiere tu atención.',
|
|
114
|
+
resultInfoTitle: 'Información',
|
|
115
|
+
resultInfoDesc: 'Hay algo que deberías saber.',
|
|
116
|
+
result404Title: 'Página no encontrada',
|
|
117
|
+
result404Desc: 'La página que buscas no existe o fue movida.',
|
|
118
|
+
result403Title: 'Acceso denegado',
|
|
119
|
+
result403Desc: 'No tienes permisos para ver este recurso.',
|
|
120
|
+
result500Title: 'Error del servidor',
|
|
121
|
+
result500Desc: 'El servidor no pudo procesar la solicitud.',
|
|
122
|
+
|
|
123
|
+
// Chat bubble
|
|
124
|
+
chatTyping: 'Escribiendo…',
|
|
125
|
+
chatRecordingAudio: 'Grabando audio…',
|
|
126
|
+
|
|
127
|
+
// Drag & drop list ({pos}/{total} are replaced at runtime)
|
|
128
|
+
reorderHandle: 'Reordenar',
|
|
129
|
+
reorderGrabbed: 'Elemento tomado, posición {pos} de {total}. Usa las flechas para moverlo, Espacio para soltarlo y Escape para cancelar.',
|
|
130
|
+
reorderMoved: 'Movido a la posición {pos} de {total}.',
|
|
131
|
+
reorderDropped: 'Elemento soltado en la posición {pos} de {total}.',
|
|
132
|
+
reorderCancelled: 'Reordenamiento cancelado.',
|
|
133
|
+
|
|
134
|
+
// Transfer list (panes)
|
|
135
|
+
selectAll: 'Seleccionar todo',
|
|
136
|
+
clearSearch: 'Borrar búsqueda',
|
|
137
|
+
|
|
138
|
+
// Kanban ({column}/{pos}/{total} are replaced at runtime)
|
|
139
|
+
kanbanMoved: 'Movido a {column}, posición {pos} de {total}.',
|
|
106
140
|
}
|