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,15 +1,41 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="input-number-with-label"
|
|
4
|
+
:data-theme="formTheme"
|
|
5
|
+
:data-size="size"
|
|
6
|
+
:class="[elementClasses, `theme-${theme}`, { error: fieldHasError }]"
|
|
7
|
+
>
|
|
8
|
+
<InputLabel
|
|
9
|
+
:for="id"
|
|
10
|
+
:id
|
|
11
|
+
:theme
|
|
12
|
+
:name
|
|
13
|
+
input-variant="normal"
|
|
14
|
+
:field-has-error
|
|
15
|
+
:style-class-passthrough="['input-number-label', 'body-normal-bold']"
|
|
16
|
+
>
|
|
4
17
|
<template #textLabel>{{ label }}</template>
|
|
5
18
|
</InputLabel>
|
|
6
19
|
|
|
7
|
-
<template v-if="
|
|
20
|
+
<template v-if="slots.description">
|
|
8
21
|
<slot name="description"></slot>
|
|
9
22
|
</template>
|
|
10
23
|
|
|
11
|
-
<InputNumberCore
|
|
12
|
-
|
|
24
|
+
<InputNumberCore
|
|
25
|
+
v-model="modelValue"
|
|
26
|
+
:id
|
|
27
|
+
:name
|
|
28
|
+
:min
|
|
29
|
+
:max
|
|
30
|
+
:step
|
|
31
|
+
:theme
|
|
32
|
+
:required
|
|
33
|
+
:size
|
|
34
|
+
:weight
|
|
35
|
+
:fieldHasError
|
|
36
|
+
:styleClassPassthrough
|
|
37
|
+
>
|
|
38
|
+
<template v-if="slots.left" #left>
|
|
13
39
|
<InputButtonCore
|
|
14
40
|
type="button"
|
|
15
41
|
@click.stop.prevent="updateValue(-step, Number(modelValue) > min)"
|
|
@@ -24,7 +50,7 @@
|
|
|
24
50
|
</template>
|
|
25
51
|
</InputButtonCore>
|
|
26
52
|
</template>
|
|
27
|
-
<template v-if="
|
|
53
|
+
<template v-if="slots.right" #right>
|
|
28
54
|
<InputButtonCore
|
|
29
55
|
type="button"
|
|
30
56
|
@click.stop.prevent="updateValue(step, Number(modelValue) < max)"
|
|
@@ -45,7 +71,7 @@
|
|
|
45
71
|
</template>
|
|
46
72
|
|
|
47
73
|
<script setup lang="ts">
|
|
48
|
-
import propValidators from
|
|
74
|
+
import propValidators from "../../c12/prop-validators"
|
|
49
75
|
|
|
50
76
|
const props = defineProps({
|
|
51
77
|
name: {
|
|
@@ -70,7 +96,7 @@ const props = defineProps({
|
|
|
70
96
|
},
|
|
71
97
|
placeholder: {
|
|
72
98
|
type: String,
|
|
73
|
-
default:
|
|
99
|
+
default: "",
|
|
74
100
|
},
|
|
75
101
|
errorMessage: {
|
|
76
102
|
type: [Object, String],
|
|
@@ -86,51 +112,48 @@ const props = defineProps({
|
|
|
86
112
|
},
|
|
87
113
|
theme: {
|
|
88
114
|
type: String as PropType<string>,
|
|
89
|
-
default:
|
|
115
|
+
default: "primary",
|
|
90
116
|
validator(value: string) {
|
|
91
|
-
return propValidators.theme.includes(value)
|
|
117
|
+
return propValidators.theme.includes(value)
|
|
92
118
|
},
|
|
93
119
|
},
|
|
94
120
|
size: {
|
|
95
121
|
type: String as PropType<string>,
|
|
96
|
-
default:
|
|
122
|
+
default: "medium",
|
|
97
123
|
validator(value: string) {
|
|
98
|
-
return propValidators.size.includes(value)
|
|
124
|
+
return propValidators.size.includes(value)
|
|
99
125
|
},
|
|
100
126
|
},
|
|
101
127
|
weight: {
|
|
102
128
|
type: String as PropType<string>,
|
|
103
|
-
default:
|
|
129
|
+
default: "wght-400",
|
|
104
130
|
validator(value: string) {
|
|
105
|
-
return propValidators.weight.includes(value)
|
|
131
|
+
return propValidators.weight.includes(value)
|
|
106
132
|
},
|
|
107
133
|
},
|
|
108
134
|
styleClassPassthrough: {
|
|
109
135
|
type: Array as PropType<string[]>,
|
|
110
136
|
default: () => [],
|
|
111
137
|
},
|
|
112
|
-
})
|
|
138
|
+
})
|
|
113
139
|
|
|
114
|
-
const slots = useSlots()
|
|
115
|
-
const
|
|
116
|
-
const hasLeftContent = computed(() => slots.left !== undefined);
|
|
117
|
-
const hasRightContent = computed(() => slots.right !== undefined);
|
|
118
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
140
|
+
const slots = useSlots()
|
|
141
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
119
142
|
|
|
120
|
-
const id = useId()
|
|
143
|
+
const id = useId()
|
|
121
144
|
const formTheme = computed(() => {
|
|
122
|
-
return props.fieldHasError ?
|
|
123
|
-
})
|
|
145
|
+
return props.fieldHasError ? "error" : props.theme
|
|
146
|
+
})
|
|
124
147
|
|
|
125
|
-
const modelValue = defineModel<number | readonly number[]>()
|
|
148
|
+
const modelValue = defineModel<number | readonly number[]>()
|
|
126
149
|
|
|
127
150
|
const updateValue = (step: number, withinRangeLimit: boolean) => {
|
|
128
151
|
if (withinRangeLimit) {
|
|
129
|
-
modelValue.value = (Number(modelValue.value) + step) as number
|
|
152
|
+
modelValue.value = (Number(modelValue.value) + step) as number
|
|
130
153
|
}
|
|
131
|
-
}
|
|
154
|
+
}
|
|
132
155
|
|
|
133
|
-
updateElementClasses([
|
|
156
|
+
updateElementClasses(["has-left-button", "has-right-button"])
|
|
134
157
|
</script>
|
|
135
158
|
|
|
136
159
|
<style lang="css">
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FormFieldset
|
|
2
|
+
<FormFieldset
|
|
3
|
+
:id
|
|
4
|
+
:name
|
|
5
|
+
:legend
|
|
6
|
+
:fieldHasError
|
|
7
|
+
:required
|
|
8
|
+
:data-testid
|
|
9
|
+
:styleClassPassthrough="['multiple-radiobuttons-fieldset']"
|
|
10
|
+
>
|
|
3
11
|
<template #description>
|
|
4
12
|
<slot name="description"></slot>
|
|
5
13
|
</template>
|
|
@@ -59,13 +67,13 @@
|
|
|
59
67
|
</template>
|
|
60
68
|
|
|
61
69
|
<script setup lang="ts">
|
|
62
|
-
import propValidators from
|
|
63
|
-
import type { IFormMultipleOptions } from
|
|
70
|
+
import propValidators from "../c12/prop-validators"
|
|
71
|
+
import type { IFormMultipleOptions } from "../../../../shared/types/types.forms"
|
|
64
72
|
|
|
65
73
|
const props = defineProps({
|
|
66
74
|
dataTestid: {
|
|
67
75
|
type: String,
|
|
68
|
-
default:
|
|
76
|
+
default: "multiple-radio-buttons",
|
|
69
77
|
},
|
|
70
78
|
name: {
|
|
71
79
|
type: String,
|
|
@@ -81,7 +89,7 @@ const props = defineProps({
|
|
|
81
89
|
},
|
|
82
90
|
placeholder: {
|
|
83
91
|
type: String,
|
|
84
|
-
default:
|
|
92
|
+
default: "",
|
|
85
93
|
},
|
|
86
94
|
isButton: {
|
|
87
95
|
type: Boolean,
|
|
@@ -105,16 +113,16 @@ const props = defineProps({
|
|
|
105
113
|
},
|
|
106
114
|
size: {
|
|
107
115
|
type: String as PropType<string>,
|
|
108
|
-
default:
|
|
116
|
+
default: "medium",
|
|
109
117
|
validator(value: string) {
|
|
110
|
-
return propValidators.size.includes(value)
|
|
118
|
+
return propValidators.size.includes(value)
|
|
111
119
|
},
|
|
112
120
|
},
|
|
113
121
|
optionsLayout: {
|
|
114
122
|
type: String as PropType<string>,
|
|
115
|
-
default:
|
|
123
|
+
default: "equal-widths",
|
|
116
124
|
validator(value: string) {
|
|
117
|
-
return propValidators.optionsLayout.includes(value)
|
|
125
|
+
return propValidators.optionsLayout.includes(value)
|
|
118
126
|
},
|
|
119
127
|
},
|
|
120
128
|
equalCols: {
|
|
@@ -127,33 +135,31 @@ const props = defineProps({
|
|
|
127
135
|
},
|
|
128
136
|
theme: {
|
|
129
137
|
type: String as PropType<string>,
|
|
130
|
-
default:
|
|
138
|
+
default: "primary",
|
|
131
139
|
validator(value: string) {
|
|
132
|
-
return propValidators.theme.includes(value)
|
|
140
|
+
return propValidators.theme.includes(value)
|
|
133
141
|
},
|
|
134
142
|
},
|
|
135
143
|
direction: {
|
|
136
|
-
type: String as PropType<
|
|
137
|
-
default:
|
|
144
|
+
type: String as PropType<"row" | "row-reverse">,
|
|
145
|
+
default: "row",
|
|
138
146
|
validator(value: string) {
|
|
139
|
-
return [
|
|
147
|
+
return ["row", "row-reverse"].includes(value)
|
|
140
148
|
},
|
|
141
149
|
},
|
|
142
|
-
})
|
|
150
|
+
})
|
|
143
151
|
|
|
144
|
-
const slots = useSlots()
|
|
145
|
-
const hasDescriptionSlot = computed(() => slots.description !== undefined);
|
|
146
|
-
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
152
|
+
const slots = useSlots()
|
|
147
153
|
|
|
148
|
-
const id = `${props.name}-input-${useId()}
|
|
149
|
-
const errorId = `${name}-error-message
|
|
154
|
+
const id = `${props.name}-input-${useId()}`
|
|
155
|
+
const errorId = `${name}-error-message`
|
|
150
156
|
const ariaDescribedby = computed(() => {
|
|
151
|
-
const ariaDescribedbyId =
|
|
152
|
-
return props.fieldHasError ? errorId : ariaDescribedbyId
|
|
153
|
-
})
|
|
157
|
+
const ariaDescribedbyId = slots.description ? `${id}-description` : undefined
|
|
158
|
+
return props.fieldHasError ? errorId : ariaDescribedbyId
|
|
159
|
+
})
|
|
154
160
|
|
|
155
|
-
const modelValue = defineModel()
|
|
156
|
-
const fieldData = defineModel(
|
|
161
|
+
const modelValue = defineModel()
|
|
162
|
+
const fieldData = defineModel("fieldData") as Ref<IFormMultipleOptions>
|
|
157
163
|
</script>
|
|
158
164
|
|
|
159
165
|
<style lang="css">
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="input-range-wrapper" :data-theme="formTheme">
|
|
3
|
-
<div v-if="
|
|
3
|
+
<div v-if="slots.left" class="slot left">
|
|
4
4
|
<slot name="left"></slot>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div class="input-range-container">
|
|
8
|
-
<slot v-if="
|
|
8
|
+
<slot v-if="slots.markers" name="markers"></slot>
|
|
9
9
|
|
|
10
10
|
<input
|
|
11
11
|
type="range"
|
|
@@ -15,22 +15,28 @@
|
|
|
15
15
|
:min
|
|
16
16
|
:max
|
|
17
17
|
:step
|
|
18
|
-
:list="
|
|
19
|
-
:class="[
|
|
18
|
+
:list="slots.datalist ? name + '-datalist' : ''"
|
|
19
|
+
:class="[
|
|
20
|
+
'input-range-core',
|
|
21
|
+
`input-range--${size}`,
|
|
22
|
+
`input-range--${weight}`,
|
|
23
|
+
styleClassPassthrough,
|
|
24
|
+
{ 'has-markers': slots.markers },
|
|
25
|
+
]"
|
|
20
26
|
v-model="modelValue"
|
|
21
27
|
ref="inputRange"
|
|
22
28
|
/>
|
|
23
29
|
|
|
24
|
-
<slot v-if="
|
|
30
|
+
<slot v-if="slots.datalist" name="datalist"></slot>
|
|
25
31
|
</div>
|
|
26
|
-
<div v-if="
|
|
32
|
+
<div v-if="slots.right" class="slot right">
|
|
27
33
|
<slot name="right"></slot>
|
|
28
34
|
</div>
|
|
29
35
|
</div>
|
|
30
36
|
</template>
|
|
31
37
|
|
|
32
38
|
<script setup lang="ts">
|
|
33
|
-
import propValidators from
|
|
39
|
+
import propValidators from "../c12/prop-validators"
|
|
34
40
|
|
|
35
41
|
const props = defineProps({
|
|
36
42
|
id: {
|
|
@@ -55,7 +61,7 @@ const props = defineProps({
|
|
|
55
61
|
},
|
|
56
62
|
placeholder: {
|
|
57
63
|
type: String,
|
|
58
|
-
default:
|
|
64
|
+
default: "",
|
|
59
65
|
},
|
|
60
66
|
required: {
|
|
61
67
|
type: Boolean,
|
|
@@ -63,23 +69,23 @@ const props = defineProps({
|
|
|
63
69
|
},
|
|
64
70
|
theme: {
|
|
65
71
|
type: String as PropType<string>,
|
|
66
|
-
default:
|
|
72
|
+
default: "primary",
|
|
67
73
|
validator(value: string) {
|
|
68
|
-
return propValidators.theme.includes(value)
|
|
74
|
+
return propValidators.theme.includes(value)
|
|
69
75
|
},
|
|
70
76
|
},
|
|
71
77
|
size: {
|
|
72
78
|
type: String as PropType<string>,
|
|
73
|
-
default:
|
|
79
|
+
default: "medium",
|
|
74
80
|
validator(value: string) {
|
|
75
|
-
return propValidators.size.includes(value)
|
|
81
|
+
return propValidators.size.includes(value)
|
|
76
82
|
},
|
|
77
83
|
},
|
|
78
84
|
weight: {
|
|
79
85
|
type: String as PropType<string>,
|
|
80
|
-
default:
|
|
86
|
+
default: "wght-400",
|
|
81
87
|
validator(value: string) {
|
|
82
|
-
return propValidators.weight.includes(value)
|
|
88
|
+
return propValidators.weight.includes(value)
|
|
83
89
|
},
|
|
84
90
|
},
|
|
85
91
|
fieldHasError: {
|
|
@@ -90,28 +96,24 @@ const props = defineProps({
|
|
|
90
96
|
type: Array as PropType<string[]>,
|
|
91
97
|
default: () => [],
|
|
92
98
|
},
|
|
93
|
-
})
|
|
99
|
+
})
|
|
94
100
|
|
|
95
|
-
const slots = useSlots()
|
|
96
|
-
const hasDataList = computed(() => slots.datalist !== undefined);
|
|
97
|
-
const hasMarkers = computed(() => slots.markers !== undefined);
|
|
98
|
-
const hasLeftContent = computed(() => slots.left !== undefined);
|
|
99
|
-
const hasRightContent = computed(() => slots.right !== undefined);
|
|
101
|
+
const slots = useSlots()
|
|
100
102
|
|
|
101
103
|
const formTheme = computed(() => {
|
|
102
|
-
return props.fieldHasError ?
|
|
103
|
-
})
|
|
104
|
+
return props.fieldHasError ? "error" : props.theme
|
|
105
|
+
})
|
|
104
106
|
|
|
105
|
-
const modelValue = defineModel<number | readonly number[]>()
|
|
107
|
+
const modelValue = defineModel<number | readonly number[]>()
|
|
106
108
|
|
|
107
109
|
// @input="changeBackgroundColor"
|
|
108
110
|
const changeBackgroundColor = () => {
|
|
109
|
-
console.log(
|
|
110
|
-
const inputRange = ref<HTMLInputElement | null>(null)
|
|
111
|
+
console.log("changeBackgroundColor()")
|
|
112
|
+
const inputRange = ref<HTMLInputElement | null>(null)
|
|
111
113
|
if (inputRange.value !== null) {
|
|
112
|
-
inputRange.value.style.accentColor =
|
|
114
|
+
inputRange.value.style.accentColor = "hsl(" + modelValue.value + ", 100%, 50%)"
|
|
113
115
|
}
|
|
114
|
-
}
|
|
116
|
+
}
|
|
115
117
|
</script>
|
|
116
118
|
|
|
117
119
|
<style lang="css">
|
|
@@ -137,7 +139,7 @@ const changeBackgroundColor = () => {
|
|
|
137
139
|
flex-grow: 1;
|
|
138
140
|
|
|
139
141
|
display: grid;
|
|
140
|
-
grid-template-areas:
|
|
142
|
+
grid-template-areas: "element-stack";
|
|
141
143
|
|
|
142
144
|
.input-range-markers {
|
|
143
145
|
grid-area: element-stack;
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="input-range-with-label" :data-theme="formTheme" :class="[elementClasses, { error: fieldHasError }]">
|
|
3
|
-
<InputLabel
|
|
3
|
+
<InputLabel
|
|
4
|
+
:for="id"
|
|
5
|
+
:id
|
|
6
|
+
:theme
|
|
7
|
+
:name
|
|
8
|
+
input-variant="normal"
|
|
9
|
+
:field-has-error
|
|
10
|
+
:style-class-passthrough="['input-number-label', 'body-normal-bold']"
|
|
11
|
+
>
|
|
4
12
|
<template #textLabel>{{ label }}</template>
|
|
5
13
|
</InputLabel>
|
|
6
14
|
|
|
7
|
-
<template v-if="
|
|
15
|
+
<template v-if="slots.description">
|
|
8
16
|
<slot name="description"></slot>
|
|
9
17
|
</template>
|
|
10
18
|
|
|
11
19
|
<InputRangeCore v-model="modelValue" :id :name :min :max :step :theme :required :size :weight :fieldHasError>
|
|
12
|
-
<template v-if="
|
|
20
|
+
<template v-if="slots.datalist" #datalist>
|
|
13
21
|
<slot name="datalist"></slot>
|
|
14
22
|
</template>
|
|
15
|
-
<template v-if="
|
|
23
|
+
<template v-if="slots.left" #left>
|
|
16
24
|
<InputButtonCore
|
|
17
25
|
type="button"
|
|
18
26
|
@click.stop.prevent="updateRange(-step, Number(modelValue) > min)"
|
|
@@ -27,7 +35,7 @@
|
|
|
27
35
|
</template>
|
|
28
36
|
</InputButtonCore>
|
|
29
37
|
</template>
|
|
30
|
-
<template v-if="
|
|
38
|
+
<template v-if="slots.right" #right>
|
|
31
39
|
<InputButtonCore
|
|
32
40
|
type="button"
|
|
33
41
|
@click.stop.prevent="updateRange(step, Number(modelValue) < max)"
|
|
@@ -48,9 +56,22 @@
|
|
|
48
56
|
</template>
|
|
49
57
|
|
|
50
58
|
<script setup lang="ts">
|
|
51
|
-
import propValidators from
|
|
59
|
+
import propValidators from "../../c12/prop-validators"
|
|
52
60
|
|
|
53
|
-
const {
|
|
61
|
+
const {
|
|
62
|
+
name,
|
|
63
|
+
label,
|
|
64
|
+
required,
|
|
65
|
+
min,
|
|
66
|
+
max,
|
|
67
|
+
step,
|
|
68
|
+
theme,
|
|
69
|
+
size,
|
|
70
|
+
weight,
|
|
71
|
+
styleClassPassthrough,
|
|
72
|
+
errorMessage,
|
|
73
|
+
fieldHasError,
|
|
74
|
+
} = defineProps({
|
|
54
75
|
name: {
|
|
55
76
|
type: String,
|
|
56
77
|
required: true,
|
|
@@ -73,7 +94,7 @@ const { name, label, required, min, max, step, theme, size, weight, styleClassPa
|
|
|
73
94
|
},
|
|
74
95
|
placeholder: {
|
|
75
96
|
type: String,
|
|
76
|
-
default:
|
|
97
|
+
default: "",
|
|
77
98
|
},
|
|
78
99
|
errorMessage: {
|
|
79
100
|
type: [Object, String],
|
|
@@ -89,23 +110,23 @@ const { name, label, required, min, max, step, theme, size, weight, styleClassPa
|
|
|
89
110
|
},
|
|
90
111
|
theme: {
|
|
91
112
|
type: String as PropType<string>,
|
|
92
|
-
default:
|
|
113
|
+
default: "primary",
|
|
93
114
|
validator(value: string) {
|
|
94
|
-
return propValidators.theme.includes(value)
|
|
115
|
+
return propValidators.theme.includes(value)
|
|
95
116
|
},
|
|
96
117
|
},
|
|
97
118
|
size: {
|
|
98
119
|
type: String as PropType<string>,
|
|
99
|
-
default:
|
|
120
|
+
default: "medium",
|
|
100
121
|
validator(value: string) {
|
|
101
|
-
return propValidators.size.includes(value)
|
|
122
|
+
return propValidators.size.includes(value)
|
|
102
123
|
},
|
|
103
124
|
},
|
|
104
125
|
weight: {
|
|
105
126
|
type: String as PropType<string>,
|
|
106
|
-
default:
|
|
127
|
+
default: "wght-400",
|
|
107
128
|
validator(value: string) {
|
|
108
|
-
return propValidators.weight.includes(value)
|
|
129
|
+
return propValidators.weight.includes(value)
|
|
109
130
|
},
|
|
110
131
|
},
|
|
111
132
|
styleClassPassthrough: {
|
|
@@ -114,29 +135,25 @@ const { name, label, required, min, max, step, theme, size, weight, styleClassPa
|
|
|
114
135
|
},
|
|
115
136
|
deepCssClassPassthrough: {
|
|
116
137
|
type: String,
|
|
117
|
-
default:
|
|
138
|
+
default: "",
|
|
118
139
|
},
|
|
119
|
-
})
|
|
140
|
+
})
|
|
120
141
|
|
|
121
|
-
const slots = useSlots()
|
|
122
|
-
const
|
|
123
|
-
const hasDataList = computed(() => slots.datalist !== undefined);
|
|
124
|
-
const hasLeftContent = computed(() => slots.left !== undefined);
|
|
125
|
-
const hasRightContent = computed(() => slots.right !== undefined);
|
|
126
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
142
|
+
const slots = useSlots()
|
|
143
|
+
const { elementClasses } = useStyleClassPassthrough(styleClassPassthrough)
|
|
127
144
|
|
|
128
|
-
const id = useId()
|
|
145
|
+
const id = useId()
|
|
129
146
|
const formTheme = computed(() => {
|
|
130
|
-
return fieldHasError ?
|
|
131
|
-
})
|
|
147
|
+
return fieldHasError ? "error" : theme
|
|
148
|
+
})
|
|
132
149
|
|
|
133
|
-
const modelValue = defineModel<number | readonly number[]>()
|
|
150
|
+
const modelValue = defineModel<number | readonly number[]>()
|
|
134
151
|
|
|
135
152
|
const updateRange = (step: number, withinRangeLimit: boolean) => {
|
|
136
153
|
if (withinRangeLimit) {
|
|
137
|
-
modelValue.value = (Number(modelValue.value) + step) as number
|
|
154
|
+
modelValue.value = (Number(modelValue.value) + step) as number
|
|
138
155
|
}
|
|
139
|
-
}
|
|
156
|
+
}
|
|
140
157
|
</script>
|
|
141
158
|
|
|
142
159
|
<style lang="css">
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="input-range-fancy-with-label" :data-theme="formTheme" :class="[elementClasses, { error: fieldHasError }]">
|
|
3
3
|
<label class="input-range-fancy-label body-normal-bold" :for="id">{{ label }}</label>
|
|
4
|
-
<template v-if="
|
|
4
|
+
<template v-if="slots.description">
|
|
5
5
|
<slot name="description"></slot>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
|
-
<InputRangeFancyCore
|
|
8
|
+
<InputRangeFancyCore
|
|
9
|
+
v-model="modelValue"
|
|
10
|
+
:id
|
|
11
|
+
:name
|
|
12
|
+
:rangeLowLabel
|
|
13
|
+
:rangeHighLabel
|
|
14
|
+
:min
|
|
15
|
+
:max
|
|
16
|
+
:step
|
|
17
|
+
:theme
|
|
18
|
+
:required
|
|
19
|
+
:size
|
|
20
|
+
:weight
|
|
21
|
+
:fieldHasError
|
|
22
|
+
/>
|
|
9
23
|
<InputError :errorMessage :showError="fieldHasError" :id :isDetached="true" :styleClassPassthrough="['mbe-20']" />
|
|
10
24
|
</div>
|
|
11
25
|
</template>
|
|
12
26
|
|
|
13
27
|
<script setup lang="ts">
|
|
14
|
-
import propValidators from
|
|
28
|
+
import propValidators from "../c12/prop-validators"
|
|
15
29
|
|
|
16
30
|
const props = defineProps({
|
|
17
31
|
id: {
|
|
@@ -48,7 +62,7 @@ const props = defineProps({
|
|
|
48
62
|
},
|
|
49
63
|
placeholder: {
|
|
50
64
|
type: String,
|
|
51
|
-
default:
|
|
65
|
+
default: "",
|
|
52
66
|
},
|
|
53
67
|
errorMessage: {
|
|
54
68
|
type: [Object, String],
|
|
@@ -64,23 +78,23 @@ const props = defineProps({
|
|
|
64
78
|
},
|
|
65
79
|
theme: {
|
|
66
80
|
type: String as PropType<string>,
|
|
67
|
-
default:
|
|
81
|
+
default: "primary",
|
|
68
82
|
validator(value: string) {
|
|
69
|
-
return propValidators.theme.includes(value)
|
|
83
|
+
return propValidators.theme.includes(value)
|
|
70
84
|
},
|
|
71
85
|
},
|
|
72
86
|
size: {
|
|
73
87
|
type: String as PropType<string>,
|
|
74
|
-
default:
|
|
88
|
+
default: "medium",
|
|
75
89
|
validator(value: string) {
|
|
76
|
-
return propValidators.size.includes(value)
|
|
90
|
+
return propValidators.size.includes(value)
|
|
77
91
|
},
|
|
78
92
|
},
|
|
79
93
|
weight: {
|
|
80
94
|
type: String as PropType<string>,
|
|
81
|
-
default:
|
|
95
|
+
default: "wght-400",
|
|
82
96
|
validator(value: string) {
|
|
83
|
-
return propValidators.weight.includes(value)
|
|
97
|
+
return propValidators.weight.includes(value)
|
|
84
98
|
},
|
|
85
99
|
},
|
|
86
100
|
styleClassPassthrough: {
|
|
@@ -89,19 +103,18 @@ const props = defineProps({
|
|
|
89
103
|
},
|
|
90
104
|
deepCssClassPassthrough: {
|
|
91
105
|
type: String,
|
|
92
|
-
default:
|
|
106
|
+
default: "",
|
|
93
107
|
},
|
|
94
|
-
})
|
|
108
|
+
})
|
|
95
109
|
|
|
96
|
-
const slots = useSlots()
|
|
97
|
-
const
|
|
98
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
110
|
+
const slots = useSlots()
|
|
111
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
99
112
|
|
|
100
113
|
const formTheme = computed(() => {
|
|
101
|
-
return props.fieldHasError ?
|
|
102
|
-
})
|
|
114
|
+
return props.fieldHasError ? "error" : props.theme
|
|
115
|
+
})
|
|
103
116
|
|
|
104
|
-
const modelValue = defineModel<number | readonly number[]>()
|
|
117
|
+
const modelValue = defineModel<number | readonly number[]>()
|
|
105
118
|
</script>
|
|
106
119
|
|
|
107
120
|
<style lang="css">
|