cja-phoenix 0.0.13 → 0.0.15
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/dist/cja-phoenix.es.js +2897 -2664
- package/dist/style.css +1 -1
- package/dist/types/components/forms/FileInput.vue.d.ts +49 -0
- package/dist/types/components/forms/InputTitle.vue.d.ts +17 -0
- package/dist/types/components/forms/InputToggle.vue.d.ts +42 -0
- package/dist/types/components/forms/PhoneInput.vue.d.ts +56 -53
- package/dist/types/components/forms/SelectInput.vue.d.ts +21 -11
- package/dist/types/components/forms/TextInput.vue.d.ts +28 -17
- package/dist/types/components/index.d.ts +5 -1
- package/dist/types/components/structural/CollapseContainer.vue.d.ts +29 -0
- package/dist/types/components/structural/ContentTabs.vue.d.ts +25 -0
- package/dist/types/types/Tab.d.ts +4 -0
- package/package.json +5 -5
- package/src/assets/forms.scss +10 -9
- package/src/assets/iconia/fonts/CGG-icomoon.eot +0 -0
- package/src/assets/iconia/fonts/CGG-icomoon.svg +1 -1
- package/src/assets/iconia/fonts/CGG-icomoon.ttf +0 -0
- package/src/assets/iconia/fonts/CGG-icomoon.woff +0 -0
- package/src/assets/iconia/selection.json +1 -1
- package/src/assets/iconia/style.css +5 -5
- package/src/assets/iconia/style.scss +5 -5
- package/src/components/composite/ProductDetails.vue +27 -38
- package/src/components/forms/FileInput.vue +227 -0
- package/src/components/forms/InputTitle.vue +42 -0
- package/src/components/forms/InputToggle.vue +80 -0
- package/src/components/forms/PhoneInput.vue +29 -28
- package/src/components/forms/SelectInput.vue +27 -24
- package/src/components/forms/TextInput.vue +19 -11
- package/src/components/index.ts +9 -0
- package/src/components/structural/CollapseContainer.vue +115 -0
- package/src/components/structural/ContentTabs.vue +104 -0
- package/src/index.ts +0 -2
- package/src/types/Tab.ts +4 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: 'CGG-icomoon';
|
|
3
|
-
src: url('fonts/CGG-icomoon.eot?
|
|
4
|
-
src: url('fonts/CGG-icomoon.eot?
|
|
5
|
-
url('fonts/CGG-icomoon.ttf?
|
|
6
|
-
url('fonts/CGG-icomoon.woff?
|
|
7
|
-
url('fonts/CGG-icomoon.svg?
|
|
3
|
+
src: url('fonts/CGG-icomoon.eot?cjnnpy');
|
|
4
|
+
src: url('fonts/CGG-icomoon.eot?cjnnpy#iefix') format('embedded-opentype'),
|
|
5
|
+
url('fonts/CGG-icomoon.ttf?cjnnpy') format('truetype'),
|
|
6
|
+
url('fonts/CGG-icomoon.woff?cjnnpy') format('woff'),
|
|
7
|
+
url('fonts/CGG-icomoon.svg?cjnnpy#CGG-icomoon') format('svg');
|
|
8
8
|
font-weight: normal;
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-display: block;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
@font-face {
|
|
4
4
|
font-family: '#{$icomoon-font-family}';
|
|
5
|
-
src: url('#{$icomoon-font-path}/#{$icomoon-font-family}.eot?
|
|
6
|
-
src: url('#{$icomoon-font-path}/#{$icomoon-font-family}.eot?
|
|
7
|
-
url('#{$icomoon-font-path}/#{$icomoon-font-family}.ttf?
|
|
8
|
-
url('#{$icomoon-font-path}/#{$icomoon-font-family}.woff?
|
|
9
|
-
url('#{$icomoon-font-path}/#{$icomoon-font-family}.svg?
|
|
5
|
+
src: url('#{$icomoon-font-path}/#{$icomoon-font-family}.eot?cjnnpy');
|
|
6
|
+
src: url('#{$icomoon-font-path}/#{$icomoon-font-family}.eot?cjnnpy#iefix') format('embedded-opentype'),
|
|
7
|
+
url('#{$icomoon-font-path}/#{$icomoon-font-family}.ttf?cjnnpy') format('truetype'),
|
|
8
|
+
url('#{$icomoon-font-path}/#{$icomoon-font-family}.woff?cjnnpy') format('woff'),
|
|
9
|
+
url('#{$icomoon-font-path}/#{$icomoon-font-family}.svg?cjnnpy##{$icomoon-font-family}') format('svg');
|
|
10
10
|
font-weight: normal;
|
|
11
11
|
font-style: normal;
|
|
12
12
|
font-display: block;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="body">
|
|
3
3
|
<Transition name="details">
|
|
4
|
-
<div
|
|
5
|
-
class="overlay"
|
|
6
|
-
v-if="active"
|
|
7
|
-
:style="{ height: overlayHeight }"
|
|
8
|
-
@click.self="closeDetails"
|
|
9
|
-
>
|
|
4
|
+
<div class="overlay" v-if="active" @click.self="closeDetails">
|
|
10
5
|
<div ref="detailsEl" class="details-container">
|
|
11
6
|
<div class="details-header">
|
|
12
7
|
<slot name="header"></slot>
|
|
@@ -15,7 +10,7 @@
|
|
|
15
10
|
<span class="m-cgg-icon--cross2"></span>
|
|
16
11
|
</div>
|
|
17
12
|
</div>
|
|
18
|
-
<div class="details-
|
|
13
|
+
<div class="details-body">
|
|
19
14
|
<slot name="body"></slot>
|
|
20
15
|
</div>
|
|
21
16
|
<div class="details-footer" v-if="$slots.footer">
|
|
@@ -28,37 +23,18 @@
|
|
|
28
23
|
</template>
|
|
29
24
|
|
|
30
25
|
<script lang="ts" setup>
|
|
31
|
-
import { ref, watch } from "vue";
|
|
26
|
+
import { ref, watch, computed } from "vue";
|
|
32
27
|
|
|
33
28
|
const active = ref();
|
|
34
29
|
const detailsEl = ref();
|
|
35
|
-
const
|
|
30
|
+
const headerEl = ref();
|
|
31
|
+
const bodyEl = ref();
|
|
32
|
+
const footerEl = ref();
|
|
36
33
|
|
|
37
34
|
watch(active, () => {
|
|
38
35
|
if (active.value) {
|
|
39
36
|
document.body.style.overflow = "hidden";
|
|
40
37
|
document.documentElement.style.overflow = "hidden";
|
|
41
|
-
|
|
42
|
-
if (window.outerWidth >= 992) {
|
|
43
|
-
requestAnimationFrame(() => {
|
|
44
|
-
const pageHeader = document.querySelector(".header") as HTMLElement;
|
|
45
|
-
const appHeader = document.querySelector("#app header") as HTMLElement;
|
|
46
|
-
const comboOffset = appHeader
|
|
47
|
-
? pageHeader.clientHeight + appHeader.clientHeight
|
|
48
|
-
: pageHeader.clientHeight;
|
|
49
|
-
const headerOffset = appHeader?.clientHeight;
|
|
50
|
-
|
|
51
|
-
if (appHeader?.classList.contains("position-fixed")) {
|
|
52
|
-
overlayHeight.value = `calc(100% - ${headerOffset}px)`;
|
|
53
|
-
} else if (window.pageYOffset < comboOffset) {
|
|
54
|
-
overlayHeight.value = `calc(100% - ${
|
|
55
|
-
comboOffset - window.pageYOffset
|
|
56
|
-
}px)`;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
} else {
|
|
60
|
-
overlayHeight.value = "";
|
|
61
|
-
}
|
|
62
38
|
} else {
|
|
63
39
|
document.body.style.overflow = "";
|
|
64
40
|
document.documentElement.style.overflow = "";
|
|
@@ -90,23 +66,31 @@ defineExpose({ openDetails, closeDetails });
|
|
|
90
66
|
}
|
|
91
67
|
|
|
92
68
|
.details-container {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
93
71
|
position: absolute;
|
|
94
72
|
top: 0;
|
|
95
73
|
right: 0;
|
|
96
74
|
background-color: #fff;
|
|
97
|
-
height:
|
|
75
|
+
height: 100%;
|
|
98
76
|
transition: all 0.3s linear;
|
|
99
77
|
|
|
100
78
|
@media screen and (min-width: 992px) {
|
|
101
|
-
|
|
79
|
+
width: 620px;
|
|
102
80
|
}
|
|
103
81
|
|
|
104
82
|
.details-header {
|
|
105
83
|
display: flex;
|
|
106
84
|
justify-content: space-between;
|
|
85
|
+
gap: 15px;
|
|
107
86
|
align-items: center;
|
|
108
87
|
background-color: #fff;
|
|
109
|
-
padding:
|
|
88
|
+
padding: 15px;
|
|
89
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
|
|
90
|
+
|
|
91
|
+
@media screen and (min-width: 992px) {
|
|
92
|
+
padding: 20px 50px;
|
|
93
|
+
}
|
|
110
94
|
|
|
111
95
|
.btn-close {
|
|
112
96
|
display: flex;
|
|
@@ -121,19 +105,24 @@ defineExpose({ openDetails, closeDetails });
|
|
|
121
105
|
}
|
|
122
106
|
}
|
|
123
107
|
|
|
124
|
-
.details-
|
|
108
|
+
.details-body {
|
|
109
|
+
flex-grow: 1;
|
|
125
110
|
position: relative;
|
|
126
|
-
max-height: 100%;
|
|
127
111
|
overflow-y: auto;
|
|
128
|
-
padding:
|
|
112
|
+
padding: 15px 15px 30px;
|
|
129
113
|
|
|
130
114
|
@media screen and (min-width: 992px) {
|
|
131
|
-
|
|
115
|
+
padding: 20px 50px 50px;
|
|
132
116
|
}
|
|
133
117
|
}
|
|
134
118
|
|
|
135
119
|
.details-footer {
|
|
136
|
-
padding:
|
|
120
|
+
padding: 15px;
|
|
121
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
|
|
122
|
+
|
|
123
|
+
@media screen and (min-width: 992px) {
|
|
124
|
+
padding: 20px 50px;
|
|
125
|
+
}
|
|
137
126
|
}
|
|
138
127
|
}
|
|
139
128
|
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-group">
|
|
3
|
+
<InputTitle v-bind="{ title, tooltip }" v-if="title" />
|
|
4
|
+
|
|
5
|
+
<div
|
|
6
|
+
class="input-container"
|
|
7
|
+
:class="{
|
|
8
|
+
error: errorMessage,
|
|
9
|
+
success: fileName && !loading,
|
|
10
|
+
loading: loading,
|
|
11
|
+
}"
|
|
12
|
+
@click="handleInput"
|
|
13
|
+
>
|
|
14
|
+
<span class="input-placeholder">{{
|
|
15
|
+
!loading ? fileName || placeholder : loadingText
|
|
16
|
+
}}</span>
|
|
17
|
+
<div v-if="!loading" class="icon-wrapper">
|
|
18
|
+
<span v-if="!fileName" class="m-cgg-icon--upload"></span>
|
|
19
|
+
<span
|
|
20
|
+
v-if="fileName && !errorMessage"
|
|
21
|
+
class="m-cgg-icon--check-cja"
|
|
22
|
+
></span>
|
|
23
|
+
<span v-if="errorMessage" class="m-cgg-icon--cross-cja"></span>
|
|
24
|
+
<span
|
|
25
|
+
v-if="fileName"
|
|
26
|
+
class="m-cgg-icon--trash"
|
|
27
|
+
@click.stop="$emit('update:delete')"
|
|
28
|
+
></span>
|
|
29
|
+
</div>
|
|
30
|
+
<div v-else class="icon-wrapper">
|
|
31
|
+
<span class="spinner"></span>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<input
|
|
36
|
+
ref="inputElement"
|
|
37
|
+
type="file"
|
|
38
|
+
name="file-input"
|
|
39
|
+
@change="updateFile"
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<p
|
|
43
|
+
class="input-error"
|
|
44
|
+
v-if="(errorMessage || localErrorMessage) && errorDisplay"
|
|
45
|
+
>
|
|
46
|
+
{{ errorMessage || localErrorMessage }}
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script lang="ts" setup>
|
|
52
|
+
import { ref } from "vue";
|
|
53
|
+
import InputTitle from "./InputTitle.vue";
|
|
54
|
+
|
|
55
|
+
const props = withDefaults(
|
|
56
|
+
defineProps<{
|
|
57
|
+
active: Boolean;
|
|
58
|
+
title?: string;
|
|
59
|
+
placeholder?: string;
|
|
60
|
+
loadingText?: string;
|
|
61
|
+
tooltip?: string;
|
|
62
|
+
errorMessage?: string;
|
|
63
|
+
errorDisplay?: boolean;
|
|
64
|
+
validExt?: string[];
|
|
65
|
+
fileName: string;
|
|
66
|
+
fieldName: string;
|
|
67
|
+
fieldUploadDoc: string;
|
|
68
|
+
}>(),
|
|
69
|
+
{
|
|
70
|
+
errorDisplay: true,
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const emit = defineEmits(["update:file", "update:delete"]);
|
|
75
|
+
|
|
76
|
+
const loading = ref(false);
|
|
77
|
+
const localErrorMessage = ref();
|
|
78
|
+
const inputElement = ref();
|
|
79
|
+
|
|
80
|
+
const handleInput = () => {
|
|
81
|
+
if (!props.fileName) {
|
|
82
|
+
inputElement.value.click();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const verifyExtension = (ext: string) => props.validExt?.includes(ext);
|
|
87
|
+
|
|
88
|
+
const updateFile = () => {
|
|
89
|
+
const file = inputElement.value.files[0];
|
|
90
|
+
const ext = file.name.match(new RegExp("[^.]+$"))[0];
|
|
91
|
+
|
|
92
|
+
if (file && (props.validExt ? props.validExt.includes(ext) : true)) {
|
|
93
|
+
localErrorMessage.value = "";
|
|
94
|
+
loading.value = true;
|
|
95
|
+
|
|
96
|
+
const reader = new FileReader();
|
|
97
|
+
reader.addEventListener("load", () => {
|
|
98
|
+
if (reader.result && typeof reader.result == "string") {
|
|
99
|
+
emit("update:file", {
|
|
100
|
+
name: file.name,
|
|
101
|
+
file64: reader.result.replace("data:", "").replace(/^.+,/, ""),
|
|
102
|
+
extension: ext,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
reader.readAsDataURL(file);
|
|
107
|
+
} else {
|
|
108
|
+
emit("update:delete");
|
|
109
|
+
localErrorMessage.value = "Extensão de ficheiro inválida";
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style lang="scss" scoped>
|
|
115
|
+
.input-title {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: row;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
align-items: center;
|
|
120
|
+
font-size: 16px;
|
|
121
|
+
line-height: 18px;
|
|
122
|
+
margin-bottom: 15px;
|
|
123
|
+
font-weight: 400;
|
|
124
|
+
|
|
125
|
+
span.m-cgg-icon--help {
|
|
126
|
+
font-size: 20px;
|
|
127
|
+
color: #312f2e;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.input-container {
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
padding: 0 25px;
|
|
134
|
+
height: 60px;
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: space-between;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: 10px;
|
|
139
|
+
background: #ffffff;
|
|
140
|
+
border: 2px dashed #dedede;
|
|
141
|
+
box-shadow: 0px 4px 18px rgba(0, 0, 0, 0.05);
|
|
142
|
+
border-radius: 4px;
|
|
143
|
+
|
|
144
|
+
&.success {
|
|
145
|
+
cursor: auto;
|
|
146
|
+
border: 2px solid #77aa43;
|
|
147
|
+
|
|
148
|
+
.input-text {
|
|
149
|
+
font-weight: 400;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.loading {
|
|
154
|
+
pointer-events: none;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&.error {
|
|
158
|
+
border: 2px solid #ff533f;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.input-placeholder {
|
|
162
|
+
font-weight: 700;
|
|
163
|
+
font-size: 14px;
|
|
164
|
+
line-height: 15px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.icon-wrapper {
|
|
168
|
+
display: flex;
|
|
169
|
+
flex-direction: row;
|
|
170
|
+
gap: 10px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.spinner {
|
|
174
|
+
width: 10px;
|
|
175
|
+
height: 10px;
|
|
176
|
+
border: 3px solid var(--color-main);
|
|
177
|
+
border-top-color: var(--color-secondary);
|
|
178
|
+
border-radius: 50%;
|
|
179
|
+
animation: spin 1s infinite;
|
|
180
|
+
animation-timing-function: linear;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.m-cgg-icon--upload {
|
|
184
|
+
color: var(--color-main);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.m-cgg-icon--trash {
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
color: var(--color-secondary);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.m-cgg-icon--cross-cja {
|
|
193
|
+
color: #ff533f;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.m-cgg-icon--check-cja {
|
|
197
|
+
color: #77aa43;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
input[type="file"] {
|
|
202
|
+
display: none;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@keyframes spin {
|
|
206
|
+
from {
|
|
207
|
+
transform: rotate(0deg);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
to {
|
|
211
|
+
transform: rotate(360deg);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
</style>
|
|
215
|
+
|
|
216
|
+
<i18n lang="json">
|
|
217
|
+
{
|
|
218
|
+
"en": {
|
|
219
|
+
"loading": "Uploading file...",
|
|
220
|
+
"deleting": "Deleting file...",
|
|
221
|
+
"upload": "Submit file",
|
|
222
|
+
"validation": {
|
|
223
|
+
"invalidExt": "Unsupported file extension"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
</i18n>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="input-title" v-if="title">
|
|
3
|
+
<span>{{ title }}</span>
|
|
4
|
+
<span
|
|
5
|
+
v-if="tooltip"
|
|
6
|
+
class="tooltip m-cgg-icon--help"
|
|
7
|
+
v-tippy="tooltip"
|
|
8
|
+
></span>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
const props = defineProps<{
|
|
14
|
+
title: string;
|
|
15
|
+
tooltip?: string;
|
|
16
|
+
}>();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style lang="scss" scoped>
|
|
20
|
+
.input-title {
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
gap: 10px;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
line-height: 18px;
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
|
|
28
|
+
@media screen and (min-width: 768px) {
|
|
29
|
+
font-size: 16px;
|
|
30
|
+
line-height: 20px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tooltip {
|
|
34
|
+
font-size: 18px;
|
|
35
|
+
color: #076b9c;
|
|
36
|
+
|
|
37
|
+
@media screen and (min-width: 768px) {
|
|
38
|
+
font-size: 20px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-group">
|
|
3
|
+
<div class="input-container" :class="{ active: modelValue }">
|
|
4
|
+
<div class="label">
|
|
5
|
+
{{ label }}
|
|
6
|
+
</div>
|
|
7
|
+
<div class="toggler" @click="$emit('update:modelValue', !modelValue)">
|
|
8
|
+
<div class="toggle"></div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
import { InputHTMLAttributes } from "vue";
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(
|
|
18
|
+
defineProps<{
|
|
19
|
+
disabled?: InputHTMLAttributes["disabled"];
|
|
20
|
+
validation?: any;
|
|
21
|
+
label: string;
|
|
22
|
+
modelValue: boolean;
|
|
23
|
+
error?: string;
|
|
24
|
+
errorDisplay?: boolean;
|
|
25
|
+
}>(),
|
|
26
|
+
{
|
|
27
|
+
disabled: false,
|
|
28
|
+
errorDisplay: true,
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style lang="scss" scoped>
|
|
36
|
+
.input-container {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 10px;
|
|
41
|
+
|
|
42
|
+
.label {
|
|
43
|
+
font-weight: 700;
|
|
44
|
+
font-size: 16px;
|
|
45
|
+
line-height: 18px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.toggler {
|
|
49
|
+
position: relative;
|
|
50
|
+
width: 36px;
|
|
51
|
+
height: 14px;
|
|
52
|
+
border-radius: 7px;
|
|
53
|
+
background-color: #dedcdb;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
transition: all 0.2s ease-in-out;
|
|
56
|
+
|
|
57
|
+
.toggle {
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: -3px;
|
|
60
|
+
left: 0;
|
|
61
|
+
width: 20px;
|
|
62
|
+
height: 20px;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
background-color: #9fabbc;
|
|
65
|
+
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
|
|
66
|
+
transition: all 0.2s ease-in-out;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.active {
|
|
71
|
+
.toggler {
|
|
72
|
+
background-color: #e5f0f5;
|
|
73
|
+
.toggle {
|
|
74
|
+
background-color: #076b9c;
|
|
75
|
+
left: 16px;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="form-group">
|
|
3
|
-
<
|
|
3
|
+
<InputTitle v-bind="{ title, tooltip }" v-if="title" />
|
|
4
4
|
|
|
5
5
|
<div class="input-container" :class="{ error: errorMessage }">
|
|
6
6
|
<input
|
|
7
7
|
ref="inputEl"
|
|
8
8
|
:id="id"
|
|
9
|
-
v-maska
|
|
9
|
+
v-maska
|
|
10
|
+
data-maska="#########"
|
|
10
11
|
:placeholder="placeholder && placeholder"
|
|
11
12
|
type="tel"
|
|
12
13
|
:value="value"
|
|
@@ -26,34 +27,34 @@
|
|
|
26
27
|
<script lang="ts" setup>
|
|
27
28
|
import { useField } from "vee-validate";
|
|
28
29
|
import intlTelInput from "intl-tel-input";
|
|
29
|
-
import { ref, onMounted, watch } from "vue";
|
|
30
|
+
import { ref, onMounted, watch, InputHTMLAttributes } from "vue";
|
|
31
|
+
import { vMaska } from "maska";
|
|
32
|
+
import InputTitle from "./InputTitle.vue";
|
|
33
|
+
|
|
34
|
+
const props = withDefaults(
|
|
35
|
+
defineProps<{
|
|
36
|
+
title?: string;
|
|
37
|
+
tooltip?: string;
|
|
38
|
+
placeholder?: InputHTMLAttributes["placeholder"];
|
|
39
|
+
layout?: "vertical" | "horizontal";
|
|
40
|
+
error?: string;
|
|
41
|
+
validation?: any;
|
|
42
|
+
errorDisplay?: boolean;
|
|
43
|
+
modelValue: InputHTMLAttributes["value"];
|
|
44
|
+
id?: InputHTMLAttributes["id"];
|
|
45
|
+
disabled?: InputHTMLAttributes["disabled"];
|
|
46
|
+
phoneCountryCode: number;
|
|
47
|
+
autocomplete?: InputHTMLAttributes["autocomplete"];
|
|
48
|
+
}>(),
|
|
49
|
+
{
|
|
50
|
+
placeholder: "",
|
|
51
|
+
modelValue: "",
|
|
52
|
+
errorDisplay: true,
|
|
53
|
+
phoneCountryCode: 351,
|
|
54
|
+
}
|
|
55
|
+
);
|
|
30
56
|
|
|
31
57
|
const inputEl = ref();
|
|
32
|
-
const props = defineProps({
|
|
33
|
-
placeholder: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: "",
|
|
36
|
-
},
|
|
37
|
-
title: {
|
|
38
|
-
type: String,
|
|
39
|
-
required: true,
|
|
40
|
-
},
|
|
41
|
-
modelValue: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: "",
|
|
44
|
-
},
|
|
45
|
-
phoneCountryCode: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: "",
|
|
48
|
-
},
|
|
49
|
-
errorDisplay: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: true,
|
|
52
|
-
},
|
|
53
|
-
validation: Object,
|
|
54
|
-
autocomplete: String,
|
|
55
|
-
id: String,
|
|
56
|
-
});
|
|
57
58
|
|
|
58
59
|
const { value, errorMessage, meta, validate, setValue } = useField(
|
|
59
60
|
"input",
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="form-group">
|
|
3
|
-
<
|
|
4
|
-
<span>{{ title }}</span>
|
|
5
|
-
<span v-if="tooltip" class="tooltip" v-tippy="tooltip">?</span>
|
|
6
|
-
</div>
|
|
2
|
+
<div class="form-group" :class="[layout]">
|
|
3
|
+
<InputTitle v-bind="{ title, tooltip }" v-if="title" />
|
|
7
4
|
|
|
8
5
|
<div
|
|
9
6
|
ref="inputEl"
|
|
@@ -70,27 +67,23 @@ import {
|
|
|
70
67
|
watch,
|
|
71
68
|
onMounted,
|
|
72
69
|
onUnmounted,
|
|
73
|
-
|
|
70
|
+
InputHTMLAttributes,
|
|
74
71
|
} from "vue";
|
|
72
|
+
import InputTitle from "./InputTitle.vue";
|
|
73
|
+
import { SelectHTMLAttributes } from "vue";
|
|
75
74
|
import { SelectOption } from "../../types/SelectOption";
|
|
76
75
|
|
|
77
|
-
const open = ref(false);
|
|
78
|
-
const search = ref("");
|
|
79
|
-
const inputEl = ref();
|
|
80
|
-
const collapseEl = ref();
|
|
81
|
-
const collapsePosition = ref();
|
|
82
|
-
const filteredOptions = computed(() =>
|
|
83
|
-
search.value
|
|
84
|
-
? props.options.filter((opt) =>
|
|
85
|
-
opt.label.toLowerCase().includes(search.value.toLowerCase())
|
|
86
|
-
)
|
|
87
|
-
: props.options
|
|
88
|
-
);
|
|
89
|
-
|
|
90
76
|
const props = withDefaults(
|
|
91
77
|
defineProps<{
|
|
92
78
|
title?: string;
|
|
93
|
-
|
|
79
|
+
tooltip?: string;
|
|
80
|
+
placeholder?: InputHTMLAttributes["placeholder"];
|
|
81
|
+
layout?: "vertical" | "horizontal";
|
|
82
|
+
error?: string;
|
|
83
|
+
validation?: any;
|
|
84
|
+
errorDisplay?: boolean;
|
|
85
|
+
id?: InputHTMLAttributes["id"];
|
|
86
|
+
disabled?: InputHTMLAttributes["disabled"];
|
|
94
87
|
modelValue: SelectHTMLAttributes["value"];
|
|
95
88
|
options: SelectOption[];
|
|
96
89
|
multiSelect?: boolean;
|
|
@@ -98,18 +91,28 @@ const props = withDefaults(
|
|
|
98
91
|
placeholder: string;
|
|
99
92
|
noResults: string;
|
|
100
93
|
};
|
|
101
|
-
tooltip?: string;
|
|
102
|
-
errorDisplay?: boolean;
|
|
103
|
-
validation?: any;
|
|
104
|
-
disabled?: boolean;
|
|
105
94
|
}>(),
|
|
106
95
|
{
|
|
96
|
+
layout: "vertical",
|
|
107
97
|
placeholder: "Selecionar",
|
|
108
98
|
disabled: false,
|
|
109
99
|
errorDisplay: true,
|
|
110
100
|
}
|
|
111
101
|
);
|
|
112
102
|
|
|
103
|
+
const open = ref(false);
|
|
104
|
+
const search = ref("");
|
|
105
|
+
const inputEl = ref();
|
|
106
|
+
const collapseEl = ref();
|
|
107
|
+
const collapsePosition = ref();
|
|
108
|
+
const filteredOptions = computed(() =>
|
|
109
|
+
search.value
|
|
110
|
+
? props.options.filter((opt) =>
|
|
111
|
+
opt.label.toLowerCase().includes(search.value.toLowerCase())
|
|
112
|
+
)
|
|
113
|
+
: props.options
|
|
114
|
+
);
|
|
115
|
+
|
|
113
116
|
const { value, errorMessage, meta, validate, setValue } = useField(
|
|
114
117
|
"input",
|
|
115
118
|
props.validation,
|