srcdev-nuxt-forms 0.0.22 → 0.1.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/assets/styles/forms/themes/_error.css +12 -0
- package/assets/styles/forms/themes/_ghost.css +11 -0
- package/assets/styles/forms/themes/_primary.css +9 -1
- package/assets/styles/forms/themes/_secondary.css +11 -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 +6 -0
- package/assets/styles/forms/variables/_theme.css +64 -1
- 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 +25 -0
- package/components/forms/c12/validation-patterns/en.json +1 -1
- package/components/forms/input-button/InputButtonCore.vue +367 -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-text/InputTextCore.vue +77 -59
- package/components/forms/input-text/variants/material/InputEmailMaterial.vue +72 -0
- package/components/forms/input-text/variants/material/InputPasswordMaterial.vue +88 -0
- package/components/forms/input-text/variants/material/InputTextMaterial.vue +75 -0
- package/components/forms/input-text/variants/material/InputTextMaterialCore.vue +258 -0
- package/components/forms/ui/FormField.vue +7 -2
- package/components/forms/ui/FormWrapper.vue +2 -2
- package/composables/useErrorMessages.ts +4 -4
- package/composables/useFormControl.ts +36 -16
- package/composables/useUpdateStyleClassPassthrough.ts +29 -0
- package/layouts/default.vue +33 -2
- package/nuxt.config.ts +4 -3
- package/package.json +3 -1
- package/pages/forms/examples/buttons/index.vue +154 -0
- package/pages/forms/examples/material/text-fields-compact.vue +136 -0
- package/pages/forms/examples/material/text-fields.vue +136 -0
- package/pages/index.vue +2 -70
- package/types/types.forms.ts +6 -11
- package/components/forms/input-text/InputTextField.vue +0 -22
- package/components/forms/input-text/variants/InputTextMaterial.vue +0 -159
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="input-text-material">
|
|
3
|
-
<label
|
|
4
|
-
class="label"
|
|
5
|
-
:class="[{ active: isFocused }, { dirty: isDirty }]"
|
|
6
|
-
:for="id"
|
|
7
|
-
>{{ c12.label }}</label
|
|
8
|
-
>
|
|
9
|
-
<div class="input-text-container">
|
|
10
|
-
<InputTextCore
|
|
11
|
-
:id
|
|
12
|
-
:name
|
|
13
|
-
:type
|
|
14
|
-
:validation
|
|
15
|
-
:required
|
|
16
|
-
v-model="modelValue"
|
|
17
|
-
v-model:isFocused="isFocused"
|
|
18
|
-
:c12
|
|
19
|
-
:style-class-passthrough="styleClassPassthrough"
|
|
20
|
-
/>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script setup lang="ts">
|
|
26
|
-
import type { InpuTextC12, IFormData } from '@/types/types.forms';
|
|
27
|
-
import { validationConfig } from '@/components/forms/c12/validation-patterns';
|
|
28
|
-
|
|
29
|
-
const props = defineProps({
|
|
30
|
-
type: {
|
|
31
|
-
// type: String as PropType<"text" | "password" | "tel" | "number" | "email" | "url">, // This breaks props setup in unit tests
|
|
32
|
-
type: String,
|
|
33
|
-
validator(value: string) {
|
|
34
|
-
return ['text', 'password', 'tel', 'number', 'email', 'url'].includes(
|
|
35
|
-
value
|
|
36
|
-
);
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
id: {
|
|
40
|
-
// type: String as PropType<string>,
|
|
41
|
-
type: String,
|
|
42
|
-
required: true,
|
|
43
|
-
},
|
|
44
|
-
name: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: null,
|
|
47
|
-
},
|
|
48
|
-
validation: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: '',
|
|
51
|
-
},
|
|
52
|
-
required: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
value: false,
|
|
55
|
-
},
|
|
56
|
-
isPending: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
value: false,
|
|
59
|
-
},
|
|
60
|
-
c12: {
|
|
61
|
-
type: Object as PropType<InpuTextC12>,
|
|
62
|
-
required: true,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const name = computed(() => {
|
|
67
|
-
return props.name !== null ? props.name : props.id;
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const styleClassPassthrough = computed(() => {
|
|
71
|
-
return isFocused.value ? 'is-active' : '';
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const modelValue = defineModel() as Ref<IFormData>;
|
|
75
|
-
const isFocused = ref(false);
|
|
76
|
-
const isDirty = computed(() => {
|
|
77
|
-
return modelValue.value.data[name.value] !== '';
|
|
78
|
-
});
|
|
79
|
-
</script>
|
|
80
|
-
|
|
81
|
-
<style lang="css">
|
|
82
|
-
.input-text-material {
|
|
83
|
-
input {
|
|
84
|
-
background-color: transparent;
|
|
85
|
-
&:focus {
|
|
86
|
-
outline: none;
|
|
87
|
-
box-shadow: none;
|
|
88
|
-
border: none;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
--_gutter: 12px;
|
|
93
|
-
--_border-default: var(--primary-border-default);
|
|
94
|
-
--_border-width: var(--input-border-width-default);
|
|
95
|
-
|
|
96
|
-
display: grid;
|
|
97
|
-
border-radius: 2px;
|
|
98
|
-
outline: var(--_border-width) solid var(--_border-default);
|
|
99
|
-
|
|
100
|
-
margin-bottom: 20px;
|
|
101
|
-
overflow: hidden;
|
|
102
|
-
|
|
103
|
-
&:focus-within {
|
|
104
|
-
outline: calc(var(--_border-width) * 2) solid var(--_border-default);
|
|
105
|
-
background-color: hsl(from var(--_border-default) h s 95%);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.label {
|
|
109
|
-
grid-row: 1;
|
|
110
|
-
grid-column: 1;
|
|
111
|
-
|
|
112
|
-
font-family: var(--font-family);
|
|
113
|
-
font-size: 20px;
|
|
114
|
-
font-weight: 700;
|
|
115
|
-
padding: var(--_gutter);
|
|
116
|
-
transform: translateY(10px);
|
|
117
|
-
transition: all linear 0.2s;
|
|
118
|
-
background-color: transparent;
|
|
119
|
-
|
|
120
|
-
&.active,
|
|
121
|
-
&.dirty {
|
|
122
|
-
font-size: 14px;
|
|
123
|
-
transform: translateY(0);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.input-text-container {
|
|
128
|
-
display: grid;
|
|
129
|
-
grid-row: 1;
|
|
130
|
-
grid-column: 1;
|
|
131
|
-
margin-top: 2rem;
|
|
132
|
-
background-color: transparent;
|
|
133
|
-
|
|
134
|
-
.input-text {
|
|
135
|
-
font-family: var(--font-family);
|
|
136
|
-
border: 0px solid green;
|
|
137
|
-
padding: calc(var(--_gutter) / 2) var(--_gutter);
|
|
138
|
-
font-size: 16px;
|
|
139
|
-
margin: 0;
|
|
140
|
-
|
|
141
|
-
/* &::placeholder,
|
|
142
|
-
&:-ms-input-placeholder,
|
|
143
|
-
&::-moz-placeholder, */
|
|
144
|
-
&::-webkit-input-placeholder {
|
|
145
|
-
font-family: var(--font-family);
|
|
146
|
-
color: var(--gray-5);
|
|
147
|
-
font-size: 14px;
|
|
148
|
-
font-style: italic;
|
|
149
|
-
font-weight: 700;
|
|
150
|
-
opacity: 0;
|
|
151
|
-
|
|
152
|
-
&.is-active {
|
|
153
|
-
opacity: 1;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
</style>
|