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 CHANGED
@@ -70,6 +70,7 @@ const products = JSON.parse(process.env.VITE_PRODUCT_ID!);
70
70
  inputFocusBorderColor="#76B" //[Opcional]
71
71
  inputPlaceholderColor="#FFF" //[Opcional]
72
72
  inputTextColor="#FFF" //[Opcional]
73
+ showPreferenciaContato={true} //[Opcional] Exibe campo de preferência de contato
73
74
  onSuccess={(requestBody, leadId) => console.log('Formulário enviado com sucesso!', requestBody, leadId)} //[Opcional]
74
75
  onError={(error) => console.error('Erro ao enviar formulário:', error)} //[Opcional]
75
76
  />;
@@ -142,6 +143,7 @@ O `MitreFormComponent` aceita as seguintes props:
142
143
  - **`inputFocusBorderColor`** (opcional, string): Cor da borda do input quando selecionado. Padrão: `#F6C76B`.
143
144
  - **`inputPlaceholderColor`** (opcional, string): Cor do placeholder do input. Padrão: `#B6B6B6`.
144
145
  - **`inputTextColor`** (opcional, string): Cor do texto do input. Padrão: `#2F2F2F`.
146
+ - **`showPreferenciaContato`** (opcional, boolean): Exibe um campo de seleção "Preferência de Contato" com as opções `Whatsapp`, `Email` e `Ligação`. Quando selecionado, o valor é enviado à API como `preferencia_contato`. Padrão: `false`.
145
147
  - **`onSuccess`** (opcional, função): Callback executado quando o formulário é enviado com sucesso. Recebe dois parâmetros: `requestBody` (objeto com os dados enviados) e `leadId` (string com o ID do lead retornado pela API).
146
148
  - **`onError`** (opcional, função): Callback executado quando ocorre um erro no envio do formulário. Recebe um objeto `Error` como parâmetro.
147
149
 
@@ -176,6 +178,37 @@ interface Product {
176
178
 
177
179
  ---
178
180
 
181
+ ## 📞 Preferência de Contato
182
+
183
+ Quando `showPreferenciaContato={true}`, um campo de seleção é exibido no formulário com as seguintes opções:
184
+
185
+ | Valor do enum | Valor enviado à API |
186
+ |--------------------------|---------------------|
187
+ | `PreferenciaContato.Whatsapp` | `"Whatsapp"` |
188
+ | `PreferenciaContato.Email` | `"Email"` |
189
+ | `PreferenciaContato.Ligacao` | `"Ligação"` |
190
+
191
+ O campo é opcional: se o usuário não selecionar nenhuma opção, `preferencia_contato` não é enviado no body da requisição.
192
+
193
+ O enum `PreferenciaContato` é exportado pela biblioteca para uso externo, se necessário:
194
+
195
+ ```tsx
196
+ import { MitreFormComponent, PreferenciaContato } from "mitre-form-component-next";
197
+
198
+ <MitreFormComponent
199
+ products={products}
200
+ apiUrl={process.env.NEXT_PUBLIC_REGISTER_LEADS_URL!}
201
+ apiToken={process.env.NEXT_PUBLIC_REGISTER_LEADS_TOKEN!}
202
+ showPreferenciaContato={true}
203
+ onSuccess={(requestBody) => {
204
+ // requestBody.preferencia_contato estará presente se o usuário selecionou uma opção
205
+ console.log(requestBody.preferencia_contato); // ex: "Whatsapp"
206
+ }}
207
+ />
208
+ ```
209
+
210
+ ---
211
+
179
212
  ## 🚨 Componente dentro de um `ErrorBoundary`
180
213
 
181
214
  Recomendamos que o componente `MitreFormComponent` seja sempre utilizado dentro de um `ErrorBoundary` para garantir que a aplicação não quebre em caso de falha no carregamento do componente. Também é preciso usar dynamic do next/dynamics para a importação.
package/dist/index.cjs CHANGED
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- MitreFormComponent: () => Form_default
33
+ MitreFormComponent: () => Form_default,
34
+ PreferenciaContato: () => PreferenciaContato
34
35
  });
35
36
  module.exports = __toCommonJS(index_exports);
36
37
 
@@ -336,6 +337,92 @@ var Subtitle = import_styled_components.default.p`
336
337
  color: ${(props) => props.$textColor || theme.colors.black};
337
338
  `;
338
339
 
340
+ // src/components/ProductSelect/styles.ts
341
+ var import_styled_components2 = __toESM(require("styled-components"), 1);
342
+ var FormLabel = import_styled_components2.default.label`
343
+ font-family: ${theme.fonts.primary};
344
+ font-style: normal;
345
+ font-weight: 500;
346
+ font-size: 1rem;
347
+ color: ${(props) => props.$textColor || theme.colors.black};
348
+ display: block;
349
+ margin-bottom: 0.5rem;
350
+ text-align: left;
351
+ `;
352
+ var Select = import_styled_components2.default.select`
353
+ font-family: ${theme.fonts.primary};
354
+ font-style: normal;
355
+ font-weight: 500;
356
+ font-size: 1rem;
357
+ line-height: 1.5rem;
358
+ background: ${(props) => props.$backgroundColor || theme.colors.white};
359
+ color: ${(props) => props.$textColor || theme.colors.black};
360
+ padding: 0.5rem 3rem 0.5rem 0.5rem; /* Aumentado padding-right para 3rem */
361
+ border-radius: 0.125rem;
362
+ border: 1px solid ${(props) => props.$borderColor || theme.colors.transparent};
363
+ display: block;
364
+ height: 3.125rem;
365
+ width: 100%;
366
+ cursor: pointer;
367
+
368
+ /* Remover a seta padrão do navegador */
369
+ -webkit-appearance: none;
370
+ -moz-appearance: none;
371
+ appearance: none;
372
+
373
+ /* Adicionar seta personalizada maior */
374
+ 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");
375
+ background-repeat: no-repeat;
376
+ background-position: right 1rem center; /* Posicionado a 1rem da direita */
377
+ background-size: 1.25rem; /* Tamanho da seta aumentado para 1.25rem */
378
+
379
+ &:focus {
380
+ border-radius: 0.125rem;
381
+ border: 2px solid ${(props) => props.$focusBorderColor || theme.colors.yellow500};
382
+ outline: none;
383
+ }
384
+
385
+ /* Estilo para option disabled (placeholder) */
386
+ option:disabled {
387
+ color: ${theme.colors.gray100};
388
+ font-weight: 800;
389
+ }
390
+
391
+ /* Estilo para options normais */
392
+ option:not(:disabled) {
393
+ color: ${(props) => props.$textColor || theme.colors.black};
394
+ font-weight: 500;
395
+ }
396
+ `;
397
+ var FormErrorMessage = import_styled_components2.default.small`
398
+ font-size: 0.75rem;
399
+ line-height: 1.125rem;
400
+ color: ${theme.colors.red};
401
+ margin-top: 0.25rem;
402
+ display: block;
403
+ `;
404
+ var FormControl = import_styled_components2.default.div.withConfig({
405
+ shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
406
+ })`
407
+ ${FormLabel} {
408
+ ${(props) => props.isInvalid && import_styled_components2.css`
409
+ color: ${theme.colors.red};
410
+ `};
411
+ }
412
+
413
+ ${Select} {
414
+ ${(props) => props.isInvalid && import_styled_components2.css`
415
+ border: 1px solid ${theme.colors.red};
416
+ `};
417
+
418
+ &:focus {
419
+ ${(props) => props.isInvalid && import_styled_components2.css`
420
+ border: 1px solid ${theme.colors.red};
421
+ `};
422
+ }
423
+ }
424
+ `;
425
+
339
426
  // src/components/styles/FontLoader.tsx
340
427
  var import_react2 = require("react");
341
428
  var useMontserratFont = () => {
@@ -402,8 +489,8 @@ function date(e) {
402
489
  }
403
490
 
404
491
  // src/components/Input/styles.ts
405
- var import_styled_components2 = __toESM(require("styled-components"), 1);
406
- var FormLabel = import_styled_components2.default.label`
492
+ var import_styled_components3 = __toESM(require("styled-components"), 1);
493
+ var FormLabel2 = import_styled_components3.default.label`
407
494
  font-family: ${theme.fonts.primary};
408
495
  font-style: normal;
409
496
  font-weight: 500;
@@ -413,7 +500,7 @@ var FormLabel = import_styled_components2.default.label`
413
500
  margin-bottom: 0.5rem;
414
501
  text-align: left;
415
502
  `;
416
- var Input = import_styled_components2.default.input`
503
+ var Input = import_styled_components3.default.input`
417
504
  font-family: ${theme.fonts.primary};
418
505
  font-style: normal;
419
506
  font-weight: 500;
@@ -455,24 +542,24 @@ var Input = import_styled_components2.default.input`
455
542
  font-weight: 500;
456
543
  }
457
544
  `;
458
- var FormErrorMessage = import_styled_components2.default.small`
545
+ var FormErrorMessage2 = import_styled_components3.default.small`
459
546
  font-size: 0.75rem;
460
547
  line-height: 1.125rem;
461
548
  color: ${theme.colors.red};
462
549
  margin-top: 0.25rem;
463
550
  display: block;
464
551
  `;
465
- var FormControl = import_styled_components2.default.div.withConfig({
552
+ var FormControl2 = import_styled_components3.default.div.withConfig({
466
553
  shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
467
554
  })`
468
- ${FormLabel} {
469
- ${(props) => props.isInvalid && import_styled_components2.css`
555
+ ${FormLabel2} {
556
+ ${(props) => props.isInvalid && import_styled_components3.css`
470
557
  color: ${theme.colors.red};
471
558
  `};
472
559
  }
473
560
 
474
561
  ${Input} {
475
- ${(props) => props.isInvalid && import_styled_components2.css`
562
+ ${(props) => props.isInvalid && import_styled_components3.css`
476
563
  border: 1px solid ${theme.colors.red};
477
564
 
478
565
  &:not(:focus)::placeholder {
@@ -482,7 +569,7 @@ var FormControl = import_styled_components2.default.div.withConfig({
482
569
  `};
483
570
 
484
571
  &:focus {
485
- ${(props) => props.isInvalid && import_styled_components2.css`
572
+ ${(props) => props.isInvalid && import_styled_components3.css`
486
573
  border: 1px solid ${theme.colors.red};
487
574
  `};
488
575
  }
@@ -515,8 +602,8 @@ var InputBase = ({
515
602
  },
516
603
  [mask]
517
604
  );
518
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormControl, { isInvalid: !!error, children: [
519
- !!label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormLabel, { htmlFor: id, $textColor: labelTextColor, children: label }),
605
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormControl2, { isInvalid: !!error, children: [
606
+ !!label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormLabel2, { htmlFor: id, $textColor: labelTextColor, children: label }),
520
607
  !mask ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
521
608
  Input,
522
609
  {
@@ -549,15 +636,15 @@ var InputBase = ({
549
636
  ...rest
550
637
  }
551
638
  ),
552
- !!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormErrorMessage, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
639
+ !!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormErrorMessage2, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
553
640
  ] });
554
641
  };
555
642
  var Input2 = (0, import_react3.forwardRef)(InputBase);
556
643
 
557
644
  // src/components/Button/styles.ts
558
645
  var import_polished = require("polished");
559
- var import_styled_components3 = __toESM(require("styled-components"), 1);
560
- var Icon = import_styled_components3.default.span`
646
+ var import_styled_components4 = __toESM(require("styled-components"), 1);
647
+ var Icon = import_styled_components4.default.span`
561
648
  font-size: 0;
562
649
  line-height: 0;
563
650
  transition: all 0.25s ease;
@@ -567,7 +654,7 @@ var Icon = import_styled_components3.default.span`
567
654
  opacity: 0;
568
655
  margin-right: 0.625rem;
569
656
  `;
570
- var Text = import_styled_components3.default.span`
657
+ var Text = import_styled_components4.default.span`
571
658
  font-family: ${theme.fonts.primary};
572
659
  font-size: 1rem;
573
660
  line-height: 1.5rem;
@@ -575,14 +662,14 @@ var Text = import_styled_components3.default.span`
575
662
 
576
663
  transition: all 0.25s ease;
577
664
  `;
578
- var TextSubmitting = import_styled_components3.default.span`
665
+ var TextSubmitting = import_styled_components4.default.span`
579
666
  font-family: ${theme.fonts.primary};
580
667
  font-weight: 400;
581
668
  font-size: 1rem;
582
669
 
583
670
  transition: all 0.25s ease;
584
671
  `;
585
- var LoadingIcon = import_styled_components3.default.span.withConfig({
672
+ var LoadingIcon = import_styled_components4.default.span.withConfig({
586
673
  shouldForwardProp: (prop) => prop !== "hasText"
587
674
  })`
588
675
  display: block;
@@ -605,7 +692,7 @@ var LoadingIcon = import_styled_components3.default.span.withConfig({
605
692
  }
606
693
  }
607
694
  `;
608
- var Button = import_styled_components3.default.button.withConfig({
695
+ var Button = import_styled_components4.default.button.withConfig({
609
696
  shouldForwardProp: (prop) => ![
610
697
  "hasIcon",
611
698
  "isSubmitting",
@@ -662,14 +749,14 @@ var Button = import_styled_components3.default.button.withConfig({
662
749
  }
663
750
 
664
751
  ${Text} {
665
- ${(props) => props.isSubmitting && !props.hasSubmittingMessage && import_styled_components3.css`
752
+ ${(props) => props.isSubmitting && !props.hasSubmittingMessage && import_styled_components4.css`
666
753
  transform: unset;
667
754
  opacity: 0;
668
755
  `}
669
756
  }
670
757
 
671
758
  ${LoadingIcon} {
672
- ${(props) => props.isSubmitting && !props.hasSubmittingMessage && import_styled_components3.css`
759
+ ${(props) => props.isSubmitting && !props.hasSubmittingMessage && import_styled_components4.css`
673
760
  display: flex;
674
761
  -webkit-box-align: center;
675
762
  align-items: center;
@@ -713,17 +800,17 @@ function Button2({
713
800
  var import_react4 = require("react");
714
801
 
715
802
  // src/components/Alert/styles.ts
716
- var import_styled_components4 = __toESM(require("styled-components"), 1);
717
- var fadeIn = import_styled_components4.keyframes`
803
+ var import_styled_components5 = __toESM(require("styled-components"), 1);
804
+ var fadeIn = import_styled_components5.keyframes`
718
805
  from { opacity: 0; transform: translateY(-10px); }
719
806
  to { opacity: 1; transform: translateY(0); }
720
807
  `;
721
- var fadeOut = import_styled_components4.keyframes`
808
+ var fadeOut = import_styled_components5.keyframes`
722
809
  from { opacity: 1; transform: translateY(0); }
723
810
  to { opacity: 0; transform: translateY(-10px); }
724
811
  `;
725
812
  var typeStyles = {
726
- error: import_styled_components4.css`
813
+ error: import_styled_components5.css`
727
814
  background-color: ${theme.colors.red};
728
815
  border: 1px solid ${theme.colors.red};
729
816
  color: ${theme.colors.white};
@@ -731,7 +818,7 @@ var typeStyles = {
731
818
  color: ${theme.colors.white};
732
819
  }
733
820
  `,
734
- warning: import_styled_components4.css`
821
+ warning: import_styled_components5.css`
735
822
  background-color: ${theme.colors.yellow500};
736
823
  border: 1px solid ${theme.colors.yellow400};
737
824
  color: ${theme.colors.black};
@@ -739,7 +826,7 @@ var typeStyles = {
739
826
  color: ${theme.colors.black};
740
827
  }
741
828
  `,
742
- info: import_styled_components4.css`
829
+ info: import_styled_components5.css`
743
830
  background-color: ${theme.colors.blue};
744
831
  border: 1px solid ${theme.colors.blue};
745
832
  color: ${theme.colors.white};
@@ -747,7 +834,7 @@ var typeStyles = {
747
834
  color: ${theme.colors.white};
748
835
  }
749
836
  `,
750
- success: import_styled_components4.css`
837
+ success: import_styled_components5.css`
751
838
  background-color: ${theme.colors.green};
752
839
  border: 1px solid ${theme.colors.green2};
753
840
  color: ${theme.colors.white};
@@ -756,7 +843,7 @@ var typeStyles = {
756
843
  }
757
844
  `
758
845
  };
759
- var AlertContainer = import_styled_components4.default.div`
846
+ var AlertContainer = import_styled_components5.default.div`
760
847
  position: fixed;
761
848
  width: 500px;
762
849
  top: 15px;
@@ -776,7 +863,7 @@ var AlertContainer = import_styled_components4.default.div`
776
863
 
777
864
  ${({ $type }) => typeStyles[$type]}
778
865
  `;
779
- var DismissButton = import_styled_components4.default.button`
866
+ var DismissButton = import_styled_components5.default.button`
780
867
  position: absolute;
781
868
  background: transparent;
782
869
  right: 10px;
@@ -845,10 +932,10 @@ var Alert = ({
845
932
  var import_react5 = require("react");
846
933
 
847
934
  // src/components/PhoneInput/styles.ts
848
- var import_styled_components5 = __toESM(require("styled-components"), 1);
935
+ var import_styled_components6 = __toESM(require("styled-components"), 1);
849
936
  var import_react_international_phone = require("react-international-phone");
850
937
  var import_style = require("react-international-phone/style.css");
851
- var FormLabel2 = import_styled_components5.default.label`
938
+ var FormLabel3 = import_styled_components6.default.label`
852
939
  font-family: ${theme.fonts.primary};
853
940
  font-style: normal;
854
941
  font-weight: 500;
@@ -858,7 +945,7 @@ var FormLabel2 = import_styled_components5.default.label`
858
945
  margin-bottom: 0.5rem;
859
946
  text-align: left;
860
947
  `;
861
- var StyledPhoneInput = (0, import_styled_components5.default)(import_react_international_phone.PhoneInput)`
948
+ var StyledPhoneInput = (0, import_styled_components6.default)(import_react_international_phone.PhoneInput)`
862
949
  width: 100%;
863
950
  height: 3.125rem;
864
951
  background: ${(props) => props.$backgroundColor || theme.colors.white};
@@ -972,24 +1059,24 @@ var StyledPhoneInput = (0, import_styled_components5.default)(import_react_inter
972
1059
  }
973
1060
  }
974
1061
  `;
975
- var FormErrorMessage2 = import_styled_components5.default.small`
1062
+ var FormErrorMessage3 = import_styled_components6.default.small`
976
1063
  font-size: 0.75rem;
977
1064
  line-height: 1.125rem;
978
1065
  color: ${theme.colors.red};
979
1066
  margin-top: 0.25rem;
980
1067
  display: block;
981
1068
  `;
982
- var FormControl2 = import_styled_components5.default.div.withConfig({
1069
+ var FormControl3 = import_styled_components6.default.div.withConfig({
983
1070
  shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
984
1071
  })`
985
- ${FormLabel2} {
986
- ${(props) => props.isInvalid && import_styled_components5.css`
1072
+ ${FormLabel3} {
1073
+ ${(props) => props.isInvalid && import_styled_components6.css`
987
1074
  color: ${theme.colors.red};
988
1075
  `};
989
1076
  }
990
1077
 
991
1078
  ${StyledPhoneInput} {
992
- ${(props) => props.isInvalid && import_styled_components5.css`
1079
+ ${(props) => props.isInvalid && import_styled_components6.css`
993
1080
  border: 1px solid ${theme.colors.red};
994
1081
 
995
1082
  &:not(:focus)::placeholder {
@@ -999,7 +1086,7 @@ var FormControl2 = import_styled_components5.default.div.withConfig({
999
1086
  `};
1000
1087
 
1001
1088
  .react-international-phone-input-container {
1002
- ${(props) => props.isInvalid && import_styled_components5.css`
1089
+ ${(props) => props.isInvalid && import_styled_components6.css`
1003
1090
  border: 1px solid ${theme.colors.red};
1004
1091
 
1005
1092
  &:not(:focus)::placeholder {
@@ -1010,7 +1097,7 @@ var FormControl2 = import_styled_components5.default.div.withConfig({
1010
1097
  }
1011
1098
 
1012
1099
  .react-international-phone-country-selector-button {
1013
- ${(props) => props.isInvalid && import_styled_components5.css`
1100
+ ${(props) => props.isInvalid && import_styled_components6.css`
1014
1101
  border-right: 1px solid ${theme.colors.red};
1015
1102
  `};
1016
1103
  }
@@ -1033,8 +1120,8 @@ var PhoneInputBase = ({
1033
1120
  value,
1034
1121
  ...rest
1035
1122
  }, ref) => {
1036
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(FormControl2, { isInvalid: !!error, children: [
1037
- !!label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormLabel2, { htmlFor: id, $textColor: labelTextColor, children: label }),
1123
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(FormControl3, { isInvalid: !!error, children: [
1124
+ !!label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormLabel3, { htmlFor: id, $textColor: labelTextColor, children: label }),
1038
1125
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1039
1126
  StyledPhoneInput,
1040
1127
  {
@@ -1069,101 +1156,13 @@ var PhoneInputBase = ({
1069
1156
  $textColor: inputTextColor
1070
1157
  }
1071
1158
  ),
1072
- !!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormErrorMessage2, { "data-testid": "error-message", children: typeof error === "string" ? error : error?.message })
1159
+ !!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormErrorMessage3, { "data-testid": "error-message", children: typeof error === "string" ? error : error?.message })
1073
1160
  ] });
1074
1161
  };
1075
1162
  var PhoneInput2 = (0, import_react5.forwardRef)(PhoneInputBase);
1076
1163
 
1077
1164
  // src/components/ProductSelect/index.tsx
1078
1165
  var import_react6 = require("react");
1079
-
1080
- // src/components/ProductSelect/styles.ts
1081
- var import_styled_components6 = __toESM(require("styled-components"), 1);
1082
- var FormLabel3 = import_styled_components6.default.label`
1083
- font-family: ${theme.fonts.primary};
1084
- font-style: normal;
1085
- font-weight: 500;
1086
- font-size: 1rem;
1087
- color: ${(props) => props.$textColor || theme.colors.black};
1088
- display: block;
1089
- margin-bottom: 0.5rem;
1090
- text-align: left;
1091
- `;
1092
- var Select = import_styled_components6.default.select`
1093
- font-family: ${theme.fonts.primary};
1094
- font-style: normal;
1095
- font-weight: 500;
1096
- font-size: 1rem;
1097
- line-height: 1.5rem;
1098
- background: ${(props) => props.$backgroundColor || theme.colors.white};
1099
- color: ${(props) => props.$textColor || theme.colors.black};
1100
- padding: 0.5rem 3rem 0.5rem 0.5rem; /* Aumentado padding-right para 3rem */
1101
- border-radius: 0.125rem;
1102
- border: 1px solid ${(props) => props.$borderColor || theme.colors.transparent};
1103
- display: block;
1104
- height: 3.125rem;
1105
- width: 100%;
1106
- cursor: pointer;
1107
-
1108
- /* Remover a seta padrão do navegador */
1109
- -webkit-appearance: none;
1110
- -moz-appearance: none;
1111
- appearance: none;
1112
-
1113
- /* Adicionar seta personalizada maior */
1114
- 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");
1115
- background-repeat: no-repeat;
1116
- background-position: right 1rem center; /* Posicionado a 1rem da direita */
1117
- background-size: 1.25rem; /* Tamanho da seta aumentado para 1.25rem */
1118
-
1119
- &:focus {
1120
- border-radius: 0.125rem;
1121
- border: 2px solid ${(props) => props.$focusBorderColor || theme.colors.yellow500};
1122
- outline: none;
1123
- }
1124
-
1125
- /* Estilo para option disabled (placeholder) */
1126
- option:disabled {
1127
- color: ${theme.colors.gray100};
1128
- font-weight: 800;
1129
- }
1130
-
1131
- /* Estilo para options normais */
1132
- option:not(:disabled) {
1133
- color: ${(props) => props.$textColor || theme.colors.black};
1134
- font-weight: 500;
1135
- }
1136
- `;
1137
- var FormErrorMessage3 = import_styled_components6.default.small`
1138
- font-size: 0.75rem;
1139
- line-height: 1.125rem;
1140
- color: ${theme.colors.red};
1141
- margin-top: 0.25rem;
1142
- display: block;
1143
- `;
1144
- var FormControl3 = import_styled_components6.default.div.withConfig({
1145
- shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
1146
- })`
1147
- ${FormLabel3} {
1148
- ${(props) => props.isInvalid && import_styled_components6.css`
1149
- color: ${theme.colors.red};
1150
- `};
1151
- }
1152
-
1153
- ${Select} {
1154
- ${(props) => props.isInvalid && import_styled_components6.css`
1155
- border: 1px solid ${theme.colors.red};
1156
- `};
1157
-
1158
- &:focus {
1159
- ${(props) => props.isInvalid && import_styled_components6.css`
1160
- border: 1px solid ${theme.colors.red};
1161
- `};
1162
- }
1163
- }
1164
- `;
1165
-
1166
- // src/components/ProductSelect/index.tsx
1167
1166
  var import_jsx_runtime5 = require("react/jsx-runtime");
1168
1167
  var ProductSelectBase = ({
1169
1168
  id,
@@ -1179,8 +1178,8 @@ var ProductSelectBase = ({
1179
1178
  placeholder = "Selecione um produto",
1180
1179
  ...rest
1181
1180
  }, ref) => {
1182
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(FormControl3, { isInvalid: !!error, children: [
1183
- !!label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FormLabel3, { htmlFor: id, $textColor: labelTextColor, children: label }),
1181
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(FormControl, { isInvalid: !!error, children: [
1182
+ !!label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FormLabel, { htmlFor: id, $textColor: labelTextColor, children: label }),
1184
1183
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1185
1184
  Select,
1186
1185
  {
@@ -1198,7 +1197,7 @@ var ProductSelectBase = ({
1198
1197
  ]
1199
1198
  }
1200
1199
  ),
1201
- !!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FormErrorMessage3, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
1200
+ !!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FormErrorMessage, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
1202
1201
  ] });
1203
1202
  };
1204
1203
  var ProductSelect = (0, import_react6.forwardRef)(ProductSelectBase);
@@ -1206,6 +1205,12 @@ var ProductSelect = (0, import_react6.forwardRef)(ProductSelectBase);
1206
1205
  // src/components/Form/index.tsx
1207
1206
  var import_jsx_runtime6 = require("react/jsx-runtime");
1208
1207
  var phoneUtil = import_google_libphonenumber.PhoneNumberUtil.getInstance();
1208
+ var PreferenciaContato = /* @__PURE__ */ ((PreferenciaContato2) => {
1209
+ PreferenciaContato2["Whatsapp"] = "Whatsapp";
1210
+ PreferenciaContato2["Email"] = "Email";
1211
+ PreferenciaContato2["Ligacao"] = "Liga\xE7\xE3o";
1212
+ return PreferenciaContato2;
1213
+ })(PreferenciaContato || {});
1209
1214
  var isPhoneValid = (phone) => {
1210
1215
  try {
1211
1216
  return phoneUtil.isValidNumber(phoneUtil.parseAndKeepRawInput(phone));
@@ -1252,6 +1257,7 @@ var MitreFormComponent = import_react7.default.forwardRef(({
1252
1257
  inputFocusBorderColor = theme.colors.yellow500,
1253
1258
  inputPlaceholderColor = theme.colors.gray100,
1254
1259
  inputTextColor = theme.colors.black,
1260
+ showPreferenciaContato = false,
1255
1261
  onSuccess,
1256
1262
  onError
1257
1263
  }, ref) => {
@@ -1320,7 +1326,7 @@ var MitreFormComponent = import_react7.default.forwardRef(({
1320
1326
  setFormKey((k) => k + 1);
1321
1327
  };
1322
1328
  const sendMessage = async (data) => {
1323
- const { name, email, phone, productId } = data;
1329
+ const { name, email, phone, productId, preferencia_contato } = data;
1324
1330
  const phoneValue = phone.inputValue;
1325
1331
  const phoneDigitsOnly = phoneValue?.replace(/\D/g, "") || "";
1326
1332
  const message = "Gostaria de mais informa\xE7\xF5es sobre o produto";
@@ -1351,7 +1357,8 @@ var MitreFormComponent = import_react7.default.forwardRef(({
1351
1357
  utm_source: utm.utm_source,
1352
1358
  utm_campaign: utm.utm_campaign,
1353
1359
  utm_medium: utm.utm_medium,
1354
- utm_term: utm.utm_term
1360
+ utm_term: utm.utm_term,
1361
+ ...showPreferenciaContato && preferencia_contato ? { preferencia_contato } : {}
1355
1362
  };
1356
1363
  const response = await fetch(`${apiUrl}/leads`, {
1357
1364
  method: "POST",
@@ -1497,6 +1504,26 @@ var MitreFormComponent = import_react7.default.forwardRef(({
1497
1504
  },
1498
1505
  formKey
1499
1506
  ),
1507
+ showPreferenciaContato && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(FormControl, { isInvalid: !!errors.preferencia_contato, children: [
1508
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormLabel, { htmlFor: "preferencia_contato", $textColor: textColor, children: "Prefer\xEAncia de Contato" }),
1509
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1510
+ Select,
1511
+ {
1512
+ id: "preferencia_contato",
1513
+ ...register("preferencia_contato"),
1514
+ defaultValue: "",
1515
+ $backgroundColor: inputBackgroundColor,
1516
+ $borderColor: inputBorderColor,
1517
+ $focusBorderColor: inputFocusBorderColor,
1518
+ $textColor: inputTextColor,
1519
+ children: [
1520
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", disabled: true, children: "Selecione uma op\xE7\xE3o" }),
1521
+ Object.values(PreferenciaContato).map((op) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: op, children: op }, op))
1522
+ ]
1523
+ }
1524
+ ),
1525
+ errors.preferencia_contato && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormErrorMessage, { children: errors.preferencia_contato.message })
1526
+ ] }),
1500
1527
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h6", { children: "* Campos de preenchimento obrigat\xF3rio." }),
1501
1528
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ButtonContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button2, { bgColor: buttonBackgroundColor, color: buttonTextColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
1502
1529
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { children: [
@@ -1525,6 +1552,7 @@ MitreFormComponent.displayName = "MitreFormComponent";
1525
1552
  var Form_default = MitreFormComponent;
1526
1553
  // Annotate the CommonJS export names for ESM import in node:
1527
1554
  0 && (module.exports = {
1528
- MitreFormComponent
1555
+ MitreFormComponent,
1556
+ PreferenciaContato
1529
1557
  });
1530
1558
  //# sourceMappingURL=index.cjs.map