srcdev-nuxt-forms 6.1.0 → 6.1.1

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 (24) hide show
  1. package/app/components/forms/form-fieldset/FormFieldset.vue +19 -10
  2. package/app/components/forms/input-button/InputButtonCore.vue +25 -28
  3. package/app/components/forms/input-checkbox/MultipleCheckboxes.vue +48 -27
  4. package/app/components/forms/input-checkbox/SingleCheckbox.vue +52 -33
  5. package/app/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +40 -22
  6. package/app/components/forms/input-checkbox-radio/InputCheckboxRadioWithLabel.vue +33 -17
  7. package/app/components/forms/input-label/InputLabel.vue +10 -12
  8. package/app/components/forms/input-number/InputNumberCore.vue +26 -22
  9. package/app/components/forms/input-number/variants/InputNumberDefault.vue +50 -27
  10. package/app/components/forms/input-radio/MultipleRadiobuttons.vue +31 -25
  11. package/app/components/forms/input-range/InputRangeCore.vue +30 -28
  12. package/app/components/forms/input-range/variants/InputRangeDefault.vue +45 -28
  13. package/app/components/forms/input-range-fancy/InputRangeFancyWithLabel.vue +31 -18
  14. package/app/components/forms/input-select/variants/InputSelectWithLabel.vue +48 -37
  15. package/app/components/forms/input-text/InputTextCore.vue +4 -6
  16. package/app/components/forms/input-text/variants/InputTextAsNumberWithLabel.vue +42 -33
  17. package/app/components/forms/input-text/variants/InputTextWithLabel.vue +51 -42
  18. package/app/components/forms/input-textarea/InputTextareaCore.vue +29 -24
  19. package/app/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +41 -31
  20. package/app/components/forms/toggle-switch/ToggleSwitchCore.vue +43 -25
  21. package/app/components/forms/toggle-switch/ToggleSwitchCoreOld.vue +36 -22
  22. package/app/components/forms/toggle-switch/variants/ToggleSwitchWithLabel.vue +42 -25
  23. package/app/components/forms/toggle-switch/variants/ToggleSwitchWithLabelInline.vue +30 -26
  24. package/package.json +1 -1
@@ -1,10 +1,19 @@
1
1
  <template>
2
- <fieldset :aria-required="required" :aria-invalid="fieldHasError" role="radiogroup" :id :name class="form-fieldset" :class="[elementClasses, { error: fieldHasError }]" :data-testid="dataTestid">
3
- <legend v-if="legend" class="form-fieldset-legend" :class="[{ 'has-description': hasDescription }]">
2
+ <fieldset
3
+ :aria-required="required"
4
+ :aria-invalid="fieldHasError"
5
+ role="radiogroup"
6
+ :id
7
+ :name
8
+ class="form-fieldset"
9
+ :class="[elementClasses, { error: fieldHasError }]"
10
+ :data-testid="dataTestid"
11
+ >
12
+ <legend v-if="legend" class="form-fieldset-legend" :class="[{ 'has-description': slots.description }]">
4
13
  <slot name="legend">{{ legend }}</slot>
5
14
  </legend>
6
15
 
7
- <div v-if="hasDescriptionSlot" class="form-fieldset-description" :id="`${id}-description`">
16
+ <div v-if="slots.description" class="form-fieldset-description" :id="`${id}-description`">
8
17
  <slot name="description"></slot>
9
18
  </div>
10
19
 
@@ -28,7 +37,7 @@ const props = defineProps({
28
37
  },
29
38
  legend: {
30
39
  type: String,
31
- default: '',
40
+ default: "",
32
41
  },
33
42
  required: {
34
43
  type: Boolean,
@@ -40,18 +49,18 @@ const props = defineProps({
40
49
  },
41
50
  dataTestid: {
42
51
  type: String,
43
- default: '',
52
+ default: "",
44
53
  },
45
54
  styleClassPassthrough: {
46
55
  type: Array as PropType<string[]>,
47
56
  default: () => [],
48
57
  },
49
- });
58
+ })
50
59
 
51
- const slots = useSlots();
52
- const hasDescriptionSlot = computed(() => slots.description !== undefined);
53
- const hasDescription = computed(() => slots.description !== undefined);
54
- const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
60
+ const slots = useSlots()
61
+ // const hasDescriptionSlot = computed(() => slots.description !== undefined);
62
+ const hasDescription = computed(() => slots.description !== undefined)
63
+ const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
55
64
  </script>
56
65
 
57
66
  <style lang="css">
@@ -7,21 +7,21 @@
7
7
  :data-theme="theme"
8
8
  :data-size="size"
9
9
  class="input-button-core"
10
- :class="[`btn-${type}`, effectClass, elementClasses, { 'icon-only': isIconOnly }]"
10
+ :class="[`btn-${type}`, effectClass, elementClasses, { 'icon-only': slots.iconOnly }]"
11
11
  >
12
12
  <span v-if="useEffect && effect == 'fancy'" class="fancy"></span>
13
- <template v-if="hasLeftContent && !isIconOnly">
13
+ <template v-if="slots.left && !slots.iconOnly">
14
14
  <span class="btn-icon left">
15
15
  <slot name="left"></slot>
16
16
  </span>
17
17
  </template>
18
- <span class="btn-text" :class="[weight, { 'sr-only': isIconOnly }]">{{ buttonText }}</span>
19
- <template v-if="hasRightContent && !isIconOnly">
18
+ <span class="btn-text" :class="[weight, { 'sr-only': slots.iconOnly }]">{{ buttonText }}</span>
19
+ <template v-if="slots.right && !slots.iconOnly">
20
20
  <span class="btn-icon right">
21
21
  <slot name="right"></slot>
22
22
  </span>
23
23
  </template>
24
- <template v-if="isIconOnly">
24
+ <template v-if="slots.iconOnly">
25
25
  <span class="btn-icon icon-only">
26
26
  <slot name="iconOnly"></slot>
27
27
  </span>
@@ -30,35 +30,35 @@
30
30
  </template>
31
31
 
32
32
  <script setup lang="ts">
33
- import propValidators from '../c12/prop-validators';
33
+ import propValidators from "../c12/prop-validators"
34
34
 
35
35
  const props = defineProps({
36
36
  size: {
37
37
  type: String as PropType<string>,
38
- default: 'default',
38
+ default: "default",
39
39
  validator(value: string) {
40
- return propValidators.size.includes(value);
40
+ return propValidators.size.includes(value)
41
41
  },
42
42
  },
43
43
  weight: {
44
44
  type: String as PropType<string>,
45
- default: 'wght-400',
45
+ default: "wght-400",
46
46
  validator(value: string) {
47
- return propValidators.weight.includes(value);
47
+ return propValidators.weight.includes(value)
48
48
  },
49
49
  },
50
50
  theme: {
51
51
  type: String as PropType<string>,
52
- default: 'primary',
52
+ default: "primary",
53
53
  validator(value: string) {
54
- return propValidators.theme.includes(value);
54
+ return propValidators.theme.includes(value)
55
55
  },
56
56
  },
57
57
  type: {
58
- type: String as PropType<'submit' | 'button' | 'reset'>,
59
- default: 'button',
58
+ type: String as PropType<"submit" | "button" | "reset">,
59
+ default: "button",
60
60
  validator(value: string) {
61
- return propValidators.inputTypesButton.includes(value);
61
+ return propValidators.inputTypesButton.includes(value)
62
62
  },
63
63
  },
64
64
  buttonText: {
@@ -67,7 +67,7 @@ const props = defineProps({
67
67
  },
68
68
  dataTestid: {
69
69
  type: String,
70
- default: '',
70
+ default: "",
71
71
  },
72
72
  styleClassPassthrough: {
73
73
  type: Array as PropType<string[]>,
@@ -79,9 +79,9 @@ const props = defineProps({
79
79
  },
80
80
  effect: {
81
81
  type: String as PropType<string>,
82
- default: 'fancy',
82
+ default: "fancy",
83
83
  validator(value: string) {
84
- return ['fancy', 'pulse'].includes(value);
84
+ return ["fancy", "pulse"].includes(value)
85
85
  },
86
86
  },
87
87
  isPending: {
@@ -92,23 +92,20 @@ const props = defineProps({
92
92
  type: Boolean,
93
93
  default: false,
94
94
  },
95
- });
95
+ })
96
96
 
97
- const type = toRef(() => props.type);
97
+ const type = toRef(() => props.type)
98
98
  const effectClass = computed(() => {
99
99
  if (props.useEffect) {
100
- return props.effect === 'fancy' ? '' : props.effect;
100
+ return props.effect === "fancy" ? "" : props.effect
101
101
  } else {
102
- return '';
102
+ return ""
103
103
  }
104
- });
104
+ })
105
105
 
106
- const slots = useSlots();
107
- const hasLeftContent = computed(() => slots.left !== undefined);
108
- const hasRightContent = computed(() => slots.right !== undefined);
109
- const isIconOnly = computed(() => slots.iconOnly !== undefined);
106
+ const slots = useSlots()
110
107
 
111
- const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
108
+ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
112
109
  </script>
113
110
 
114
111
  <style lang="css">
@@ -1,5 +1,13 @@
1
1
  <template>
2
- <FormFieldset :id :name :legend :fieldHasError :required :data-testid :styleClassPassthrough="['multiple-checkboxes-fieldset']">
2
+ <FormFieldset
3
+ :id
4
+ :name
5
+ :legend
6
+ :fieldHasError
7
+ :required
8
+ :data-testid
9
+ :styleClassPassthrough="['multiple-checkboxes-fieldset']"
10
+ >
3
11
  <template #description>
4
12
  <slot name="description"></slot>
5
13
  </template>
@@ -61,13 +69,29 @@
61
69
  </template>
62
70
 
63
71
  <script setup lang="ts">
64
- import propValidators from '../c12/prop-validators';
65
- import type { IOptionsConfig, IFormMultipleOptions } from '../../../../shared/types/types.forms';
72
+ import propValidators from "../c12/prop-validators"
73
+ import type { IOptionsConfig, IFormMultipleOptions } from "../../../../shared/types/types.forms"
66
74
 
67
- const { dataTestid, name, legend, label, required, fieldHasError, placeholder, isButton, errorMessage, size, optionsLayout, equalCols, styleClassPassthrough, theme, direction } = defineProps({
75
+ const {
76
+ dataTestid,
77
+ name,
78
+ legend,
79
+ label,
80
+ required,
81
+ fieldHasError,
82
+ placeholder,
83
+ isButton,
84
+ errorMessage,
85
+ size,
86
+ optionsLayout,
87
+ equalCols,
88
+ styleClassPassthrough,
89
+ theme,
90
+ direction,
91
+ } = defineProps({
68
92
  dataTestid: {
69
93
  type: String,
70
- default: 'multiple-checkboxes',
94
+ default: "multiple-checkboxes",
71
95
  },
72
96
  name: {
73
97
  type: String,
@@ -83,7 +107,7 @@ const { dataTestid, name, legend, label, required, fieldHasError, placeholder, i
83
107
  },
84
108
  placeholder: {
85
109
  type: String,
86
- default: '',
110
+ default: "",
87
111
  },
88
112
  isButton: {
89
113
  type: Boolean,
@@ -107,16 +131,16 @@ const { dataTestid, name, legend, label, required, fieldHasError, placeholder, i
107
131
  },
108
132
  size: {
109
133
  type: String as PropType<string>,
110
- default: 'medium',
134
+ default: "medium",
111
135
  validator(value: string) {
112
- return propValidators.size.includes(value);
136
+ return propValidators.size.includes(value)
113
137
  },
114
138
  },
115
139
  optionsLayout: {
116
140
  type: String as PropType<string>,
117
- default: 'equal-widths',
141
+ default: "equal-widths",
118
142
  validator(value: string) {
119
- return propValidators.optionsLayout.includes(value);
143
+ return propValidators.optionsLayout.includes(value)
120
144
  },
121
145
  },
122
146
  equalCols: {
@@ -129,38 +153,35 @@ const { dataTestid, name, legend, label, required, fieldHasError, placeholder, i
129
153
  },
130
154
  theme: {
131
155
  type: String as PropType<string>,
132
- default: 'primary',
156
+ default: "primary",
133
157
  validator(value: string) {
134
- return propValidators.theme.includes(value);
158
+ return propValidators.theme.includes(value)
135
159
  },
136
160
  },
137
161
  direction: {
138
- type: String as PropType<'row' | 'row-reverse'>,
139
- default: 'row',
162
+ type: String as PropType<"row" | "row-reverse">,
163
+ default: "row",
140
164
  validator(value: string) {
141
- return ['row', 'row-reverse'].includes(value);
165
+ return ["row", "row-reverse"].includes(value)
142
166
  },
143
167
  },
144
168
  displayAsDisc: {
145
169
  type: Boolean,
146
170
  default: false,
147
171
  },
148
- });
172
+ })
149
173
 
150
- const slots = useSlots();
151
- const hasDescriptionSlot = computed(() => slots.description !== undefined);
152
- const hasDescription = computed(() => slots.description !== undefined);
153
- const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
174
+ const slots = useSlots()
154
175
 
155
- const modelValue = defineModel();
156
- const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
176
+ const modelValue = defineModel()
177
+ const fieldData = defineModel("fieldData") as Ref<IFormMultipleOptions>
157
178
 
158
- const id = `${name}-input-${useId()}`;
159
- const errorId = `${name}-error-message`;
179
+ const id = `${name}-input-${useId()}`
180
+ const errorId = `${name}-error-message`
160
181
  const ariaDescribedby = computed(() => {
161
- const ariaDescribedbyId = hasDescriptionSlot.value ? `${name}-description` : undefined;
162
- return fieldHasError ? errorId : ariaDescribedbyId;
163
- });
182
+ const ariaDescribedbyId = slots.description ? `${name}-description` : undefined
183
+ return fieldHasError ? errorId : ariaDescribedbyId
184
+ })
164
185
  </script>
165
186
 
166
187
  <style lang="css">
@@ -1,33 +1,58 @@
1
1
  <template>
2
- <FormFieldset :id :name :legend :fieldHasError :required :data-testid :styleClassPassthrough="['single-checkbox-fieldset']">
2
+ <FormFieldset
3
+ :id
4
+ :name
5
+ :legend
6
+ :fieldHasError
7
+ :required
8
+ :data-testid
9
+ :styleClassPassthrough="['single-checkbox-fieldset']"
10
+ >
3
11
  <template #description>
4
12
  <slot name="description"></slot>
5
13
  </template>
6
14
 
7
15
  <template #content>
8
16
  <div class="single-checkbox-items" :class="[optionsLayout]">
9
- <InputCheckboxRadioWithLabel type="checkbox" :name :required :label :fieldHasError v-model="modelValue" :trueValue :falseValue :size :theme :ariaDescribedby>
17
+ <InputCheckboxRadioWithLabel
18
+ type="checkbox"
19
+ :name
20
+ :required
21
+ :label
22
+ :fieldHasError
23
+ v-model="modelValue"
24
+ :trueValue
25
+ :falseValue
26
+ :size
27
+ :theme
28
+ :ariaDescribedby
29
+ >
10
30
  <template #checkedIcon>
11
31
  <slot name="checkedIcon"></slot>
12
32
  </template>
13
- <template v-if="hasLabelContent" #labelContent>
33
+ <template v-if="slots.labelContent" #labelContent>
14
34
  <slot name="labelContent"></slot>
15
35
  </template>
16
36
  </InputCheckboxRadioWithLabel>
17
37
  </div>
18
- <InputError :errorMessage :showError="fieldHasError" :id="errorId" :isDetached="true" :styleClassPassthrough="inputErrorStyles" />
38
+ <InputError
39
+ :errorMessage
40
+ :showError="fieldHasError"
41
+ :id="errorId"
42
+ :isDetached="true"
43
+ :styleClassPassthrough="inputErrorStyles"
44
+ />
19
45
  </template>
20
46
  </FormFieldset>
21
47
  </template>
22
48
 
23
49
  <script setup lang="ts">
24
- import propValidators from '../c12/prop-validators';
25
- import type { IFormMultipleOptions } from '../../../../shared/types/types.forms';
50
+ import propValidators from "../c12/prop-validators"
26
51
 
27
52
  const props = defineProps({
28
53
  dataTestid: {
29
54
  type: String,
30
- default: 'multiple-radio-buttons',
55
+ default: "multiple-radio-buttons",
31
56
  },
32
57
  name: {
33
58
  type: String,
@@ -40,7 +65,7 @@ const props = defineProps({
40
65
  label: {
41
66
  type: String,
42
67
  required: false,
43
- default: '',
68
+ default: "",
44
69
  },
45
70
  errorMessage: {
46
71
  type: [Object, String],
@@ -60,9 +85,9 @@ const props = defineProps({
60
85
  },
61
86
  size: {
62
87
  type: String as PropType<string>,
63
- default: 'medium',
88
+ default: "medium",
64
89
  validator(value: string) {
65
- return propValidators.size.includes(value);
90
+ return propValidators.size.includes(value)
66
91
  },
67
92
  },
68
93
  trueValue: {
@@ -75,9 +100,9 @@ const props = defineProps({
75
100
  },
76
101
  optionsLayout: {
77
102
  type: String as PropType<string>,
78
- default: 'equal-widths',
103
+ default: "equal-widths",
79
104
  validator(value: string) {
80
- return propValidators.optionsLayout.includes(value);
105
+ return propValidators.optionsLayout.includes(value)
81
106
  },
82
107
  },
83
108
  equalCols: {
@@ -90,39 +115,33 @@ const props = defineProps({
90
115
  },
91
116
  theme: {
92
117
  type: String as PropType<string>,
93
- default: 'primary',
118
+ default: "primary",
94
119
  validator(value: string) {
95
- return propValidators.theme.includes(value);
120
+ return propValidators.theme.includes(value)
96
121
  },
97
122
  },
98
- });
123
+ })
99
124
 
100
- const slots = useSlots();
101
- const hasDescriptionSlot = computed(() => slots.description !== undefined);
102
- const hasDescription = computed(() => slots.description !== undefined);
103
- const hasLabelContent = computed(() => slots.labelContent !== undefined);
125
+ const slots = useSlots()
104
126
 
105
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
127
+ const modelValue = defineModel()
106
128
 
107
- const modelValue = defineModel();
108
- const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
129
+ const inputErrorStyles = ref<string[]>(props.styleClassPassthrough)
109
130
 
110
- const inputErrorStyles = ref<string[]>(props.styleClassPassthrough);
111
-
112
- const id = `${props.name}-input-${useId()}`;
113
- const errorId = `${name}-error-message`;
131
+ const id = `${props.name}-input-${useId()}`
132
+ const errorId = `${name}-error-message`
114
133
  const ariaDescribedby = computed(() => {
115
- const ariaDescribedbyId = hasDescriptionSlot.value ? `${name}-description` : undefined;
116
- return props.fieldHasError ? errorId : ariaDescribedbyId;
117
- });
134
+ const ariaDescribedbyId = slots.description ? `${name}-description` : undefined
135
+ return props.fieldHasError ? errorId : ariaDescribedbyId
136
+ })
118
137
 
119
138
  watchEffect(() => {
120
- if (!hasDescription.value && props.fieldHasError) {
121
- inputErrorStyles.value.push('mbs-12');
139
+ if (!slots.description && props.fieldHasError) {
140
+ inputErrorStyles.value.push("mbs-12")
122
141
  } else {
123
- inputErrorStyles.value = inputErrorStyles.value.filter((style) => style !== 'mbs-12');
142
+ inputErrorStyles.value = inputErrorStyles.value.filter((style) => style !== "mbs-12")
124
143
  }
125
- });
144
+ })
126
145
  </script>
127
146
 
128
147
  <style lang="css">
@@ -1,11 +1,30 @@
1
1
  <template>
2
- <div class="input-checkbox-radio-options-button" :data-theme="formTheme" :data-size="size" :class="[size, elementClasses, optionsLayout, { error: fieldHasError }]">
3
- <InputCheckboxRadioCore :isButton="true" :type :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme :ariaDescribedby :displayAsDisc>
2
+ <div
3
+ class="input-checkbox-radio-options-button"
4
+ :data-theme="formTheme"
5
+ :data-size="size"
6
+ :class="[size, elementClasses, optionsLayout, { error: fieldHasError }]"
7
+ >
8
+ <InputCheckboxRadioCore
9
+ :isButton="true"
10
+ :type
11
+ :id
12
+ :name
13
+ :required
14
+ v-model="modelValue"
15
+ :size
16
+ :trueValue
17
+ :falseValue
18
+ :fieldHasError
19
+ :theme
20
+ :ariaDescribedby
21
+ :displayAsDisc
22
+ >
4
23
  <template #checkedIcon>
5
24
  <slot name="checkedIcon"></slot>
6
25
  </template>
7
26
  </InputCheckboxRadioCore>
8
- <label v-if="hasLabelContent" class="input-checkbox-radio-options-button-label" :for="id">
27
+ <label v-if="slots.labelContent" class="input-checkbox-radio-options-button-label" :for="id">
9
28
  <slot name="labelContent"></slot>
10
29
  </label>
11
30
  <label v-else class="input-checkbox-radio-options-button-label" :for="id">{{ label }}</label>
@@ -18,11 +37,11 @@
18
37
  </template>
19
38
 
20
39
  <script setup lang="ts">
21
- import propValidators from '../c12/prop-validators';
40
+ import propValidators from "../c12/prop-validators"
22
41
 
23
42
  const props = defineProps({
24
43
  type: {
25
- type: String as PropType<'checkbox' | 'radio'>,
44
+ type: String as PropType<"checkbox" | "radio">,
26
45
  required: true,
27
46
  },
28
47
  id: {
@@ -55,16 +74,16 @@ const props = defineProps({
55
74
  },
56
75
  size: {
57
76
  type: String as PropType<string>,
58
- default: 'medium',
77
+ default: "medium",
59
78
  validator(value: string) {
60
- return propValidators.size.includes(value);
79
+ return propValidators.size.includes(value)
61
80
  },
62
81
  },
63
82
  optionsLayout: {
64
83
  type: String as PropType<string>,
65
- default: 'equal-widths',
84
+ default: "equal-widths",
66
85
  validator(value: string) {
67
- return propValidators.optionsLayout.includes(value);
86
+ return propValidators.optionsLayout.includes(value)
68
87
  },
69
88
  },
70
89
  styleClassPassthrough: {
@@ -73,16 +92,16 @@ const props = defineProps({
73
92
  },
74
93
  theme: {
75
94
  type: String as PropType<string>,
76
- default: 'primary',
95
+ default: "primary",
77
96
  validator(value: string) {
78
- return propValidators.theme.includes(value);
97
+ return propValidators.theme.includes(value)
79
98
  },
80
99
  },
81
100
  direction: {
82
- type: String as PropType<'row' | 'row-reverse'>,
83
- default: 'row',
101
+ type: String as PropType<"row" | "row-reverse">,
102
+ default: "row",
84
103
  validator(value: string) {
85
- return ['row', 'row-reverse'].includes(value);
104
+ return ["row", "row-reverse"].includes(value)
86
105
  },
87
106
  },
88
107
  ariaDescribedby: {
@@ -93,19 +112,18 @@ const props = defineProps({
93
112
  type: Boolean,
94
113
  default: false,
95
114
  },
96
- });
115
+ })
97
116
 
98
- const slots = useSlots();
99
- const hasLabelContent = computed(() => slots.labelContent !== undefined);
100
- const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
117
+ const slots = useSlots()
118
+ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
101
119
 
102
- const modelValue = defineModel();
120
+ const modelValue = defineModel()
103
121
 
104
122
  const formTheme = computed(() => {
105
- return props.fieldHasError ? 'error' : props.theme;
106
- });
123
+ return props.fieldHasError ? "error" : props.theme
124
+ })
107
125
 
108
- const flexDirection = ref(props.direction);
126
+ const flexDirection = ref(props.direction)
109
127
  </script>
110
128
 
111
129
  <style lang="css">
@@ -1,12 +1,29 @@
1
1
  <template>
2
- <div class="input-checkbox-radio-with-label" :data-size="size" :class="[elementClasses, optionsLayout, { error: fieldHasError }]">
3
- <InputCheckboxRadioCore :type :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme :ariaDescribedby :displayAsDisc>
2
+ <div
3
+ class="input-checkbox-radio-with-label"
4
+ :data-size="size"
5
+ :class="[elementClasses, optionsLayout, { error: fieldHasError }]"
6
+ >
7
+ <InputCheckboxRadioCore
8
+ :type
9
+ :id
10
+ :name
11
+ :required
12
+ v-model="modelValue"
13
+ :size
14
+ :trueValue
15
+ :falseValue
16
+ :fieldHasError
17
+ :theme
18
+ :ariaDescribedby
19
+ :displayAsDisc
20
+ >
4
21
  <template #checkedIcon>
5
22
  <slot name="checkedIcon"></slot>
6
23
  </template>
7
24
  </InputCheckboxRadioCore>
8
25
 
9
- <label v-if="hasLabelContent" class="input-checkbox-radio-label body-normal" :for="id">
26
+ <label v-if="slots.labelContent" class="input-checkbox-radio-label body-normal" :for="id">
10
27
  <slot name="labelContent"></slot>
11
28
  </label>
12
29
  <label v-else class="input-checkbox-radio-label body-normal-semibold" :for="id">{{ label }}</label>
@@ -14,11 +31,11 @@
14
31
  </template>
15
32
 
16
33
  <script setup lang="ts">
17
- import propValidators from '../c12/prop-validators';
34
+ import propValidators from "../c12/prop-validators"
18
35
 
19
36
  const props = defineProps({
20
37
  type: {
21
- type: String as PropType<'checkbox' | 'radio'>,
38
+ type: String as PropType<"checkbox" | "radio">,
22
39
  required: true,
23
40
  },
24
41
  name: {
@@ -47,16 +64,16 @@ const props = defineProps({
47
64
  },
48
65
  size: {
49
66
  type: String as PropType<string>,
50
- default: 'medium',
67
+ default: "medium",
51
68
  validator(value: string) {
52
- return propValidators.size.includes(value);
69
+ return propValidators.size.includes(value)
53
70
  },
54
71
  },
55
72
  optionsLayout: {
56
73
  type: String as PropType<string>,
57
- default: 'equal-widths',
74
+ default: "equal-widths",
58
75
  validator(value: string) {
59
- return propValidators.optionsLayout.includes(value);
76
+ return propValidators.optionsLayout.includes(value)
60
77
  },
61
78
  },
62
79
  styleClassPassthrough: {
@@ -65,9 +82,9 @@ const props = defineProps({
65
82
  },
66
83
  theme: {
67
84
  type: String as PropType<string>,
68
- default: 'primary',
85
+ default: "primary",
69
86
  validator(value: string) {
70
- return propValidators.theme.includes(value);
87
+ return propValidators.theme.includes(value)
71
88
  },
72
89
  },
73
90
  ariaDescribedby: {
@@ -78,14 +95,13 @@ const props = defineProps({
78
95
  type: Boolean,
79
96
  default: false,
80
97
  },
81
- });
98
+ })
82
99
 
83
- const slots = useSlots();
84
- const hasLabelContent = computed(() => slots.labelContent !== undefined);
85
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
100
+ const slots = useSlots()
101
+ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
86
102
 
87
- const modelValue = defineModel();
88
- const id = useId();
103
+ const modelValue = defineModel()
104
+ const id = useId()
89
105
  </script>
90
106
 
91
107
  <style lang="css">