mitre-form-component 0.1.3 → 0.1.4
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/README.md +33 -0
- package/dist/index.cjs +165 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +161 -134
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -300,6 +300,92 @@ var Subtitle = styled.p`
|
|
|
300
300
|
color: ${(props) => props.$textColor || theme.colors.black};
|
|
301
301
|
`;
|
|
302
302
|
|
|
303
|
+
// src/components/ProductSelect/styles.ts
|
|
304
|
+
import styled2, { css } from "styled-components";
|
|
305
|
+
var FormLabel = styled2.label`
|
|
306
|
+
font-family: ${theme.fonts.primary};
|
|
307
|
+
font-style: normal;
|
|
308
|
+
font-weight: 500;
|
|
309
|
+
font-size: 1rem;
|
|
310
|
+
color: ${(props) => props.$textColor || theme.colors.black};
|
|
311
|
+
display: block;
|
|
312
|
+
margin-bottom: 0.5rem;
|
|
313
|
+
text-align: left;
|
|
314
|
+
`;
|
|
315
|
+
var Select = styled2.select`
|
|
316
|
+
font-family: ${theme.fonts.primary};
|
|
317
|
+
font-style: normal;
|
|
318
|
+
font-weight: 500;
|
|
319
|
+
font-size: 1rem;
|
|
320
|
+
line-height: 1.5rem;
|
|
321
|
+
background: ${(props) => props.$backgroundColor || theme.colors.white};
|
|
322
|
+
color: ${(props) => props.$textColor || theme.colors.black};
|
|
323
|
+
padding: 0.5rem 3rem 0.5rem 0.5rem; /* Aumentado padding-right para 3rem */
|
|
324
|
+
border-radius: 0.125rem;
|
|
325
|
+
border: 1px solid ${(props) => props.$borderColor || theme.colors.transparent};
|
|
326
|
+
display: block;
|
|
327
|
+
height: 3.125rem;
|
|
328
|
+
width: 100%;
|
|
329
|
+
cursor: pointer;
|
|
330
|
+
|
|
331
|
+
/* Remover a seta padrão do navegador */
|
|
332
|
+
-webkit-appearance: none;
|
|
333
|
+
-moz-appearance: none;
|
|
334
|
+
appearance: none;
|
|
335
|
+
|
|
336
|
+
/* Adicionar seta personalizada maior */
|
|
337
|
+
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
|
|
338
|
+
background-repeat: no-repeat;
|
|
339
|
+
background-position: right 1rem center; /* Posicionado a 1rem da direita */
|
|
340
|
+
background-size: 1.25rem; /* Tamanho da seta aumentado para 1.25rem */
|
|
341
|
+
|
|
342
|
+
&:focus {
|
|
343
|
+
border-radius: 0.125rem;
|
|
344
|
+
border: 2px solid ${(props) => props.$focusBorderColor || theme.colors.yellow500};
|
|
345
|
+
outline: none;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* Estilo para option disabled (placeholder) */
|
|
349
|
+
option:disabled {
|
|
350
|
+
color: ${theme.colors.gray100};
|
|
351
|
+
font-weight: 800;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/* Estilo para options normais */
|
|
355
|
+
option:not(:disabled) {
|
|
356
|
+
color: ${(props) => props.$textColor || theme.colors.black};
|
|
357
|
+
font-weight: 500;
|
|
358
|
+
}
|
|
359
|
+
`;
|
|
360
|
+
var FormErrorMessage = styled2.small`
|
|
361
|
+
font-size: 0.75rem;
|
|
362
|
+
line-height: 1.125rem;
|
|
363
|
+
color: ${theme.colors.red};
|
|
364
|
+
margin-top: 0.25rem;
|
|
365
|
+
display: block;
|
|
366
|
+
`;
|
|
367
|
+
var FormControl = styled2.div.withConfig({
|
|
368
|
+
shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
|
|
369
|
+
})`
|
|
370
|
+
${FormLabel} {
|
|
371
|
+
${(props) => props.isInvalid && css`
|
|
372
|
+
color: ${theme.colors.red};
|
|
373
|
+
`};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
${Select} {
|
|
377
|
+
${(props) => props.isInvalid && css`
|
|
378
|
+
border: 1px solid ${theme.colors.red};
|
|
379
|
+
`};
|
|
380
|
+
|
|
381
|
+
&:focus {
|
|
382
|
+
${(props) => props.isInvalid && css`
|
|
383
|
+
border: 1px solid ${theme.colors.red};
|
|
384
|
+
`};
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
`;
|
|
388
|
+
|
|
303
389
|
// src/components/styles/FontLoader.tsx
|
|
304
390
|
import { useEffect } from "react";
|
|
305
391
|
var useMontserratFont = () => {
|
|
@@ -369,8 +455,8 @@ function date(e) {
|
|
|
369
455
|
}
|
|
370
456
|
|
|
371
457
|
// src/components/Input/styles.ts
|
|
372
|
-
import
|
|
373
|
-
var
|
|
458
|
+
import styled3, { css as css2 } from "styled-components";
|
|
459
|
+
var FormLabel2 = styled3.label`
|
|
374
460
|
font-family: ${theme.fonts.primary};
|
|
375
461
|
font-style: normal;
|
|
376
462
|
font-weight: 500;
|
|
@@ -380,7 +466,7 @@ var FormLabel = styled2.label`
|
|
|
380
466
|
margin-bottom: 0.5rem;
|
|
381
467
|
text-align: left;
|
|
382
468
|
`;
|
|
383
|
-
var Input =
|
|
469
|
+
var Input = styled3.input`
|
|
384
470
|
font-family: ${theme.fonts.primary};
|
|
385
471
|
font-style: normal;
|
|
386
472
|
font-weight: 500;
|
|
@@ -422,24 +508,24 @@ var Input = styled2.input`
|
|
|
422
508
|
font-weight: 500;
|
|
423
509
|
}
|
|
424
510
|
`;
|
|
425
|
-
var
|
|
511
|
+
var FormErrorMessage2 = styled3.small`
|
|
426
512
|
font-size: 0.75rem;
|
|
427
513
|
line-height: 1.125rem;
|
|
428
514
|
color: ${theme.colors.red};
|
|
429
515
|
margin-top: 0.25rem;
|
|
430
516
|
display: block;
|
|
431
517
|
`;
|
|
432
|
-
var
|
|
518
|
+
var FormControl2 = styled3.div.withConfig({
|
|
433
519
|
shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
|
|
434
520
|
})`
|
|
435
|
-
${
|
|
436
|
-
${(props) => props.isInvalid &&
|
|
521
|
+
${FormLabel2} {
|
|
522
|
+
${(props) => props.isInvalid && css2`
|
|
437
523
|
color: ${theme.colors.red};
|
|
438
524
|
`};
|
|
439
525
|
}
|
|
440
526
|
|
|
441
527
|
${Input} {
|
|
442
|
-
${(props) => props.isInvalid &&
|
|
528
|
+
${(props) => props.isInvalid && css2`
|
|
443
529
|
border: 1px solid ${theme.colors.red};
|
|
444
530
|
|
|
445
531
|
&:not(:focus)::placeholder {
|
|
@@ -449,7 +535,7 @@ var FormControl = styled2.div.withConfig({
|
|
|
449
535
|
`};
|
|
450
536
|
|
|
451
537
|
&:focus {
|
|
452
|
-
${(props) => props.isInvalid &&
|
|
538
|
+
${(props) => props.isInvalid && css2`
|
|
453
539
|
border: 1px solid ${theme.colors.red};
|
|
454
540
|
`};
|
|
455
541
|
}
|
|
@@ -482,8 +568,8 @@ var InputBase = ({
|
|
|
482
568
|
},
|
|
483
569
|
[mask]
|
|
484
570
|
);
|
|
485
|
-
return /* @__PURE__ */ jsxs(
|
|
486
|
-
!!label && /* @__PURE__ */ jsx(
|
|
571
|
+
return /* @__PURE__ */ jsxs(FormControl2, { isInvalid: !!error, children: [
|
|
572
|
+
!!label && /* @__PURE__ */ jsx(FormLabel2, { htmlFor: id, $textColor: labelTextColor, children: label }),
|
|
487
573
|
!mask ? /* @__PURE__ */ jsx(
|
|
488
574
|
Input,
|
|
489
575
|
{
|
|
@@ -516,15 +602,15 @@ var InputBase = ({
|
|
|
516
602
|
...rest
|
|
517
603
|
}
|
|
518
604
|
),
|
|
519
|
-
!!error && showErrorMessage && /* @__PURE__ */ jsx(
|
|
605
|
+
!!error && showErrorMessage && /* @__PURE__ */ jsx(FormErrorMessage2, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
|
|
520
606
|
] });
|
|
521
607
|
};
|
|
522
608
|
var Input2 = forwardRef(InputBase);
|
|
523
609
|
|
|
524
610
|
// src/components/Button/styles.ts
|
|
525
611
|
import { darken } from "polished";
|
|
526
|
-
import
|
|
527
|
-
var Icon =
|
|
612
|
+
import styled4, { css as css3 } from "styled-components";
|
|
613
|
+
var Icon = styled4.span`
|
|
528
614
|
font-size: 0;
|
|
529
615
|
line-height: 0;
|
|
530
616
|
transition: all 0.25s ease;
|
|
@@ -534,7 +620,7 @@ var Icon = styled3.span`
|
|
|
534
620
|
opacity: 0;
|
|
535
621
|
margin-right: 0.625rem;
|
|
536
622
|
`;
|
|
537
|
-
var Text =
|
|
623
|
+
var Text = styled4.span`
|
|
538
624
|
font-family: ${theme.fonts.primary};
|
|
539
625
|
font-size: 1rem;
|
|
540
626
|
line-height: 1.5rem;
|
|
@@ -542,14 +628,14 @@ var Text = styled3.span`
|
|
|
542
628
|
|
|
543
629
|
transition: all 0.25s ease;
|
|
544
630
|
`;
|
|
545
|
-
var TextSubmitting =
|
|
631
|
+
var TextSubmitting = styled4.span`
|
|
546
632
|
font-family: ${theme.fonts.primary};
|
|
547
633
|
font-weight: 400;
|
|
548
634
|
font-size: 1rem;
|
|
549
635
|
|
|
550
636
|
transition: all 0.25s ease;
|
|
551
637
|
`;
|
|
552
|
-
var LoadingIcon =
|
|
638
|
+
var LoadingIcon = styled4.span.withConfig({
|
|
553
639
|
shouldForwardProp: (prop) => prop !== "hasText"
|
|
554
640
|
})`
|
|
555
641
|
display: block;
|
|
@@ -572,7 +658,7 @@ var LoadingIcon = styled3.span.withConfig({
|
|
|
572
658
|
}
|
|
573
659
|
}
|
|
574
660
|
`;
|
|
575
|
-
var Button =
|
|
661
|
+
var Button = styled4.button.withConfig({
|
|
576
662
|
shouldForwardProp: (prop) => ![
|
|
577
663
|
"hasIcon",
|
|
578
664
|
"isSubmitting",
|
|
@@ -629,14 +715,14 @@ var Button = styled3.button.withConfig({
|
|
|
629
715
|
}
|
|
630
716
|
|
|
631
717
|
${Text} {
|
|
632
|
-
${(props) => props.isSubmitting && !props.hasSubmittingMessage &&
|
|
718
|
+
${(props) => props.isSubmitting && !props.hasSubmittingMessage && css3`
|
|
633
719
|
transform: unset;
|
|
634
720
|
opacity: 0;
|
|
635
721
|
`}
|
|
636
722
|
}
|
|
637
723
|
|
|
638
724
|
${LoadingIcon} {
|
|
639
|
-
${(props) => props.isSubmitting && !props.hasSubmittingMessage &&
|
|
725
|
+
${(props) => props.isSubmitting && !props.hasSubmittingMessage && css3`
|
|
640
726
|
display: flex;
|
|
641
727
|
-webkit-box-align: center;
|
|
642
728
|
align-items: center;
|
|
@@ -680,7 +766,7 @@ function Button2({
|
|
|
680
766
|
import { useEffect as useEffect2, useState as useState2, useCallback as useCallback2 } from "react";
|
|
681
767
|
|
|
682
768
|
// src/components/Alert/styles.ts
|
|
683
|
-
import
|
|
769
|
+
import styled5, { css as css4, keyframes } from "styled-components";
|
|
684
770
|
var fadeIn = keyframes`
|
|
685
771
|
from { opacity: 0; transform: translateY(-10px); }
|
|
686
772
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -690,7 +776,7 @@ var fadeOut = keyframes`
|
|
|
690
776
|
to { opacity: 0; transform: translateY(-10px); }
|
|
691
777
|
`;
|
|
692
778
|
var typeStyles = {
|
|
693
|
-
error:
|
|
779
|
+
error: css4`
|
|
694
780
|
background-color: ${theme.colors.red};
|
|
695
781
|
border: 1px solid ${theme.colors.red};
|
|
696
782
|
color: ${theme.colors.white};
|
|
@@ -698,7 +784,7 @@ var typeStyles = {
|
|
|
698
784
|
color: ${theme.colors.white};
|
|
699
785
|
}
|
|
700
786
|
`,
|
|
701
|
-
warning:
|
|
787
|
+
warning: css4`
|
|
702
788
|
background-color: ${theme.colors.yellow500};
|
|
703
789
|
border: 1px solid ${theme.colors.yellow400};
|
|
704
790
|
color: ${theme.colors.black};
|
|
@@ -706,7 +792,7 @@ var typeStyles = {
|
|
|
706
792
|
color: ${theme.colors.black};
|
|
707
793
|
}
|
|
708
794
|
`,
|
|
709
|
-
info:
|
|
795
|
+
info: css4`
|
|
710
796
|
background-color: ${theme.colors.blue};
|
|
711
797
|
border: 1px solid ${theme.colors.blue};
|
|
712
798
|
color: ${theme.colors.white};
|
|
@@ -714,7 +800,7 @@ var typeStyles = {
|
|
|
714
800
|
color: ${theme.colors.white};
|
|
715
801
|
}
|
|
716
802
|
`,
|
|
717
|
-
success:
|
|
803
|
+
success: css4`
|
|
718
804
|
background-color: ${theme.colors.green};
|
|
719
805
|
border: 1px solid ${theme.colors.green2};
|
|
720
806
|
color: ${theme.colors.white};
|
|
@@ -723,7 +809,7 @@ var typeStyles = {
|
|
|
723
809
|
}
|
|
724
810
|
`
|
|
725
811
|
};
|
|
726
|
-
var AlertContainer =
|
|
812
|
+
var AlertContainer = styled5.div`
|
|
727
813
|
position: fixed;
|
|
728
814
|
width: 500px;
|
|
729
815
|
top: 15px;
|
|
@@ -743,7 +829,7 @@ var AlertContainer = styled4.div`
|
|
|
743
829
|
|
|
744
830
|
${({ $type }) => typeStyles[$type]}
|
|
745
831
|
`;
|
|
746
|
-
var DismissButton =
|
|
832
|
+
var DismissButton = styled5.button`
|
|
747
833
|
position: absolute;
|
|
748
834
|
background: transparent;
|
|
749
835
|
right: 10px;
|
|
@@ -814,10 +900,10 @@ import {
|
|
|
814
900
|
} from "react";
|
|
815
901
|
|
|
816
902
|
// src/components/PhoneInput/styles.ts
|
|
817
|
-
import
|
|
903
|
+
import styled6, { css as css5 } from "styled-components";
|
|
818
904
|
import { PhoneInput } from "react-international-phone";
|
|
819
905
|
import "react-international-phone/style.css";
|
|
820
|
-
var
|
|
906
|
+
var FormLabel3 = styled6.label`
|
|
821
907
|
font-family: ${theme.fonts.primary};
|
|
822
908
|
font-style: normal;
|
|
823
909
|
font-weight: 500;
|
|
@@ -827,7 +913,7 @@ var FormLabel2 = styled5.label`
|
|
|
827
913
|
margin-bottom: 0.5rem;
|
|
828
914
|
text-align: left;
|
|
829
915
|
`;
|
|
830
|
-
var StyledPhoneInput =
|
|
916
|
+
var StyledPhoneInput = styled6(PhoneInput)`
|
|
831
917
|
width: 100%;
|
|
832
918
|
height: 3.125rem;
|
|
833
919
|
background: ${(props) => props.$backgroundColor || theme.colors.white};
|
|
@@ -941,24 +1027,24 @@ var StyledPhoneInput = styled5(PhoneInput)`
|
|
|
941
1027
|
}
|
|
942
1028
|
}
|
|
943
1029
|
`;
|
|
944
|
-
var
|
|
1030
|
+
var FormErrorMessage3 = styled6.small`
|
|
945
1031
|
font-size: 0.75rem;
|
|
946
1032
|
line-height: 1.125rem;
|
|
947
1033
|
color: ${theme.colors.red};
|
|
948
1034
|
margin-top: 0.25rem;
|
|
949
1035
|
display: block;
|
|
950
1036
|
`;
|
|
951
|
-
var
|
|
1037
|
+
var FormControl3 = styled6.div.withConfig({
|
|
952
1038
|
shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
|
|
953
1039
|
})`
|
|
954
|
-
${
|
|
955
|
-
${(props) => props.isInvalid &&
|
|
1040
|
+
${FormLabel3} {
|
|
1041
|
+
${(props) => props.isInvalid && css5`
|
|
956
1042
|
color: ${theme.colors.red};
|
|
957
1043
|
`};
|
|
958
1044
|
}
|
|
959
1045
|
|
|
960
1046
|
${StyledPhoneInput} {
|
|
961
|
-
${(props) => props.isInvalid &&
|
|
1047
|
+
${(props) => props.isInvalid && css5`
|
|
962
1048
|
border: 1px solid ${theme.colors.red};
|
|
963
1049
|
|
|
964
1050
|
&:not(:focus)::placeholder {
|
|
@@ -968,7 +1054,7 @@ var FormControl2 = styled5.div.withConfig({
|
|
|
968
1054
|
`};
|
|
969
1055
|
|
|
970
1056
|
.react-international-phone-input-container {
|
|
971
|
-
${(props) => props.isInvalid &&
|
|
1057
|
+
${(props) => props.isInvalid && css5`
|
|
972
1058
|
border: 1px solid ${theme.colors.red};
|
|
973
1059
|
|
|
974
1060
|
&:not(:focus)::placeholder {
|
|
@@ -979,7 +1065,7 @@ var FormControl2 = styled5.div.withConfig({
|
|
|
979
1065
|
}
|
|
980
1066
|
|
|
981
1067
|
.react-international-phone-country-selector-button {
|
|
982
|
-
${(props) => props.isInvalid &&
|
|
1068
|
+
${(props) => props.isInvalid && css5`
|
|
983
1069
|
border-right: 1px solid ${theme.colors.red};
|
|
984
1070
|
`};
|
|
985
1071
|
}
|
|
@@ -1002,8 +1088,8 @@ var PhoneInputBase = ({
|
|
|
1002
1088
|
value,
|
|
1003
1089
|
...rest
|
|
1004
1090
|
}, ref) => {
|
|
1005
|
-
return /* @__PURE__ */ jsxs4(
|
|
1006
|
-
!!label && /* @__PURE__ */ jsx4(
|
|
1091
|
+
return /* @__PURE__ */ jsxs4(FormControl3, { isInvalid: !!error, children: [
|
|
1092
|
+
!!label && /* @__PURE__ */ jsx4(FormLabel3, { htmlFor: id, $textColor: labelTextColor, children: label }),
|
|
1007
1093
|
/* @__PURE__ */ jsx4(
|
|
1008
1094
|
StyledPhoneInput,
|
|
1009
1095
|
{
|
|
@@ -1038,7 +1124,7 @@ var PhoneInputBase = ({
|
|
|
1038
1124
|
$textColor: inputTextColor
|
|
1039
1125
|
}
|
|
1040
1126
|
),
|
|
1041
|
-
!!error && showErrorMessage && /* @__PURE__ */ jsx4(
|
|
1127
|
+
!!error && showErrorMessage && /* @__PURE__ */ jsx4(FormErrorMessage3, { "data-testid": "error-message", children: typeof error === "string" ? error : error?.message })
|
|
1042
1128
|
] });
|
|
1043
1129
|
};
|
|
1044
1130
|
var PhoneInput2 = forwardRef2(PhoneInputBase);
|
|
@@ -1047,94 +1133,6 @@ var PhoneInput2 = forwardRef2(PhoneInputBase);
|
|
|
1047
1133
|
import {
|
|
1048
1134
|
forwardRef as forwardRef3
|
|
1049
1135
|
} from "react";
|
|
1050
|
-
|
|
1051
|
-
// src/components/ProductSelect/styles.ts
|
|
1052
|
-
import styled6, { css as css5 } from "styled-components";
|
|
1053
|
-
var FormLabel3 = styled6.label`
|
|
1054
|
-
font-family: ${theme.fonts.primary};
|
|
1055
|
-
font-style: normal;
|
|
1056
|
-
font-weight: 500;
|
|
1057
|
-
font-size: 1rem;
|
|
1058
|
-
color: ${(props) => props.$textColor || theme.colors.black};
|
|
1059
|
-
display: block;
|
|
1060
|
-
margin-bottom: 0.5rem;
|
|
1061
|
-
text-align: left;
|
|
1062
|
-
`;
|
|
1063
|
-
var Select = styled6.select`
|
|
1064
|
-
font-family: ${theme.fonts.primary};
|
|
1065
|
-
font-style: normal;
|
|
1066
|
-
font-weight: 500;
|
|
1067
|
-
font-size: 1rem;
|
|
1068
|
-
line-height: 1.5rem;
|
|
1069
|
-
background: ${(props) => props.$backgroundColor || theme.colors.white};
|
|
1070
|
-
color: ${(props) => props.$textColor || theme.colors.black};
|
|
1071
|
-
padding: 0.5rem 3rem 0.5rem 0.5rem; /* Aumentado padding-right para 3rem */
|
|
1072
|
-
border-radius: 0.125rem;
|
|
1073
|
-
border: 1px solid ${(props) => props.$borderColor || theme.colors.transparent};
|
|
1074
|
-
display: block;
|
|
1075
|
-
height: 3.125rem;
|
|
1076
|
-
width: 100%;
|
|
1077
|
-
cursor: pointer;
|
|
1078
|
-
|
|
1079
|
-
/* Remover a seta padrão do navegador */
|
|
1080
|
-
-webkit-appearance: none;
|
|
1081
|
-
-moz-appearance: none;
|
|
1082
|
-
appearance: none;
|
|
1083
|
-
|
|
1084
|
-
/* Adicionar seta personalizada maior */
|
|
1085
|
-
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
|
|
1086
|
-
background-repeat: no-repeat;
|
|
1087
|
-
background-position: right 1rem center; /* Posicionado a 1rem da direita */
|
|
1088
|
-
background-size: 1.25rem; /* Tamanho da seta aumentado para 1.25rem */
|
|
1089
|
-
|
|
1090
|
-
&:focus {
|
|
1091
|
-
border-radius: 0.125rem;
|
|
1092
|
-
border: 2px solid ${(props) => props.$focusBorderColor || theme.colors.yellow500};
|
|
1093
|
-
outline: none;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
/* Estilo para option disabled (placeholder) */
|
|
1097
|
-
option:disabled {
|
|
1098
|
-
color: ${theme.colors.gray100};
|
|
1099
|
-
font-weight: 800;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
/* Estilo para options normais */
|
|
1103
|
-
option:not(:disabled) {
|
|
1104
|
-
color: ${(props) => props.$textColor || theme.colors.black};
|
|
1105
|
-
font-weight: 500;
|
|
1106
|
-
}
|
|
1107
|
-
`;
|
|
1108
|
-
var FormErrorMessage3 = styled6.small`
|
|
1109
|
-
font-size: 0.75rem;
|
|
1110
|
-
line-height: 1.125rem;
|
|
1111
|
-
color: ${theme.colors.red};
|
|
1112
|
-
margin-top: 0.25rem;
|
|
1113
|
-
display: block;
|
|
1114
|
-
`;
|
|
1115
|
-
var FormControl3 = styled6.div.withConfig({
|
|
1116
|
-
shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
|
|
1117
|
-
})`
|
|
1118
|
-
${FormLabel3} {
|
|
1119
|
-
${(props) => props.isInvalid && css5`
|
|
1120
|
-
color: ${theme.colors.red};
|
|
1121
|
-
`};
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
${Select} {
|
|
1125
|
-
${(props) => props.isInvalid && css5`
|
|
1126
|
-
border: 1px solid ${theme.colors.red};
|
|
1127
|
-
`};
|
|
1128
|
-
|
|
1129
|
-
&:focus {
|
|
1130
|
-
${(props) => props.isInvalid && css5`
|
|
1131
|
-
border: 1px solid ${theme.colors.red};
|
|
1132
|
-
`};
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
`;
|
|
1136
|
-
|
|
1137
|
-
// src/components/ProductSelect/index.tsx
|
|
1138
1136
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1139
1137
|
var ProductSelectBase = ({
|
|
1140
1138
|
id,
|
|
@@ -1150,8 +1148,8 @@ var ProductSelectBase = ({
|
|
|
1150
1148
|
placeholder = "Selecione um produto",
|
|
1151
1149
|
...rest
|
|
1152
1150
|
}, ref) => {
|
|
1153
|
-
return /* @__PURE__ */ jsxs5(
|
|
1154
|
-
!!label && /* @__PURE__ */ jsx5(
|
|
1151
|
+
return /* @__PURE__ */ jsxs5(FormControl, { isInvalid: !!error, children: [
|
|
1152
|
+
!!label && /* @__PURE__ */ jsx5(FormLabel, { htmlFor: id, $textColor: labelTextColor, children: label }),
|
|
1155
1153
|
/* @__PURE__ */ jsxs5(
|
|
1156
1154
|
Select,
|
|
1157
1155
|
{
|
|
@@ -1169,7 +1167,7 @@ var ProductSelectBase = ({
|
|
|
1169
1167
|
]
|
|
1170
1168
|
}
|
|
1171
1169
|
),
|
|
1172
|
-
!!error && showErrorMessage && /* @__PURE__ */ jsx5(
|
|
1170
|
+
!!error && showErrorMessage && /* @__PURE__ */ jsx5(FormErrorMessage, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
|
|
1173
1171
|
] });
|
|
1174
1172
|
};
|
|
1175
1173
|
var ProductSelect = forwardRef3(ProductSelectBase);
|
|
@@ -1177,6 +1175,12 @@ var ProductSelect = forwardRef3(ProductSelectBase);
|
|
|
1177
1175
|
// src/components/Form/index.tsx
|
|
1178
1176
|
import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1179
1177
|
var phoneUtil = PhoneNumberUtil.getInstance();
|
|
1178
|
+
var PreferenciaContato = /* @__PURE__ */ ((PreferenciaContato2) => {
|
|
1179
|
+
PreferenciaContato2["Whatsapp"] = "Whatsapp";
|
|
1180
|
+
PreferenciaContato2["Email"] = "Email";
|
|
1181
|
+
PreferenciaContato2["Ligacao"] = "Liga\xE7\xE3o";
|
|
1182
|
+
return PreferenciaContato2;
|
|
1183
|
+
})(PreferenciaContato || {});
|
|
1180
1184
|
var isPhoneValid = (phone) => {
|
|
1181
1185
|
try {
|
|
1182
1186
|
return phoneUtil.isValidNumber(phoneUtil.parseAndKeepRawInput(phone));
|
|
@@ -1223,6 +1227,7 @@ var MitreFormComponent = React2.forwardRef(({
|
|
|
1223
1227
|
inputFocusBorderColor = theme.colors.yellow500,
|
|
1224
1228
|
inputPlaceholderColor = theme.colors.gray100,
|
|
1225
1229
|
inputTextColor = theme.colors.black,
|
|
1230
|
+
showPreferenciaContato = false,
|
|
1226
1231
|
onSuccess,
|
|
1227
1232
|
onError
|
|
1228
1233
|
}, ref) => {
|
|
@@ -1291,7 +1296,7 @@ var MitreFormComponent = React2.forwardRef(({
|
|
|
1291
1296
|
setFormKey((k) => k + 1);
|
|
1292
1297
|
};
|
|
1293
1298
|
const sendMessage = async (data) => {
|
|
1294
|
-
const { name, email, phone, productId } = data;
|
|
1299
|
+
const { name, email, phone, productId, preferencia_contato } = data;
|
|
1295
1300
|
const phoneValue = phone.inputValue;
|
|
1296
1301
|
const phoneDigitsOnly = phoneValue?.replace(/\D/g, "") || "";
|
|
1297
1302
|
const message = "Gostaria de mais informa\xE7\xF5es sobre o produto";
|
|
@@ -1322,7 +1327,8 @@ var MitreFormComponent = React2.forwardRef(({
|
|
|
1322
1327
|
utm_source: utm.utm_source,
|
|
1323
1328
|
utm_campaign: utm.utm_campaign,
|
|
1324
1329
|
utm_medium: utm.utm_medium,
|
|
1325
|
-
utm_term: utm.utm_term
|
|
1330
|
+
utm_term: utm.utm_term,
|
|
1331
|
+
...showPreferenciaContato && preferencia_contato ? { preferencia_contato } : {}
|
|
1326
1332
|
};
|
|
1327
1333
|
const response = await fetch(`${apiUrl}/leads`, {
|
|
1328
1334
|
method: "POST",
|
|
@@ -1468,6 +1474,26 @@ var MitreFormComponent = React2.forwardRef(({
|
|
|
1468
1474
|
},
|
|
1469
1475
|
formKey
|
|
1470
1476
|
),
|
|
1477
|
+
showPreferenciaContato && /* @__PURE__ */ jsxs6(FormControl, { isInvalid: !!errors.preferencia_contato, children: [
|
|
1478
|
+
/* @__PURE__ */ jsx6(FormLabel, { htmlFor: "preferencia_contato", $textColor: textColor, children: "Prefer\xEAncia de Contato" }),
|
|
1479
|
+
/* @__PURE__ */ jsxs6(
|
|
1480
|
+
Select,
|
|
1481
|
+
{
|
|
1482
|
+
id: "preferencia_contato",
|
|
1483
|
+
...register("preferencia_contato"),
|
|
1484
|
+
defaultValue: "",
|
|
1485
|
+
$backgroundColor: inputBackgroundColor,
|
|
1486
|
+
$borderColor: inputBorderColor,
|
|
1487
|
+
$focusBorderColor: inputFocusBorderColor,
|
|
1488
|
+
$textColor: inputTextColor,
|
|
1489
|
+
children: [
|
|
1490
|
+
/* @__PURE__ */ jsx6("option", { value: "", disabled: true, children: "Selecione uma op\xE7\xE3o" }),
|
|
1491
|
+
Object.values(PreferenciaContato).map((op) => /* @__PURE__ */ jsx6("option", { value: op, children: op }, op))
|
|
1492
|
+
]
|
|
1493
|
+
}
|
|
1494
|
+
),
|
|
1495
|
+
errors.preferencia_contato && /* @__PURE__ */ jsx6(FormErrorMessage, { children: errors.preferencia_contato.message })
|
|
1496
|
+
] }),
|
|
1471
1497
|
/* @__PURE__ */ jsx6("h6", { children: "* Campos de preenchimento obrigat\xF3rio." }),
|
|
1472
1498
|
/* @__PURE__ */ jsx6(ButtonContainer, { children: /* @__PURE__ */ jsx6(Button2, { bgColor: buttonBackgroundColor, color: buttonTextColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
|
|
1473
1499
|
/* @__PURE__ */ jsxs6("p", { children: [
|
|
@@ -1495,6 +1521,7 @@ var MitreFormComponent = React2.forwardRef(({
|
|
|
1495
1521
|
MitreFormComponent.displayName = "MitreFormComponent";
|
|
1496
1522
|
var Form_default = MitreFormComponent;
|
|
1497
1523
|
export {
|
|
1498
|
-
Form_default as MitreFormComponent
|
|
1524
|
+
Form_default as MitreFormComponent,
|
|
1525
|
+
PreferenciaContato
|
|
1499
1526
|
};
|
|
1500
1527
|
//# sourceMappingURL=index.js.map
|