srcdev-nuxt-forms 2.4.23 → 3.0.0

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 (85) hide show
  1. package/nuxt.config.ts +3 -0
  2. package/package.json +2 -2
  3. package/assets/styles/ally/_utils.css +0 -20
  4. package/assets/styles/ally/_variables.css +0 -8
  5. package/assets/styles/ally/index.css +0 -2
  6. package/assets/styles/forms/index.css +0 -2
  7. package/assets/styles/forms/themes/_error.css +0 -85
  8. package/assets/styles/forms/themes/_ghost.css +0 -85
  9. package/assets/styles/forms/themes/_input-action-underlined.css +0 -20
  10. package/assets/styles/forms/themes/_input-action.css +0 -20
  11. package/assets/styles/forms/themes/_primary.css +0 -90
  12. package/assets/styles/forms/themes/_secondary.css +0 -85
  13. package/assets/styles/forms/themes/_success.css +0 -85
  14. package/assets/styles/forms/themes/_tertiary.css +0 -85
  15. package/assets/styles/forms/themes/_warning.css +0 -85
  16. package/assets/styles/forms/themes/index.css +0 -9
  17. package/assets/styles/forms/variables/_sizes.css +0 -71
  18. package/assets/styles/forms/variables/_theme.css +0 -11
  19. package/assets/styles/forms/variables/index.css +0 -2
  20. package/assets/styles/main.css +0 -5
  21. package/assets/styles/typography/index.css +0 -2
  22. package/assets/styles/typography/utils/_font-classes.css +0 -190
  23. package/assets/styles/typography/utils/_weights.css +0 -69
  24. package/assets/styles/typography/utils/index.css +0 -2
  25. package/assets/styles/typography/variables/_colors.css +0 -14
  26. package/assets/styles/typography/variables/_reponsive-font-size.css +0 -10
  27. package/assets/styles/typography/variables/index.css +0 -2
  28. package/assets/styles/utils/_margin-helpers.css +0 -334
  29. package/assets/styles/utils/_padding-helpers.css +0 -308
  30. package/assets/styles/utils/_page.css +0 -36
  31. package/assets/styles/utils/index.css +0 -3
  32. package/assets/styles/variables/colors/_blue.css +0 -15
  33. package/assets/styles/variables/colors/_gray.css +0 -16
  34. package/assets/styles/variables/colors/_green.css +0 -15
  35. package/assets/styles/variables/colors/_orange.css +0 -15
  36. package/assets/styles/variables/colors/_red.css +0 -15
  37. package/assets/styles/variables/colors/_yellow.css +0 -15
  38. package/assets/styles/variables/colors/colors.css +0 -6
  39. package/assets/styles/variables/index.css +0 -1
  40. package/components/forms/c12/prop-validators/index.ts +0 -38
  41. package/components/forms/c12/utils.ts +0 -14
  42. package/components/forms/form-errors/InputError.vue +0 -172
  43. package/components/forms/form-errors/tests/InputError.spec.ts +0 -67
  44. package/components/forms/input-button/InputButtonCore.vue +0 -191
  45. package/components/forms/input-button/variants/InputButtonConfirm.vue +0 -66
  46. package/components/forms/input-button/variants/InputButtonSubmit.vue +0 -62
  47. package/components/forms/input-checkbox/MultipleCheckboxes.vue +0 -203
  48. package/components/forms/input-checkbox/SingleCheckbox.vue +0 -169
  49. package/components/forms/input-checkbox/tests/MultipleCheckboxes.spec.ts +0 -98
  50. package/components/forms/input-checkbox/tests/data/tags.json +0 -67
  51. package/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +0 -214
  52. package/components/forms/input-checkbox-radio/InputCheckboxRadioCore.vue +0 -191
  53. package/components/forms/input-checkbox-radio/InputCheckboxRadioWithLabel.vue +0 -111
  54. package/components/forms/input-number/InputNumberCore.vue +0 -203
  55. package/components/forms/input-number/variants/InputNumberDefault.vue +0 -154
  56. package/components/forms/input-radio/MultipleRadiobuttons.vue +0 -201
  57. package/components/forms/input-radio/tests/MultipleRadioButtons.spec.ts +0 -89
  58. package/components/forms/input-radio/tests/data/tags.json +0 -67
  59. package/components/forms/input-range/InputRangeCore.vue +0 -274
  60. package/components/forms/input-range/variants/InputRangeDefault.vue +0 -156
  61. package/components/forms/input-range-fancy/InputRangeFancyCore.vue +0 -450
  62. package/components/forms/input-range-fancy/InputRangeFancyWithLabel.vue +0 -124
  63. package/components/forms/input-text/InputTextCore.vue +0 -331
  64. package/components/forms/input-text/variants/InputPasswordWithLabel.vue +0 -130
  65. package/components/forms/input-text/variants/InputTextAsNumberWithLabel.vue +0 -187
  66. package/components/forms/input-text/variants/InputTextWithLabel.vue +0 -298
  67. package/components/forms/input-textarea/InputTextareaCore.vue +0 -234
  68. package/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +0 -267
  69. package/components/forms/toggle-switch/ToggleSwitchCore.vue +0 -216
  70. package/components/forms/toggle-switch/variants/ToggleSwitchWithLabel.vue +0 -105
  71. package/components/forms/toggle-switch/variants/ToggleSwitchWithLabelInline.vue +0 -102
  72. package/components/forms/ui/FormField.vue +0 -78
  73. package/components/forms/ui/FormWrapper.vue +0 -35
  74. package/components/utils/colour-scheme-select/ColourSchemeSelect.vue +0 -270
  75. package/components/utils/colour-scheme-select/ColourSchemeSelectOld.vue +0 -225
  76. package/components/utils/dark-mode-switcher/DarkModeSwitcher.vue +0 -47
  77. package/composables/useApiRequest.ts +0 -25
  78. package/composables/useColourScheme.ts +0 -25
  79. package/composables/useErrorMessages.ts +0 -59
  80. package/composables/useFormControl.ts +0 -248
  81. package/composables/useSleep.ts +0 -5
  82. package/composables/useStyleClassPassthrough.ts +0 -30
  83. package/composables/useZodValidation.ts +0 -148
  84. package/types/types.forms.ts +0 -216
  85. package/types/types.zodFormControl.ts +0 -21
@@ -1,450 +0,0 @@
1
- <template>
2
- <div class="control" ref="control">
3
- <div aria-hidden="true" class="tooltip" ref="toolTip">
4
- <div class="range-label range-low-label" ref="toolTipLow">
5
- {{ rangeLowLabel }}<span class="value">{{ lowValue }} %</span>
6
- </div>
7
- <div class="range-label range-high-label" ref="toolTipHigh">
8
- <span class="value">{{ highValue }} %</span>{{ rangeHighLabel }}
9
- </div>
10
- </div>
11
- <input type="range" v-model="modelValue" ref="inputRef" @input="update()" @pointerdown="update()" :id :name :min :max :step />
12
-
13
- <div class="control__track" ref="controlTrack">
14
- <div class="control__track-slide">
15
- <div class="control__fill"></div>
16
- <div class="control__indicator"></div>
17
- <div class="control__fill"></div>
18
- </div>
19
- </div>
20
- </div>
21
- </template>
22
-
23
- <script setup lang="ts">
24
- import propValidators from '../c12/prop-validators';
25
-
26
- const props = defineProps({
27
- id: {
28
- type: String,
29
- required: true,
30
- },
31
- name: {
32
- type: String,
33
- required: true,
34
- },
35
- min: {
36
- type: Number,
37
- required: true,
38
- },
39
- max: {
40
- type: Number,
41
- required: true,
42
- },
43
- step: {
44
- type: Number,
45
- default: 1,
46
- },
47
- rangeLowLabel: {
48
- type: String,
49
- required: true,
50
- },
51
- rangeHighLabel: {
52
- type: String,
53
- required: true,
54
- },
55
- placeholder: {
56
- type: String,
57
- default: '',
58
- },
59
- required: {
60
- type: Boolean,
61
- default: false,
62
- },
63
- theme: {
64
- type: String as PropType<string>,
65
- default: 'primary',
66
- validator(value: string) {
67
- return propValidators.theme.includes(value);
68
- },
69
- },
70
- size: {
71
- type: String as PropType<string>,
72
- default: 'medium',
73
- validator(value: string) {
74
- return propValidators.size.includes(value);
75
- },
76
- },
77
- weight: {
78
- type: String as PropType<string>,
79
- default: 'wght-400',
80
- validator(value: string) {
81
- return propValidators.weight.includes(value);
82
- },
83
- },
84
- fieldHasError: {
85
- type: Boolean,
86
- default: false,
87
- },
88
- styleClassPassthrough: {
89
- type: Array as PropType<string[]>,
90
- default: () => [],
91
- },
92
- });
93
-
94
- const modelValue = defineModel<number | readonly number[]>();
95
-
96
- const control = ref<HTMLDivElement | null>(null);
97
- const controlTrack = ref<HTMLDivElement | null>(null);
98
- const toolTip = ref<HTMLDivElement | null>(null);
99
- const toolTipLow = ref<HTMLDivElement | null>(null);
100
- const toolTipHigh = ref<HTMLDivElement | null>(null);
101
- const inputRef = ref<HTMLInputElement | null>(null);
102
-
103
- // Box sizes
104
- const toolTipWidth = ref(0);
105
- const toolTipLowWidth = ref(0);
106
- const toolTipHighWidth = ref(0);
107
- const toolTipMargin = 20;
108
-
109
- const toolTipLowContainerEnd = computed(() => {
110
- return Math.floor(((toolTipHighWidth.value + toolTipMargin) / toolTipWidth.value) * 100) + '%';
111
- });
112
-
113
- const toolTipHighContainerStart = computed(() => {
114
- return Math.floor(((toolTipWidth.value - (toolTipHighWidth.value + toolTipMargin)) / toolTipWidth.value) * 100) + '%';
115
- });
116
-
117
- const lowValue = computed(() => {
118
- return Math.floor(Number(props.max) - Number(highValue.value));
119
- });
120
- const highValue = computed(() => {
121
- return Math.floor((Number(modelValue.value) / props.max) * 100);
122
- });
123
-
124
- const update = () => {
125
- control.value?.style.setProperty('--value', String(modelValue.value));
126
- const value = typeof modelValue.value === 'number' ? modelValue.value : 0;
127
- controlTrack.value?.style.setProperty('--shift', value > 40 && value < 68 ? '1' : '0');
128
- toolTip.value?.style.setProperty('--shift', value > 40 && value < 68 ? '1' : '0');
129
- };
130
-
131
- const updateBoxSizes = () => {
132
- toolTipWidth.value = toolTip.value?.offsetWidth || 0;
133
- toolTipLowWidth.value = toolTipLow.value?.offsetWidth || 0;
134
- toolTipHighWidth.value = toolTipHigh.value?.offsetWidth || 0;
135
- console.log('toolTipWidth', toolTipWidth.value);
136
- console.log('toolTipLowContainerEnd', toolTipLowContainerEnd.value);
137
- console.log('toolTipHighContainerStart', toolTipHighContainerStart.value);
138
- };
139
-
140
- onMounted(() => {
141
- updateBoxSizes();
142
- if (!CSS.supports('animation-timeline: scroll()')) {
143
- update();
144
- }
145
- });
146
- </script>
147
-
148
- <style lang="css">
149
- @layer foundation {
150
- .control {
151
- position: relative;
152
- display: grid;
153
- place-items: center;
154
- margin: 0 auto;
155
- }
156
-
157
- .control:focus-within,
158
- .control:hover {
159
- --active: 1;
160
- }
161
-
162
- [type='range'] {
163
- width: 100%;
164
- opacity: 0;
165
- height: 6rem;
166
- }
167
-
168
- [type='range']:hover {
169
- cursor: -webkit-grab;
170
- }
171
- [type='range']:active {
172
- cursor: -webkit-grabbing;
173
- }
174
-
175
- [type='range']:focus-visible {
176
- outline-offset: 0.25rem;
177
- outline-color: transparent;
178
- }
179
-
180
- @property --shift {
181
- initial-value: 0;
182
- inherits: true;
183
- syntax: '<integer>';
184
- }
185
-
186
- .tooltip {
187
- font-size: 1rem;
188
- position: absolute;
189
- top: 0;
190
- left: 0;
191
- right: 0;
192
- height: 50%;
193
- pointer-events: none;
194
- transform: translateY(calc(var(--shift, 0) * 50%));
195
- transition: transform var(--speed) var(--timing);
196
- z-index: 2;
197
- }
198
- @keyframes shift {
199
- 0%,
200
- 31%,
201
- 61%,
202
- 100% {
203
- --shift: 0;
204
- }
205
- 32%,
206
- 60% {
207
- --shift: 1;
208
- }
209
- }
210
-
211
- /* .tooltip::after, */
212
- /* .tooltip::before, */
213
- .tooltip .range-label {
214
- display: block;
215
- font-variant: tabular-nums;
216
- position: absolute;
217
- top: 50%;
218
- translate: 0 -50%;
219
- font-weight: bold;
220
- color: white;
221
- font-weight: 40;
222
- font-family: monospace;
223
- }
224
-
225
- [type='range']::-webkit-slider-thumb {
226
- appearance: none;
227
- -webkit-appearance: none;
228
- height: 6rem;
229
- width: 4rem;
230
- margin-top: 0rem;
231
- opacity: 1;
232
- }
233
- [type='range']::-webkit-slider-runnable-track {
234
- -webkit-appearance: none;
235
- height: 6rem;
236
- /* background: hsl(10 80% 50% / 0.5); */
237
- margin-top: 0rem; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
238
- box-shadow: 0.1rem 0.1rem 0.1rem #000000, 0rem 0rem 0.1rem #0d0d0d;
239
- }
240
- [type='range']::-moz-range-track {
241
- height: 6rem;
242
- /* background: hsl(10 80% 50% / 0.5); */
243
- margin-top: 0rem; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
244
- box-shadow: 0.1rem 0.1rem 0.1rem #000000, 0rem 0rem 0.1rem #0d0d0d;
245
- }
246
- }
247
-
248
- @layer scrolls {
249
- @property --value {
250
- initial-value: 0;
251
- syntax: '<integer>';
252
- inherits: true;
253
- }
254
-
255
- @keyframes sync {
256
- to {
257
- --value: 100;
258
- }
259
- }
260
-
261
- [type='range'] {
262
- overflow: hidden;
263
- opacity: 0;
264
- touch-action: none;
265
- /* extras */
266
- accent-color: hsl(24 74% calc(24% + (30% * ((100 - var(--value, 0)) / 100)) / 1) / 0.4);
267
- outline: 0.2rem dashed #0000;
268
- transition-property: outline-color, opacity, translate;
269
- transition-duration: 0.25s;
270
- }
271
-
272
- [data-reveal='true'] [type='range'] {
273
- opacity: 1;
274
- translate: 0 -150%;
275
- outline-color: white;
276
- }
277
-
278
- .control {
279
- width: 100%;
280
- animation: sync both linear reverse, shift both linear;
281
- animation-timeline: --thumb;
282
- animation-range: contain;
283
- container-type: inline-size;
284
- }
285
-
286
- .control__track {
287
- --coffee: hsl(24 74% calc(24% + (30% * ((100 - var(--value, 0)) / 100)) / 1) / 0.4);
288
- --milk: hsl(0 0% 100% / calc(0.1 + (0.4 * ((100 - var(--value, 0)) / 100))));
289
- height: calc(50% + (var(--shift) * 50%));
290
- width: 100%;
291
- position: absolute;
292
- bottom: 0;
293
- pointer-events: none;
294
- transition: height var(--speed) var(--timing);
295
- z-index: 5;
296
- clip-path: inset(0 -0.25rem 0 -0.25rem round 0.6rem);
297
- }
298
-
299
- [data-reveal='true'] .control__track {
300
- clip-path: unset;
301
- outline: 0.2rem dashed white;
302
- }
303
-
304
- .control__track-slide {
305
- height: 100%;
306
- width: 100%;
307
- position: relative;
308
- translate: calc(-50% + (var(--value) * 1cqi)) 0;
309
- transition: translate var(--update);
310
- }
311
- .control__fill {
312
- width: 100%;
313
- height: 100%;
314
- position: absolute;
315
- border-radius: 0.6rem;
316
-
317
- &:nth-of-type(1) {
318
- background: var(--coffee);
319
- right: calc(50% + 0.5rem);
320
- }
321
- &:nth-of-type(3) {
322
- background: var(--milk);
323
- left: calc(50% + 0.5rem);
324
- }
325
- }
326
-
327
- .control__indicator {
328
- height: 75%;
329
- border-radius: 0.4rem;
330
- width: 0.4rem;
331
- position: absolute;
332
- top: 50%;
333
- left: 50%;
334
- background: hsl(0 0% 100% / calc((var(--active, 0) * 0.5) + 0.5));
335
- /* left: calc(var(--value, 0) * 1%); */
336
- z-index: 2;
337
- translate: -50% -50%;
338
- /* transition: left var(--update); */
339
- }
340
-
341
- :root {
342
- --speed: 0.65s;
343
- --update: 0s;
344
- --timing: linear(
345
- 0,
346
- 0.5007 7.21%,
347
- 0.7803 12.29%,
348
- 0.8883 14.93%,
349
- 0.9724 17.63%,
350
- 1.0343 20.44%,
351
- 1.0754 23.44%,
352
- 1.0898 25.22%,
353
- 1.0984 27.11%,
354
- 1.1014 29.15%,
355
- 1.0989 31.4%,
356
- 1.0854 35.23%,
357
- 1.0196 48.86%,
358
- 1.0043 54.06%,
359
- 0.9956 59.6%,
360
- 0.9925 68.11%,
361
- 1
362
- );
363
- timeline-scope: --thumb;
364
- }
365
-
366
- @supports (animation-timeline: scroll()) {
367
- :root {
368
- --speed: 0.65s;
369
- --update: 0.1s;
370
- --timing: linear(
371
- 0,
372
- 0.5007 7.21%,
373
- 0.7803 12.29%,
374
- 0.8883 14.93%,
375
- 0.9724 17.63%,
376
- 1.0343 20.44%,
377
- 1.0754 23.44%,
378
- 1.0898 25.22%,
379
- 1.0984 27.11%,
380
- 1.1014 29.15%,
381
- 1.0989 31.4%,
382
- 1.0854 35.23%,
383
- 1.0196 48.86%,
384
- 1.0043 54.06%,
385
- 0.9956 59.6%,
386
- 0.9925 68.11%,
387
- 1
388
- );
389
- timeline-scope: --thumb;
390
- }
391
-
392
- [type='range']::-webkit-slider-thumb {
393
- view-timeline-name: --thumb;
394
- view-timeline-axis: inline;
395
- }
396
- }
397
- }
398
-
399
- @layer tip {
400
- .tooltip {
401
- counter-set: low var(--value) high calc(100 - var(--value));
402
- z-index: 6;
403
-
404
- /* .tooltip::before {
405
- --range: calc((70 - (var(--value) / 100 * 10)) * 1%);
406
- color: hsl(24 74% 54%);
407
- content: 'COFFEE ' counter(low) '%';
408
- mask: linear-gradient(90deg, hsl(0 0% 100% / 0.6) var(--range), hsl(0 0% 100% / 1) var(--range));
409
- left: 0.5rem;
410
- } */
411
- /* .tooltip::after {
412
- --range: calc((50 - (var(--value) / 100 * 10)) * 1%);
413
- content: counter(high) '% MILK';
414
- mask: linear-gradient(90deg, hsl(0 0% 100% / 1) var(--range), hsl(0 0% 100% / 0.5) var(--range));
415
- right: 0.5rem;
416
- } */
417
-
418
- .range-low-label {
419
- --range: calc((70 - (var(--value) / 100 * 10)) * 1%);
420
-
421
- display: flex;
422
- gap: 1.2rem;
423
- color: hsl(24 74% 54%);
424
- mask: linear-gradient(90deg, hsl(0 0% 100% / 0.6) var(--range), hsl(0 0% 100% / 1) var(--range));
425
- left: 0.5rem;
426
- .low-value {
427
- display: inline-block;
428
- border: 0.1rem solid white;
429
- height: 2rem;
430
- width: 5rem;
431
- }
432
- }
433
-
434
- .range-high-label {
435
- --range: calc((50 - (var(--value) / 100 * 10)) * 1%);
436
-
437
- display: flex;
438
- gap: 1.2rem;
439
- mask: linear-gradient(90deg, hsl(0 0% 100% / 1) var(--range), hsl(0 0% 100% / 0.5) var(--range));
440
- right: 0.5rem;
441
- .high-value {
442
- display: inline-block;
443
- border: 0.1rem solid white;
444
- height: 2rem;
445
- width: 5rem;
446
- }
447
- }
448
- }
449
- }
450
- </style>
@@ -1,124 +0,0 @@
1
- <template>
2
- <div class="input-range-fancy-with-label" :data-form-theme="formTheme" :class="[elementClasses, { error: fieldHasError }]">
3
- <label class="input-range-fancy-label body-normal-bold" :for="id">{{ label }}</label>
4
- <template v-if="hasDescription">
5
- <slot name="description"></slot>
6
- </template>
7
-
8
- <InputRangeFancyCore v-model="modelValue" :id :name :rangeLowLabel :rangeHighLabel :min :max :step :theme :required :size :weight :fieldHasError />
9
- <InputError :errorMessage :showError="fieldHasError" :id :isDetached="true" :styleClassPassthrough="['mbe-20']" />
10
- </div>
11
- </template>
12
-
13
- <script setup lang="ts">
14
- import propValidators from '../c12/prop-validators';
15
-
16
- const props = defineProps({
17
- id: {
18
- type: String,
19
- required: true,
20
- },
21
- name: {
22
- type: String,
23
- required: true,
24
- },
25
- label: {
26
- type: String,
27
- required: true,
28
- },
29
- rangeLowLabel: {
30
- type: String,
31
- required: true,
32
- },
33
- rangeHighLabel: {
34
- type: String,
35
- required: true,
36
- },
37
- min: {
38
- type: Number,
39
- required: true,
40
- },
41
- max: {
42
- type: Number,
43
- required: true,
44
- },
45
- step: {
46
- type: Number,
47
- default: 1,
48
- },
49
- placeholder: {
50
- type: String,
51
- default: '',
52
- },
53
- errorMessage: {
54
- type: [Object, String],
55
- required: true,
56
- },
57
- fieldHasError: {
58
- type: Boolean,
59
- default: false,
60
- },
61
- required: {
62
- type: Boolean,
63
- default: false,
64
- },
65
- theme: {
66
- type: String as PropType<string>,
67
- default: 'primary',
68
- validator(value: string) {
69
- return propValidators.theme.includes(value);
70
- },
71
- },
72
- size: {
73
- type: String as PropType<string>,
74
- default: 'medium',
75
- validator(value: string) {
76
- return propValidators.size.includes(value);
77
- },
78
- },
79
- weight: {
80
- type: String as PropType<string>,
81
- default: 'wght-400',
82
- validator(value: string) {
83
- return propValidators.weight.includes(value);
84
- },
85
- },
86
- styleClassPassthrough: {
87
- type: Array as PropType<string[]>,
88
- default: () => [],
89
- },
90
- deepCssClassPassthrough: {
91
- type: String,
92
- default: '',
93
- },
94
- });
95
-
96
- const slots = useSlots();
97
- const hasDescription = computed(() => slots.description !== undefined);
98
- const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
99
-
100
- const formTheme = computed(() => {
101
- return props.fieldHasError ? 'error' : props.theme;
102
- });
103
-
104
- const modelValue = defineModel<number | readonly number[]>();
105
- </script>
106
-
107
- <style lang="css">
108
- .input-range-fancy-with-label {
109
- .input-range-fancy-label {
110
- display: block;
111
- margin-block: 0.8rem;
112
-
113
- &:hover {
114
- cursor: pointer;
115
- }
116
- }
117
-
118
- .label-description {
119
- font-family: var(--font-family);
120
- font-size: 1.6rem;
121
- margin-top: 1.2rem;
122
- }
123
- }
124
- </style>