srcdev-nuxt-forms 0.0.20 → 0.0.21
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/forms/variables/_theme.css +3 -0
- package/assets/styles/main.css +2 -1
- package/assets/styles/variables/index.css +1 -1
- package/components/forms/input-text/InputTextCore.vue +10 -1
- package/components/forms/input-text/variants/InputTextMaterial.vue +76 -21
- package/components/forms/ui/FormField.vue +2 -2
- package/components/forms/ui/FormWrapper.vue +2 -2
- package/package.json +1 -1
- package/assets/styles/variables/_colours.css +0 -10
- /package/assets/styles/variables/colors/{_grey.css → _gray.css} +0 -0
package/assets/styles/main.css
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import './variables';
|
|
2
|
+
@import './forms';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import './
|
|
1
|
+
@import './colors/index.css';
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
:pattern="componentValidation.pattern"
|
|
8
8
|
:maxlength="componentValidation.maxlength"
|
|
9
9
|
:required
|
|
10
|
-
:class="[
|
|
10
|
+
:class="[
|
|
11
|
+
'input-text',
|
|
12
|
+
'text-normal',
|
|
13
|
+
styleClassPassthrough,
|
|
14
|
+
{ error: fieldHasError() },
|
|
15
|
+
]"
|
|
11
16
|
v-model="modelValue.data[name]"
|
|
12
17
|
ref="inputField"
|
|
13
18
|
@focusin="isFocused = true"
|
|
@@ -54,6 +59,10 @@ const props = defineProps({
|
|
|
54
59
|
type: Object as PropType<InpuTextC12>,
|
|
55
60
|
required: true,
|
|
56
61
|
},
|
|
62
|
+
styleClassPassthrough: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
57
66
|
});
|
|
58
67
|
|
|
59
68
|
const modelValue = defineModel() as Ref<IFormData>;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="input-text-material">
|
|
3
|
-
<label :
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
<label class="label" :class="[{ active: isFocused }]" :for="id"
|
|
4
|
+
>{{ c12.label }} - isFocused({{ isFocused }})</label
|
|
5
|
+
>
|
|
6
|
+
<div class="input-placeholder">
|
|
7
|
+
<InputTextCore
|
|
8
|
+
:id
|
|
9
|
+
:name
|
|
10
|
+
:type
|
|
11
|
+
:validation
|
|
12
|
+
:required
|
|
13
|
+
v-model="modelValue"
|
|
14
|
+
v-model:isFocused="isFocused"
|
|
15
|
+
:c12
|
|
16
|
+
:style-class-passthrough="styleClassPassthrough"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
14
19
|
</div>
|
|
15
20
|
</template>
|
|
16
21
|
|
|
@@ -59,30 +64,80 @@ const name = computed(() => {
|
|
|
59
64
|
return props.name !== null ? props.name : props.id;
|
|
60
65
|
});
|
|
61
66
|
|
|
67
|
+
const styleClassPassthrough = computed(() => {
|
|
68
|
+
return isFocused.value ? 'is-active' : '';
|
|
69
|
+
});
|
|
70
|
+
|
|
62
71
|
const modelValue = defineModel() as Ref<IFormData>;
|
|
63
72
|
const isFocused = ref(false);
|
|
64
73
|
</script>
|
|
65
74
|
|
|
66
75
|
<style lang="css">
|
|
67
76
|
.input-text-material {
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
--_gutter: 12px;
|
|
78
|
+
|
|
79
|
+
display: grid;
|
|
80
|
+
grid-template-columns: 1fr;
|
|
81
|
+
/* grid-template-rows: var(--_gutter) 1fr var(--_gutter); */
|
|
82
|
+
grid-template-rows: var(--_gutter) 1fr var(--_gutter);
|
|
83
|
+
gap: calc(var(--_gutter) / 2);
|
|
70
84
|
|
|
71
|
-
border: 1px solid
|
|
85
|
+
border: 1px solid red;
|
|
72
86
|
border-radius: 2px;
|
|
73
87
|
|
|
74
88
|
margin-bottom: 20px;
|
|
89
|
+
/* padding: calc(2 * var(--_gutter)); */
|
|
90
|
+
|
|
91
|
+
.label {
|
|
92
|
+
grid-row: 2;
|
|
93
|
+
grid-column: 1;
|
|
94
|
+
|
|
95
|
+
font-family: var(--font-family);
|
|
96
|
+
font-size: 16px;
|
|
97
|
+
font-weight: 700;
|
|
98
|
+
padding: var(--_gutter);
|
|
99
|
+
/* transform: translateY(12px); */
|
|
100
|
+
|
|
101
|
+
z-index: 2;
|
|
75
102
|
|
|
76
|
-
|
|
77
|
-
border: 1px solid red;
|
|
78
|
-
margin: 5px;
|
|
103
|
+
transition: all linear 0.2s;
|
|
79
104
|
|
|
80
|
-
|
|
105
|
+
&.active {
|
|
106
|
+
grid-row: 1;
|
|
107
|
+
grid-column: 1;
|
|
108
|
+
/* padding: 0; */
|
|
109
|
+
transform: translateY(-10px);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.input-placeholder {
|
|
114
|
+
grid-row: 2;
|
|
115
|
+
grid-column: 1;
|
|
116
|
+
align-content: center;
|
|
117
|
+
padding-inline: var(--_gutter);
|
|
118
|
+
transform: translateY(12px);
|
|
119
|
+
|
|
120
|
+
.input-text {
|
|
121
|
+
font-family: var(--font-family);
|
|
122
|
+
border: 0px solid green;
|
|
123
|
+
padding: var(--_gutter);
|
|
124
|
+
font-size: 16px;
|
|
125
|
+
|
|
126
|
+
/* &::placeholder,
|
|
81
127
|
&:-ms-input-placeholder,
|
|
82
128
|
&::-moz-placeholder, */
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
129
|
+
&::-webkit-input-placeholder {
|
|
130
|
+
font-family: var(--font-family);
|
|
131
|
+
color: var(--gray-5);
|
|
132
|
+
font-size: 14px;
|
|
133
|
+
font-style: italic;
|
|
134
|
+
font-weight: 700;
|
|
135
|
+
opacity: 0;
|
|
136
|
+
|
|
137
|
+
&.is-active {
|
|
138
|
+
opacity: 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
86
141
|
}
|
|
87
142
|
}
|
|
88
143
|
}
|
|
@@ -16,7 +16,7 @@ defineProps({
|
|
|
16
16
|
type: Boolean as PropType<boolean>,
|
|
17
17
|
default: true,
|
|
18
18
|
},
|
|
19
|
-
})
|
|
19
|
+
});
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<style lang="css">
|
|
@@ -26,7 +26,7 @@ defineProps({
|
|
|
26
26
|
|
|
27
27
|
margin-inline: auto;
|
|
28
28
|
width: min(100% - calc(2 * var(--_gutter-width)), var(--_max-width));
|
|
29
|
-
outline: 1px solid
|
|
29
|
+
outline: 1px solid var(--gray-5);
|
|
30
30
|
|
|
31
31
|
&.has-gutter {
|
|
32
32
|
--_gutter-width: 16px;
|
|
@@ -12,12 +12,12 @@ defineProps({
|
|
|
12
12
|
default: 'narrow',
|
|
13
13
|
validator: (val: string) => ['narrow', 'medium', 'wide'].includes(val),
|
|
14
14
|
},
|
|
15
|
-
})
|
|
15
|
+
});
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<style lang="css">
|
|
19
19
|
.form-wrapper {
|
|
20
|
-
outline: 1px solid
|
|
20
|
+
outline: 1px solid var(--gray-12);
|
|
21
21
|
|
|
22
22
|
&.narrow {
|
|
23
23
|
max-width: 400px;
|
package/package.json
CHANGED
|
File without changes
|