mitre-form-component 0.0.49 → 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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/components/Form/index.tsx
2
- import React3, { useState as useState3 } from "react";
2
+ import React2, { useState as useState3 } from "react";
3
3
 
4
4
  // src/components/hooks/useError.ts
5
5
  import { useState } from "react";
@@ -130,6 +130,53 @@ var opacityEffect = `
130
130
 
131
131
  // src/components/Form/styles.ts
132
132
  import styled from "styled-components";
133
+
134
+ // src/components/styles/theme.ts
135
+ var theme = {
136
+ colors: {
137
+ // Cores principais
138
+ red: "#e52e4d",
139
+ white: "#FFF",
140
+ black: "#2F2F2F",
141
+ black2: "#1E1E1E",
142
+ black3: "#353535",
143
+ alphaBlack: "#000000",
144
+ // Amarelos
145
+ yellow400: "#FFD789",
146
+ yellow500: "#F6C76B",
147
+ // Cinzas
148
+ gray40: "#F0F0F0",
149
+ gray45: "#767676",
150
+ gray50: "#686A69",
151
+ gray60: "#8F8F8F",
152
+ gray100: "#B6B6B6",
153
+ gray150: "#B9B9B9",
154
+ gray180: "#CECECE",
155
+ gray200: "#D2D2D2",
156
+ gray300: "#EBEBEB",
157
+ gray400: "#ECECEC",
158
+ gray500: "#F4F4F4",
159
+ gray550: "#6F6F6F",
160
+ gray600: "#686868",
161
+ gray700: "#535353",
162
+ gray800: "#9D9D9D",
163
+ // Verdes
164
+ green: "#57C06E",
165
+ green2: "#2DCE68",
166
+ // Azul
167
+ blue: "#007BFF",
168
+ // Transparente
169
+ transparent: "transparent"
170
+ },
171
+ shadows: {
172
+ shadow500: "0px 4px 8px rgba(91, 91, 91, 0.2)"
173
+ },
174
+ fonts: {
175
+ primary: '"Montserrat", sans-serif'
176
+ }
177
+ };
178
+
179
+ // src/components/Form/styles.ts
133
180
  var FormContainer = styled.div`
134
181
  ${flex("column")}
135
182
  align-items: stretch;
@@ -137,7 +184,7 @@ var FormContainer = styled.div`
137
184
  overflow-x: hidden;
138
185
  overflow-y: auto;
139
186
 
140
- background: ${(props) => props.$backgroundColor || "var(--gray-180)"};
187
+ background: ${(props) => props.$backgroundColor || theme.colors.gray180};
141
188
 
142
189
  padding: ${(props) => props.$innerPadding || "1rem"};
143
190
 
@@ -165,7 +212,7 @@ var ButtonContainer = styled.div`
165
212
 
166
213
  button {
167
214
  ${opacityEffect}
168
- color: var(--black);
215
+ color: ${theme.colors.black};
169
216
  font-weight: 600;
170
217
  border: none;
171
218
  border-radius: 8px;
@@ -184,26 +231,26 @@ var Form = styled.form`
184
231
  }
185
232
 
186
233
  p {
187
- font-family: "Montserrat", sans-serif;
234
+ font-family: ${theme.fonts.primary};
188
235
  font-style: italic;
189
236
  font-weight: 200;
190
237
  font-size: 0.8rem;
191
- color: ${(props) => props.$textColor || "var(--black)"};
238
+ color: ${(props) => props.$textColor || theme.colors.black};
192
239
  text-align: start;
193
240
  }
194
241
 
195
242
  a {
196
- font-family: "Montserrat", sans-serif;
243
+ font-family: ${theme.fonts.primary};
197
244
  font-style: italic;
198
245
  font-weight: 200;
199
246
  font-size: 0.8rem;
200
- color: ${(props) => props.$textColor || "var(--black)"};
247
+ color: ${(props) => props.$textColor || theme.colors.black};
201
248
  }
202
249
 
203
250
  h6 {
204
251
  text-align: start;
205
252
  margin-left: 10px;
206
- color: ${(props) => props.$textColor || "var(--black)"};
253
+ color: ${(props) => props.$textColor || theme.colors.black};
207
254
  }
208
255
 
209
256
  & > div {
@@ -215,88 +262,36 @@ var Title = styled.h2`
215
262
  font-weight: 700;
216
263
  line-height: 24px;
217
264
  letter-spacing: 0em;
218
- color: ${(props) => props.$textColor || "var(--black)"};
265
+ color: ${(props) => props.$textColor || theme.colors.black};
219
266
  `;
220
- var Text = styled.p`
267
+ var Subtitle = styled.p`
221
268
  font-size: 1rem;
222
269
  font-weight: 400;
223
270
  line-height: 23px;
224
271
  letter-spacing: 0em;
225
272
  margin-top: 10px;
226
- color: ${(props) => props.$textColor || "var(--black)"};
273
+ color: ${(props) => props.$textColor || theme.colors.black};
227
274
  `;
228
275
 
229
- // src/components/styles/global.ts
230
- import { createGlobalStyle } from "styled-components";
231
- import { useEffect } from "react";
232
- var GlobalStyles = createGlobalStyle`
233
- :root {
234
- --red: #e52e4d;
235
- --white: #FFF;
236
- --black: #2F2F2F;
237
- --black-2:#1E1E1E;
238
- --alphaBlack: #000000;
239
- --black-2:#1E1E1E;
240
- --black-3:#353535;
241
-
242
- --yellow-400:#FFD789;
243
- --yellow-500: #F6C76B;
244
- --gray-40:#F0F0F0;
245
- --gray-45:#767676;
246
- --gray-50: #686A69;
247
- --gray-60: #8F8F8F;
248
- --gray-100: #B6B6B6;
249
- --gray-150: #B9B9B9;
250
- --gray-180: #CECECE;
251
- --gray-200: #D2D2D2;
252
- --gray-300: #EBEBEB;
253
- --gray-400: #ECECEC;
254
- --gray-500: #F4F4F4;
255
- --gray-550:#6F6F6F;
256
- --gray-600:#686868;
257
- --gray-700: #535353;
258
- --gray-800:#9D9D9D;
259
- --shadow-500: 0px 4px 8px rgba(91, 91, 91, 0.2);
260
- --green:#57C06E;
261
- --green-2:#2DCE68;
262
- --blue:#007BFF;
263
-
264
- --transparent: transparent;
265
- }
266
-
276
+ // src/components/styles/ComponentWrapper.tsx
277
+ import styled2 from "styled-components";
278
+ var ComponentWrapper = styled2.div`
279
+ /* Reset CSS scoped apenas ao componente */
267
280
  * {
268
- margin: 0;
269
- padding: 0;
270
281
  box-sizing: border-box;
271
282
  }
272
-
273
- html {
274
- scroll-behavior: smooth;
275
-
276
- @media (max-width: 1080px) {
277
- font-size: 93.75%;
278
- }
279
- @media (max-width: 720px) {
280
- font-size: 87.5%;
281
- }
282
- }
283
-
284
- body {
285
- background: var(--white);
286
- -webkit-font-smoothing: antialiased;
287
- }
288
-
289
- body, input, textarea, select, button {
290
- font-family: "Montserrat", sans-serif;
291
- font-weight: 400;
292
- }
293
-
294
- h1, h2, h3, h4, h5, h6, strong {
295
- font-weight: 600;
296
- }
297
-
283
+
284
+ /* Fonte aplicada apenas ao componente */
285
+ font-family: ${theme.fonts.primary};
286
+
287
+ /* Estilos necessários apenas neste escopo */
298
288
  button {
299
289
  cursor: pointer;
290
+ font-family: ${theme.fonts.primary};
291
+ }
292
+
293
+ input, textarea, select {
294
+ font-family: ${theme.fonts.primary};
300
295
  }
301
296
 
302
297
  [disabled] {
@@ -304,90 +299,42 @@ var GlobalStyles = createGlobalStyle`
304
299
  cursor: not-allowed;
305
300
  }
306
301
 
307
- .hidden {
308
- overflow: hidden;
309
- }
310
-
302
+ /* Scrollbar customizada apenas para este componente */
311
303
  ::-webkit-scrollbar {
312
304
  -webkit-appearance: none;
313
- background: var(--gray-500);
305
+ background: ${theme.colors.gray500};
314
306
  width: 6px;
315
307
  height: 10px;
316
308
  }
317
309
 
318
310
  ::-webkit-scrollbar-thumb {
319
- background-color: var(--gray-50);
320
- }
321
-
322
- .aligncenter {
323
- text-align: center;
324
- }
325
-
326
- .width-190px {
327
- width:190px;
328
- }
329
-
330
- .hidden-content {
331
- display:none !important;
332
- }
333
-
334
- .global-margin-bottom {
335
- margin-bottom:20px;
336
- }
337
-
338
- .background-light-gray {
339
- background:#F4F4F4;
340
- }
341
-
342
- .full-width-and-height {
343
- height:100%;
344
- width:100%;
345
- }
346
-
347
- .flex-direction-column {
348
- flex-direction:column;
349
- }
350
-
351
- .bold {
352
- font-weight:700;
311
+ background-color: ${theme.colors.gray50};
353
312
  }
354
-
355
- .margin-center-x {
356
- margin:0 auto;
357
- }
358
-
359
- .border-none {
360
- border:none;
361
- }
362
-
363
- .text-center {
364
- text-align:center;
365
- }
366
-
367
- .relative {
368
- position:relative;
369
- }
370
-
371
- /* accessibility */
372
- body ._access-menu p._text-center{
373
- font-family: "Montserrat", sans-serif;
374
- font-style: italic;
375
- font-size: 1.2rem!important;
376
- margin-top: 6px;
377
- margin-bottom: 3px;
378
- }
379
-
380
313
  `;
381
- var FontLoader = () => {
314
+
315
+ // src/components/styles/FontLoader.tsx
316
+ import { useEffect } from "react";
317
+ var useMontserratFont = () => {
382
318
  useEffect(() => {
383
- const link = document.createElement("link");
384
- link.href = "https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap";
385
- link.rel = "stylesheet";
386
- document.head.appendChild(link);
319
+ const existingLink = document.querySelector('link[data-mitre-form-font="montserrat"]');
320
+ if (!existingLink) {
321
+ const link = document.createElement("link");
322
+ link.rel = "preconnect";
323
+ link.href = "https://fonts.googleapis.com";
324
+ document.head.appendChild(link);
325
+ const link2 = document.createElement("link");
326
+ link2.rel = "preconnect";
327
+ link2.href = "https://fonts.gstatic.com";
328
+ link2.crossOrigin = "anonymous";
329
+ document.head.appendChild(link2);
330
+ const link3 = document.createElement("link");
331
+ link3.rel = "stylesheet";
332
+ link3.href = "https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap";
333
+ link3.dataset.mitreFormFont = "montserrat";
334
+ document.head.appendChild(link3);
335
+ }
387
336
  }, []);
388
- return null;
389
337
  };
390
- var global_default = FontLoader;
391
338
 
392
339
  // src/components/Input/index.tsx
393
340
  import {
@@ -434,88 +381,88 @@ function date(e) {
434
381
  }
435
382
 
436
383
  // src/components/Input/styles.ts
437
- import styled2, { css } from "styled-components";
438
- var FormLabel = styled2.label`
439
- font-family: "Montserrat", sans-serif;
384
+ import styled3, { css } from "styled-components";
385
+ var FormLabel = styled3.label`
386
+ font-family: ${theme.fonts.primary};
440
387
  font-style: normal;
441
388
  font-weight: 500;
442
389
  font-size: 1rem;
443
- color: ${(props) => props.$textColor || "var(--black)"};
390
+ color: ${(props) => props.$textColor || theme.colors.black};
444
391
  display: block;
445
392
  margin-bottom: 0.5rem;
446
393
  text-align: left;
447
394
  `;
448
- var Input = styled2.input`
449
- font-family: "Montserrat", sans-serif;
395
+ var Input = styled3.input`
396
+ font-family: ${theme.fonts.primary};
450
397
  font-style: normal;
451
398
  font-weight: 500;
452
399
  font-size: 1rem;
453
400
  line-height: 1.5rem;
454
- background: ${(props) => props.$backgroundColor || "var(--white)"};
455
- color: ${(props) => props.$textColor || "var(--black)"};
401
+ background: ${(props) => props.$backgroundColor || theme.colors.white};
402
+ color: ${(props) => props.$textColor || theme.colors.black};
456
403
  padding: 0.5rem;
457
404
  border-radius: 0.125rem;
458
- border: 1px solid ${(props) => props.$borderColor || "transparent"};
405
+ border: 1px solid ${(props) => props.$borderColor || theme.colors.transparent};
459
406
  display: block;
460
407
  height: 3.125rem;
461
408
  width: 100%;
462
409
 
463
410
  &:focus {
464
411
  border-radius: 0.125rem;
465
- border: 2px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
412
+ border: 2px solid ${(props) => props.$focusBorderColor || theme.colors.yellow500};
466
413
  outline: none;
467
414
  }
468
415
 
469
416
  &::placeholder {
470
417
  font-size: 1rem;
471
418
  line-height: 1.5rem;
472
- color: ${(props) => props.$placeholderColor || "var(--gray-100)"};
419
+ color: ${(props) => props.$placeholderColor || theme.colors.gray100};
473
420
  font-weight: 800;
474
421
  }
475
422
 
476
423
  /* Autofill styles */
477
424
  &:-webkit-autofill {
478
- background: ${(props) => props.$backgroundColor || "var(--white)"} !important;
479
- color: ${(props) => props.$textColor || "var(--black)"} !important;
480
- -webkit-text-fill-color: ${(props) => props.$textColor || "var(--black)"} !important;
425
+ background: ${(props) => props.$backgroundColor || theme.colors.white} !important;
426
+ color: ${(props) => props.$textColor || theme.colors.black} !important;
427
+ -webkit-text-fill-color: ${(props) => props.$textColor || theme.colors.black} !important;
481
428
  transition: background-color 5000s ease-in-out 0s; /* Prevent flashing */
482
429
  }
483
430
 
484
431
  &:-webkit-autofill::first-line {
485
- font-family: "Montserrat", sans-serif;
432
+ font-family: ${theme.fonts.primary};
486
433
  font-size: 1rem;
487
434
  font-weight: 500;
488
435
  }
489
436
  `;
490
- var FormErrorMessage = styled2.small`
437
+ var FormErrorMessage = styled3.small`
491
438
  font-size: 0.75rem;
492
439
  line-height: 1.125rem;
493
- color: var(--red);
440
+ color: ${theme.colors.red};
494
441
  margin-top: 0.25rem;
495
442
  display: block;
496
443
  `;
497
- var FormControl = styled2.div.withConfig({
444
+ var FormControl = styled3.div.withConfig({
498
445
  shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
499
446
  })`
500
447
  ${FormLabel} {
501
448
  ${(props) => props.isInvalid && css`
502
- color: var(--red);
449
+ color: ${theme.colors.red};
503
450
  `};
504
451
  }
505
452
 
506
453
  ${Input} {
507
454
  ${(props) => props.isInvalid && css`
508
- border: 1px solid var(--red);
455
+ border: 1px solid ${theme.colors.red};
509
456
 
510
457
  &:not(:focus)::placeholder {
511
- color: var(--red);
458
+ color: ${theme.colors.red};
512
459
  font-weight: 600;
513
460
  }
514
461
  `};
515
462
 
516
463
  &:focus {
517
464
  ${(props) => props.isInvalid && css`
518
- border: 1px solid var(--red);
465
+ border: 1px solid ${theme.colors.red};
519
466
  `};
520
467
  }
521
468
  }
@@ -588,8 +535,8 @@ var Input2 = forwardRef(InputBase);
588
535
 
589
536
  // src/components/Button/styles.ts
590
537
  import { darken } from "polished";
591
- import styled3, { css as css2 } from "styled-components";
592
- var Icon = styled3.span`
538
+ import styled4, { css as css2 } from "styled-components";
539
+ var Icon = styled4.span`
593
540
  font-size: 0;
594
541
  line-height: 0;
595
542
  transition: all 0.25s ease;
@@ -599,32 +546,32 @@ var Icon = styled3.span`
599
546
  opacity: 0;
600
547
  margin-right: 0.625rem;
601
548
  `;
602
- var Text2 = styled3.span`
603
- font-family: "Montserrat", sans-serif;
549
+ var Text = styled4.span`
550
+ font-family: ${theme.fonts.primary};
604
551
  font-size: 1rem;
605
552
  line-height: 1.5rem;
606
553
  margin-bottom: -2px;
607
554
 
608
555
  transition: all 0.25s ease;
609
556
  `;
610
- var TextSubmitting = styled3.span`
611
- font-family: "Montserrat", sans-serif;
557
+ var TextSubmitting = styled4.span`
558
+ font-family: ${theme.fonts.primary};
612
559
  font-weight: 400;
613
560
  font-size: 1rem;
614
561
 
615
562
  transition: all 0.25s ease;
616
563
  `;
617
- var LoadingIcon = styled3.span.withConfig({
564
+ var LoadingIcon = styled4.span.withConfig({
618
565
  shouldForwardProp: (prop) => prop !== "hasText"
619
566
  })`
620
567
  display: block;
621
568
 
622
569
  width: 1rem;
623
570
  height: 1rem;
624
- border: 0.125rem solid var(--white);
571
+ border: 0.125rem solid ${theme.colors.white};
625
572
  border-radius: 50%;
626
573
  animation: loadingAnimation 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
627
- border-color: var(--white) transparent transparent transparent;
574
+ border-color: ${theme.colors.white} transparent transparent transparent;
628
575
 
629
576
  margin-right: ${(props) => props.hasText ? "0.625rem" : "0"};
630
577
 
@@ -637,7 +584,7 @@ var LoadingIcon = styled3.span.withConfig({
637
584
  }
638
585
  }
639
586
  `;
640
- var Button = styled3.button.withConfig({
587
+ var Button = styled4.button.withConfig({
641
588
  shouldForwardProp: (prop) => ![
642
589
  "hasIcon",
643
590
  "isSubmitting",
@@ -668,7 +615,7 @@ var Button = styled3.button.withConfig({
668
615
  display: ${(props) => props?.hasIcon ? "block" : ""};
669
616
  }
670
617
 
671
- ${Text2} {
618
+ ${Text} {
672
619
  transform: ${(props) => props?.hasIcon ? "translate3d(-4.5px, 0px, 0px)" : "unset"};
673
620
 
674
621
  @media print, screen and (min-width: 40em) {
@@ -688,12 +635,12 @@ var Button = styled3.button.withConfig({
688
635
  transform: translate3d(0px, 0px, 0px);
689
636
  }
690
637
 
691
- ${Text2} {
638
+ ${Text} {
692
639
  transform: ${(props) => props?.hasIcon ? "translate3d(-5px, 0px, 0px)" : "unset"};
693
640
  }
694
641
  }
695
642
 
696
- ${Text2} {
643
+ ${Text} {
697
644
  ${(props) => props.isSubmitting && !props.hasSubmittingMessage && css2`
698
645
  transform: unset;
699
646
  opacity: 0;
@@ -718,7 +665,7 @@ function Button2({
718
665
  isSubmitting = false,
719
666
  submittingMessage = "",
720
667
  disabled = false,
721
- color = "var(--black)",
668
+ color = "#2F2F2F",
722
669
  ...rest
723
670
  }) {
724
671
  return /* @__PURE__ */ jsxs2(
@@ -734,7 +681,7 @@ function Button2({
734
681
  children: [
735
682
  icon && !isSubmitting && /* @__PURE__ */ jsx2(Icon, { "data-testid": "button-icon", children: icon }),
736
683
  isSubmitting && /* @__PURE__ */ jsx2(LoadingIcon, { hasText: submittingMessage.length > 0 }),
737
- (!isSubmitting || submittingMessage.length === 0) && /* @__PURE__ */ jsx2(Text2, { className: "text", children }),
684
+ (!isSubmitting || submittingMessage.length === 0) && /* @__PURE__ */ jsx2(Text, { className: "text", children }),
738
685
  isSubmitting && submittingMessage.length > 0 && /* @__PURE__ */ jsx2(TextSubmitting, { children: submittingMessage })
739
686
  ]
740
687
  }
@@ -745,7 +692,7 @@ function Button2({
745
692
  import { useEffect as useEffect2, useState as useState2, useCallback as useCallback2 } from "react";
746
693
 
747
694
  // src/components/Alert/styles.ts
748
- import styled4, { css as css3, keyframes } from "styled-components";
695
+ import styled5, { css as css3, keyframes } from "styled-components";
749
696
  var fadeIn = keyframes`
750
697
  from { opacity: 0; transform: translateY(-10px); }
751
698
  to { opacity: 1; transform: translateY(0); }
@@ -756,39 +703,39 @@ var fadeOut = keyframes`
756
703
  `;
757
704
  var typeStyles = {
758
705
  error: css3`
759
- background-color: var(--red);
760
- border: 1px solid var(--red);
761
- color: var(--white);
706
+ background-color: ${theme.colors.red};
707
+ border: 1px solid ${theme.colors.red};
708
+ color: ${theme.colors.white};
762
709
  svg {
763
- color: var(--white);
710
+ color: ${theme.colors.white};
764
711
  }
765
712
  `,
766
713
  warning: css3`
767
- background-color: var(--yellow-500);
768
- border: 1px solid var(--yellow-400);
769
- color: var(--black);
714
+ background-color: ${theme.colors.yellow500};
715
+ border: 1px solid ${theme.colors.yellow400};
716
+ color: ${theme.colors.black};
770
717
  svg {
771
- color: var(--black);
718
+ color: ${theme.colors.black};
772
719
  }
773
720
  `,
774
721
  info: css3`
775
- background-color: var(--blue);
776
- border: 1px solid var(--blue);
777
- color: var(--white);
722
+ background-color: ${theme.colors.blue};
723
+ border: 1px solid ${theme.colors.blue};
724
+ color: ${theme.colors.white};
778
725
  svg {
779
- color: var(--white);
726
+ color: ${theme.colors.white};
780
727
  }
781
728
  `,
782
729
  success: css3`
783
- background-color: var(--green);
784
- border: 1px solid var(--green-2);
785
- color: var(--white);
730
+ background-color: ${theme.colors.green};
731
+ border: 1px solid ${theme.colors.green2};
732
+ color: ${theme.colors.white};
786
733
  svg {
787
- color: var(--white);
734
+ color: ${theme.colors.white};
788
735
  }
789
736
  `
790
737
  };
791
- var AlertContainer = styled4.div`
738
+ var AlertContainer = styled5.div`
792
739
  position: fixed;
793
740
  width: 500px;
794
741
  top: 15px;
@@ -801,14 +748,14 @@ var AlertContainer = styled4.div`
801
748
  animation-fill-mode: forwards;
802
749
  align-items: center;
803
750
  gap: 0.5rem;
804
- box-shadow: var(--shadow-500);
751
+ box-shadow: ${theme.shadows.shadow500};
805
752
  border-radius: 0.5rem;
806
753
  font-size: 1rem;
807
754
  font-weight: 500;
808
755
 
809
756
  ${({ $type }) => typeStyles[$type]}
810
757
  `;
811
- var DismissButton = styled4.button`
758
+ var DismissButton = styled5.button`
812
759
  position: absolute;
813
760
  background: transparent;
814
761
  right: 10px;
@@ -879,34 +826,34 @@ import {
879
826
  } from "react";
880
827
 
881
828
  // src/components/PhoneInput/styles.ts
882
- import styled5, { css as css4 } from "styled-components";
829
+ import styled6, { css as css4 } from "styled-components";
883
830
  import { PhoneInput } from "react-international-phone";
884
831
  import "react-international-phone/style.css";
885
- var FormLabel2 = styled5.label`
886
- font-family: "Montserrat", sans-serif;
832
+ var FormLabel2 = styled6.label`
833
+ font-family: ${theme.fonts.primary};
887
834
  font-style: normal;
888
835
  font-weight: 500;
889
836
  font-size: 1rem;
890
- color: ${(props) => props.$textColor || "var(--black)"};
837
+ color: ${(props) => props.$textColor || theme.colors.black};
891
838
  display: block;
892
839
  margin-bottom: 0.5rem;
893
840
  text-align: left;
894
841
  `;
895
- var StyledPhoneInput = styled5(PhoneInput)`
842
+ var StyledPhoneInput = styled6(PhoneInput)`
896
843
  width: 100%;
897
844
  height: 3.125rem;
898
- background: ${(props) => props.$backgroundColor || "var(--white)"};
899
- font-family: "Montserrat", sans-serif;
900
- border: 1px solid ${(props) => props.$borderColor || "transparent"};
845
+ background: ${(props) => props.$backgroundColor || theme.colors.white};
846
+ font-family: ${theme.fonts.primary};
847
+ border: 1px solid ${(props) => props.$borderColor || theme.colors.transparent};
901
848
  border-radius: 0.125rem;
902
849
 
903
850
  &:focus-within {
904
851
  border-radius: 0.125rem;
905
- border: 2px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
852
+ border: 2px solid ${(props) => props.$focusBorderColor || theme.colors.yellow500};
906
853
  outline: none;
907
854
 
908
855
  .react-international-phone-country-selector-button {
909
- border-right: 1px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
856
+ border-right: 1px solid ${(props) => props.$focusBorderColor || theme.colors.yellow500};
910
857
  }
911
858
  }
912
859
 
@@ -917,27 +864,27 @@ var StyledPhoneInput = styled5(PhoneInput)`
917
864
  display: flex;
918
865
  align-items: center;
919
866
  overflow: hidden;
920
- font-family: "Montserrat", sans-serif;
867
+ font-family: ${theme.fonts.primary};
921
868
  font-size: 1rem;
922
869
  font-weight: 500;
923
- color: ${(props) => props.$textColor || "var(--black)"};
924
- background: ${(props) => props.$backgroundColor || "var(--white)"};
870
+ color: ${(props) => props.$textColor || theme.colors.black};
871
+ background: ${(props) => props.$backgroundColor || theme.colors.white};
925
872
  }
926
873
 
927
874
  /* Style for the country selector button */
928
875
  .react-international-phone-country-selector-button {
929
876
  height: 100%;
930
- background: ${(props) => props.$backgroundColor || "var(--white)"};
877
+ background: ${(props) => props.$backgroundColor || theme.colors.white};
931
878
  display: flex;
932
879
  align-items: center;
933
880
  justify-content: center;
934
- font-family: "Montserrat", sans-serif;
881
+ font-family: ${theme.fonts.primary};
935
882
  font-size: 1rem;
936
883
  font-weight: 500;
937
884
  cursor: pointer;
938
885
  outline: none;
939
886
  border: none;
940
- border-right: 1px solid ${(props) => props.$borderColor || "var(--transparent)"};
887
+ border-right: 1px solid ${(props) => props.$borderColor || theme.colors.transparent};
941
888
  }
942
889
 
943
890
  /* Style for the input itself */
@@ -946,13 +893,13 @@ var StyledPhoneInput = styled5(PhoneInput)`
946
893
  height: 100%;
947
894
  padding: 0 0.5rem;
948
895
  margin: 0;
949
- background: ${(props) => props.$backgroundColor || "var(--white)"};
950
- font-family: "Montserrat", sans-serif;
896
+ background: ${(props) => props.$backgroundColor || theme.colors.white};
897
+ font-family: ${theme.fonts.primary};
951
898
  font-style: normal;
952
899
  font-weight: 500;
953
900
  font-size: 1rem;
954
901
  line-height: 1.5rem;
955
- color: ${(props) => props.$textColor || "var(--black)"};
902
+ color: ${(props) => props.$textColor || theme.colors.black};
956
903
  outline: none;
957
904
  border: none;
958
905
  border-radius: 0.125rem;
@@ -960,55 +907,55 @@ var StyledPhoneInput = styled5(PhoneInput)`
960
907
  &::placeholder {
961
908
  font-size: 1rem;
962
909
  line-height: 1.5rem;
963
- color: ${(props) => props.$placeholderColor || "var(--gray-100)"};
910
+ color: ${(props) => props.$placeholderColor || theme.colors.gray100};
964
911
  font-weight: 800;
965
912
  }
966
913
 
967
914
  &:-webkit-autofill {
968
- background: ${(props) => props.$backgroundColor || "var(--white)"} !important;
969
- -webkit-text-fill-color: ${(props) => props.$textColor || "var(--black)"} !important;
915
+ background: ${(props) => props.$backgroundColor || theme.colors.white} !important;
916
+ -webkit-text-fill-color: ${(props) => props.$textColor || theme.colors.black} !important;
970
917
  transition: background-color 5000s ease-in-out 0s;
971
918
  }
972
919
 
973
920
  &:-webkit-autofill::first-line {
974
- font-family: "Montserrat", sans-serif;
921
+ font-family: ${theme.fonts.primary};
975
922
  font-size: 1rem;
976
923
  font-weight: 500;
977
924
  }
978
925
  }
979
926
  `;
980
- var FormErrorMessage2 = styled5.small`
927
+ var FormErrorMessage2 = styled6.small`
981
928
  font-size: 0.75rem;
982
929
  line-height: 1.125rem;
983
- color: var(--red);
930
+ color: ${theme.colors.red};
984
931
  margin-top: 0.25rem;
985
932
  display: block;
986
933
  `;
987
- var FormControl2 = styled5.div.withConfig({
934
+ var FormControl2 = styled6.div.withConfig({
988
935
  shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
989
936
  })`
990
937
  ${FormLabel2} {
991
938
  ${(props) => props.isInvalid && css4`
992
- color: var(--red);
939
+ color: ${theme.colors.red};
993
940
  `};
994
941
  }
995
942
 
996
943
  ${StyledPhoneInput} {
997
944
  ${(props) => props.isInvalid && css4`
998
- border: 1px solid var(--red);
945
+ border: 1px solid ${theme.colors.red};
999
946
 
1000
947
  &:not(:focus)::placeholder {
1001
- color: var(--red);
948
+ color: ${theme.colors.red};
1002
949
  font-weight: 600;
1003
950
  }
1004
951
  `};
1005
952
 
1006
953
  .react-international-phone-input-container {
1007
954
  ${(props) => props.isInvalid && css4`
1008
- border: 1px solid var(--red);
955
+ border: 1px solid ${theme.colors.red};
1009
956
 
1010
957
  &:not(:focus)::placeholder {
1011
- color: var(--red);
958
+ color: ${theme.colors.red};
1012
959
  font-weight: 600;
1013
960
  }
1014
961
  `};
@@ -1016,7 +963,7 @@ var FormControl2 = styled5.div.withConfig({
1016
963
 
1017
964
  .react-international-phone-country-selector-button {
1018
965
  ${(props) => props.isInvalid && css4`
1019
- border-right: 1px solid var(--red);
966
+ border-right: 1px solid ${theme.colors.red};
1020
967
  `};
1021
968
  }
1022
969
  }
@@ -1085,28 +1032,28 @@ import {
1085
1032
  } from "react";
1086
1033
 
1087
1034
  // src/components/ProductSelect/styles.ts
1088
- import styled6, { css as css5 } from "styled-components";
1089
- var FormLabel3 = styled6.label`
1090
- font-family: "Montserrat", sans-serif;
1035
+ import styled7, { css as css5 } from "styled-components";
1036
+ var FormLabel3 = styled7.label`
1037
+ font-family: ${theme.fonts.primary};
1091
1038
  font-style: normal;
1092
1039
  font-weight: 500;
1093
1040
  font-size: 1rem;
1094
- color: ${(props) => props.$textColor || "var(--black)"};
1041
+ color: ${(props) => props.$textColor || theme.colors.black};
1095
1042
  display: block;
1096
1043
  margin-bottom: 0.5rem;
1097
1044
  text-align: left;
1098
1045
  `;
1099
- var Select = styled6.select`
1100
- font-family: "Montserrat", sans-serif;
1046
+ var Select = styled7.select`
1047
+ font-family: ${theme.fonts.primary};
1101
1048
  font-style: normal;
1102
1049
  font-weight: 500;
1103
1050
  font-size: 1rem;
1104
1051
  line-height: 1.5rem;
1105
- background: ${(props) => props.$backgroundColor || "var(--white)"};
1106
- color: ${(props) => props.$textColor || "var(--black)"};
1052
+ background: ${(props) => props.$backgroundColor || theme.colors.white};
1053
+ color: ${(props) => props.$textColor || theme.colors.black};
1107
1054
  padding: 0.5rem 3rem 0.5rem 0.5rem; /* Aumentado padding-right para 3rem */
1108
1055
  border-radius: 0.125rem;
1109
- border: 1px solid ${(props) => props.$borderColor || "transparent"};
1056
+ border: 1px solid ${(props) => props.$borderColor || theme.colors.transparent};
1110
1057
  display: block;
1111
1058
  height: 3.125rem;
1112
1059
  width: 100%;
@@ -1125,46 +1072,46 @@ var Select = styled6.select`
1125
1072
 
1126
1073
  &:focus {
1127
1074
  border-radius: 0.125rem;
1128
- border: 2px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
1075
+ border: 2px solid ${(props) => props.$focusBorderColor || theme.colors.yellow500};
1129
1076
  outline: none;
1130
1077
  }
1131
1078
 
1132
1079
  /* Estilo para option disabled (placeholder) */
1133
1080
  option:disabled {
1134
- color: var(--gray-100);
1081
+ color: ${theme.colors.gray100};
1135
1082
  font-weight: 800;
1136
1083
  }
1137
1084
 
1138
1085
  /* Estilo para options normais */
1139
1086
  option:not(:disabled) {
1140
- color: ${(props) => props.$textColor || "var(--black)"};
1087
+ color: ${(props) => props.$textColor || theme.colors.black};
1141
1088
  font-weight: 500;
1142
1089
  }
1143
1090
  `;
1144
- var FormErrorMessage3 = styled6.small`
1091
+ var FormErrorMessage3 = styled7.small`
1145
1092
  font-size: 0.75rem;
1146
1093
  line-height: 1.125rem;
1147
- color: var(--red);
1094
+ color: ${theme.colors.red};
1148
1095
  margin-top: 0.25rem;
1149
1096
  display: block;
1150
1097
  `;
1151
- var FormControl3 = styled6.div.withConfig({
1098
+ var FormControl3 = styled7.div.withConfig({
1152
1099
  shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
1153
1100
  })`
1154
1101
  ${FormLabel3} {
1155
1102
  ${(props) => props.isInvalid && css5`
1156
- color: var(--red);
1103
+ color: ${theme.colors.red};
1157
1104
  `};
1158
1105
  }
1159
1106
 
1160
1107
  ${Select} {
1161
1108
  ${(props) => props.isInvalid && css5`
1162
- border: 1px solid var(--red);
1109
+ border: 1px solid ${theme.colors.red};
1163
1110
  `};
1164
1111
 
1165
1112
  &:focus {
1166
1113
  ${(props) => props.isInvalid && css5`
1167
- border: 1px solid var(--red);
1114
+ border: 1px solid ${theme.colors.red};
1168
1115
  `};
1169
1116
  }
1170
1117
  }
@@ -1211,7 +1158,7 @@ var ProductSelectBase = ({
1211
1158
  var ProductSelect = forwardRef3(ProductSelectBase);
1212
1159
 
1213
1160
  // src/components/Form/index.tsx
1214
- import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1161
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1215
1162
  var phoneUtil = PhoneNumberUtil.getInstance();
1216
1163
  var isPhoneValid = (phone) => {
1217
1164
  try {
@@ -1242,22 +1189,27 @@ var schemaWithProduct = yup.object().shape({
1242
1189
  productId: yup.string().required("Produto \xE9 obrigat\xF3rio")
1243
1190
  });
1244
1191
  var schema = yup.object().shape(baseSchema);
1245
- var MitreFormComponent = React3.forwardRef(({
1192
+ var MitreFormComponent = React2.forwardRef(({
1246
1193
  products,
1247
1194
  apiUrl,
1248
1195
  apiToken,
1249
1196
  showHeader = true,
1250
- backgroundColor = "var(--gray-180)",
1251
- textColor = "var(--black)",
1252
- buttonBackgroundColor = "#F6C76B",
1253
- buttonTextColor = "var(--black)",
1197
+ title = "Atendimento por mensagem",
1198
+ subtitle = "Informe seus dados e retornaremos a mensagem.",
1199
+ backgroundColor = theme.colors.gray180,
1200
+ textColor = theme.colors.black,
1201
+ buttonBackgroundColor = theme.colors.yellow500,
1202
+ buttonTextColor = theme.colors.black,
1254
1203
  innerPadding = "1rem",
1255
- inputBackgroundColor = "var(--white)",
1256
- inputBorderColor = "var(--transparent)",
1257
- inputFocusBorderColor = "var(--yellow-500)",
1258
- inputPlaceholderColor = "var(--gray-100)",
1259
- inputTextColor = "var(--black)"
1204
+ inputBackgroundColor = theme.colors.white,
1205
+ inputBorderColor = theme.colors.transparent,
1206
+ inputFocusBorderColor = theme.colors.yellow500,
1207
+ inputPlaceholderColor = theme.colors.gray100,
1208
+ inputTextColor = theme.colors.black,
1209
+ onSuccess,
1210
+ onError
1260
1211
  }, ref) => {
1212
+ useMontserratFont();
1261
1213
  const [loading, setIsLoading] = useState3(false);
1262
1214
  const { error, handleError, clearError } = useError();
1263
1215
  const [successMessage, setSuccessMessage] = useState3("");
@@ -1294,7 +1246,7 @@ var MitreFormComponent = React3.forwardRef(({
1294
1246
  resolver: yupResolver(formSchema),
1295
1247
  mode: "onSubmit"
1296
1248
  });
1297
- React3.useEffect(() => {
1249
+ React2.useEffect(() => {
1298
1250
  if (!isBrowser()) return;
1299
1251
  const { data } = resolveUtmWithPriority(/* @__PURE__ */ new Date());
1300
1252
  setUtm(data);
@@ -1355,7 +1307,6 @@ var MitreFormComponent = React3.forwardRef(({
1355
1307
  utm_medium: utm.utm_medium,
1356
1308
  utm_term: utm.utm_term
1357
1309
  };
1358
- console.log("requestBody = " + JSON.stringify(requestBody));
1359
1310
  const response = await fetch(`${apiUrl}/leads`, {
1360
1311
  method: "POST",
1361
1312
  headers: {
@@ -1365,31 +1316,29 @@ var MitreFormComponent = React3.forwardRef(({
1365
1316
  body: JSON.stringify(requestBody)
1366
1317
  });
1367
1318
  if (!response.ok) {
1368
- console.log("response = " + JSON.stringify(response));
1369
1319
  throw new Error("Falha ao enviar a mensagem!");
1370
1320
  }
1321
+ const responseData = await response.json();
1322
+ const leadId = responseData.leadId || responseData.id || "";
1371
1323
  setSuccessMessage("Mensagem enviada com sucesso!");
1372
1324
  resetForm();
1325
+ onSuccess?.(requestBody, leadId);
1373
1326
  } catch (err) {
1327
+ const error2 = err instanceof Error ? err : new Error("Erro desconhecido");
1374
1328
  handleError(err);
1329
+ onError?.(error2);
1375
1330
  } finally {
1376
1331
  setIsLoading(false);
1377
1332
  }
1378
1333
  };
1379
1334
  if (productsValidationError) {
1380
1335
  console.error("Erro na valida\xE7\xE3o dos produtos:", productsValidationError);
1381
- return /* @__PURE__ */ jsxs6(Fragment, { children: [
1382
- /* @__PURE__ */ jsx6(global_default, {}),
1383
- /* @__PURE__ */ jsx6(GlobalStyles, {}),
1384
- /* @__PURE__ */ jsx6(FormContainer, { $backgroundColor: backgroundColor, $innerPadding: innerPadding, ref, children: /* @__PURE__ */ jsxs6(HeaderContainer, { children: [
1385
- /* @__PURE__ */ jsx6(Title, { $textColor: textColor, children: "Erro no carregamento do formul\xE1rio!" }),
1386
- /* @__PURE__ */ jsx6(Text, { $textColor: textColor, children: "N\xE3o foi poss\xEDvel carregar o formul\xE1rio. Tente novamente mais tarde." })
1387
- ] }) })
1388
- ] });
1336
+ return /* @__PURE__ */ jsx6(ComponentWrapper, { children: /* @__PURE__ */ jsx6(FormContainer, { $backgroundColor: backgroundColor, $innerPadding: innerPadding, ref, children: /* @__PURE__ */ jsxs6(HeaderContainer, { children: [
1337
+ /* @__PURE__ */ jsx6(Title, { $textColor: textColor, children: "Erro no carregamento do formul\xE1rio!" }),
1338
+ /* @__PURE__ */ jsx6(Subtitle, { $textColor: textColor, children: "N\xE3o foi poss\xEDvel carregar o formul\xE1rio. Tente novamente mais tarde." })
1339
+ ] }) }) });
1389
1340
  }
1390
- return /* @__PURE__ */ jsxs6(Fragment, { children: [
1391
- /* @__PURE__ */ jsx6(global_default, {}),
1392
- /* @__PURE__ */ jsx6(GlobalStyles, {}),
1341
+ return /* @__PURE__ */ jsxs6(ComponentWrapper, { children: [
1393
1342
  error && /* @__PURE__ */ jsx6(
1394
1343
  Alert,
1395
1344
  {
@@ -1412,8 +1361,8 @@ var MitreFormComponent = React3.forwardRef(({
1412
1361
  ),
1413
1362
  /* @__PURE__ */ jsxs6(FormContainer, { $backgroundColor: backgroundColor, $innerPadding: innerPadding, ref, children: [
1414
1363
  showHeader && /* @__PURE__ */ jsxs6(HeaderContainer, { children: [
1415
- /* @__PURE__ */ jsx6(Title, { $textColor: textColor, children: "Atendimento por mensagem" }),
1416
- /* @__PURE__ */ jsx6(Text, { $textColor: textColor, children: "Informe seus dados e retornaremos a mensagem." })
1364
+ /* @__PURE__ */ jsx6(Title, { $textColor: textColor, children: title }),
1365
+ /* @__PURE__ */ jsx6(Subtitle, { $textColor: textColor, children: subtitle })
1417
1366
  ] }),
1418
1367
  /* @__PURE__ */ jsxs6(Form, { $textColor: textColor, onSubmit: handleSubmit(sendMessage), noValidate: true, children: [
1419
1368
  products.length > 1 && /* @__PURE__ */ jsx6(