srcdev-nuxt-forms 4.2.0 → 5.0.0
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 +152 -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,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<fieldset :aria-required="required" :aria-invalid="fieldHasError" role="radiogroup" :id :name class="form-fieldset" :class="[elementClasses, { error: fieldHasError }]" :data-testid="dataTestid">
|
|
3
|
+
<legend v-if="legend" class="form-fieldset-legend" :class="[{ 'has-description': hasDescription }]">
|
|
4
|
+
<slot name="legend">{{ legend }}</slot>
|
|
5
|
+
</legend>
|
|
6
|
+
|
|
7
|
+
<div v-if="hasDescriptionSlot" class="form-fieldset-description" :id="`${id}-description`">
|
|
8
|
+
<slot name="description"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="form-fieldset-content">
|
|
12
|
+
<slot name="content"></slot>
|
|
13
|
+
</div>
|
|
14
|
+
</fieldset>
|
|
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
|
+
legend: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '',
|
|
32
|
+
},
|
|
33
|
+
required: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
fieldHasError: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
dataTestid: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '',
|
|
44
|
+
},
|
|
45
|
+
styleClassPassthrough: {
|
|
46
|
+
type: Array as PropType<string[]>,
|
|
47
|
+
default: () => [],
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const slots = useSlots();
|
|
52
|
+
const hasDescriptionSlot = computed(() => slots.description !== undefined);
|
|
53
|
+
const hasDescription = computed(() => slots.description !== undefined);
|
|
54
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<style lang="css">
|
|
58
|
+
.form-fieldset {
|
|
59
|
+
margin: 0;
|
|
60
|
+
padding: 0;
|
|
61
|
+
border: 0;
|
|
62
|
+
|
|
63
|
+
&.single-checkbox-fieldset {
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.multiple-checkboxes-fieldset {
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.multiple-radiobuttons-fieldset {
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.form-fieldset-legend {
|
|
73
|
+
color: var(--form-fieldset-legend-text-color);
|
|
74
|
+
margin-block: var(--form-fieldset-legend-text-margin-block);
|
|
75
|
+
font-size: var(--form-fieldset-legend-text-size);
|
|
76
|
+
font-weight: var(--form-fieldset-legend-text-weight);
|
|
77
|
+
line-height: var(--form-fieldset-legend-text-line-height);
|
|
78
|
+
|
|
79
|
+
&.has-description {
|
|
80
|
+
margin-bottom: 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.form-fieldset-description {
|
|
85
|
+
font-size: var(--form-fieldset-description-font-size);
|
|
86
|
+
margin-top: var(--form-fieldset-description-margin-top);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.form-fieldset-content {
|
|
90
|
+
margin-block-start: var(--form-fieldset-content-margin-block-start);
|
|
91
|
+
margin-block-end: var(--form-fieldset-content-padding-block-start);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -1,61 +1,63 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<div v-if="hasDescriptionSlot" :id="`${id}-description`">
|
|
2
|
+
<FormFieldset :id :name :legend :fieldHasError :required :data-testid :styleClassPassthrough="['multiple-checkboxes-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-checkboxes-items" :class="[optionsLayout]">
|
|
9
|
+
<template v-for="item in fieldData.data" :key="item.id">
|
|
10
|
+
<InputCheckboxRadioButton
|
|
11
|
+
v-if="isButton"
|
|
12
|
+
type="checkbox"
|
|
13
|
+
:id="`${name}-${item.value}`"
|
|
14
|
+
: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
|
+
:displayAsDisc
|
|
26
|
+
>
|
|
27
|
+
<template #checkedIcon>
|
|
28
|
+
<slot name="checkedIcon"></slot>
|
|
29
|
+
</template>
|
|
30
|
+
<template #itemIcon>
|
|
31
|
+
<slot name="itemIcon">
|
|
32
|
+
<Icon name="material-symbols:add-2" class="icon" />
|
|
33
|
+
</slot>
|
|
34
|
+
</template>
|
|
35
|
+
</InputCheckboxRadioButton>
|
|
36
|
+
<InputCheckboxRadioWithLabel
|
|
37
|
+
v-else
|
|
38
|
+
type="checkbox"
|
|
39
|
+
:id="`${name}-${item.value}`"
|
|
40
|
+
:name
|
|
41
|
+
:required
|
|
42
|
+
:label="item.label"
|
|
43
|
+
:fieldHasError
|
|
44
|
+
v-model="modelValue"
|
|
45
|
+
:true-value="item.value"
|
|
46
|
+
:size
|
|
47
|
+
:optionsLayout
|
|
48
|
+
:theme
|
|
49
|
+
:ariaDescribedby
|
|
50
|
+
:displayAsDisc
|
|
51
|
+
>
|
|
52
|
+
<template #checkedIcon>
|
|
53
|
+
<slot name="checkedIcon"></slot>
|
|
54
|
+
</template>
|
|
55
|
+
</InputCheckboxRadioWithLabel>
|
|
56
|
+
</template>
|
|
57
|
+
</div>
|
|
58
|
+
<InputError :errorMessage="errorMessage" :showError="fieldHasError" :id="errorId" :isDetached="true" />
|
|
59
|
+
</template>
|
|
60
|
+
</FormFieldset>
|
|
59
61
|
</template>
|
|
60
62
|
|
|
61
63
|
<script setup lang="ts">
|
|
@@ -139,6 +141,10 @@ const { dataTestid, name, legend, label, required, fieldHasError, placeholder, i
|
|
|
139
141
|
return ['row', 'row-reverse'].includes(value);
|
|
140
142
|
},
|
|
141
143
|
},
|
|
144
|
+
displayAsDisc: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: false,
|
|
147
|
+
},
|
|
142
148
|
});
|
|
143
149
|
|
|
144
150
|
const slots = useSlots();
|
|
@@ -149,7 +155,7 @@ const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleC
|
|
|
149
155
|
const modelValue = defineModel();
|
|
150
156
|
const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
151
157
|
|
|
152
|
-
const id = useId()
|
|
158
|
+
const id = `${name}-input-${useId()}`;
|
|
153
159
|
const errorId = `${name}-error-message`;
|
|
154
160
|
const ariaDescribedby = computed(() => {
|
|
155
161
|
const ariaDescribedbyId = hasDescriptionSlot.value ? `${name}-description` : undefined;
|
|
@@ -158,28 +164,6 @@ const ariaDescribedby = computed(() => {
|
|
|
158
164
|
</script>
|
|
159
165
|
|
|
160
166
|
<style lang="css">
|
|
161
|
-
.multiple-checkboxes-fieldset {
|
|
162
|
-
margin: 0;
|
|
163
|
-
padding: 0;
|
|
164
|
-
border: 0;
|
|
165
|
-
|
|
166
|
-
legend {
|
|
167
|
-
font-family: var(--font-family);
|
|
168
|
-
font-size: 1.6rem;
|
|
169
|
-
font-weight: 500;
|
|
170
|
-
|
|
171
|
-
&.has-description {
|
|
172
|
-
margin-bottom: 0;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.label-description {
|
|
177
|
-
font-family: var(--font-family);
|
|
178
|
-
font-size: 1.6rem;
|
|
179
|
-
margin-top: 1.2rem;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
167
|
.multiple-checkboxes-items {
|
|
184
168
|
display: grid;
|
|
185
169
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<div v-if="hasDescriptionSlot" :id="`${name}-description`">
|
|
2
|
+
<FormFieldset :id :name :legend :fieldHasError :required :data-testid :styleClassPassthrough="['single-checkbox-fieldset']">
|
|
3
|
+
<template #description>
|
|
6
4
|
<slot name="description"></slot>
|
|
7
|
-
</
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #content>
|
|
8
|
+
<div class="single-checkbox-items" :class="[optionsLayout]">
|
|
9
|
+
<InputCheckboxRadioWithLabel type="checkbox" :name :required :label :fieldHasError v-model="modelValue" :trueValue :falseValue :size :theme :ariaDescribedby>
|
|
10
|
+
<template #checkedIcon>
|
|
11
|
+
<slot name="checkedIcon"></slot>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-if="hasLabelContent" #labelContent>
|
|
14
|
+
<slot name="labelContent"></slot>
|
|
15
|
+
</template>
|
|
16
|
+
</InputCheckboxRadioWithLabel>
|
|
17
|
+
</div>
|
|
18
|
+
<InputError :errorMessage :showError="fieldHasError" :id="errorId" :isDetached="true" :styleClassPassthrough="inputErrorStyles" />
|
|
19
|
+
</template>
|
|
20
|
+
</FormFieldset>
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script setup lang="ts">
|
|
@@ -109,6 +109,7 @@ const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
|
109
109
|
|
|
110
110
|
const inputErrorStyles = ref<string[]>(props.styleClassPassthrough);
|
|
111
111
|
|
|
112
|
+
const id = `${props.name}-input-${useId()}`;
|
|
112
113
|
const errorId = `${name}-error-message`;
|
|
113
114
|
const ariaDescribedby = computed(() => {
|
|
114
115
|
const ariaDescribedbyId = hasDescriptionSlot.value ? `${name}-description` : undefined;
|
|
@@ -125,28 +126,6 @@ watchEffect(() => {
|
|
|
125
126
|
</script>
|
|
126
127
|
|
|
127
128
|
<style lang="css">
|
|
128
|
-
.single-checkbox-fieldset {
|
|
129
|
-
margin: 0;
|
|
130
|
-
padding: 0;
|
|
131
|
-
border: 0;
|
|
132
|
-
|
|
133
|
-
legend {
|
|
134
|
-
font-family: var(--font-family);
|
|
135
|
-
font-size: 1.6rem;
|
|
136
|
-
font-weight: 500;
|
|
137
|
-
|
|
138
|
-
&.has-description {
|
|
139
|
-
margin-bottom: 0;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.label-description {
|
|
144
|
-
font-family: var(--font-family);
|
|
145
|
-
font-size: 1.6rem;
|
|
146
|
-
margin-top: 1.2rem;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
129
|
.single-checkbox-items {
|
|
151
130
|
display: flex;
|
|
152
131
|
gap: 1.2rem;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="input-checkbox-radio-
|
|
3
|
-
<InputCheckboxRadioCore :isButton="true" :type :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme :ariaDescribedby>
|
|
2
|
+
<div class="input-checkbox-radio-options-button" :data-form-theme="formTheme" :data-size="size" :class="[size, elementClasses, optionsLayout, { error: fieldHasError }]">
|
|
3
|
+
<InputCheckboxRadioCore :isButton="true" :type :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme :ariaDescribedby :displayAsDisc>
|
|
4
4
|
<template #checkedIcon>
|
|
5
5
|
<slot name="checkedIcon"></slot>
|
|
6
6
|
</template>
|
|
7
7
|
</InputCheckboxRadioCore>
|
|
8
|
-
<label v-if="hasLabelContent" class="input-checkbox-radio-button-label" :for="id">
|
|
8
|
+
<label v-if="hasLabelContent" class="input-checkbox-radio-options-button-label" :for="id">
|
|
9
9
|
<slot name="labelContent"></slot>
|
|
10
10
|
</label>
|
|
11
|
-
<label v-else class="input-checkbox-radio-button-label" :for="id">{{ label }}</label>
|
|
11
|
+
<label v-else class="input-checkbox-radio-options-button-label" :for="id">{{ label }}</label>
|
|
12
12
|
<div class="item-icon">
|
|
13
13
|
<slot name="itemIcon">
|
|
14
14
|
<Icon name="material-symbols:add-2" class="icon" />
|
|
@@ -89,6 +89,10 @@ const props = defineProps({
|
|
|
89
89
|
type: String,
|
|
90
90
|
default: null,
|
|
91
91
|
},
|
|
92
|
+
displayAsDisc: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: false,
|
|
95
|
+
},
|
|
92
96
|
});
|
|
93
97
|
|
|
94
98
|
const slots = useSlots();
|
|
@@ -105,33 +109,37 @@ const flexDirection = ref(props.direction);
|
|
|
105
109
|
</script>
|
|
106
110
|
|
|
107
111
|
<style lang="css">
|
|
108
|
-
.input-checkbox-radio-
|
|
112
|
+
.input-checkbox-radio-options-button {
|
|
109
113
|
/* --_checkbox-size: initial; */
|
|
110
|
-
|
|
111
|
-
--_outline-width: var(--form-element-outline-width);
|
|
112
|
-
--_border-color: var(--theme-checkbox-radio-button-border-default);
|
|
114
|
+
|
|
113
115
|
--_outline-color: var(--theme-checkbox-radio-button-outline-default);
|
|
114
116
|
--_label-color: var(--theme-checkbox-radio-button-label-default);
|
|
115
117
|
--_box-shadow: var(--theme-checkbox-radio-button-shadow);
|
|
116
118
|
--_white-space: wrap;
|
|
117
|
-
--_gap: 0.4rem;
|
|
118
119
|
/* --_border-radius: 2.2rem; */
|
|
119
|
-
--_padding-block: 0.4rem;
|
|
120
|
-
--_padding-inline: 1.2rem;
|
|
120
|
+
/* --_padding-block: 0.4rem;
|
|
121
|
+
--_padding-inline: 1.2rem; */
|
|
121
122
|
|
|
122
123
|
display: flex;
|
|
123
124
|
flex-direction: v-bind(flexDirection);
|
|
124
125
|
align-items: center;
|
|
125
126
|
justify-content: space-between;
|
|
126
|
-
gap: var(--
|
|
127
|
+
gap: var(--input-checkbox-radio-options-button-gap);
|
|
128
|
+
|
|
129
|
+
background-color: var(--input-checkbox-radio-options-button-background-color);
|
|
130
|
+
border-radius: var(--input-checkbox-radio-options-button-border-radius);
|
|
131
|
+
border: var(--input-checkbox-radio-options-button-border);
|
|
132
|
+
outline: var(--input-checkbox-radio-options-button-outline);
|
|
127
133
|
|
|
128
|
-
background-color: var(--_background-color);
|
|
129
|
-
border-radius: calc(var(--form-element-line-height) / 1);
|
|
130
|
-
border: var(--theme-checkbox-radio-button-border-width) solid var(--_border-color);
|
|
131
|
-
outline: var(--theme-checkbox-radio-button-outline-width) solid var(--_outline-color);
|
|
132
134
|
box-shadow: 0.1rem 0.1rem 0.8rem 0.1rem var(--_box-shadow);
|
|
133
|
-
padding-block: var(--
|
|
134
|
-
padding-inline: var(--
|
|
135
|
+
padding-block: var(--input-checkbox-radio-options-padding-block);
|
|
136
|
+
padding-inline: var(--input-checkbox-radio-options-padding-inline);
|
|
137
|
+
|
|
138
|
+
&:hover {
|
|
139
|
+
background-color: var(--input-checkbox-radio-options-button-background-color-active);
|
|
140
|
+
border: var(--input-checkbox-radio-options-button-border-active);
|
|
141
|
+
outline: var(--input-checkbox-radio-options-button-outline-active);
|
|
142
|
+
}
|
|
135
143
|
|
|
136
144
|
&.inline {
|
|
137
145
|
--_white-space: nowrap;
|
|
@@ -150,52 +158,47 @@ const flexDirection = ref(props.direction);
|
|
|
150
158
|
/* Sizes */
|
|
151
159
|
&.x-small {
|
|
152
160
|
/* --_checkbox-size: 2rem; */
|
|
153
|
-
--_gap: 1rem;
|
|
154
161
|
/* --_border-radius: 2rem; */
|
|
155
|
-
--_padding-block: 0.2rem;
|
|
156
|
-
--_padding-inline: 1.6rem;
|
|
162
|
+
/* --_padding-block: 0.2rem; */
|
|
163
|
+
/* --_padding-inline: 1.6rem; */
|
|
157
164
|
}
|
|
158
165
|
&.small {
|
|
159
166
|
/* --_checkbox-size: 2.2rem; */
|
|
160
|
-
--_gap: 1.2rem;
|
|
161
167
|
/* --_border-radius: 1.8rem; */
|
|
162
|
-
--_padding-block: 0rem;
|
|
163
|
-
--_padding-inline: 1.2rem;
|
|
168
|
+
/* --_padding-block: 0rem; */
|
|
169
|
+
/* --_padding-inline: 1.2rem; */
|
|
164
170
|
}
|
|
165
171
|
&.normal {
|
|
166
172
|
/* --_checkbox-size: 3.4rem; */
|
|
167
|
-
--_gap: 1rem;
|
|
168
173
|
/* --_border-radius: 2rem; */
|
|
169
|
-
--_padding-block: 0.4rem;
|
|
170
|
-
--_padding-inline: 1.2rem;
|
|
174
|
+
/* --_padding-block: 0.4rem; */
|
|
175
|
+
/* --_padding-inline: 1.2rem; */
|
|
171
176
|
}
|
|
172
177
|
&.medium {
|
|
173
178
|
/* --_checkbox-size: 3.4rem; */
|
|
174
|
-
--_gap: 1rem;
|
|
175
179
|
/* --_border-radius: 2rem; */
|
|
176
|
-
--_padding-block: 0.4rem;
|
|
177
|
-
--_padding-inline: 1.2rem;
|
|
180
|
+
/* --_padding-block: 0.4rem; */
|
|
181
|
+
/* --_padding-inline: 1.2rem; */
|
|
178
182
|
}
|
|
179
183
|
&.large {
|
|
180
184
|
/* --_checkbox-size: 3.4rem; */
|
|
181
|
-
--_gap: 1rem;
|
|
182
185
|
/* --_border-radius: 2rem; */
|
|
183
|
-
--_padding-block: 0.4rem;
|
|
184
|
-
--_padding-inline: 1.2rem;
|
|
186
|
+
/* --_padding-block: 0.4rem; */
|
|
187
|
+
/* --_padding-inline: 1.2rem; */
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
190
|
|
|
188
|
-
.input-checkbox-radio-button-label {
|
|
191
|
+
.input-checkbox-radio-options-button-label {
|
|
189
192
|
display: flex;
|
|
190
193
|
flex-grow: 1;
|
|
191
|
-
color: var(--
|
|
192
|
-
font-size: var(--
|
|
194
|
+
color: var(--input-checkbox-radio-options-button-label-text-color);
|
|
195
|
+
font-size: var(--input-checkbox-radio-options-button-label-font-size);
|
|
193
196
|
width: 100%;
|
|
194
|
-
height: var(--
|
|
197
|
+
min-height: var(--input-checkbox-radio-options-button-label-min-height);
|
|
195
198
|
align-items: center;
|
|
196
199
|
justify-content: center;
|
|
197
|
-
margin-block:
|
|
198
|
-
padding-inline:
|
|
200
|
+
margin-block: var(--input-checkbox-radio-options-button-label-margin-block);
|
|
201
|
+
padding-inline: var(--input-checkbox-radio-options-button-label-padding-inline);
|
|
199
202
|
white-space: var(--_white-space);
|
|
200
203
|
|
|
201
204
|
&:hover {
|
|
@@ -207,7 +210,7 @@ const flexDirection = ref(props.direction);
|
|
|
207
210
|
display: flex;
|
|
208
211
|
align-items: center;
|
|
209
212
|
justify-content: center;
|
|
210
|
-
color: var(--
|
|
213
|
+
color: var(--input-checkbox-radio-options-button-label-icon-color);
|
|
211
214
|
height: var(--form-input-checkbox-radio-button-size);
|
|
212
215
|
width: var(--form-input-checkbox-radio-button-size);
|
|
213
216
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="input-checkbox-radio-wrapper"
|
|
4
|
+
:data-form-theme="formTheme"
|
|
5
|
+
:data-theme="size"
|
|
6
|
+
:class="[type, size, elementClasses, { error: fieldHasError }, { button: isButton }, { 'display-as-disc': displayAsDisc }]"
|
|
7
|
+
>
|
|
3
8
|
<slot name="checkedIcon" v-if="isChecked">
|
|
4
9
|
<Icon :name="defaultIcon" class="input-checked-icon" />
|
|
5
10
|
</slot>
|
|
@@ -84,6 +89,10 @@ const props = defineProps({
|
|
|
84
89
|
type: String,
|
|
85
90
|
default: null,
|
|
86
91
|
},
|
|
92
|
+
displayAsDisc: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: false,
|
|
95
|
+
},
|
|
87
96
|
});
|
|
88
97
|
|
|
89
98
|
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
@@ -113,57 +122,32 @@ const isChecked = computed(() => {
|
|
|
113
122
|
|
|
114
123
|
<style lang="css">
|
|
115
124
|
.input-checkbox-radio-wrapper {
|
|
116
|
-
--_outline-width: 0.1rem;
|
|
117
|
-
--_border-width: 0.1rem;
|
|
118
|
-
--_border-radius: 50%;
|
|
119
|
-
--_background-color: var(--theme-form-checkbox-bg);
|
|
120
|
-
--_box-shadow: none;
|
|
121
|
-
|
|
122
|
-
--_icon-size: var(--form-input-checkbox-radio-button-size);
|
|
123
|
-
|
|
124
|
-
&:not(.button) {
|
|
125
|
-
--_icon-size: var(--form-toggle-symbol-size);
|
|
126
|
-
--_outline-width: var(--form-element-outline-width);
|
|
127
|
-
--_border-width: var(--form-element-border-width);
|
|
128
|
-
&.checkbox {
|
|
129
|
-
--_background-color: var(--theme-form-checkbox-bg);
|
|
130
|
-
--_border-color: var(--theme-form-checkbox-border);
|
|
131
|
-
--_border-radius: 0.4rem;
|
|
132
|
-
--_outline-color: var(--theme-form-checkbox-outline);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&.radio {
|
|
136
|
-
--_background-color: var(--theme-form-radio-bg);
|
|
137
|
-
--_border-color: var(--theme-form-radio-border);
|
|
138
|
-
--_border-radius: 50%;
|
|
139
|
-
--_outline-color: var(--theme-form-radio-outline);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
125
|
display: grid;
|
|
144
126
|
grid-template-areas: 'element-stack';
|
|
145
127
|
place-content: center;
|
|
146
128
|
|
|
147
|
-
background-color: var(--
|
|
148
|
-
border: var(--
|
|
149
|
-
border-radius: var(--
|
|
150
|
-
outline:
|
|
129
|
+
background-color: var(--input-checkbox-radio-wrapper-background-color);
|
|
130
|
+
border: var(--input-checkbox-radio-wrapper-border);
|
|
131
|
+
border-radius: var(--input-checkbox-radio-wrapper-border-radius);
|
|
132
|
+
outline: var(--input-checkbox-radio-wrapper-outline);
|
|
151
133
|
box-shadow: var(--_box-shadow);
|
|
152
134
|
|
|
153
|
-
height: var(--
|
|
154
|
-
width: var(--
|
|
135
|
+
height: var(--form-input-checkbox-radio-button-symbol-size);
|
|
136
|
+
width: var(--form-input-checkbox-radio-button-symbol-size);
|
|
155
137
|
|
|
156
|
-
transition:
|
|
138
|
+
transition: var(--input-checkbox-radio-wrapper-transition);
|
|
157
139
|
|
|
158
140
|
&:not(.button):has(.input-checkbox-radio-core:focus-visible) {
|
|
159
|
-
|
|
141
|
+
border: var(--input-checkbox-radio-wrapper-border-on);
|
|
142
|
+
outline: var(--input-checkbox-radio-wrapper-outline-on);
|
|
143
|
+
box-shadow: var(--input-checkbox-radio-wrapper-box-shadow-on);
|
|
160
144
|
}
|
|
161
145
|
|
|
162
146
|
.input-checked-icon {
|
|
163
147
|
grid-area: element-stack;
|
|
164
|
-
color: var(--
|
|
165
|
-
height: var(--
|
|
166
|
-
width: var(--
|
|
148
|
+
color: var(--form-input-checkbox-radio-button-symbol-color);
|
|
149
|
+
height: var(--form-input-checkbox-radio-button-symbol-size);
|
|
150
|
+
width: var(--form-input-checkbox-radio-button-symbol-size);
|
|
167
151
|
box-shadow: var(--_box-shadow);
|
|
168
152
|
}
|
|
169
153
|
|
|
@@ -174,8 +158,8 @@ const isChecked = computed(() => {
|
|
|
174
158
|
overflow: hidden;
|
|
175
159
|
opacity: 0;
|
|
176
160
|
|
|
177
|
-
height: var(--
|
|
178
|
-
width: var(--
|
|
161
|
+
height: var(--form-input-checkbox-radio-button-symbol-size);
|
|
162
|
+
width: var(--form-input-checkbox-radio-button-symbol-size);
|
|
179
163
|
|
|
180
164
|
&:hover {
|
|
181
165
|
cursor: pointer;
|
|
@@ -183,7 +167,9 @@ const isChecked = computed(() => {
|
|
|
183
167
|
|
|
184
168
|
&:not(.is-button) {
|
|
185
169
|
&:focus-visible {
|
|
186
|
-
|
|
170
|
+
border: var(--input-checkbox-radio-wrapper-border-on);
|
|
171
|
+
outline: var(--input-checkbox-radio-wrapper-outline-on);
|
|
172
|
+
box-shadow: var(--input-checkbox-radio-wrapper-box-shadow-on);
|
|
187
173
|
}
|
|
188
174
|
}
|
|
189
175
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="input-checkbox-radio-with-label" :data-size="size" :class="[elementClasses, optionsLayout, { error: fieldHasError }]">
|
|
3
|
-
<InputCheckboxRadioCore :type :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme :ariaDescribedby>
|
|
3
|
+
<InputCheckboxRadioCore :type :id :name :required v-model="modelValue" :size :trueValue :falseValue :fieldHasError :theme :ariaDescribedby :displayAsDisc>
|
|
4
4
|
<template #checkedIcon>
|
|
5
5
|
<slot name="checkedIcon"></slot>
|
|
6
6
|
</template>
|
|
@@ -73,6 +73,10 @@ const props = defineProps({
|
|
|
73
73
|
type: String,
|
|
74
74
|
default: null,
|
|
75
75
|
},
|
|
76
|
+
displayAsDisc: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false,
|
|
79
|
+
},
|
|
76
80
|
});
|
|
77
81
|
|
|
78
82
|
const slots = useSlots();
|