srcdev-nuxt-forms 6.1.0 → 6.1.2
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/assets/styles/extends-layer/srcdev-forms/components/_input-description.css +13 -0
- package/app/assets/styles/extends-layer/srcdev-forms/components/index.css +10 -9
- package/app/assets/styles/setup/theming/themes/_default.css +3 -0
- package/app/assets/styles/setup/theming/themes/_error.css +4 -1
- package/app/assets/styles/setup/theming/themes/_secondary.css +4 -1
- package/app/assets/styles/setup/theming/themes/_success.css +4 -1
- package/app/assets/styles/setup/theming/themes/_warning.css +4 -1
- package/app/assets/styles/setup/utility-classes/_margin.css +334 -0
- package/app/assets/styles/setup/utility-classes/_padding.css +308 -0
- package/app/assets/styles/setup/utility-classes/index.css +4 -2
- 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 -38
- 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-description/InputDescription.vue +71 -0
- package/app/components/forms/input-label/InputLabel.vue +14 -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 +80 -45
- 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 +83 -50
- package/app/components/forms/input-textarea/InputTextareaCore.vue +34 -25
- package/app/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +100 -50
- 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,33 +1,58 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FormFieldset
|
|
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
|
|
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="
|
|
33
|
+
<template v-if="slots.labelContent" #labelContent>
|
|
14
34
|
<slot name="labelContent"></slot>
|
|
15
35
|
</template>
|
|
16
36
|
</InputCheckboxRadioWithLabel>
|
|
17
37
|
</div>
|
|
18
|
-
<InputError
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
127
|
+
const modelValue = defineModel()
|
|
106
128
|
|
|
107
|
-
const
|
|
108
|
-
const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
129
|
+
const inputErrorStyles = ref<string[]>(props.styleClassPassthrough)
|
|
109
130
|
|
|
110
|
-
const
|
|
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 =
|
|
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 (!
|
|
121
|
-
inputErrorStyles.value.push(
|
|
139
|
+
if (!slots.description && props.fieldHasError) {
|
|
140
|
+
inputErrorStyles.value.push("mbs-12")
|
|
122
141
|
} else {
|
|
123
|
-
inputErrorStyles.value = inputErrorStyles.value.filter((style) => style !==
|
|
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
|
|
3
|
-
|
|
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="
|
|
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
|
|
40
|
+
import propValidators from "../c12/prop-validators"
|
|
22
41
|
|
|
23
42
|
const props = defineProps({
|
|
24
43
|
type: {
|
|
25
|
-
type: String as PropType<
|
|
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:
|
|
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:
|
|
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:
|
|
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<
|
|
83
|
-
default:
|
|
101
|
+
type: String as PropType<"row" | "row-reverse">,
|
|
102
|
+
default: "row",
|
|
84
103
|
validator(value: string) {
|
|
85
|
-
return [
|
|
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
|
|
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 ?
|
|
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
|
|
3
|
-
|
|
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="
|
|
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
|
|
34
|
+
import propValidators from "../c12/prop-validators"
|
|
18
35
|
|
|
19
36
|
const props = defineProps({
|
|
20
37
|
type: {
|
|
21
|
-
type: String as PropType<
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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">
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="slots.descriptionText || slots.descriptionHtml"
|
|
4
|
+
class="input-description"
|
|
5
|
+
:class="[elementClasses]"
|
|
6
|
+
:id="descriptionId"
|
|
7
|
+
>
|
|
8
|
+
<div v-if="slots.descriptionHtml" class="input-description-html">
|
|
9
|
+
<slot name="descriptionHtml"></slot>
|
|
10
|
+
</div>
|
|
11
|
+
<p v-if="slots.descriptionText" class="input-description-text">
|
|
12
|
+
<slot name="descriptionText"></slot>
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import propValidators from "../c12/prop-validators"
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
id: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
name: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
fieldHasError: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
styleClassPassthrough: {
|
|
34
|
+
type: Array as PropType<string[]>,
|
|
35
|
+
default: () => [],
|
|
36
|
+
},
|
|
37
|
+
theme: {
|
|
38
|
+
type: String as PropType<string>,
|
|
39
|
+
default: "primary",
|
|
40
|
+
validator(value: string) {
|
|
41
|
+
return propValidators.theme.includes(value)
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
inputVariant: {
|
|
45
|
+
type: String as PropType<string>,
|
|
46
|
+
default: "default",
|
|
47
|
+
validator(value: string) {
|
|
48
|
+
return propValidators.inputVariant.includes(value)
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const slots = useSlots()
|
|
54
|
+
|
|
55
|
+
const descriptionId = `${props.id}-description`
|
|
56
|
+
|
|
57
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
58
|
+
</script>
|
|
59
|
+
<style lang="css">
|
|
60
|
+
.input-description {
|
|
61
|
+
.input-description-html {
|
|
62
|
+
margin-block: 0.4rem 0.8rem;
|
|
63
|
+
}
|
|
64
|
+
.input-description-text {
|
|
65
|
+
color: var(--form-description-color);
|
|
66
|
+
font-size: var(--step-4);
|
|
67
|
+
margin-block: 0.4rem 0.8rem;
|
|
68
|
+
line-height: var(--step-4);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label :for="id" class="input-label" :class="[elementClasses, inputVariant]">
|
|
3
|
-
<slot v-if="
|
|
4
|
-
<slot v-if="
|
|
3
|
+
<slot v-if="slots.htmlLabel" name="htmlLabel"></slot>
|
|
4
|
+
<slot v-if="slots.textLabel" name="textLabel"></slot>
|
|
5
5
|
</label>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
-
import propValidators from
|
|
9
|
+
import propValidators from "../c12/prop-validators"
|
|
10
10
|
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
id: {
|
|
@@ -27,25 +27,23 @@ const props = defineProps({
|
|
|
27
27
|
},
|
|
28
28
|
theme: {
|
|
29
29
|
type: String as PropType<string>,
|
|
30
|
-
default:
|
|
30
|
+
default: "primary",
|
|
31
31
|
validator(value: string) {
|
|
32
|
-
return propValidators.theme.includes(value)
|
|
32
|
+
return propValidators.theme.includes(value)
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
inputVariant: {
|
|
36
36
|
type: String as PropType<string>,
|
|
37
|
-
default:
|
|
37
|
+
default: "default",
|
|
38
38
|
validator(value: string) {
|
|
39
|
-
return propValidators.inputVariant.includes(value)
|
|
39
|
+
return propValidators.inputVariant.includes(value)
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
-
})
|
|
42
|
+
})
|
|
43
43
|
|
|
44
|
-
const slots = useSlots()
|
|
45
|
-
const hasHtmlLabel = computed(() => slots.htmlLabel !== undefined);
|
|
46
|
-
const hasTextLabel = computed(() => slots.textLabel !== undefined);
|
|
44
|
+
const slots = useSlots()
|
|
47
45
|
|
|
48
|
-
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
46
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
49
47
|
</script>
|
|
50
48
|
|
|
51
49
|
<style lang="css">
|
|
@@ -75,5 +73,9 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
75
73
|
line-height: 1.5;
|
|
76
74
|
display: block;
|
|
77
75
|
}
|
|
76
|
+
|
|
77
|
+
& + .input-description {
|
|
78
|
+
margin-block-end: 0.2rem;
|
|
79
|
+
}
|
|
78
80
|
}
|
|
79
81
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="input-number-wrapper" :data-theme="formTheme" :data-size="size">
|
|
3
|
-
<div v-if="
|
|
3
|
+
<div v-if="slots.left" class="slot left">
|
|
4
4
|
<slot name="left"></slot>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
@@ -13,21 +13,27 @@
|
|
|
13
13
|
:min
|
|
14
14
|
:max
|
|
15
15
|
:step
|
|
16
|
-
:class="[
|
|
16
|
+
:class="[
|
|
17
|
+
elementClasses,
|
|
18
|
+
'input-number-core',
|
|
19
|
+
`input-number--${theme}`,
|
|
20
|
+
`input-number--${size}`,
|
|
21
|
+
`input-number--${weight}`,
|
|
22
|
+
]"
|
|
17
23
|
v-model="modelValue"
|
|
18
24
|
ref="inputField"
|
|
19
25
|
inputmode="numeric"
|
|
20
26
|
pattern="[0-9]+"
|
|
21
27
|
/>
|
|
22
28
|
</div>
|
|
23
|
-
<div v-if="
|
|
29
|
+
<div v-if="slots.right" class="slot right">
|
|
24
30
|
<slot name="right"></slot>
|
|
25
31
|
</div>
|
|
26
32
|
</div>
|
|
27
33
|
</template>
|
|
28
34
|
|
|
29
35
|
<script setup lang="ts">
|
|
30
|
-
import propValidators from
|
|
36
|
+
import propValidators from "../c12/prop-validators"
|
|
31
37
|
|
|
32
38
|
const props = defineProps({
|
|
33
39
|
id: {
|
|
@@ -52,7 +58,7 @@ const props = defineProps({
|
|
|
52
58
|
},
|
|
53
59
|
placeholder: {
|
|
54
60
|
type: String,
|
|
55
|
-
default:
|
|
61
|
+
default: "",
|
|
56
62
|
},
|
|
57
63
|
required: {
|
|
58
64
|
type: Boolean,
|
|
@@ -60,23 +66,23 @@ const props = defineProps({
|
|
|
60
66
|
},
|
|
61
67
|
theme: {
|
|
62
68
|
type: String as PropType<string>,
|
|
63
|
-
default:
|
|
69
|
+
default: "primary",
|
|
64
70
|
validator(value: string) {
|
|
65
|
-
return propValidators.theme.includes(value)
|
|
71
|
+
return propValidators.theme.includes(value)
|
|
66
72
|
},
|
|
67
73
|
},
|
|
68
74
|
size: {
|
|
69
75
|
type: String as PropType<string>,
|
|
70
|
-
default:
|
|
76
|
+
default: "medium",
|
|
71
77
|
validator(value: string) {
|
|
72
|
-
return propValidators.size.includes(value)
|
|
78
|
+
return propValidators.size.includes(value)
|
|
73
79
|
},
|
|
74
80
|
},
|
|
75
81
|
weight: {
|
|
76
82
|
type: String as PropType<string>,
|
|
77
|
-
default:
|
|
83
|
+
default: "wght-400",
|
|
78
84
|
validator(value: string) {
|
|
79
|
-
return propValidators.weight.includes(value)
|
|
85
|
+
return propValidators.weight.includes(value)
|
|
80
86
|
},
|
|
81
87
|
},
|
|
82
88
|
fieldHasError: {
|
|
@@ -87,20 +93,18 @@ const props = defineProps({
|
|
|
87
93
|
type: Array as PropType<string[]>,
|
|
88
94
|
default: () => [],
|
|
89
95
|
},
|
|
90
|
-
})
|
|
96
|
+
})
|
|
91
97
|
|
|
92
|
-
const slots = useSlots()
|
|
93
|
-
const hasLeftContent = computed(() => slots.left !== undefined);
|
|
94
|
-
const hasRightContent = computed(() => slots.right !== undefined);
|
|
98
|
+
const slots = useSlots()
|
|
95
99
|
|
|
96
100
|
const formTheme = computed(() => {
|
|
97
|
-
return props.fieldHasError ?
|
|
98
|
-
})
|
|
101
|
+
return props.fieldHasError ? "error" : props.theme
|
|
102
|
+
})
|
|
99
103
|
|
|
100
|
-
const modelValue = defineModel<number | readonly number[]>()
|
|
104
|
+
const modelValue = defineModel<number | readonly number[]>()
|
|
101
105
|
|
|
102
|
-
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
103
|
-
const minLength = computed(() => `${props.max.toString().length + 1}em`)
|
|
106
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
107
|
+
const minLength = computed(() => `${props.max.toString().length + 1}em`)
|
|
104
108
|
</script>
|
|
105
109
|
|
|
106
110
|
<style lang="css">
|
|
@@ -196,8 +200,8 @@ const minLength = computed(() => `${props.max.toString().length + 1}em`);
|
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
|
|
199
|
-
input[type=
|
|
200
|
-
input[type=
|
|
203
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
204
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
201
205
|
-webkit-appearance: none;
|
|
202
206
|
margin: 0;
|
|
203
207
|
}
|