srcdev-nuxt-forms 2.1.45 → 2.1.47
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/assets/styles/forms/themes/_input-action.css +9 -9
- package/assets/styles/forms/variables/_sizes.css +5 -5
- package/components/forms/input-checkbox-radio/InputCheckboxRadioCore.vue +1 -0
- package/components/forms/input-number/InputNumberCore.vue +25 -5
- package/components/forms/input-number/variants/InputNumberDefault.vue +3 -1
- package/components/forms/input-text/InputTextCore.vue +23 -2
- package/components/forms/input-text/variants/InputPasswordWithLabel.vue +41 -4
- package/components/forms/input-text/variants/InputTextAsNumberWithLabel.vue +1 -3
- package/composables/useZodValidation.ts +8 -5
- package/package.json +1 -1
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
--theme-btn-outline: transparent;
|
|
6
6
|
--theme-btn-text: var(--theme-form-input-text);
|
|
7
7
|
|
|
8
|
-
--theme-btn-bg-hover:
|
|
9
|
-
--theme-btn-border-hover:
|
|
10
|
-
--theme-btn-outline-hover:
|
|
11
|
-
--theme-btn-text-hover: var(--
|
|
8
|
+
--theme-btn-bg-hover: var(--blue-8);
|
|
9
|
+
--theme-btn-border-hover: var(--blue-8);
|
|
10
|
+
--theme-btn-outline-hover: var(--blue-8);
|
|
11
|
+
--theme-btn-text-hover: var(--gray-00);
|
|
12
12
|
|
|
13
|
-
--theme-btn-bg-focus:
|
|
14
|
-
--theme-btn-border-focus:
|
|
15
|
-
--theme-btn-outline-focus:
|
|
16
|
-
--theme-btn-text-focus:
|
|
13
|
+
--theme-btn-bg-focus: var(--blue-8);
|
|
14
|
+
--theme-btn-border-focus: var(--blue-8);
|
|
15
|
+
--theme-btn-outline-focus: var(--blue-8);
|
|
16
|
+
--theme-btn-text-focus: var(--gray-00);
|
|
17
17
|
|
|
18
|
-
--theme-form-focus-box-shadow:
|
|
18
|
+
--theme-form-focus-box-shadow: transparent;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
--form-text-padding-inline: calc(var(--step-0) * 0.25);
|
|
14
14
|
--form-button-icon-gap: calc(var(--step-0) * 0.65);
|
|
15
15
|
--form-input-border-radius: 0.4rem;
|
|
16
|
-
--form-icon-only-button-size: calc(var(--step-1) * 2);
|
|
16
|
+
--form-icon-only-button-size: calc(var(--step-1) * 2 + 1px);
|
|
17
17
|
--form-toggle-symbol-size: calc(var(--step-0) * 1.55);
|
|
18
18
|
--form-toggle-switch-width-adjustment: 0.5rem;
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
--form-text-padding-inline: calc(var(--step-1) * 0.25);
|
|
29
29
|
--form-button-icon-gap: calc(var(--step-0) * 0.65);
|
|
30
30
|
--form-input-border-radius: 0.4rem;
|
|
31
|
-
--form-icon-only-button-size: calc(var(--step-1) * 2.25);
|
|
31
|
+
--form-icon-only-button-size: calc(var(--step-1) * 2.25 + 1px);
|
|
32
32
|
--form-toggle-symbol-size: calc(var(--step-1) * 1.635);
|
|
33
33
|
--form-toggle-switch-width-adjustment: 0.3rem;
|
|
34
34
|
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
--form-text-padding-inline: calc(var(--step-2) * 0.25);
|
|
44
44
|
--form-button-icon-gap: calc(var(--step-0) * 0.65);
|
|
45
45
|
--form-input-border-radius: 0.4rem;
|
|
46
|
-
--form-icon-only-button-size: calc(var(--step-1) * 2.5);
|
|
46
|
+
--form-icon-only-button-size: calc(var(--step-1) * 2.5 + 1px);
|
|
47
47
|
--form-toggle-symbol-size: calc(var(--step-2) * 1.72);
|
|
48
48
|
--form-toggle-switch-width-adjustment: 0.2rem;
|
|
49
49
|
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
--form-text-padding-inline: calc(var(--step-3) * 0.25);
|
|
59
59
|
--form-button-icon-gap: calc(var(--step-0) * 0.65);
|
|
60
60
|
--form-input-border-radius: 0.4rem;
|
|
61
|
-
--form-icon-only-button-size: calc(var(--step-1) * 2.75);
|
|
61
|
+
--form-icon-only-button-size: calc(var(--step-1) * 2.75 + 1px);
|
|
62
62
|
--form-toggle-symbol-size: calc(var(--step-3) * 1.78);
|
|
63
63
|
--form-toggle-switch-width-adjustment: 0rem;
|
|
64
64
|
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
--form-text-padding-inline: calc(var(--step-4) * 0.25);
|
|
74
74
|
--form-button-icon-gap: calc(var(--step-0) * 0.75);
|
|
75
75
|
--form-input-border-radius: 0.4rem;
|
|
76
|
-
--form-icon-only-button-size: calc(var(--step-1) * 3);
|
|
76
|
+
--form-icon-only-button-size: calc(var(--step-1) * 3 + 1px);
|
|
77
77
|
--form-toggle-symbol-size: calc(var(--step-4) * 1.816);
|
|
78
78
|
--form-toggle-switch-width-adjustment: -0.2rem;
|
|
79
79
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="input-number-wrapper" :data-form-theme="formTheme" :data-size="size"
|
|
2
|
+
<div class="input-number-wrapper" :data-form-theme="formTheme" :data-size="size">
|
|
3
3
|
<div v-if="hasLeftContent" class="slot left">
|
|
4
4
|
<slot name="left"></slot>
|
|
5
5
|
</div>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:min
|
|
14
14
|
:max
|
|
15
15
|
:step
|
|
16
|
-
:class="['input-number-core', `input-number--${theme}`, `input-number--${size}`, `input-number--${weight}`]"
|
|
16
|
+
:class="[elementClasses, 'input-number-core', `input-number--${theme}`, `input-number--${size}`, `input-number--${weight}`]"
|
|
17
17
|
v-model="modelValue"
|
|
18
18
|
ref="inputField"
|
|
19
19
|
inputmode="numeric"
|
|
@@ -102,9 +102,7 @@ const modelValue = defineModel<number | readonly number[]>();
|
|
|
102
102
|
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
103
103
|
const minLength = computed(() => `${max.toString().length + 3}ch`);
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
updateElementClasses(['number-1']);
|
|
107
|
-
});
|
|
105
|
+
// updateElementClasses(['number-1']);
|
|
108
106
|
</script>
|
|
109
107
|
|
|
110
108
|
<style lang="css">
|
|
@@ -175,6 +173,28 @@ onMounted(() => {
|
|
|
175
173
|
font-weight: 400;
|
|
176
174
|
}
|
|
177
175
|
}
|
|
176
|
+
|
|
177
|
+
&:has(.has-left-button),
|
|
178
|
+
&:has(.has-right-button) {
|
|
179
|
+
.slot {
|
|
180
|
+
.input-button-core {
|
|
181
|
+
border: initial;
|
|
182
|
+
border-radius: 0;
|
|
183
|
+
outline: initial;
|
|
184
|
+
box-shadow: unset;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.left-slot {
|
|
189
|
+
margin-inline-end: 0;
|
|
190
|
+
border-right: 2px solid var(--theme-btn-bg-hover);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.right-slot {
|
|
194
|
+
margin-inline-end: 0;
|
|
195
|
+
border-left: 2px solid var(--theme-btn-bg-hover);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
178
198
|
}
|
|
179
199
|
|
|
180
200
|
input[type='number']::-webkit-inner-spin-button,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<slot name="description"></slot>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
|
-
<InputNumberCore v-model="modelValue" :id :name :min :max :step :theme :required :size :weight :fieldHasError>
|
|
8
|
+
<InputNumberCore v-model="modelValue" :id :name :min :max :step :theme :required :size :weight :fieldHasError :styleClassPassthrough>
|
|
9
9
|
<template v-if="hasLeftContent" #left>
|
|
10
10
|
<InputButtonCore
|
|
11
11
|
type="button"
|
|
@@ -129,6 +129,8 @@ const updateValue = (step: number, withinRangeLimit: boolean) => {
|
|
|
129
129
|
modelValue.value = (Number(modelValue.value) + step) as number;
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
+
|
|
133
|
+
updateElementClasses(['has-left-button', 'has-right-button']);
|
|
132
134
|
</script>
|
|
133
135
|
|
|
134
136
|
<style lang="css">
|
|
@@ -145,7 +145,6 @@ const validateInput = () => {
|
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
onMounted(() => {
|
|
148
|
-
updateElementClasses(['deep-bristol', 'deep-london', 'deep-bath']);
|
|
149
148
|
if (inputmode === 'numeric') validateInput();
|
|
150
149
|
});
|
|
151
150
|
</script>
|
|
@@ -240,9 +239,31 @@ onMounted(() => {
|
|
|
240
239
|
/*
|
|
241
240
|
&:focus-visible {
|
|
242
241
|
--_focus-box-shadow: var(--box-shadow-on);
|
|
243
|
-
|
|
242
|
+
:has(:has( }
|
|
244
243
|
*/
|
|
245
244
|
}
|
|
245
|
+
|
|
246
|
+
&:has(.has-left-button),
|
|
247
|
+
&:has(.has-right-button) {
|
|
248
|
+
.slot {
|
|
249
|
+
.input-button-core {
|
|
250
|
+
border: initial;
|
|
251
|
+
border-radius: 0;
|
|
252
|
+
outline: initial;
|
|
253
|
+
box-shadow: unset;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.left-slot {
|
|
258
|
+
margin-inline-end: 0;
|
|
259
|
+
border-right: 2px solid var(--theme-btn-bg-hover);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.right-slot {
|
|
263
|
+
margin-inline-end: 0;
|
|
264
|
+
border-left: 2px solid var(--theme-btn-bg-hover);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
246
267
|
}
|
|
247
268
|
|
|
248
269
|
input:autofill,
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
@click.stop.prevent="toggleDisplayPassword"
|
|
7
7
|
:is-pending="false"
|
|
8
8
|
:buttonText
|
|
9
|
-
|
|
10
|
-
size
|
|
9
|
+
theme="input-action"
|
|
10
|
+
:size
|
|
11
11
|
@focusin="updateFocus(name, true)"
|
|
12
12
|
@focusout="updateFocus(name, false)"
|
|
13
13
|
>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<script setup lang="ts">
|
|
24
24
|
import propValidators from '../../c12/prop-validators';
|
|
25
25
|
|
|
26
|
-
const { type, maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme } = defineProps({
|
|
26
|
+
const { type, maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme, size } = defineProps({
|
|
27
27
|
type: {
|
|
28
28
|
type: String,
|
|
29
29
|
default: 'password',
|
|
@@ -71,6 +71,13 @@ const { type, maxlength, id, name, placeholder, label, errorMessage, fieldHasErr
|
|
|
71
71
|
return propValidators.theme.includes(value);
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
+
size: {
|
|
75
|
+
type: String as PropType<string>,
|
|
76
|
+
default: 'medium',
|
|
77
|
+
validator(value: string) {
|
|
78
|
+
return propValidators.size.includes(value);
|
|
79
|
+
},
|
|
80
|
+
},
|
|
74
81
|
});
|
|
75
82
|
|
|
76
83
|
const formTheme = computed(() => {
|
|
@@ -79,6 +86,8 @@ const formTheme = computed(() => {
|
|
|
79
86
|
|
|
80
87
|
const modelValue = defineModel();
|
|
81
88
|
|
|
89
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
90
|
+
|
|
82
91
|
const updateFocus = (name: string, isFocused: boolean) => {
|
|
83
92
|
// console.log('updateFocus', name, isFocused);
|
|
84
93
|
// modelValue.value.focusedField = isFocused ? name : '';
|
|
@@ -94,6 +103,34 @@ const buttonText = computed(() => {
|
|
|
94
103
|
const toggleDisplayPassword = () => {
|
|
95
104
|
displayPassword.value = !displayPassword.value;
|
|
96
105
|
};
|
|
106
|
+
|
|
107
|
+
updateElementClasses(['has-right-button']);
|
|
97
108
|
</script>
|
|
98
109
|
|
|
99
|
-
<style lang="css"
|
|
110
|
+
<style lang="css">
|
|
111
|
+
/* .input-text-with-label {
|
|
112
|
+
&.has-left-button,
|
|
113
|
+
&.has-right-button {
|
|
114
|
+
.input-text-wrapper {
|
|
115
|
+
.slot {
|
|
116
|
+
.input-button-core {
|
|
117
|
+
border: initial;
|
|
118
|
+
border-radius: 0;
|
|
119
|
+
outline: initial;
|
|
120
|
+
box-shadow: unset;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.left-slot {
|
|
125
|
+
margin-inline-end: 0;
|
|
126
|
+
border-right: 2px solid var(--theme-btn-bg-hover);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.right-slot {
|
|
130
|
+
margin-inline-end: 0;
|
|
131
|
+
border-left: 2px solid var(--theme-btn-bg-hover);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
} */
|
|
136
|
+
</style>
|
|
@@ -155,9 +155,7 @@ const updateValue = (step: number, withinRangeLimit: boolean) => {
|
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
updateElementClasses(['input-text-as-number']);
|
|
160
|
-
});
|
|
158
|
+
updateElementClasses(['input-text-as-number', 'has-left-button', 'has-right-button']);
|
|
161
159
|
</script>
|
|
162
160
|
|
|
163
161
|
<style lang="css">
|
|
@@ -112,11 +112,14 @@ const useZodValidation = (formSchema: any, formRef: Ref<HTMLFormElement | null>)
|
|
|
112
112
|
const scrollToFirstError = async () => {
|
|
113
113
|
if (formRef.value) {
|
|
114
114
|
const firstErrorElement = formRef.value.querySelector('[aria-invalid=true]');
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
|
|
116
|
+
if (firstErrorElement) {
|
|
117
|
+
window.scrollTo({
|
|
118
|
+
top: firstErrorElement?.getBoundingClientRect().y + window.scrollY,
|
|
119
|
+
left: 0,
|
|
120
|
+
behavior: 'smooth',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
120
123
|
}
|
|
121
124
|
};
|
|
122
125
|
|
package/package.json
CHANGED