srcdev-nuxt-forms 4.2.0 → 5.0.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/assets/styles/extends-layer/srcdev-forms/components/_form-fieldset.css +16 -0
- package/assets/styles/extends-layer/srcdev-forms/components/_input-checkbox-radio-options-button.css +59 -0
- package/assets/styles/extends-layer/srcdev-forms/components/_input-checkbox.css +71 -0
- package/assets/styles/extends-layer/srcdev-forms/components/_input-error.css +55 -0
- package/assets/styles/extends-layer/srcdev-forms/components/_input-label.css +18 -0
- package/assets/styles/extends-layer/srcdev-forms/components/_input-radio.css +67 -0
- package/assets/styles/extends-layer/srcdev-forms/components/_input-select.css +16 -0
- package/assets/styles/extends-layer/srcdev-forms/components/_input-text-as-number.css +22 -0
- package/assets/styles/extends-layer/srcdev-forms/components/_input-textarea.css +5 -0
- package/assets/styles/extends-layer/srcdev-forms/components/index.css +9 -0
- package/assets/styles/extends-layer/srcdev-forms/index.css +2 -0
- package/assets/styles/{forms/variables/_theme.css → extends-layer/srcdev-forms/setup/_generic.css} +3 -1
- package/assets/styles/extends-layer/srcdev-forms/setup/index.css +4 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_default.css +12 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_large.css +12 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_medium.css +12 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_small.css +12 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/sizes/_x-small.css +11 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/sizes/index.css +21 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/variants/_normal.css +48 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/variants/_underlined.css +48 -0
- package/assets/styles/extends-layer/srcdev-forms/setup/variants/index.css +2 -0
- package/assets/styles/main.css +3 -3
- package/assets/styles/setup/index.css +1 -0
- package/assets/styles/setup/variables/index.css +2 -0
- package/assets/styles/theming/index.css +2 -0
- package/assets/styles/theming/vars/index.css +1 -0
- package/assets/styles/utils/_page.css +1 -1
- package/components/forms/c12/prop-validators/index.ts +1 -1
- package/components/forms/form-errors/InputError.vue +22 -6
- package/components/forms/form-fieldset/FormFieldset.vue +94 -0
- package/components/forms/input-button/InputButtonCore.vue +1 -1
- package/components/forms/input-button/variants/InputButtonConfirm.vue +1 -1
- package/components/forms/input-button/variants/InputButtonSubmit.vue +1 -1
- package/components/forms/input-checkbox/MultipleCheckboxes.vue +62 -78
- package/components/forms/input-checkbox/SingleCheckbox.vue +19 -40
- package/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +43 -40
- package/components/forms/input-checkbox-radio/InputCheckboxRadioCore.vue +28 -42
- package/components/forms/input-checkbox-radio/InputCheckboxRadioWithLabel.vue +5 -1
- package/components/forms/input-label/InputLabel.vue +60 -0
- package/components/forms/input-radio/MultipleRadiobuttons.vue +56 -78
- package/components/forms/input-select/InputSelectCore.vue +164 -0
- package/components/forms/input-select/variants/InputSelectWithLabel.vue +123 -0
- package/components/forms/input-text/InputTextCore.vue +60 -1
- package/components/forms/input-text/variants/InputTextAsNumberWithLabel.vue +1 -1
- package/components/forms/input-text/variants/InputTextWithLabel.vue +11 -9
- package/components/forms/input-textarea/InputTextareaCore.vue +62 -1
- package/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +7 -5
- package/components/forms/toggle-switch/ToggleSwitchCore.vue +1 -1
- package/components/forms/toggle-switch/ToggleSwitchCoreOld.vue +1 -1
- package/components/forms/toggle-switch/variants/ToggleSwitchWithLabel.vue +1 -1
- package/components/forms/toggle-switch/variants/ToggleSwitchWithLabelInline.vue +1 -1
- package/package.json +1 -1
- package/assets/styles/forms/index.css +0 -2
- package/assets/styles/forms/variables/_sizes.css +0 -71
- package/assets/styles/forms/variables/index.css +0 -2
- package/assets/styles/typography/index.css +0 -2
- package/assets/styles/typography/variables/index.css +0 -2
- package/assets/styles/variables/index.css +0 -1
- package/components/forms/input-select/InputSelect.vue +0 -289
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_error.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_ghost.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_input-action-underlined.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_input-action.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_primary.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_secondary.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_success.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_tertiary.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/_warning.css +0 -0
- /package/assets/styles/{forms → extends-layer/srcdev-forms/setup}/themes/index.css +0 -0
- /package/assets/styles/{typography → setup}/variables/_reponsive-font-size.css +0 -0
- /package/assets/styles/{variables → setup/variables}/colors/_blue.css +0 -0
- /package/assets/styles/{variables → setup/variables}/colors/_gray.css +0 -0
- /package/assets/styles/{variables → setup/variables}/colors/_green.css +0 -0
- /package/assets/styles/{variables → setup/variables}/colors/_orange.css +0 -0
- /package/assets/styles/{variables → setup/variables}/colors/_red.css +0 -0
- /package/assets/styles/{variables → setup/variables}/colors/_yellow.css +0 -0
- /package/assets/styles/{variables/colors/colors.css → setup/variables/colors/index.css} +0 -0
- /package/assets/styles/{typography → theming}/utils/_font-classes.css +0 -0
- /package/assets/styles/{typography → theming}/utils/_weights.css +0 -0
- /package/assets/styles/{typography → theming}/utils/index.css +0 -0
- /package/assets/styles/{typography/variables/_colors.css → theming/vars/_type-colors.css} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label :for="id" class="input-label" :class="[elementClasses]">
|
|
3
|
+
<slot v-if="hasHtmlLabel" name="htmlLabel"></slot>
|
|
4
|
+
<slot v-if="hasTextLabel" name="textLabel"></slot>
|
|
5
|
+
</label>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import propValidators from '../c12/prop-validators';
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
id: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
20
|
+
fieldHasError: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false,
|
|
23
|
+
},
|
|
24
|
+
styleClassPassthrough: {
|
|
25
|
+
type: Array as PropType<string[]>,
|
|
26
|
+
default: () => [],
|
|
27
|
+
},
|
|
28
|
+
theme: {
|
|
29
|
+
type: String as PropType<string>,
|
|
30
|
+
default: 'primary',
|
|
31
|
+
validator(value: string) {
|
|
32
|
+
return propValidators.theme.includes(value);
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
inputVariant: {
|
|
36
|
+
type: String as PropType<string>,
|
|
37
|
+
default: 'normal',
|
|
38
|
+
validator(value: string) {
|
|
39
|
+
return propValidators.inputVariant.includes(value);
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const slots = useSlots();
|
|
45
|
+
const hasHtmlLabel = computed(() => slots.htmlLabel !== undefined);
|
|
46
|
+
const hasTextLabel = computed(() => slots.textLabel !== undefined);
|
|
47
|
+
|
|
48
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<style lang="css">
|
|
52
|
+
.input-label {
|
|
53
|
+
color: var(--input-label-text-color);
|
|
54
|
+
margin-block: var(--input-label-text-margin-block);
|
|
55
|
+
font-size: var(--input-label-text-size);
|
|
56
|
+
font-weight: var(--input-label-text-weight);
|
|
57
|
+
line-height: var(--input-label-text-line-height);
|
|
58
|
+
display: block;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<div v-if="hasDescriptionSlot" :id="`${name}-description`">
|
|
2
|
+
<FormFieldset :id :name :legend :fieldHasError :required :data-testid :styleClassPassthrough="['multiple-radiobuttons-fieldset']">
|
|
3
|
+
<template #description>
|
|
6
4
|
<slot name="description"></slot>
|
|
7
|
-
</
|
|
5
|
+
</template>
|
|
8
6
|
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
7
|
+
<template #content>
|
|
8
|
+
<div class="multiple-radiobuttons-items" :class="[optionsLayout]">
|
|
9
|
+
<template v-for="item in fieldData.data" :key="item.id">
|
|
10
|
+
<InputCheckboxRadioButton
|
|
11
|
+
v-if="isButton"
|
|
12
|
+
type="radio"
|
|
13
|
+
:id="`${name}-${item.value}`"
|
|
14
|
+
:name="`${name}-${item.name}`"
|
|
15
|
+
:required
|
|
16
|
+
:label="item.label"
|
|
17
|
+
:fieldHasError
|
|
18
|
+
v-model="modelValue"
|
|
19
|
+
:true-value="item.value"
|
|
20
|
+
:size
|
|
21
|
+
:optionsLayout
|
|
22
|
+
:theme
|
|
23
|
+
:direction
|
|
24
|
+
:ariaDescribedby
|
|
25
|
+
>
|
|
26
|
+
<template #checkedIcon>
|
|
27
|
+
<slot name="checkedIcon"></slot>
|
|
28
|
+
</template>
|
|
29
|
+
<template #itemIcon>
|
|
30
|
+
<slot name="itemIcon">
|
|
31
|
+
<Icon name="material-symbols:add-2" class="icon" />
|
|
32
|
+
</slot>
|
|
33
|
+
</template>
|
|
34
|
+
</InputCheckboxRadioButton>
|
|
35
|
+
<InputCheckboxRadioWithLabel
|
|
36
|
+
v-else
|
|
37
|
+
type="radio"
|
|
38
|
+
:id="`${name}-${item.value}`"
|
|
39
|
+
:name="`${name}-${item.name}`"
|
|
40
|
+
:required
|
|
41
|
+
:label="item.label"
|
|
42
|
+
:fieldHasError
|
|
43
|
+
v-model="modelValue"
|
|
44
|
+
:true-value="item.value"
|
|
45
|
+
:size
|
|
46
|
+
:optionsLayout
|
|
47
|
+
:theme
|
|
48
|
+
:ariaDescribedby
|
|
49
|
+
>
|
|
50
|
+
<template #checkedIcon>
|
|
51
|
+
<slot name="checkedIcon"></slot>
|
|
52
|
+
</template>
|
|
53
|
+
</InputCheckboxRadioWithLabel>
|
|
54
|
+
</template>
|
|
55
|
+
</div>
|
|
56
|
+
<InputError :errorMessage="errorMessage" :showError="fieldHasError" :id="errorId" :isDetached="true" />
|
|
57
|
+
</template>
|
|
58
|
+
</FormFieldset>
|
|
59
59
|
</template>
|
|
60
60
|
|
|
61
61
|
<script setup lang="ts">
|
|
@@ -145,7 +145,7 @@ const slots = useSlots();
|
|
|
145
145
|
const hasDescriptionSlot = computed(() => slots.description !== undefined);
|
|
146
146
|
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
147
147
|
|
|
148
|
-
const id = useId()
|
|
148
|
+
const id = `${props.name}-input-${useId()}`;
|
|
149
149
|
const errorId = `${name}-error-message`;
|
|
150
150
|
const ariaDescribedby = computed(() => {
|
|
151
151
|
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` : undefined;
|
|
@@ -157,28 +157,6 @@ const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
|
157
157
|
</script>
|
|
158
158
|
|
|
159
159
|
<style lang="css">
|
|
160
|
-
.multiple-radiobuttons-fieldset {
|
|
161
|
-
margin: 0;
|
|
162
|
-
padding: 0;
|
|
163
|
-
border: 0;
|
|
164
|
-
|
|
165
|
-
legend {
|
|
166
|
-
font-family: var(--font-family);
|
|
167
|
-
font-size: 1.6rem;
|
|
168
|
-
font-weight: 500;
|
|
169
|
-
|
|
170
|
-
&.has-description {
|
|
171
|
-
margin-bottom: 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.label-description {
|
|
176
|
-
font-family: var(--font-family);
|
|
177
|
-
font-size: 1.6rem;
|
|
178
|
-
margin-top: 1.2rem;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
160
|
.multiple-radiobuttons-items {
|
|
183
161
|
display: flex;
|
|
184
162
|
gap: 1.2rem;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="input-select-wrapper" :data-form-theme="formTheme" :data-size="size" :class="[inputVariant, size, { dirty: isDirty }, { active: isActive }, { error: fieldHasError }]">
|
|
3
|
+
<select v-model="modelValue" class="input-select-core" :name :id>
|
|
4
|
+
<option v-if="placeholder" value="" readonly :selected="!modelValue" class="input-select-core-option placeholder">{{ placeholder }}</option>
|
|
5
|
+
<option v-for="item in fieldData.data" :key="item.id" :value="item.value" :selected="item.value === modelValue" class="input-select-core-option">
|
|
6
|
+
<Icon :name="item.icon" class="input-select-core-option-icon" />
|
|
7
|
+
{{ item.label }}
|
|
8
|
+
</option>
|
|
9
|
+
</select>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import propValidators from '../c12/prop-validators';
|
|
15
|
+
import type { IFormMultipleOptions } from '@/types/types.forms';
|
|
16
|
+
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
id: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
name: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
placeholder: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
required: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
fieldHasError: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false,
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
type: String as PropType<string>,
|
|
40
|
+
default: 'medium',
|
|
41
|
+
validator(value: string) {
|
|
42
|
+
return propValidators.size.includes(value);
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
styleClassPassthrough: {
|
|
46
|
+
type: Array as PropType<string[]>,
|
|
47
|
+
default: () => [],
|
|
48
|
+
},
|
|
49
|
+
theme: {
|
|
50
|
+
type: String as PropType<string>,
|
|
51
|
+
default: 'primary',
|
|
52
|
+
validator(value: string) {
|
|
53
|
+
return propValidators.theme.includes(value);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
inputVariant: {
|
|
57
|
+
type: String as PropType<string>,
|
|
58
|
+
default: 'normal',
|
|
59
|
+
validator(value: string) {
|
|
60
|
+
return propValidators.inputVariant.includes(value);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const formTheme = computed(() => {
|
|
66
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const modelValue = defineModel({ required: true });
|
|
70
|
+
const isDirty = defineModel('isDirty');
|
|
71
|
+
const isActive = defineModel('isActive');
|
|
72
|
+
const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<style lang="css">
|
|
76
|
+
.input-select-wrapper {
|
|
77
|
+
background-color: var(--element-decorator-background-color);
|
|
78
|
+
outline: var(--element-decorator-outline-default);
|
|
79
|
+
|
|
80
|
+
border-top-left-radius: var(--element-decorator-border-top-left-radius);
|
|
81
|
+
border-top-right-radius: var(--element-decorator-border-top-right-radius);
|
|
82
|
+
border-bottom-left-radius: var(--element-decorator-border-bottom-left-radius);
|
|
83
|
+
border-bottom-right-radius: var(--element-decorator-border-bottom-right-radius);
|
|
84
|
+
|
|
85
|
+
border-top: var(--element-decorator-border-top-default);
|
|
86
|
+
border-right: var(--element-decorator-border-right-default);
|
|
87
|
+
border-bottom: var(--element-decorator-border-bottom-default);
|
|
88
|
+
border-left: var(--element-decorator-border-left-default);
|
|
89
|
+
|
|
90
|
+
.input-select-core {
|
|
91
|
+
appearance: none;
|
|
92
|
+
background-color: transparent;
|
|
93
|
+
|
|
94
|
+
/* For legacy support - eg, Safari */
|
|
95
|
+
/* &::after {
|
|
96
|
+
content: '';
|
|
97
|
+
width: 0.8em;
|
|
98
|
+
height: 0.5em;
|
|
99
|
+
background-color: var(--theme-form-input-border);
|
|
100
|
+
clip-path: polygon(100% 0%, 0 0%, 50% 100%);
|
|
101
|
+
} */
|
|
102
|
+
|
|
103
|
+
/* Start modern Select CSS */
|
|
104
|
+
&,
|
|
105
|
+
&::picker(select) {
|
|
106
|
+
appearance: base-select;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&::picker(select) {
|
|
110
|
+
transition: display allow-discrete var(--input-select-animation-duration), opacity var(--input-select-animation-duration), overlay var(--input-select-animation-duration) allow-discrete;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&:not(:open)::picker(select) {
|
|
114
|
+
opacity: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&:open::picker(select) {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
border: var(--form-element-border-width) solid var(--theme-form-input-border);
|
|
120
|
+
outline: var(--form-element-outline-width) solid var(--_input-select-outline-color);
|
|
121
|
+
|
|
122
|
+
@starting-style {
|
|
123
|
+
opacity: 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
border: none;
|
|
128
|
+
outline: none;
|
|
129
|
+
border-radius: 0;
|
|
130
|
+
width: 100%;
|
|
131
|
+
|
|
132
|
+
&:hover {
|
|
133
|
+
/* background-color: lab(89.6502 -0.829279 -2.45323 / 0.1); */
|
|
134
|
+
background-color: hsl(from var(--theme-form-input-border) h s 20%);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* END modern Select CSS */
|
|
138
|
+
|
|
139
|
+
/* color: var(--_input-text-core-color); */
|
|
140
|
+
font-family: var(--font-family);
|
|
141
|
+
font-size: var(--form-element-font-size);
|
|
142
|
+
line-height: var(--form-element-line-height);
|
|
143
|
+
padding-block: var(--input-select-padding-block);
|
|
144
|
+
padding-inline: var(--input-select-padding-inline);
|
|
145
|
+
|
|
146
|
+
.input-select-core-option {
|
|
147
|
+
padding-block: var(--input-select-option-padding-block);
|
|
148
|
+
padding-inline: var(--input-select-option-padding-inline);
|
|
149
|
+
gap: var(--input-select-option-gap);
|
|
150
|
+
transition: var(--input-select-option-transition);
|
|
151
|
+
|
|
152
|
+
&:hover {
|
|
153
|
+
background-color: var(--input-select-option-background-color-hover);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.input-select-core-option-icon {
|
|
157
|
+
display: inline-block;
|
|
158
|
+
width: var(--input-select-option-icon-size);
|
|
159
|
+
height: var(--input-select-option-icon-size);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="input-select-with-label" :class="[inputVariant, { dirty: isDirty }, { active: isActive }, { error: fieldHasError }]" :data-testid :data-form-theme="formTheme" :data-size="size">
|
|
4
|
+
<InputLabel :for="id" :id :theme :name :input-variant :field-has-error :style-class-passthrough="['input-select-label']">
|
|
5
|
+
<template #textLabel>{{ label }}</template>
|
|
6
|
+
</InputLabel>
|
|
7
|
+
|
|
8
|
+
<div v-if="inputVariant === 'normal' && hasDescriptionSlot" :id="`${id}-description`">
|
|
9
|
+
<slot name="description"></slot>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<InputSelectCore
|
|
13
|
+
v-model="modelValue"
|
|
14
|
+
v-model:fieldData="fieldData"
|
|
15
|
+
v-model:isDirty="isDirty"
|
|
16
|
+
v-model:isActive="isActive"
|
|
17
|
+
:id
|
|
18
|
+
:name
|
|
19
|
+
:placeholder
|
|
20
|
+
:fieldHasError
|
|
21
|
+
:required
|
|
22
|
+
:styleClassPassthrough
|
|
23
|
+
:theme="formTheme"
|
|
24
|
+
:ariaDescribedby="ariaDescribedby"
|
|
25
|
+
:size
|
|
26
|
+
:inputVariant
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<InputError :errorMessage="errorMessage" :showError="fieldHasError" :id="errorId" :isDetached="false" :inputVariant />
|
|
30
|
+
</div>
|
|
31
|
+
<div v-if="inputVariant !== 'normal' && hasDescriptionSlot" :id="`${id}-description`">
|
|
32
|
+
<slot name="description"></slot>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import propValidators from '../../c12/prop-validators';
|
|
39
|
+
import type { IFormMultipleOptions } from '@/types/types.forms';
|
|
40
|
+
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
dataTestid: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'input-select-with-label',
|
|
45
|
+
},
|
|
46
|
+
name: {
|
|
47
|
+
type: String,
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
label: {
|
|
51
|
+
type: String,
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
placeholder: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '',
|
|
57
|
+
},
|
|
58
|
+
errorMessage: {
|
|
59
|
+
type: [Object, String],
|
|
60
|
+
required: true,
|
|
61
|
+
},
|
|
62
|
+
required: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
fieldHasError: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false,
|
|
69
|
+
},
|
|
70
|
+
size: {
|
|
71
|
+
type: String as PropType<string>,
|
|
72
|
+
default: 'medium',
|
|
73
|
+
validator(value: string) {
|
|
74
|
+
return propValidators.size.includes(value);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
styleClassPassthrough: {
|
|
78
|
+
type: Array as PropType<string[]>,
|
|
79
|
+
default: () => [],
|
|
80
|
+
},
|
|
81
|
+
theme: {
|
|
82
|
+
type: String as PropType<string>,
|
|
83
|
+
default: 'primary',
|
|
84
|
+
validator(value: string) {
|
|
85
|
+
return propValidators.theme.includes(value);
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
inputVariant: {
|
|
89
|
+
type: String as PropType<string>,
|
|
90
|
+
default: 'normal',
|
|
91
|
+
validator(value: string) {
|
|
92
|
+
return propValidators.inputVariant.includes(value);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const slots = useSlots();
|
|
98
|
+
const hasDescriptionSlot = computed(() => slots.description !== undefined);
|
|
99
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
100
|
+
|
|
101
|
+
const formTheme = computed(() => {
|
|
102
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const id = `${props.name}-${useId()}`;
|
|
106
|
+
const errorId = `${name}-error-message`;
|
|
107
|
+
const ariaDescribedby = computed(() => {
|
|
108
|
+
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` : undefined;
|
|
109
|
+
return props.fieldHasError ? errorId : ariaDescribedbyId;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const modelValue = defineModel({ required: true });
|
|
113
|
+
const isDirty = defineModel('isDirty');
|
|
114
|
+
const isActive = defineModel('isActive');
|
|
115
|
+
const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<style lang="css">
|
|
119
|
+
.input-select-with-label {
|
|
120
|
+
.input-select-label {
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
class="input-text-wrapper"
|
|
4
4
|
:data-form-theme="formTheme"
|
|
5
5
|
:data-size="size"
|
|
6
|
+
:data-inputmode="inputmode"
|
|
6
7
|
:class="[inputVariant, { dirty: isDirty }, { active: isActive }, { error: fieldHasError }, { 'has-left-slot': hasLeftSlot }, { 'has-right-slot': hasRightSlot }]"
|
|
7
8
|
>
|
|
8
9
|
<span v-if="hasLeftSlot" class="slot left-slot">
|
|
@@ -93,7 +94,7 @@ const props = defineProps({
|
|
|
93
94
|
},
|
|
94
95
|
size: {
|
|
95
96
|
type: String as PropType<string>,
|
|
96
|
-
default: '
|
|
97
|
+
default: 'default',
|
|
97
98
|
validator(value: string) {
|
|
98
99
|
return propValidators.size.includes(value);
|
|
99
100
|
},
|
|
@@ -157,6 +158,64 @@ onMounted(() => {
|
|
|
157
158
|
|
|
158
159
|
<style lang="css">
|
|
159
160
|
.input-text-wrapper {
|
|
161
|
+
background-color: var(--element-decorator-background-color);
|
|
162
|
+
outline: var(--element-decorator-outline-default);
|
|
163
|
+
|
|
164
|
+
border-top-left-radius: var(--element-decorator-border-top-left-radius);
|
|
165
|
+
border-top-right-radius: var(--element-decorator-border-top-right-radius);
|
|
166
|
+
border-bottom-left-radius: var(--element-decorator-border-bottom-left-radius);
|
|
167
|
+
border-bottom-right-radius: var(--element-decorator-border-bottom-right-radius);
|
|
168
|
+
|
|
169
|
+
border-top: var(--element-decorator-border-top-default);
|
|
170
|
+
border-right: var(--element-decorator-border-right-default);
|
|
171
|
+
border-bottom: var(--element-decorator-border-bottom-default);
|
|
172
|
+
border-left: var(--element-decorator-border-left-default);
|
|
173
|
+
|
|
174
|
+
padding-inline: var(--element-decorator-padding-inline);
|
|
175
|
+
|
|
176
|
+
&:hover {
|
|
177
|
+
/* background-color: lab(89.6502 -0.829279 -2.45323 / 0.1); */
|
|
178
|
+
background-color: hsl(from var(--theme-form-input-border) h s 20%);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
display: flex;
|
|
182
|
+
align-items: center;
|
|
183
|
+
gap: 12px;
|
|
184
|
+
|
|
185
|
+
.slot {
|
|
186
|
+
display: flex;
|
|
187
|
+
place-items: center;
|
|
188
|
+
background-clip: padding-box;
|
|
189
|
+
|
|
190
|
+
&.left-slot {
|
|
191
|
+
/* background-color: green; */
|
|
192
|
+
}
|
|
193
|
+
&.right-slot {
|
|
194
|
+
/* background-color: orange; */
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.input-text-core {
|
|
199
|
+
all: unset;
|
|
200
|
+
flex-grow: 1;
|
|
201
|
+
|
|
202
|
+
font-family: var(--font-family);
|
|
203
|
+
font-size: var(--form-element-font-size);
|
|
204
|
+
line-height: var(--form-element-line-height);
|
|
205
|
+
padding-block: var(--input-element-padding-block);
|
|
206
|
+
padding-inline: var(--input-element-padding-inline);
|
|
207
|
+
|
|
208
|
+
&::placeholder {
|
|
209
|
+
color: var(--input-placeholder-color);
|
|
210
|
+
font-size: var(--input-placeholder-font-size);
|
|
211
|
+
font-style: var(--input-placeholder-font-style);
|
|
212
|
+
line-height: var(--input-placeholder-line-height);
|
|
213
|
+
font-weight: var(--input-placeholder-font-weight);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.input-text-wrapper-XXX {
|
|
160
219
|
--_focus-box-shadow: var(--box-shadow-off);
|
|
161
220
|
--_input-text-core-color: var(--theme-form-input-text-color-normal);
|
|
162
221
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div class="input-text-with-label" :data-form-theme="formTheme" :class="[elementClasses, inputVariant, { dirty: isDirty }, { active: isActive }]">
|
|
4
|
-
<
|
|
4
|
+
<InputLabel :for="id" :id :theme :name :input-variant :field-has-error :style-class-passthrough="['input-text-label']">
|
|
5
|
+
<template #textLabel>{{ label }}</template>
|
|
6
|
+
</InputLabel>
|
|
5
7
|
|
|
6
8
|
<div v-if="inputVariant === 'normal' && hasDescriptionSlot" :id="`${id}-description`">
|
|
7
9
|
<slot name="description"></slot>
|
|
@@ -99,7 +101,7 @@ const props = defineProps({
|
|
|
99
101
|
},
|
|
100
102
|
size: {
|
|
101
103
|
type: String as PropType<string>,
|
|
102
|
-
default: '
|
|
104
|
+
default: 'default',
|
|
103
105
|
validator(value: string) {
|
|
104
106
|
return propValidators.size.includes(value);
|
|
105
107
|
},
|
|
@@ -122,7 +124,7 @@ const formTheme = computed(() => {
|
|
|
122
124
|
return props.fieldHasError ? 'error' : props.theme;
|
|
123
125
|
});
|
|
124
126
|
|
|
125
|
-
const id = useId()
|
|
127
|
+
const id = `${props.name}-${useId()}`;
|
|
126
128
|
const errorId = `${id}-error-message`;
|
|
127
129
|
const ariaDescribedby = computed(() => {
|
|
128
130
|
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` : undefined;
|
|
@@ -156,7 +158,7 @@ watch(
|
|
|
156
158
|
</script>
|
|
157
159
|
|
|
158
160
|
<style lang="css">
|
|
159
|
-
.input-text-with-label {
|
|
161
|
+
.input-text-with-label-XXX {
|
|
160
162
|
--_input-text-with-label-margin-block-start: 0;
|
|
161
163
|
--_input-text-with-label-background-color: transparent;
|
|
162
164
|
|
|
@@ -244,7 +246,7 @@ watch(
|
|
|
244
246
|
/* overflow: clip; */
|
|
245
247
|
|
|
246
248
|
&.underlined {
|
|
247
|
-
border-bottom: var(--_input-text-wrapper-border-underlined);
|
|
249
|
+
/* border-bottom: var(--_input-text-wrapper-border-underlined); */
|
|
248
250
|
border-top-left-radius: var(--_input-text-wrapper-underlined-border-radius-top-left);
|
|
249
251
|
border-top-right-radius: var(--_input-text-wrapper-underlined-border-radius-top-right);
|
|
250
252
|
border-bottom-left-radius: var(--_input-text-wrapper-underlined-border-radius-bottom-left);
|
|
@@ -266,17 +268,17 @@ watch(
|
|
|
266
268
|
|
|
267
269
|
margin-block-start: var(--_input-text-with-label-margin-block-start);
|
|
268
270
|
|
|
269
|
-
.input-text-label {
|
|
271
|
+
/* .input-text-label {
|
|
270
272
|
grid-area: underlined-text-stack;
|
|
271
273
|
z-index: 2;
|
|
272
|
-
}
|
|
274
|
+
} */
|
|
273
275
|
.input-text-wrapper {
|
|
274
276
|
grid-area: underlined-text-stack;
|
|
275
277
|
z-index: 1;
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
280
|
|
|
279
|
-
.input-text-label {
|
|
281
|
+
/* .input-text-label {
|
|
280
282
|
display: inline-block;
|
|
281
283
|
color: var(--_label-text-color);
|
|
282
284
|
background-color: var(--_label-text-background-color);
|
|
@@ -293,6 +295,6 @@ watch(
|
|
|
293
295
|
display: flex;
|
|
294
296
|
align-items: center;
|
|
295
297
|
}
|
|
296
|
-
}
|
|
298
|
+
} */
|
|
297
299
|
}
|
|
298
300
|
</style>
|