srcdev-nuxt-forms 0.2.0 → 1.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/brand/_brand.css +150 -0
- package/assets/styles/brand/_brand_dark.css +152 -0
- package/assets/styles/brand/_palette_dark.css +148 -0
- package/assets/styles/brand/_palette_light.css +148 -0
- package/assets/styles/brand/_typography.css +176 -0
- package/assets/styles/brand/index.css +1 -0
- package/assets/styles/forms/index.css +1 -2
- package/assets/styles/forms/themes/_default.css +3 -0
- package/assets/styles/forms/themes/_error.css +45 -11
- package/assets/styles/forms/themes/_ghost.css +42 -10
- package/assets/styles/forms/themes/_primary.css +42 -12
- package/assets/styles/forms/themes/_secondary.css +42 -12
- package/assets/styles/forms/themes/_success.css +42 -11
- package/assets/styles/forms/themes/_tertiary.css +42 -10
- package/assets/styles/forms/themes/_warning.css +42 -10
- package/assets/styles/forms/themes/index.css +1 -0
- package/assets/styles/forms/variables/_palette.css +104 -0
- package/assets/styles/forms/variables/_theme.css +1 -1
- package/assets/styles/forms/variables/index.css +2 -0
- package/assets/styles/main.css +2 -0
- package/assets/styles/scaffolding/_margin-helpers.css +308 -0
- package/assets/styles/scaffolding/_padding-helpers.css +308 -0
- package/assets/styles/scaffolding/_page.css +23 -0
- package/assets/styles/scaffolding/index.css +3 -0
- package/assets/styles/variables/colors/_blue.css +2 -2
- package/assets/styles/variables/colors/_gray.css +1 -1
- package/assets/styles/variables/colors/_green.css +2 -2
- package/assets/styles/variables/colors/_orange.css +2 -2
- package/assets/styles/variables/colors/_red.css +2 -2
- package/assets/styles/variables/colors/_yellow.css +1 -1
- package/components/forms/form-errors/InputError.vue +82 -37
- package/components/forms/input-button/InputButtonCore.vue +25 -104
- package/components/forms/input-checkbox/InputCheckboxCore.vue +37 -181
- package/components/forms/input-checkbox/InputCheckboxWithLabel.vue +42 -51
- package/components/forms/input-checkbox/variants/MultipleCheckboxes.vue +42 -69
- package/components/forms/input-checkbox/variants/SingleCheckbox.vue +126 -111
- package/components/forms/input-number/InputNumberCore.vue +184 -0
- package/components/forms/input-number/variants/InputNumberDefault.vue +155 -0
- package/components/forms/input-radio/InputRadiobuttonCore.vue +212 -0
- package/components/forms/input-radio/InputRadiobuttonWithLabel.vue +103 -0
- package/components/forms/input-radio/variants/MultipleRadiobuttons.vue +166 -0
- package/components/forms/input-range/InputRangeCore.vue +70 -88
- package/components/forms/input-range/variants/InputRangeDefault.vue +74 -46
- package/components/forms/input-text/InputTextCore.vue +141 -109
- package/components/forms/input-text/variants/material/InputPasswordWithLabel.vue +99 -0
- package/components/forms/input-text/variants/material/InputTextAsNumberWithLabel.vue +142 -0
- package/components/forms/input-text/variants/material/InputTextWithLabel.vue +125 -0
- package/components/forms/input-textarea/InputTextareaCore.vue +96 -105
- package/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +106 -0
- package/components/scaffolding/footer/NavFooter.vue +62 -0
- package/composables/useApiRequest.ts +25 -0
- package/composables/useFormControl.ts +2 -0
- package/composables/useSleep.ts +2 -2
- package/composables/useStyleClassPassthrough.ts +30 -0
- package/composables/useZodValidation.ts +120 -0
- package/layouts/default.vue +21 -5
- package/package.json +13 -9
- package/pages/forms/examples/material/cssbattle.vue +60 -0
- package/pages/forms/examples/material/text-fields.vue +375 -153
- package/pages/index.vue +2 -2
- package/pages/typography.vue +83 -0
- package/server/data/places/cities.json +7 -1
- package/types/types.forms.ts +102 -0
- package/types/types.zodFormControl.ts +21 -0
- package/assets/styles/forms/utils/_a11y.css +0 -5
- package/assets/styles/forms/utils/index.css +0 -1
- package/components/forms/input-radio/InputRadioCore.vue +0 -226
- package/components/forms/input-radio/InputRadioWithLabel.vue +0 -118
- package/components/forms/input-radio/variants/MultipleRadio.vue +0 -183
- package/components/forms/input-radio/variants/SingleRadio.vue +0 -131
- package/components/forms/input-text/variants/material/InputEmailMaterial.vue +0 -72
- package/components/forms/input-text/variants/material/InputPasswordMaterial.vue +0 -114
- package/components/forms/input-text/variants/material/InputTextMaterial.vue +0 -68
- package/components/forms/input-text/variants/material/InputTextMaterialCore.vue +0 -313
- package/components/forms/input-textarea/variants/material/InputTextareaMaterial.vue +0 -75
- package/components/forms/input-textarea/variants/material/InputTextareaMaterialCore.vue +0 -290
- package/composables/useUpdateStyleClassPassthrough.ts +0 -29
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<fieldset class="multiple-radio-fieldset" :class="[`theme-${theme}`, { error: fieldHasError }]" :aria-required="required" :aria-invalid="fieldHasError" role="radiogroup">
|
|
3
|
-
<legend :class="[{ 'has-description': hasDescription }]">
|
|
4
|
-
{{ legend }}
|
|
5
|
-
<span v-if="required"> (Required)</span>
|
|
6
|
-
</legend>
|
|
7
|
-
<template v-if="hasDescription">
|
|
8
|
-
<slot name="description"></slot>
|
|
9
|
-
</template>
|
|
10
|
-
<InputError :errorMessaging :fieldHasError :id="name" :isDetached="true" />
|
|
11
|
-
<div class="multiple-radio-items" :class="[optionsLayout]">
|
|
12
|
-
<template v-for="item in fieldData.data" :key="item.id">
|
|
13
|
-
<InputRadioWithLabel
|
|
14
|
-
:id="item.value"
|
|
15
|
-
:name
|
|
16
|
-
:required
|
|
17
|
-
:c12="{
|
|
18
|
-
label: item.label,
|
|
19
|
-
placeholder: 'eg. Type something here',
|
|
20
|
-
errorMessage: 'Please accept our terms and conditions',
|
|
21
|
-
}"
|
|
22
|
-
v-model="modelValue"
|
|
23
|
-
:true-value="item.value"
|
|
24
|
-
:theme
|
|
25
|
-
:size
|
|
26
|
-
:radioAppearance
|
|
27
|
-
/>
|
|
28
|
-
</template>
|
|
29
|
-
</div>
|
|
30
|
-
</fieldset>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<script setup lang="ts">
|
|
34
|
-
import propValidators from '../../c12/prop-validators';
|
|
35
|
-
import type { IOptionsConfig, IFormMultipleOptions } from '@/types/types.forms';
|
|
36
|
-
|
|
37
|
-
import type { InpuTextC12, IFormFieldC12, IFormData } from '@/types/types.forms';
|
|
38
|
-
|
|
39
|
-
const props = defineProps({
|
|
40
|
-
name: {
|
|
41
|
-
type: String,
|
|
42
|
-
required: true,
|
|
43
|
-
},
|
|
44
|
-
legend: {
|
|
45
|
-
type: String,
|
|
46
|
-
required: true,
|
|
47
|
-
},
|
|
48
|
-
required: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
value: false,
|
|
51
|
-
},
|
|
52
|
-
c12: {
|
|
53
|
-
type: Object as PropType<InpuTextC12>,
|
|
54
|
-
required: true,
|
|
55
|
-
},
|
|
56
|
-
multipleOptions: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: false,
|
|
59
|
-
},
|
|
60
|
-
styleClassPassthrough: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: '',
|
|
63
|
-
},
|
|
64
|
-
theme: {
|
|
65
|
-
type: String as PropType<string>,
|
|
66
|
-
default: 'primary',
|
|
67
|
-
validator(value: string) {
|
|
68
|
-
return propValidators.theme.includes(value);
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
size: {
|
|
72
|
-
type: String as PropType<string>,
|
|
73
|
-
default: 'medium',
|
|
74
|
-
validator(value: string) {
|
|
75
|
-
return propValidators.size.includes(value);
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
optionsLayout: {
|
|
79
|
-
type: String as PropType<string>,
|
|
80
|
-
default: 'equal-widths',
|
|
81
|
-
validator(value: string) {
|
|
82
|
-
return propValidators.optionsLayout.includes(value);
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
equalCols: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: true,
|
|
88
|
-
},
|
|
89
|
-
radioAppearance: {
|
|
90
|
-
type: String as PropType<string>,
|
|
91
|
-
default: null,
|
|
92
|
-
validator(value: string) {
|
|
93
|
-
return propValidators.radioAppearance.includes(value);
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const slots = useSlots();
|
|
99
|
-
const hasDescription = computed(() => slots.description !== undefined);
|
|
100
|
-
|
|
101
|
-
const modelValue = defineModel() as Ref<IFormData>;
|
|
102
|
-
const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
103
|
-
|
|
104
|
-
const errorMessaging = computed(() => {
|
|
105
|
-
if (
|
|
106
|
-
typeof modelValue.value!.formFieldsC12[props.name] !== 'undefined' &&
|
|
107
|
-
modelValue.value!.formFieldsC12[props.name].useCustomError &&
|
|
108
|
-
modelValue.value.data[props.name] === modelValue.value.formFieldsC12[props.name].previousValue
|
|
109
|
-
) {
|
|
110
|
-
return modelValue.value.formFieldsC12[props.name]?.customErrors || [];
|
|
111
|
-
} else {
|
|
112
|
-
return props.c12.errorMessage;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// const isArray = Array.isArray(modelValue.value.data[props.name]);
|
|
117
|
-
// const formFieldC12 = <IFormFieldC12>{
|
|
118
|
-
// label: props.c12.label,
|
|
119
|
-
// placeholder: props.c12.placeholder,
|
|
120
|
-
// errorMessage: props.c12.errorMessage,
|
|
121
|
-
// useCustomError: false,
|
|
122
|
-
// customErrors: {},
|
|
123
|
-
// isValid: false,
|
|
124
|
-
// isDirty: false,
|
|
125
|
-
// type: isArray ? 'array' : 'string',
|
|
126
|
-
// previousValue: null,
|
|
127
|
-
// };
|
|
128
|
-
// modelValue.value.formFieldsC12[props.name] = formFieldC12;
|
|
129
|
-
|
|
130
|
-
const fieldHasError = computed(() => {
|
|
131
|
-
return modelValue.value!.submitAttempted && !modelValue.value!.formFieldsC12[props.name].isValid;
|
|
132
|
-
});
|
|
133
|
-
</script>
|
|
134
|
-
|
|
135
|
-
<style lang="css">
|
|
136
|
-
.multiple-radio-fieldset {
|
|
137
|
-
--_form-theme: var(--theme-form-primary);
|
|
138
|
-
|
|
139
|
-
margin: 0;
|
|
140
|
-
padding: 0;
|
|
141
|
-
border: 0;
|
|
142
|
-
|
|
143
|
-
&.theme-secondary {
|
|
144
|
-
--_form-theme: var(--theme-form-secondary);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
&.error {
|
|
148
|
-
--_form-theme: var(--theme-error);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
legend {
|
|
152
|
-
color: var(--_form-theme);
|
|
153
|
-
|
|
154
|
-
font-family: var(--font-family);
|
|
155
|
-
font-size: 18px;
|
|
156
|
-
font-weight: 500;
|
|
157
|
-
|
|
158
|
-
&.has-description {
|
|
159
|
-
margin-bottom: 0;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.multiple-radio-items {
|
|
165
|
-
display: flex;
|
|
166
|
-
gap: 18px;
|
|
167
|
-
margin-top: 12px;
|
|
168
|
-
|
|
169
|
-
&.inline {
|
|
170
|
-
flex-direction: row;
|
|
171
|
-
flex-wrap: wrap;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
&.block {
|
|
175
|
-
flex-direction: column;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
&.equal-widths {
|
|
179
|
-
display: grid;
|
|
180
|
-
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
</style>
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<fieldset class="single-radio-fieldset" :class="[`theme-${theme}`, { error: fieldHasError }]">
|
|
3
|
-
<legend :class="[{ 'has-description': hasDescription }]">{{ legend }}</legend>
|
|
4
|
-
<template v-if="hasDescription">
|
|
5
|
-
<slot name="description"></slot>
|
|
6
|
-
</template>
|
|
7
|
-
<InputError :errorMessaging :fieldHasError :id="name" :isDetached="true" />
|
|
8
|
-
<InputRadioWithLabel :id :name :required :c12 v-model="modelValue" :theme :size :radioAppearance />
|
|
9
|
-
</fieldset>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script setup lang="ts">
|
|
13
|
-
import propValidators from '../../c12/prop-validators';
|
|
14
|
-
|
|
15
|
-
import type { InpuTextC12, IFormFieldC12, IFormData } from '@/types/types.forms';
|
|
16
|
-
// import { validationConfig } from '@/components/forms/c12/validation-patterns';
|
|
17
|
-
|
|
18
|
-
const props = defineProps({
|
|
19
|
-
id: {
|
|
20
|
-
// type: String as PropType<string>,
|
|
21
|
-
type: String,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
name: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: true,
|
|
27
|
-
},
|
|
28
|
-
legend: {
|
|
29
|
-
type: String,
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
32
|
-
required: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
value: false,
|
|
35
|
-
},
|
|
36
|
-
c12: {
|
|
37
|
-
type: Object as PropType<InpuTextC12>,
|
|
38
|
-
required: true,
|
|
39
|
-
},
|
|
40
|
-
trueValue: {
|
|
41
|
-
type: [String, Number, Boolean],
|
|
42
|
-
default: true,
|
|
43
|
-
},
|
|
44
|
-
falseValue: {
|
|
45
|
-
type: [String, Number, Boolean],
|
|
46
|
-
default: false,
|
|
47
|
-
},
|
|
48
|
-
// multipleOptions: {
|
|
49
|
-
// type: Boolean,
|
|
50
|
-
// default: false,
|
|
51
|
-
// },
|
|
52
|
-
styleClassPassthrough: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: '',
|
|
55
|
-
},
|
|
56
|
-
theme: {
|
|
57
|
-
type: String as PropType<string>,
|
|
58
|
-
default: 'primary',
|
|
59
|
-
validator(value: string) {
|
|
60
|
-
return propValidators.theme.includes(value);
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
size: {
|
|
64
|
-
type: String as PropType<string>,
|
|
65
|
-
default: 'medium',
|
|
66
|
-
validator(value: string) {
|
|
67
|
-
return propValidators.size.includes(value);
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
radioAppearance: {
|
|
71
|
-
type: String as PropType<string>,
|
|
72
|
-
default: null,
|
|
73
|
-
validator(value: string) {
|
|
74
|
-
return propValidators.radioAppearance.includes(value);
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const slots = useSlots();
|
|
80
|
-
const hasDescription = computed(() => slots.description !== undefined);
|
|
81
|
-
|
|
82
|
-
const modelValue = defineModel() as Ref<IFormData>;
|
|
83
|
-
const name = computed(() => {
|
|
84
|
-
return props.name !== null ? props.name : props.id;
|
|
85
|
-
});
|
|
86
|
-
const fieldHasError = computed(() => {
|
|
87
|
-
return modelValue.value!.submitAttempted && !modelValue.value!.formFieldsC12[props.name].isValid;
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const errorMessaging = computed(() => {
|
|
91
|
-
if (
|
|
92
|
-
typeof modelValue.value!.formFieldsC12[props.name] !== 'undefined' &&
|
|
93
|
-
modelValue.value!.formFieldsC12[props.name].useCustomError &&
|
|
94
|
-
modelValue.value.data[props.name] === modelValue.value.formFieldsC12[props.name].previousValue
|
|
95
|
-
) {
|
|
96
|
-
return modelValue.value.formFieldsC12[props.name]?.customErrors || [];
|
|
97
|
-
} else {
|
|
98
|
-
return props.c12.errorMessage;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<style lang="css">
|
|
104
|
-
.single-radio-fieldset {
|
|
105
|
-
--_form-theme: var(--theme-form-primary);
|
|
106
|
-
|
|
107
|
-
margin: 0;
|
|
108
|
-
padding: 0;
|
|
109
|
-
border: 0;
|
|
110
|
-
|
|
111
|
-
&.theme-secondary {
|
|
112
|
-
--_form-theme: var(--theme-form-secondary);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
&.error {
|
|
116
|
-
--_form-theme: var(--theme-error);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
legend {
|
|
120
|
-
color: var(--_form-theme);
|
|
121
|
-
font-family: var(--font-family);
|
|
122
|
-
font-size: 18px;
|
|
123
|
-
font-weight: 500;
|
|
124
|
-
margin-bottom: 12px;
|
|
125
|
-
|
|
126
|
-
&.has-description {
|
|
127
|
-
margin-bottom: 0;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
</style>
|
|
@@ -1,72 +0,0 @@
|
|
|
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>
|
|
@@ -1,114 +0,0 @@
|
|
|
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>
|
|
@@ -1,68 +0,0 @@
|
|
|
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>
|