mitre-form-component 0.0.37 → 0.0.39

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
@@ -47,11 +47,17 @@ import { MitreFormComponent } from "mitre-form-component-next";
47
47
  utm_medium="cpc" //[Opcional] Apenas um exemplo. Definir com MKT ou extrair da URL
48
48
  utm_campaign="mitre" //[Opcional] Apenas um exemplo. Definir com MKT ou extrair da URL
49
49
  utm_term="mitre" //[Opcional] Apenas um exemplo. Definir com MKT ou extrair da URL
50
- showHeader={true} //[Opcional]
51
- colorPrimary="#FF5733" //[Opcional]
52
- textColor="#ffffff" //[Opcional]
53
- backgroundColor="#000" //[Opcional]
50
+ showHeader={true} //[Opcional] Se irá exibir ou não o cabeçalho com "Atendimento por Mensagem - Informe seus dados e retornaremos a mensagem."
51
+ backgroundColor="#000" //[Opcional]
52
+ textColor="#ffffff" //[Opcional]
53
+ buttonBackgroundColor="#FF5733"
54
+ buttonTextColor="#FFF" // [Opcional]
54
55
  innerPadding="0.2rem" //[Opcional]
56
+ inputBackgroundColor="#000" //[Opcional]
57
+ inputBorderColor="#000" //[Opcional]
58
+ inputFocusBorderColor="#76B" //[Opcional]
59
+ inputPlaceholderColor="#FFF" //[Opcional]
60
+ inputTextColor="#FFF" //[Opcional]
55
61
  />;
56
62
  ```
57
63
 
@@ -102,10 +108,16 @@ O `MitreFormComponent` aceita as seguintes props:
102
108
  - **`utm_campaign`** (opcional, string): Parâmetro UTM de nome da campanha (ex: `'mitre'`).
103
109
  - **`utm_term`** (opcional, string): Parâmetro UTM de termo da campanha (ex: `'mitre'`).
104
110
  - **`showHeader`** (opcional, boolean): Controla se o cabeçalho será mostrado. Padrão: `false`.
105
- - **`colorPrimary`** (opcional, string): Cor primária do componente. Exemplo: `#FF5733`.
106
- - **`textColor`** (opcional, string): Cor do texto do componente. Exemplo: `#ffffff`.
107
- - **`backgroundColor`** (opcional, string): Cor do fundo do componente. Exemplo: `#CECECE`.
108
- - **`innerPadding`** (opcional, string): Espaçamento interno do componente. Exemplo: `1rem`.
111
+ - **`backgroundColor`** (opcional, string): Cor de fundo do formulário. Padrão: `#CECECE`.
112
+ - **`textColor`** (opcional, string): Cor dos textos do cabeçalho, do label dos inputs e do texto de privacidade. Padrão: `#2F2F2F`.
113
+ - **`buttonBackgroundColor`** (opcional, string): Define a cor de fundo do botão. Padrão: `#F6C76B`.
114
+ - **`buttonTextColor`** (opcional, string): Define a cor do texto do botão. Padrão: `#2F2F2F`.
115
+ - **`innerPadding`** (opcional, string): Espaçamento interno do componente com relação às bordas. Padrão `1rem`.
116
+ - **`inputBackgroundColor`** (opcional, string): Cor de fundo do input. Padrão: `#FFF`.
117
+ - **`inputBorderColor`** (opcional, string): Cor da borda do input. Padrão: `transparent`.
118
+ - **`inputFocusBorderColor`** (opcional, string): Cor da borda do input quando selecionado. Padrão: `#F6C76B`.
119
+ - **`inputPlaceholderColor`** (opcional, string): Cor do placeholder do input. Padrão: `#B6B6B6`.
120
+ - **`inputTextColor`** (opcional, string): Cor do texto do input. Padrão: `#2F2F2F`.
109
121
 
110
122
  ---
111
123
 
package/dist/index.cjs CHANGED
@@ -85,7 +85,7 @@ var FormContainer = import_styled_components.default.div`
85
85
  overflow-x: hidden;
86
86
  overflow-y: auto;
87
87
 
88
- background: ${(props) => props.$backgroundColor || " #cecece"};
88
+ background: ${(props) => props.$backgroundColor || "var(--gray-180)"};
89
89
 
90
90
  padding: ${(props) => props.$innerPadding || "1rem"};
91
91
 
@@ -128,7 +128,6 @@ var Form = import_styled_components.default.form`
128
128
  }
129
129
 
130
130
  input {
131
- background: white;
132
131
  margin-bottom: 0.75rem;
133
132
  }
134
133
 
@@ -196,6 +195,7 @@ var GlobalStyles = import_styled_components2.createGlobalStyle`
196
195
  --gray-60: #8F8F8F;
197
196
  --gray-100: #B6B6B6;
198
197
  --gray-150: #B9B9B9;
198
+ --gray-180: #CECECE;
199
199
  --gray-200: #D2D2D2;
200
200
  --gray-300: #EBEBEB;
201
201
  --gray-400: #ECECEC;
@@ -208,6 +208,8 @@ var GlobalStyles = import_styled_components2.createGlobalStyle`
208
208
  --green:#57C06E;
209
209
  --green-2:#2DCE68;
210
210
  --blue:#007BFF;
211
+
212
+ --transparent: transparent;
211
213
  }
212
214
 
213
215
  * {
@@ -394,33 +396,33 @@ var Input = import_styled_components3.default.input`
394
396
  font-weight: 500;
395
397
  font-size: 1rem;
396
398
  line-height: 1.5rem;
397
- background: var(--gray-500);
398
- color: var(--black);
399
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
400
+ color: ${(props) => props.$textColor || "var(--black)"};
399
401
  padding: 0.5rem;
400
402
  border-radius: 0.125rem;
401
- border: 1px solid transparent;
403
+ border: 1px solid ${(props) => props.$borderColor || "transparent"};
402
404
  display: block;
403
405
  height: 3.125rem;
404
406
  width: 100%;
405
407
 
406
408
  &:focus {
407
409
  border-radius: 0.125rem;
408
- border: 2px solid ${(props) => props.$bordercolor || "var(--yellow-500)"};
410
+ border: 2px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
409
411
  outline: none;
410
412
  }
411
413
 
412
414
  &::placeholder {
413
415
  font-size: 1rem;
414
416
  line-height: 1.5rem;
415
- color: #b6b6b6;
417
+ color: ${(props) => props.$placeholderColor || "var(--gray-100)"};
416
418
  font-weight: 800;
417
419
  }
418
420
 
419
421
  /* Autofill styles */
420
422
  &:-webkit-autofill {
421
- background: var(--gray-500) !important;
422
- color: var(--black) !important;
423
- -webkit-text-fill-color: var(--black) !important;
423
+ background: ${(props) => props.$backgroundColor || "var(--white)"} !important;
424
+ color: ${(props) => props.$textColor || "var(--black)"} !important;
425
+ -webkit-text-fill-color: ${(props) => props.$textColor || "var(--black)"} !important;
424
426
  transition: background-color 5000s ease-in-out 0s; /* Prevent flashing */
425
427
  }
426
428
 
@@ -466,7 +468,21 @@ var FormControl = import_styled_components3.default.div.withConfig({
466
468
 
467
469
  // src/components/Input/index.tsx
468
470
  var import_jsx_runtime = require("react/jsx-runtime");
469
- var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textColor, mask = "", type = "text", ...rest }, ref) => {
471
+ var InputBase = ({
472
+ id,
473
+ label,
474
+ error,
475
+ showErrorMessage = true,
476
+ labelTextColor,
477
+ backgroundColor,
478
+ borderColor,
479
+ focusBorderColor,
480
+ inputPlaceholderColor,
481
+ inputTextColor,
482
+ mask = "",
483
+ type = "text",
484
+ ...rest
485
+ }, ref) => {
470
486
  const handleKeyUp = (0, import_react3.useCallback)(
471
487
  (e) => {
472
488
  if (mask === "cep") cep(e);
@@ -477,16 +493,20 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
477
493
  [mask]
478
494
  );
479
495
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormControl, { isInvalid: !!error, children: [
480
- !!label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormLabel, { htmlFor: id, $textColor: textColor, children: label }),
496
+ !!label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormLabel, { htmlFor: id, $textColor: labelTextColor, children: label }),
481
497
  !mask ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
482
498
  Input,
483
499
  {
484
500
  id,
485
501
  ref,
486
502
  type,
487
- $bordercolor: borderColor,
488
503
  "aria-invalid": !!error && showErrorMessage ? "true" : "false",
489
504
  autoComplete: rest.autoComplete || "on",
505
+ $backgroundColor: backgroundColor,
506
+ $borderColor: borderColor,
507
+ $focusBorderColor: focusBorderColor,
508
+ $placeholderColor: inputPlaceholderColor,
509
+ $textColor: inputTextColor,
490
510
  ...rest
491
511
  }
492
512
  ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -495,10 +515,14 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
495
515
  id,
496
516
  ref,
497
517
  type,
498
- $bordercolor: borderColor,
499
518
  "aria-invalid": !!error && showErrorMessage ? "true" : "false",
500
- onKeyUp: handleKeyUp,
501
519
  autoComplete: rest.autoComplete || "on",
520
+ onKeyUp: handleKeyUp,
521
+ $backgroundColor: backgroundColor,
522
+ $borderColor: borderColor,
523
+ $focusBorderColor: focusBorderColor,
524
+ $placeholderColor: inputPlaceholderColor,
525
+ $textColor: inputTextColor,
502
526
  ...rest
503
527
  }
504
528
  ),
@@ -639,7 +663,7 @@ function Button2({
639
663
  isSubmitting = false,
640
664
  submittingMessage = "",
641
665
  disabled = false,
642
- color = "#2F2F2F",
666
+ color = "var(--black)",
643
667
  ...rest
644
668
  }) {
645
669
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -814,13 +838,19 @@ var FormLabel2 = import_styled_components6.default.label`
814
838
  var StyledPhoneInput = (0, import_styled_components6.default)(import_react_international_phone.PhoneInput)`
815
839
  width: 100%;
816
840
  height: 3.125rem;
817
- background: var(--gray-500);
841
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
818
842
  font-family: "Montserrat", sans-serif;
843
+ border: 1px solid ${(props) => props.$borderColor || "transparent"};
844
+ border-radius: 0.125rem;
819
845
 
820
846
  &:focus-within {
821
847
  border-radius: 0.125rem;
822
- border: 2px solid ${(props) => props.$bordercolor || "var(--yellow-500)"};
848
+ border: 2px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
823
849
  outline: none;
850
+
851
+ .react-international-phone-country-selector-button {
852
+ border-right: 1px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
853
+ }
824
854
  }
825
855
 
826
856
  /* Style for the inner phone input container */
@@ -833,14 +863,14 @@ var StyledPhoneInput = (0, import_styled_components6.default)(import_react_inter
833
863
  font-family: "Montserrat", sans-serif;
834
864
  font-size: 1rem;
835
865
  font-weight: 500;
836
- color: var(--black);
837
- background: var(--white);
866
+ color: ${(props) => props.$textColor || "var(--black)"};
867
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
838
868
  }
839
869
 
840
870
  /* Style for the country selector button */
841
871
  .react-international-phone-country-selector-button {
842
872
  height: 100%;
843
- background: var(--white);
873
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
844
874
  display: flex;
845
875
  align-items: center;
846
876
  justify-content: center;
@@ -850,7 +880,7 @@ var StyledPhoneInput = (0, import_styled_components6.default)(import_react_inter
850
880
  cursor: pointer;
851
881
  outline: none;
852
882
  border: none;
853
- border-right: 2px solid var(--gray-300);
883
+ border-right: 1px solid ${(props) => props.$borderColor || "var(--transparent)"};
854
884
  }
855
885
 
856
886
  /* Style for the input itself */
@@ -859,13 +889,13 @@ var StyledPhoneInput = (0, import_styled_components6.default)(import_react_inter
859
889
  height: 100%;
860
890
  padding: 0 0.5rem;
861
891
  margin: 0;
862
- background: var(--white);
892
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
863
893
  font-family: "Montserrat", sans-serif;
864
894
  font-style: normal;
865
895
  font-weight: 500;
866
896
  font-size: 1rem;
867
897
  line-height: 1.5rem;
868
- color: var(--black);
898
+ color: ${(props) => props.$textColor || "var(--black)"};
869
899
  outline: none;
870
900
  border: none;
871
901
  border-radius: 0.125rem;
@@ -873,13 +903,13 @@ var StyledPhoneInput = (0, import_styled_components6.default)(import_react_inter
873
903
  &::placeholder {
874
904
  font-size: 1rem;
875
905
  line-height: 1.5rem;
876
- color: #b6b6b6;
906
+ color: ${(props) => props.$placeholderColor || "var(--gray-100)"};
877
907
  font-weight: 800;
878
908
  }
879
909
 
880
910
  &:-webkit-autofill {
881
- background: var(--gray-500) !important;
882
- -webkit-text-fill-color: var(--black) !important;
911
+ background: ${(props) => props.$backgroundColor || "var(--white)"} !important;
912
+ -webkit-text-fill-color: ${(props) => props.$textColor || "var(--black)"} !important;
883
913
  transition: background-color 5000s ease-in-out 0s;
884
914
  }
885
915
 
@@ -926,14 +956,33 @@ var FormControl2 = import_styled_components6.default.div.withConfig({
926
956
  }
927
957
  `};
928
958
  }
959
+
960
+ .react-international-phone-country-selector-button {
961
+ ${(props) => props.isInvalid && import_styled_components6.css`
962
+ border-right: 1px solid var(--red);
963
+ `};
964
+ }
929
965
  }
930
966
  `;
931
967
 
932
968
  // src/components/PhoneInput/index.tsx
933
969
  var import_jsx_runtime4 = require("react/jsx-runtime");
934
- var PhoneInputBase = ({ id, label, error, showErrorMessage = true, borderColor, textColor, value, ...rest }, ref) => {
970
+ var PhoneInputBase = ({
971
+ id,
972
+ label,
973
+ error,
974
+ showErrorMessage = true,
975
+ labelTextColor,
976
+ backgroundColor,
977
+ borderColor,
978
+ focusBorderColor,
979
+ inputPlaceholderColor,
980
+ inputTextColor,
981
+ value,
982
+ ...rest
983
+ }, ref) => {
935
984
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(FormControl2, { isInvalid: !!error, children: [
936
- !!label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormLabel2, { htmlFor: id, $textColor: textColor, children: label }),
985
+ !!label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormLabel2, { htmlFor: id, $textColor: labelTextColor, children: label }),
937
986
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
938
987
  StyledPhoneInput,
939
988
  {
@@ -942,7 +991,6 @@ var PhoneInputBase = ({ id, label, error, showErrorMessage = true, borderColor,
942
991
  disableCountryGuess: true,
943
992
  disableDialCodeAndPrefix: true,
944
993
  showDisabledDialCodeAndPrefix: false,
945
- $bordercolor: borderColor,
946
994
  placeholder: rest.placeholder,
947
995
  "aria-invalid": !!error && showErrorMessage ? "true" : "false",
948
996
  value: String(value),
@@ -961,7 +1009,12 @@ var PhoneInputBase = ({ id, label, error, showErrorMessage = true, borderColor,
961
1009
  required: rest.required,
962
1010
  autoFocus: rest.autoFocus,
963
1011
  autoComplete: rest.autoComplete || "tel"
964
- }
1012
+ },
1013
+ $backgroundColor: backgroundColor,
1014
+ $borderColor: borderColor,
1015
+ $focusBorderColor: focusBorderColor,
1016
+ $placeholderColor: inputPlaceholderColor,
1017
+ $textColor: inputTextColor
965
1018
  }
966
1019
  ),
967
1020
  !!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormErrorMessage2, { "data-testid": "error-message", children: typeof error === "string" ? error : error?.message })
@@ -1005,10 +1058,16 @@ var MitreFormComponent = import_react6.default.forwardRef(({
1005
1058
  utm_campaign,
1006
1059
  utm_term,
1007
1060
  showHeader = true,
1008
- colorPrimary = "#F6C76B",
1009
- textColor = "#2F2F2F",
1010
- backgroundColor = "#CECECE",
1011
- innerPadding = "1rem"
1061
+ backgroundColor = "var(--gray-180)",
1062
+ textColor = "var(--black)",
1063
+ buttonBackgroundColor = "#F6C76B",
1064
+ buttonTextColor = "var(--black)",
1065
+ innerPadding = "1rem",
1066
+ inputBackgroundColor = "var(--white)",
1067
+ inputBorderColor = "var(--transparent)",
1068
+ inputFocusBorderColor = "var(--yellow-500)",
1069
+ inputPlaceholderColor = "var(--gray-100)",
1070
+ inputTextColor = "var(--black)"
1012
1071
  }, ref) => {
1013
1072
  const [loading, setIsLoading] = (0, import_react6.useState)(false);
1014
1073
  const { error, handleError, clearError } = useError();
@@ -1112,11 +1171,15 @@ var MitreFormComponent = import_react6.default.forwardRef(({
1112
1171
  label: "Nome *",
1113
1172
  placeholder: "Digite seu nome",
1114
1173
  ...register("name"),
1115
- borderColor: colorPrimary,
1116
- textColor,
1117
1174
  error: errors.name?.message,
1118
1175
  autoComplete: "name",
1119
- required: true
1176
+ required: true,
1177
+ labelTextColor: textColor,
1178
+ backgroundColor: inputBackgroundColor,
1179
+ borderColor: inputBorderColor,
1180
+ focusBorderColor: inputFocusBorderColor,
1181
+ inputPlaceholderColor,
1182
+ inputTextColor
1120
1183
  }
1121
1184
  ),
1122
1185
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1127,11 +1190,15 @@ var MitreFormComponent = import_react6.default.forwardRef(({
1127
1190
  type: "email",
1128
1191
  placeholder: "exemplo@email.com",
1129
1192
  ...register("email"),
1130
- borderColor: colorPrimary,
1131
- textColor,
1132
1193
  error: errors.email?.message,
1133
1194
  autoComplete: "email",
1134
- required: true
1195
+ required: true,
1196
+ labelTextColor: textColor,
1197
+ backgroundColor: inputBackgroundColor,
1198
+ borderColor: inputBorderColor,
1199
+ focusBorderColor: inputFocusBorderColor,
1200
+ inputPlaceholderColor,
1201
+ inputTextColor
1135
1202
  }
1136
1203
  ),
1137
1204
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1149,13 +1216,17 @@ var MitreFormComponent = import_react6.default.forwardRef(({
1149
1216
  id: "phone",
1150
1217
  label: "Telefone *",
1151
1218
  placeholder: "(11) 00000-0000",
1152
- borderColor: colorPrimary,
1153
- textColor,
1154
1219
  error: errorMsg,
1155
1220
  required: true,
1156
1221
  value: field.value.phone,
1157
1222
  onChange: field.onChange,
1158
- name: field.name
1223
+ name: field.name,
1224
+ labelTextColor: textColor,
1225
+ backgroundColor: inputBackgroundColor,
1226
+ borderColor: inputBorderColor,
1227
+ focusBorderColor: inputFocusBorderColor,
1228
+ inputPlaceholderColor,
1229
+ inputTextColor
1159
1230
  }
1160
1231
  );
1161
1232
  }
@@ -1163,7 +1234,7 @@ var MitreFormComponent = import_react6.default.forwardRef(({
1163
1234
  formKey
1164
1235
  ),
1165
1236
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h6", { children: "* Campos de preenchimento obrigat\xF3rio." }),
1166
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ButtonContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button2, { bgColor: colorPrimary, color: textColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
1237
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ButtonContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button2, { bgColor: buttonBackgroundColor, color: buttonTextColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
1167
1238
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
1168
1239
  "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",
1169
1240
  " ",