srcdev-nuxt-forms 6.1.16 → 6.1.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.
Files changed (37) hide show
  1. package/app/components/forms/form-errors/InputError.vue +19 -11
  2. package/app/components/forms/form-fieldset/FormFieldset.vue +1 -1
  3. package/app/components/forms/input-button/InputButtonCore.vue +1 -1
  4. package/app/components/forms/input-button/variants/InputButtonConfirm.vue +25 -13
  5. package/app/components/forms/input-button/variants/InputButtonSubmit.vue +25 -13
  6. package/app/components/forms/input-checkbox/MultipleCheckboxes.vue +1 -1
  7. package/app/components/forms/input-checkbox/SingleCheckbox.vue +1 -1
  8. package/app/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +1 -1
  9. package/app/components/forms/input-checkbox-radio/InputCheckboxRadioCore.vue +1 -1
  10. package/app/components/forms/input-checkbox-radio/InputCheckboxRadioWithLabel.vue +1 -1
  11. package/app/components/forms/input-description/InputDescription.vue +1 -1
  12. package/app/components/forms/input-label/InputLabel.vue +1 -1
  13. package/app/components/forms/input-number/InputNumberCore.vue +1 -1
  14. package/app/components/forms/input-number/variants/InputNumberDefault.vue +1 -1
  15. package/app/components/forms/input-radio/MultipleRadiobuttons.vue +1 -1
  16. package/app/components/forms/input-range/InputRangeCore.vue +1 -1
  17. package/app/components/forms/input-range/variants/InputRangeDefault.vue +1 -1
  18. package/app/components/forms/input-range-fancy/InputRangeFancyCore.vue +74 -61
  19. package/app/components/forms/input-range-fancy/InputRangeFancyWithLabel.vue +1 -1
  20. package/app/components/forms/input-select/InputSelectCore.vue +43 -23
  21. package/app/components/forms/input-select/variants/InputSelectWithLabel.vue +1 -1
  22. package/app/components/forms/input-text/InputTextCore.vue +1 -1
  23. package/app/components/forms/input-text/variants/InputPasswordWithLabel.vue +27 -27
  24. package/app/components/forms/input-text/variants/InputTextAsNumberWithLabel.vue +1 -1
  25. package/app/components/forms/input-text/variants/InputTextWithLabel.vue +1 -1
  26. package/app/components/forms/input-textarea/InputTextareaCore.vue +1 -1
  27. package/app/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +1 -1
  28. package/app/components/forms/toggle-switch/ToggleSwitchCore.vue +1 -1
  29. package/app/components/forms/toggle-switch/ToggleSwitchCoreOld.vue +1 -1
  30. package/app/components/forms/toggle-switch/variants/ToggleSwitchWithLabel.vue +1 -1
  31. package/app/components/forms/toggle-switch/variants/ToggleSwitchWithLabelInline.vue +1 -1
  32. package/app/components/forms/triple-toggle-switch/TripleToggleSwitchCore.vue +1 -1
  33. package/app/components/utils/colour-scheme-select/ColourSchemeSelect.vue +1 -1
  34. package/app/components/utils/colour-scheme-select/ColourSchemeSelectOld.vue +21 -18
  35. package/app/components/utils/dark-mode-switcher/DarkModeSwitcher.vue +1 -1
  36. package/app/composables/useStyleClassPassthrough.ts +21 -19
  37. package/package.json +6 -6
@@ -1,5 +1,12 @@
1
1
  <template>
2
- <div class="input-error-message" data-theme="error" :id :class="[inputVariant, elementClasses, { show: showError }, { detached: isDetached }]" :data-testid :aria-hidden="!showError">
2
+ <div
3
+ class="input-error-message"
4
+ data-theme="error"
5
+ :id
6
+ :class="[inputVariant, elementClasses, { show: showError }, { detached: isDetached }]"
7
+ :data-testid
8
+ :aria-hidden="!showError"
9
+ >
3
10
  <div class="inner" :class="[{ show: showError }]">
4
11
  <div class="inner-content">
5
12
  <div class="inner-icon">
@@ -19,12 +26,12 @@
19
26
  </template>
20
27
 
21
28
  <script setup lang="ts">
22
- import propValidators from '../c12/prop-validators';
29
+ import propValidators from "../c12/prop-validators"
23
30
 
24
31
  const props = defineProps({
25
32
  dataTestid: {
26
33
  type: String,
27
- default: 'inputError',
34
+ default: "inputError",
28
35
  },
29
36
  errorMessage: {
30
37
  type: [Array, Object, String],
@@ -39,7 +46,7 @@ const props = defineProps({
39
46
  required: true,
40
47
  },
41
48
  styleClassPassthrough: {
42
- type: Array as PropType<string[]>,
49
+ type: [String, Array] as PropType<string | string[]>,
43
50
  default: () => [],
44
51
  },
45
52
  compact: {
@@ -52,18 +59,18 @@ const props = defineProps({
52
59
  },
53
60
  inputVariant: {
54
61
  type: String as PropType<string>,
55
- default: 'normal',
62
+ default: "normal",
56
63
  validator(value: string) {
57
- return propValidators.inputVariant.includes(value);
64
+ return propValidators.inputVariant.includes(value)
58
65
  },
59
66
  },
60
- });
67
+ })
61
68
 
62
69
  const isArray = computed(() => {
63
- return Array.isArray(props.errorMessage);
64
- });
70
+ return Array.isArray(props.errorMessage)
71
+ })
65
72
 
66
- const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
73
+ const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
67
74
  </script>
68
75
 
69
76
  <style lang="css">
@@ -121,7 +128,8 @@ const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.
121
128
  align-items: center;
122
129
 
123
130
  overflow: hidden;
124
- transition: opacity var(--theme-form-transition-duration) linear, display var(--theme-form-transition-duration) linear allow-discrete;
131
+ transition: opacity var(--theme-form-transition-duration) linear,
132
+ display var(--theme-form-transition-duration) linear allow-discrete;
125
133
 
126
134
  .inner-content {
127
135
  display: flex;
@@ -52,7 +52,7 @@ const props = defineProps({
52
52
  default: "",
53
53
  },
54
54
  styleClassPassthrough: {
55
- type: Array as PropType<string[]>,
55
+ type: [String, Array] as PropType<string | string[]>,
56
56
  default: () => [],
57
57
  },
58
58
  })
@@ -70,7 +70,7 @@ const props = defineProps({
70
70
  default: "",
71
71
  },
72
72
  styleClassPassthrough: {
73
- type: Array as PropType<string[]>,
73
+ type: [String, Array] as PropType<string | string[]>,
74
74
  default: () => [],
75
75
  },
76
76
  useEffect: {
@@ -1,5 +1,17 @@
1
1
  <template>
2
- <InputButtonCore type="button" :use-effect :isPending :readonly :effect :data-testid :size :weight :button-text :style-class-passthrough :theme>
2
+ <InputButtonCore
3
+ type="button"
4
+ :use-effect
5
+ :isPending
6
+ :readonly
7
+ :effect
8
+ :data-testid
9
+ :size
10
+ :weight
11
+ :button-text
12
+ :style-class-passthrough
13
+ :theme
14
+ >
3
15
  <template #left>
4
16
  <Icon name="material-symbols:check-circle-outline" class="icon" aria-hidden="true" focusable="false" />
5
17
  </template>
@@ -7,28 +19,28 @@
7
19
  </template>
8
20
 
9
21
  <script setup lang="ts">
10
- import propValidators from '../../c12/prop-validators';
22
+ import propValidators from "../../c12/prop-validators"
11
23
 
12
24
  defineProps({
13
25
  size: {
14
26
  type: String as PropType<string>,
15
- default: 'default',
27
+ default: "default",
16
28
  validator(value: string) {
17
- return propValidators.size.includes(value);
29
+ return propValidators.size.includes(value)
18
30
  },
19
31
  },
20
32
  weight: {
21
33
  type: String as PropType<string>,
22
- default: 'wght-400',
34
+ default: "wght-400",
23
35
  validator(value: string) {
24
- return propValidators.weight.includes(value);
36
+ return propValidators.weight.includes(value)
25
37
  },
26
38
  },
27
39
  theme: {
28
40
  type: String as PropType<string>,
29
- default: 'primary',
41
+ default: "primary",
30
42
  validator(value: string) {
31
- return propValidators.theme.includes(value);
43
+ return propValidators.theme.includes(value)
32
44
  },
33
45
  },
34
46
  useEffect: {
@@ -37,9 +49,9 @@ defineProps({
37
49
  },
38
50
  effect: {
39
51
  type: String as PropType<string>,
40
- default: 'fancy',
52
+ default: "fancy",
41
53
  validator(value: string) {
42
- return ['fancy', 'pulse'].includes(value);
54
+ return ["fancy", "pulse"].includes(value)
43
55
  },
44
56
  },
45
57
  buttonText: {
@@ -48,10 +60,10 @@ defineProps({
48
60
  },
49
61
  dataTestid: {
50
62
  type: String,
51
- default: '',
63
+ default: "",
52
64
  },
53
65
  styleClassPassthrough: {
54
- type: Array as PropType<string[]>,
66
+ type: [String, Array] as PropType<string | string[]>,
55
67
  default: () => [],
56
68
  },
57
69
  isPending: {
@@ -62,5 +74,5 @@ defineProps({
62
74
  type: Boolean,
63
75
  default: false,
64
76
  },
65
- });
77
+ })
66
78
  </script>
@@ -1,30 +1,42 @@
1
1
  <template>
2
- <InputButtonCore type="button" :use-effect :isPending :readonly :effect :data-testid :size :weight :button-text :style-class-passthrough :theme />
2
+ <InputButtonCore
3
+ type="button"
4
+ :use-effect
5
+ :isPending
6
+ :readonly
7
+ :effect
8
+ :data-testid
9
+ :size
10
+ :weight
11
+ :button-text
12
+ :style-class-passthrough
13
+ :theme
14
+ />
3
15
  </template>
4
16
 
5
17
  <script setup lang="ts">
6
- import propValidators from '../../c12/prop-validators';
18
+ import propValidators from "../../c12/prop-validators"
7
19
 
8
20
  defineProps({
9
21
  size: {
10
22
  type: String as PropType<string>,
11
- default: 'default',
23
+ default: "default",
12
24
  validator(value: string) {
13
- return propValidators.size.includes(value);
25
+ return propValidators.size.includes(value)
14
26
  },
15
27
  },
16
28
  weight: {
17
29
  type: String as PropType<string>,
18
- default: 'wght-400',
30
+ default: "wght-400",
19
31
  validator(value: string) {
20
- return propValidators.weight.includes(value);
32
+ return propValidators.weight.includes(value)
21
33
  },
22
34
  },
23
35
  theme: {
24
36
  type: String as PropType<string>,
25
- default: 'primary',
37
+ default: "primary",
26
38
  validator(value: string) {
27
- return propValidators.theme.includes(value);
39
+ return propValidators.theme.includes(value)
28
40
  },
29
41
  },
30
42
  useEffect: {
@@ -33,9 +45,9 @@ defineProps({
33
45
  },
34
46
  effect: {
35
47
  type: String as PropType<string>,
36
- default: 'fancy',
48
+ default: "fancy",
37
49
  validator(value: string) {
38
- return ['fancy', 'pulse'].includes(value);
50
+ return ["fancy", "pulse"].includes(value)
39
51
  },
40
52
  },
41
53
  buttonText: {
@@ -44,10 +56,10 @@ defineProps({
44
56
  },
45
57
  dataTestid: {
46
58
  type: String,
47
- default: '',
59
+ default: "",
48
60
  },
49
61
  styleClassPassthrough: {
50
- type: Array as PropType<string[]>,
62
+ type: [String, Array] as PropType<string | string[]>,
51
63
  default: () => [],
52
64
  },
53
65
  isPending: {
@@ -58,5 +70,5 @@ defineProps({
58
70
  type: Boolean,
59
71
  default: false,
60
72
  },
61
- });
73
+ })
62
74
  </script>
@@ -137,7 +137,7 @@ const props = defineProps({
137
137
  default: true,
138
138
  },
139
139
  styleClassPassthrough: {
140
- type: Array as PropType<string[]>,
140
+ type: [String, Array] as PropType<string | string[]>,
141
141
  default: () => [],
142
142
  },
143
143
  theme: {
@@ -110,7 +110,7 @@ const props = defineProps({
110
110
  default: true,
111
111
  },
112
112
  styleClassPassthrough: {
113
- type: Array as PropType<string[]>,
113
+ type: [String, Array] as PropType<string | string[]>,
114
114
  default: () => [],
115
115
  },
116
116
  theme: {
@@ -88,7 +88,7 @@ const props = defineProps({
88
88
  },
89
89
  },
90
90
  styleClassPassthrough: {
91
- type: Array as PropType<string[]>,
91
+ type: [String, Array] as PropType<string | string[]>,
92
92
  default: () => [],
93
93
  },
94
94
  theme: {
@@ -91,7 +91,7 @@ const props = defineProps({
91
91
  default: false,
92
92
  },
93
93
  styleClassPassthrough: {
94
- type: Array as PropType<string[]>,
94
+ type: [String, Array] as PropType<string | string[]>,
95
95
  default: () => [],
96
96
  },
97
97
  ariaDescribedby: {
@@ -78,7 +78,7 @@ const props = defineProps({
78
78
  },
79
79
  },
80
80
  styleClassPassthrough: {
81
- type: Array as PropType<string[]>,
81
+ type: [String, Array] as PropType<string | string[]>,
82
82
  default: () => [],
83
83
  },
84
84
  theme: {
@@ -31,7 +31,7 @@ const props = defineProps({
31
31
  default: false,
32
32
  },
33
33
  styleClassPassthrough: {
34
- type: Array as PropType<string[]>,
34
+ type: [String, Array] as PropType<string | string[]>,
35
35
  default: () => [],
36
36
  },
37
37
  theme: {
@@ -22,7 +22,7 @@ const props = defineProps({
22
22
  default: false,
23
23
  },
24
24
  styleClassPassthrough: {
25
- type: Array as PropType<string[]>,
25
+ type: [String, Array] as PropType<string | string[]>,
26
26
  default: () => [],
27
27
  },
28
28
  theme: {
@@ -90,7 +90,7 @@ const props = defineProps({
90
90
  default: false,
91
91
  },
92
92
  styleClassPassthrough: {
93
- type: Array as PropType<string[]>,
93
+ type: [String, Array] as PropType<string | string[]>,
94
94
  default: () => [],
95
95
  },
96
96
  })
@@ -132,7 +132,7 @@ const props = defineProps({
132
132
  },
133
133
  },
134
134
  styleClassPassthrough: {
135
- type: Array as PropType<string[]>,
135
+ type: [String, Array] as PropType<string | string[]>,
136
136
  default: () => [],
137
137
  },
138
138
  })
@@ -130,7 +130,7 @@ const props = defineProps({
130
130
  default: true,
131
131
  },
132
132
  styleClassPassthrough: {
133
- type: Array as PropType<string[]>,
133
+ type: [String, Array] as PropType<string | string[]>,
134
134
  default: () => [],
135
135
  },
136
136
  theme: {
@@ -93,7 +93,7 @@ const props = defineProps({
93
93
  default: false,
94
94
  },
95
95
  styleClassPassthrough: {
96
- type: Array as PropType<string[]>,
96
+ type: [String, Array] as PropType<string | string[]>,
97
97
  default: () => [],
98
98
  },
99
99
  })
@@ -130,7 +130,7 @@ const {
130
130
  },
131
131
  },
132
132
  styleClassPassthrough: {
133
- type: Array as PropType<string[]>,
133
+ type: [String, Array] as PropType<string | string[]>,
134
134
  default: () => [],
135
135
  },
136
136
  deepCssClassPassthrough: {
@@ -2,13 +2,26 @@
2
2
  <div class="control" ref="control">
3
3
  <div aria-hidden="true" class="tooltip" ref="toolTip">
4
4
  <div class="range-label range-low-label" ref="toolTipLow">
5
- {{ rangeLowLabel }}<span class="value">{{ lowValue }} %</span>
5
+ {{ rangeLowLabel }}
6
+ <span class="value">{{ lowValue }} %</span>
6
7
  </div>
7
8
  <div class="range-label range-high-label" ref="toolTipHigh">
8
- <span class="value">{{ highValue }} %</span>{{ rangeHighLabel }}
9
+ <span class="value">{{ highValue }} %</span>
10
+ {{ rangeHighLabel }}
9
11
  </div>
10
12
  </div>
11
- <input type="range" v-model="modelValue" ref="inputRef" @input="update()" @pointerdown="update()" :id :name :min :max :step />
13
+ <input
14
+ type="range"
15
+ v-model="modelValue"
16
+ ref="inputRef"
17
+ @input="update()"
18
+ @pointerdown="update()"
19
+ :id
20
+ :name
21
+ :min
22
+ :max
23
+ :step
24
+ />
12
25
 
13
26
  <div class="control__track" ref="controlTrack">
14
27
  <div class="control__track-slide">
@@ -21,7 +34,7 @@
21
34
  </template>
22
35
 
23
36
  <script setup lang="ts">
24
- import propValidators from '../c12/prop-validators';
37
+ import propValidators from "../c12/prop-validators"
25
38
 
26
39
  const props = defineProps({
27
40
  id: {
@@ -54,7 +67,7 @@ const props = defineProps({
54
67
  },
55
68
  placeholder: {
56
69
  type: String,
57
- default: '',
70
+ default: "",
58
71
  },
59
72
  required: {
60
73
  type: Boolean,
@@ -62,23 +75,23 @@ const props = defineProps({
62
75
  },
63
76
  theme: {
64
77
  type: String as PropType<string>,
65
- default: 'primary',
78
+ default: "primary",
66
79
  validator(value: string) {
67
- return propValidators.theme.includes(value);
80
+ return propValidators.theme.includes(value)
68
81
  },
69
82
  },
70
83
  size: {
71
84
  type: String as PropType<string>,
72
- default: 'medium',
85
+ default: "medium",
73
86
  validator(value: string) {
74
- return propValidators.size.includes(value);
87
+ return propValidators.size.includes(value)
75
88
  },
76
89
  },
77
90
  weight: {
78
91
  type: String as PropType<string>,
79
- default: 'wght-400',
92
+ default: "wght-400",
80
93
  validator(value: string) {
81
- return propValidators.weight.includes(value);
94
+ return propValidators.weight.includes(value)
82
95
  },
83
96
  },
84
97
  fieldHasError: {
@@ -86,63 +99,63 @@ const props = defineProps({
86
99
  default: false,
87
100
  },
88
101
  styleClassPassthrough: {
89
- type: Array as PropType<string[]>,
102
+ type: [String, Array] as PropType<string | string[]>,
90
103
  default: () => [],
91
104
  },
92
- });
105
+ })
93
106
 
94
- const modelValue = defineModel<number | readonly number[]>();
107
+ const modelValue = defineModel<number | readonly number[]>()
95
108
 
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);
109
+ const control = ref<HTMLDivElement | null>(null)
110
+ const controlTrack = ref<HTMLDivElement | null>(null)
111
+ const toolTip = ref<HTMLDivElement | null>(null)
112
+ const toolTipLow = ref<HTMLDivElement | null>(null)
113
+ const toolTipHigh = ref<HTMLDivElement | null>(null)
114
+ const inputRef = ref<HTMLInputElement | null>(null)
102
115
 
103
116
  // Box sizes
104
- const toolTipWidth = ref(0);
105
- const toolTipLowWidth = ref(0);
106
- const toolTipHighWidth = ref(0);
107
- const toolTipMargin = 20;
117
+ const toolTipWidth = ref(0)
118
+ const toolTipLowWidth = ref(0)
119
+ const toolTipHighWidth = ref(0)
120
+ const toolTipMargin = 20
108
121
 
109
122
  const toolTipLowContainerEnd = computed(() => {
110
- return Math.floor(((toolTipHighWidth.value + toolTipMargin) / toolTipWidth.value) * 100) + '%';
111
- });
123
+ return Math.floor(((toolTipHighWidth.value + toolTipMargin) / toolTipWidth.value) * 100) + "%"
124
+ })
112
125
 
113
126
  const toolTipHighContainerStart = computed(() => {
114
- return Math.floor(((toolTipWidth.value - (toolTipHighWidth.value + toolTipMargin)) / toolTipWidth.value) * 100) + '%';
115
- });
127
+ return Math.floor(((toolTipWidth.value - (toolTipHighWidth.value + toolTipMargin)) / toolTipWidth.value) * 100) + "%"
128
+ })
116
129
 
117
130
  const lowValue = computed(() => {
118
- return Math.floor(Number(props.max) - Number(highValue.value));
119
- });
131
+ return Math.floor(Number(props.max) - Number(highValue.value))
132
+ })
120
133
  const highValue = computed(() => {
121
- return Math.floor((Number(modelValue.value) / props.max) * 100);
122
- });
134
+ return Math.floor((Number(modelValue.value) / props.max) * 100)
135
+ })
123
136
 
124
137
  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
- };
138
+ control.value?.style.setProperty("--value", String(modelValue.value))
139
+ const value = typeof modelValue.value === "number" ? modelValue.value : 0
140
+ controlTrack.value?.style.setProperty("--shift", value > 40 && value < 68 ? "1" : "0")
141
+ toolTip.value?.style.setProperty("--shift", value > 40 && value < 68 ? "1" : "0")
142
+ }
130
143
 
131
144
  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
- };
145
+ toolTipWidth.value = toolTip.value?.offsetWidth || 0
146
+ toolTipLowWidth.value = toolTipLow.value?.offsetWidth || 0
147
+ toolTipHighWidth.value = toolTipHigh.value?.offsetWidth || 0
148
+ console.log("toolTipWidth", toolTipWidth.value)
149
+ console.log("toolTipLowContainerEnd", toolTipLowContainerEnd.value)
150
+ console.log("toolTipHighContainerStart", toolTipHighContainerStart.value)
151
+ }
139
152
 
140
153
  onMounted(() => {
141
- updateBoxSizes();
142
- if (!CSS.supports('animation-timeline: scroll()')) {
143
- update();
154
+ updateBoxSizes()
155
+ if (!CSS.supports("animation-timeline: scroll()")) {
156
+ update()
144
157
  }
145
- });
158
+ })
146
159
  </script>
147
160
 
148
161
  <style lang="css">
@@ -159,20 +172,20 @@ onMounted(() => {
159
172
  --active: 1;
160
173
  }
161
174
 
162
- [type='range'] {
175
+ [type="range"] {
163
176
  width: 100%;
164
177
  opacity: 0;
165
178
  height: 6rem;
166
179
  }
167
180
 
168
- [type='range']:hover {
181
+ [type="range"]:hover {
169
182
  cursor: -webkit-grab;
170
183
  }
171
- [type='range']:active {
184
+ [type="range"]:active {
172
185
  cursor: -webkit-grabbing;
173
186
  }
174
187
 
175
- [type='range']:focus-visible {
188
+ [type="range"]:focus-visible {
176
189
  outline-offset: var(--form-element-outline-offset-focus);
177
190
  outline-color: transparent;
178
191
  }
@@ -180,7 +193,7 @@ onMounted(() => {
180
193
  @property --shift {
181
194
  initial-value: 0;
182
195
  inherits: true;
183
- syntax: '<integer>';
196
+ syntax: "<integer>";
184
197
  }
185
198
 
186
199
  .tooltip {
@@ -222,7 +235,7 @@ onMounted(() => {
222
235
  font-family: monospace;
223
236
  }
224
237
 
225
- [type='range']::-webkit-slider-thumb {
238
+ [type="range"]::-webkit-slider-thumb {
226
239
  appearance: none;
227
240
  -webkit-appearance: none;
228
241
  height: 6rem;
@@ -230,14 +243,14 @@ onMounted(() => {
230
243
  margin-top: 0rem;
231
244
  opacity: 1;
232
245
  }
233
- [type='range']::-webkit-slider-runnable-track {
246
+ [type="range"]::-webkit-slider-runnable-track {
234
247
  -webkit-appearance: none;
235
248
  height: 6rem;
236
249
  /* background: hsl(10 80% 50% / 0.5); */
237
250
  margin-top: 0rem; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
238
251
  box-shadow: 0.1rem 0.1rem 0.1rem #000000, 0rem 0rem 0.1rem #0d0d0d;
239
252
  }
240
- [type='range']::-moz-range-track {
253
+ [type="range"]::-moz-range-track {
241
254
  height: 6rem;
242
255
  /* background: hsl(10 80% 50% / 0.5); */
243
256
  margin-top: 0rem; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
@@ -248,7 +261,7 @@ onMounted(() => {
248
261
  @layer scrolls {
249
262
  @property --value {
250
263
  initial-value: 0;
251
- syntax: '<integer>';
264
+ syntax: "<integer>";
252
265
  inherits: true;
253
266
  }
254
267
 
@@ -258,7 +271,7 @@ onMounted(() => {
258
271
  }
259
272
  }
260
273
 
261
- [type='range'] {
274
+ [type="range"] {
262
275
  overflow: hidden;
263
276
  opacity: 0;
264
277
  touch-action: none;
@@ -269,7 +282,7 @@ onMounted(() => {
269
282
  transition-duration: 0.25s;
270
283
  }
271
284
 
272
- [data-reveal='true'] [type='range'] {
285
+ [data-reveal="true"] [type="range"] {
273
286
  opacity: 1;
274
287
  translate: 0 -150%;
275
288
  outline-color: white;
@@ -296,7 +309,7 @@ onMounted(() => {
296
309
  clip-path: inset(0 -0.25rem 0 -0.25rem round 0.6rem);
297
310
  }
298
311
 
299
- [data-reveal='true'] .control__track {
312
+ [data-reveal="true"] .control__track {
300
313
  clip-path: unset;
301
314
  outline: 0.2rem dashed white;
302
315
  }
@@ -389,7 +402,7 @@ onMounted(() => {
389
402
  timeline-scope: --thumb;
390
403
  }
391
404
 
392
- [type='range']::-webkit-slider-thumb {
405
+ [type="range"]::-webkit-slider-thumb {
393
406
  view-timeline-name: --thumb;
394
407
  view-timeline-axis: inline;
395
408
  }
@@ -98,7 +98,7 @@ const props = defineProps({
98
98
  },
99
99
  },
100
100
  styleClassPassthrough: {
101
- type: Array as PropType<string[]>,
101
+ type: [String, Array] as PropType<string | string[]>,
102
102
  default: () => [],
103
103
  },
104
104
  deepCssClassPassthrough: {
@@ -1,9 +1,28 @@
1
1
  <template>
2
- <div class="input-select-wrapper" :data-theme="formTheme" :data-size="size" :class="[inputVariant, size, { dirty: isDirty }, { active: isActive }, { error: fieldHasError }]">
2
+ <div
3
+ class="input-select-wrapper"
4
+ :data-theme="formTheme"
5
+ :data-size="size"
6
+ :class="[inputVariant, size, { dirty: isDirty }, { active: isActive }, { error: fieldHasError }]"
7
+ >
3
8
  <select v-model="modelValue" class="input-select-core" :name :id :title>
4
- <option v-if="placeholder" value="" readonly :selected="!modelValue" class="input-select-core-option placeholder">{{ placeholder }}</option>
5
- <option v-for="item in fieldData.data" :key="item.id" :value="item.value" :selected="item.value === modelValue" class="input-select-core-option">
6
- <Icon v-if="item.icon" :name="item.icon" class="input-select-core-option-decorator-icon" aria-hidden="true" focusable="false" />
9
+ <option v-if="placeholder" value="" readonly :selected="!modelValue" class="input-select-core-option placeholder">
10
+ {{ placeholder }}
11
+ </option>
12
+ <option
13
+ v-for="item in fieldData.data"
14
+ :key="item.id"
15
+ :value="item.value"
16
+ :selected="item.value === modelValue"
17
+ class="input-select-core-option"
18
+ >
19
+ <Icon
20
+ v-if="item.icon"
21
+ :name="item.icon"
22
+ class="input-select-core-option-decorator-icon"
23
+ aria-hidden="true"
24
+ focusable="false"
25
+ />
7
26
  {{ item.label }}
8
27
  </option>
9
28
  </select>
@@ -11,8 +30,8 @@
11
30
  </template>
12
31
 
13
32
  <script setup lang="ts">
14
- import propValidators from '../c12/prop-validators';
15
- import type { IFormMultipleOptions } from '../../../../shared/types/types.forms';
33
+ import propValidators from "../c12/prop-validators"
34
+ import type { IFormMultipleOptions } from "../../../../shared/types/types.forms"
16
35
 
17
36
  const props = defineProps({
18
37
  id: {
@@ -25,11 +44,11 @@ const props = defineProps({
25
44
  },
26
45
  placeholder: {
27
46
  type: String,
28
- default: '',
47
+ default: "",
29
48
  },
30
49
  title: {
31
50
  type: String,
32
- default: 'Please select an option',
51
+ default: "Please select an option",
33
52
  },
34
53
  required: {
35
54
  type: Boolean,
@@ -41,39 +60,39 @@ const props = defineProps({
41
60
  },
42
61
  size: {
43
62
  type: String as PropType<string>,
44
- default: 'medium',
63
+ default: "medium",
45
64
  validator(value: string) {
46
- return propValidators.size.includes(value);
65
+ return propValidators.size.includes(value)
47
66
  },
48
67
  },
49
68
  styleClassPassthrough: {
50
- type: Array as PropType<string[]>,
69
+ type: [String, Array] as PropType<string | string[]>,
51
70
  default: () => [],
52
71
  },
53
72
  theme: {
54
73
  type: String as PropType<string>,
55
- default: 'primary',
74
+ default: "primary",
56
75
  validator(value: string) {
57
- return propValidators.theme.includes(value);
76
+ return propValidators.theme.includes(value)
58
77
  },
59
78
  },
60
79
  inputVariant: {
61
80
  type: String as PropType<string>,
62
- default: 'normal',
81
+ default: "normal",
63
82
  validator(value: string) {
64
- return propValidators.inputVariant.includes(value);
83
+ return propValidators.inputVariant.includes(value)
65
84
  },
66
85
  },
67
- });
86
+ })
68
87
 
69
88
  const formTheme = computed(() => {
70
- return props.fieldHasError ? 'error' : props.theme;
71
- });
89
+ return props.fieldHasError ? "error" : props.theme
90
+ })
72
91
 
73
- const modelValue = defineModel({ required: true });
74
- const isDirty = defineModel('isDirty');
75
- const isActive = defineModel('isActive');
76
- const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
92
+ const modelValue = defineModel({ required: true })
93
+ const isDirty = defineModel("isDirty")
94
+ const isActive = defineModel("isActive")
95
+ const fieldData = defineModel("fieldData") as Ref<IFormMultipleOptions>
77
96
  </script>
78
97
 
79
98
  <style lang="css">
@@ -111,7 +130,8 @@ const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
111
130
  }
112
131
 
113
132
  &::picker(select) {
114
- transition: display allow-discrete var(--theme-form-transition-duration), opacity var(--theme-form-transition-duration), overlay var(--theme-form-transition-duration) allow-discrete;
133
+ transition: display allow-discrete var(--theme-form-transition-duration),
134
+ opacity var(--theme-form-transition-duration), overlay var(--theme-form-transition-duration) allow-discrete;
115
135
  }
116
136
 
117
137
  &:not(:open)::picker(select) {
@@ -119,7 +119,7 @@ const props = defineProps({
119
119
  },
120
120
  },
121
121
  styleClassPassthrough: {
122
- type: Array as PropType<string[]>,
122
+ type: [String, Array] as PropType<string | string[]>,
123
123
  default: () => [],
124
124
  },
125
125
  theme: {
@@ -84,7 +84,7 @@ const props = defineProps({
84
84
  default: false,
85
85
  },
86
86
  styleClassPassthrough: {
87
- type: Array as PropType<string[]>,
87
+ type: [String, Array] as PropType<string | string[]>,
88
88
  default: () => [],
89
89
  },
90
90
  theme: {
@@ -36,12 +36,12 @@
36
36
  </template>
37
37
 
38
38
  <script setup lang="ts">
39
- import propValidators from '../../c12/prop-validators';
39
+ import propValidators from "../../c12/prop-validators"
40
40
 
41
41
  const props = defineProps({
42
42
  type: {
43
- type: String as PropType<'text' | 'password'>,
44
- default: 'password',
43
+ type: String as PropType<"text" | "password">,
44
+ default: "password",
45
45
  },
46
46
  maxlength: {
47
47
  type: Number,
@@ -53,7 +53,7 @@ const props = defineProps({
53
53
  },
54
54
  placeholder: {
55
55
  type: String,
56
- default: '',
56
+ default: "",
57
57
  },
58
58
  label: {
59
59
  type: String,
@@ -72,59 +72,59 @@ const props = defineProps({
72
72
  default: false,
73
73
  },
74
74
  styleClassPassthrough: {
75
- type: Array as PropType<string[]>,
75
+ type: [String, Array] as PropType<string | string[]>,
76
76
  default: () => [],
77
77
  },
78
78
  theme: {
79
79
  type: String as PropType<string>,
80
- default: 'primary',
80
+ default: "primary",
81
81
  validator(value: string) {
82
- return propValidators.theme.includes(value);
82
+ return propValidators.theme.includes(value)
83
83
  },
84
84
  },
85
85
  size: {
86
86
  type: String as PropType<string>,
87
- default: 'medium',
87
+ default: "medium",
88
88
  validator(value: string) {
89
- return propValidators.size.includes(value);
89
+ return propValidators.size.includes(value)
90
90
  },
91
91
  },
92
92
  inputVariant: {
93
93
  type: String as PropType<string>,
94
- default: 'normal',
94
+ default: "normal",
95
95
  validator(value: string) {
96
- return propValidators.inputVariant.includes(value);
96
+ return propValidators.inputVariant.includes(value)
97
97
  },
98
98
  },
99
- });
99
+ })
100
100
 
101
101
  const formTheme = computed(() => {
102
- return props.fieldHasError ? 'error' : props.theme;
103
- });
102
+ return props.fieldHasError ? "error" : props.theme
103
+ })
104
104
 
105
105
  const buttonTheme = computed(() => {
106
- return props.inputVariant === 'underlined' ? 'input-action-underlined' : 'input-action';
107
- });
106
+ return props.inputVariant === "underlined" ? "input-action-underlined" : "input-action"
107
+ })
108
108
 
109
- const modelValue = defineModel();
109
+ const modelValue = defineModel()
110
110
 
111
- const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
111
+ const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
112
112
 
113
113
  const updateFocus = (name: string, isFocused: boolean) => {
114
114
  // console.log('updateFocus', name, isFocused);
115
115
  // modelValue.value.focusedField = isFocused ? name : '';
116
- };
116
+ }
117
117
 
118
- const inputType = ref<'text' | 'password'>(props.type);
118
+ const inputType = ref<"text" | "password">(props.type)
119
119
 
120
- const displayPassword = ref(false);
120
+ const displayPassword = ref(false)
121
121
  const buttonText = computed(() => {
122
- inputType.value = displayPassword.value ? 'text' : 'password';
123
- return displayPassword.value ? 'Hide password' : 'Show password';
124
- });
122
+ inputType.value = displayPassword.value ? "text" : "password"
123
+ return displayPassword.value ? "Hide password" : "Show password"
124
+ })
125
125
  const toggleDisplayPassword = () => {
126
- displayPassword.value = !displayPassword.value;
127
- };
126
+ displayPassword.value = !displayPassword.value
127
+ }
128
128
 
129
- updateElementClasses(['has-right-button']);
129
+ updateElementClasses(["has-right-button"])
130
130
  </script>
@@ -107,7 +107,7 @@ const props = defineProps({
107
107
  default: false,
108
108
  },
109
109
  styleClassPassthrough: {
110
- type: Array as PropType<string[]>,
110
+ type: [String, Array] as PropType<string | string[]>,
111
111
  default: () => [],
112
112
  },
113
113
  theme: {
@@ -125,7 +125,7 @@ const props = defineProps({
125
125
  default: false,
126
126
  },
127
127
  styleClassPassthrough: {
128
- type: Array as PropType<string[]>,
128
+ type: [String, Array] as PropType<string | string[]>,
129
129
  default: () => [],
130
130
  },
131
131
  theme: {
@@ -69,7 +69,7 @@ const props = defineProps({
69
69
  default: false,
70
70
  },
71
71
  styleClassPassthrough: {
72
- type: Array as PropType<string[]>,
72
+ type: [String, Array] as PropType<string | string[]>,
73
73
  default: () => [],
74
74
  },
75
75
  theme: {
@@ -109,7 +109,7 @@ const props = defineProps({
109
109
  default: false,
110
110
  },
111
111
  styleClassPassthrough: {
112
- type: Array as PropType<string[]>,
112
+ type: [String, Array] as PropType<string | string[]>,
113
113
  default: () => [],
114
114
  },
115
115
  theme: {
@@ -66,7 +66,7 @@ const props = defineProps({
66
66
  default: false,
67
67
  },
68
68
  styleClassPassthrough: {
69
- type: Array as PropType<string[]>,
69
+ type: [String, Array] as PropType<string | string[]>,
70
70
  default: () => [],
71
71
  },
72
72
  theme: {
@@ -56,7 +56,7 @@ const props = defineProps({
56
56
  default: false,
57
57
  },
58
58
  styleClassPassthrough: {
59
- type: Array as PropType<string[]>,
59
+ type: [String, Array] as PropType<string | string[]>,
60
60
  default: () => [],
61
61
  },
62
62
  theme: {
@@ -74,7 +74,7 @@ const props = defineProps({
74
74
  default: false,
75
75
  },
76
76
  styleClassPassthrough: {
77
- type: Array as PropType<string[]>,
77
+ type: [String, Array] as PropType<string | string[]>,
78
78
  default: () => [],
79
79
  },
80
80
  theme: {
@@ -51,7 +51,7 @@ const props = defineProps({
51
51
  default: false,
52
52
  },
53
53
  styleClassPassthrough: {
54
- type: Array as PropType<string[]>,
54
+ type: [String, Array] as PropType<string | string[]>,
55
55
  default: () => [],
56
56
  },
57
57
  theme: {
@@ -62,7 +62,7 @@ const props = defineProps({
62
62
  default: "250ms",
63
63
  },
64
64
  styleClassPassthrough: {
65
- type: Array as PropType<string[]>,
65
+ type: [String, Array] as PropType<string | string[]>,
66
66
  default: () => [],
67
67
  },
68
68
  })
@@ -60,7 +60,7 @@ const props = defineProps({
60
60
  default: 100,
61
61
  },
62
62
  styleClassPassthrough: {
63
- type: Array as PropType<string[]>,
63
+ type: [String, Array] as PropType<string | string[]>,
64
64
  default: () => [],
65
65
  },
66
66
  })
@@ -38,7 +38,7 @@
38
38
  </template>
39
39
 
40
40
  <script setup lang="ts">
41
- import propValidators from '../../forms/c12/prop-validators';
41
+ import propValidators from "../../forms/c12/prop-validators"
42
42
 
43
43
  defineProps({
44
44
  name: {
@@ -47,27 +47,27 @@ defineProps({
47
47
  },
48
48
  size: {
49
49
  type: String as PropType<string>,
50
- default: 'medium',
50
+ default: "medium",
51
51
  validator(value: string) {
52
- return propValidators.size.includes(value);
52
+ return propValidators.size.includes(value)
53
53
  },
54
54
  },
55
55
  theme: {
56
56
  type: String as PropType<string>,
57
- default: 'primary',
57
+ default: "primary",
58
58
  validator(value: string) {
59
- return propValidators.theme.includes(value);
59
+ return propValidators.theme.includes(value)
60
60
  },
61
61
  },
62
62
  styleClassPassthrough: {
63
- type: Array as PropType<string[]>,
63
+ type: [String, Array] as PropType<string | string[]>,
64
64
  default: () => [],
65
65
  },
66
- });
66
+ })
67
67
 
68
- const colourScheme = ref<'auto' | 'dark' | 'light'>('auto');
68
+ const colourScheme = ref<"auto" | "dark" | "light">("auto")
69
69
 
70
- useColourScheme(colourScheme);
70
+ useColourScheme(colourScheme)
71
71
  </script>
72
72
 
73
73
  <style lang="css">
@@ -92,13 +92,16 @@ useColourScheme(colourScheme);
92
92
 
93
93
  .colour-scheme-select-form {
94
94
  display: grid;
95
- grid-template-areas: 'element-stack';
95
+ grid-template-areas: "element-stack";
96
96
  align-items: center;
97
97
 
98
98
  background-color: var(--theme-form-radio-bg);
99
99
  border: var(--_border-width) solid var(--_border-color);
100
100
 
101
- border-radius: calc((var(--_icon-size) / 2) + var(--_form-padding) + var(--_border-width) + var(--_outline-width) + var(--_form-input-outline-width));
101
+ border-radius: calc(
102
+ (var(--_icon-size) / 2) + var(--_form-padding) + var(--_border-width) + var(--_outline-width) +
103
+ var(--_form-input-outline-width)
104
+ );
102
105
 
103
106
  outline: var(--_outline-width) solid var(--_outline-color);
104
107
  box-shadow: var(--_box-shadow);
@@ -177,37 +180,37 @@ useColourScheme(colourScheme);
177
180
  outline: var(--_form-input-outline-width) solid gray;
178
181
  opacity: 0.75;
179
182
 
180
- &:has(input[value='auto']) {
183
+ &:has(input[value="auto"]) {
181
184
  background-color: green;
182
185
 
183
- &:has(input[value='auto']:checked) {
186
+ &:has(input[value="auto"]:checked) {
184
187
  --_scheme-marker-position: start;
185
188
  outline: var(--_form-input-outline-width) solid var(--_border-color);
186
189
  opacity: 1;
187
190
  }
188
191
  }
189
192
 
190
- &:has(input[value='light']) {
193
+ &:has(input[value="light"]) {
191
194
  background-color: orange;
192
195
 
193
- &:has(input[value='light']:checked) {
196
+ &:has(input[value="light"]:checked) {
194
197
  --_scheme-marker-position: center;
195
198
  outline: var(--_form-input-outline-width) solid var(--_border-color);
196
199
  opacity: 1;
197
200
  }
198
201
  }
199
202
 
200
- &:has(input[value='dark']) {
203
+ &:has(input[value="dark"]) {
201
204
  background-color: black;
202
205
 
203
- &:has(input[value='dark']:checked) {
206
+ &:has(input[value="dark"]:checked) {
204
207
  --_scheme-marker-position: end;
205
208
  outline: var(--_form-input-outline-width) solid var(--_border-color);
206
209
  opacity: 1;
207
210
  }
208
211
  }
209
212
 
210
- input[type='radio'] {
213
+ input[type="radio"] {
211
214
  opacity: 0;
212
215
  height: var(--_icon-size);
213
216
  width: var(--_icon-size);
@@ -45,7 +45,7 @@ defineProps({
45
45
  },
46
46
  },
47
47
  styleClassPassthrough: {
48
- type: Array as PropType<string[]>,
48
+ type: [String, Array] as PropType<string | string[]>,
49
49
  default: () => [],
50
50
  },
51
51
  })
@@ -1,30 +1,32 @@
1
- export const useStyleClassPassthrough = (styleClassPassthrough: string[]) => {
2
- const styleClassPassthroughRef = ref(styleClassPassthrough);
1
+ export const useStyleClassPassthrough = (styleClassPassthrough: string | string[]) => {
2
+ // Normalize initial value to an array
3
+ const normalize = (input: string | string[]): string[] =>
4
+ Array.isArray(input) ? input : input.split(/\s+/).filter(Boolean)
3
5
 
4
- const elementClasses = computed(() => {
5
- return styleClassPassthroughRef.value.join(' ');
6
- });
6
+ const styleClassPassthroughRef = ref<string[]>(normalize(styleClassPassthrough))
7
+
8
+ const elementClasses = computed(() => styleClassPassthroughRef.value.join(" "))
7
9
 
8
10
  const updateElementClasses = (cssClass: string | string[]) => {
9
- let cssClasses = [] as string[];
10
- if (typeof cssClass === 'string') {
11
- cssClasses = [cssClass];
12
- } else if (Array.isArray(cssClass)) {
13
- cssClasses = cssClass;
14
- }
11
+ const cssClasses = Array.isArray(cssClass) ? cssClass : [cssClass]
15
12
 
16
- cssClasses.forEach((cssClass) => {
17
- if (styleClassPassthroughRef.value.includes(cssClass)) {
18
- styleClassPassthroughRef.value = styleClassPassthroughRef.value.filter((className) => className !== cssClass);
13
+ cssClasses.forEach((cls) => {
14
+ if (styleClassPassthroughRef.value.includes(cls)) {
15
+ styleClassPassthroughRef.value = styleClassPassthroughRef.value.filter((c) => c !== cls)
19
16
  } else {
20
- styleClassPassthroughRef.value.push(cssClass);
17
+ styleClassPassthroughRef.value.push(cls)
21
18
  }
22
- });
23
- };
19
+ })
20
+ }
21
+
22
+ const resetElementClasses = (propsClasses: string | string[]) => {
23
+ styleClassPassthroughRef.value = normalize(propsClasses)
24
+ }
24
25
 
25
26
  return {
26
27
  elementClasses,
27
28
  updateElementClasses,
29
+ resetElementClasses,
28
30
  styleClassPassthroughRef,
29
- };
30
- };
31
+ }
32
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-forms",
3
3
  "type": "module",
4
- "version": "6.1.16",
4
+ "version": "6.1.18",
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",
@@ -25,20 +25,20 @@
25
25
  "devDependencies": {
26
26
  "@iconify-json/carbon": "1.2.13",
27
27
  "@iconify-json/gridicons": "1.2.4",
28
- "@iconify-json/material-symbols": "1.2.35",
29
- "@iconify-json/material-symbols-light": "1.2.35",
28
+ "@iconify-json/material-symbols": "1.2.37",
29
+ "@iconify-json/material-symbols-light": "1.2.37",
30
30
  "@iconify-json/radix-icons": "1.2.5",
31
31
  "@nuxt/eslint": "1.9.0",
32
32
  "@nuxt/icon": "2.0.0",
33
33
  "@nuxt/test-utils": "3.19.2",
34
34
  "@vue/test-utils": "2.4.6",
35
- "eslint": "9.35.0",
35
+ "eslint": "9.36.0",
36
36
  "happy-dom": "18.0.1",
37
37
  "nuxt": "4.1.2",
38
- "release-it": "19.0.4",
38
+ "release-it": "19.0.5",
39
39
  "typescript": "5.9.2",
40
40
  "vitest": "3.2.4",
41
- "zod": "4.1.8"
41
+ "zod": "4.1.11"
42
42
  },
43
43
  "dependencies": {
44
44
  "@iconify-json/ph": "1.2.2",