mitre-form-component 0.0.38 → 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/dist/index.d.cts CHANGED
@@ -9,10 +9,16 @@ interface MitreFormComponentProps {
9
9
  utm_campaign?: string;
10
10
  utm_term?: string;
11
11
  showHeader?: boolean;
12
- colorPrimary?: string;
13
- textColor?: string;
14
12
  backgroundColor?: string;
13
+ buttonBackgroundColor?: string;
14
+ buttonTextColor?: string;
15
+ textColor?: string;
15
16
  innerPadding?: string;
17
+ inputBackgroundColor?: string;
18
+ inputFocusBorderColor?: string;
19
+ inputBorderColor?: string;
20
+ inputTextColor?: string;
21
+ inputPlaceholderColor?: string;
16
22
  }
17
23
  declare const MitreFormComponent: React.ForwardRefExoticComponent<MitreFormComponentProps & React.RefAttributes<HTMLDivElement>>;
18
24
 
package/dist/index.d.ts CHANGED
@@ -9,10 +9,16 @@ interface MitreFormComponentProps {
9
9
  utm_campaign?: string;
10
10
  utm_term?: string;
11
11
  showHeader?: boolean;
12
- colorPrimary?: string;
13
- textColor?: string;
14
12
  backgroundColor?: string;
13
+ buttonBackgroundColor?: string;
14
+ buttonTextColor?: string;
15
+ textColor?: string;
15
16
  innerPadding?: string;
17
+ inputBackgroundColor?: string;
18
+ inputFocusBorderColor?: string;
19
+ inputBorderColor?: string;
20
+ inputTextColor?: string;
21
+ inputPlaceholderColor?: string;
16
22
  }
17
23
  declare const MitreFormComponent: React.ForwardRefExoticComponent<MitreFormComponentProps & React.RefAttributes<HTMLDivElement>>;
18
24
 
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ var FormContainer = styled.div`
49
49
  overflow-x: hidden;
50
50
  overflow-y: auto;
51
51
 
52
- background: ${(props) => props.$backgroundColor || " #cecece"};
52
+ background: ${(props) => props.$backgroundColor || "var(--gray-180)"};
53
53
 
54
54
  padding: ${(props) => props.$innerPadding || "1rem"};
55
55
 
@@ -92,7 +92,6 @@ var Form = styled.form`
92
92
  }
93
93
 
94
94
  input {
95
- background: white;
96
95
  margin-bottom: 0.75rem;
97
96
  }
98
97
 
@@ -160,6 +159,7 @@ var GlobalStyles = createGlobalStyle`
160
159
  --gray-60: #8F8F8F;
161
160
  --gray-100: #B6B6B6;
162
161
  --gray-150: #B9B9B9;
162
+ --gray-180: #CECECE;
163
163
  --gray-200: #D2D2D2;
164
164
  --gray-300: #EBEBEB;
165
165
  --gray-400: #ECECEC;
@@ -172,6 +172,8 @@ var GlobalStyles = createGlobalStyle`
172
172
  --green:#57C06E;
173
173
  --green-2:#2DCE68;
174
174
  --blue:#007BFF;
175
+
176
+ --transparent: transparent;
175
177
  }
176
178
 
177
179
  * {
@@ -361,33 +363,33 @@ var Input = styled2.input`
361
363
  font-weight: 500;
362
364
  font-size: 1rem;
363
365
  line-height: 1.5rem;
364
- background: var(--gray-500);
365
- color: var(--black);
366
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
367
+ color: ${(props) => props.$textColor || "var(--black)"};
366
368
  padding: 0.5rem;
367
369
  border-radius: 0.125rem;
368
- border: 1px solid transparent;
370
+ border: 1px solid ${(props) => props.$borderColor || "transparent"};
369
371
  display: block;
370
372
  height: 3.125rem;
371
373
  width: 100%;
372
374
 
373
375
  &:focus {
374
376
  border-radius: 0.125rem;
375
- border: 2px solid ${(props) => props.$bordercolor || "var(--yellow-500)"};
377
+ border: 2px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
376
378
  outline: none;
377
379
  }
378
380
 
379
381
  &::placeholder {
380
382
  font-size: 1rem;
381
383
  line-height: 1.5rem;
382
- color: #b6b6b6;
384
+ color: ${(props) => props.$placeholderColor || "var(--gray-100)"};
383
385
  font-weight: 800;
384
386
  }
385
387
 
386
388
  /* Autofill styles */
387
389
  &:-webkit-autofill {
388
- background: var(--gray-500) !important;
389
- color: var(--black) !important;
390
- -webkit-text-fill-color: var(--black) !important;
390
+ background: ${(props) => props.$backgroundColor || "var(--white)"} !important;
391
+ color: ${(props) => props.$textColor || "var(--black)"} !important;
392
+ -webkit-text-fill-color: ${(props) => props.$textColor || "var(--black)"} !important;
391
393
  transition: background-color 5000s ease-in-out 0s; /* Prevent flashing */
392
394
  }
393
395
 
@@ -433,7 +435,21 @@ var FormControl = styled2.div.withConfig({
433
435
 
434
436
  // src/components/Input/index.tsx
435
437
  import { jsx, jsxs } from "react/jsx-runtime";
436
- var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textColor, mask = "", type = "text", ...rest }, ref) => {
438
+ var InputBase = ({
439
+ id,
440
+ label,
441
+ error,
442
+ showErrorMessage = true,
443
+ labelTextColor,
444
+ backgroundColor,
445
+ borderColor,
446
+ focusBorderColor,
447
+ inputPlaceholderColor,
448
+ inputTextColor,
449
+ mask = "",
450
+ type = "text",
451
+ ...rest
452
+ }, ref) => {
437
453
  const handleKeyUp = useCallback(
438
454
  (e) => {
439
455
  if (mask === "cep") cep(e);
@@ -444,16 +460,20 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
444
460
  [mask]
445
461
  );
446
462
  return /* @__PURE__ */ jsxs(FormControl, { isInvalid: !!error, children: [
447
- !!label && /* @__PURE__ */ jsx(FormLabel, { htmlFor: id, $textColor: textColor, children: label }),
463
+ !!label && /* @__PURE__ */ jsx(FormLabel, { htmlFor: id, $textColor: labelTextColor, children: label }),
448
464
  !mask ? /* @__PURE__ */ jsx(
449
465
  Input,
450
466
  {
451
467
  id,
452
468
  ref,
453
469
  type,
454
- $bordercolor: borderColor,
455
470
  "aria-invalid": !!error && showErrorMessage ? "true" : "false",
456
471
  autoComplete: rest.autoComplete || "on",
472
+ $backgroundColor: backgroundColor,
473
+ $borderColor: borderColor,
474
+ $focusBorderColor: focusBorderColor,
475
+ $placeholderColor: inputPlaceholderColor,
476
+ $textColor: inputTextColor,
457
477
  ...rest
458
478
  }
459
479
  ) : /* @__PURE__ */ jsx(
@@ -462,10 +482,14 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
462
482
  id,
463
483
  ref,
464
484
  type,
465
- $bordercolor: borderColor,
466
485
  "aria-invalid": !!error && showErrorMessage ? "true" : "false",
467
- onKeyUp: handleKeyUp,
468
486
  autoComplete: rest.autoComplete || "on",
487
+ onKeyUp: handleKeyUp,
488
+ $backgroundColor: backgroundColor,
489
+ $borderColor: borderColor,
490
+ $focusBorderColor: focusBorderColor,
491
+ $placeholderColor: inputPlaceholderColor,
492
+ $textColor: inputTextColor,
469
493
  ...rest
470
494
  }
471
495
  ),
@@ -606,7 +630,7 @@ function Button2({
606
630
  isSubmitting = false,
607
631
  submittingMessage = "",
608
632
  disabled = false,
609
- color = "#2F2F2F",
633
+ color = "var(--black)",
610
634
  ...rest
611
635
  }) {
612
636
  return /* @__PURE__ */ jsxs2(
@@ -783,13 +807,19 @@ var FormLabel2 = styled5.label`
783
807
  var StyledPhoneInput = styled5(PhoneInput)`
784
808
  width: 100%;
785
809
  height: 3.125rem;
786
- background: var(--gray-500);
810
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
787
811
  font-family: "Montserrat", sans-serif;
812
+ border: 1px solid ${(props) => props.$borderColor || "transparent"};
813
+ border-radius: 0.125rem;
788
814
 
789
815
  &:focus-within {
790
816
  border-radius: 0.125rem;
791
- border: 2px solid ${(props) => props.$bordercolor || "var(--yellow-500)"};
817
+ border: 2px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
792
818
  outline: none;
819
+
820
+ .react-international-phone-country-selector-button {
821
+ border-right: 1px solid ${(props) => props.$focusBorderColor || "var(--yellow-500)"};
822
+ }
793
823
  }
794
824
 
795
825
  /* Style for the inner phone input container */
@@ -802,14 +832,14 @@ var StyledPhoneInput = styled5(PhoneInput)`
802
832
  font-family: "Montserrat", sans-serif;
803
833
  font-size: 1rem;
804
834
  font-weight: 500;
805
- color: var(--black);
806
- background: var(--white);
835
+ color: ${(props) => props.$textColor || "var(--black)"};
836
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
807
837
  }
808
838
 
809
839
  /* Style for the country selector button */
810
840
  .react-international-phone-country-selector-button {
811
841
  height: 100%;
812
- background: var(--white);
842
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
813
843
  display: flex;
814
844
  align-items: center;
815
845
  justify-content: center;
@@ -819,7 +849,7 @@ var StyledPhoneInput = styled5(PhoneInput)`
819
849
  cursor: pointer;
820
850
  outline: none;
821
851
  border: none;
822
- border-right: 2px solid var(--gray-300);
852
+ border-right: 1px solid ${(props) => props.$borderColor || "var(--transparent)"};
823
853
  }
824
854
 
825
855
  /* Style for the input itself */
@@ -828,13 +858,13 @@ var StyledPhoneInput = styled5(PhoneInput)`
828
858
  height: 100%;
829
859
  padding: 0 0.5rem;
830
860
  margin: 0;
831
- background: var(--white);
861
+ background: ${(props) => props.$backgroundColor || "var(--white)"};
832
862
  font-family: "Montserrat", sans-serif;
833
863
  font-style: normal;
834
864
  font-weight: 500;
835
865
  font-size: 1rem;
836
866
  line-height: 1.5rem;
837
- color: var(--black);
867
+ color: ${(props) => props.$textColor || "var(--black)"};
838
868
  outline: none;
839
869
  border: none;
840
870
  border-radius: 0.125rem;
@@ -842,13 +872,13 @@ var StyledPhoneInput = styled5(PhoneInput)`
842
872
  &::placeholder {
843
873
  font-size: 1rem;
844
874
  line-height: 1.5rem;
845
- color: #b6b6b6;
875
+ color: ${(props) => props.$placeholderColor || "var(--gray-100)"};
846
876
  font-weight: 800;
847
877
  }
848
878
 
849
879
  &:-webkit-autofill {
850
- background: var(--gray-500) !important;
851
- -webkit-text-fill-color: var(--black) !important;
880
+ background: ${(props) => props.$backgroundColor || "var(--white)"} !important;
881
+ -webkit-text-fill-color: ${(props) => props.$textColor || "var(--black)"} !important;
852
882
  transition: background-color 5000s ease-in-out 0s;
853
883
  }
854
884
 
@@ -895,14 +925,33 @@ var FormControl2 = styled5.div.withConfig({
895
925
  }
896
926
  `};
897
927
  }
928
+
929
+ .react-international-phone-country-selector-button {
930
+ ${(props) => props.isInvalid && css4`
931
+ border-right: 1px solid var(--red);
932
+ `};
933
+ }
898
934
  }
899
935
  `;
900
936
 
901
937
  // src/components/PhoneInput/index.tsx
902
938
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
903
- var PhoneInputBase = ({ id, label, error, showErrorMessage = true, borderColor, textColor, value, ...rest }, ref) => {
939
+ var PhoneInputBase = ({
940
+ id,
941
+ label,
942
+ error,
943
+ showErrorMessage = true,
944
+ labelTextColor,
945
+ backgroundColor,
946
+ borderColor,
947
+ focusBorderColor,
948
+ inputPlaceholderColor,
949
+ inputTextColor,
950
+ value,
951
+ ...rest
952
+ }, ref) => {
904
953
  return /* @__PURE__ */ jsxs4(FormControl2, { isInvalid: !!error, children: [
905
- !!label && /* @__PURE__ */ jsx4(FormLabel2, { htmlFor: id, $textColor: textColor, children: label }),
954
+ !!label && /* @__PURE__ */ jsx4(FormLabel2, { htmlFor: id, $textColor: labelTextColor, children: label }),
906
955
  /* @__PURE__ */ jsx4(
907
956
  StyledPhoneInput,
908
957
  {
@@ -911,7 +960,6 @@ var PhoneInputBase = ({ id, label, error, showErrorMessage = true, borderColor,
911
960
  disableCountryGuess: true,
912
961
  disableDialCodeAndPrefix: true,
913
962
  showDisabledDialCodeAndPrefix: false,
914
- $bordercolor: borderColor,
915
963
  placeholder: rest.placeholder,
916
964
  "aria-invalid": !!error && showErrorMessage ? "true" : "false",
917
965
  value: String(value),
@@ -930,7 +978,12 @@ var PhoneInputBase = ({ id, label, error, showErrorMessage = true, borderColor,
930
978
  required: rest.required,
931
979
  autoFocus: rest.autoFocus,
932
980
  autoComplete: rest.autoComplete || "tel"
933
- }
981
+ },
982
+ $backgroundColor: backgroundColor,
983
+ $borderColor: borderColor,
984
+ $focusBorderColor: focusBorderColor,
985
+ $placeholderColor: inputPlaceholderColor,
986
+ $textColor: inputTextColor
934
987
  }
935
988
  ),
936
989
  !!error && showErrorMessage && /* @__PURE__ */ jsx4(FormErrorMessage2, { "data-testid": "error-message", children: typeof error === "string" ? error : error?.message })
@@ -974,10 +1027,16 @@ var MitreFormComponent = React3.forwardRef(({
974
1027
  utm_campaign,
975
1028
  utm_term,
976
1029
  showHeader = true,
977
- colorPrimary = "#F6C76B",
978
- textColor = "#2F2F2F",
979
- backgroundColor = "#CECECE",
980
- innerPadding = "1rem"
1030
+ backgroundColor = "var(--gray-180)",
1031
+ textColor = "var(--black)",
1032
+ buttonBackgroundColor = "#F6C76B",
1033
+ buttonTextColor = "var(--black)",
1034
+ innerPadding = "1rem",
1035
+ inputBackgroundColor = "var(--white)",
1036
+ inputBorderColor = "var(--transparent)",
1037
+ inputFocusBorderColor = "var(--yellow-500)",
1038
+ inputPlaceholderColor = "var(--gray-100)",
1039
+ inputTextColor = "var(--black)"
981
1040
  }, ref) => {
982
1041
  const [loading, setIsLoading] = useState3(false);
983
1042
  const { error, handleError, clearError } = useError();
@@ -1081,11 +1140,15 @@ var MitreFormComponent = React3.forwardRef(({
1081
1140
  label: "Nome *",
1082
1141
  placeholder: "Digite seu nome",
1083
1142
  ...register("name"),
1084
- borderColor: colorPrimary,
1085
- textColor,
1086
1143
  error: errors.name?.message,
1087
1144
  autoComplete: "name",
1088
- required: true
1145
+ required: true,
1146
+ labelTextColor: textColor,
1147
+ backgroundColor: inputBackgroundColor,
1148
+ borderColor: inputBorderColor,
1149
+ focusBorderColor: inputFocusBorderColor,
1150
+ inputPlaceholderColor,
1151
+ inputTextColor
1089
1152
  }
1090
1153
  ),
1091
1154
  /* @__PURE__ */ jsx5(
@@ -1096,11 +1159,15 @@ var MitreFormComponent = React3.forwardRef(({
1096
1159
  type: "email",
1097
1160
  placeholder: "exemplo@email.com",
1098
1161
  ...register("email"),
1099
- borderColor: colorPrimary,
1100
- textColor,
1101
1162
  error: errors.email?.message,
1102
1163
  autoComplete: "email",
1103
- required: true
1164
+ required: true,
1165
+ labelTextColor: textColor,
1166
+ backgroundColor: inputBackgroundColor,
1167
+ borderColor: inputBorderColor,
1168
+ focusBorderColor: inputFocusBorderColor,
1169
+ inputPlaceholderColor,
1170
+ inputTextColor
1104
1171
  }
1105
1172
  ),
1106
1173
  /* @__PURE__ */ jsx5(
@@ -1118,13 +1185,17 @@ var MitreFormComponent = React3.forwardRef(({
1118
1185
  id: "phone",
1119
1186
  label: "Telefone *",
1120
1187
  placeholder: "(11) 00000-0000",
1121
- borderColor: colorPrimary,
1122
- textColor,
1123
1188
  error: errorMsg,
1124
1189
  required: true,
1125
1190
  value: field.value.phone,
1126
1191
  onChange: field.onChange,
1127
- name: field.name
1192
+ name: field.name,
1193
+ labelTextColor: textColor,
1194
+ backgroundColor: inputBackgroundColor,
1195
+ borderColor: inputBorderColor,
1196
+ focusBorderColor: inputFocusBorderColor,
1197
+ inputPlaceholderColor,
1198
+ inputTextColor
1128
1199
  }
1129
1200
  );
1130
1201
  }
@@ -1132,7 +1203,7 @@ var MitreFormComponent = React3.forwardRef(({
1132
1203
  formKey
1133
1204
  ),
1134
1205
  /* @__PURE__ */ jsx5("h6", { children: "* Campos de preenchimento obrigat\xF3rio." }),
1135
- /* @__PURE__ */ jsx5(ButtonContainer, { children: /* @__PURE__ */ jsx5(Button2, { bgColor: colorPrimary, color: textColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
1206
+ /* @__PURE__ */ jsx5(ButtonContainer, { children: /* @__PURE__ */ jsx5(Button2, { bgColor: buttonBackgroundColor, color: buttonTextColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
1136
1207
  /* @__PURE__ */ jsxs5("p", { children: [
1137
1208
  "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",
1138
1209
  " ",