srcdev-nuxt-forms 2.1.13 → 2.1.14
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/assets/styles/forms/themes/_error.css +14 -0
- package/assets/styles/forms/themes/_ghost.css +14 -0
- package/assets/styles/forms/themes/_primary.css +15 -1
- package/assets/styles/forms/themes/_secondary.css +14 -0
- package/assets/styles/forms/themes/_success.css +14 -0
- package/assets/styles/forms/themes/_tertiary.css +14 -0
- package/assets/styles/forms/themes/_warning.css +14 -0
- package/assets/styles/forms/variables/_theme.css +3 -0
- package/assets/styles/main.css +1 -0
- package/assets/styles/typography/index.css +2 -0
- package/assets/styles/{variables/_typography.css → typography/utils/_classes.css} +0 -16
- package/assets/styles/typography/utils/_weights.css +69 -0
- package/assets/styles/typography/utils/index.css +2 -0
- package/assets/styles/typography/variables/_reponsive-font-size.css +10 -0
- package/assets/styles/typography/variables/index.css +2 -0
- package/assets/styles/variables/index.css +1 -3
- package/components/forms/c12/prop-validators/index.ts +24 -1
- package/components/forms/form-errors/InputError.vue +7 -3
- package/components/forms/form-errors/stories/InputError.stories.ts +36 -0
- package/components/forms/form-errors/tests/InputError.spec.ts +67 -0
- package/components/forms/input-button/InputButtonCore.vue +7 -5
- package/components/forms/input-button/stories/InputButtonCore.mdx +8 -0
- package/components/forms/input-button/stories/InputButtonCore.stories.ts +65 -0
- package/components/forms/input-button/variants/InputButtonConfirm.vue +5 -5
- package/components/forms/input-button/variants/InputButtonSubmit.vue +4 -16
- package/components/forms/input-checkbox/variants/MultipleCheckboxes.vue +39 -6
- package/components/forms/input-checkbox/variants/SingleCheckbox.vue +3 -3
- package/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +130 -0
- package/components/forms/{input-checkbox/InputCheckboxCore.vue → input-checkbox-radio/InputCheckboxRadioCore.vue} +46 -14
- package/components/forms/{input-checkbox/InputCheckboxWithLabel.vue → input-checkbox-radio/InputCheckboxRadioWithLabel.vue} +12 -8
- package/components/forms/input-number/variants/InputNumberDefault.vue +1 -1
- package/components/forms/input-radio/variants/MultipleRadiobuttons.vue +39 -4
- package/components/forms/input-range/InputRangeCore.vue +32 -0
- package/components/forms/input-range/variants/InputRangeDefault.vue +1 -1
- package/components/forms/input-range-fancy/InputRangeFancyCore.vue +2 -2
- package/components/forms/input-range-fancy/InputRangeFancyWithLabel.vue +1 -1
- package/components/forms/input-text/InputTextCore.vue +5 -1
- package/components/forms/input-text/stories/InputTextCore.mdx +8 -0
- package/components/forms/input-text/stories/InputTextCore.stories.ts +59 -0
- package/components/forms/input-text/variants/{material/InputPasswordWithLabel.vue → InputPasswordWithLabel.vue} +1 -1
- package/components/forms/input-text/variants/{material/InputTextAsNumberWithLabel.vue → InputTextAsNumberWithLabel.vue} +2 -2
- package/components/forms/input-text/variants/{material/InputTextWithLabel.vue → InputTextWithLabel.vue} +2 -2
- package/components/forms/input-text/variants/stories/InputPasswordWithLabel.mdx +8 -0
- package/components/forms/input-text/variants/stories/InputPasswordWithLabel.stories.ts +60 -0
- package/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +1 -1
- package/nuxt.config.ts +11 -4
- package/package.json +17 -4
- package/components/forms/input-radio/InputRadiobuttonCore.vue +0 -170
- package/components/forms/input-radio/InputRadiobuttonWithLabel.vue +0 -93
- /package/assets/styles/{variables/_default.css → typography/variables/_colors.css} +0 -0
- /package/assets/styles/variables/colors/{index.css → colors.css} +0 -0
|
@@ -6,14 +6,45 @@
|
|
|
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
|
-
<
|
|
9
|
+
<InputCheckboxRadioButton
|
|
10
|
+
v-if="isButton"
|
|
11
|
+
type="checkbox"
|
|
12
|
+
:id="`${name}-${item.value}`"
|
|
13
|
+
:name
|
|
14
|
+
:required
|
|
15
|
+
:label="item.label"
|
|
16
|
+
:fieldHasError
|
|
17
|
+
v-model="modelValue"
|
|
18
|
+
:true-value="item.value"
|
|
19
|
+
:size
|
|
20
|
+
:optionsLayout
|
|
21
|
+
:theme
|
|
22
|
+
>
|
|
10
23
|
<template #checkedIcon>
|
|
11
24
|
<slot name="checkedIcon"></slot>
|
|
12
25
|
</template>
|
|
13
|
-
</
|
|
26
|
+
</InputCheckboxRadioButton>
|
|
27
|
+
<InputCheckboxRadioWithLabel
|
|
28
|
+
v-else
|
|
29
|
+
type="checkbox"
|
|
30
|
+
:id="`${name}-${item.value}`"
|
|
31
|
+
:name
|
|
32
|
+
:required
|
|
33
|
+
:label="item.label"
|
|
34
|
+
:fieldHasError
|
|
35
|
+
v-model="modelValue"
|
|
36
|
+
:true-value="item.value"
|
|
37
|
+
:size
|
|
38
|
+
:optionsLayout
|
|
39
|
+
:theme
|
|
40
|
+
>
|
|
41
|
+
<template #checkedIcon>
|
|
42
|
+
<slot name="checkedIcon"></slot>
|
|
43
|
+
</template>
|
|
44
|
+
</InputCheckboxRadioWithLabel>
|
|
14
45
|
</template>
|
|
15
46
|
</div>
|
|
16
|
-
<InputError :errorMessage="errorMessage" :fieldHasError :id="name" :isDetached="true" />
|
|
47
|
+
<InputError :errorMessage="errorMessage" :showError="fieldHasError" :id="name" :isDetached="true" />
|
|
17
48
|
</fieldset>
|
|
18
49
|
</template>
|
|
19
50
|
|
|
@@ -21,9 +52,7 @@
|
|
|
21
52
|
import propValidators from '../../c12/prop-validators';
|
|
22
53
|
import type { IOptionsConfig, IFormMultipleOptions } from '@/types/types.forms';
|
|
23
54
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols, styleClassPassthrough, theme } = defineProps({
|
|
55
|
+
const { id, name, legend, label, required, fieldHasError, placeholder, isButton, errorMessage, size, optionsLayout, equalCols, styleClassPassthrough, theme } = defineProps({
|
|
27
56
|
id: {
|
|
28
57
|
type: String,
|
|
29
58
|
required: true,
|
|
@@ -44,6 +73,10 @@ const { id, name, legend, label, required, fieldHasError, placeholder, errorMess
|
|
|
44
73
|
type: String,
|
|
45
74
|
default: '',
|
|
46
75
|
},
|
|
76
|
+
isButton: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false,
|
|
79
|
+
},
|
|
47
80
|
errorMessage: {
|
|
48
81
|
type: [Object, String],
|
|
49
82
|
required: true,
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
<slot name="description"></slot>
|
|
6
6
|
</template>
|
|
7
7
|
<div class="single-checkbox-items" :class="[optionsLayout]">
|
|
8
|
-
<
|
|
8
|
+
<InputCheckboxRadioWithLabel type="checkbox" :id :name :required :label :fieldHasError v-model="modelValue" :trueValue :falseValue :size :theme>
|
|
9
9
|
<template #checkedIcon>
|
|
10
10
|
<slot name="checkedIcon"></slot>
|
|
11
11
|
</template>
|
|
12
12
|
<template v-if="hasLabelContent" #labelContent>
|
|
13
13
|
<slot name="labelContent"></slot>
|
|
14
14
|
</template>
|
|
15
|
-
</
|
|
15
|
+
</InputCheckboxRadioWithLabel>
|
|
16
16
|
</div>
|
|
17
|
-
<InputError :errorMessage :fieldHasError :id="name" :isDetached="true" :styleClassPassthrough="inputErrorStyles" />
|
|
17
|
+
<InputError :errorMessage :showError="fieldHasError" :id="name" :isDetached="true" :styleClassPassthrough="inputErrorStyles" />
|
|
18
18
|
</fieldset>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="input-checkbox-radio-button-button" :data-form-theme="formTheme" :class="[elementClasses, optionsLayout, { error: fieldHasError }]">
|
|
3
|
+
<InputCheckboxRadioCore :isButton="true" :type :id :name :required v-model="modelValue" size="small" :trueValue :falseValue :fieldHasError :theme>
|
|
4
|
+
<template #checkedIcon>
|
|
5
|
+
<slot name="checkedIcon"></slot>
|
|
6
|
+
</template>
|
|
7
|
+
</InputCheckboxRadioCore>
|
|
8
|
+
<label v-if="hasLabelContent" class="input-checkbox-radio-button-label body-normal" :for="id">
|
|
9
|
+
<slot name="labelContent"></slot>
|
|
10
|
+
</label>
|
|
11
|
+
<label v-else class="input-checkbox-radio-button-label body-normal-semibold" :for="id">{{ label }}</label>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import propValidators from '../c12/prop-validators';
|
|
17
|
+
|
|
18
|
+
const { type, id, name, label, required, fieldHasError, trueValue, falseValue, size, optionsLayout, styleClassPassthrough, theme } = defineProps({
|
|
19
|
+
type: {
|
|
20
|
+
type: String as PropType<'checkbox' | 'radio'>,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
id: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
name: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
label: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
required: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
fieldHasError: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
trueValue: {
|
|
44
|
+
type: [String, Number, Boolean],
|
|
45
|
+
default: true,
|
|
46
|
+
},
|
|
47
|
+
falseValue: {
|
|
48
|
+
type: [String, Number, Boolean],
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
size: {
|
|
52
|
+
type: String as PropType<string>,
|
|
53
|
+
default: 'medium',
|
|
54
|
+
validator(value: string) {
|
|
55
|
+
return propValidators.size.includes(value);
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
optionsLayout: {
|
|
59
|
+
type: String as PropType<string>,
|
|
60
|
+
default: 'equal-widths',
|
|
61
|
+
validator(value: string) {
|
|
62
|
+
return propValidators.optionsLayout.includes(value);
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
styleClassPassthrough: {
|
|
66
|
+
type: Array as PropType<string[]>,
|
|
67
|
+
default: () => [],
|
|
68
|
+
},
|
|
69
|
+
theme: {
|
|
70
|
+
type: String as PropType<string>,
|
|
71
|
+
default: 'primary',
|
|
72
|
+
validator(value: string) {
|
|
73
|
+
return propValidators.theme.includes(value);
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const slots = useSlots();
|
|
79
|
+
const hasLabelContent = computed(() => slots.labelContent !== undefined);
|
|
80
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
81
|
+
|
|
82
|
+
const modelValue = defineModel();
|
|
83
|
+
|
|
84
|
+
const formTheme = computed(() => {
|
|
85
|
+
return fieldHasError ? 'error' : theme;
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<style lang="css">
|
|
90
|
+
.input-checkbox-radio-button-button {
|
|
91
|
+
--_checkbox-size: initial;
|
|
92
|
+
--_background-color: var(--theme-checkbox-radio-button-bg-default);
|
|
93
|
+
--_outline-width: var(--input-outline-width-thin);
|
|
94
|
+
--_border-color: var(--theme-checkbox-radio-button-border-default);
|
|
95
|
+
--_outline-color: var(--theme-checkbox-radio-button-outline-default);
|
|
96
|
+
--_label-color: var(--theme-checkbox-radio-button-label-default);
|
|
97
|
+
--_box-shadow: none;
|
|
98
|
+
--_white-space: wrap;
|
|
99
|
+
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
gap: 4px;
|
|
103
|
+
|
|
104
|
+
background-color: var(--_background-color);
|
|
105
|
+
border-radius: 22px;
|
|
106
|
+
border: var(--theme-checkbox-radio-button-border-width) solid var(--_border-color);
|
|
107
|
+
outline: var(--theme-checkbox-radio-button-outline-width) solid var(--_outline-color);
|
|
108
|
+
box-shadow: var(--_box-shadow);
|
|
109
|
+
padding-inline: 12px;
|
|
110
|
+
|
|
111
|
+
&.inline {
|
|
112
|
+
--_white-space: nowrap;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.input-checkbox-radio-button-label {
|
|
116
|
+
display: flex;
|
|
117
|
+
color: var(--_label-color);
|
|
118
|
+
width: 100%;
|
|
119
|
+
height: 100%;
|
|
120
|
+
align-items: center;
|
|
121
|
+
margin-block: 8px;
|
|
122
|
+
padding-inline: 8px;
|
|
123
|
+
white-space: var(--_white-space);
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="input-checkbox-wrapper" :data-form-theme="formTheme" :class="[size, { error: fieldHasError }]">
|
|
2
|
+
<div class="input-checkbox-radio-wrapper" :data-form-theme="formTheme" :class="[type, size, elementClasses, { error: fieldHasError }, { button: isButton }]">
|
|
3
3
|
<slot name="checkedIcon" v-if="isChecked">
|
|
4
|
-
<Icon name="
|
|
4
|
+
<Icon :name="defaultIcon" class="input-checked-icon" />
|
|
5
5
|
</slot>
|
|
6
6
|
|
|
7
7
|
<input
|
|
8
|
-
type
|
|
8
|
+
:type
|
|
9
9
|
:true-value="trueValue"
|
|
10
10
|
:false-value="falseValue"
|
|
11
11
|
:id
|
|
12
12
|
:name
|
|
13
13
|
:required="required && !multipleOptions"
|
|
14
14
|
:value="trueValue"
|
|
15
|
-
class="input-checkbox-core"
|
|
15
|
+
class="input-checkbox-radio-core"
|
|
16
16
|
:class="[size, { error: fieldHasError }]"
|
|
17
17
|
v-model="modelValue"
|
|
18
18
|
ref="inputField"
|
|
@@ -22,7 +22,15 @@
|
|
|
22
22
|
|
|
23
23
|
<script setup lang="ts">
|
|
24
24
|
import propValidators from '../c12/prop-validators';
|
|
25
|
-
const { id, name, required, trueValue, falseValue, multipleOptions, theme, styleClassPassthrough, size, fieldHasError } = defineProps({
|
|
25
|
+
const { isButton, type, id, name, required, trueValue, falseValue, multipleOptions, theme, styleClassPassthrough, size, fieldHasError } = defineProps({
|
|
26
|
+
isButton: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
type: {
|
|
31
|
+
type: String as PropType<'checkbox' | 'radio'>,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
26
34
|
id: {
|
|
27
35
|
type: String,
|
|
28
36
|
required: true,
|
|
@@ -81,6 +89,10 @@ const modelValue = defineModel<any>();
|
|
|
81
89
|
|
|
82
90
|
const inputField = ref<HTMLInputElement | null>(null);
|
|
83
91
|
|
|
92
|
+
const defaultIcon = computed(() => {
|
|
93
|
+
return type === 'checkbox' ? 'material-symbols:check-small' : 'material-symbols:circle';
|
|
94
|
+
});
|
|
95
|
+
|
|
84
96
|
const isArray = Array.isArray(modelValue.value);
|
|
85
97
|
|
|
86
98
|
const isChecked = computed(() => {
|
|
@@ -93,28 +105,48 @@ const isChecked = computed(() => {
|
|
|
93
105
|
</script>
|
|
94
106
|
|
|
95
107
|
<style lang="css">
|
|
96
|
-
.input-checkbox-wrapper {
|
|
108
|
+
.input-checkbox-radio-wrapper {
|
|
97
109
|
--_checkbox-size: initial;
|
|
98
|
-
--_outline-width:
|
|
99
|
-
--_border-width:
|
|
100
|
-
--_border-
|
|
101
|
-
--
|
|
110
|
+
--_outline-width: 1px;
|
|
111
|
+
--_border-width: 1px;
|
|
112
|
+
--_border-radius: 50%;
|
|
113
|
+
--_background-color: var(--theme-form-checkbox-bg);
|
|
102
114
|
--_box-shadow: none;
|
|
103
115
|
|
|
116
|
+
&:not(.button) {
|
|
117
|
+
--_outline-width: var(--input-outline-width-thin);
|
|
118
|
+
--_border-width: var(--input-border-width-default);
|
|
119
|
+
&.checkbox {
|
|
120
|
+
--_background-color: var(--theme-form-checkbox-bg);
|
|
121
|
+
--_border-color: var(--theme-form-checkbox-border);
|
|
122
|
+
--_border-radius: 4px;
|
|
123
|
+
--_outline-color: var(--theme-form-checkbox-outline);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&.radio {
|
|
127
|
+
--_background-color: var(--theme-form-radio-bg);
|
|
128
|
+
--_border-color: var(--theme-form-radio-border);
|
|
129
|
+
--_border-radius: 50%;
|
|
130
|
+
--_outline-color: var(--theme-form-radio-outline);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
104
134
|
display: grid;
|
|
105
135
|
grid-template-areas: 'element-stack';
|
|
106
136
|
place-content: center;
|
|
107
137
|
|
|
108
|
-
background-color: var(--
|
|
109
|
-
border-radius: 4px;
|
|
138
|
+
background-color: var(--_background-color);
|
|
110
139
|
border: var(--_border-width) solid var(--_border-color);
|
|
140
|
+
border-radius: var(--_border-radius);
|
|
111
141
|
outline: 1px solid var(--_outline-color);
|
|
112
142
|
box-shadow: var(--_box-shadow);
|
|
113
143
|
|
|
114
144
|
height: var(--_checkbox-size);
|
|
115
145
|
width: var(--_checkbox-size);
|
|
116
146
|
|
|
117
|
-
|
|
147
|
+
transition: all 0.2s ease-in-out;
|
|
148
|
+
|
|
149
|
+
&:has(.input-checkbox-radio-core:focus-visible) {
|
|
118
150
|
--_box-shadow: var(--theme-form-focus-box-shadow);
|
|
119
151
|
}
|
|
120
152
|
|
|
@@ -143,7 +175,7 @@ const isChecked = computed(() => {
|
|
|
143
175
|
box-shadow: var(--_box-shadow);
|
|
144
176
|
}
|
|
145
177
|
|
|
146
|
-
.input-checkbox-core {
|
|
178
|
+
.input-checkbox-radio-core {
|
|
147
179
|
grid-area: element-stack;
|
|
148
180
|
appearance: none;
|
|
149
181
|
margin: 0;
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="input-checkbox-with-label" :class="[elementClasses, optionsLayout, { error: fieldHasError }]">
|
|
3
|
-
<
|
|
2
|
+
<div class="input-checkbox-radio-with-label" :class="[elementClasses, optionsLayout, { error: fieldHasError }]">
|
|
3
|
+
<InputCheckboxRadioCore :type :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme>
|
|
4
4
|
<template #checkedIcon>
|
|
5
5
|
<slot name="checkedIcon"></slot>
|
|
6
6
|
</template>
|
|
7
|
-
</
|
|
8
|
-
<label v-if="hasLabelContent" class="input-checkbox-label body-normal" :for="id">
|
|
7
|
+
</InputCheckboxRadioCore>
|
|
8
|
+
<label v-if="hasLabelContent" class="input-checkbox-radio-label body-normal" :for="id">
|
|
9
9
|
<slot name="labelContent"></slot>
|
|
10
10
|
</label>
|
|
11
|
-
<label v-else class="input-checkbox-label body-normal-semibold" :for="id">{{ label }}</label>
|
|
11
|
+
<label v-else class="input-checkbox-radio-label body-normal-semibold" :for="id">{{ label }}</label>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
16
|
import propValidators from '../c12/prop-validators';
|
|
17
17
|
|
|
18
|
-
const { id, name, label, required, fieldHasError, trueValue, falseValue, size, optionsLayout, styleClassPassthrough, theme } = defineProps({
|
|
18
|
+
const { type, id, name, label, required, fieldHasError, trueValue, falseValue, size, optionsLayout, styleClassPassthrough, theme } = defineProps({
|
|
19
|
+
type: {
|
|
20
|
+
type: String as PropType<'checkbox' | 'radio'>,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
19
23
|
id: {
|
|
20
24
|
type: String,
|
|
21
25
|
required: true,
|
|
@@ -79,7 +83,7 @@ const modelValue = defineModel();
|
|
|
79
83
|
</script>
|
|
80
84
|
|
|
81
85
|
<style lang="css">
|
|
82
|
-
.input-checkbox-with-label {
|
|
86
|
+
.input-checkbox-radio-with-label {
|
|
83
87
|
--_white-space: wrap;
|
|
84
88
|
|
|
85
89
|
display: flex;
|
|
@@ -89,7 +93,7 @@ const modelValue = defineModel();
|
|
|
89
93
|
--_white-space: nowrap;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
.input-checkbox-label {
|
|
96
|
+
.input-checkbox-radio-label {
|
|
93
97
|
display: flex;
|
|
94
98
|
width: 100%;
|
|
95
99
|
height: 100%;
|
|
@@ -6,14 +6,45 @@
|
|
|
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
|
-
<
|
|
9
|
+
<InputCheckboxRadioButton
|
|
10
|
+
v-if="isButton"
|
|
11
|
+
type="radio"
|
|
12
|
+
:id="`${name}-${item.value}`"
|
|
13
|
+
:name="`${name}-${item.name}`"
|
|
14
|
+
:required
|
|
15
|
+
:label="item.label"
|
|
16
|
+
:fieldHasError
|
|
17
|
+
v-model="modelValue"
|
|
18
|
+
:true-value="item.value"
|
|
19
|
+
:size
|
|
20
|
+
:optionsLayout
|
|
21
|
+
:theme
|
|
22
|
+
>
|
|
10
23
|
<template #checkedIcon>
|
|
11
24
|
<slot name="checkedIcon"></slot>
|
|
12
25
|
</template>
|
|
13
|
-
</
|
|
26
|
+
</InputCheckboxRadioButton>
|
|
27
|
+
<InputCheckboxRadioWithLabel
|
|
28
|
+
v-else
|
|
29
|
+
type="radio"
|
|
30
|
+
:id="`${name}-${item.value}`"
|
|
31
|
+
:name="`${name}-${item.name}`"
|
|
32
|
+
:required
|
|
33
|
+
:label="item.label"
|
|
34
|
+
:fieldHasError
|
|
35
|
+
v-model="modelValue"
|
|
36
|
+
:true-value="item.value"
|
|
37
|
+
:size
|
|
38
|
+
:optionsLayout
|
|
39
|
+
:theme
|
|
40
|
+
>
|
|
41
|
+
<template #checkedIcon>
|
|
42
|
+
<slot name="checkedIcon"></slot>
|
|
43
|
+
</template>
|
|
44
|
+
</InputCheckboxRadioWithLabel>
|
|
14
45
|
</template>
|
|
15
46
|
</div>
|
|
16
|
-
<InputError :errorMessage="errorMessage" :fieldHasError :id="name" :isDetached="true" />
|
|
47
|
+
<InputError :errorMessage="errorMessage" :showError="fieldHasError" :id="name" :isDetached="true" />
|
|
17
48
|
</fieldset>
|
|
18
49
|
</template>
|
|
19
50
|
|
|
@@ -21,7 +52,7 @@
|
|
|
21
52
|
import propValidators from '../../c12/prop-validators';
|
|
22
53
|
import type { IFormMultipleOptions } from '@/types/types.forms';
|
|
23
54
|
|
|
24
|
-
const { id, name, legend, label, required, fieldHasError, placeholder, errorMessage, size, optionsLayout, equalCols, styleClassPassthrough, theme } = defineProps({
|
|
55
|
+
const { id, name, legend, label, required, fieldHasError, placeholder, isButton, errorMessage, size, optionsLayout, equalCols, styleClassPassthrough, theme } = defineProps({
|
|
25
56
|
id: {
|
|
26
57
|
type: String,
|
|
27
58
|
required: true,
|
|
@@ -42,6 +73,10 @@ const { id, name, legend, label, required, fieldHasError, placeholder, errorMess
|
|
|
42
73
|
type: String,
|
|
43
74
|
default: '',
|
|
44
75
|
},
|
|
76
|
+
isButton: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false,
|
|
79
|
+
},
|
|
45
80
|
errorMessage: {
|
|
46
81
|
type: [Object, String],
|
|
47
82
|
required: true,
|
|
@@ -140,6 +140,38 @@ const changeBackgroundColor = () => {
|
|
|
140
140
|
margin: 0;
|
|
141
141
|
width: 100%;
|
|
142
142
|
|
|
143
|
+
/*
|
|
144
|
+
&:hover {
|
|
145
|
+
cursor: -webkit-grab;
|
|
146
|
+
outline-color: red;
|
|
147
|
+
}
|
|
148
|
+
&:active {
|
|
149
|
+
cursor: -webkit-grabbing;
|
|
150
|
+
outline-color: blue;
|
|
151
|
+
}
|
|
152
|
+
&:focus-visible {
|
|
153
|
+
outline-offset: 0.25rem;
|
|
154
|
+
outline-color: transparent;
|
|
155
|
+
}
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
&::-webkit-slider-thumb {
|
|
159
|
+
/* appearance: none; */
|
|
160
|
+
/* -webkit-appearance: none; */
|
|
161
|
+
accent-color: blue;
|
|
162
|
+
color: blue;
|
|
163
|
+
background-color: 1px solid green;
|
|
164
|
+
outline: 1px solid blue;
|
|
165
|
+
border-radius: 50%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&::-webkit-slider-runnable-track {
|
|
169
|
+
appearance: none;
|
|
170
|
+
-webkit-appearance: none;
|
|
171
|
+
/* background: hsl(10 80% 50% / 0.5); */
|
|
172
|
+
/* box-shadow: 1px 1px 1px #fff, 0px 0px 1px #fff; */
|
|
173
|
+
}
|
|
174
|
+
|
|
143
175
|
/* For Chrome, Safari, Opera, and Edge */
|
|
144
176
|
/* &::-webkit-slider-runnable-track {
|
|
145
177
|
background: var(--theme-form-range-accent-color);
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</InputButtonCore>
|
|
41
41
|
</template>
|
|
42
42
|
</InputRangeCore>
|
|
43
|
-
<InputError :errorMessage :fieldHasError :id :isDetached="true" :styleClassPassthrough="['mbe-20']" />
|
|
43
|
+
<InputError :errorMessage :showError="fieldHasError" :id :isDetached="true" :styleClassPassthrough="['mbe-20']" />
|
|
44
44
|
</div>
|
|
45
45
|
</template>
|
|
46
46
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
8
|
<InputRangeFancyCore v-model="modelValue" :id :name :rangeLowLabel :rangeHighLabel :min :max :step :theme :required :size :weight :fieldHasError />
|
|
9
|
-
<InputError :errorMessage :fieldHasError :id :isDetached="true" :styleClassPassthrough="['mbe-20']" />
|
|
9
|
+
<InputError :errorMessage :showError="fieldHasError" :id :isDetached="true" :styleClassPassthrough="['mbe-20']" />
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
@@ -37,7 +37,8 @@ import propValidators from '../c12/prop-validators';
|
|
|
37
37
|
|
|
38
38
|
const { type, inputmode, maxlength, id, name, placeholder, required, fieldHasError, styleClassPassthrough, theme } = defineProps({
|
|
39
39
|
type: {
|
|
40
|
-
type: String as PropType<'text' | 'email' | 'password' | 'number' | 'tel' | 'url'>,
|
|
40
|
+
// type: String as PropType<'text' | 'email' | 'password' | 'number' | 'tel' | 'url'>,
|
|
41
|
+
type: String,
|
|
41
42
|
default: 'text',
|
|
42
43
|
validator(value: string) {
|
|
43
44
|
return propValidators.inputTypesText.includes(value);
|
|
@@ -46,6 +47,9 @@ const { type, inputmode, maxlength, id, name, placeholder, required, fieldHasErr
|
|
|
46
47
|
inputmode: {
|
|
47
48
|
type: String as PropType<'text' | 'email' | 'tel' | 'url' | 'search' | 'numeric' | 'none' | 'decimal'>,
|
|
48
49
|
default: 'text',
|
|
50
|
+
validator(value: string) {
|
|
51
|
+
return propValidators.inputMode.includes(value);
|
|
52
|
+
},
|
|
49
53
|
},
|
|
50
54
|
maxlength: {
|
|
51
55
|
type: Number,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@nuxtjs/storybook';
|
|
2
|
+
import InputTextCore from '../InputTextCore.vue';
|
|
3
|
+
import propValidators from '../../c12/prop-validators';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Forms/Input/Text/Core',
|
|
7
|
+
component: InputTextCore,
|
|
8
|
+
argTypes: {
|
|
9
|
+
type: {
|
|
10
|
+
options: propValidators.inputTypesText,
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
},
|
|
13
|
+
inputMode: {
|
|
14
|
+
options: propValidators.inputMode,
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
},
|
|
17
|
+
theme: {
|
|
18
|
+
options: propValidators.theme,
|
|
19
|
+
control: { type: 'select' },
|
|
20
|
+
default: 'primary',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} as Meta<typeof InputTextCore>;
|
|
24
|
+
|
|
25
|
+
const Template: StoryFn<typeof InputTextCore> = (args) => ({
|
|
26
|
+
components: { InputTextCore },
|
|
27
|
+
setup() {
|
|
28
|
+
return { args };
|
|
29
|
+
},
|
|
30
|
+
template: `
|
|
31
|
+
<Suspense>
|
|
32
|
+
<template #default>
|
|
33
|
+
<InputTextCore v-bind="args">
|
|
34
|
+
<template v-if="${'left' in args}" v-slot:title>${args.left}</template>
|
|
35
|
+
<template v-if="${'right' in args}" v-slot:content>${args.right}</template>
|
|
36
|
+
</InputTextCore>
|
|
37
|
+
</template>
|
|
38
|
+
<template #fallback>
|
|
39
|
+
<div>Loading...</div>
|
|
40
|
+
</template>
|
|
41
|
+
</Suspense>
|
|
42
|
+
`,
|
|
43
|
+
// template: '<InputTextCore v-bind="args" />',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const Primary = Template.bind({});
|
|
47
|
+
Primary.args = {
|
|
48
|
+
type: 'text',
|
|
49
|
+
inputmode: 'text',
|
|
50
|
+
maxlength: 255,
|
|
51
|
+
id: 'testId',
|
|
52
|
+
name: 'testName',
|
|
53
|
+
required: true,
|
|
54
|
+
placeholder: 'Input placeholder text',
|
|
55
|
+
fieldHasError: false,
|
|
56
|
+
styleClassPassthrough: ['testClass1', 'testClass2'],
|
|
57
|
+
theme: 'primary',
|
|
58
|
+
modelValue: 'This is the model value',
|
|
59
|
+
};
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script setup lang="ts">
|
|
24
|
-
import propValidators from '
|
|
24
|
+
import propValidators from '../../c12/prop-validators';
|
|
25
25
|
|
|
26
26
|
const { type, maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme } = defineProps({
|
|
27
27
|
type: {
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
</InputButtonCore>
|
|
54
54
|
</template>
|
|
55
55
|
</InputTextCore>
|
|
56
|
-
<InputError :errorMessage="errorMessage" :fieldHasError :id :isDetached="true" />
|
|
56
|
+
<InputError :errorMessage="errorMessage" :showError="fieldHasError" :id :isDetached="true" />
|
|
57
57
|
</div>
|
|
58
58
|
</template>
|
|
59
59
|
|
|
60
60
|
<script setup lang="ts">
|
|
61
|
-
import propValidators from '
|
|
61
|
+
import propValidators from '../../c12/prop-validators';
|
|
62
62
|
const { maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme, step, min, max } = defineProps({
|
|
63
63
|
maxlength: {
|
|
64
64
|
type: Number,
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
<slot name="right"></slot>
|
|
26
26
|
</template>
|
|
27
27
|
</InputTextCore>
|
|
28
|
-
<InputError :errorMessage="errorMessage" :fieldHasError :id :isDetached="false" />
|
|
28
|
+
<InputError :errorMessage="errorMessage" :showError="fieldHasError" :id :isDetached="false" />
|
|
29
29
|
</div>
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script setup lang="ts">
|
|
33
|
-
import propValidators from '
|
|
33
|
+
import propValidators from '../../c12/prop-validators';
|
|
34
34
|
const { type, maxlength, id, name, placeholder, label, errorMessage, fieldHasError, required, styleClassPassthrough, theme } = defineProps({
|
|
35
35
|
maxlength: {
|
|
36
36
|
type: Number,
|