mitre-form-component 0.0.10 → 0.0.12
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/index.cjs +2 -1054
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -16
- package/dist/index.d.ts +2 -16
- package/dist/index.js +3 -1049
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
@@ -35,1051 +25,9 @@ __export(index_exports, {
|
|
|
35
25
|
module.exports = __toCommonJS(index_exports);
|
|
36
26
|
|
|
37
27
|
// src/components/Form/index.tsx
|
|
38
|
-
var import_react5 = require("react");
|
|
39
|
-
|
|
40
|
-
// src/components/hooks/useError.ts
|
|
41
|
-
var import_react = require("react");
|
|
42
|
-
function useError() {
|
|
43
|
-
const [error, setError] = (0, import_react.useState)(null);
|
|
44
|
-
const handleError = (err) => {
|
|
45
|
-
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
46
|
-
setError(errorObj);
|
|
47
|
-
console.error(errorObj);
|
|
48
|
-
};
|
|
49
|
-
const clearError = () => setError(null);
|
|
50
|
-
return { error, handleError, clearError };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// src/components/Form/index.tsx
|
|
54
|
-
var import_react_hook_form = require("react-hook-form");
|
|
55
|
-
var import_yup = require("@hookform/resolvers/yup");
|
|
56
|
-
var yup = __toESM(require("yup"), 1);
|
|
57
|
-
|
|
58
|
-
// src/components/styles/utils.ts
|
|
59
|
-
function flex(direction = "row", alignItems, justifyContent) {
|
|
60
|
-
return `
|
|
61
|
-
align-items:${alignItems || null};
|
|
62
|
-
display:flex;
|
|
63
|
-
flex-direction:${direction};
|
|
64
|
-
justify-content:${justifyContent || null};
|
|
65
|
-
`;
|
|
66
|
-
}
|
|
67
|
-
var opacityEffect = `
|
|
68
|
-
&:hover {
|
|
69
|
-
cursor:pointer;
|
|
70
|
-
opacity:.9;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&:active {
|
|
74
|
-
opacity:.7;
|
|
75
|
-
}
|
|
76
|
-
`;
|
|
77
|
-
|
|
78
|
-
// src/components/Form/styles.ts
|
|
79
|
-
var import_styled_components = __toESM(require("styled-components"), 1);
|
|
80
|
-
var FormContainer = import_styled_components.default.div`
|
|
81
|
-
${flex("column")}
|
|
82
|
-
align-items: stretch;
|
|
83
|
-
justify-content: flex-start;
|
|
84
|
-
overflow-x: hidden;
|
|
85
|
-
overflow-y: auto;
|
|
86
|
-
|
|
87
|
-
background: ${(props) => props.$backgroundColor || " #cecece"};
|
|
88
|
-
|
|
89
|
-
padding: ${(props) => props.$innerPadding || "1rem"};
|
|
90
|
-
|
|
91
|
-
/* Hide scrollbars for WebKit browsers */
|
|
92
|
-
::-webkit-scrollbar {
|
|
93
|
-
display: none;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/* Hide scrollbars for Firefox */
|
|
97
|
-
scrollbar-width: none;
|
|
98
|
-
|
|
99
|
-
box-sizing: border-box;
|
|
100
|
-
height: 100%;
|
|
101
|
-
`;
|
|
102
|
-
var HeaderContainer = import_styled_components.default.div`
|
|
103
|
-
margin-bottom: 1rem;
|
|
104
|
-
`;
|
|
105
|
-
var ButtonContainer = import_styled_components.default.div`
|
|
106
|
-
display: flex;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
align-items: center;
|
|
109
|
-
justify-content: center;
|
|
110
|
-
width: 100%;
|
|
111
|
-
margin-top: 0.75rem;
|
|
112
|
-
`;
|
|
113
|
-
var Form = import_styled_components.default.form`
|
|
114
|
-
label {
|
|
115
|
-
font-weight: 700;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
input {
|
|
119
|
-
background: white;
|
|
120
|
-
margin-bottom: 0.75rem;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
p {
|
|
124
|
-
font-family: "Montserrat", sans-serif;
|
|
125
|
-
font-style: italic;
|
|
126
|
-
font-weight: 200;
|
|
127
|
-
font-size: 0.8rem;
|
|
128
|
-
color: ${(props) => props.$textColor || "var(--black)"};
|
|
129
|
-
text-align: start;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
a {
|
|
133
|
-
font-family: "Montserrat", sans-serif;
|
|
134
|
-
font-style: italic;
|
|
135
|
-
font-weight: 200;
|
|
136
|
-
font-size: 0.8rem;
|
|
137
|
-
color: ${(props) => props.$textColor || "var(--black)"};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
h6 {
|
|
141
|
-
text-align: start;
|
|
142
|
-
margin-left: 10px;
|
|
143
|
-
color: ${(props) => props.$textColor || "var(--black)"};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
& > div {
|
|
147
|
-
margin-bottom: 10px;,
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
button {
|
|
151
|
-
${opacityEffect}
|
|
152
|
-
color: var(--black);
|
|
153
|
-
font-weight: 600;
|
|
154
|
-
border: none;
|
|
155
|
-
border-radius: 8px;
|
|
156
|
-
width: 60%;
|
|
157
|
-
margin-top: 10px;
|
|
158
|
-
margin-bottom: 10px;
|
|
159
|
-
}
|
|
160
|
-
`;
|
|
161
|
-
var Title = import_styled_components.default.h2`
|
|
162
|
-
font-size: 1.25rem;
|
|
163
|
-
font-weight: 700;
|
|
164
|
-
line-height: 24px;
|
|
165
|
-
letter-spacing: 0em;
|
|
166
|
-
color: ${(props) => props.$textColor || "var(--black)"};
|
|
167
|
-
`;
|
|
168
|
-
var Text = import_styled_components.default.p`
|
|
169
|
-
font-size: 1rem;
|
|
170
|
-
font-weight: 400;
|
|
171
|
-
line-height: 23px;
|
|
172
|
-
letter-spacing: 0em;
|
|
173
|
-
margin-top: 10px;
|
|
174
|
-
color: ${(props) => props.$textColor || "var(--black)"};
|
|
175
|
-
`;
|
|
176
|
-
|
|
177
|
-
// src/components/styles/global.ts
|
|
178
|
-
var import_styled_components2 = require("styled-components");
|
|
179
|
-
var import_react2 = require("react");
|
|
180
|
-
var GlobalStyles = import_styled_components2.createGlobalStyle`
|
|
181
|
-
:root {
|
|
182
|
-
--red: #e52e4d;
|
|
183
|
-
--white: #FFF;
|
|
184
|
-
--black: #2F2F2F;
|
|
185
|
-
--black-2:#1E1E1E;
|
|
186
|
-
--alphaBlack: #000000;
|
|
187
|
-
--black-2:#1E1E1E;
|
|
188
|
-
--black-3:#353535;
|
|
189
|
-
|
|
190
|
-
--yellow-400:#FFD789;
|
|
191
|
-
--yellow-500: #F6C76B;
|
|
192
|
-
--gray-40:#F0F0F0;
|
|
193
|
-
--gray-45:#767676;
|
|
194
|
-
--gray-50: #686A69;
|
|
195
|
-
--gray-60: #8F8F8F;
|
|
196
|
-
--gray-100: #B6B6B6;
|
|
197
|
-
--gray-150: #B9B9B9;
|
|
198
|
-
--gray-200: #D2D2D2;
|
|
199
|
-
--gray-300: #EBEBEB;
|
|
200
|
-
--gray-400: #ECECEC;
|
|
201
|
-
--gray-500: #F4F4F4;
|
|
202
|
-
--gray-550:#6F6F6F;
|
|
203
|
-
--gray-600:#686868;
|
|
204
|
-
--gray-700: #535353;
|
|
205
|
-
--gray-800:#9D9D9D;
|
|
206
|
-
--shadow-500: 0px 4px 8px rgba(91, 91, 91, 0.2);
|
|
207
|
-
--green:#57C06E;
|
|
208
|
-
--green-2:#2DCE68;
|
|
209
|
-
--blue:#007BFF;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
* {
|
|
213
|
-
margin: 0;
|
|
214
|
-
padding: 0;
|
|
215
|
-
box-sizing: border-box;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
html {
|
|
219
|
-
scroll-behavior: smooth;
|
|
220
|
-
|
|
221
|
-
@media (max-width: 1080px) {
|
|
222
|
-
font-size: 93.75%;
|
|
223
|
-
}
|
|
224
|
-
@media (max-width: 720px) {
|
|
225
|
-
font-size: 87.5%;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
body {
|
|
230
|
-
background: var(--white);
|
|
231
|
-
-webkit-font-smoothing: antialiased;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
body, input, textarea, select, button {
|
|
235
|
-
font-family: "Montserrat", sans-serif;
|
|
236
|
-
font-weight: 400;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
h1, h2, h3, h4, h5, h6, strong {
|
|
240
|
-
font-weight: 600;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
button {
|
|
244
|
-
cursor: pointer;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
[disabled] {
|
|
248
|
-
opacity: 0.6;
|
|
249
|
-
cursor: not-allowed;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.hidden {
|
|
253
|
-
overflow: hidden;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
::-webkit-scrollbar {
|
|
257
|
-
-webkit-appearance: none;
|
|
258
|
-
background: var(--gray-500);
|
|
259
|
-
width: 6px;
|
|
260
|
-
height: 10px;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
::-webkit-scrollbar-thumb {
|
|
264
|
-
background-color: var(--gray-50);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
.aligncenter {
|
|
268
|
-
text-align: center;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
.width-190px {
|
|
272
|
-
width:190px;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.hidden-content {
|
|
276
|
-
display:none !important;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.global-margin-bottom {
|
|
280
|
-
margin-bottom:20px;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.background-light-gray {
|
|
284
|
-
background:#F4F4F4;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.full-width-and-height {
|
|
288
|
-
height:100%;
|
|
289
|
-
width:100%;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
.flex-direction-column {
|
|
293
|
-
flex-direction:column;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.bold {
|
|
297
|
-
font-weight:700;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.margin-center-x {
|
|
301
|
-
margin:0 auto;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.border-none {
|
|
305
|
-
border:none;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.text-center {
|
|
309
|
-
text-align:center;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.relative {
|
|
313
|
-
position:relative;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/* accessibility */
|
|
317
|
-
body ._access-menu p._text-center{
|
|
318
|
-
font-family: "Montserrat", sans-serif;
|
|
319
|
-
font-style: italic;
|
|
320
|
-
font-size: 1.2rem!important;
|
|
321
|
-
margin-top: 6px;
|
|
322
|
-
margin-bottom: 3px;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
`;
|
|
326
|
-
var FontLoader = () => {
|
|
327
|
-
(0, import_react2.useEffect)(() => {
|
|
328
|
-
const link = document.createElement("link");
|
|
329
|
-
link.href = "https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap";
|
|
330
|
-
link.rel = "stylesheet";
|
|
331
|
-
document.head.appendChild(link);
|
|
332
|
-
}, []);
|
|
333
|
-
return null;
|
|
334
|
-
};
|
|
335
|
-
var global_default = FontLoader;
|
|
336
|
-
|
|
337
|
-
// src/components/Input/index.tsx
|
|
338
|
-
var import_react3 = require("react");
|
|
339
|
-
|
|
340
|
-
// src/components/Input/masks.ts
|
|
341
|
-
function cep(e) {
|
|
342
|
-
e.currentTarget.maxLength = 9;
|
|
343
|
-
let value = e.currentTarget.value;
|
|
344
|
-
value = value.replace(/\D/g, "");
|
|
345
|
-
value = value.replace(/^(\d{5})(\d)/, "$1-$2");
|
|
346
|
-
e.currentTarget.value = value;
|
|
347
|
-
return e;
|
|
348
|
-
}
|
|
349
|
-
function currency(e) {
|
|
350
|
-
let value = e.currentTarget.value;
|
|
351
|
-
value = value.replace(/\D/g, "");
|
|
352
|
-
value = value.replace(/(\d)(\d{2})$/, "$1,$2");
|
|
353
|
-
value = value.replace(/(?=(\d{3})+(\D))\B/g, ".");
|
|
354
|
-
e.currentTarget.value = value;
|
|
355
|
-
return e;
|
|
356
|
-
}
|
|
357
|
-
function cpf(e) {
|
|
358
|
-
e.currentTarget.maxLength = 14;
|
|
359
|
-
let value = e.currentTarget.value;
|
|
360
|
-
if (!value.match(/^(\d{3}).(\d{3}).(\d{3})-(\d{2})$/)) {
|
|
361
|
-
value = value.replace(/\D/g, "");
|
|
362
|
-
value = value.replace(/(\d{3})(\d)/, "$1.$2");
|
|
363
|
-
value = value.replace(/(\d{3})(\d)/, "$1.$2");
|
|
364
|
-
value = value.replace(/(\d{3})(\d{2})$/, "$1-$2");
|
|
365
|
-
e.currentTarget.value = value;
|
|
366
|
-
}
|
|
367
|
-
return e;
|
|
368
|
-
}
|
|
369
|
-
function date(e) {
|
|
370
|
-
let value = e.currentTarget.value;
|
|
371
|
-
value = value.replace(/\D/g, "");
|
|
372
|
-
value = value.replace(/(\d{2})(\d)/, "$1/$2");
|
|
373
|
-
value = value.replace(/(\d{2})(\d)/, "$1/$2");
|
|
374
|
-
e.currentTarget.value = value;
|
|
375
|
-
return e;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// src/components/Input/index.tsx
|
|
379
|
-
var import_style = require("react-phone-input-2/lib/style.css");
|
|
380
|
-
|
|
381
|
-
// src/components/Input/styles.ts
|
|
382
|
-
var import_styled_components3 = __toESM(require("styled-components"), 1);
|
|
383
|
-
var import_react_phone_input_2 = __toESM(require("react-phone-input-2"), 1);
|
|
384
|
-
var FormLabel = import_styled_components3.default.label`
|
|
385
|
-
font-family: "Montserrat", sans-serif;
|
|
386
|
-
font-style: normal;
|
|
387
|
-
font-weight: 500;
|
|
388
|
-
font-size: 1rem;
|
|
389
|
-
color: ${(props) => props.isInvalid ? "var(--red)" : props.$textColor || "var(--black)"};
|
|
390
|
-
display: block;
|
|
391
|
-
margin-bottom: 0.5rem;
|
|
392
|
-
text-align: left;
|
|
393
|
-
`;
|
|
394
|
-
var Input = import_styled_components3.default.input`
|
|
395
|
-
font-family: "Montserrat", sans-serif;
|
|
396
|
-
font-style: normal;
|
|
397
|
-
font-weight: 500;
|
|
398
|
-
font-size: 1rem;
|
|
399
|
-
line-height: 1.5rem;
|
|
400
|
-
background: var(--gray-500);
|
|
401
|
-
color: var(--black);
|
|
402
|
-
padding: 0.5rem;
|
|
403
|
-
border-radius: 0.125rem;
|
|
404
|
-
border: 1px solid transparent;
|
|
405
|
-
display: block;
|
|
406
|
-
height: 3.125rem;
|
|
407
|
-
width: 100%;
|
|
408
|
-
|
|
409
|
-
&:focus {
|
|
410
|
-
border-radius: 0.125rem;
|
|
411
|
-
border: 2px solid ${(props) => props.$bordercolor || "var(--yellow-500)"};
|
|
412
|
-
outline: none;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
&::placeholder {
|
|
416
|
-
font-size: 1rem;
|
|
417
|
-
line-height: 1.5rem;
|
|
418
|
-
color: #b6b6b6;
|
|
419
|
-
font-weight: 800;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/* Autofill styles */
|
|
423
|
-
&:-webkit-autofill {
|
|
424
|
-
background: var(--gray-500) !important;
|
|
425
|
-
color: var(--black) !important;
|
|
426
|
-
-webkit-text-fill-color: var(--black) !important;
|
|
427
|
-
transition: background-color 5000s ease-in-out 0s; /* Prevent flashing */
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
&:-webkit-autofill::first-line {
|
|
431
|
-
font-family: "Montserrat", sans-serif;
|
|
432
|
-
font-size: 1rem;
|
|
433
|
-
font-weight: 500;
|
|
434
|
-
}
|
|
435
|
-
`;
|
|
436
|
-
var FormPhoneInput = (0, import_styled_components3.default)(import_react_phone_input_2.default)`
|
|
437
|
-
.form-control {
|
|
438
|
-
background: white;
|
|
439
|
-
color: ${(props) => props.isInvalid ? "var(--red)" : props.$textColor || "var(--black)"};
|
|
440
|
-
padding: 0.5rem;
|
|
441
|
-
border-radius: 0.125rem;
|
|
442
|
-
border: 1px solid transparent;
|
|
443
|
-
height: 3.125rem;
|
|
444
|
-
width: 100%;
|
|
445
|
-
padding-left: 4rem;
|
|
446
|
-
font-family: "Montserrat", sans-serif;
|
|
447
|
-
font-style: normal;
|
|
448
|
-
font-weight: 500;
|
|
449
|
-
font-size: 1rem;
|
|
450
|
-
line-height: 1.5rem;
|
|
451
|
-
text &:focus,
|
|
452
|
-
&:focus-within {
|
|
453
|
-
border-radius: 0.125rem;
|
|
454
|
-
border: 2px solid
|
|
455
|
-
${(props) => !props.isValid ? "var(--red)" : props.$bordercolor || "var(--yellow-500)"};
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
&::placeholder {
|
|
459
|
-
font-size: 1rem;
|
|
460
|
-
line-height: 1.5rem;
|
|
461
|
-
color: #b6b6b6;
|
|
462
|
-
font-weight: 800;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/* Autofill styles */
|
|
466
|
-
&:-webkit-autofill {
|
|
467
|
-
background: var(--gray-500) !important;
|
|
468
|
-
color: var(--black) !important;
|
|
469
|
-
-webkit-text-fill-color: var(--black) !important;
|
|
470
|
-
transition: background-color 5000s ease-in-out 0s; /* Prevent flashing */
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
&:-webkit-autofill::first-line {
|
|
474
|
-
font-family: "Montserrat", sans-serif;
|
|
475
|
-
font-size: 1rem;
|
|
476
|
-
font-weight: 500;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
&:focus-within {
|
|
481
|
-
.form-control {
|
|
482
|
-
border: 2px solid
|
|
483
|
-
${(props) => props.isInvalid ? "var(--red)" : props.$bordercolor || "var(--yellow-500)"};
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
.flag-dropdown {
|
|
488
|
-
background: white;
|
|
489
|
-
border: none;
|
|
490
|
-
padding: 0.5rem;
|
|
491
|
-
margin: 0.25rem;
|
|
492
|
-
cursor: pointer;
|
|
493
|
-
|
|
494
|
-
&:focus-within {
|
|
495
|
-
outline: none;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
`;
|
|
499
|
-
var FormErrorMessage = import_styled_components3.default.small`
|
|
500
|
-
font-size: 0.75rem;
|
|
501
|
-
line-height: 1.125rem;
|
|
502
|
-
color: var(--red);
|
|
503
|
-
margin-top: 0.25rem;
|
|
504
|
-
display: block;
|
|
505
|
-
`;
|
|
506
|
-
var FormControl = import_styled_components3.default.div.withConfig({
|
|
507
|
-
shouldForwardProp: (prop) => !["isInvalid", "$bordercolor"].includes(prop)
|
|
508
|
-
})`
|
|
509
|
-
${FormLabel} {
|
|
510
|
-
${(props) => props.isInvalid && import_styled_components3.css`
|
|
511
|
-
color: var(--red);
|
|
512
|
-
`};
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
${Input} {
|
|
516
|
-
${(props) => props.isInvalid && import_styled_components3.css`
|
|
517
|
-
border: 1px solid var(--red);
|
|
518
|
-
|
|
519
|
-
&:not(:focus)::placeholder {
|
|
520
|
-
color: var(--red);
|
|
521
|
-
font-weight: 600;
|
|
522
|
-
}
|
|
523
|
-
`};
|
|
524
|
-
|
|
525
|
-
&:focus {
|
|
526
|
-
${(props) => props.isInvalid && import_styled_components3.css`
|
|
527
|
-
border: 1px solid var(--red);
|
|
528
|
-
`};
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
${FormPhoneInput} {
|
|
533
|
-
${(props) => props.isInvalid && import_styled_components3.css`
|
|
534
|
-
border: 1px solid var(--red);
|
|
535
|
-
|
|
536
|
-
&:not(:focus)::placeholder {
|
|
537
|
-
color: var(--red);
|
|
538
|
-
font-weight: 600;
|
|
539
|
-
}
|
|
540
|
-
`};
|
|
541
|
-
|
|
542
|
-
&:focus {
|
|
543
|
-
${(props) => props.isInvalid && import_styled_components3.css`
|
|
544
|
-
border: 1px solid var(--red);
|
|
545
|
-
`};
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
`;
|
|
549
|
-
|
|
550
|
-
// src/components/Input/index.tsx
|
|
551
28
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
552
|
-
var
|
|
553
|
-
|
|
554
|
-
const { onChange, name } = rest;
|
|
555
|
-
const handleKeyUp = (0, import_react3.useCallback)(
|
|
556
|
-
(e) => {
|
|
557
|
-
if (mask === "cep") cep(e);
|
|
558
|
-
if (mask === "currency") currency(e);
|
|
559
|
-
if (mask === "cpf") cpf(e);
|
|
560
|
-
if (mask === "date") date(e);
|
|
561
|
-
},
|
|
562
|
-
[mask]
|
|
563
|
-
);
|
|
564
|
-
const handlePhoneChange = (0, import_react3.useCallback)((value) => {
|
|
565
|
-
onChange?.({ target: { value, name } });
|
|
566
|
-
if (phoneInputRef.current?.input) {
|
|
567
|
-
phoneInputRef.current.input.value = value;
|
|
568
|
-
}
|
|
569
|
-
}, [onChange, name]);
|
|
570
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormControl, { isInvalid: !!error, children: [
|
|
571
|
-
!!label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormLabel, { htmlFor: id, $textColor: textColor, children: label }),
|
|
572
|
-
!mask ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
573
|
-
Input,
|
|
574
|
-
{
|
|
575
|
-
id,
|
|
576
|
-
ref,
|
|
577
|
-
type,
|
|
578
|
-
$bordercolor: borderColor,
|
|
579
|
-
"aria-invalid": !!error && showErrorMessage ? "true" : "false",
|
|
580
|
-
autoComplete: rest.autoComplete || "on",
|
|
581
|
-
...rest
|
|
582
|
-
}
|
|
583
|
-
) : mask === "phone" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
584
|
-
FormPhoneInput,
|
|
585
|
-
{
|
|
586
|
-
country: "br",
|
|
587
|
-
$bordercolor: borderColor,
|
|
588
|
-
placeholder: rest.placeholder,
|
|
589
|
-
"aria-invalid": !!error && showErrorMessage ? "true" : "false",
|
|
590
|
-
isInvalid: !!error,
|
|
591
|
-
onChange: handlePhoneChange,
|
|
592
|
-
masks: {
|
|
593
|
-
br: "(..) .....-...."
|
|
594
|
-
},
|
|
595
|
-
inputProps: {
|
|
596
|
-
id,
|
|
597
|
-
name: "phone",
|
|
598
|
-
required: true,
|
|
599
|
-
autoFocus: true,
|
|
600
|
-
autoComplete: "tel",
|
|
601
|
-
ref: phoneInputRef
|
|
602
|
-
},
|
|
603
|
-
dropdownStyle: {
|
|
604
|
-
color: textColor
|
|
605
|
-
},
|
|
606
|
-
disableCountryGuess: true,
|
|
607
|
-
disableCountryCode: true,
|
|
608
|
-
value: rest.value
|
|
609
|
-
}
|
|
610
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
611
|
-
Input,
|
|
612
|
-
{
|
|
613
|
-
id,
|
|
614
|
-
ref,
|
|
615
|
-
type,
|
|
616
|
-
$bordercolor: borderColor,
|
|
617
|
-
"aria-invalid": !!error && showErrorMessage ? "true" : "false",
|
|
618
|
-
onKeyUp: handleKeyUp,
|
|
619
|
-
autoComplete: rest.autoComplete || "on",
|
|
620
|
-
...rest
|
|
621
|
-
}
|
|
622
|
-
),
|
|
623
|
-
!!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormErrorMessage, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
|
|
624
|
-
] });
|
|
625
|
-
};
|
|
626
|
-
var Input2 = (0, import_react3.forwardRef)(InputBase);
|
|
627
|
-
|
|
628
|
-
// src/components/Button/styles.ts
|
|
629
|
-
var import_polished = require("polished");
|
|
630
|
-
var import_styled_components4 = __toESM(require("styled-components"), 1);
|
|
631
|
-
var Icon = import_styled_components4.default.span`
|
|
632
|
-
font-size: 0;
|
|
633
|
-
line-height: 0;
|
|
634
|
-
transition: all 0.25s ease;
|
|
635
|
-
|
|
636
|
-
transform: translate3d(-30px, 0px, 0px);
|
|
637
|
-
visibility: hidden;
|
|
638
|
-
opacity: 0;
|
|
639
|
-
margin-right: 0.625rem;
|
|
640
|
-
`;
|
|
641
|
-
var Text2 = import_styled_components4.default.span`
|
|
642
|
-
font-family: "Montserrat", sans-serif;
|
|
643
|
-
font-size: 1rem;
|
|
644
|
-
line-height: 1.5rem;
|
|
645
|
-
margin-bottom: -2px;
|
|
646
|
-
|
|
647
|
-
transition: all 0.25s ease;
|
|
648
|
-
`;
|
|
649
|
-
var TextSubmitting = import_styled_components4.default.span`
|
|
650
|
-
font-family: "Montserrat", sans-serif;
|
|
651
|
-
font-weight: 400;
|
|
652
|
-
font-size: 1rem;
|
|
653
|
-
|
|
654
|
-
transition: all 0.25s ease;
|
|
655
|
-
`;
|
|
656
|
-
var LoadingIcon = import_styled_components4.default.span.withConfig({
|
|
657
|
-
shouldForwardProp: (prop) => prop !== "hasText"
|
|
658
|
-
})`
|
|
659
|
-
display: block;
|
|
660
|
-
|
|
661
|
-
width: 1rem;
|
|
662
|
-
height: 1rem;
|
|
663
|
-
border: 0.125rem solid var(--white);
|
|
664
|
-
border-radius: 50%;
|
|
665
|
-
animation: loadingAnimation 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
|
666
|
-
border-color: var(--white) transparent transparent transparent;
|
|
667
|
-
|
|
668
|
-
margin-right: ${(props) => props.hasText ? "0.625rem" : "0"};
|
|
669
|
-
|
|
670
|
-
@keyframes loadingAnimation {
|
|
671
|
-
0% {
|
|
672
|
-
transform: rotate(0deg);
|
|
673
|
-
}
|
|
674
|
-
100% {
|
|
675
|
-
transform: rotate(360deg);
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
`;
|
|
679
|
-
var Button = import_styled_components4.default.button.withConfig({
|
|
680
|
-
shouldForwardProp: (prop) => ![
|
|
681
|
-
"hasIcon",
|
|
682
|
-
"isSubmitting",
|
|
683
|
-
"hasSubmittingMessage",
|
|
684
|
-
"bgColor",
|
|
685
|
-
"bordercolor",
|
|
686
|
-
"color",
|
|
687
|
-
"height"
|
|
688
|
-
].includes(prop)
|
|
689
|
-
})`
|
|
690
|
-
background: ${(props) => (0, import_polished.darken)(0.1, props?.bgColor || "#F6C76B")};
|
|
691
|
-
color: ${(props) => props?.color || "#2F2F2F"};
|
|
692
|
-
border: 1px solid ${(props) => (0, import_polished.darken)(0.1, props?.bordercolor || "#F6C76B")};
|
|
693
|
-
border-radius: 2px;
|
|
694
|
-
|
|
695
|
-
display: inline-flex;
|
|
696
|
-
align-items: center;
|
|
697
|
-
justify-content: center;
|
|
698
|
-
padding: 0 0.75rem;
|
|
699
|
-
height: ${(props) => props?.height || "3.125rem"};
|
|
700
|
-
position: relative;
|
|
701
|
-
font-size: 0;
|
|
702
|
-
line-height: 0;
|
|
703
|
-
|
|
704
|
-
transition: all 0.25s;
|
|
705
|
-
|
|
706
|
-
${Icon} {
|
|
707
|
-
display: ${(props) => props?.hasIcon ? "block" : ""};
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
${Text2} {
|
|
711
|
-
transform: ${(props) => props?.hasIcon ? "translate3d(-4.5px, 0px, 0px)" : "unset"};
|
|
712
|
-
|
|
713
|
-
@media print, screen and (min-width: 40em) {
|
|
714
|
-
transform: ${(props) => props?.hasIcon ? "translate3d(-14.5px, 0px, 0px)" : "unset"};
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
color: ${(props) => props?.color || "#2F2F2F"};
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
&:hover {
|
|
721
|
-
background: ${(props) => (0, import_polished.darken)(0.2, props?.bgColor || "#F6C76B")};
|
|
722
|
-
border-color: ${(props) => (0, import_polished.darken)(0.2, props?.bordercolor || "#F6C76B")};
|
|
723
|
-
|
|
724
|
-
${Icon} {
|
|
725
|
-
opacity: 1;
|
|
726
|
-
visibility: visible;
|
|
727
|
-
transform: translate3d(0px, 0px, 0px);
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
${Text2} {
|
|
731
|
-
transform: ${(props) => props?.hasIcon ? "translate3d(-5px, 0px, 0px)" : "unset"};
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
${Text2} {
|
|
736
|
-
${(props) => props.isSubmitting && !props.hasSubmittingMessage && import_styled_components4.css`
|
|
737
|
-
transform: unset;
|
|
738
|
-
opacity: 0;
|
|
739
|
-
`}
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
${LoadingIcon} {
|
|
743
|
-
${(props) => props.isSubmitting && !props.hasSubmittingMessage && import_styled_components4.css`
|
|
744
|
-
display: flex;
|
|
745
|
-
-webkit-box-align: center;
|
|
746
|
-
align-items: center;
|
|
747
|
-
position: absolute;
|
|
748
|
-
`}
|
|
749
|
-
}
|
|
750
|
-
`;
|
|
751
|
-
|
|
752
|
-
// src/components/Button/index.tsx
|
|
753
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
754
|
-
function Button2({
|
|
755
|
-
children,
|
|
756
|
-
icon,
|
|
757
|
-
isSubmitting = false,
|
|
758
|
-
submittingMessage = "",
|
|
759
|
-
disabled = false,
|
|
760
|
-
color = "#2F2F2F",
|
|
761
|
-
...rest
|
|
762
|
-
}) {
|
|
763
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
764
|
-
Button,
|
|
765
|
-
{
|
|
766
|
-
isSubmitting,
|
|
767
|
-
hasSubmittingMessage: submittingMessage.length > 0,
|
|
768
|
-
disabled: isSubmitting || disabled,
|
|
769
|
-
"aria-disabled": isSubmitting || disabled,
|
|
770
|
-
hasIcon: !!icon,
|
|
771
|
-
color,
|
|
772
|
-
...rest,
|
|
773
|
-
children: [
|
|
774
|
-
icon && !isSubmitting && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { "data-testid": "button-icon", children: icon }),
|
|
775
|
-
isSubmitting && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingIcon, { hasText: submittingMessage.length > 0 }),
|
|
776
|
-
(!isSubmitting || submittingMessage.length === 0) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text2, { className: "text", children }),
|
|
777
|
-
isSubmitting && submittingMessage.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextSubmitting, { children: submittingMessage })
|
|
778
|
-
]
|
|
779
|
-
}
|
|
780
|
-
);
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
// src/components/Alert/index.tsx
|
|
784
|
-
var import_react4 = require("react");
|
|
785
|
-
|
|
786
|
-
// src/components/Alert/styles.ts
|
|
787
|
-
var import_styled_components5 = __toESM(require("styled-components"), 1);
|
|
788
|
-
var fadeIn = import_styled_components5.keyframes`
|
|
789
|
-
from { opacity: 0; transform: translateY(-10px); }
|
|
790
|
-
to { opacity: 1; transform: translateY(0); }
|
|
791
|
-
`;
|
|
792
|
-
var fadeOut = import_styled_components5.keyframes`
|
|
793
|
-
from { opacity: 1; transform: translateY(0); }
|
|
794
|
-
to { opacity: 0; transform: translateY(-10px); }
|
|
795
|
-
`;
|
|
796
|
-
var typeStyles = {
|
|
797
|
-
error: import_styled_components5.css`
|
|
798
|
-
background-color: var(--red);
|
|
799
|
-
border: 1px solid var(--red);
|
|
800
|
-
color: var(--white);
|
|
801
|
-
svg {
|
|
802
|
-
color: var(--white);
|
|
803
|
-
}
|
|
804
|
-
`,
|
|
805
|
-
warning: import_styled_components5.css`
|
|
806
|
-
background-color: var(--yellow-500);
|
|
807
|
-
border: 1px solid var(--yellow-400);
|
|
808
|
-
color: var(--black);
|
|
809
|
-
svg {
|
|
810
|
-
color: var(--black);
|
|
811
|
-
}
|
|
812
|
-
`,
|
|
813
|
-
info: import_styled_components5.css`
|
|
814
|
-
background-color: var(--blue);
|
|
815
|
-
border: 1px solid var(--blue);
|
|
816
|
-
color: var(--white);
|
|
817
|
-
svg {
|
|
818
|
-
color: var(--white);
|
|
819
|
-
}
|
|
820
|
-
`,
|
|
821
|
-
success: import_styled_components5.css`
|
|
822
|
-
background-color: var(--green);
|
|
823
|
-
border: 1px solid var(--green-2);
|
|
824
|
-
color: var(--white);
|
|
825
|
-
svg {
|
|
826
|
-
color: var(--white);
|
|
827
|
-
}
|
|
828
|
-
`
|
|
829
|
-
};
|
|
830
|
-
var AlertContainer = import_styled_components5.default.div`
|
|
831
|
-
position: fixed;
|
|
832
|
-
width: 500px;
|
|
833
|
-
top: 15px;
|
|
834
|
-
right: 15px;
|
|
835
|
-
padding: 1rem ${({ $dismissible }) => $dismissible ? "2.5rem" : "1rem"} 1rem
|
|
836
|
-
1rem;
|
|
837
|
-
margin-bottom: 1rem;
|
|
838
|
-
animation: ${({ $isClosing }) => $isClosing ? fadeOut : fadeIn} 0.3s
|
|
839
|
-
ease-out;
|
|
840
|
-
animation-fill-mode: forwards;
|
|
841
|
-
align-items: center;
|
|
842
|
-
gap: 0.5rem;
|
|
843
|
-
box-shadow: var(--shadow-500);
|
|
844
|
-
border-radius: 0.5rem;
|
|
845
|
-
font-size: 1rem;
|
|
846
|
-
font-weight: 500;
|
|
847
|
-
|
|
848
|
-
${({ $type }) => typeStyles[$type]}
|
|
849
|
-
`;
|
|
850
|
-
var DismissButton = import_styled_components5.default.button`
|
|
851
|
-
position: absolute;
|
|
852
|
-
background: transparent;
|
|
853
|
-
right: 10px;
|
|
854
|
-
border: none;
|
|
855
|
-
cursor: pointer;
|
|
856
|
-
color: inherit;
|
|
857
|
-
opacity: 1;
|
|
858
|
-
transition: opacity 0.2s;
|
|
859
|
-
|
|
860
|
-
&:hover {
|
|
861
|
-
opacity: 0.7;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
svg {
|
|
865
|
-
width: 1rem;
|
|
866
|
-
height: 1rem;
|
|
867
|
-
}
|
|
868
|
-
`;
|
|
869
|
-
|
|
870
|
-
// src/components/Alert/index.tsx
|
|
871
|
-
var import_hi = require("react-icons/hi");
|
|
872
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
873
|
-
var Alert = ({
|
|
874
|
-
type = "info",
|
|
875
|
-
children,
|
|
876
|
-
className,
|
|
877
|
-
dismissible = false,
|
|
878
|
-
onDismiss,
|
|
879
|
-
autoDismiss
|
|
880
|
-
}) => {
|
|
881
|
-
const [isClosing, setIsClosing] = (0, import_react4.useState)(false);
|
|
882
|
-
const handleDismiss = (0, import_react4.useCallback)(() => {
|
|
883
|
-
setIsClosing(true);
|
|
884
|
-
setTimeout(() => onDismiss?.(), 300);
|
|
885
|
-
}, [onDismiss]);
|
|
886
|
-
(0, import_react4.useEffect)(() => {
|
|
887
|
-
if (autoDismiss) {
|
|
888
|
-
const timer = setTimeout(handleDismiss, autoDismiss);
|
|
889
|
-
return () => clearTimeout(timer);
|
|
890
|
-
}
|
|
891
|
-
}, [autoDismiss, handleDismiss]);
|
|
892
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
893
|
-
AlertContainer,
|
|
894
|
-
{
|
|
895
|
-
$type: type,
|
|
896
|
-
$dismissible: dismissible,
|
|
897
|
-
$isClosing: isClosing,
|
|
898
|
-
className,
|
|
899
|
-
role: "alert",
|
|
900
|
-
children: [
|
|
901
|
-
children,
|
|
902
|
-
dismissible && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
903
|
-
DismissButton,
|
|
904
|
-
{
|
|
905
|
-
onClick: handleDismiss,
|
|
906
|
-
"aria-label": "Dismiss alert",
|
|
907
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_hi.HiX, {})
|
|
908
|
-
}
|
|
909
|
-
)
|
|
910
|
-
]
|
|
911
|
-
}
|
|
912
|
-
);
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
// src/components/Form/index.tsx
|
|
916
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
917
|
-
var schema = yup.object().shape({
|
|
918
|
-
name: yup.string().required("Nome \xE9 obrigat\xF3rio"),
|
|
919
|
-
email: yup.string().required("Email \xE9 obrigat\xF3rio").email("Email inv\xE1lido"),
|
|
920
|
-
phone: yup.string().required("Telefone \xE9 obrigat\xF3rio").test(
|
|
921
|
-
"min-digits",
|
|
922
|
-
"N\xFAmero de telefone inv\xE1lido!",
|
|
923
|
-
(value) => {
|
|
924
|
-
const digitsOnly = value?.replace(/\D/g, "") || "";
|
|
925
|
-
return digitsOnly.length >= 8;
|
|
926
|
-
}
|
|
927
|
-
)
|
|
928
|
-
});
|
|
929
|
-
var MitreFormComponent = ({
|
|
930
|
-
productId,
|
|
931
|
-
apiUrl,
|
|
932
|
-
apiToken,
|
|
933
|
-
utm_source,
|
|
934
|
-
utm_medium,
|
|
935
|
-
utm_campaign,
|
|
936
|
-
utm_term,
|
|
937
|
-
showHeader = true,
|
|
938
|
-
colorPrimary = "#000",
|
|
939
|
-
textColor = "#000",
|
|
940
|
-
backgroundColor = "#fff",
|
|
941
|
-
innerPadding = "20px"
|
|
942
|
-
}) => {
|
|
943
|
-
const [loading, setIsLoading] = (0, import_react5.useState)(false);
|
|
944
|
-
const { error, handleError, clearError } = useError();
|
|
945
|
-
const [successMessage, setSuccessMessage] = (0, import_react5.useState)("");
|
|
946
|
-
const { register, handleSubmit, formState: { errors }, reset, watch } = (0, import_react_hook_form.useForm)({
|
|
947
|
-
resolver: (0, import_yup.yupResolver)(schema)
|
|
948
|
-
});
|
|
949
|
-
const phoneValue = watch("phone");
|
|
950
|
-
const sendMessage = async (data) => {
|
|
951
|
-
const { name, email, phone } = data;
|
|
952
|
-
const message = "Gostaria de mais informa\xE7\xF5es sobre o produto";
|
|
953
|
-
try {
|
|
954
|
-
setIsLoading(true);
|
|
955
|
-
if (!productId || !utm_source || !utm_medium || !utm_campaign || !utm_term || !apiToken) {
|
|
956
|
-
throw new Error("Par\xE2metros obrigat\xF3rios n\xE3o informados");
|
|
957
|
-
}
|
|
958
|
-
const response = await fetch(`${apiUrl}/leads`, {
|
|
959
|
-
method: "POST",
|
|
960
|
-
headers: {
|
|
961
|
-
"Content-Type": "application/json",
|
|
962
|
-
Authorization: `Basic ${apiToken}`
|
|
963
|
-
},
|
|
964
|
-
body: JSON.stringify({
|
|
965
|
-
name,
|
|
966
|
-
email,
|
|
967
|
-
phone,
|
|
968
|
-
message,
|
|
969
|
-
productId,
|
|
970
|
-
utm_source,
|
|
971
|
-
utm_medium,
|
|
972
|
-
utm_campaign,
|
|
973
|
-
utm_term
|
|
974
|
-
})
|
|
975
|
-
});
|
|
976
|
-
if (!response.ok) {
|
|
977
|
-
throw new Error("Falha ao enviar a mensagem!");
|
|
978
|
-
}
|
|
979
|
-
setSuccessMessage("Mensagem enviada com sucesso!");
|
|
980
|
-
reset();
|
|
981
|
-
} catch (err) {
|
|
982
|
-
handleError(err);
|
|
983
|
-
} finally {
|
|
984
|
-
setIsLoading(false);
|
|
985
|
-
}
|
|
986
|
-
};
|
|
987
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
988
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(global_default, {}),
|
|
989
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GlobalStyles, {}),
|
|
990
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
991
|
-
Alert,
|
|
992
|
-
{
|
|
993
|
-
type: "error",
|
|
994
|
-
dismissible: true,
|
|
995
|
-
onDismiss: clearError,
|
|
996
|
-
autoDismiss: 5e3,
|
|
997
|
-
children: error.message
|
|
998
|
-
}
|
|
999
|
-
),
|
|
1000
|
-
successMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1001
|
-
Alert,
|
|
1002
|
-
{
|
|
1003
|
-
type: "success",
|
|
1004
|
-
dismissible: true,
|
|
1005
|
-
onDismiss: () => setSuccessMessage(""),
|
|
1006
|
-
autoDismiss: 5e3,
|
|
1007
|
-
children: successMessage
|
|
1008
|
-
}
|
|
1009
|
-
),
|
|
1010
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(FormContainer, { $backgroundColor: backgroundColor, $innerPadding: innerPadding, children: [
|
|
1011
|
-
showHeader && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(HeaderContainer, { children: [
|
|
1012
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Title, { $textColor: textColor, children: "Atendimento por mensagem" }),
|
|
1013
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { $textColor: textColor, children: "Informe seus dados e retornaremos a mensagem." })
|
|
1014
|
-
] }),
|
|
1015
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Form, { $textColor: textColor, onSubmit: handleSubmit(sendMessage), noValidate: true, children: [
|
|
1016
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1017
|
-
Input2,
|
|
1018
|
-
{
|
|
1019
|
-
id: "name",
|
|
1020
|
-
label: "Nome *",
|
|
1021
|
-
placeholder: "Digite seu nome",
|
|
1022
|
-
...register("name"),
|
|
1023
|
-
borderColor: colorPrimary,
|
|
1024
|
-
textColor,
|
|
1025
|
-
error: errors.name?.message,
|
|
1026
|
-
autoComplete: "name",
|
|
1027
|
-
required: true
|
|
1028
|
-
}
|
|
1029
|
-
),
|
|
1030
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1031
|
-
Input2,
|
|
1032
|
-
{
|
|
1033
|
-
id: "email",
|
|
1034
|
-
label: "Email *",
|
|
1035
|
-
type: "email",
|
|
1036
|
-
placeholder: "exemplo@email.com",
|
|
1037
|
-
...register("email"),
|
|
1038
|
-
borderColor: colorPrimary,
|
|
1039
|
-
textColor,
|
|
1040
|
-
error: errors.email?.message,
|
|
1041
|
-
autoComplete: "email",
|
|
1042
|
-
required: true
|
|
1043
|
-
}
|
|
1044
|
-
),
|
|
1045
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1046
|
-
Input2,
|
|
1047
|
-
{
|
|
1048
|
-
id: "phone",
|
|
1049
|
-
label: "Telefone *",
|
|
1050
|
-
placeholder: "(11) 00000-0000",
|
|
1051
|
-
mask: "phone",
|
|
1052
|
-
...register("phone"),
|
|
1053
|
-
borderColor: colorPrimary,
|
|
1054
|
-
textColor,
|
|
1055
|
-
error: errors.phone?.message,
|
|
1056
|
-
required: true,
|
|
1057
|
-
value: phoneValue
|
|
1058
|
-
}
|
|
1059
|
-
),
|
|
1060
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h6", { children: "* Campos de preenchimento obrigat\xF3rio." }),
|
|
1061
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ButtonContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button2, { bgColor: colorPrimary, color: textColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
|
|
1062
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
|
|
1063
|
-
"A Mitre Realty respeita a sua privacidade e utiliza os seus dados pessoais para contat\xE1-lo por e-mail ou telefone aqui registrados. Para saber mais, acesse a nossa",
|
|
1064
|
-
" ",
|
|
1065
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1066
|
-
"a",
|
|
1067
|
-
{
|
|
1068
|
-
href: "https://www.mitrerealty.com.br/politica-de-privacidade",
|
|
1069
|
-
target: "_blank",
|
|
1070
|
-
rel: "noopener noreferrer",
|
|
1071
|
-
children: "Pol\xEDtica de Privacidade"
|
|
1072
|
-
}
|
|
1073
|
-
),
|
|
1074
|
-
". Ao clicar em ",
|
|
1075
|
-
'"',
|
|
1076
|
-
"enviar",
|
|
1077
|
-
'"',
|
|
1078
|
-
", voc\xEA concorda em permitir que a Mitre Realty, armazene e processe os dados pessoais fornecidos por voc\xEA para finalidade informada"
|
|
1079
|
-
] })
|
|
1080
|
-
] })
|
|
1081
|
-
] })
|
|
1082
|
-
] });
|
|
29
|
+
var MitreFormComponent = () => {
|
|
30
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "10px", background: "red" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { children: "Teste" }) }) });
|
|
1083
31
|
};
|
|
1084
32
|
MitreFormComponent.displayName = "MitreFormComponent";
|
|
1085
33
|
var Form_default = MitreFormComponent;
|