@saasmakers/ui 1.4.44 → 1.4.46
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.
|
@@ -45,6 +45,7 @@ defineSlots<{
|
|
|
45
45
|
const id = useId()
|
|
46
46
|
const modelValue = defineModel<FieldInput['modelValue']>({ default: '' })
|
|
47
47
|
const input = ref<HTMLInputElement>()
|
|
48
|
+
const showPassword = ref(false)
|
|
48
49
|
const { isDesktopBrowser } = useDevice()
|
|
49
50
|
|
|
50
51
|
onMounted(() => {
|
|
@@ -133,6 +134,10 @@ function onFieldKeyUp(event: KeyboardEvent) {
|
|
|
133
134
|
emit('keyup', event, value)
|
|
134
135
|
}
|
|
135
136
|
|
|
137
|
+
function onTogglePasswordVisibility() {
|
|
138
|
+
showPassword.value = !showPassword.value
|
|
139
|
+
}
|
|
140
|
+
|
|
136
141
|
defineExpose({ focus })
|
|
137
142
|
</script>
|
|
138
143
|
|
|
@@ -169,45 +174,66 @@ defineExpose({ focus })
|
|
|
169
174
|
>
|
|
170
175
|
<slot name="inputLeft" />
|
|
171
176
|
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
177
|
+
<div class="relative h-full min-w-0 flex-1">
|
|
178
|
+
<input
|
|
179
|
+
:id="id"
|
|
180
|
+
ref="input"
|
|
181
|
+
:autocomplete="autocomplete ? 'on' : 'off'"
|
|
182
|
+
class="h-full w-full appearance-none items-center rounded-lg outline-none placeholder-gray-600 dark:placeholder-gray-400"
|
|
183
|
+
:class="{
|
|
184
|
+
'field-disabled': disabled,
|
|
185
|
+
'focus:placeholder-gray-900 hover:placeholder-gray-900 dark:focus:placeholder-gray-100 dark:hover:placeholder-gray-100': !disabled,
|
|
186
|
+
'text-gray-900 dark:text-gray-100': !lineThrough,
|
|
187
|
+
'text-gray-500 dark:text-gray-500 line-through': lineThrough,
|
|
188
|
+
'font-medium tracking-tight uppercase': uppercase,
|
|
189
|
+
'font-normal': !uppercase,
|
|
190
|
+
'text-center': alignment === 'center',
|
|
191
|
+
'text-left': alignment === 'left',
|
|
192
|
+
'text-right': alignment === 'right',
|
|
193
|
+
'bg-gray-100 dark:bg-gray-900': background === 'gray',
|
|
194
|
+
'bg-white dark:bg-gray-900': background === 'white',
|
|
195
|
+
'border shadow-sm border-gray-200 dark:border-gray-800': border === 'full',
|
|
196
|
+
'pl-3 pr-10': border === 'full' && type === 'password',
|
|
197
|
+
'px-3': border === 'full' && type !== 'password',
|
|
198
|
+
'hover:border-gray-300 focus:border-gray-400 dark:hover:border-gray-700 dark:focus:border-gray-600': border === 'full' && !disabled,
|
|
199
|
+
'border-b border-gray-200 dark:border-gray-800': border === 'bottom',
|
|
200
|
+
'pl-10 pr-16': border === 'bottom' && type === 'password',
|
|
201
|
+
'px-10': border === 'bottom' && type !== 'password',
|
|
202
|
+
'border-0 p-0': border === 'none' && type !== 'password',
|
|
203
|
+
'border-0 pr-9': border === 'none' && type === 'password',
|
|
204
|
+
'text-xs': size === 'xs',
|
|
205
|
+
'text-sm': size === 'sm',
|
|
206
|
+
'text-base': size === 'base',
|
|
207
|
+
'text-lg': size === 'lg',
|
|
208
|
+
}"
|
|
209
|
+
:disabled="disabled"
|
|
210
|
+
:max="max"
|
|
211
|
+
:min="min"
|
|
212
|
+
:placeholder="placeholder"
|
|
213
|
+
spellcheck="false"
|
|
214
|
+
:type="type === 'password' && showPassword ? 'text' : type"
|
|
215
|
+
:value="modelValue"
|
|
216
|
+
@blur="onFieldBlur"
|
|
217
|
+
@focus="onFieldFocus"
|
|
218
|
+
@input="onFieldInput"
|
|
219
|
+
@keydown="onFieldKeyDown"
|
|
220
|
+
@keyup="onFieldKeyUp"
|
|
221
|
+
>
|
|
222
|
+
|
|
223
|
+
<button
|
|
224
|
+
v-if="type === 'password'"
|
|
225
|
+
class="absolute inset-y-0 right-0 flex items-center pr-3 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"
|
|
226
|
+
:disabled="disabled"
|
|
227
|
+
tabindex="-1"
|
|
228
|
+
type="button"
|
|
229
|
+
@click="onTogglePasswordVisibility"
|
|
230
|
+
>
|
|
231
|
+
<BaseIcon
|
|
232
|
+
:icon="showPassword ? 'solar:eye-closed-linear' : 'solar:eye-linear'"
|
|
233
|
+
size="sm"
|
|
234
|
+
/>
|
|
235
|
+
</button>
|
|
236
|
+
</div>
|
|
211
237
|
|
|
212
238
|
<BaseSpinner
|
|
213
239
|
v-if="loading"
|