@saasmakers/ui 1.4.44 → 1.4.45

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
 
@@ -200,7 +205,7 @@ defineExpose({ focus })
200
205
  :min="min"
201
206
  :placeholder="placeholder"
202
207
  spellcheck="false"
203
- :type="type"
208
+ :type="type === 'password' && showPassword ? 'text' : type"
204
209
  :value="modelValue"
205
210
  @blur="onFieldBlur"
206
211
  @focus="onFieldFocus"
@@ -216,6 +221,20 @@ defineExpose({ focus })
216
221
  />
217
222
 
218
223
  <slot name="inputRight" />
224
+
225
+ <button
226
+ v-if="type === 'password'"
227
+ class="ml-2 text-gray-500 flex-initial dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"
228
+ :disabled="disabled"
229
+ tabindex="-1"
230
+ type="button"
231
+ @click="onTogglePasswordVisibility"
232
+ >
233
+ <BaseIcon
234
+ :icon="showPassword ? 'solar:eye-closed-linear' : 'solar:eye-linear'"
235
+ size="sm"
236
+ />
237
+ </button>
219
238
  </div>
220
239
 
221
240
  <FieldMessage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "1.4.44",
3
+ "version": "1.4.45",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",