srcdev-nuxt-forms 2.4.17 → 2.4.18
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/components/forms/input-text/InputTextCore.vue +2 -3
- package/components/forms/input-text/variants/InputTextWithLabel.vue +2 -2
- package/components/forms/input-textarea/InputTextareaCore.vue +85 -23
- package/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +161 -4
- package/package.json +1 -1
|
@@ -173,7 +173,6 @@ onMounted(() => {
|
|
|
173
173
|
|
|
174
174
|
&.underlined {
|
|
175
175
|
--_input-text-core-color: var(--theme-form-input-text-color-underlined);
|
|
176
|
-
/* --_input-text-wrapper-background-color: var(--theme-form-input-bg-underlined); */
|
|
177
176
|
--_input-text-wrapper-background-color: transparent;
|
|
178
177
|
--_input-text-wrapper-padding-block: 0.5rem;
|
|
179
178
|
}
|
|
@@ -324,9 +323,9 @@ input:-webkit-autofill-strong-password-viewable,
|
|
|
324
323
|
input:-webkit-autofill-and-obscured {
|
|
325
324
|
background-color: var(--theme-form-input-bg-normal) !important;
|
|
326
325
|
background-image: none !important;
|
|
327
|
-
color: var(--
|
|
326
|
+
color: var(--_input-text-core-color) !important;
|
|
328
327
|
-webkit-box-shadow: 0 0 0rem 1000px var(--theme-form-input-bg-normal) inset;
|
|
329
|
-
-webkit-text-fill-color: var(--
|
|
328
|
+
-webkit-text-fill-color: var(--_input-text-core-color);
|
|
330
329
|
transition: background-color 5000s ease-in-out 0s;
|
|
331
330
|
}
|
|
332
331
|
</style>
|
|
@@ -180,8 +180,7 @@ watch(
|
|
|
180
180
|
&.underlined {
|
|
181
181
|
--_label-text-color: var(--theme-form-input-text-label-color-underlined);
|
|
182
182
|
--_label-offset: 1rem 0;
|
|
183
|
-
|
|
184
|
-
--_input-text-with-label-background-color: rgba(255, 255, 255, 0.1);
|
|
183
|
+
--_input-text-with-label-background-color: color-mix(in srgb, currentColor 5%, transparent);
|
|
185
184
|
|
|
186
185
|
--_input-text-wrapper-underlined-border-radius-top-left: 0;
|
|
187
186
|
--_input-text-wrapper-underlined-border-radius-top-right: 0;
|
|
@@ -286,6 +285,7 @@ watch(
|
|
|
286
285
|
line-height: var(--_label-text-line-height);
|
|
287
286
|
translate: var(--_label-offset);
|
|
288
287
|
width: fit-content;
|
|
288
|
+
height: fit-content;
|
|
289
289
|
transition: font-size 0.2s ease-in-out, translate 0.2s ease-in-out;
|
|
290
290
|
|
|
291
291
|
&:not(.normal) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
class="input-textarea-wrapper"
|
|
4
4
|
:data-form-theme="formTheme"
|
|
5
5
|
:data-size="size"
|
|
6
|
-
:class="[{ dirty: isDirty }, { active: isActive }, { error: fieldHasError }, { 'has-left-slot': hasLeftSlot }, { 'has-right-slot': hasRightSlot }]"
|
|
6
|
+
:class="[inputVariant, { dirty: isDirty }, { active: isActive }, { error: fieldHasError }, { 'has-left-slot': hasLeftSlot }, { 'has-right-slot': hasRightSlot }]"
|
|
7
7
|
>
|
|
8
8
|
<span v-if="hasLeftSlot" class="slot left-slot">
|
|
9
9
|
<slot name="left"></slot>
|
|
@@ -75,6 +75,13 @@ const props = defineProps({
|
|
|
75
75
|
return propValidators.size.includes(value);
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
|
+
inputVariant: {
|
|
79
|
+
type: String as PropType<string>,
|
|
80
|
+
default: 'normal',
|
|
81
|
+
validator(value: string) {
|
|
82
|
+
return propValidators.inputVariant.includes(value);
|
|
83
|
+
},
|
|
84
|
+
},
|
|
78
85
|
});
|
|
79
86
|
|
|
80
87
|
const slots = useSlots();
|
|
@@ -100,36 +107,91 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
100
107
|
|
|
101
108
|
<style lang="css">
|
|
102
109
|
.input-textarea-wrapper {
|
|
103
|
-
--
|
|
104
|
-
--
|
|
105
|
-
--_outline-width: var(--form-element-border-width);
|
|
110
|
+
--_focus-box-shadow: var(--box-shadow-off);
|
|
111
|
+
--_input-textarea-core-color: var(--theme-form-input-text-color-normal);
|
|
106
112
|
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
--_input-textarea-wrapper-background-color: var(--theme-form-input-bg-normal);
|
|
114
|
+
|
|
115
|
+
--_input-textarea-wrapper-border: var(--form-element-border-width) solid var(--theme-form-input-border);
|
|
116
|
+
--_input-textarea-wrapper-border-radius: var(--form-input-border-radius);
|
|
109
117
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
118
|
+
--_input-textarea-wrapper-outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
|
|
119
|
+
--_input-textarea-wrapper-opacity: 1;
|
|
120
|
+
--_input-textarea-wrapper-box-shadow: var(--_focus-box-shadow);
|
|
121
|
+
--_input-textarea-wrapper-margin-inline: 0;
|
|
122
|
+
--_input-textarea-wrapper-padding-block: 0;
|
|
113
123
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
&.underlined {
|
|
125
|
+
--_input-textarea-core-color: var(--theme-form-input-text-color-underlined);
|
|
126
|
+
--_input-textarea-wrapper-background-color: transparent;
|
|
127
|
+
--_input-textarea-wrapper-padding-block: 0.5rem;
|
|
118
128
|
}
|
|
119
129
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
&.outlined {
|
|
131
|
+
--_input-textarea-wrapper-margin-inline: 1px;
|
|
132
|
+
--_input-textarea-wrapper-background-color: var(--theme-form-input-bg-outlined);
|
|
133
|
+
}
|
|
123
134
|
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
&.normal {
|
|
136
|
+
&:focus-within {
|
|
137
|
+
--_input-textarea-wrapper-box-shadow: var(--box-shadow-on);
|
|
138
|
+
--_input-textarea-wrapper-outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
|
|
126
139
|
}
|
|
127
140
|
}
|
|
128
141
|
|
|
142
|
+
&:not(.normal) {
|
|
143
|
+
--_input-textarea-wrapper-border: none;
|
|
144
|
+
--_input-textarea-wrapper-box-shadow: none;
|
|
145
|
+
--_input-textarea-wrapper-outline: none;
|
|
146
|
+
--_input-textarea-wrapper-opacity: 0;
|
|
147
|
+
|
|
148
|
+
&:focus {
|
|
149
|
+
--_input-textarea-wrapper-border: none;
|
|
150
|
+
--_input-textarea-wrapper-box-shadow: none;
|
|
151
|
+
--_input-textarea-wrapper-outline: none;
|
|
152
|
+
--_input-textarea-wrapper-background-color: transparent;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&:focus-within {
|
|
156
|
+
--_input-textarea-wrapper-border: none;
|
|
157
|
+
--_input-textarea-wrapper-box-shadow: none;
|
|
158
|
+
--_input-textarea-wrapper-outline: none;
|
|
159
|
+
--_input-textarea-wrapper-background-color: transparent;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&.active,
|
|
163
|
+
&.dirty {
|
|
164
|
+
--_input-textarea-wrapper-border: none;
|
|
165
|
+
--_input-textarea-wrapper-box-shadow: none;
|
|
166
|
+
--_input-textarea-wrapper-outline: none;
|
|
167
|
+
--_input-textarea-wrapper-background-color: transparent;
|
|
168
|
+
|
|
169
|
+
--_input-textarea-wrapper-opacity: 1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
|
|
176
|
+
background-color: var(--_input-textarea-wrapper-background-color);
|
|
177
|
+
border-radius: var(--_input-textarea-wrapper-border-radius);
|
|
178
|
+
border: var(--_input-textarea-wrapper-border);
|
|
179
|
+
outline: var(--_input-textarea-wrapper-outline);
|
|
180
|
+
box-shadow: var(--_input-textarea-wrapper-box-shadow);
|
|
181
|
+
opacity: var(--_input-textarea-wrapper-opacity);
|
|
182
|
+
|
|
183
|
+
margin-inline: var(--_input-textarea-wrapper-margin-inline);
|
|
184
|
+
padding-block: var(--_input-textarea-wrapper-padding-block);
|
|
185
|
+
|
|
186
|
+
&:not(.normal) {
|
|
187
|
+
transition: opacity 0.2s ease-in-out;
|
|
188
|
+
}
|
|
189
|
+
|
|
129
190
|
&.has-left-slot {
|
|
130
191
|
.left-slot {
|
|
131
192
|
display: flex;
|
|
132
193
|
align-items: center;
|
|
194
|
+
margin-inline-start: 1rem;
|
|
133
195
|
}
|
|
134
196
|
}
|
|
135
197
|
|
|
@@ -137,6 +199,7 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
137
199
|
.right-slot {
|
|
138
200
|
display: flex;
|
|
139
201
|
align-items: center;
|
|
202
|
+
margin-inline-end: 1rem;
|
|
140
203
|
}
|
|
141
204
|
}
|
|
142
205
|
|
|
@@ -147,7 +210,10 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
147
210
|
box-shadow: none;
|
|
148
211
|
flex-grow: 1;
|
|
149
212
|
|
|
150
|
-
|
|
213
|
+
min-height: 4lh;
|
|
214
|
+
field-sizing: content;
|
|
215
|
+
|
|
216
|
+
color: var(--_input-textarea-core-color);
|
|
151
217
|
font-family: var(--font-family);
|
|
152
218
|
font-size: var(--form-element-font-size);
|
|
153
219
|
line-height: var(--form-element-line-height);
|
|
@@ -156,10 +222,6 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
156
222
|
padding-block-start: var(--form-element-padding-block-start);
|
|
157
223
|
padding-block-end: var(--form-element-padding-block-end);
|
|
158
224
|
|
|
159
|
-
min-height: 5em;
|
|
160
|
-
|
|
161
|
-
field-sizing: content;
|
|
162
|
-
|
|
163
225
|
&::placeholder,
|
|
164
226
|
&::-webkit-input-placeholder {
|
|
165
227
|
font-family: var(--font-family);
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="input-textarea-with-label" :data-form-theme="formTheme" :class="[elementClasses, { dirty: isDirty }, { active: isActive }]">
|
|
2
|
+
<div class="input-textarea-with-label" :data-form-theme="formTheme" :class="[elementClasses, inputVariant, { dirty: isDirty }, { active: isActive }]">
|
|
3
3
|
<label :for="id" class="input-textarea-label body-normal-semibold">{{ label }}</label>
|
|
4
4
|
|
|
5
|
-
<InputTextareaCore
|
|
5
|
+
<InputTextareaCore
|
|
6
|
+
v-model="modelValue"
|
|
7
|
+
v-model:isDirty="isDirty"
|
|
8
|
+
v-model:isActive="isActive"
|
|
9
|
+
:maxlength
|
|
10
|
+
:id
|
|
11
|
+
:name
|
|
12
|
+
:placeholder
|
|
13
|
+
:label
|
|
14
|
+
:fieldHasError
|
|
15
|
+
:required
|
|
16
|
+
:styleClassPassthrough
|
|
17
|
+
:theme
|
|
18
|
+
:size
|
|
19
|
+
:inputVariant
|
|
20
|
+
>
|
|
6
21
|
<template v-if="hasLeftSlot" #left>
|
|
7
22
|
<slot name="left"></slot>
|
|
8
23
|
</template>
|
|
@@ -63,6 +78,13 @@ const props = defineProps({
|
|
|
63
78
|
return propValidators.size.includes(value);
|
|
64
79
|
},
|
|
65
80
|
},
|
|
81
|
+
inputVariant: {
|
|
82
|
+
type: String as PropType<string>,
|
|
83
|
+
default: 'normal',
|
|
84
|
+
validator(value: string) {
|
|
85
|
+
return propValidators.inputVariant.includes(value);
|
|
86
|
+
},
|
|
87
|
+
},
|
|
66
88
|
});
|
|
67
89
|
|
|
68
90
|
const slots = useSlots();
|
|
@@ -102,9 +124,144 @@ watch(
|
|
|
102
124
|
|
|
103
125
|
<style lang="css">
|
|
104
126
|
.input-textarea-with-label {
|
|
127
|
+
--_input-textarea-with-label-margin-block-start: 0;
|
|
128
|
+
--_input-textarea-with-label-background-color: transparent;
|
|
129
|
+
|
|
130
|
+
--_input-textarea-wrapper-border: var(--form-element-border-width) solid var(--theme-form-input-border);
|
|
131
|
+
--_input-textarea-wrapper-border-radius: var(--form-input-border-radius);
|
|
132
|
+
--_input-textarea-wrapper-border-underlined: var(--form-element-border-width-underlined) solid var(--theme-form-input-border);
|
|
133
|
+
--_input-textarea-wrapper-outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
|
|
134
|
+
--_input-textarea-wrapper-box-shadow: var(--_focus-box-shadow);
|
|
135
|
+
--_input-textarea-wrapper-padding-block: 0;
|
|
136
|
+
|
|
137
|
+
--_focus-box-shadow: var(--box-shadow-off);
|
|
138
|
+
|
|
139
|
+
/* Label vars */
|
|
140
|
+
--_label-textarea-color: var(--theme-form-input-text-label-color-normal);
|
|
141
|
+
--_label-textarea-margin-block: 0.8rem;
|
|
142
|
+
--_label-textarea-size: var(--step-2);
|
|
143
|
+
--_label-textarea-weight: normal;
|
|
144
|
+
--_label-textarea-height: auto;
|
|
145
|
+
--_label-textarea-line-height: 1.5;
|
|
146
|
+
--_label-textarea-background-color: var(--_input-textarea-with-label-background-color);
|
|
147
|
+
|
|
148
|
+
&.underlined {
|
|
149
|
+
--_label-textarea-color: var(--theme-form-input-text-label-color-underlined);
|
|
150
|
+
--_label-offset: 1rem 0;
|
|
151
|
+
--_input-textarea-with-label-background-color: color-mix(in srgb, currentColor 5%, transparent);
|
|
152
|
+
|
|
153
|
+
--_input-textarea-wrapper-underlined-border-radius-top-left: 0;
|
|
154
|
+
--_input-textarea-wrapper-underlined-border-radius-top-right: 0;
|
|
155
|
+
--_input-textarea-wrapper-underlined-border-radius-bottom-left: 4px;
|
|
156
|
+
--_input-textarea-wrapper-underlined-border-radius-bottom-right: 4px;
|
|
157
|
+
|
|
158
|
+
--_label-textarea-background-color: transparent;
|
|
159
|
+
--_label-textarea-height: fit-content;
|
|
160
|
+
|
|
161
|
+
&:has(.input-textarea-wrapper.active),
|
|
162
|
+
&:has(.input-textarea-wrapper.dirty) {
|
|
163
|
+
--_label-offset: 0 -4.2rem;
|
|
164
|
+
--_label-textarea-weight: bolder;
|
|
165
|
+
--_label-textarea-size: var(--step-1);
|
|
166
|
+
/* line-height: 1.5; */
|
|
167
|
+
/* padding: 0.2rem 1.2rem; */
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&.outlined {
|
|
172
|
+
--_label-textarea-color: var(--theme-form-input-text-label-color-outlined);
|
|
173
|
+
|
|
174
|
+
--_label-offset: 1rem 0;
|
|
175
|
+
--_input-textarea-with-label-background-color: var(--theme-form-input-bg-normal);
|
|
176
|
+
|
|
177
|
+
--_input-textarea-wrapper-padding-block: 0.4em;
|
|
178
|
+
--_label-textarea-height: fit-content;
|
|
179
|
+
|
|
180
|
+
&:has(.input-textarea-wrapper.active),
|
|
181
|
+
&:has(.input-textarea-wrapper.dirty) {
|
|
182
|
+
--_label-offset: 1rem -2.8rem;
|
|
183
|
+
--_label-textarea-weight: normal;
|
|
184
|
+
/* --_label-textarea-size: var(--step-1); */
|
|
185
|
+
/* line-height: 1.5; */
|
|
186
|
+
/* padding: 0.2rem 1.2rem; */
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&:not(.normal) {
|
|
191
|
+
--_input-textarea-with-label-margin-block-start: 3em;
|
|
192
|
+
|
|
193
|
+
&:has(.input-textarea-wrapper.active),
|
|
194
|
+
&:has(.input-textarea-wrapper.dirty) {
|
|
195
|
+
/* --_label-offset: 1rem -2.8rem; */
|
|
196
|
+
/* font-size: var(--step-1); */
|
|
197
|
+
/* line-height: 1.5; */
|
|
198
|
+
/* padding: 0.2rem 1.2rem; */
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
&:focus-within {
|
|
202
|
+
--_input-textarea-wrapper-box-shadow: var(--box-shadow-on);
|
|
203
|
+
--_input-textarea-wrapper-outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/*
|
|
208
|
+
* Apply generic styles
|
|
209
|
+
**/
|
|
210
|
+
|
|
211
|
+
background-color: var(--_input-textarea-with-label-background-color);
|
|
212
|
+
border-radius: var(--_input-textarea-wrapper-border-radius);
|
|
213
|
+
/* overflow: clip; */
|
|
214
|
+
|
|
215
|
+
&.underlined {
|
|
216
|
+
border-bottom: var(--_input-textarea-wrapper-border-underlined);
|
|
217
|
+
border-top-left-radius: var(--_input-textarea-wrapper-underlined-border-radius-top-left);
|
|
218
|
+
border-top-right-radius: var(--_input-textarea-wrapper-underlined-border-radius-top-right);
|
|
219
|
+
border-bottom-left-radius: var(--_input-textarea-wrapper-underlined-border-radius-bottom-left);
|
|
220
|
+
border-bottom-right-radius: var(--_input-textarea-wrapper-underlined-border-radius-bottom-right);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&.outlined {
|
|
224
|
+
border: var(--_input-textarea-wrapper-border);
|
|
225
|
+
outline: var(--_input-textarea-wrapper-outline);
|
|
226
|
+
box-shadow: var(--_input-textarea-wrapper-box-shadow);
|
|
227
|
+
padding-block: var(--_input-textarea-wrapper-padding-block);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&:not(.normal) {
|
|
231
|
+
display: grid;
|
|
232
|
+
grid-template-columns: 1fr;
|
|
233
|
+
grid-template-rows: 1fr;
|
|
234
|
+
grid-template-areas: 'underlined-textarea-stack';
|
|
235
|
+
|
|
236
|
+
margin-block-start: var(--_input-textarea-with-label-margin-block-start);
|
|
237
|
+
|
|
238
|
+
.input-textarea-label {
|
|
239
|
+
grid-area: underlined-textarea-stack;
|
|
240
|
+
z-index: 2;
|
|
241
|
+
}
|
|
242
|
+
.input-textarea-wrapper {
|
|
243
|
+
grid-area: underlined-textarea-stack;
|
|
244
|
+
z-index: 1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
105
248
|
.input-textarea-label {
|
|
106
|
-
display: block;
|
|
107
|
-
|
|
249
|
+
display: inline-block;
|
|
250
|
+
color: var(--_label-textarea-color);
|
|
251
|
+
background-color: var(--_label-textarea-background-color);
|
|
252
|
+
margin-block: var(--_label-textarea-margin-block);
|
|
253
|
+
font-size: var(--_label-textarea-size);
|
|
254
|
+
font-weight: var(--_label-textarea-weight);
|
|
255
|
+
line-height: var(--_label-textarea-line-height);
|
|
256
|
+
translate: var(--_label-offset);
|
|
257
|
+
width: fit-content;
|
|
258
|
+
height: var(--_label-textarea-height);
|
|
259
|
+
transition: font-size 0.2s ease-in-out, translate 0.2s ease-in-out;
|
|
260
|
+
|
|
261
|
+
&:not(.normal) {
|
|
262
|
+
display: flex;
|
|
263
|
+
align-items: center;
|
|
264
|
+
}
|
|
108
265
|
}
|
|
109
266
|
}
|
|
110
267
|
</style>
|
package/package.json
CHANGED