@citizenplane/pimp 9.7.4 → 9.7.5
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/pimp.es.js +326 -323
- package/dist/pimp.umd.js +15 -15
- package/package.json +1 -1
- package/src/components/CpTelInput.vue +15 -0
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
@close="focusOnInput"
|
|
19
19
|
@country-changed="handleCountryChanged"
|
|
20
20
|
@open="handleDropdownOpen"
|
|
21
|
+
@validate="handleOnValidate"
|
|
21
22
|
>
|
|
22
23
|
<template #arrow-icon>
|
|
23
24
|
<cp-icon class="cpTelInput__arrow" size="20" type="chevron-down" />
|
|
@@ -76,8 +77,18 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
76
77
|
|
|
77
78
|
const emit = defineEmits<Emits>()
|
|
78
79
|
|
|
80
|
+
type PhoneObject = {
|
|
81
|
+
country: string
|
|
82
|
+
countryCode: string
|
|
83
|
+
formatted: string
|
|
84
|
+
nationalNumber: string
|
|
85
|
+
possible: boolean
|
|
86
|
+
valid: boolean
|
|
87
|
+
}
|
|
88
|
+
|
|
79
89
|
interface Emits {
|
|
80
90
|
(e: 'countryChanged', countryCode: string): void
|
|
91
|
+
(e: 'validate', phoneObject: PhoneObject): void
|
|
81
92
|
}
|
|
82
93
|
|
|
83
94
|
const inputModel = defineModel<string>()
|
|
@@ -139,6 +150,10 @@ const handleDropdownOpen = async () => {
|
|
|
139
150
|
const handleCountryChanged = (country: { iso2: string }) => {
|
|
140
151
|
emit('countryChanged', country?.iso2 || '')
|
|
141
152
|
}
|
|
153
|
+
|
|
154
|
+
const handleOnValidate = (phoneObject: PhoneObject) => {
|
|
155
|
+
emit('validate', phoneObject)
|
|
156
|
+
}
|
|
142
157
|
</script>
|
|
143
158
|
|
|
144
159
|
<style lang="scss">
|