@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
- <input
173
- :id="id"
174
- ref="input"
175
- :autocomplete="autocomplete ? 'on' : 'off'"
176
- class="h-full w-full flex-1 appearance-none items-center rounded-lg outline-none placeholder-gray-600 dark:placeholder-gray-400"
177
- :class="{
178
- 'field-disabled': disabled,
179
- 'focus:placeholder-gray-900 hover:placeholder-gray-900 dark:focus:placeholder-gray-100 dark:hover:placeholder-gray-100': !disabled,
180
- 'text-gray-900 dark:text-gray-100': !lineThrough,
181
- 'text-gray-500 dark:text-gray-500 line-through': lineThrough,
182
- 'font-medium tracking-tight uppercase': uppercase,
183
- 'font-normal': !uppercase,
184
- 'text-center': alignment === 'center',
185
- 'text-left': alignment === 'left',
186
- 'text-right': alignment === 'right',
187
- 'bg-gray-100 dark:bg-gray-900': background === 'gray',
188
- 'bg-white dark:bg-gray-900': background === 'white',
189
- 'border shadow-sm border-gray-200 dark:border-gray-800 px-3': border === 'full',
190
- 'hover:border-gray-300 focus:border-gray-400 dark:hover:border-gray-700 dark:focus:border-gray-600': border === 'full' && !disabled,
191
- 'border-b border-gray-200 dark:border-gray-800 px-10': border === 'bottom',
192
- 'border-0 p-0': border === 'none',
193
- 'text-xs': size === 'xs',
194
- 'text-sm': size === 'sm',
195
- 'text-base': size === 'base',
196
- 'text-lg': size === 'lg',
197
- }"
198
- :disabled="disabled"
199
- :max="max"
200
- :min="min"
201
- :placeholder="placeholder"
202
- spellcheck="false"
203
- :type="type"
204
- :value="modelValue"
205
- @blur="onFieldBlur"
206
- @focus="onFieldFocus"
207
- @input="onFieldInput"
208
- @keydown="onFieldKeyDown"
209
- @keyup="onFieldKeyUp"
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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "1.4.44",
3
+ "version": "1.4.46",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",