@citizenplane/pimp 10.1.11 → 10.2.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/dist/pimp.es.js +1312 -1304
- package/dist/pimp.umd.js +10 -10
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CpInput.vue +18 -8
- package/src/components/CpTelInput.vue +1 -0
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
>
|
|
17
17
|
<div v-if="hasBeforeIcon" class="cpInput__icon cpInput__icon--isBefore">
|
|
18
18
|
<cp-icon v-if="isSearch" type="search" />
|
|
19
|
+
<cp-icon v-else-if="isEmail" type="mail" />
|
|
19
20
|
<slot v-else name="leading-icon" />
|
|
20
21
|
</div>
|
|
21
22
|
<input
|
|
@@ -62,6 +63,8 @@ interface Emits {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
interface Props {
|
|
66
|
+
autocomplete?: string
|
|
67
|
+
disabled?: boolean
|
|
65
68
|
errorMessage?: string
|
|
66
69
|
help?: string
|
|
67
70
|
inputId?: string | null
|
|
@@ -70,23 +73,26 @@ interface Props {
|
|
|
70
73
|
label?: string
|
|
71
74
|
mask?: string | Record<string, unknown> | null
|
|
72
75
|
modelValue?: string | number | boolean
|
|
76
|
+
placeholder?: string
|
|
73
77
|
removeBorder?: boolean
|
|
78
|
+
required?: boolean
|
|
74
79
|
size?: Sizes
|
|
75
80
|
tooltip?: string
|
|
81
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url'
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
const props = withDefaults(defineProps<Props>(), {
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
autocomplete: '',
|
|
86
|
+
errorMessage: '',
|
|
81
87
|
label: '',
|
|
88
|
+
help: '',
|
|
82
89
|
inputId: null,
|
|
83
|
-
isInvalid: false,
|
|
84
|
-
errorMessage: '',
|
|
85
90
|
mask: null,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
help: '',
|
|
91
|
+
modelValue: '',
|
|
92
|
+
placeholder: '',
|
|
89
93
|
size: Sizes.MD,
|
|
94
|
+
tooltip: '',
|
|
95
|
+
type: 'text',
|
|
90
96
|
})
|
|
91
97
|
|
|
92
98
|
const emit = defineEmits<Emits>()
|
|
@@ -125,6 +131,8 @@ const cpInputContainer = ref<HTMLDivElement | null>(null)
|
|
|
125
131
|
const isDisabled = computed(() => checkAttribute('disabled'))
|
|
126
132
|
const isRequired = computed(() => checkAttribute('required'))
|
|
127
133
|
|
|
134
|
+
const isEmail = computed(() => props.type === 'email')
|
|
135
|
+
|
|
128
136
|
const dynamicClasses = computed(() => {
|
|
129
137
|
return [
|
|
130
138
|
attrs.class,
|
|
@@ -141,7 +149,7 @@ const dynamicClasses = computed(() => {
|
|
|
141
149
|
const isInputInvalid = computed(() => props.isInvalid || !isDOMElementValid.value)
|
|
142
150
|
|
|
143
151
|
const hasBeforeIconSlot = computed(() => !!slots['leading-icon'])
|
|
144
|
-
const hasBeforeIcon = computed(() => hasBeforeIconSlot.value || props.isSearch)
|
|
152
|
+
const hasBeforeIcon = computed(() => hasBeforeIconSlot.value || props.isSearch || isEmail.value)
|
|
145
153
|
|
|
146
154
|
const hasAfterIconSlot = computed(() => !!slots['trailing-icon'])
|
|
147
155
|
const hasAfterIcon = computed(() => hasAfterIconSlot.value || props.isSearch)
|
|
@@ -288,8 +296,10 @@ onMounted(async () => {
|
|
|
288
296
|
width: var(--cp-dimensions-4);
|
|
289
297
|
height: var(--cp-dimensions-4);
|
|
290
298
|
|
|
299
|
+
color: var(--cp-foreground-secondary);
|
|
291
300
|
display: flex;
|
|
292
301
|
align-items: center;
|
|
302
|
+
flex-shrink: 0;
|
|
293
303
|
left: var(--cp-dimensions-3_5);
|
|
294
304
|
z-index: 1;
|
|
295
305
|
position: absolute;
|