srcdev-nuxt-forms 0.0.23 → 0.2.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/.prettierrc +2 -1
- package/LICENSE +21 -0
- package/assets/styles/forms/index.css +1 -0
- package/assets/styles/forms/themes/_error.css +9 -0
- package/assets/styles/forms/themes/_ghost.css +11 -0
- package/assets/styles/forms/themes/_primary.css +11 -1
- package/assets/styles/forms/themes/_secondary.css +13 -0
- package/assets/styles/forms/themes/_success.css +12 -0
- package/assets/styles/forms/themes/_tertiary.css +11 -0
- package/assets/styles/forms/themes/_warning.css +11 -0
- package/assets/styles/forms/themes/index.css +5 -0
- package/assets/styles/forms/utils/_a11y.css +5 -0
- package/assets/styles/forms/utils/index.css +1 -0
- package/assets/styles/forms/variables/_theme.css +56 -2
- package/assets/styles/variables/colors/_gray.css +1 -0
- package/assets/styles/variables/colors/_orange.css +1 -1
- package/assets/styles/variables/colors/_red.css +1 -1
- package/components/forms/c12/prop-validators/index.ts +13 -0
- package/components/forms/c12/utils.ts +14 -0
- package/components/forms/c12/validation-patterns/en.json +13 -1
- package/components/forms/form-errors/InputError.vue +132 -0
- package/components/forms/input-button/InputButtonCore.vue +370 -0
- package/components/forms/input-button/variants/InputButtonConfirm.vue +78 -0
- package/components/forms/input-button/variants/InputButtonSubmit.vue +74 -0
- package/components/forms/input-checkbox/InputCheckboxCore.vue +407 -0
- package/components/forms/input-checkbox/InputCheckboxWithLabel.vue +125 -0
- package/components/forms/input-checkbox/variants/MultipleCheckboxes.vue +194 -0
- package/components/forms/input-checkbox/variants/SingleCheckbox.vue +157 -0
- package/components/forms/input-radio/InputRadioCore.vue +226 -0
- package/components/forms/input-radio/InputRadioWithLabel.vue +118 -0
- package/components/forms/input-radio/variants/MultipleRadio.vue +183 -0
- package/components/forms/input-radio/variants/SingleRadio.vue +131 -0
- package/components/forms/input-range/InputRangeCore.vue +171 -0
- package/components/forms/input-range/variants/InputRangeDefault.vue +131 -0
- package/components/forms/input-text/InputTextCore.vue +115 -79
- package/components/forms/input-text/variants/material/InputEmailMaterial.vue +72 -0
- package/components/forms/input-text/variants/material/InputPasswordMaterial.vue +114 -0
- package/components/forms/input-text/variants/material/InputTextMaterial.vue +68 -0
- package/components/forms/input-text/variants/material/InputTextMaterialCore.vue +313 -0
- package/components/forms/input-textarea/InputTextareaCore.vue +170 -0
- package/components/forms/input-textarea/variants/material/InputTextareaMaterial.vue +75 -0
- package/components/forms/input-textarea/variants/material/InputTextareaMaterialCore.vue +290 -0
- package/components/forms/ui/FormField.vue +7 -2
- package/components/forms/ui/FormWrapper.vue +2 -2
- package/components/ui/content-grid/ContentGrid.vue +85 -0
- package/composables/useErrorMessages.ts +21 -9
- package/composables/useFormControl.ts +171 -41
- package/layouts/default.vue +28 -3
- package/nuxt.config.ts +26 -3
- package/package.json +9 -6
- package/pages/forms/examples/buttons/index.vue +155 -0
- package/pages/forms/examples/material/text-fields.vue +372 -0
- package/pages/index.vue +2 -70
- package/pages/limit-text.vue +43 -0
- package/server/api/places/list.get.ts +23 -0
- package/server/api/textFields.post.ts +37 -0
- package/server/api/utils/index.get.ts +20 -0
- package/server/data/places/cities.json +37 -0
- package/server/data/places/countries.json +55 -0
- package/server/data/utils/title.json +49 -0
- package/types/types.forms.ts +38 -13
- package/types/types.places.ts +8 -0
- package/components/forms/input-text/InputTextField.vue +0 -22
- package/components/forms/input-text/variants/InputTextMaterial.vue +0 -192
|
@@ -1,62 +1,64 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<input
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
<div class="input-text-wrapper" :class="[{ 'has-left-content': hasLeftContent }, { 'has-right-content': hasRightContent }]">
|
|
3
|
+
<template v-if="hasLeftContent">
|
|
4
|
+
<span class="left-content">
|
|
5
|
+
<slot name="left"></slot>
|
|
6
|
+
</span>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<input
|
|
10
|
+
:type
|
|
11
|
+
:placeholder="c12.placeholder"
|
|
12
|
+
:id
|
|
13
|
+
:name
|
|
14
|
+
:pattern="componentValidation.pattern"
|
|
15
|
+
:maxlength="componentValidation.maxlength"
|
|
16
|
+
:required
|
|
17
|
+
:class="['input-text-core', 'text-normal', styleClassPassthrough, { active: isFocused }, { dirty: fieldIsDirty }, { error: fieldHasError }]"
|
|
18
|
+
v-model="modelValue.data[name]"
|
|
19
|
+
ref="inputField"
|
|
20
|
+
:aria-invalid="fieldHasError"
|
|
21
|
+
:aria-describedby="`${id}-error-message`"
|
|
22
|
+
@focusin="updateFocus(name, true)"
|
|
23
|
+
@focusout="updateFocus(name, false)"
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<template v-if="hasRightContent">
|
|
27
|
+
<span class="right-content">
|
|
28
|
+
<slot name="right"></slot>
|
|
29
|
+
</span>
|
|
30
|
+
</template>
|
|
31
|
+
</div>
|
|
23
32
|
</template>
|
|
24
33
|
|
|
25
34
|
<script setup lang="ts">
|
|
26
|
-
import type { InpuTextC12, IFormData } from '@/types/types.forms';
|
|
35
|
+
import type { InpuTextC12, IFormFieldC12, IFormData } from '@/types/types.forms';
|
|
27
36
|
import { validationConfig } from '@/components/forms/c12/validation-patterns';
|
|
37
|
+
import propValidators from '../c12/prop-validators';
|
|
28
38
|
|
|
29
39
|
const props = defineProps({
|
|
30
40
|
type: {
|
|
31
|
-
// type: String as PropType<"text" | "password" | "tel" | "number" | "email" | "url">, // This breaks props setup in unit tests
|
|
32
41
|
type: String,
|
|
33
42
|
validator(value: string) {
|
|
34
|
-
return
|
|
35
|
-
value
|
|
36
|
-
);
|
|
43
|
+
return propValidators.inputTypesText.includes(value);
|
|
37
44
|
},
|
|
38
45
|
},
|
|
39
46
|
id: {
|
|
40
|
-
// type: String as PropType<string>,
|
|
41
47
|
type: String,
|
|
42
48
|
required: true,
|
|
43
49
|
},
|
|
44
50
|
name: {
|
|
45
51
|
type: String,
|
|
46
|
-
|
|
52
|
+
required: true,
|
|
47
53
|
},
|
|
48
54
|
validation: {
|
|
49
55
|
type: String,
|
|
50
|
-
default:
|
|
56
|
+
default: null,
|
|
51
57
|
},
|
|
52
58
|
required: {
|
|
53
59
|
type: Boolean,
|
|
54
60
|
value: false,
|
|
55
61
|
},
|
|
56
|
-
isPending: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
value: false,
|
|
59
|
-
},
|
|
60
62
|
c12: {
|
|
61
63
|
type: Object as PropType<InpuTextC12>,
|
|
62
64
|
required: true,
|
|
@@ -67,9 +69,19 @@ const props = defineProps({
|
|
|
67
69
|
},
|
|
68
70
|
});
|
|
69
71
|
|
|
72
|
+
const slots = useSlots();
|
|
73
|
+
const hasLeftContent = computed(() => slots.left !== undefined);
|
|
74
|
+
const hasRightContent = computed(() => slots.right !== undefined);
|
|
75
|
+
|
|
70
76
|
const modelValue = defineModel() as Ref<IFormData>;
|
|
71
|
-
|
|
72
|
-
const
|
|
77
|
+
|
|
78
|
+
const updateFocus = (name: string, isFocused: boolean) => {
|
|
79
|
+
modelValue.value.focusedField = isFocused ? name : '';
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const isFocused = computed(() => {
|
|
83
|
+
return modelValue.value.focusedField == name.value;
|
|
84
|
+
});
|
|
73
85
|
|
|
74
86
|
const name = computed(() => {
|
|
75
87
|
return props.name !== null ? props.name : props.id;
|
|
@@ -77,69 +89,93 @@ const name = computed(() => {
|
|
|
77
89
|
|
|
78
90
|
const validatorLocale = toRef(useRuntimeConfig().public.validatorLocale);
|
|
79
91
|
|
|
80
|
-
const componentValidation =
|
|
81
|
-
validationConfig[validatorLocale.value][props.validation];
|
|
92
|
+
const componentValidation = validationConfig[validatorLocale.value][props.validation];
|
|
82
93
|
const inputField = ref<HTMLInputElement | null>(null);
|
|
83
94
|
|
|
84
|
-
const
|
|
85
|
-
name.value
|
|
86
|
-
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const hasApiErrorMessage = hasCustomError();
|
|
91
|
-
const inputBad = !inputField.value?.validity.valid;
|
|
95
|
+
const fieldIsDirty = computed(() => {
|
|
96
|
+
return modelValue.value!.formFieldsC12[name.value].isDirty;
|
|
97
|
+
});
|
|
98
|
+
const fieldHasError = computed(() => {
|
|
99
|
+
return modelValue.value!.submitAttempted && !modelValue.value!.formFieldsC12[name.value].isValid;
|
|
100
|
+
});
|
|
92
101
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
// const { fieldHasError } = useFormControl(name.value);
|
|
103
|
+
|
|
104
|
+
const formFieldC12 = <IFormFieldC12>{
|
|
105
|
+
label: props.c12.label,
|
|
106
|
+
placeholder: props.c12.placeholder,
|
|
107
|
+
errorMessage: props.c12.errorMessage,
|
|
108
|
+
useCustomError: false,
|
|
109
|
+
customErrors: {},
|
|
110
|
+
isValid: false,
|
|
111
|
+
isDirty: false,
|
|
112
|
+
type: 'string',
|
|
113
|
+
previousValue: null,
|
|
99
114
|
};
|
|
115
|
+
modelValue.value!.formFieldsC12[name.value] = formFieldC12;
|
|
116
|
+
|
|
117
|
+
const { initFormFieldsC12 } = useFormControl();
|
|
118
|
+
initFormFieldsC12(props.name, formFieldC12);
|
|
100
119
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
modelValue.value.data[name.value]
|
|
105
|
-
);
|
|
120
|
+
const fieldValue = computed(() => {
|
|
121
|
+
return modelValue.value.data[name.value];
|
|
122
|
+
});
|
|
106
123
|
|
|
107
|
-
|
|
124
|
+
watch(fieldValue, () => {
|
|
125
|
+
if (!modelValue.value!.formFieldsC12[name.value].isDirty) {
|
|
126
|
+
modelValue.value!.formFieldsC12[name.value].isDirty = modelValue.value.data[name.value] !== '';
|
|
127
|
+
}
|
|
128
|
+
modelValue.value!.formFieldsC12[name.value].isValid = inputField.value?.validity.valid ?? false;
|
|
129
|
+
modelValue.value!.validityState[name.value] = inputField.value?.validity.valid ?? false;
|
|
108
130
|
|
|
109
|
-
modelValue.value!.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
131
|
+
if (modelValue.value!.formFieldsC12[name.value].useCustomError && modelValue.value.data[props.name] === modelValue.value.formFieldsC12[props.name].previousValue) {
|
|
132
|
+
modelValue.value!.validityState[name.value] = false;
|
|
133
|
+
modelValue.value!.formFieldsC12[name.value].isValid = false;
|
|
134
|
+
modelValue.value.displayErrorMessages = true;
|
|
113
135
|
}
|
|
114
136
|
});
|
|
115
137
|
|
|
116
138
|
const isValid = () => {
|
|
117
139
|
setTimeout(() => {
|
|
118
|
-
modelValue.value!.validityState[name.value] =
|
|
119
|
-
|
|
140
|
+
modelValue.value!.validityState[name.value] = inputField.value?.validity.valid ?? false;
|
|
141
|
+
modelValue.value!.formFieldsC12[name.value].isValid = inputField.value?.validity.valid ?? false;
|
|
142
|
+
if (!modelValue.value!.formFieldsC12[name.value].isDirty) {
|
|
143
|
+
modelValue.value!.formFieldsC12[name.value].isDirty = modelValue.value.data[name.value] !== '';
|
|
144
|
+
}
|
|
120
145
|
}, 0);
|
|
121
146
|
};
|
|
122
147
|
|
|
123
|
-
// Keep an eye on this for performance issue
|
|
124
|
-
// watch(
|
|
125
|
-
// () => modelValue.value.data[name.value],
|
|
126
|
-
// () => {
|
|
127
|
-
// modelValue.value!.validityState[name.value] =
|
|
128
|
-
// inputField.value?.validity.valid ?? false;
|
|
129
|
-
// if (hasCustomError()) {
|
|
130
|
-
// removeCustomError(inputField.value?.validity.valid);
|
|
131
|
-
// }
|
|
132
|
-
// },
|
|
133
|
-
// { deep: true }
|
|
134
|
-
// );
|
|
135
|
-
|
|
136
148
|
onMounted(() => {
|
|
137
149
|
isValid();
|
|
138
150
|
});
|
|
139
151
|
</script>
|
|
140
152
|
|
|
141
153
|
<style lang="css">
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
154
|
+
.input-text-wrapper {
|
|
155
|
+
align-items: center;
|
|
156
|
+
display: grid;
|
|
157
|
+
grid-template-columns: 1fr;
|
|
158
|
+
|
|
159
|
+
&.has-left-content {
|
|
160
|
+
grid-template-columns: auto 1fr;
|
|
161
|
+
margin-left: var(--_gutter);
|
|
162
|
+
|
|
163
|
+
.left-content {
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&.has-right-content {
|
|
170
|
+
display: grid;
|
|
171
|
+
grid-template-columns: 1fr auto;
|
|
172
|
+
/* display: flex; */
|
|
173
|
+
margin-right: var(--_gutter);
|
|
174
|
+
|
|
175
|
+
.right-content {
|
|
176
|
+
display: flex;
|
|
177
|
+
align-items: center;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
145
181
|
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputTextMaterialCore type="email" :id :name :required :c12 :styleClassPassthrough :theme v-model="modelValue">
|
|
3
|
+
<template #input>
|
|
4
|
+
<InputTextCore :id :name type="email" :validation :required v-model="modelValue" :c12 :style-class-passthrough="styleClassPassthrough">
|
|
5
|
+
<template #left>
|
|
6
|
+
<Icon name="radix-icons:envelope-closed" class="icon" />
|
|
7
|
+
</template>
|
|
8
|
+
</InputTextCore>
|
|
9
|
+
</template>
|
|
10
|
+
</InputTextMaterialCore>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import type { InpuTextC12, IFormData } from '@/types/types.forms';
|
|
15
|
+
|
|
16
|
+
import propValidators from '../../../c12/prop-validators';
|
|
17
|
+
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
size: {
|
|
20
|
+
type: String as PropType<string>,
|
|
21
|
+
default: 'normal',
|
|
22
|
+
validator(value: string) {
|
|
23
|
+
return propValidators.size.includes(value);
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
weight: {
|
|
27
|
+
type: String as PropType<string>,
|
|
28
|
+
default: 'wght-400',
|
|
29
|
+
validator(value: string) {
|
|
30
|
+
return propValidators.weight.includes(value);
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
theme: {
|
|
34
|
+
type: String as PropType<string>,
|
|
35
|
+
default: 'primary',
|
|
36
|
+
validator(value: string) {
|
|
37
|
+
return propValidators.theme.includes(value);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
id: {
|
|
41
|
+
// type: String as PropType<string>,
|
|
42
|
+
type: String,
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
name: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: null,
|
|
48
|
+
},
|
|
49
|
+
validation: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
required: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
value: false,
|
|
56
|
+
},
|
|
57
|
+
c12: {
|
|
58
|
+
type: Object as PropType<InpuTextC12>,
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
styleClassPassthrough: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: '',
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const name = computed(() => {
|
|
68
|
+
return props.name !== null ? props.name : props.id;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const modelValue = defineModel() as Ref<IFormData>;
|
|
72
|
+
</script>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputTextMaterialCore :type :id :name :required :c12 :styleClassPassthrough :theme v-model="modelValue">
|
|
3
|
+
<template #input>
|
|
4
|
+
<InputTextCore :id :name :type :validation :required v-model="modelValue" :c12 :style-class-passthrough="styleClassPassthrough">
|
|
5
|
+
<template #right>
|
|
6
|
+
<InputButtonCore
|
|
7
|
+
type="button"
|
|
8
|
+
@click.stop.prevent="toggleDisplayPassword"
|
|
9
|
+
:is-pending="false"
|
|
10
|
+
:buttonText
|
|
11
|
+
theme="ghost"
|
|
12
|
+
size="x-small"
|
|
13
|
+
@focusin="updateFocus(name, true)"
|
|
14
|
+
@focusout="updateFocus(name, false)"
|
|
15
|
+
>
|
|
16
|
+
<template #iconOnly>
|
|
17
|
+
<Icon v-if="displayPassword" name="radix-icons:eye-none" class="icon" />
|
|
18
|
+
<Icon v-else name="radix-icons:eye-open" class="icon" />
|
|
19
|
+
</template>
|
|
20
|
+
</InputButtonCore>
|
|
21
|
+
</template>
|
|
22
|
+
</InputTextCore>
|
|
23
|
+
</template>
|
|
24
|
+
</InputTextMaterialCore>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import type { InpuTextC12, IFormData } from '@/types/types.forms';
|
|
29
|
+
|
|
30
|
+
import propValidators from '../../../c12/prop-validators';
|
|
31
|
+
|
|
32
|
+
const props = defineProps({
|
|
33
|
+
size: {
|
|
34
|
+
type: String as PropType<string>,
|
|
35
|
+
default: 'normal',
|
|
36
|
+
validator(value: string) {
|
|
37
|
+
return propValidators.size.includes(value);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
weight: {
|
|
41
|
+
type: String as PropType<string>,
|
|
42
|
+
default: 'wght-400',
|
|
43
|
+
validator(value: string) {
|
|
44
|
+
return propValidators.weight.includes(value);
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
theme: {
|
|
48
|
+
type: String as PropType<string>,
|
|
49
|
+
default: 'primary',
|
|
50
|
+
validator(value: string) {
|
|
51
|
+
return propValidators.theme.includes(value);
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
id: {
|
|
55
|
+
// type: String as PropType<string>,
|
|
56
|
+
type: String,
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
name: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: null,
|
|
62
|
+
},
|
|
63
|
+
validation: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '',
|
|
66
|
+
},
|
|
67
|
+
required: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
value: false,
|
|
70
|
+
},
|
|
71
|
+
c12: {
|
|
72
|
+
type: Object as PropType<InpuTextC12>,
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
styleClassPassthrough: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const name = computed(() => {
|
|
82
|
+
return props.name !== null ? props.name : props.id;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const modelValue = defineModel() as Ref<IFormData>;
|
|
86
|
+
|
|
87
|
+
const updateFocus = (name: string, isFocused: boolean) => {
|
|
88
|
+
modelValue.value.focusedField = isFocused ? name : '';
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const displayPassword = ref(false);
|
|
92
|
+
|
|
93
|
+
const type = computed(() => {
|
|
94
|
+
// return displayPassword.value && !modelValue.value.isPending ? "text" : "password";
|
|
95
|
+
return displayPassword.value ? 'text' : 'password';
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const buttonText = computed(() => {
|
|
99
|
+
return displayPassword.value ? 'Hide password' : 'Show password';
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const toggleDisplayPassword = () => {
|
|
103
|
+
displayPassword.value = !displayPassword.value;
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<style lang="css" scoped>
|
|
108
|
+
/* :deep(.input-text-core:not(.active)),
|
|
109
|
+
:deep(.input-text-core:not(.dirty)) {
|
|
110
|
+
+ .right-content {
|
|
111
|
+
display: none !important;
|
|
112
|
+
}
|
|
113
|
+
} */
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputTextMaterialCore type="text" :id :name :required :c12 :styleClassPassthrough :theme v-model="modelValue">
|
|
3
|
+
<template #input>
|
|
4
|
+
<InputTextCore :id :name type="text" :validation :required v-model="modelValue" :c12 :style-class-passthrough="styleClassPassthrough" />
|
|
5
|
+
</template>
|
|
6
|
+
</InputTextMaterialCore>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import type { InpuTextC12, IFormData } from '@/types/types.forms';
|
|
11
|
+
|
|
12
|
+
import propValidators from '../../../c12/prop-validators';
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
size: {
|
|
16
|
+
type: String as PropType<string>,
|
|
17
|
+
default: 'normal',
|
|
18
|
+
validator(value: string) {
|
|
19
|
+
return propValidators.size.includes(value);
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
weight: {
|
|
23
|
+
type: String as PropType<string>,
|
|
24
|
+
default: 'wght-400',
|
|
25
|
+
validator(value: string) {
|
|
26
|
+
return propValidators.weight.includes(value);
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
theme: {
|
|
30
|
+
type: String as PropType<string>,
|
|
31
|
+
default: 'primary',
|
|
32
|
+
validator(value: string) {
|
|
33
|
+
return propValidators.theme.includes(value);
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
id: {
|
|
37
|
+
// type: String as PropType<string>,
|
|
38
|
+
type: String,
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
name: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: null,
|
|
44
|
+
},
|
|
45
|
+
validation: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
required: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
value: false,
|
|
52
|
+
},
|
|
53
|
+
c12: {
|
|
54
|
+
type: Object as PropType<InpuTextC12>,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
styleClassPassthrough: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '',
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const name = computed(() => {
|
|
64
|
+
return props.name !== null ? props.name : props.id;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const modelValue = defineModel() as Ref<IFormData>;
|
|
68
|
+
</script>
|