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.
- package/app/components/forms/form-fieldset/FormFieldset.vue +19 -10
- package/app/components/forms/input-button/InputButtonCore.vue +25 -28
- package/app/components/forms/input-checkbox/MultipleCheckboxes.vue +48 -27
- package/app/components/forms/input-checkbox/SingleCheckbox.vue +52 -33
- package/app/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +40 -22
- package/app/components/forms/input-checkbox-radio/InputCheckboxRadioWithLabel.vue +33 -17
- package/app/components/forms/input-label/InputLabel.vue +10 -12
- package/app/components/forms/input-number/InputNumberCore.vue +26 -22
- package/app/components/forms/input-number/variants/InputNumberDefault.vue +50 -27
- package/app/components/forms/input-radio/MultipleRadiobuttons.vue +31 -25
- package/app/components/forms/input-range/InputRangeCore.vue +30 -28
- package/app/components/forms/input-range/variants/InputRangeDefault.vue +45 -28
- package/app/components/forms/input-range-fancy/InputRangeFancyWithLabel.vue +31 -18
- package/app/components/forms/input-select/variants/InputSelectWithLabel.vue +48 -37
- package/app/components/forms/input-text/InputTextCore.vue +4 -6
- package/app/components/forms/input-text/variants/InputTextAsNumberWithLabel.vue +42 -33
- package/app/components/forms/input-text/variants/InputTextWithLabel.vue +51 -42
- package/app/components/forms/input-textarea/InputTextareaCore.vue +29 -24
- package/app/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +41 -31
- package/app/components/forms/toggle-switch/ToggleSwitchCore.vue +43 -25
- package/app/components/forms/toggle-switch/ToggleSwitchCoreOld.vue +36 -22
- package/app/components/forms/toggle-switch/variants/ToggleSwitchWithLabel.vue +42 -25
- package/app/components/forms/toggle-switch/variants/ToggleSwitchWithLabelInline.vue +30 -26
- package/package.json +1 -1
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="toggle-switch-with-label" :class="[elementClasses]" :data-theme="formTheme">
|
|
3
|
-
<InputLabel
|
|
3
|
+
<InputLabel
|
|
4
|
+
:for="`toggle-sitch-${id}`"
|
|
5
|
+
:id
|
|
6
|
+
:theme
|
|
7
|
+
:name
|
|
8
|
+
input-variant="normal"
|
|
9
|
+
:field-has-error
|
|
10
|
+
:style-class-passthrough="['input-switch-label', 'input-text-label', 'body-normal-bold']"
|
|
11
|
+
>
|
|
4
12
|
<template #textLabel>{{ label }}</template>
|
|
5
13
|
</InputLabel>
|
|
6
14
|
|
|
7
|
-
<div v-if="
|
|
15
|
+
<div v-if="slots.description" :id="`${id}-description`">
|
|
8
16
|
<slot name="description"></slot>
|
|
9
17
|
</div>
|
|
10
|
-
<ToggleSwitchCore
|
|
11
|
-
|
|
18
|
+
<ToggleSwitchCore
|
|
19
|
+
v-model="modelValue"
|
|
20
|
+
:id
|
|
21
|
+
:name
|
|
22
|
+
:required
|
|
23
|
+
:field-has-error
|
|
24
|
+
:true-value
|
|
25
|
+
:false-value
|
|
26
|
+
:theme
|
|
27
|
+
:round
|
|
28
|
+
:size
|
|
29
|
+
:ariaDescribedby
|
|
30
|
+
>
|
|
31
|
+
<template v-if="slots.iconOn" #iconOn>
|
|
12
32
|
<slot name="iconOn"></slot>
|
|
13
33
|
</template>
|
|
14
34
|
|
|
15
|
-
<template v-if="
|
|
35
|
+
<template v-if="slots.iconOff" #iconOff>
|
|
16
36
|
<slot name="iconOff"></slot>
|
|
17
37
|
</template>
|
|
18
38
|
</ToggleSwitchCore>
|
|
@@ -21,7 +41,7 @@
|
|
|
21
41
|
</template>
|
|
22
42
|
|
|
23
43
|
<script setup lang="ts">
|
|
24
|
-
import propValidators from
|
|
44
|
+
import propValidators from "../../c12/prop-validators"
|
|
25
45
|
|
|
26
46
|
const props = defineProps({
|
|
27
47
|
name: {
|
|
@@ -38,7 +58,7 @@ const props = defineProps({
|
|
|
38
58
|
},
|
|
39
59
|
errorMessage: {
|
|
40
60
|
type: [Object, String],
|
|
41
|
-
default:
|
|
61
|
+
default: "",
|
|
42
62
|
required: false,
|
|
43
63
|
},
|
|
44
64
|
fieldHasError: {
|
|
@@ -59,9 +79,9 @@ const props = defineProps({
|
|
|
59
79
|
},
|
|
60
80
|
theme: {
|
|
61
81
|
type: String as PropType<string>,
|
|
62
|
-
default:
|
|
82
|
+
default: "primary",
|
|
63
83
|
validator(value: string) {
|
|
64
|
-
return propValidators.theme.includes(value)
|
|
84
|
+
return propValidators.theme.includes(value)
|
|
65
85
|
},
|
|
66
86
|
},
|
|
67
87
|
round: {
|
|
@@ -70,31 +90,28 @@ const props = defineProps({
|
|
|
70
90
|
},
|
|
71
91
|
size: {
|
|
72
92
|
type: String as PropType<string>,
|
|
73
|
-
default:
|
|
93
|
+
default: "default",
|
|
74
94
|
validator(value: string) {
|
|
75
|
-
return propValidators.size.includes(value)
|
|
95
|
+
return propValidators.size.includes(value)
|
|
76
96
|
},
|
|
77
97
|
},
|
|
78
|
-
})
|
|
98
|
+
})
|
|
79
99
|
|
|
80
|
-
const slots = useSlots()
|
|
81
|
-
const hasDescriptionSlot = computed(() => slots.description !== undefined);
|
|
82
|
-
const hasIconOnSlot = computed(() => slots.iconOn !== undefined);
|
|
83
|
-
const hasIconOffSlot = computed(() => slots.iconOff !== undefined);
|
|
100
|
+
const slots = useSlots()
|
|
84
101
|
|
|
85
102
|
const formTheme = computed(() => {
|
|
86
|
-
return props.fieldHasError ?
|
|
87
|
-
})
|
|
103
|
+
return props.fieldHasError ? "error" : props.theme
|
|
104
|
+
})
|
|
88
105
|
|
|
89
|
-
const id = useId()
|
|
90
|
-
const errorId = `${id}-error-message
|
|
106
|
+
const id = useId()
|
|
107
|
+
const errorId = `${id}-error-message`
|
|
91
108
|
const ariaDescribedby = computed(() => {
|
|
92
|
-
const ariaDescribedbyId =
|
|
93
|
-
return props.fieldHasError ? errorId : ariaDescribedbyId
|
|
94
|
-
})
|
|
109
|
+
const ariaDescribedbyId = slots.description ? `${id}-description` : undefined
|
|
110
|
+
return props.fieldHasError ? errorId : ariaDescribedbyId
|
|
111
|
+
})
|
|
95
112
|
|
|
96
|
-
const modelValue = defineModel()
|
|
97
|
-
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
113
|
+
const modelValue = defineModel()
|
|
114
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
98
115
|
</script>
|
|
99
116
|
|
|
100
117
|
<style lang="css">
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="toggle-switch-with-label-inline" :class="[elementClasses]" :data-theme="theme">
|
|
3
|
-
<InputLabel
|
|
3
|
+
<InputLabel
|
|
4
|
+
:for="`toggle-sitch-${id}`"
|
|
5
|
+
:id
|
|
6
|
+
:theme
|
|
7
|
+
:name
|
|
8
|
+
input-variant="normal"
|
|
9
|
+
:style-class-passthrough="['input-switch-label', 'input-text-label', labelWeightClass]"
|
|
10
|
+
>
|
|
4
11
|
<template #textLabel>{{ label }}</template>
|
|
5
12
|
</InputLabel>
|
|
6
13
|
|
|
7
14
|
<ToggleSwitchCore v-model="modelValue" :id :name :true-value :false-value :theme :round :size>
|
|
8
|
-
<template v-if="
|
|
15
|
+
<template v-if="slots.iconOn" #iconOn>
|
|
9
16
|
<slot name="iconOn"></slot>
|
|
10
17
|
</template>
|
|
11
18
|
|
|
12
|
-
<template v-if="
|
|
19
|
+
<template v-if="slots.iconOff" #iconOff>
|
|
13
20
|
<slot name="iconOff"></slot>
|
|
14
21
|
</template>
|
|
15
22
|
</ToggleSwitchCore>
|
|
@@ -17,7 +24,7 @@
|
|
|
17
24
|
</template>
|
|
18
25
|
|
|
19
26
|
<script setup lang="ts">
|
|
20
|
-
import propValidators from
|
|
27
|
+
import propValidators from "../../c12/prop-validators"
|
|
21
28
|
|
|
22
29
|
const props = defineProps({
|
|
23
30
|
name: {
|
|
@@ -30,9 +37,9 @@ const props = defineProps({
|
|
|
30
37
|
},
|
|
31
38
|
labelWeight: {
|
|
32
39
|
type: String as PropType<string>,
|
|
33
|
-
default:
|
|
40
|
+
default: "semi-bold",
|
|
34
41
|
validator(value: string) {
|
|
35
|
-
return propValidators.labelWeight.includes(value)
|
|
42
|
+
return propValidators.labelWeight.includes(value)
|
|
36
43
|
},
|
|
37
44
|
},
|
|
38
45
|
trueValue: {
|
|
@@ -49,9 +56,9 @@ const props = defineProps({
|
|
|
49
56
|
},
|
|
50
57
|
theme: {
|
|
51
58
|
type: String as PropType<string>,
|
|
52
|
-
default:
|
|
59
|
+
default: "primary",
|
|
53
60
|
validator(value: string) {
|
|
54
|
-
return propValidators.theme.includes(value)
|
|
61
|
+
return propValidators.theme.includes(value)
|
|
55
62
|
},
|
|
56
63
|
},
|
|
57
64
|
round: {
|
|
@@ -60,34 +67,31 @@ const props = defineProps({
|
|
|
60
67
|
},
|
|
61
68
|
size: {
|
|
62
69
|
type: String as PropType<string>,
|
|
63
|
-
default:
|
|
70
|
+
default: "default",
|
|
64
71
|
validator(value: string) {
|
|
65
|
-
return propValidators.size.includes(value)
|
|
72
|
+
return propValidators.size.includes(value)
|
|
66
73
|
},
|
|
67
74
|
},
|
|
68
|
-
})
|
|
75
|
+
})
|
|
69
76
|
|
|
70
|
-
const slots = useSlots()
|
|
71
|
-
const
|
|
72
|
-
const hasIconOffSlot = computed(() => slots.iconOff !== undefined);
|
|
73
|
-
|
|
74
|
-
const id = useId();
|
|
77
|
+
const slots = useSlots()
|
|
78
|
+
const id = useId()
|
|
75
79
|
|
|
76
80
|
const labelWeightClass = computed(() => {
|
|
77
81
|
switch (props.labelWeight) {
|
|
78
|
-
case
|
|
79
|
-
return
|
|
80
|
-
case
|
|
81
|
-
return
|
|
82
|
-
case
|
|
83
|
-
return
|
|
82
|
+
case "bold":
|
|
83
|
+
return "body-normal-bold"
|
|
84
|
+
case "semi-bold":
|
|
85
|
+
return "body-normal-semibold"
|
|
86
|
+
case "normal":
|
|
87
|
+
return "body-normal"
|
|
84
88
|
default:
|
|
85
|
-
return
|
|
89
|
+
return "body-normal-semibold"
|
|
86
90
|
}
|
|
87
|
-
})
|
|
91
|
+
})
|
|
88
92
|
|
|
89
|
-
const modelValue = defineModel()
|
|
90
|
-
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
93
|
+
const modelValue = defineModel()
|
|
94
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
91
95
|
</script>
|
|
92
96
|
|
|
93
97
|
<style lang="css">
|
package/package.json
CHANGED