@imaginario27/air-ui-ds 1.0.8 → 1.0.10

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.
@@ -56,7 +56,7 @@
56
56
  <!-- Input -->
57
57
  <input
58
58
  :id
59
- :type
59
+ :type="props.type === 'password' ? passwordInputType : props.type"
60
60
  :placeholder
61
61
  :value="modelValue"
62
62
  :maxlength="maxLength"
@@ -93,7 +93,7 @@
93
93
  v-if="suffixIcon"
94
94
  type="button"
95
95
  :class="[
96
- 'text-icon-neutral-subtler',
96
+ 'text-icon-default',
97
97
  'hover:text-icon-neutral-subtle',
98
98
  'focus:outline-none',
99
99
  'transition-colors',
@@ -108,6 +108,26 @@
108
108
  />
109
109
  </button>
110
110
 
111
+ <!-- Show / Hide password -->
112
+ <button
113
+ v-if="!suffixIcon && type === 'password' && hasShowPasswordButton"
114
+ type="button"
115
+ :class="[
116
+ 'text-icon-default',
117
+ 'hover:text-icon-neutral-subtle',
118
+ 'focus:outline-none',
119
+ 'transition-colors',
120
+ 'cursor-pointer',
121
+ ]"
122
+ @click="() => showPassword = !showPassword"
123
+ >
124
+ <MdiIcon
125
+ :icon="showPassword ? 'mdiEyeOffOutline' : 'mdiEyeOutline'"
126
+ size="20"
127
+ preserveAspectRatio="xMidYMid meet"
128
+ />
129
+ </button>
130
+
111
131
  <!-- Error Icon -->
112
132
  <span
113
133
  v-if="hasError && !suffixIcon"
@@ -154,7 +174,7 @@ const props = defineProps({
154
174
  icon: String as PropType<any>,
155
175
  suffixIcon: String as PropType<any>,
156
176
  linkText: String as PropType<string>,
157
- linkUrl: String as PropType<string>,
177
+ linkUrl: String as PropType<string>,
158
178
  size: {
159
179
  type: String as PropType<InputSize>,
160
180
  default: InputSize.MD,
@@ -184,6 +204,10 @@ const props = defineProps({
184
204
  type: Boolean as PropType<boolean>,
185
205
  default: false,
186
206
  },
207
+ hasShowPasswordButton: {
208
+ type: Boolean as PropType<boolean>,
209
+ default: true,
210
+ },
187
211
  min: String as PropType<string>,
188
212
  max: String as PropType<string>,
189
213
  step: String as PropType<string>,
@@ -193,7 +217,7 @@ const props = defineProps({
193
217
  default: false,
194
218
  },
195
219
  autocomplete: {
196
- type: String as PropType<'on' | 'off'>,
220
+ type: String as PropType<string>,
197
221
  default: 'off',
198
222
  },
199
223
  autofocus: {
@@ -215,6 +239,7 @@ const emit = defineEmits(['update:modelValue', 'update:error', 'click:suffix'])
215
239
 
216
240
  // States
217
241
  const isFocused = ref(false)
242
+ const showPassword = ref(false)
218
243
 
219
244
  // Composables
220
245
  const validationMode = useInjectedValidationMode()
@@ -231,6 +256,11 @@ const filled = computed(() => {
231
256
  return false
232
257
  })
233
258
 
259
+ const passwordInputType = computed(() => {
260
+ if (props.type !== 'password') return props.type
261
+ return showPassword.value ? 'text' : 'password'
262
+ })
263
+
234
264
  // Computed classes
235
265
  const inputSizeClass = computed(() => {
236
266
  const sizeVariant = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imaginario27/air-ui-ds",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "author": "imaginario27",
5
5
  "type": "module",
6
6
  "homepage": "https://air-ui.netlify.app/",