@m3ui-vue/m3ui-vue 1.4.1 → 1.4.3
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/dist/API.md +251 -9
- package/dist/{MButton-DQMTIlaV.js → MButton-D7M324r9.js} +2 -2
- package/dist/{MButton-DQMTIlaV.js.map → MButton-D7M324r9.js.map} +1 -1
- package/dist/{MDialog-cdgapGfZ.js → MDialog-DuOnNF9s.js} +2 -2
- package/dist/{MDialog-cdgapGfZ.js.map → MDialog-DuOnNF9s.js.map} +1 -1
- package/dist/{MListItem-ZkSGIIrb.js → MListItem-Bb84X6ex.js} +144 -120
- package/dist/{MListItem-ZkSGIIrb.js.map → MListItem-Bb84X6ex.js.map} +1 -1
- package/dist/{MLoadingIndicator-U6_oGx8z.js → MLoadingIndicator-BUGRo2Tu.js} +2 -2
- package/dist/{MLoadingIndicator-U6_oGx8z.js.map → MLoadingIndicator-BUGRo2Tu.js.map} +1 -1
- package/dist/{MSeekBar-DTZVizZg.js → MSeekBar-BQUvUqb9.js} +2 -2
- package/dist/{MSeekBar-DTZVizZg.js.map → MSeekBar-BQUvUqb9.js.map} +1 -1
- package/dist/{MSlider-CqJkEYRZ.js → MSlider-SFdjE1Hy.js} +2 -2
- package/dist/{MSlider-CqJkEYRZ.js.map → MSlider-SFdjE1Hy.js.map} +1 -1
- package/dist/{MSpinner-Btgc-0nb.js → MSpinner-DKGNN64_.js} +2 -2
- package/dist/{MSpinner-Btgc-0nb.js.map → MSpinner-DKGNN64_.js.map} +1 -1
- package/dist/{MTextField-B6M0gJEO.js → MTextField-Utsef6Kk.js} +2 -2
- package/dist/{MTextField-B6M0gJEO.js.map → MTextField-Utsef6Kk.js.map} +1 -1
- package/dist/{MTooltip-Dspji4XG.js → MTooltip-BhTFQ9Z2.js} +4 -4
- package/dist/{MTooltip-Dspji4XG.js.map → MTooltip-BhTFQ9Z2.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAvailabilityCalendar.vue.d.ts +1 -1
- package/dist/components/MCalendarHeatmap.vue.d.ts +120 -0
- package/dist/components/MDatePicker.vue.d.ts +5 -0
- package/dist/components/MDatePickerModal.vue.d.ts +5 -0
- package/dist/components/MDateRangePicker.vue.d.ts +5 -0
- package/dist/components/MDateRangePickerModal.vue.d.ts +5 -0
- package/dist/components/MLightbox.vue.d.ts +1 -1
- package/dist/components/MListItem.vue.d.ts +10 -6
- package/dist/components/MMeterGroup.vue.d.ts +98 -0
- package/dist/components/MPhoneInput.vue.d.ts +72 -0
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MTreeTable.vue.d.ts +1 -1
- package/dist/components/MTypewriter.vue.d.ts +57 -0
- package/dist/components/MVideoPlayer.vue.d.ts +1 -1
- package/dist/components/_MMonthYearButton.vue.d.ts +16 -0
- package/dist/components/_MYearGrid.vue.d.ts +19 -0
- package/dist/composables/_useCalendarMonth.d.ts +7 -0
- package/dist/composables/phoneNumber.d.ts +39 -0
- package/dist/composables/useLocale.d.ts +18 -0
- package/dist/data/phone-countries.d.ts +2 -0
- package/dist/draw.js +2 -2
- package/dist/flow.js +1 -1
- package/dist/gantt.js +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/locales/index.js +63 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +3662 -2028
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +5 -5
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/{useLocale-DLKJIRFi.js → useLocale-B8YKWg-H.js} +10 -1
- package/dist/useLocale-B8YKWg-H.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MCalendarHeatmap.test.ts +79 -0
- package/src/__tests__/MListItemNestedControl.test.ts +88 -0
- package/src/__tests__/MMeterGroup.test.ts +43 -0
- package/src/__tests__/MPhoneInput.test.ts +97 -0
- package/src/__tests__/MTabs.test.ts +100 -2
- package/src/__tests__/MTypewriter.test.ts +50 -0
- package/src/__tests__/calendarMonth.test.ts +104 -0
- package/src/__tests__/ssr.test.ts +4 -0
- package/src/components/MCalendarHeatmap.vue +349 -0
- package/src/components/MDatePicker.vue +74 -34
- package/src/components/MDatePickerModal.vue +79 -36
- package/src/components/MDateRangePicker.vue +73 -33
- package/src/components/MDateRangePickerModal.vue +75 -35
- package/src/components/MListItem.vue +54 -8
- package/src/components/MMeterGroup.vue +196 -0
- package/src/components/MPhoneInput.vue +480 -0
- package/src/components/MTabs.vue +33 -6
- package/src/components/MTypewriter.vue +195 -0
- package/src/components/_MMonthYearButton.vue +36 -0
- package/src/components/_MYearGrid.vue +106 -0
- package/src/composables/_useCalendarMonth.ts +32 -2
- package/src/composables/phoneNumber.ts +137 -0
- package/src/composables/useLocale.ts +27 -0
- package/src/data/phone-countries.ts +62 -0
- package/src/index.ts +8 -0
- package/src/locales/de.ts +9 -0
- package/src/locales/es.ts +9 -0
- package/src/locales/fr.ts +9 -0
- package/src/locales/ja.ts +9 -0
- package/src/locales/ko.ts +9 -0
- package/src/locales/pt.ts +9 -0
- package/src/locales/zh.ts +9 -0
- package/dist/useLocale-DLKJIRFi.js.map +0 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* MTypewriter — text that types itself out and, with several phrases, erases and types the next in a loop, behind a
|
|
4
|
+
* blinking caret. Only the end that differs is erased ("faster" → "prettier" keeps nothing, "build faster apps" →
|
|
5
|
+
* "build prettier apps" erases back to "build "). Works by grapheme, so emoji and accents count as one
|
|
6
|
+
* character. Starts when it scrolls into view; with reduced motion the phrases swap whole. Screen readers get every
|
|
7
|
+
* phrase once, not each keystroke.
|
|
8
|
+
*
|
|
9
|
+
* @slot cursor Replaces the caret
|
|
10
|
+
* @event typed Emitted with the phrase's index when a phrase is fully typed
|
|
11
|
+
* @event done Emitted when the last phrase is typed and `loop` is off
|
|
12
|
+
*/
|
|
13
|
+
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
/** A phrase, or phrases typed one after another */
|
|
18
|
+
text: string | string[]
|
|
19
|
+
/** Milliseconds per character typed */
|
|
20
|
+
typeSpeed?: number
|
|
21
|
+
/** Milliseconds per character erased */
|
|
22
|
+
deleteSpeed?: number
|
|
23
|
+
/** Milliseconds a typed phrase stays before it's erased */
|
|
24
|
+
pause?: number
|
|
25
|
+
/** Milliseconds before the first character */
|
|
26
|
+
startDelay?: number
|
|
27
|
+
/** Start over after the last phrase; off stops on it */
|
|
28
|
+
loop?: boolean
|
|
29
|
+
/** Erase only the end that differs from the next phrase */
|
|
30
|
+
smartBackspace?: boolean
|
|
31
|
+
/** Vary each keystroke's delay a little, like a person typing */
|
|
32
|
+
humanize?: boolean
|
|
33
|
+
/** Show the caret */
|
|
34
|
+
cursor?: boolean
|
|
35
|
+
/** Wait until it's on screen to start */
|
|
36
|
+
startOnVisible?: boolean
|
|
37
|
+
/** Element rendered */
|
|
38
|
+
tag?: string
|
|
39
|
+
}>(),
|
|
40
|
+
{
|
|
41
|
+
typeSpeed: 70,
|
|
42
|
+
deleteSpeed: 35,
|
|
43
|
+
pause: 1600,
|
|
44
|
+
startDelay: 300,
|
|
45
|
+
loop: true,
|
|
46
|
+
smartBackspace: true,
|
|
47
|
+
humanize: true,
|
|
48
|
+
cursor: true,
|
|
49
|
+
startOnVisible: true,
|
|
50
|
+
tag: 'span',
|
|
51
|
+
},
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits<{ typed: [index: number]; done: [] }>()
|
|
55
|
+
|
|
56
|
+
const phrases = computed(() => (Array.isArray(props.text) ? props.text : [props.text]))
|
|
57
|
+
|
|
58
|
+
// Graphemes: an emoji with a skin tone, a flag or a letter with its accent is one keystroke
|
|
59
|
+
const segmenter = typeof Intl !== 'undefined' && 'Segmenter' in Intl ? new Intl.Segmenter(undefined, { granularity: 'grapheme' }) : null
|
|
60
|
+
const split = (s: string) => (segmenter ? Array.from(segmenter.segment(s), (g) => g.segment) : Array.from(s))
|
|
61
|
+
|
|
62
|
+
const shown = ref<string[]>([])
|
|
63
|
+
const index = ref(0)
|
|
64
|
+
const reduced = typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
|
|
65
|
+
|
|
66
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
67
|
+
let running = false
|
|
68
|
+
|
|
69
|
+
const jitter = (ms: number) => (props.humanize ? ms * (0.6 + Math.random() * 0.8) : ms)
|
|
70
|
+
|
|
71
|
+
function commonPrefix(a: string[], b: string[]) {
|
|
72
|
+
let i = 0
|
|
73
|
+
while (i < a.length && i < b.length && a[i] === b[i]) i++
|
|
74
|
+
return i
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function schedule(fn: () => void, ms: number) {
|
|
78
|
+
clearTimeout(timer)
|
|
79
|
+
timer = setTimeout(fn, ms)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function typePhrase() {
|
|
83
|
+
const target = split(phrases.value[index.value] ?? '')
|
|
84
|
+
if (reduced) {
|
|
85
|
+
shown.value = target
|
|
86
|
+
return afterTyped()
|
|
87
|
+
}
|
|
88
|
+
if (shown.value.length < target.length) {
|
|
89
|
+
shown.value = target.slice(0, shown.value.length + 1)
|
|
90
|
+
schedule(typePhrase, jitter(props.typeSpeed))
|
|
91
|
+
} else afterTyped()
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function afterTyped() {
|
|
95
|
+
emit('typed', index.value)
|
|
96
|
+
const last = index.value === phrases.value.length - 1
|
|
97
|
+
if (last && !props.loop) {
|
|
98
|
+
emit('done')
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
// A single phrase has nothing to loop to: it stays typed
|
|
102
|
+
if (phrases.value.length === 1) return
|
|
103
|
+
schedule(erase, props.pause)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function erase() {
|
|
107
|
+
const nextIndex = (index.value + 1) % phrases.value.length
|
|
108
|
+
const next = split(phrases.value[nextIndex] ?? '')
|
|
109
|
+
const keep = props.smartBackspace ? commonPrefix(shown.value, next) : 0
|
|
110
|
+
if (reduced) {
|
|
111
|
+
shown.value = []
|
|
112
|
+
index.value = nextIndex
|
|
113
|
+
return typePhrase()
|
|
114
|
+
}
|
|
115
|
+
if (shown.value.length > keep) {
|
|
116
|
+
shown.value = shown.value.slice(0, -1)
|
|
117
|
+
schedule(erase, jitter(props.deleteSpeed))
|
|
118
|
+
} else {
|
|
119
|
+
index.value = nextIndex
|
|
120
|
+
schedule(typePhrase, props.typeSpeed * 3)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function start() {
|
|
125
|
+
if (running) return
|
|
126
|
+
running = true
|
|
127
|
+
schedule(typePhrase, props.startDelay)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function restart() {
|
|
131
|
+
clearTimeout(timer)
|
|
132
|
+
running = false
|
|
133
|
+
shown.value = []
|
|
134
|
+
index.value = 0
|
|
135
|
+
start()
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const el = ref<HTMLElement>()
|
|
139
|
+
let observer: IntersectionObserver | undefined
|
|
140
|
+
onMounted(() => {
|
|
141
|
+
if (props.startOnVisible && typeof IntersectionObserver !== 'undefined' && el.value) {
|
|
142
|
+
observer = new IntersectionObserver((entries) => {
|
|
143
|
+
if (entries.some((e) => e.isIntersecting)) {
|
|
144
|
+
observer?.disconnect()
|
|
145
|
+
start()
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
observer.observe(el.value)
|
|
149
|
+
} else start()
|
|
150
|
+
})
|
|
151
|
+
onBeforeUnmount(() => {
|
|
152
|
+
clearTimeout(timer)
|
|
153
|
+
observer?.disconnect()
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
watch(() => phrases.value.join('\u0000'), () => { if (running) restart() })
|
|
157
|
+
|
|
158
|
+
defineExpose({ restart })
|
|
159
|
+
|
|
160
|
+
const typed = computed(() => shown.value.join(''))
|
|
161
|
+
</script>
|
|
162
|
+
|
|
163
|
+
<template>
|
|
164
|
+
<component :is="tag" ref="el" class="m3-typewriter">
|
|
165
|
+
<span class="sr-only">{{ phrases.join(', ') }}</span>
|
|
166
|
+
<span aria-hidden="true">{{ typed }}</span>
|
|
167
|
+
<span v-if="cursor" aria-hidden="true" class="m3-typewriter-cursor" :class="!$slots.cursor && 'm3-typewriter-caret'"><slot name="cursor" /></span>
|
|
168
|
+
</component>
|
|
169
|
+
</template>
|
|
170
|
+
|
|
171
|
+
<style>
|
|
172
|
+
/* Like an M3 text field's caret: 2px wide, primary, blinking */
|
|
173
|
+
.m3-typewriter-cursor {
|
|
174
|
+
display: inline-block;
|
|
175
|
+
min-width: 2px;
|
|
176
|
+
height: 1em;
|
|
177
|
+
margin-left: 0.06em;
|
|
178
|
+
vertical-align: -0.12em;
|
|
179
|
+
animation: m3-typewriter-blink 1.06s steps(1) infinite;
|
|
180
|
+
}
|
|
181
|
+
.m3-typewriter-caret {
|
|
182
|
+
width: 2px;
|
|
183
|
+
background-color: var(--color-primary);
|
|
184
|
+
}
|
|
185
|
+
@keyframes m3-typewriter-blink {
|
|
186
|
+
50% {
|
|
187
|
+
opacity: 0;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
@media (prefers-reduced-motion: reduce) {
|
|
191
|
+
.m3-typewriter-cursor {
|
|
192
|
+
animation: none;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/*
|
|
3
|
+
* Internal (not exported from index.ts): the date pickers' month/year menu button, Compose's YearPickerMenuButton.
|
|
4
|
+
* A pill text button with the month's title and a drop-down arrow that turns over while the year grid is open.
|
|
5
|
+
*/
|
|
6
|
+
import { ref } from 'vue'
|
|
7
|
+
import MIcon from './MIcon.vue'
|
|
8
|
+
|
|
9
|
+
defineProps<{
|
|
10
|
+
/** The month's title ("May 1990") */
|
|
11
|
+
label: string
|
|
12
|
+
expanded: boolean
|
|
13
|
+
/** What the button does: switch to the years, or back to the days */
|
|
14
|
+
action: string
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
defineEmits<{ toggle: [] }>()
|
|
18
|
+
|
|
19
|
+
const el = ref<HTMLButtonElement>()
|
|
20
|
+
defineExpose({ focus: () => el.value?.focus() })
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<button
|
|
25
|
+
ref="el"
|
|
26
|
+
type="button"
|
|
27
|
+
class="flex h-10 cursor-pointer items-center gap-1 rounded-full pr-2 pl-3 text-title-small font-medium capitalize text-on-surface-variant outline-none transition-colors hover:bg-on-surface-variant/8 focus-visible:ring-2 focus-visible:ring-secondary active:bg-on-surface-variant/10"
|
|
28
|
+
:aria-label="`${label}, ${action}`"
|
|
29
|
+
:aria-expanded="expanded"
|
|
30
|
+
aria-live="polite"
|
|
31
|
+
@click="$emit('toggle')"
|
|
32
|
+
>
|
|
33
|
+
{{ label }}
|
|
34
|
+
<MIcon name="arrow_drop_down" :size="18" class="transition-transform duration-200" :class="expanded && 'rotate-180'" />
|
|
35
|
+
</button>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/*
|
|
3
|
+
* Internal (not exported from index.ts): the year grid of the four date pickers, Compose's YearPicker. Laid over
|
|
4
|
+
* the weekday row and the days (the parent wraps them in a `relative` box), as tall as them: 72x36dp pills, 3 per
|
|
5
|
+
* row, 16dp apart (DatePickerModalTokens SelectionYear*, YearsInRow, YearsVerticalPadding). The year on view is
|
|
6
|
+
* filled, the current one outlined, the ones min/max leave no day in disabled (OnSurfaceVariant at 38%).
|
|
7
|
+
*/
|
|
8
|
+
import { computed, nextTick, ref, watch } from 'vue'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
open: boolean
|
|
12
|
+
years: { year: number; disabled: boolean }[]
|
|
13
|
+
/** The year on view: the selected pill */
|
|
14
|
+
viewYear: number
|
|
15
|
+
locale: string
|
|
16
|
+
/** The radiogroup's accessible name */
|
|
17
|
+
label: string
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const emit = defineEmits<{ pick: [year: number] }>()
|
|
21
|
+
|
|
22
|
+
const el = ref<HTMLElement>()
|
|
23
|
+
const currentYear = new Date().getFullYear()
|
|
24
|
+
const yearFormat = computed(() => new Intl.NumberFormat(props.locale, { useGrouping: false }))
|
|
25
|
+
|
|
26
|
+
// The grid's Tab stop (and first focus): the year on view, else the first enabled one
|
|
27
|
+
const tabStop = computed(() => {
|
|
28
|
+
const on = props.years.find((y) => y.year === props.viewYear && !y.disabled)
|
|
29
|
+
return (on ?? props.years.find((y) => !y.disabled))?.year
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Opens on the year on view, in the middle of the grid, with the focus on it (Compose requests it too)
|
|
33
|
+
watch(() => props.open, async (open) => {
|
|
34
|
+
if (!open) return
|
|
35
|
+
await nextTick()
|
|
36
|
+
const btn = el.value?.querySelector<HTMLElement>('[tabindex="0"]')
|
|
37
|
+
if (!el.value || !btn) return
|
|
38
|
+
el.value.scrollTop = btn.offsetTop - (el.value.clientHeight - btn.offsetHeight) / 2
|
|
39
|
+
btn.focus({ preventScroll: true })
|
|
40
|
+
}, { immediate: true })
|
|
41
|
+
|
|
42
|
+
// Arrows move the focus across the enabled years (a row is 3), Home/End to the ends; Enter/Space pick
|
|
43
|
+
function onKey(e: KeyboardEvent) {
|
|
44
|
+
const buttons = Array.from(el.value?.querySelectorAll<HTMLElement>('button:not(:disabled)') ?? [])
|
|
45
|
+
const i = buttons.indexOf(document.activeElement as HTMLElement)
|
|
46
|
+
if (i < 0) return
|
|
47
|
+
const step: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -3, ArrowDown: 3, Home: -i, End: buttons.length - 1 - i }
|
|
48
|
+
if (!(e.key in step)) return
|
|
49
|
+
e.preventDefault()
|
|
50
|
+
buttons[Math.min(buttons.length - 1, Math.max(0, i + step[e.key]!))]?.focus()
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<Transition name="m3-date-years">
|
|
56
|
+
<div
|
|
57
|
+
v-if="open"
|
|
58
|
+
ref="el"
|
|
59
|
+
class="absolute inset-0 grid auto-rows-min grid-cols-3 justify-items-center gap-y-4 overflow-y-auto bg-surface-container-high py-2"
|
|
60
|
+
role="radiogroup"
|
|
61
|
+
:aria-label="label"
|
|
62
|
+
@keydown="onKey"
|
|
63
|
+
>
|
|
64
|
+
<button
|
|
65
|
+
v-for="{ year: y, disabled } in years"
|
|
66
|
+
:key="y"
|
|
67
|
+
type="button"
|
|
68
|
+
role="radio"
|
|
69
|
+
:aria-checked="y === viewYear"
|
|
70
|
+
:disabled="disabled"
|
|
71
|
+
:tabindex="y === tabStop ? 0 : -1"
|
|
72
|
+
class="flex h-9 w-[72px] items-center justify-center rounded-full text-body-large outline-none transition-colors focus-visible:ring-2 focus-visible:ring-secondary"
|
|
73
|
+
:class="
|
|
74
|
+
y === viewYear
|
|
75
|
+
? disabled ? 'bg-primary/38 text-on-primary' : 'cursor-pointer bg-primary text-on-primary'
|
|
76
|
+
: disabled
|
|
77
|
+
? 'cursor-not-allowed text-on-surface-variant/38' + (y === currentYear ? ' border border-primary/38' : '')
|
|
78
|
+
: y === currentYear
|
|
79
|
+
? 'cursor-pointer border border-primary text-primary hover:bg-primary/8'
|
|
80
|
+
: 'cursor-pointer text-on-surface-variant hover:bg-on-surface-variant/8'
|
|
81
|
+
"
|
|
82
|
+
@click="emit('pick', y)"
|
|
83
|
+
>
|
|
84
|
+
{{ yearFormat.format(y) }}
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
</Transition>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<style>
|
|
91
|
+
/* Compose: expandVertically + fadeIn from 0.6 (DefaultEffects) in, shrinkVertically + fadeOut (FastEffects) out */
|
|
92
|
+
.m3-date-years-enter-active {
|
|
93
|
+
transition: clip-path 200ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms cubic-bezier(0.2, 0, 0, 1);
|
|
94
|
+
}
|
|
95
|
+
.m3-date-years-leave-active {
|
|
96
|
+
transition: clip-path 150ms cubic-bezier(0.2, 0, 0, 1), opacity 150ms cubic-bezier(0.2, 0, 0, 1);
|
|
97
|
+
}
|
|
98
|
+
.m3-date-years-enter-from {
|
|
99
|
+
clip-path: inset(0 0 100% 0);
|
|
100
|
+
opacity: 0.6;
|
|
101
|
+
}
|
|
102
|
+
.m3-date-years-leave-to {
|
|
103
|
+
clip-path: inset(0 0 100% 0);
|
|
104
|
+
opacity: 0;
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -23,7 +23,13 @@ export function isoDate(y: number, m: number, d: number) {
|
|
|
23
23
|
|
|
24
24
|
export function useCalendarMonth(
|
|
25
25
|
viewDate: Ref<Date>,
|
|
26
|
-
opts: {
|
|
26
|
+
opts: {
|
|
27
|
+
locale: () => string
|
|
28
|
+
min: () => string | undefined
|
|
29
|
+
max: () => string | undefined
|
|
30
|
+
/** First and last year the year grid offers (DatePickerDefaults.YearRange: 1900–2100); min/max disable years in it */
|
|
31
|
+
yearRange?: () => [number, number] | undefined
|
|
32
|
+
},
|
|
27
33
|
) {
|
|
28
34
|
// Narrow weekday names, Monday first (1 Jan 2024 was a Monday)
|
|
29
35
|
const weekdays = computed(() => {
|
|
@@ -70,5 +76,29 @@ export function useCalendarMonth(
|
|
|
70
76
|
const prevMonth = () => shiftMonth(-1)
|
|
71
77
|
const nextMonth = () => shiftMonth(1)
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
// The year grid (Compose's YearPicker): every year of yearRange, the ones min/max leave no day in disabled
|
|
80
|
+
// (Compose's selectableDates.isSelectableYear)
|
|
81
|
+
const years = computed(() => {
|
|
82
|
+
const [from, to] = opts.yearRange?.() ?? [1900, 2100]
|
|
83
|
+
const min = opts.min()
|
|
84
|
+
const max = opts.max()
|
|
85
|
+
const minYear = min ? Number(min.slice(0, 4)) : -Infinity
|
|
86
|
+
const maxYear = max ? Number(max.slice(0, 4)) : Infinity
|
|
87
|
+
const out: { year: number; disabled: boolean }[] = []
|
|
88
|
+
for (let year = from; year <= to; year++) out.push({ year, disabled: year < minYear || year > maxYear })
|
|
89
|
+
return out
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
// Shows a year keeping the month on view, as Compose's year grid does; brought inside min/max when that month
|
|
93
|
+
// falls outside them (min 15 June 2020 and March on view: June 2020)
|
|
94
|
+
function showYear(year: number) {
|
|
95
|
+
let month = viewDate.value.getMonth()
|
|
96
|
+
const min = opts.min()
|
|
97
|
+
const max = opts.max()
|
|
98
|
+
if (min && isoDate(year, month + 1, 0) < min && Number(min.slice(0, 4)) === year) month = Number(min.slice(5, 7)) - 1
|
|
99
|
+
if (max && isoDate(year, month, 1) > max && Number(max.slice(0, 4)) === year) month = Number(max.slice(5, 7)) - 1
|
|
100
|
+
viewDate.value = new Date(year, month, 1)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return { weekdays, monthLabel, days, isOutOfRange, isToday, prevMonth, nextMonth, years, showYear }
|
|
74
104
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { PHONE_COUNTRIES } from '../data/phone-countries'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Phone numbers for MPhoneInput, also exported to show a stored number elsewhere. Not libphonenumber: masks for the
|
|
5
|
+
* countries most used and E.164 rules (a calling code, then at most 15 digits in all) for the rest. A number is
|
|
6
|
+
* "valid" when its length fits one of its country's masks, or any 4 to 14 national digits for a country without
|
|
7
|
+
* masks.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface PhoneCountry {
|
|
11
|
+
/** ISO 3166-1 alpha-2 */
|
|
12
|
+
iso2: string
|
|
13
|
+
/** Calling code, without the + */
|
|
14
|
+
dial: string
|
|
15
|
+
/** National number masks, `#` a digit */
|
|
16
|
+
masks: readonly string[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ParsedPhone {
|
|
20
|
+
country: PhoneCountry
|
|
21
|
+
/** National significant number: digits only, no trunk 0 */
|
|
22
|
+
national: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const BY_ISO = new Map<string, PhoneCountry>()
|
|
26
|
+
const BY_DIAL = new Map<string, PhoneCountry[]>()
|
|
27
|
+
for (const [iso2, dial, masks] of PHONE_COUNTRIES) {
|
|
28
|
+
const c: PhoneCountry = { iso2, dial, masks: masks ?? [] }
|
|
29
|
+
BY_ISO.set(iso2, c)
|
|
30
|
+
BY_DIAL.set(dial, [...(BY_DIAL.get(dial) ?? []), c])
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Every country, in the data's order */
|
|
34
|
+
export function phoneCountries(): PhoneCountry[] {
|
|
35
|
+
return [...BY_ISO.values()]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function phoneCountry(iso2: string): PhoneCountry | undefined {
|
|
39
|
+
return BY_ISO.get(iso2.toUpperCase())
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Italy (and the Vatican, San Marino) keep the leading 0 of landlines in international numbers
|
|
43
|
+
const KEEPS_ZERO = new Set(['IT', 'VA', 'SM'])
|
|
44
|
+
|
|
45
|
+
/** Digits of a national number as typed: no formatting, no trunk 0 */
|
|
46
|
+
export function nationalDigits(input: string, country: PhoneCountry): string {
|
|
47
|
+
let d = input.replace(/\D/g, '')
|
|
48
|
+
if (!KEEPS_ZERO.has(country.iso2)) d = d.replace(/^0+/, '')
|
|
49
|
+
return d.slice(0, 15 - country.dial.length)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Splits an international number (`+541123456789`, `00 54 11...`, `+54 9 11 2345-6789`) into its country and
|
|
54
|
+
* national digits. Where a calling code is shared (+1), `prefer` wins if it has it, else the first listed (US).
|
|
55
|
+
*/
|
|
56
|
+
export function parsePhone(value: string, prefer?: string): ParsedPhone | null {
|
|
57
|
+
let d = value.trim()
|
|
58
|
+
if (d.startsWith('00')) d = '+' + d.slice(2)
|
|
59
|
+
if (!d.startsWith('+')) return null
|
|
60
|
+
d = d.replace(/\D/g, '')
|
|
61
|
+
for (let len = 4; len >= 1; len--) {
|
|
62
|
+
const list = BY_DIAL.get(d.slice(0, len))
|
|
63
|
+
if (!list) continue
|
|
64
|
+
const country = list.find((c) => c.iso2 === prefer?.toUpperCase()) ?? list[0]!
|
|
65
|
+
return { country, national: nationalDigits(d.slice(len), country) }
|
|
66
|
+
}
|
|
67
|
+
return null
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// A mask may start with literal digits the number must start with (Argentina's mobiles: "9 ## ####-####")
|
|
71
|
+
const leadOf = (mask: string) => mask.match(/^\d+/)?.[0] ?? ''
|
|
72
|
+
const slots = (mask: string) => mask.split('#').length - 1
|
|
73
|
+
const sizeOf = (mask: string) => leadOf(mask).length + slots(mask)
|
|
74
|
+
|
|
75
|
+
function applyMask(mask: string, digits: string) {
|
|
76
|
+
const lead = leadOf(mask)
|
|
77
|
+
let out = lead
|
|
78
|
+
let i = lead.length
|
|
79
|
+
for (const ch of mask.slice(lead.length)) {
|
|
80
|
+
if (i >= digits.length) break
|
|
81
|
+
out += ch === '#' ? digits[i++] : ch
|
|
82
|
+
}
|
|
83
|
+
return out.trimEnd()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* National digits formatted with the country's masks: the one whose leading digits match (Argentina's 9 for
|
|
88
|
+
* mobiles), else the shortest that holds them. Digits past every mask are appended; countries without masks get
|
|
89
|
+
* groups of three with the last four together.
|
|
90
|
+
*/
|
|
91
|
+
export function formatNational(national: string, country: PhoneCountry): string {
|
|
92
|
+
if (!national) return ''
|
|
93
|
+
const matches = (m: string) => {
|
|
94
|
+
const lead = leadOf(m)
|
|
95
|
+
return national.startsWith(lead) || lead.startsWith(national)
|
|
96
|
+
}
|
|
97
|
+
const masks = [...country.masks].filter(matches).sort((a, b) => leadOf(b).length - leadOf(a).length || sizeOf(a) - sizeOf(b))
|
|
98
|
+
const mask = masks.find((m) => sizeOf(m) >= national.length)
|
|
99
|
+
if (mask) return applyMask(mask, national)
|
|
100
|
+
const longest = masks.sort((a, b) => sizeOf(b) - sizeOf(a))[0]
|
|
101
|
+
if (longest) return applyMask(longest, national) + ' ' + national.slice(sizeOf(longest))
|
|
102
|
+
if (national.length <= 4) return national
|
|
103
|
+
// Groups of three, a lone digit left over joining the group before it (3012 → "3012", not "301 2")
|
|
104
|
+
const groups = national.slice(0, -4).match(/.{1,3}/g) ?? []
|
|
105
|
+
if (groups.length > 1 && groups[groups.length - 1]!.length === 1) groups[groups.length - 2] += groups.pop()!
|
|
106
|
+
return [...groups, national.slice(-4)].join(' ')
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Whether national digits are a plausible full number for the country */
|
|
110
|
+
export function isValidNational(national: string, country: PhoneCountry): boolean {
|
|
111
|
+
if (!national) return false
|
|
112
|
+
if (country.masks.length) return country.masks.some((m) => sizeOf(m) === national.length && national.startsWith(leadOf(m)))
|
|
113
|
+
return national.length >= 4 && national.length + country.dial.length <= 15
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** E.164 (`+541123456789`) from a country and national digits; null when there are none */
|
|
117
|
+
export function toE164(national: string, country: PhoneCountry): string | null {
|
|
118
|
+
return national ? `+${country.dial}${national}` : null
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** A stored E.164 number for display: `+54 11 2345-6789`; the input back when it isn't one */
|
|
122
|
+
export function formatPhone(e164: string, prefer?: string): string {
|
|
123
|
+
const p = parsePhone(e164, prefer)
|
|
124
|
+
if (!p) return e164
|
|
125
|
+
return `+${p.country.dial} ${formatNational(p.national, p.country)}`
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Whether an E.164 number is a plausible full number for its country */
|
|
129
|
+
export function isValidPhone(e164: string, prefer?: string): boolean {
|
|
130
|
+
const p = parsePhone(e164, prefer)
|
|
131
|
+
return !!p && isValidNational(p.national, p.country)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The flag emoji of an ISO 3166-1 alpha-2 code (regional indicator letters) */
|
|
135
|
+
export function flagEmoji(iso2: string): string {
|
|
136
|
+
return String.fromCodePoint(...[...iso2.toUpperCase()].map((c) => 0x1f1e6 + c.charCodeAt(0) - 65))
|
|
137
|
+
}
|
|
@@ -45,6 +45,24 @@ export interface M3Locale {
|
|
|
45
45
|
ok: string
|
|
46
46
|
dateToggleInput: string
|
|
47
47
|
dateToggleCalendar: string
|
|
48
|
+
/** The date pickers' month/year button: opens the year grid */
|
|
49
|
+
dateSwitchToYear: string
|
|
50
|
+
/** The same button while the year grid is open: back to the days */
|
|
51
|
+
dateSwitchToDay: string
|
|
52
|
+
/** Calendar heatmap legend, low end */
|
|
53
|
+
heatmapLess: string
|
|
54
|
+
/** Calendar heatmap legend, high end */
|
|
55
|
+
heatmapMore: string
|
|
56
|
+
/** Meter group: what's left of max */
|
|
57
|
+
meterRemaining: string
|
|
58
|
+
/** Meter group header; {used} and {max} are replaced */
|
|
59
|
+
meterUsedOf: string
|
|
60
|
+
/** Phone input: the country selector */
|
|
61
|
+
phoneCountry: string
|
|
62
|
+
/** Phone input: the country search field */
|
|
63
|
+
phoneSearchCountry: string
|
|
64
|
+
/** Phone input: the number doesn't fit its country's length */
|
|
65
|
+
phoneInvalid: string
|
|
48
66
|
dateInputLabel: string
|
|
49
67
|
selectTime: string
|
|
50
68
|
timeHourSelection: string
|
|
@@ -637,6 +655,15 @@ export const defaultLocale: M3Locale = {
|
|
|
637
655
|
ok: 'OK',
|
|
638
656
|
dateToggleInput: 'Switch to text input',
|
|
639
657
|
dateToggleCalendar: 'Switch to calendar',
|
|
658
|
+
dateSwitchToYear: 'Switch to selecting a year',
|
|
659
|
+
dateSwitchToDay: 'Switch to selecting a day',
|
|
660
|
+
heatmapLess: 'Less',
|
|
661
|
+
heatmapMore: 'More',
|
|
662
|
+
meterRemaining: 'Remaining',
|
|
663
|
+
meterUsedOf: '{used} of {max}',
|
|
664
|
+
phoneCountry: 'Country',
|
|
665
|
+
phoneSearchCountry: 'Search country',
|
|
666
|
+
phoneInvalid: 'Incomplete phone number',
|
|
640
667
|
dateInputLabel: 'Date',
|
|
641
668
|
selectTime: 'Select time',
|
|
642
669
|
timeHourSelection: 'Select hour',
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Countries for MPhoneInput: ISO 3166-1 alpha-2 code, ITU calling code and, for the countries most used, national
|
|
3
|
+
* number masks (`#` a digit; several when lengths vary, e.g. Argentina's landlines and mobiles with the 9).
|
|
4
|
+
* Names aren't stored: they come from Intl.DisplayNames in the app's language. Where several countries share a
|
|
5
|
+
* calling code (+1, +7, +44, +61...), the first listed is the one a pasted number lands on.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type PhoneCountryData = readonly [iso2: string, dial: string, masks?: readonly string[]]
|
|
9
|
+
|
|
10
|
+
export const PHONE_COUNTRIES: readonly PhoneCountryData[] = [
|
|
11
|
+
['US', '1', ['(###) ###-####']],
|
|
12
|
+
['CA', '1', ['(###) ###-####']],
|
|
13
|
+
['AG', '1'], ['AI', '1'], ['AS', '1'], ['BB', '1'], ['BM', '1'], ['BS', '1'], ['DM', '1'],
|
|
14
|
+
['DO', '1', ['(###) ###-####']], ['GD', '1'], ['GU', '1'], ['JM', '1'], ['KN', '1'], ['KY', '1'], ['LC', '1'],
|
|
15
|
+
['MP', '1'], ['MS', '1'], ['PR', '1', ['(###) ###-####']], ['SX', '1'], ['TC', '1'], ['TT', '1'], ['VC', '1'],
|
|
16
|
+
['VG', '1'], ['VI', '1'],
|
|
17
|
+
['RU', '7', ['### ###-##-##']],
|
|
18
|
+
['KZ', '7', ['### ###-##-##']],
|
|
19
|
+
['EG', '20'], ['ZA', '27', ['## ### ####']], ['GR', '30', ['### ### ####']], ['NL', '31', ['# ########']],
|
|
20
|
+
['BE', '32', ['### ## ## ##']], ['FR', '33', ['# ## ## ## ##']], ['ES', '34', ['### ## ## ##']], ['HU', '36'],
|
|
21
|
+
['IT', '39'], ['VA', '39'], ['RO', '40', ['### ### ###']], ['CH', '41', ['## ### ## ##']], ['AT', '43'],
|
|
22
|
+
['GB', '44', ['#### ######']], ['GG', '44'], ['IM', '44'], ['JE', '44'],
|
|
23
|
+
['DK', '45', ['## ## ## ##']], ['SE', '46'], ['NO', '47', ['### ## ###']], ['SJ', '47'], ['PL', '48', ['### ### ###']],
|
|
24
|
+
['DE', '49'],
|
|
25
|
+
['PE', '51', ['### ### ###']], ['MX', '52', ['## #### ####']], ['CU', '53', ['# ### ####']],
|
|
26
|
+
['AR', '54', ['## ####-####', '9 ## ####-####']], ['BR', '55', ['(##) ####-####', '(##) #####-####']],
|
|
27
|
+
['CL', '56', ['# #### ####']], ['CO', '57', ['### ### ####']], ['VE', '58', ['### ### ####']],
|
|
28
|
+
['MY', '60'], ['AU', '61', ['### ### ###']], ['CC', '61'], ['CX', '61'], ['ID', '62'], ['PH', '63', ['### ### ####']],
|
|
29
|
+
['NZ', '64'], ['SG', '65', ['#### ####']], ['TH', '66'],
|
|
30
|
+
['JP', '81', ['#-####-####', '##-####-####']], ['KR', '82', ['##-####-####']], ['VN', '84'], ['CN', '86', ['### #### ####']],
|
|
31
|
+
['TR', '90', ['### ### ## ##']], ['IN', '91', ['##### #####']], ['PK', '92'], ['AF', '93'], ['LK', '94'],
|
|
32
|
+
['MM', '95'], ['IR', '98'],
|
|
33
|
+
['SS', '211'], ['MA', '212'], ['EH', '212'], ['DZ', '213'], ['TN', '216'], ['LY', '218'], ['GM', '220'],
|
|
34
|
+
['SN', '221'], ['MR', '222'], ['ML', '223'], ['GN', '224'], ['CI', '225'], ['BF', '226'], ['NE', '227'],
|
|
35
|
+
['TG', '228'], ['BJ', '229'], ['MU', '230'], ['LR', '231'], ['SL', '232'], ['GH', '233'], ['NG', '234'],
|
|
36
|
+
['TD', '235'], ['CF', '236'], ['CM', '237'], ['CV', '238'], ['ST', '239'], ['GQ', '240'], ['GA', '241'],
|
|
37
|
+
['CG', '242'], ['CD', '243'], ['AO', '244'], ['GW', '245'], ['IO', '246'], ['SC', '248'], ['SD', '249'],
|
|
38
|
+
['RW', '250'], ['ET', '251'], ['SO', '252'], ['DJ', '253'], ['KE', '254'], ['TZ', '255'], ['UG', '256'],
|
|
39
|
+
['BI', '257'], ['MZ', '258'], ['ZM', '260'], ['MG', '261'], ['RE', '262'], ['YT', '262'], ['ZW', '263'],
|
|
40
|
+
['NA', '264'], ['MW', '265'], ['LS', '266'], ['BW', '267'], ['SZ', '268'], ['KM', '269'], ['SH', '290'],
|
|
41
|
+
['ER', '291'], ['AW', '297'], ['FO', '298'], ['GL', '299'],
|
|
42
|
+
['GI', '350'], ['PT', '351', ['### ### ###']], ['LU', '352'], ['IE', '353', ['## ### ####']], ['IS', '354'],
|
|
43
|
+
['AL', '355'], ['MT', '356'], ['CY', '357'], ['FI', '358'], ['AX', '358'], ['BG', '359'], ['LT', '370'],
|
|
44
|
+
['LV', '371'], ['EE', '372'], ['MD', '373'], ['AM', '374'], ['BY', '375'], ['AD', '376'], ['MC', '377'],
|
|
45
|
+
['SM', '378'], ['UA', '380', ['## ### ## ##']], ['RS', '381'], ['ME', '382'], ['XK', '383'], ['HR', '385'],
|
|
46
|
+
['SI', '386'], ['BA', '387'], ['MK', '389'], ['CZ', '420', ['### ### ###']], ['SK', '421', ['### ### ###']],
|
|
47
|
+
['LI', '423'],
|
|
48
|
+
['FK', '500'], ['BZ', '501'], ['GT', '502', ['#### ####']], ['SV', '503', ['#### ####']], ['HN', '504', ['####-####']],
|
|
49
|
+
['NI', '505', ['#### ####']], ['CR', '506', ['#### ####']], ['PA', '507', ['####-####']], ['PM', '508'],
|
|
50
|
+
['HT', '509'], ['GP', '590'], ['BL', '590'], ['MF', '590'], ['BO', '591', ['# ### ####']], ['GY', '592'],
|
|
51
|
+
['EC', '593', ['## ### ####']], ['GF', '594'], ['PY', '595', ['### ### ###']], ['MQ', '596'], ['SR', '597'],
|
|
52
|
+
['UY', '598', ['## ### ###']], ['CW', '599'], ['BQ', '599'],
|
|
53
|
+
['TL', '670'], ['NF', '672'], ['BN', '673'], ['NR', '674'], ['PG', '675'], ['TO', '676'], ['SB', '677'],
|
|
54
|
+
['VU', '678'], ['FJ', '679'], ['PW', '680'], ['WF', '681'], ['CK', '682'], ['NU', '683'], ['WS', '685'],
|
|
55
|
+
['KI', '686'], ['NC', '687'], ['TV', '688'], ['PF', '689'], ['TK', '690'], ['FM', '691'], ['MH', '692'],
|
|
56
|
+
['KP', '850'], ['HK', '852', ['#### ####']], ['MO', '853'], ['KH', '855'], ['LA', '856'], ['BD', '880'],
|
|
57
|
+
['TW', '886'],
|
|
58
|
+
['MV', '960'], ['LB', '961'], ['JO', '962'], ['SY', '963'], ['IQ', '964'], ['KW', '965'], ['SA', '966', ['## ### ####']],
|
|
59
|
+
['YE', '967'], ['OM', '968'], ['PS', '970'], ['AE', '971', ['## ### ####']], ['IL', '972', ['##-###-####']],
|
|
60
|
+
['BH', '973'], ['QA', '974'], ['BT', '975'], ['MN', '976'], ['NP', '977'], ['TJ', '992'], ['TM', '993'],
|
|
61
|
+
['AZ', '994'], ['GE', '995'], ['KG', '996'], ['UZ', '998'],
|
|
62
|
+
]
|
package/src/index.ts
CHANGED
|
@@ -75,6 +75,11 @@ export { default as MAlert } from './components/MAlert.vue'
|
|
|
75
75
|
export { default as MAnimatedNumber } from './components/MAnimatedNumber.vue'
|
|
76
76
|
export { default as MCountdown } from './components/MCountdown.vue'
|
|
77
77
|
export type { CountdownUnit, CountdownParts } from './components/MCountdown.vue'
|
|
78
|
+
export { default as MCalendarHeatmap } from './components/MCalendarHeatmap.vue'
|
|
79
|
+
export type { HeatmapDay, HeatmapCell } from './components/MCalendarHeatmap.vue'
|
|
80
|
+
export { default as MMeterGroup } from './components/MMeterGroup.vue'
|
|
81
|
+
export type { MeterItem } from './components/MMeterGroup.vue'
|
|
82
|
+
export { default as MTypewriter } from './components/MTypewriter.vue'
|
|
78
83
|
export { default as MAutocomplete } from './components/MAutocomplete.vue'
|
|
79
84
|
export { default as MAppBar } from './components/MAppBar.vue'
|
|
80
85
|
export { default as MAppBarWithSearch } from './components/MAppBarWithSearch.vue'
|
|
@@ -191,6 +196,9 @@ export { default as MBeforeAfter } from './components/MBeforeAfter.vue'
|
|
|
191
196
|
export { default as MCreditCardInput } from './components/MCreditCardInput.vue'
|
|
192
197
|
export type { CreditCardValue, CreditCardField } from './components/MCreditCardInput.vue'
|
|
193
198
|
export { detectCardBrand, luhnCheck, formatCardNumber, isValidCardNumber, isValidExpiry } from './composables/cardBrand'
|
|
199
|
+
export { default as MPhoneInput } from './components/MPhoneInput.vue'
|
|
200
|
+
export { formatPhone, isValidPhone, parsePhone, phoneCountries, flagEmoji } from './composables/phoneNumber'
|
|
201
|
+
export type { PhoneCountry, ParsedPhone } from './composables/phoneNumber'
|
|
194
202
|
export type { CardBrand, CardBrandInfo } from './composables/cardBrand'
|
|
195
203
|
export { default as MPosKeypad } from './components/MPosKeypad.vue'
|
|
196
204
|
export { default as MOrderTicket } from './components/MOrderTicket.vue'
|
package/src/locales/de.ts
CHANGED
|
@@ -42,6 +42,15 @@ export const deLocale: M3Locale = {
|
|
|
42
42
|
ok: 'OK',
|
|
43
43
|
dateToggleInput: 'Zur Texteingabe wechseln',
|
|
44
44
|
dateToggleCalendar: 'Zum Kalender wechseln',
|
|
45
|
+
dateSwitchToYear: 'Zur Jahresauswahl wechseln',
|
|
46
|
+
dateSwitchToDay: 'Zur Tagesauswahl wechseln',
|
|
47
|
+
heatmapLess: 'Weniger',
|
|
48
|
+
heatmapMore: 'Mehr',
|
|
49
|
+
meterRemaining: 'Verfügbar',
|
|
50
|
+
meterUsedOf: '{used} von {max}',
|
|
51
|
+
phoneCountry: 'Land',
|
|
52
|
+
phoneSearchCountry: 'Land suchen',
|
|
53
|
+
phoneInvalid: 'Unvollständige Telefonnummer',
|
|
45
54
|
dateInputLabel: 'Datum',
|
|
46
55
|
selectTime: 'Uhrzeit auswählen',
|
|
47
56
|
timeHourSelection: 'Stunde auswählen',
|