srcdev-nuxt-forms 2.1.36 → 2.1.38

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.
Files changed (33) hide show
  1. package/assets/styles/ally/_utils.css +20 -0
  2. package/assets/styles/ally/_variables.css +8 -0
  3. package/assets/styles/ally/index.css +2 -0
  4. package/assets/styles/forms/themes/_error.css +6 -6
  5. package/assets/styles/forms/themes/_ghost.css +6 -6
  6. package/assets/styles/forms/themes/_input-action.css +20 -0
  7. package/assets/styles/forms/themes/_primary.css +7 -6
  8. package/assets/styles/forms/themes/_secondary.css +6 -6
  9. package/assets/styles/forms/themes/_success.css +6 -6
  10. package/assets/styles/forms/themes/_tertiary.css +5 -5
  11. package/assets/styles/forms/themes/_warning.css +6 -6
  12. package/assets/styles/forms/themes/index.css +8 -7
  13. package/assets/styles/forms/variables/_sizes.css +82 -0
  14. package/assets/styles/forms/variables/_theme.css +1 -62
  15. package/assets/styles/forms/variables/index.css +1 -0
  16. package/assets/styles/main.css +1 -0
  17. package/assets/styles/typography/utils/_font-classes.css +30 -0
  18. package/components/forms/c12/prop-validators/index.ts +1 -1
  19. package/components/forms/form-errors/InputError.vue +1 -1
  20. package/components/forms/input-button/InputButtonCore.vue +28 -131
  21. package/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +21 -20
  22. package/components/forms/input-checkbox-radio/InputCheckboxRadioCore.vue +14 -29
  23. package/components/forms/input-checkbox-radio/InputCheckboxRadioWithLabel.vue +1 -1
  24. package/components/forms/input-number/InputNumberCore.vue +16 -15
  25. package/components/forms/input-number/variants/InputNumberDefault.vue +7 -7
  26. package/components/forms/input-range/InputRangeCore.vue +3 -3
  27. package/components/forms/input-range-fancy/InputRangeFancyCore.vue +0 -12
  28. package/components/forms/input-text/InputTextCore.vue +52 -22
  29. package/components/forms/input-text/variants/InputTextAsNumberWithLabel.vue +23 -5
  30. package/components/forms/input-text/variants/InputTextWithLabel.vue +9 -1
  31. package/components/forms/input-textarea/InputTextareaCore.vue +4 -4
  32. package/components/forms/toggle-switch/ToggleSwitchCore.vue +19 -29
  33. package/package.json +2 -1
@@ -2,6 +2,7 @@
2
2
  <div
3
3
  class="input-text-wrapper"
4
4
  :data-form-theme="formTheme"
5
+ :data-size="size"
5
6
  :class="[{ dirty: isDirty }, { active: isActive }, { error: fieldHasError }, { 'has-left-slot': hasLeftSlot }, { 'has-right-slot': hasRightSlot }]"
6
7
  >
7
8
  <span v-if="hasLeftSlot" class="slot left-slot">
@@ -15,7 +16,7 @@
15
16
  :name
16
17
  :required
17
18
  :maxlength
18
- :class="['input-text-core', 'text-normal', elementClasses, { dirty: isDirty }, { active: isActive }]"
19
+ :class="['input-text-core', elementClasses, { dirty: isDirty }, { active: isActive }]"
19
20
  v-model="modelValue"
20
21
  ref="inputField"
21
22
  :aria-invalid="fieldHasError"
@@ -35,7 +36,8 @@
35
36
  <script setup lang="ts">
36
37
  import propValidators from '../c12/prop-validators';
37
38
 
38
- const { type, inputmode, maxlength, id, name, placeholder, required, fieldHasError, styleClassPassthrough, theme, ariaDescribedby } = defineProps({
39
+ // const props = defineProps({
40
+ const { type, inputmode, maxlength, id, name, placeholder, required, fieldHasError, styleClassPassthrough, theme, ariaDescribedby, size } = defineProps({
39
41
  type: {
40
42
  // type: String as PropType<'text' | 'email' | 'password' | 'number' | 'tel' | 'url'>,
41
43
  type: String,
@@ -90,6 +92,13 @@ const { type, inputmode, maxlength, id, name, placeholder, required, fieldHasErr
90
92
  type: String,
91
93
  default: null,
92
94
  },
95
+ size: {
96
+ type: String as PropType<string>,
97
+ default: 'normal',
98
+ validator(value: string) {
99
+ return propValidators.size.includes(value);
100
+ },
101
+ },
93
102
  });
94
103
 
95
104
  const slots = useSlots();
@@ -127,7 +136,6 @@ const validateInput = () => {
127
136
  () => {
128
137
  if (inputField.value !== null && inputField.value.validity.patternMismatch) {
129
138
  inputField.value.value = beforeValue as string;
130
- console.log('you did some bad chars');
131
139
  }
132
140
  },
133
141
  { once: true }
@@ -144,44 +152,44 @@ onMounted(() => {
144
152
 
145
153
  <style lang="css">
146
154
  .input-text-wrapper {
147
- --_gutter: 1.2rem;
148
- --_border-width: var(--input-border-width-default);
149
- --_outline-width: var(--input-border-width-default);
155
+ --_focus-box-shadow: var(--box-shadow-off);
150
156
 
151
157
  display: flex;
152
158
  align-items: center;
153
159
 
154
160
  background-color: var(--theme-form-input-bg);
155
- border-radius: var(--input-border-width-default);
156
- border: var(--_border-width) solid var(--theme-form-input-border);
161
+ border-radius: var(--form-element-border-width);
162
+ border: var(--form-element-border-width) solid var(--theme-form-input-border);
163
+ outline: var(--form-element-outline-width) solid var(--theme-form-input-outline);
164
+ box-shadow: var(--_focus-box-shadow);
157
165
 
158
- &:focus-within {
159
- border: var(--_border-width) solid var(--theme-form-input-border-focus);
160
- outline: var(--_outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 50%);
161
- box-shadow: var(--theme-form-focus-box-shadow);
162
- }
163
-
164
- &:not(:has(.btn)) {
166
+ &:not(:has(.input-button-core)) {
165
167
  .slot {
166
168
  display: inline-block;
167
169
  padding-inline: 0.8rem;
168
170
 
169
171
  .icon {
170
172
  color: var(--theme-form-input-text);
173
+ aspect-ratio: 1;
174
+ height: var(--form-icon-size);
175
+ width: var(--form-icon-size);
176
+ margin: 0 !important;
177
+ padding: 0 !important;
171
178
  }
172
179
  }
173
180
  }
174
181
 
175
- &:has(.btn) {
176
- .btn {
182
+ /* &:has(.input-button-core) {
183
+ .input-button-core {
177
184
  margin-inline: 0.6rem;
178
185
  }
179
- }
186
+ } */
180
187
 
181
188
  &.has-left-slot {
182
189
  .left-slot {
183
190
  display: flex;
184
191
  align-items: center;
192
+ margin-inline: 0.6rem;
185
193
  }
186
194
  }
187
195
 
@@ -189,9 +197,21 @@ onMounted(() => {
189
197
  .right-slot {
190
198
  display: flex;
191
199
  align-items: center;
200
+ margin-inline: 0.6rem;
192
201
  }
193
202
  }
194
203
 
204
+ &:not(.has-left-slot) {
205
+ padding-inline-start: var(--form-text-padding-inline);
206
+ }
207
+
208
+ &:focus-within {
209
+ box-shadow: var(--box-shadow-on);
210
+ /* --_theme-form-input-outline-focus: hsl(from var(--_theme-form-input-outline-focus) h s 50%); */
211
+ outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
212
+ /* outline: var(--form-element-outline-width) solid white; */
213
+ }
214
+
195
215
  .input-text-core {
196
216
  background-color: transparent;
197
217
  border: none;
@@ -201,17 +221,27 @@ onMounted(() => {
201
221
 
202
222
  color: var(--theme-form-input-text);
203
223
  font-family: var(--font-family);
204
- font-size: var(--theme-form-button-font-size-normal);
205
- line-height: var(--line-height);
206
- padding: 0.8rem 1.2rem;
224
+ font-size: var(--form-element-font-size);
225
+ line-height: var(--form-element-line-height);
226
+
227
+ padding-inline: var(--form-text-padding-inline);
228
+ padding-block-start: var(--form-element-padding-block-start);
229
+ padding-block-end: var(--form-element-padding-block-end);
207
230
 
208
231
  &::placeholder,
209
232
  &::-webkit-input-placeholder {
210
233
  font-family: var(--font-family);
211
- font-size: var(--font-size);
234
+ font-size: var(--form-element-font-size);
212
235
  font-style: italic;
213
236
  font-weight: 400;
214
237
  }
238
+
239
+ /* WTH is --_focus-box-shadow undefined when attempting update here?? */
240
+ /*
241
+ &:focus-visible {
242
+ --_focus-box-shadow: var(--box-shadow-on);
243
+ }
244
+ */
215
245
  }
216
246
  }
217
247
 
@@ -23,6 +23,7 @@
23
23
  :theme
24
24
  inputmode="numeric"
25
25
  :ariaDescribedby
26
+ :size
26
27
  >
27
28
  <template v-if="hasLeftSlot" #left>
28
29
  <InputButtonCore
@@ -31,8 +32,8 @@
31
32
  :readonly="Number(modelValue) <= min"
32
33
  :is-pending="false"
33
34
  buttonText="Step down"
34
- :theme
35
- size="x-small"
35
+ theme="input-action"
36
+ :size
36
37
  >
37
38
  <template #iconOnly>
38
39
  <slot name="left"></slot>
@@ -46,8 +47,8 @@
46
47
  :readonly="Number(modelValue) >= max"
47
48
  :is-pending="false"
48
49
  buttonText="Step up"
49
- :theme
50
- size="x-small"
50
+ theme="input-action"
51
+ :size
51
52
  >
52
53
  <template #iconOnly>
53
54
  <slot name="right"></slot>
@@ -61,7 +62,7 @@
61
62
 
62
63
  <script setup lang="ts">
63
64
  import propValidators from '../../c12/prop-validators';
64
- const { maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme, step, min, max } = defineProps({
65
+ const { maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme, step, min, max, size } = defineProps({
65
66
  maxlength: {
66
67
  type: Number,
67
68
  default: 255,
@@ -117,6 +118,13 @@ const { maxlength, id, name, placeholder, label, errorMessage, fieldHasError, re
117
118
  type: Number,
118
119
  default: 1,
119
120
  },
121
+ size: {
122
+ type: String as PropType<string>,
123
+ default: 'normal',
124
+ validator(value: string) {
125
+ return propValidators.size.includes(value);
126
+ },
127
+ },
120
128
  });
121
129
 
122
130
  const slots = useSlots();
@@ -156,6 +164,16 @@ onMounted(() => {
156
164
  .input-text-as-number {
157
165
  .input-text-wrapper {
158
166
  width: fit-content;
167
+
168
+ &:has(.input-text-as-number) {
169
+ .left-slot {
170
+ margin-inline: 0;
171
+ }
172
+ .right-slot {
173
+ margin-inline: 0;
174
+ }
175
+ }
176
+
159
177
  .input-text-core.input-text-as-number {
160
178
  flex-grow: initial;
161
179
  text-align: center;
@@ -23,6 +23,7 @@
23
23
  :styleClassPassthrough
24
24
  :theme
25
25
  :ariaDescribedby
26
+ :size
26
27
  >
27
28
  <template v-if="hasLeftSlot" #left>
28
29
  <slot name="left"></slot>
@@ -37,7 +38,7 @@
37
38
 
38
39
  <script setup lang="ts">
39
40
  import propValidators from '../../c12/prop-validators';
40
- const { type, inputmode, maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme } = defineProps({
41
+ const { type, inputmode, maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme, size } = defineProps({
41
42
  maxlength: {
42
43
  type: Number,
43
44
  default: 255,
@@ -92,6 +93,13 @@ const { type, inputmode, maxlength, id, name, placeholder, label, errorMessage,
92
93
  return propValidators.theme.includes(value);
93
94
  },
94
95
  },
96
+ size: {
97
+ type: String as PropType<string>,
98
+ default: 'normal',
99
+ validator(value: string) {
100
+ return propValidators.size.includes(value);
101
+ },
102
+ },
95
103
  });
96
104
 
97
105
  const slots = useSlots();
@@ -97,20 +97,20 @@ onMounted(() => {
97
97
  <style lang="css">
98
98
  .input-textarea-wrapper {
99
99
  --_gutter: 1.2rem;
100
- --_border-width: var(--input-border-width-default);
101
- --_outline-width: var(--input-border-width-default);
100
+ --_border-width: var(--form-element-border-width);
101
+ --_outline-width: var(--form-element-border-width);
102
102
 
103
103
  display: flex;
104
104
  align-items: center;
105
105
 
106
106
  background-color: var(--theme-form-input-bg);
107
- border-radius: var(--input-border-width-default);
107
+ border-radius: var(--form-element-border-width);
108
108
  border: var(--_border-width) solid var(--theme-form-input-border);
109
109
 
110
110
  &:focus-within {
111
111
  border: var(--_border-width) solid var(--theme-form-input-border-focus);
112
112
  outline: var(--_outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 50%);
113
- box-shadow: var(--theme-form-focus-box-shadow);
113
+ box-shadow: var(--form-focus-box-shadow);
114
114
  }
115
115
 
116
116
  .slot {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="toggle-switch-core" :class="(elementClasses, size)" :data-form-theme="formTheme">
2
+ <div class="toggle-switch-core" :class="elementClasses" :data-size="size" :data-form-theme="formTheme">
3
3
  <label class="toggle-switch-input" :class="[{ round }]" :for="inputId">
4
4
  <input type="checkbox" v-model="modelValue" :true-value :false-value :id="inputId" :aria-describedby="`${id}-description`" :name :required />
5
5
  <div class="symbol-wrapper" :class="[{ round }]">
@@ -98,6 +98,8 @@ const inputId = computed(() => `toggle-sitch-${id}`);
98
98
  .toggle-switch-input {
99
99
  position: relative;
100
100
  display: inline-block;
101
+ height: calc(var(--form-toggle-symbol-size) + calc(var(--form-element-border-width) * 2) + calc(var(--form-element-outline-width) * 2));
102
+ width: calc(var(--form-toggle-symbol-size) * 2 - calc(var(--form-element-border-width) * 2) + calc(var(--form-element-outline-width) * 2) + var(--form-toggle-switch-width-adjustment));
101
103
 
102
104
  input {
103
105
  opacity: 0;
@@ -139,43 +141,23 @@ const inputId = computed(() => `toggle-sitch-${id}`);
139
141
  * ToggleSwitch configurable
140
142
  **/
141
143
  .toggle-switch-core {
142
- /* Sizes */
143
- &.x-small {
144
- --_symbol-size: 2rem;
145
- }
146
- &.small {
147
- --_symbol-size: 2.4rem;
148
- }
149
- &.normal {
150
- --_symbol-size: 3.4rem;
151
- }
152
- &.medium {
153
- --_symbol-size: 4rem;
154
- }
155
- &.large {
156
- --_symbol-size: 4.4rem;
157
- }
158
-
159
144
  .toggle-switch-input {
160
- border: var(--theme-form-toggle-border);
161
- outline: var(--theme-form-toggle-outline);
162
- width: calc(var(--_symbol-size) * 2 - calc(var(--theme-form-toggle-border-width) * 4));
163
- height: calc(var(--_symbol-size) + calc(var(--theme-form-toggle-border-width) * 4));
164
-
165
145
  &.round {
166
- border-radius: calc(var(--_symbol-size) + calc(var(--theme-form-toggle-border-width) * 2));
146
+ border-radius: calc(var(--form-toggle-symbol-size) + calc(var(--form-element-border-width) * 2));
167
147
  }
168
148
 
169
149
  .symbol-wrapper {
150
+ border: var(--theme-form-toggle-border);
170
151
  background-color: var(--theme-form-toggle-bg-off);
152
+ outline: var(--theme-form-toggle-outline);
171
153
  transition: 0.4s;
172
154
 
173
155
  &.round {
174
- border-radius: var(--_symbol-size);
156
+ border-radius: var(--form-toggle-symbol-size);
175
157
  }
176
158
  .symbol {
177
- height: calc(var(--_symbol-size) - 0.6rem);
178
- width: calc(var(--_symbol-size) - 0.6rem);
159
+ height: calc(var(--form-toggle-symbol-size) - 0.6rem);
160
+ width: calc(var(--form-toggle-symbol-size) - 0.6rem);
179
161
  left: 0.4rem;
180
162
  bottom: 0.4rem;
181
163
  background-color: var(--theme-form-toggle-symbol-off);
@@ -196,17 +178,25 @@ const inputId = computed(() => `toggle-sitch-${id}`);
196
178
  color: var(--theme-form-toggle-icon-stroke-colour-off);
197
179
  opacity: 1;
198
180
  }
181
+
182
+ .icon {
183
+ --_icon-size: var(--form-icon-size);
184
+ height: var(--_icon-size);
185
+ width: var(--_icon-size);
186
+ }
199
187
  }
200
188
  }
201
189
  }
202
190
 
203
191
  input:focus-visible + .symbol-wrapper {
204
- box-shadow: var(--theme-form-focus-box-shadow);
192
+ box-shadow: var(--box-shadow-on);
193
+ outline: var(--form-element-outline-width) solid hsl(from var(--theme-form-input-outline-focus) h s 90%);
205
194
  }
206
195
 
207
196
  input:checked + .symbol-wrapper .symbol {
197
+ --_on-position: calc(var(--form-toggle-symbol-size) * 0.8);
208
198
  background-color: var(--theme-form-toggle-symbol-on);
209
- transform: translateX(26px);
199
+ transform: translateX(var(--_on-position));
210
200
 
211
201
  .symbol-icon {
212
202
  &.icon-on {
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-forms",
3
3
  "type": "module",
4
- "version": "2.1.36",
4
+ "version": "2.1.38",
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",
8
8
  "cleanall": "rm -rf node_modules && rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output && rm -rf .playground/node_modules && rm package-lock.json",
9
9
  "reinstall": "rm -rf node_modules && npm install",
10
+ "cleaninstall": "npm run clean && npm run reinstall",
10
11
  "dev": "nuxi dev .playground",
11
12
  "build": "nuxt build .playground",
12
13
  "generate": "nuxt generate .playground",