srcdev-nuxt-forms 2.4.12 → 2.4.14

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.
@@ -1,13 +1,21 @@
1
1
  :root {
2
2
  [data-form-theme='error'] {
3
- --theme-form-input-bg: light-dark(var(--gray-1), var(--gray-4));
3
+ --theme-form-input-bg-normal: light-dark(var(--gray-1), var(--gray-4));
4
+ --theme-form-input-bg-outlined: light-dark(var(--gray-1), var(--gray-4));
5
+ --theme-form-input-bg-underlined: light-dark(var(--gray-1), var(--gray-4));
4
6
  --theme-form-input-border: var(--red-8);
5
7
  --theme-form-input-border-active: var(--red-2);
6
8
  --theme-form-input-border-focus: var(--red-2);
7
9
  --theme-form-input-outline: white;
8
10
  --theme-form-input-outline-active: var(--red-6);
9
11
  --theme-form-input-outline-focus: var(--red-6);
10
- --theme-form-input-text: light-dark(var(--gray-10), var(--gray-11));
12
+ --theme-form-input-text-color-normal: light-dark(var(--gray-10), var(--gray-11));
13
+ --theme-form-input-text-color-outlined: light-dark(var(--gray-10), var(--gray-1));
14
+ --theme-form-input-text-color-underlined: light-dark(var(--gray-11), var(--gray-1));
15
+
16
+ --theme-form-input-text-label-color-normal: light-dark(var(--gray-11), var(--gray-1));
17
+ --theme-form-input-text-label-color-outlined: light-dark(var(--gray-10), var(--gray-11));
18
+ --theme-form-input-text-label-color-underlined: light-dark(var(--gray-11), var(--gray-1));
11
19
 
12
20
  --theme-form-focus-box-shadow: light-dark(var(--red-12), var(--red-2));
13
21
 
@@ -1,13 +1,21 @@
1
1
  :root {
2
2
  [data-form-theme='ghost'] {
3
- --theme-form-input-bg: light-dark(var(--gray-1), var(--gray-4));
3
+ --theme-form-input-bg-normal: light-dark(var(--gray-1), var(--gray-4));
4
+ --theme-form-input-bg-outlined: light-dark(var(--gray-1), var(--gray-4));
5
+ --theme-form-input-bg-underlined: light-dark(var(--gray-1), var(--gray-4));
4
6
  --theme-form-input-border: var(--gray-8);
5
7
  --theme-form-input-border-active: var(--gray-2);
6
8
  --theme-form-input-border-focus: var(--gray-2);
7
9
  --theme-form-input-outline: white;
8
10
  --theme-form-input-outline-active: var(--gray-6);
9
11
  --theme-form-input-outline-focus: var(--gray-6);
10
- --theme-form-input-text: light-dark(var(--gray-10), var(--gray-11));
12
+ --theme-form-input-text-color-normal: light-dark(var(--gray-10), var(--gray-11));
13
+ --theme-form-input-text-color-outlined: light-dark(var(--gray-10), var(--gray-1));
14
+ --theme-form-input-text-color-underlined: light-dark(var(--gray-11), var(--gray-1));
15
+
16
+ --theme-form-input-text-label-color-normal: light-dark(var(--gray-11), var(--gray-1));
17
+ --theme-form-input-text-label-color-outlined: light-dark(var(--gray-10), var(--gray-11));
18
+ --theme-form-input-text-label-color-underlined: light-dark(var(--gray-11), var(--gray-1));
11
19
 
12
20
  --theme-form-focus-box-shadow: light-dark(var(--gray-12), var(--gray-2));
13
21
 
@@ -3,7 +3,7 @@
3
3
  --theme-btn-bg: transparent;
4
4
  --theme-btn-border: transparent;
5
5
  --theme-btn-outline: transparent;
6
- --theme-btn-text: var(--theme-form-input-text);
6
+ --theme-btn-text: var(--theme-form-input-text-color-normal);
7
7
 
8
8
  --theme-btn-bg-hover: var(--blue-8);
9
9
  --theme-btn-border-hover: var(--blue-8);
@@ -1,13 +1,21 @@
1
1
  :root {
2
2
  [data-form-theme='primary'] {
3
- --theme-form-input-bg: light-dark(var(--gray-1), var(--gray-4));
3
+ --theme-form-input-bg-normal: light-dark(var(--gray-1), var(--gray-4));
4
+ --theme-form-input-bg-outlined: light-dark(var(--gray-1), var(--gray-4));
5
+ --theme-form-input-bg-underlined: light-dark(var(--gray-0), var(--gray-9));
4
6
  --theme-form-input-border: var(--blue-8);
5
7
  --theme-form-input-border-active: var(--blue-2);
6
8
  --theme-form-input-border-focus: var(--blue-2);
7
9
  --theme-form-input-outline: white;
8
10
  --theme-form-input-outline-active: var(--blue-6);
9
11
  --theme-form-input-outline-focus: var(--blue-6);
10
- --theme-form-input-text: light-dark(var(--gray-10), var(--gray-11));
12
+ --theme-form-input-text-color-normal: light-dark(var(--gray-11), var(--gray-11));
13
+ --theme-form-input-text-color-outlined: light-dark(var(--gray-10), var(--gray-11));
14
+ --theme-form-input-text-color-underlined: light-dark(var(--gray-11), var(--gray-1));
15
+
16
+ --theme-form-input-text-label-color-normal: light-dark(var(--gray-11), var(--gray-1));
17
+ --theme-form-input-text-label-color-outlined: light-dark(var(--gray-10), var(--gray-11));
18
+ --theme-form-input-text-label-color-underlined: light-dark(var(--gray-11), var(--gray-1));
11
19
 
12
20
  /* --theme-form-focus-box-shadow: light-dark(var(--blue-12), var(--blue-2)); */
13
21
  --theme-form-focus-box-shadow: light-dark(red, yellowgreen);
@@ -26,7 +34,7 @@
26
34
  --theme-form-radio-shadow-focus: var(--blue-6);
27
35
  --theme-form-radio-symbol: var(--blue-12);
28
36
 
29
- --theme-form-range-accent-color: light-dark(var(--blue-12), var(--blue-));
37
+ --theme-form-range-accent-color: light-dark(var(--blue-12), var(--blue-1));
30
38
 
31
39
  /*
32
40
  * ToggleSwitch
@@ -1,13 +1,21 @@
1
1
  :root {
2
2
  [data-form-theme='secondary'] {
3
- --theme-form-input-bg: light-dark(var(--gray-1), var(--gray-4));
3
+ --theme-form-input-bg-normal: light-dark(var(--gray-1), var(--gray-4));
4
+ --theme-form-input-bg-outlined: light-dark(var(--gray-1), var(--gray-4));
5
+ --theme-form-input-bg-underlined: light-dark(var(--gray-1), var(--gray-4));
4
6
  --theme-form-input-border: var(--gray-8);
5
7
  --theme-form-input-border-active: var(--gray-2);
6
8
  --theme-form-input-border-focus: var(--gray-2);
7
9
  --theme-form-input-outline: white;
8
10
  --theme-form-input-outline-active: var(--gray-6);
9
11
  --theme-form-input-outline-focus: var(--gray-6);
10
- --theme-form-input-text: light-dark(var(--gray-10), var(--gray-11));
12
+ --theme-form-input-text-color-normal: light-dark(var(--gray-10), var(--gray-11));
13
+ --theme-form-input-text-color-outlined: light-dark(var(--gray-10), var(--gray-1));
14
+ --theme-form-input-text-color-underlined: light-dark(var(--gray-11), var(--gray-1));
15
+
16
+ --theme-form-input-text-label-color-normal: light-dark(var(--gray-11), var(--gray-1));
17
+ --theme-form-input-text-label-color-outlined: light-dark(var(--gray-10), var(--gray-11));
18
+ --theme-form-input-text-label-color-underlined: light-dark(var(--gray-11), var(--gray-1));
11
19
 
12
20
  --theme-form-focus-box-shadow: light-dark(var(--gray-12), var(--gray-2));
13
21
 
@@ -1,13 +1,21 @@
1
1
  :root {
2
2
  [data-form-theme='success'] {
3
- --theme-form-input-bg: light-dark(var(--gray-1), var(--gray-4));
3
+ --theme-form-input-bg-normal: light-dark(var(--gray-1), var(--gray-4));
4
+ --theme-form-input-bg-outlined: light-dark(var(--gray-1), var(--gray-4));
5
+ --theme-form-input-bg-underlined: light-dark(var(--gray-1), var(--gray-4));
4
6
  --theme-form-input-border: var(--green-8);
5
7
  --theme-form-input-border-active: var(--green-2);
6
8
  --theme-form-input-border-focus: var(--green-2);
7
9
  --theme-form-input-outline: white;
8
10
  --theme-form-input-outline-active: var(--green-6);
9
11
  --theme-form-input-outline-focus: var(--green-6);
10
- --theme-form-input-text: light-dark(var(--gray-10), var(--gray-11));
12
+ --theme-form-input-text-color-normal: light-dark(var(--gray-10), var(--gray-11));
13
+ --theme-form-input-text-color-outlined: light-dark(var(--gray-10), var(--gray-1));
14
+ --theme-form-input-text-color-underlined: light-dark(var(--gray-11), var(--gray-1));
15
+
16
+ --theme-form-input-text-label-color-normal: light-dark(var(--gray-11), var(--gray-1));
17
+ --theme-form-input-text-label-color-outlined: light-dark(var(--gray-10), var(--gray-11));
18
+ --theme-form-input-text-label-color-underlined: light-dark(var(--gray-11), var(--gray-1));
11
19
 
12
20
  --theme-form-focus-box-shadow: light-dark(var(--green-12), var(--green-2));
13
21
 
@@ -1,13 +1,21 @@
1
1
  :root {
2
2
  [data-form-theme='tertiary'] {
3
- --theme-form-input-bg: light-dark(var(--gray-1), var(--gray-4));
3
+ --theme-form-input-bg-normal: light-dark(var(--gray-1), var(--gray-4));
4
+ --theme-form-input-bg-outlined: light-dark(var(--gray-1), var(--gray-4));
5
+ --theme-form-input-bg-underlined: light-dark(var(--gray-1), var(--gray-4));
4
6
  --theme-form-input-border: var(--gray-8);
5
7
  --theme-form-input-border-active: var(--gray-2);
6
8
  --theme-form-input-border-focus: var(--gray-2);
7
9
  --theme-form-input-outline: white;
8
10
  --theme-form-input-outline-active: var(--gray-6);
9
11
  --theme-form-input-outline-focus: var(--gray-6);
10
- --theme-form-input-text: light-dark(var(--gray-10), var(--gray-11));
12
+ --theme-form-input-text-color-normal: light-dark(var(--gray-10), var(--gray-11));
13
+ --theme-form-input-text-color-outlined: light-dark(var(--gray-10), var(--gray-1));
14
+ --theme-form-input-text-color-underlined: light-dark(var(--gray-11), var(--gray-1));
15
+
16
+ --theme-form-input-text-label-color-normal: light-dark(var(--gray-11), var(--gray-1));
17
+ --theme-form-input-text-label-color-outlined: light-dark(var(--gray-10), var(--gray-11));
18
+ --theme-form-input-text-label-color-underlined: light-dark(var(--gray-11), var(--gray-1));
11
19
 
12
20
  --theme-form-focus-box-shadow: light-dark(var(--gray-12), var(--gray-2));
13
21
 
@@ -1,13 +1,21 @@
1
1
  :root {
2
2
  [data-form-theme='warning'] {
3
- --theme-form-input-bg: light-dark(var(--gray-1), var(--gray-4));
3
+ --theme-form-input-bg-normal: light-dark(var(--gray-1), var(--gray-4));
4
+ --theme-form-input-bg-outlined: light-dark(var(--gray-1), var(--gray-4));
5
+ --theme-form-input-bg-underlined: light-dark(var(--gray-1), var(--gray-4));
4
6
  --theme-form-input-border: var(--orange-8);
5
7
  --theme-form-input-border-active: var(--orange-2);
6
8
  --theme-form-input-border-focus: var(--orange-2);
7
9
  --theme-form-input-outline: white;
8
10
  --theme-form-input-outline-active: var(--orange-6);
9
11
  --theme-form-input-outline-focus: var(--orange-6);
10
- --theme-form-input-text: light-dark(var(--gray-10), var(--gray-11));
12
+ --theme-form-input-text-color-normal: light-dark(var(--gray-10), var(--gray-11));
13
+ --theme-form-input-text-color-outlined: light-dark(var(--gray-10), var(--gray-1));
14
+ --theme-form-input-text-color-underlined: light-dark(var(--gray-11), var(--gray-1));
15
+
16
+ --theme-form-input-text-label-color-normal: light-dark(var(--gray-11), var(--gray-1));
17
+ --theme-form-input-text-label-color-outlined: light-dark(var(--gray-10), var(--gray-11));
18
+ --theme-form-input-text-label-color-underlined: light-dark(var(--gray-11), var(--gray-1));
11
19
 
12
20
  --theme-form-focus-box-shadow: light-dark(var(--orange-12), var(--orange-2));
13
21
 
@@ -2,6 +2,7 @@
2
2
  --form-element-padding-block-start: 0.4lh;
3
3
  --form-element-padding-block-end: 0.4lh;
4
4
  --form-element-border-width: 0.2rem;
5
+ --form-element-border-width-underlined: 0.4rem;
5
6
  --form-element-outline-width: 0.1rem;
6
7
 
7
8
  --form-text-padding-inline: 0.5em;
@@ -1,4 +1,30 @@
1
1
  /* Margin */
2
+ .mi-auto {
3
+ margin-inline: auto;
4
+ }
5
+ .mis-auto {
6
+ margin-inline-start: auto;
7
+ }
8
+ .mie-auto {
9
+ margin-inline-end: auto;
10
+ }
11
+ .mb-auto {
12
+ margin-block: auto;
13
+ }
14
+ .mbs-auto {
15
+ margin-block-start: auto;
16
+ }
17
+ .mbe-auto {
18
+ margin-block-end: auto;
19
+ }
20
+
21
+ .mb-0 {
22
+ margin-block: 0;
23
+ }
24
+ .mi-0 {
25
+ margin-inline: 0;
26
+ }
27
+
2
28
  .m-0 {
3
29
  margin: 0;
4
30
  }
@@ -29,6 +29,7 @@ export const propValidators = {
29
29
  radioAppearance: [null, 'with-decorator'],
30
30
  optionsLayout: ['block', 'inline', 'equal-widths'],
31
31
  labelWeight: ['normal', 'semi-bold', 'bold'],
32
+ inputVariant: ['normal', 'outlined', 'underlined'],
32
33
  inputTypesButton: ['button', 'cancel', 'reset', 'submit'],
33
34
  inputTypesText: ['text', 'email', 'password', 'number', 'tel', 'url'],
34
35
  inputMode: ['text', 'email', 'tel', 'url', 'search', 'numeric', 'none', 'decimal'],
@@ -113,7 +113,7 @@ const minLength = computed(() => `${props.max.toString().length + 1}em`);
113
113
 
114
114
  width: fit-content;
115
115
 
116
- background-color: var(--theme-form-input-bg);
116
+ background-color: var(--theme-form-input-bg-normal);
117
117
  border-radius: var(--form-element-border-width);
118
118
  border: var(--form-element-border-width) solid var(--theme-form-input-border);
119
119
  outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
@@ -147,8 +147,8 @@ const minLength = computed(() => `${props.max.toString().length + 1}em`);
147
147
  outline: none;
148
148
  box-shadow: none;
149
149
 
150
- background-color: var(--theme-form-input-bg);
151
- color: var(--theme-form-input-text);
150
+ background-color: var(--theme-form-input-bg-normal);
151
+ color: var(--theme-form-input-text-color-normal);
152
152
  font-family: var(--font-family);
153
153
  font-size: var(--form-element-font-size);
154
154
  line-height: var(--form-element-line-height);
@@ -3,7 +3,7 @@
3
3
  class="input-text-wrapper"
4
4
  :data-form-theme="formTheme"
5
5
  :data-size="size"
6
- :class="[{ isMaterial: isMaterial }, { 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>
@@ -98,14 +98,15 @@ const props = defineProps({
98
98
  return propValidators.size.includes(value);
99
99
  },
100
100
  },
101
- isMaterial: {
102
- type: Boolean,
103
- default: false,
101
+ inputVariant: {
102
+ type: String as PropType<string>,
103
+ default: 'normal',
104
+ validator(value: string) {
105
+ return propValidators.inputVariant.includes(value);
106
+ },
104
107
  },
105
108
  });
106
109
 
107
- console.log('isMaterial: ', props.isMaterial);
108
-
109
110
  const slots = useSlots();
110
111
  const hasLeftSlot = computed(() => slots.left !== undefined);
111
112
  const hasRightSlot = computed(() => slots.right !== undefined);
@@ -157,22 +158,88 @@ onMounted(() => {
157
158
  <style lang="css">
158
159
  .input-text-wrapper {
159
160
  --_focus-box-shadow: var(--box-shadow-off);
161
+ --_input-text-core-color: var(--theme-form-input-text-color-normal);
162
+
163
+ --_input-text-wrapper-background-color: var(--theme-form-input-bg-normal);
164
+
165
+ --_input-text-wrapper-border: var(--form-element-border-width) solid var(--theme-form-input-border);
166
+ --_input-text-wrapper-border-radius: var(--form-input-border-radius);
167
+
168
+ --_input-text-wrapper-outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
169
+ --_input-text-wrapper-opacity: 1;
170
+ --_input-text-wrapper-box-shadow: var(--_focus-box-shadow);
171
+ --_input-text-wrapper-margin-inline: 0;
172
+
173
+ &.underlined {
174
+ --_input-text-core-color: var(--theme-form-input-text-color-underlined);
175
+ --_input-text-wrapper-background-color: var(--theme-form-input-bg-underlined);
176
+ }
177
+
178
+ &.outlined {
179
+ --_input-text-wrapper-margin-inline: 1px;
180
+ --_input-text-wrapper-background-color: var(--theme-form-input-bg-outlined);
181
+ }
182
+
183
+ &.normal {
184
+ &:focus-within {
185
+ --_input-text-wrapper-box-shadow: var(--box-shadow-on);
186
+ --_input-text-wrapper-outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
187
+ }
188
+ }
189
+
190
+ &:not(.normal) {
191
+ --_input-text-wrapper-border: none;
192
+ --_input-text-wrapper-box-shadow: none;
193
+ --_input-text-wrapper-outline: none;
194
+ --_input-text-wrapper-opacity: 0;
195
+
196
+ &:focus {
197
+ --_input-text-wrapper-border: none;
198
+ --_input-text-wrapper-box-shadow: none;
199
+ --_input-text-wrapper-outline: none;
200
+ --_input-text-wrapper-background-color: transparent;
201
+ }
202
+
203
+ &:focus-within {
204
+ --_input-text-wrapper-border: none;
205
+ --_input-text-wrapper-box-shadow: none;
206
+ --_input-text-wrapper-outline: none;
207
+ --_input-text-wrapper-background-color: transparent;
208
+ }
209
+
210
+ &.active,
211
+ &.dirty {
212
+ --_input-text-wrapper-border: none;
213
+ --_input-text-wrapper-box-shadow: none;
214
+ --_input-text-wrapper-outline: none;
215
+ --_input-text-wrapper-background-color: transparent;
216
+
217
+ --_input-text-wrapper-opacity: 1;
218
+ }
219
+ }
160
220
 
161
221
  display: flex;
162
222
  align-items: center;
163
223
 
164
- background-color: var(--theme-form-input-bg);
165
- border-radius: var(--form-element-border-width);
166
- border: var(--form-element-border-width) solid var(--theme-form-input-border);
167
- outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
168
- box-shadow: var(--_focus-box-shadow);
224
+ background-color: var(--_input-text-wrapper-background-color);
225
+ border-radius: var(--_input-text-wrapper-border-radius);
226
+ border: var(--_input-text-wrapper-border);
227
+ outline: var(--_input-text-wrapper-outline);
228
+ box-shadow: var(--_input-text-wrapper-box-shadow);
229
+ opacity: var(--_input-text-wrapper-opacity);
230
+
231
+ margin-inline: var(--_input-text-wrapper-margin-inline);
232
+
233
+ &:not(.normal) {
234
+ transition: opacity 0.2s ease-in-out;
235
+ }
169
236
 
170
237
  &:not(:has(.input-button-core)) {
171
238
  .slot {
172
239
  display: inline-block;
173
240
 
174
241
  .icon {
175
- color: var(--theme-form-input-text);
242
+ color: var(--_input-text-core-color);
176
243
  aspect-ratio: 1;
177
244
  height: var(--form-icon-size);
178
245
  width: var(--form-icon-size);
@@ -198,11 +265,6 @@ onMounted(() => {
198
265
  }
199
266
  }
200
267
 
201
- &:focus-within {
202
- box-shadow: var(--box-shadow-on);
203
- outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
204
- }
205
-
206
268
  .input-text-core {
207
269
  background-color: transparent;
208
270
  border: none;
@@ -210,7 +272,7 @@ onMounted(() => {
210
272
  box-shadow: none;
211
273
  flex-grow: 1;
212
274
 
213
- color: var(--theme-form-input-text);
275
+ color: var(--_input-text-core-color);
214
276
  font-family: var(--font-family);
215
277
  font-size: var(--form-element-font-size);
216
278
  line-height: var(--form-element-line-height);
@@ -226,13 +288,6 @@ onMounted(() => {
226
288
  font-style: italic;
227
289
  font-weight: 400;
228
290
  }
229
-
230
- /* WTH is --_focus-box-shadow undefined when attempting update here?? */
231
- /*
232
- &:focus-visible {
233
- --_focus-box-shadow: var(--box-shadow-on);
234
- :has(:has( }
235
- */
236
291
  }
237
292
 
238
293
  &:has(.has-left-button),
@@ -256,23 +311,6 @@ onMounted(() => {
256
311
  border-left: 2px solid var(--theme-btn-bg-hover);
257
312
  }
258
313
  }
259
-
260
- /* Material Design Styles */
261
-
262
- &.isMaterial {
263
- background-color: transparent;
264
- border-radius: initial;
265
- border: none;
266
- outline: none;
267
- box-shadow: none;
268
- opacity: 0;
269
- transition: opacity 0.2s ease-in-out;
270
-
271
- &.active,
272
- &.dirty {
273
- opacity: 1;
274
- }
275
- }
276
314
  }
277
315
 
278
316
  input:autofill,
@@ -280,11 +318,11 @@ input:-internal-autofill-selected,
280
318
  input:-webkit-autofill-strong-password,
281
319
  input:-webkit-autofill-strong-password-viewable,
282
320
  input:-webkit-autofill-and-obscured {
283
- background-color: var(--theme-form-input-bg) !important;
321
+ background-color: var(--theme-form-input-bg-normal) !important;
284
322
  background-image: none !important;
285
- color: var(--theme-form-input-text) !important;
286
- -webkit-box-shadow: 0 0 0rem 1000px var(--theme-form-input-bg) inset;
287
- -webkit-text-fill-color: var(--theme-form-input-text);
323
+ color: var(--theme-form-input-text-color-normal) !important;
324
+ -webkit-box-shadow: 0 0 0rem 1000px var(--theme-form-input-bg-normal) inset;
325
+ -webkit-text-fill-color: var(--theme-form-input-text-color-normal);
288
326
  transition: background-color 5000s ease-in-out 0s;
289
327
  }
290
328
  </style>
@@ -13,7 +13,7 @@
13
13
  :styleClassPassthrough
14
14
  :theme
15
15
  :size
16
- :isMaterial
16
+ :inputVariant
17
17
  >
18
18
  <template #right>
19
19
  <InputButtonCore
@@ -89,9 +89,12 @@ const props = defineProps({
89
89
  return propValidators.size.includes(value);
90
90
  },
91
91
  },
92
- isMaterial: {
93
- type: Boolean,
94
- default: false,
92
+ inputVariant: {
93
+ type: String as PropType<string>,
94
+ default: 'normal',
95
+ validator(value: string) {
96
+ return propValidators.inputVariant.includes(value);
97
+ },
95
98
  },
96
99
  });
97
100
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="input-text-with-label" :data-form-theme="formTheme" :class="[elementClasses, { dirty: isDirty }, { active: isActive }]">
2
+ <div class="input-text-with-label" :data-form-theme="formTheme" :class="[inputVariant, elementClasses, { dirty: isDirty }, { active: isActive }]">
3
3
  <label :for="id" class="input-text-label body-normal-bold">{{ label }}</label>
4
4
 
5
5
  <div v-if="hasDescriptionSlot" :id="`${id}-description`">
@@ -24,7 +24,7 @@
24
24
  inputmode="numeric"
25
25
  :ariaDescribedby
26
26
  :size
27
- :isMaterial
27
+ :inputVariant
28
28
  >
29
29
  <template v-if="hasLeftSlot" #left>
30
30
  <InputButtonCore
@@ -122,9 +122,12 @@ const props = defineProps({
122
122
  return propValidators.size.includes(value);
123
123
  },
124
124
  },
125
- isMaterial: {
126
- type: Boolean,
127
- default: false,
125
+ inputVariant: {
126
+ type: String as PropType<string>,
127
+ default: 'normal',
128
+ validator(value: string) {
129
+ return propValidators.inputVariant.includes(value);
130
+ },
128
131
  },
129
132
  });
130
133
 
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <div>
3
- <div class="input-text-with-label" :data-form-theme="formTheme" :class="[elementClasses, { isMaterial: isMaterial }, { dirty: isDirty }, { active: isActive }]">
3
+ <div class="input-text-with-label" :data-form-theme="formTheme" :class="[elementClasses, inputVariant, { dirty: isDirty }, { active: isActive }]">
4
4
  <label :for="id" class="input-text-label">{{ label }}</label>
5
5
 
6
- <div v-if="!isMaterial && hasDescriptionSlot" :id="`${id}-description`">
6
+ <div v-if="inputVariant === 'normal' && hasDescriptionSlot" :id="`${id}-description`">
7
7
  <slot name="description"></slot>
8
8
  </div>
9
9
 
@@ -25,7 +25,7 @@
25
25
  :theme
26
26
  :ariaDescribedby
27
27
  :size
28
- :isMaterial
28
+ :inputVariant
29
29
  >
30
30
  <template v-if="hasLeftSlot" #left>
31
31
  <slot name="left"></slot>
@@ -38,7 +38,7 @@
38
38
  <InputError :errorMessage="errorMessage" :showError="fieldHasError" :id="errorId" :isDetached="false" />
39
39
  </div>
40
40
 
41
- <div v-if="isMaterial && hasDescriptionSlot" :id="`${id}-description`">
41
+ <div v-if="inputVariant !== 'normal' && hasDescriptionSlot" :id="`${id}-description`">
42
42
  <slot name="description"></slot>
43
43
  </div>
44
44
  </div>
@@ -104,9 +104,12 @@ const props = defineProps({
104
104
  return propValidators.size.includes(value);
105
105
  },
106
106
  },
107
- isMaterial: {
108
- type: Boolean,
109
- default: false,
107
+ inputVariant: {
108
+ type: String as PropType<string>,
109
+ default: 'normal',
110
+ validator(value: string) {
111
+ return propValidators.inputVariant.includes(value);
112
+ },
110
113
  },
111
114
  });
112
115
 
@@ -154,62 +157,119 @@ watch(
154
157
 
155
158
  <style lang="css">
156
159
  .input-text-with-label {
160
+ --_input-text-with-label-margin-block-start: 0;
161
+ --_input-text-with-label-background-color: transparent;
162
+
163
+ --_input-text-wrapper-border: var(--form-element-border-width) solid var(--theme-form-input-border);
164
+ --_input-text-wrapper-border-radius: var(--form-input-border-radius);
165
+ --_input-text-wrapper-border-underlined: var(--form-element-border-width-underlined) solid var(--theme-form-input-border);
166
+ --_input-text-wrapper-outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
167
+ --_input-text-wrapper-box-shadow: var(--_focus-box-shadow);
168
+ --_input-text-wrapper-padding-block: 0;
169
+
157
170
  --_focus-box-shadow: var(--box-shadow-off);
158
171
 
159
- .input-text-label {
160
- display: block;
161
- margin-block: 0.8rem;
162
- font-size: var(--step-1);
163
- font-weight: normal;
164
- line-height: 1.5;
172
+ /* Label vars */
173
+ --_label-text-color: var(--theme-form-input-text-label-color-normal);
174
+ --_label-text-margin-block: 0.8rem;
175
+ --_label-text-size: var(--step-1);
176
+ --_label-text-weight: normal;
177
+ --_label-text-line-height: 1.5;
178
+
179
+ &.underlined {
180
+ --_label-text-color: var(--theme-form-input-text-label-color-underlined);
181
+ --_label-offset: 0 0;
182
+ --_input-text-with-label-background-color: var(--theme-form-input-bg-underlined);
183
+ --_input-text-wrapper-border-radius: 0;
184
+
185
+ &:has(.input-text-wrapper.active),
186
+ &:has(.input-text-wrapper.dirty) {
187
+ --_label-offset: 0 -2.8rem;
188
+ /* font-size: var(--step-1); */
189
+ /* line-height: 1.5; */
190
+ /* padding: 0.2rem 1.2rem; */
191
+ }
165
192
  }
166
193
 
167
- /* Material Design Styles */
194
+ &.outlined {
195
+ --_label-text-color: var(--theme-form-input-text-label-color-outlined);
168
196
 
169
- &.isMaterial {
170
- --_label-offset: 0 0;
197
+ --_label-offset: 1rem 0;
198
+ --_input-text-with-label-background-color: var(--theme-form-input-bg-normal);
199
+
200
+ --_input-text-wrapper-padding-block: 0.4em;
201
+
202
+ &:has(.input-text-wrapper.active),
203
+ &:has(.input-text-wrapper.dirty) {
204
+ --_label-offset: 1rem -2.8rem;
205
+ /* font-size: var(--step-1); */
206
+ /* line-height: 1.5; */
207
+ /* padding: 0.2rem 1.2rem; */
208
+ }
209
+ }
171
210
 
211
+ &:not(.normal) {
212
+ --_input-text-with-label-margin-block-start: 2em;
213
+
214
+ &:has(.input-text-wrapper.active),
215
+ &:has(.input-text-wrapper.dirty) {
216
+ /* --_label-offset: 1rem -2.8rem; */
217
+ /* font-size: var(--step-1); */
218
+ /* line-height: 1.5; */
219
+ /* padding: 0.2rem 1.2rem; */
220
+ }
221
+
222
+ &:focus-within {
223
+ --_input-text-wrapper-box-shadow: var(--box-shadow-on);
224
+ --_input-text-wrapper-outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
225
+ }
226
+ }
227
+
228
+ /*
229
+ * Apply generic styles
230
+ **/
231
+
232
+ background-color: var(--_input-text-with-label-background-color);
233
+ border-radius: var(--_input-text-wrapper-border-radius);
234
+
235
+ &.underlined {
236
+ border-bottom: var(--_input-text-wrapper-border-underlined);
237
+ }
238
+
239
+ &.outlined {
240
+ border: var(--_input-text-wrapper-border);
241
+ outline: var(--_input-text-wrapper-outline);
242
+ box-shadow: var(--_input-text-wrapper-box-shadow);
243
+ padding-block: var(--_input-text-wrapper-padding-block);
244
+ }
245
+
246
+ &:not(.normal) {
172
247
  display: grid;
173
248
  grid-template-columns: 1fr;
174
249
  grid-template-rows: 1fr;
175
- grid-template-areas: 'material-text-stack';
250
+ grid-template-areas: 'underlined-text-stack';
176
251
 
177
- background-color: var(--theme-form-input-bg);
178
- border-radius: var(--form-element-border-width);
179
- border: var(--form-element-border-width) solid var(--theme-form-input-border);
180
- outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
181
- box-shadow: var(--_focus-box-shadow);
182
-
183
- padding: 0 0.8rem;
252
+ margin-block-start: var(--_input-text-with-label-margin-block-start);
184
253
 
185
254
  .input-text-label {
186
- grid-area: material-text-stack;
187
-
188
- display: inline-block;
189
- width: fit-content;
190
- padding: 0.2rem 1.2rem;
191
- background-color: var(--theme-form-input-bg);
192
- border-radius: 0.4em;
193
- color: var(--theme-form-input-text);
194
- translate: var(--_label-offset);
195
-
196
- font-size: var(--step-2);
197
- font-weight: normal;
198
- line-height: 1.5;
199
-
200
- transition: font-size 0.2s ease-in-out, translate 0.2s ease-in-out;
201
-
202
- &:has(+ .input-text-wrapper.active),
203
- &:has(+ .input-text-wrapper.dirty) {
204
- --_label-offset: 0 -3rem;
205
- /* font-size: var(--step-2); */
206
- /* padding: 0.2rem 1.2rem; */
207
- }
255
+ grid-area: underlined-text-stack;
256
+ z-index: 2;
208
257
  }
209
-
210
258
  .input-text-wrapper {
211
- grid-area: material-text-stack;
259
+ grid-area: underlined-text-stack;
260
+ z-index: 1;
212
261
  }
213
262
  }
263
+
264
+ .input-text-label {
265
+ display: block;
266
+ color: var(--_label-text-color);
267
+ margin-block: var(--_label-text-margin-block);
268
+ font-size: var(--_label-text-size);
269
+ font-weight: var(--_label-text-weight);
270
+ line-height: var(--_label-text-line-height);
271
+ translate: var(--_label-offset);
272
+ transition: font-size 0.2s ease-in-out, translate 0.2s ease-in-out;
273
+ }
214
274
  }
215
275
  </style>
@@ -107,7 +107,7 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
107
107
  display: flex;
108
108
  align-items: center;
109
109
 
110
- background-color: var(--theme-form-input-bg);
110
+ background-color: var(--theme-form-input-bg-normal);
111
111
  border-radius: var(--form-element-border-width);
112
112
  border: var(--_border-width) solid var(--theme-form-input-border);
113
113
 
@@ -122,7 +122,7 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
122
122
  padding-inline: 0.8rem;
123
123
 
124
124
  .icon {
125
- color: var(--theme-form-input-text);
125
+ color: var(--theme-form-input-text-color-normal);
126
126
  }
127
127
  }
128
128
 
@@ -147,7 +147,7 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
147
147
  box-shadow: none;
148
148
  flex-grow: 1;
149
149
 
150
- color: var(--theme-form-input-text);
150
+ color: var(--theme-form-input-text-color-normal);
151
151
  font-family: var(--font-family);
152
152
  font-size: var(--form-element-font-size);
153
153
  line-height: var(--form-element-line-height);
@@ -99,7 +99,6 @@ const setColourSchemeAttr = async () => {
99
99
  };
100
100
 
101
101
  const handleInputActiveClass = () => {
102
- console.log(`handleInputActiveClass`, currentActiveIndex.value);
103
102
  colourSchemeInputElements.value.forEach((element) => {
104
103
  element.classList.remove('active');
105
104
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-forms",
3
3
  "type": "module",
4
- "version": "2.4.12",
4
+ "version": "2.4.14",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",
@@ -24,28 +24,28 @@
24
24
  "types/"
25
25
  ],
26
26
  "devDependencies": {
27
- "@nuxt/eslint-config": "1.0.0",
28
- "@nuxt/icon": "1.10.3",
29
- "@nuxt/test-utils": "3.15.4",
27
+ "@nuxt/eslint-config": "1.2.0",
28
+ "@nuxt/icon": "1.11.0",
29
+ "@nuxt/test-utils": "3.17.2",
30
30
  "@vue/test-utils": "2.4.6",
31
- "eslint": "9.19.0",
31
+ "eslint": "9.22.0",
32
32
  "happy-dom": "16.8.1",
33
- "nuxt": "3.15.4",
33
+ "nuxt": "3.16.0",
34
34
  "release-it": "18.1.2",
35
- "typescript": "5.7.3",
36
- "vitest": "3.0.5",
35
+ "typescript": "5.8.2",
36
+ "vitest": "3.0.8",
37
37
  "vue": "3.5.13"
38
38
  },
39
39
  "dependencies": {
40
- "@iconify-json/carbon": "1.2.6",
40
+ "@iconify-json/carbon": "1.2.8",
41
41
  "@iconify-json/gridicons": "1.2.2",
42
- "@iconify-json/material-symbols": "1.2.14",
43
- "@iconify-json/material-symbols-light": "1.2.14",
42
+ "@iconify-json/material-symbols": "1.2.16",
43
+ "@iconify-json/material-symbols-light": "1.2.16",
44
44
  "@iconify-json/ph": "1.2.2",
45
45
  "@iconify-json/radix-icons": "1.2.2",
46
46
  "@iconify-json/ri": "1.2.5",
47
47
  "modern-normalize": "3.0.1",
48
- "zod": "3.24.1"
48
+ "zod": "3.24.2"
49
49
  },
50
50
  "release-it": {
51
51
  "$schema": "https://unpkg.com/release-it/schema/release-it.json",