srcdev-nuxt-forms 2.1.6 → 2.1.7
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.
- package/components/forms/input-checkbox/InputCheckboxWithLabel.vue +7 -14
- package/components/forms/input-checkbox/variants/MultipleCheckboxes.vue +7 -27
- package/components/forms/input-checkbox/variants/SingleCheckbox.vue +80 -88
- package/components/forms/input-radio/InputRadiobuttonWithLabel.vue +7 -14
- package/components/forms/input-radio/variants/MultipleRadiobuttons.vue +7 -26
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="input-checkbox-with-label" :class="[elementClasses, optionsLayout, { error: fieldHasError }]">
|
|
3
|
-
<InputCheckboxCore :id :name :required v-model="modelValue" :size :trueValue :falseValue :
|
|
3
|
+
<InputCheckboxCore :id :name :required v-model="modelValue" :size :trueValue :falseValue :stateIcon :fieldHasError :theme />
|
|
4
4
|
<label v-if="hasLabelContent" class="input-checkbox-label body-normal" :for="id">
|
|
5
5
|
<slot name="labelContent"></slot>
|
|
6
6
|
</label>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<script setup lang="ts">
|
|
12
12
|
import propValidators from '../c12/prop-validators';
|
|
13
13
|
|
|
14
|
-
const { id, name, label, required, fieldHasError, trueValue, falseValue, size,
|
|
14
|
+
const { id, name, label, required, fieldHasError, trueValue, falseValue, size, stateIcon, optionsLayout, styleClassPassthrough, theme } = defineProps({
|
|
15
15
|
id: {
|
|
16
16
|
type: String,
|
|
17
17
|
required: true,
|
|
@@ -47,18 +47,11 @@ const { id, name, label, required, fieldHasError, trueValue, falseValue, size, c
|
|
|
47
47
|
return propValidators.size.includes(value);
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
|
-
|
|
51
|
-
type:
|
|
52
|
-
default:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
checkboxStyle: {
|
|
58
|
-
type: String as PropType<string>,
|
|
59
|
-
default: 'check',
|
|
60
|
-
validator(value: string) {
|
|
61
|
-
return propValidators.checkboxStyle.includes(value);
|
|
50
|
+
stateIcon: {
|
|
51
|
+
type: Object as PropType<{ checked: string; unchecked: string }>,
|
|
52
|
+
default: {
|
|
53
|
+
checked: 'carbon:checkbox-checked',
|
|
54
|
+
unchecked: 'carbon:checkbox',
|
|
62
55
|
},
|
|
63
56
|
},
|
|
64
57
|
optionsLayout: {
|
|
@@ -6,20 +6,7 @@
|
|
|
6
6
|
</template>
|
|
7
7
|
<div class="multiple-checkboxes-items" :class="[optionsLayout]">
|
|
8
8
|
<template v-for="item in fieldData.data" :key="item.id">
|
|
9
|
-
<InputCheckboxWithLabel
|
|
10
|
-
:id="item.value"
|
|
11
|
-
:name
|
|
12
|
-
:required
|
|
13
|
-
:label="item.label"
|
|
14
|
-
:fieldHasError
|
|
15
|
-
v-model="modelValue"
|
|
16
|
-
:true-value="item.value"
|
|
17
|
-
:size
|
|
18
|
-
:checkboxAppearance
|
|
19
|
-
:optionsLayout
|
|
20
|
-
:checkboxStyle
|
|
21
|
-
:theme
|
|
22
|
-
/>
|
|
9
|
+
<InputCheckboxWithLabel :id="item.value" :name :required :label="item.label" :fieldHasError v-model="modelValue" :true-value="item.value" :size :stateIcon :optionsLayout :theme />
|
|
23
10
|
</template>
|
|
24
11
|
</div>
|
|
25
12
|
<InputError :errorMessage="errorMessage" :fieldHasError :id="name" :isDetached="true" />
|
|
@@ -32,7 +19,7 @@ import type { IOptionsConfig, IFormMultipleOptions } from '@/types/types.forms';
|
|
|
32
19
|
|
|
33
20
|
import type { C12nMultipleCheckboxes, IFormFieldC12, IFormData } from '@/types/types.forms';
|
|
34
21
|
|
|
35
|
-
const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols,
|
|
22
|
+
const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols, stateIcon, styleClassPassthrough, theme } = defineProps({
|
|
36
23
|
id: {
|
|
37
24
|
type: String,
|
|
38
25
|
required: true,
|
|
@@ -87,18 +74,11 @@ const { id, name, legend, label, required, fieldHasError, placeholder, errorMess
|
|
|
87
74
|
type: Boolean,
|
|
88
75
|
default: true,
|
|
89
76
|
},
|
|
90
|
-
|
|
91
|
-
type:
|
|
92
|
-
default:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
checkboxStyle: {
|
|
98
|
-
type: String as PropType<string>,
|
|
99
|
-
default: 'check',
|
|
100
|
-
validator(value: string) {
|
|
101
|
-
return propValidators.checkboxStyle.includes(value);
|
|
77
|
+
stateIcon: {
|
|
78
|
+
type: Object as PropType<{ checked: string; unchecked: string }>,
|
|
79
|
+
default: {
|
|
80
|
+
checked: 'carbon:checkbox-checked',
|
|
81
|
+
unchecked: 'carbon:checkbox',
|
|
102
82
|
},
|
|
103
83
|
},
|
|
104
84
|
styleClassPassthrough: {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<slot name="description"></slot>
|
|
6
6
|
</template>
|
|
7
7
|
<div class="single-checkbox-items" :class="[optionsLayout]">
|
|
8
|
-
<InputCheckboxWithLabel :id :name :required :label :fieldHasError v-model="modelValue" :trueValue :falseValue :size :
|
|
8
|
+
<InputCheckboxWithLabel :id :name :required :label :fieldHasError v-model="modelValue" :trueValue :falseValue :size :stateIcon :theme>
|
|
9
9
|
<template v-if="hasLabelContent" #labelContent>
|
|
10
10
|
<slot name="labelContent"></slot>
|
|
11
11
|
</template>
|
|
@@ -19,93 +19,85 @@
|
|
|
19
19
|
import propValidators from '../../c12/prop-validators';
|
|
20
20
|
import type { IFormMultipleOptions } from '@/types/types.forms';
|
|
21
21
|
|
|
22
|
-
const { id, name, legend, label, required, fieldHasError, errorMessage, size, optionsLayout, equalCols, trueValue, falseValue,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
theme: {
|
|
102
|
-
type: String as PropType<string>,
|
|
103
|
-
default: 'primary',
|
|
104
|
-
validator(value: string) {
|
|
105
|
-
return propValidators.theme.includes(value);
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
});
|
|
22
|
+
const { id, name, legend, label, required, fieldHasError, errorMessage, size, optionsLayout, equalCols, trueValue, falseValue, stateIcon, styleClassPassthrough, theme } = defineProps({
|
|
23
|
+
id: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
name: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
legend: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
label: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false,
|
|
38
|
+
default: '',
|
|
39
|
+
},
|
|
40
|
+
errorMessage: {
|
|
41
|
+
type: [Object, String],
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
required: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
fieldHasError: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
multipleOptions: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
size: {
|
|
57
|
+
type: String as PropType<string>,
|
|
58
|
+
default: 'medium',
|
|
59
|
+
validator(value: string) {
|
|
60
|
+
return propValidators.size.includes(value);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
trueValue: {
|
|
64
|
+
type: [String, Number, Boolean],
|
|
65
|
+
default: true,
|
|
66
|
+
},
|
|
67
|
+
falseValue: {
|
|
68
|
+
type: [String, Number, Boolean],
|
|
69
|
+
default: false,
|
|
70
|
+
},
|
|
71
|
+
optionsLayout: {
|
|
72
|
+
type: String as PropType<string>,
|
|
73
|
+
default: 'equal-widths',
|
|
74
|
+
validator(value: string) {
|
|
75
|
+
return propValidators.optionsLayout.includes(value);
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
equalCols: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true,
|
|
81
|
+
},
|
|
82
|
+
stateIcon: {
|
|
83
|
+
type: Object as PropType<{ checked: string; unchecked: string }>,
|
|
84
|
+
default: {
|
|
85
|
+
checked: 'carbon:checkbox-checked',
|
|
86
|
+
unchecked: 'carbon:checkbox',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
styleClassPassthrough: {
|
|
90
|
+
type: Array as PropType<string[]>,
|
|
91
|
+
default: () => [],
|
|
92
|
+
},
|
|
93
|
+
theme: {
|
|
94
|
+
type: String as PropType<string>,
|
|
95
|
+
default: 'primary',
|
|
96
|
+
validator(value: string) {
|
|
97
|
+
return propValidators.theme.includes(value);
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
});
|
|
109
101
|
|
|
110
102
|
const slots = useSlots();
|
|
111
103
|
const hasDescription = computed(() => slots.description !== undefined);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="input-radiobutton-with-label" :class="[elementClasses, { error: fieldHasError }]">
|
|
3
|
-
<InputRadiobuttonCore :id :name :required v-model="modelValue" :size :trueValue :falseValue :
|
|
3
|
+
<InputRadiobuttonCore :id :name :required v-model="modelValue" :size :trueValue :falseValue :stateIcon :fieldHasError :theme />
|
|
4
4
|
<label v-if="hasLabelContent" class="input-radiobutton-label body-normal" :for="id">
|
|
5
5
|
<slot name="labelContent"></slot>
|
|
6
6
|
</label>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<script setup lang="ts">
|
|
12
12
|
import propValidators from '../c12/prop-validators';
|
|
13
13
|
|
|
14
|
-
const { id, name, label, required, fieldHasError, trueValue, falseValue, size,
|
|
14
|
+
const { id, name, label, required, fieldHasError, trueValue, falseValue, size, stateIcon, styleClassPassthrough, theme } = defineProps({
|
|
15
15
|
id: {
|
|
16
16
|
type: String,
|
|
17
17
|
required: true,
|
|
@@ -47,18 +47,11 @@ const { id, name, label, required, fieldHasError, trueValue, falseValue, size, c
|
|
|
47
47
|
return propValidators.size.includes(value);
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
|
-
|
|
51
|
-
type:
|
|
52
|
-
default:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
checkboxStyle: {
|
|
58
|
-
type: String as PropType<string>,
|
|
59
|
-
default: 'check',
|
|
60
|
-
validator(value: string) {
|
|
61
|
-
return propValidators.checkboxStyle.includes(value);
|
|
50
|
+
stateIcon: {
|
|
51
|
+
type: Object as PropType<{ checked: string; unchecked: string }>,
|
|
52
|
+
default: {
|
|
53
|
+
checked: 'carbon:radio-button-checked',
|
|
54
|
+
unchecked: 'carbon:radio-button',
|
|
62
55
|
},
|
|
63
56
|
},
|
|
64
57
|
styleClassPassthrough: {
|
|
@@ -6,19 +6,7 @@
|
|
|
6
6
|
</template>
|
|
7
7
|
<div class="multiple-radiobuttons-items" :class="[optionsLayout]">
|
|
8
8
|
<template v-for="item in fieldData.data" :key="item.id">
|
|
9
|
-
<InputRadiobuttonWithLabel
|
|
10
|
-
:id="item.value"
|
|
11
|
-
:name="item.name"
|
|
12
|
-
:required
|
|
13
|
-
:label="item.label"
|
|
14
|
-
:fieldHasError
|
|
15
|
-
v-model="modelValue"
|
|
16
|
-
:true-value="item.value"
|
|
17
|
-
:size
|
|
18
|
-
:checkboxAppearance
|
|
19
|
-
:checkboxStyle
|
|
20
|
-
:theme
|
|
21
|
-
/>
|
|
9
|
+
<InputRadiobuttonWithLabel :id="item.value" :name="item.name" :required :label="item.label" :fieldHasError v-model="modelValue" :true-value="item.value" :size :stateIcon :theme />
|
|
22
10
|
</template>
|
|
23
11
|
</div>
|
|
24
12
|
<InputError :errorMessage="errorMessage" :fieldHasError :id="name" :isDetached="true" />
|
|
@@ -31,7 +19,7 @@ import type { IOptionsConfig, IFormMultipleOptions } from '@/types/types.forms';
|
|
|
31
19
|
|
|
32
20
|
import type { C12nMultipleCheckboxes, IFormFieldC12, IFormData } from '@/types/types.forms';
|
|
33
21
|
|
|
34
|
-
const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols,
|
|
22
|
+
const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols, stateIcon, styleClassPassthrough, theme } = defineProps({
|
|
35
23
|
id: {
|
|
36
24
|
type: String,
|
|
37
25
|
required: true,
|
|
@@ -86,18 +74,11 @@ const { id, name, legend, label, required, fieldHasError, placeholder, errorMess
|
|
|
86
74
|
type: Boolean,
|
|
87
75
|
default: true,
|
|
88
76
|
},
|
|
89
|
-
|
|
90
|
-
type:
|
|
91
|
-
default:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
checkboxStyle: {
|
|
97
|
-
type: String as PropType<string>,
|
|
98
|
-
default: 'check',
|
|
99
|
-
validator(value: string) {
|
|
100
|
-
return propValidators.checkboxStyle.includes(value);
|
|
77
|
+
stateIcon: {
|
|
78
|
+
type: Object as PropType<{ checked: string; unchecked: string }>,
|
|
79
|
+
default: {
|
|
80
|
+
checked: 'carbon:radio-button-checked',
|
|
81
|
+
unchecked: 'carbon:radio-button',
|
|
101
82
|
},
|
|
102
83
|
},
|
|
103
84
|
styleClassPassthrough: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "srcdev-nuxt-forms",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.7",
|
|
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",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
],
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@nuxt/eslint-config": "0.6.1",
|
|
25
|
-
"
|
|
25
|
+
"@nuxt/icon": "1.7.5",
|
|
26
|
+
"eslint": "9.15.0",
|
|
26
27
|
"release-it": "17.10.0",
|
|
27
28
|
"typescript": "5.6.3"
|
|
28
29
|
},
|
|
@@ -32,7 +33,6 @@
|
|
|
32
33
|
"@iconify-json/material-symbols": "1.2.6",
|
|
33
34
|
"@iconify-json/radix-icons": "1.2.1",
|
|
34
35
|
"@iconify-json/ri": "1.2.3",
|
|
35
|
-
"@nuxt/icon": "1.7.2",
|
|
36
36
|
"modern-normalize": "3.0.1",
|
|
37
37
|
"nuxt": "3.14.159",
|
|
38
38
|
"zod": "3.23.8"
|