srcdev-nuxt-forms 6.1.4 → 6.1.5
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<label
|
|
3
|
+
:for="id"
|
|
3
4
|
class="input-checkbox-radio-options-button"
|
|
4
5
|
:data-theme="formTheme"
|
|
5
6
|
:data-size="size"
|
|
@@ -24,16 +25,16 @@
|
|
|
24
25
|
<slot name="checkedIcon"></slot>
|
|
25
26
|
</template>
|
|
26
27
|
</InputCheckboxRadioCore>
|
|
27
|
-
<
|
|
28
|
+
<div v-if="slots.labelContent" class="input-checkbox-radio-options-button-label">
|
|
28
29
|
<slot name="labelContent"></slot>
|
|
29
|
-
</
|
|
30
|
-
<
|
|
30
|
+
</div>
|
|
31
|
+
<div v-else class="input-checkbox-radio-options-button-label">{{ label }}</div>
|
|
31
32
|
<div class="decorator-icon">
|
|
32
33
|
<slot name="itemIcon">
|
|
33
34
|
<Icon name="material-symbols:add-2" class="icon" aria-hidden="true" focusable="false" />
|
|
34
35
|
</slot>
|
|
35
36
|
</div>
|
|
36
|
-
</
|
|
37
|
+
</label>
|
|
37
38
|
</template>
|
|
38
39
|
|
|
39
40
|
<script setup lang="ts">
|
|
@@ -154,6 +155,7 @@ const flexDirection = ref(props.direction)
|
|
|
154
155
|
border-color: var(--theme-input-border);
|
|
155
156
|
outline-color: var(--theme-input-outline-hover);
|
|
156
157
|
outline-offset: var(--form-element-outline-offset-focus);
|
|
158
|
+
cursor: pointer;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
&:has(.input-checkbox-radio-core:focus-visible) {
|
|
@@ -3,11 +3,20 @@
|
|
|
3
3
|
class="input-checkbox-radio-wrapper"
|
|
4
4
|
:data-theme="formTheme"
|
|
5
5
|
:data-size="size"
|
|
6
|
-
:class="[
|
|
6
|
+
:class="[
|
|
7
|
+
type,
|
|
8
|
+
size,
|
|
9
|
+
elementClasses,
|
|
10
|
+
{ error: fieldHasError },
|
|
11
|
+
{ button: isButton },
|
|
12
|
+
{ 'display-as-disc': displayAsDisc },
|
|
13
|
+
]"
|
|
7
14
|
>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
15
|
+
<div class="input-checked-icon-slot">
|
|
16
|
+
<slot name="checkedIcon">
|
|
17
|
+
<Icon :name="defaultIcon" class="input-checked-icon-checked" />
|
|
18
|
+
</slot>
|
|
19
|
+
</div>
|
|
11
20
|
|
|
12
21
|
<input
|
|
13
22
|
:type
|
|
@@ -29,14 +38,14 @@
|
|
|
29
38
|
</template>
|
|
30
39
|
|
|
31
40
|
<script setup lang="ts">
|
|
32
|
-
import propValidators from
|
|
41
|
+
import propValidators from "../c12/prop-validators"
|
|
33
42
|
const props = defineProps({
|
|
34
43
|
isButton: {
|
|
35
44
|
type: Boolean,
|
|
36
45
|
default: false,
|
|
37
46
|
},
|
|
38
47
|
type: {
|
|
39
|
-
type: String as PropType<
|
|
48
|
+
type: String as PropType<"checkbox" | "radio">,
|
|
40
49
|
required: true,
|
|
41
50
|
},
|
|
42
51
|
id: {
|
|
@@ -65,16 +74,16 @@ const props = defineProps({
|
|
|
65
74
|
},
|
|
66
75
|
theme: {
|
|
67
76
|
type: String as PropType<string>,
|
|
68
|
-
default:
|
|
77
|
+
default: "primary",
|
|
69
78
|
validator(value: string) {
|
|
70
|
-
return propValidators.theme.includes(value)
|
|
79
|
+
return propValidators.theme.includes(value)
|
|
71
80
|
},
|
|
72
81
|
},
|
|
73
82
|
size: {
|
|
74
83
|
type: String as PropType<string>,
|
|
75
|
-
default:
|
|
84
|
+
default: "medium",
|
|
76
85
|
validator(value: string) {
|
|
77
|
-
return propValidators.size.includes(value)
|
|
86
|
+
return propValidators.size.includes(value)
|
|
78
87
|
},
|
|
79
88
|
},
|
|
80
89
|
fieldHasError: {
|
|
@@ -93,37 +102,37 @@ const props = defineProps({
|
|
|
93
102
|
type: Boolean,
|
|
94
103
|
default: false,
|
|
95
104
|
},
|
|
96
|
-
})
|
|
105
|
+
})
|
|
97
106
|
|
|
98
|
-
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
107
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
99
108
|
|
|
100
109
|
const formTheme = computed(() => {
|
|
101
|
-
return props.fieldHasError ?
|
|
102
|
-
})
|
|
110
|
+
return props.fieldHasError ? "error" : props.theme
|
|
111
|
+
})
|
|
103
112
|
|
|
104
|
-
const modelValue = defineModel<any>()
|
|
113
|
+
const modelValue = defineModel<any>()
|
|
105
114
|
|
|
106
|
-
const inputField = ref<HTMLInputElement | null>(null)
|
|
115
|
+
const inputField = ref<HTMLInputElement | null>(null)
|
|
107
116
|
|
|
108
117
|
const defaultIcon = computed(() => {
|
|
109
|
-
return props.type ===
|
|
110
|
-
})
|
|
118
|
+
return props.type === "checkbox" ? "material-symbols:check-small" : "material-symbols:circle"
|
|
119
|
+
})
|
|
111
120
|
|
|
112
|
-
const isArray = Array.isArray(modelValue.value)
|
|
121
|
+
const isArray = Array.isArray(modelValue.value)
|
|
113
122
|
|
|
114
123
|
const isChecked = computed(() => {
|
|
115
124
|
if (isArray) {
|
|
116
|
-
return modelValue.value.includes(props.trueValue)
|
|
125
|
+
return modelValue.value.includes(props.trueValue)
|
|
117
126
|
} else {
|
|
118
|
-
return modelValue.value === props.trueValue
|
|
127
|
+
return modelValue.value === props.trueValue
|
|
119
128
|
}
|
|
120
|
-
})
|
|
129
|
+
})
|
|
121
130
|
</script>
|
|
122
131
|
|
|
123
132
|
<style lang="css">
|
|
124
133
|
.input-checkbox-radio-wrapper {
|
|
125
134
|
display: grid;
|
|
126
|
-
grid-template-areas:
|
|
135
|
+
grid-template-areas: "element-stack";
|
|
127
136
|
place-content: center;
|
|
128
137
|
|
|
129
138
|
background-color: var(--theme-checkbox-symbol-surface);
|
|
@@ -149,17 +158,34 @@ const isChecked = computed(() => {
|
|
|
149
158
|
border-radius: 50%;
|
|
150
159
|
}
|
|
151
160
|
|
|
161
|
+
&:has(.input-checkbox-radio-core:checked) {
|
|
162
|
+
.input-checked-icon-slot {
|
|
163
|
+
opacity: 1;
|
|
164
|
+
|
|
165
|
+
.input-checked-icon-checked {
|
|
166
|
+
color: var(--theme-checkbox-symbol-color);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
152
171
|
/* focus-visible */
|
|
153
172
|
&:not(.button):has(.input-checkbox-radio-core:focus-visible) {
|
|
154
173
|
outline: var(--theme-focus-visible-outline);
|
|
155
174
|
}
|
|
156
175
|
|
|
157
|
-
.input-checked-icon {
|
|
176
|
+
.input-checked-icon-slot {
|
|
158
177
|
grid-area: element-stack;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
178
|
+
display: grid;
|
|
179
|
+
place-content: center;
|
|
180
|
+
opacity: 0;
|
|
181
|
+
transition: opacity 0.2s ease-in-out;
|
|
182
|
+
|
|
183
|
+
.input-checked-icon-checked {
|
|
184
|
+
color: var(--theme-checkbox-symbol-color);
|
|
185
|
+
height: var(--input-symbol-size);
|
|
186
|
+
width: var(--input-symbol-size);
|
|
187
|
+
box-shadow: var(--_box-shadow);
|
|
188
|
+
}
|
|
163
189
|
}
|
|
164
190
|
|
|
165
191
|
.input-checkbox-radio-core {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<label
|
|
3
|
+
:for="id"
|
|
3
4
|
class="input-checkbox-radio-with-label"
|
|
4
5
|
:data-size="size"
|
|
5
6
|
:class="[elementClasses, optionsLayout, { error: fieldHasError }]"
|
|
@@ -23,11 +24,11 @@
|
|
|
23
24
|
</template>
|
|
24
25
|
</InputCheckboxRadioCore>
|
|
25
26
|
|
|
26
|
-
<
|
|
27
|
+
<div v-if="slots.labelContent" class="input-checkbox-radio-label body-normal">
|
|
27
28
|
<slot name="labelContent"></slot>
|
|
28
|
-
</
|
|
29
|
-
<
|
|
30
|
-
</
|
|
29
|
+
</div>
|
|
30
|
+
<div v-else class="input-checkbox-radio-label body-normal-semibold">{{ label }}</div>
|
|
31
|
+
</label>
|
|
31
32
|
</template>
|
|
32
33
|
|
|
33
34
|
<script setup lang="ts">
|
package/package.json
CHANGED