mitre-form-component 0.0.4 → 0.0.6

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.
@@ -1,12 +1,46 @@
1
- "use client";
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ MitreFormComponent: () => Form_default
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
2
36
 
3
37
  // src/components/Form/index.tsx
4
- import React3, { useState as useState3 } from "react";
38
+ var import_react5 = __toESM(require("react"), 1);
5
39
 
6
40
  // src/components/hooks/useError.ts
7
- import { useState } from "react";
41
+ var import_react = require("react");
8
42
  function useError() {
9
- const [error, setError] = useState(null);
43
+ const [error, setError] = (0, import_react.useState)(null);
10
44
  const handleError = (err) => {
11
45
  const errorObj = err instanceof Error ? err : new Error(String(err));
12
46
  setError(errorObj);
@@ -17,9 +51,9 @@ function useError() {
17
51
  }
18
52
 
19
53
  // src/components/Form/index.tsx
20
- import { useForm } from "react-hook-form";
21
- import { yupResolver } from "@hookform/resolvers/yup";
22
- import * as yup from "yup";
54
+ var import_react_hook_form = require("react-hook-form");
55
+ var import_yup = require("@hookform/resolvers/yup");
56
+ var yup = __toESM(require("yup"), 1);
23
57
 
24
58
  // src/components/styles/utils.ts
25
59
  function flex(direction = "row", alignItems, justifyContent) {
@@ -42,14 +76,18 @@ var opacityEffect = `
42
76
  `;
43
77
 
44
78
  // src/components/Form/styles.ts
45
- import styled from "styled-components";
46
- var FormContainer = styled.div`
79
+ var import_styled_components = __toESM(require("styled-components"), 1);
80
+ var FormContainer = import_styled_components.default.div`
47
81
  ${flex("column")}
48
82
  align-items: stretch;
49
83
  justify-content: flex-start;
50
84
  overflow-x: hidden;
51
85
  overflow-y: auto;
52
86
 
87
+ background: ${(props) => props.$backgroundColor || " #cecece"};
88
+
89
+ padding: ${(props) => props.innerPadding || "1rem"};
90
+
53
91
  /* Hide scrollbars for WebKit browsers */
54
92
  ::-webkit-scrollbar {
55
93
  display: none;
@@ -59,11 +97,12 @@ var FormContainer = styled.div`
59
97
  scrollbar-width: none;
60
98
 
61
99
  box-sizing: border-box;
100
+ height: 100%;
62
101
  `;
63
- var HeaderContainer = styled.div`
102
+ var HeaderContainer = import_styled_components.default.div`
64
103
  margin-bottom: 1rem;
65
104
  `;
66
- var ButtonContainer = styled.div`
105
+ var ButtonContainer = import_styled_components.default.div`
67
106
  display: flex;
68
107
  flex-direction: column;
69
108
  align-items: center;
@@ -71,7 +110,7 @@ var ButtonContainer = styled.div`
71
110
  width: 100%;
72
111
  margin-top: 0.75rem;
73
112
  `;
74
- var Form = styled.form`
113
+ var Form = import_styled_components.default.form`
75
114
  label {
76
115
  font-weight: 700;
77
116
  }
@@ -119,14 +158,14 @@ var Form = styled.form`
119
158
  margin-bottom: 10px;
120
159
  }
121
160
  `;
122
- var Title = styled.h2`
161
+ var Title = import_styled_components.default.h2`
123
162
  font-size: 1.25rem;
124
163
  font-weight: 700;
125
164
  line-height: 24px;
126
165
  letter-spacing: 0em;
127
166
  color: ${(props) => props.$textColor || "var(--black)"};
128
167
  `;
129
- var Text = styled.p`
168
+ var Text = import_styled_components.default.p`
130
169
  font-size: 1rem;
131
170
  font-weight: 400;
132
171
  line-height: 23px;
@@ -136,9 +175,9 @@ var Text = styled.p`
136
175
  `;
137
176
 
138
177
  // src/components/styles/global.ts
139
- import { createGlobalStyle } from "styled-components";
140
- import { useEffect } from "react";
141
- var GlobalStyles = createGlobalStyle`
178
+ var import_styled_components2 = require("styled-components");
179
+ var import_react2 = require("react");
180
+ var GlobalStyles = import_styled_components2.createGlobalStyle`
142
181
  :root {
143
182
  --red: #e52e4d;
144
183
  --white: #FFF;
@@ -285,7 +324,7 @@ var GlobalStyles = createGlobalStyle`
285
324
 
286
325
  `;
287
326
  var FontLoader = () => {
288
- useEffect(() => {
327
+ (0, import_react2.useEffect)(() => {
289
328
  const link = document.createElement("link");
290
329
  link.href = "https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap";
291
330
  link.rel = "stylesheet";
@@ -296,11 +335,7 @@ var FontLoader = () => {
296
335
  var global_default = FontLoader;
297
336
 
298
337
  // src/components/Input/index.tsx
299
- import {
300
- forwardRef,
301
- useCallback,
302
- useRef
303
- } from "react";
338
+ var import_react3 = require("react");
304
339
 
305
340
  // src/components/Input/masks.ts
306
341
  function cep(e) {
@@ -341,12 +376,12 @@ function date(e) {
341
376
  }
342
377
 
343
378
  // src/components/Input/index.tsx
344
- import "react-phone-input-2/lib/style.css";
379
+ var import_style = require("react-phone-input-2/lib/style.css");
345
380
 
346
381
  // src/components/Input/styles.ts
347
- import styled2, { css } from "styled-components";
348
- import PhoneInput from "react-phone-input-2";
349
- var FormLabel = styled2.label`
382
+ var import_styled_components3 = __toESM(require("styled-components"), 1);
383
+ var import_react_phone_input_2 = __toESM(require("react-phone-input-2"), 1);
384
+ var FormLabel = import_styled_components3.default.label`
350
385
  font-family: "Montserrat", sans-serif;
351
386
  font-style: normal;
352
387
  font-weight: 500;
@@ -356,7 +391,7 @@ var FormLabel = styled2.label`
356
391
  margin-bottom: 0.5rem;
357
392
  text-align: left;
358
393
  `;
359
- var Input = styled2.input`
394
+ var Input = import_styled_components3.default.input`
360
395
  font-family: "Montserrat", sans-serif;
361
396
  font-style: normal;
362
397
  font-weight: 500;
@@ -398,7 +433,7 @@ var Input = styled2.input`
398
433
  font-weight: 500;
399
434
  }
400
435
  `;
401
- var FormPhoneInput = styled2(PhoneInput)`
436
+ var FormPhoneInput = (0, import_styled_components3.default)(import_react_phone_input_2.default)`
402
437
  .form-control {
403
438
  background: white;
404
439
  color: ${(props) => props.isInvalid ? "var(--red)" : props.$textColor || "var(--black)"};
@@ -461,24 +496,24 @@ var FormPhoneInput = styled2(PhoneInput)`
461
496
  }
462
497
  }
463
498
  `;
464
- var FormErrorMessage = styled2.small`
499
+ var FormErrorMessage = import_styled_components3.default.small`
465
500
  font-size: 0.75rem;
466
501
  line-height: 1.125rem;
467
502
  color: var(--red);
468
503
  margin-top: 0.25rem;
469
504
  display: block;
470
505
  `;
471
- var FormControl = styled2.div.withConfig({
506
+ var FormControl = import_styled_components3.default.div.withConfig({
472
507
  shouldForwardProp: (prop) => !["isInvalid", "$bordercolor"].includes(prop)
473
508
  })`
474
509
  ${FormLabel} {
475
- ${(props) => props.isInvalid && css`
510
+ ${(props) => props.isInvalid && import_styled_components3.css`
476
511
  color: var(--red);
477
512
  `};
478
513
  }
479
514
 
480
515
  ${Input} {
481
- ${(props) => props.isInvalid && css`
516
+ ${(props) => props.isInvalid && import_styled_components3.css`
482
517
  border: 1px solid var(--red);
483
518
 
484
519
  &:not(:focus)::placeholder {
@@ -488,14 +523,14 @@ var FormControl = styled2.div.withConfig({
488
523
  `};
489
524
 
490
525
  &:focus {
491
- ${(props) => props.isInvalid && css`
526
+ ${(props) => props.isInvalid && import_styled_components3.css`
492
527
  border: 1px solid var(--red);
493
528
  `};
494
529
  }
495
530
  }
496
531
 
497
532
  ${FormPhoneInput} {
498
- ${(props) => props.isInvalid && css`
533
+ ${(props) => props.isInvalid && import_styled_components3.css`
499
534
  border: 1px solid var(--red);
500
535
 
501
536
  &:not(:focus)::placeholder {
@@ -505,7 +540,7 @@ var FormControl = styled2.div.withConfig({
505
540
  `};
506
541
 
507
542
  &:focus {
508
- ${(props) => props.isInvalid && css`
543
+ ${(props) => props.isInvalid && import_styled_components3.css`
509
544
  border: 1px solid var(--red);
510
545
  `};
511
546
  }
@@ -513,11 +548,11 @@ var FormControl = styled2.div.withConfig({
513
548
  `;
514
549
 
515
550
  // src/components/Input/index.tsx
516
- import { jsx, jsxs } from "react/jsx-runtime";
551
+ var import_jsx_runtime = require("react/jsx-runtime");
517
552
  var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textColor, mask = "", type = "text", ...rest }, ref) => {
518
- const phoneInputRef = useRef(null);
553
+ const phoneInputRef = (0, import_react3.useRef)(null);
519
554
  const { onChange, name } = rest;
520
- const handleKeyUp = useCallback(
555
+ const handleKeyUp = (0, import_react3.useCallback)(
521
556
  (e) => {
522
557
  if (mask === "cep") cep(e);
523
558
  if (mask === "currency") currency(e);
@@ -526,15 +561,15 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
526
561
  },
527
562
  [mask]
528
563
  );
529
- const handlePhoneChange = useCallback((value) => {
564
+ const handlePhoneChange = (0, import_react3.useCallback)((value) => {
530
565
  onChange?.({ target: { value, name } });
531
566
  if (phoneInputRef.current?.input) {
532
567
  phoneInputRef.current.input.value = value;
533
568
  }
534
569
  }, [onChange, name]);
535
- return /* @__PURE__ */ jsxs(FormControl, { isInvalid: !!error, children: [
536
- !!label && /* @__PURE__ */ jsx(FormLabel, { htmlFor: id, $textColor: textColor, children: label }),
537
- !mask ? /* @__PURE__ */ jsx(
570
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FormControl, { isInvalid: !!error, children: [
571
+ !!label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormLabel, { htmlFor: id, $textColor: textColor, children: label }),
572
+ !mask ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
538
573
  Input,
539
574
  {
540
575
  id,
@@ -545,7 +580,7 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
545
580
  autoComplete: rest.autoComplete || "on",
546
581
  ...rest
547
582
  }
548
- ) : mask === "phone" ? /* @__PURE__ */ jsx(
583
+ ) : mask === "phone" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
549
584
  FormPhoneInput,
550
585
  {
551
586
  country: "br",
@@ -572,7 +607,7 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
572
607
  disableCountryCode: true,
573
608
  value: rest.value
574
609
  }
575
- ) : /* @__PURE__ */ jsx(
610
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
576
611
  Input,
577
612
  {
578
613
  id,
@@ -585,15 +620,15 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
585
620
  ...rest
586
621
  }
587
622
  ),
588
- !!error && showErrorMessage && /* @__PURE__ */ jsx(FormErrorMessage, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
623
+ !!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormErrorMessage, { "data-testid": "error-message", children: typeof error === "string" ? error : error.message })
589
624
  ] });
590
625
  };
591
- var Input2 = forwardRef(InputBase);
626
+ var Input2 = (0, import_react3.forwardRef)(InputBase);
592
627
 
593
628
  // src/components/Button/styles.ts
594
- import { darken } from "polished";
595
- import styled3, { css as css2 } from "styled-components";
596
- var Icon = styled3.span`
629
+ var import_polished = require("polished");
630
+ var import_styled_components4 = __toESM(require("styled-components"), 1);
631
+ var Icon = import_styled_components4.default.span`
597
632
  font-size: 0;
598
633
  line-height: 0;
599
634
  transition: all 0.25s ease;
@@ -603,7 +638,7 @@ var Icon = styled3.span`
603
638
  opacity: 0;
604
639
  margin-right: 0.625rem;
605
640
  `;
606
- var Text2 = styled3.span`
641
+ var Text2 = import_styled_components4.default.span`
607
642
  font-family: "Montserrat", sans-serif;
608
643
  font-size: 1rem;
609
644
  line-height: 1.5rem;
@@ -611,14 +646,14 @@ var Text2 = styled3.span`
611
646
 
612
647
  transition: all 0.25s ease;
613
648
  `;
614
- var TextSubmitting = styled3.span`
649
+ var TextSubmitting = import_styled_components4.default.span`
615
650
  font-family: "Montserrat", sans-serif;
616
651
  font-weight: 400;
617
652
  font-size: 1rem;
618
653
 
619
654
  transition: all 0.25s ease;
620
655
  `;
621
- var LoadingIcon = styled3.span.withConfig({
656
+ var LoadingIcon = import_styled_components4.default.span.withConfig({
622
657
  shouldForwardProp: (prop) => prop !== "hasText"
623
658
  })`
624
659
  display: block;
@@ -641,7 +676,7 @@ var LoadingIcon = styled3.span.withConfig({
641
676
  }
642
677
  }
643
678
  `;
644
- var Button = styled3.button.withConfig({
679
+ var Button = import_styled_components4.default.button.withConfig({
645
680
  shouldForwardProp: (prop) => ![
646
681
  "hasIcon",
647
682
  "isSubmitting",
@@ -652,9 +687,9 @@ var Button = styled3.button.withConfig({
652
687
  "height"
653
688
  ].includes(prop)
654
689
  })`
655
- background: ${(props) => darken(0.1, props?.bgColor || "#F6C76B")};
690
+ background: ${(props) => (0, import_polished.darken)(0.1, props?.bgColor || "#F6C76B")};
656
691
  color: ${(props) => props?.color || "#2F2F2F"};
657
- border: 1px solid ${(props) => darken(0.1, props?.bordercolor || "#F6C76B")};
692
+ border: 1px solid ${(props) => (0, import_polished.darken)(0.1, props?.bordercolor || "#F6C76B")};
658
693
  border-radius: 2px;
659
694
 
660
695
  display: inline-flex;
@@ -683,8 +718,8 @@ var Button = styled3.button.withConfig({
683
718
  }
684
719
 
685
720
  &:hover {
686
- background: ${(props) => darken(0.2, props?.bgColor || "#F6C76B")};
687
- border-color: ${(props) => darken(0.2, props?.bordercolor || "#F6C76B")};
721
+ background: ${(props) => (0, import_polished.darken)(0.2, props?.bgColor || "#F6C76B")};
722
+ border-color: ${(props) => (0, import_polished.darken)(0.2, props?.bordercolor || "#F6C76B")};
688
723
 
689
724
  ${Icon} {
690
725
  opacity: 1;
@@ -698,14 +733,14 @@ var Button = styled3.button.withConfig({
698
733
  }
699
734
 
700
735
  ${Text2} {
701
- ${(props) => props.isSubmitting && !props.hasSubmittingMessage && css2`
736
+ ${(props) => props.isSubmitting && !props.hasSubmittingMessage && import_styled_components4.css`
702
737
  transform: unset;
703
738
  opacity: 0;
704
739
  `}
705
740
  }
706
741
 
707
742
  ${LoadingIcon} {
708
- ${(props) => props.isSubmitting && !props.hasSubmittingMessage && css2`
743
+ ${(props) => props.isSubmitting && !props.hasSubmittingMessage && import_styled_components4.css`
709
744
  display: flex;
710
745
  -webkit-box-align: center;
711
746
  align-items: center;
@@ -715,7 +750,7 @@ var Button = styled3.button.withConfig({
715
750
  `;
716
751
 
717
752
  // src/components/Button/index.tsx
718
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
753
+ var import_jsx_runtime2 = require("react/jsx-runtime");
719
754
  function Button2({
720
755
  children,
721
756
  icon,
@@ -725,7 +760,7 @@ function Button2({
725
760
  color = "#2F2F2F",
726
761
  ...rest
727
762
  }) {
728
- return /* @__PURE__ */ jsxs2(
763
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
729
764
  Button,
730
765
  {
731
766
  isSubmitting,
@@ -736,30 +771,30 @@ function Button2({
736
771
  color,
737
772
  ...rest,
738
773
  children: [
739
- icon && !isSubmitting && /* @__PURE__ */ jsx2(Icon, { "data-testid": "button-icon", children: icon }),
740
- isSubmitting && /* @__PURE__ */ jsx2(LoadingIcon, { hasText: submittingMessage.length > 0 }),
741
- (!isSubmitting || submittingMessage.length === 0) && /* @__PURE__ */ jsx2(Text2, { className: "text", children }),
742
- isSubmitting && submittingMessage.length > 0 && /* @__PURE__ */ jsx2(TextSubmitting, { children: submittingMessage })
774
+ icon && !isSubmitting && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { "data-testid": "button-icon", children: icon }),
775
+ isSubmitting && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingIcon, { hasText: submittingMessage.length > 0 }),
776
+ (!isSubmitting || submittingMessage.length === 0) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text2, { className: "text", children }),
777
+ isSubmitting && submittingMessage.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextSubmitting, { children: submittingMessage })
743
778
  ]
744
779
  }
745
780
  );
746
781
  }
747
782
 
748
783
  // src/components/Alert/index.tsx
749
- import { useEffect as useEffect2, useState as useState2, useCallback as useCallback2 } from "react";
784
+ var import_react4 = require("react");
750
785
 
751
786
  // src/components/Alert/styles.ts
752
- import styled4, { css as css3, keyframes } from "styled-components";
753
- var fadeIn = keyframes`
787
+ var import_styled_components5 = __toESM(require("styled-components"), 1);
788
+ var fadeIn = import_styled_components5.keyframes`
754
789
  from { opacity: 0; transform: translateY(-10px); }
755
790
  to { opacity: 1; transform: translateY(0); }
756
791
  `;
757
- var fadeOut = keyframes`
792
+ var fadeOut = import_styled_components5.keyframes`
758
793
  from { opacity: 1; transform: translateY(0); }
759
794
  to { opacity: 0; transform: translateY(-10px); }
760
795
  `;
761
796
  var typeStyles = {
762
- error: css3`
797
+ error: import_styled_components5.css`
763
798
  background-color: var(--red);
764
799
  border: 1px solid var(--red);
765
800
  color: var(--white);
@@ -767,7 +802,7 @@ var typeStyles = {
767
802
  color: var(--white);
768
803
  }
769
804
  `,
770
- warning: css3`
805
+ warning: import_styled_components5.css`
771
806
  background-color: var(--yellow-500);
772
807
  border: 1px solid var(--yellow-400);
773
808
  color: var(--black);
@@ -775,7 +810,7 @@ var typeStyles = {
775
810
  color: var(--black);
776
811
  }
777
812
  `,
778
- info: css3`
813
+ info: import_styled_components5.css`
779
814
  background-color: var(--blue);
780
815
  border: 1px solid var(--blue);
781
816
  color: var(--white);
@@ -783,7 +818,7 @@ var typeStyles = {
783
818
  color: var(--white);
784
819
  }
785
820
  `,
786
- success: css3`
821
+ success: import_styled_components5.css`
787
822
  background-color: var(--green);
788
823
  border: 1px solid var(--green-2);
789
824
  color: var(--white);
@@ -792,7 +827,7 @@ var typeStyles = {
792
827
  }
793
828
  `
794
829
  };
795
- var AlertContainer = styled4.div`
830
+ var AlertContainer = import_styled_components5.default.div`
796
831
  position: fixed;
797
832
  width: 500px;
798
833
  top: 15px;
@@ -812,7 +847,7 @@ var AlertContainer = styled4.div`
812
847
 
813
848
  ${({ $type }) => typeStyles[$type]}
814
849
  `;
815
- var DismissButton = styled4.button`
850
+ var DismissButton = import_styled_components5.default.button`
816
851
  position: absolute;
817
852
  background: transparent;
818
853
  right: 10px;
@@ -833,8 +868,8 @@ var DismissButton = styled4.button`
833
868
  `;
834
869
 
835
870
  // src/components/Alert/index.tsx
836
- import { HiX } from "react-icons/hi";
837
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
871
+ var import_hi = require("react-icons/hi");
872
+ var import_jsx_runtime3 = require("react/jsx-runtime");
838
873
  var Alert = ({
839
874
  type = "info",
840
875
  children,
@@ -843,18 +878,18 @@ var Alert = ({
843
878
  onDismiss,
844
879
  autoDismiss
845
880
  }) => {
846
- const [isClosing, setIsClosing] = useState2(false);
847
- const handleDismiss = useCallback2(() => {
881
+ const [isClosing, setIsClosing] = (0, import_react4.useState)(false);
882
+ const handleDismiss = (0, import_react4.useCallback)(() => {
848
883
  setIsClosing(true);
849
884
  setTimeout(() => onDismiss?.(), 300);
850
885
  }, [onDismiss]);
851
- useEffect2(() => {
886
+ (0, import_react4.useEffect)(() => {
852
887
  if (autoDismiss) {
853
888
  const timer = setTimeout(handleDismiss, autoDismiss);
854
889
  return () => clearTimeout(timer);
855
890
  }
856
891
  }, [autoDismiss, handleDismiss]);
857
- return /* @__PURE__ */ jsxs3(
892
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
858
893
  AlertContainer,
859
894
  {
860
895
  $type: type,
@@ -864,12 +899,12 @@ var Alert = ({
864
899
  role: "alert",
865
900
  children: [
866
901
  children,
867
- dismissible && /* @__PURE__ */ jsx3(
902
+ dismissible && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
868
903
  DismissButton,
869
904
  {
870
905
  onClick: handleDismiss,
871
906
  "aria-label": "Dismiss alert",
872
- children: /* @__PURE__ */ jsx3(HiX, {})
907
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_hi.HiX, {})
873
908
  }
874
909
  )
875
910
  ]
@@ -878,7 +913,7 @@ var Alert = ({
878
913
  };
879
914
 
880
915
  // src/components/Form/index.tsx
881
- import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
916
+ var import_jsx_runtime4 = require("react/jsx-runtime");
882
917
  var schema = yup.object().shape({
883
918
  name: yup.string().required("Nome \xE9 obrigat\xF3rio"),
884
919
  email: yup.string().required("Email \xE9 obrigat\xF3rio").email("Email inv\xE1lido"),
@@ -891,7 +926,7 @@ var schema = yup.object().shape({
891
926
  }
892
927
  )
893
928
  });
894
- var MitreFormComponent = React3.forwardRef(({
929
+ var MitreFormComponent = import_react5.default.forwardRef(({
895
930
  productId,
896
931
  apiUrl,
897
932
  apiToken,
@@ -901,13 +936,15 @@ var MitreFormComponent = React3.forwardRef(({
901
936
  utm_term,
902
937
  showHeader = true,
903
938
  colorPrimary = "#F6C76B",
904
- textColor = "#2F2F2F"
939
+ textColor = "#2F2F2F",
940
+ backgroundColor = "#cecece",
941
+ innerPadding = "1rem"
905
942
  }, ref) => {
906
- const [loading, setIsLoading] = useState3(false);
943
+ const [loading, setIsLoading] = (0, import_react5.useState)(false);
907
944
  const { error, handleError, clearError } = useError();
908
- const [successMessage, setSuccessMessage] = useState3("");
909
- const { register, handleSubmit, formState: { errors }, reset, watch } = useForm({
910
- resolver: yupResolver(schema)
945
+ const [successMessage, setSuccessMessage] = (0, import_react5.useState)("");
946
+ const { register, handleSubmit, formState: { errors }, reset, watch } = (0, import_react_hook_form.useForm)({
947
+ resolver: (0, import_yup.yupResolver)(schema)
911
948
  });
912
949
  const phoneValue = watch("phone");
913
950
  const sendMessage = async (data) => {
@@ -947,10 +984,10 @@ var MitreFormComponent = React3.forwardRef(({
947
984
  setIsLoading(false);
948
985
  }
949
986
  };
950
- return /* @__PURE__ */ jsxs4(Fragment, { children: [
951
- /* @__PURE__ */ jsx4(global_default, {}),
952
- /* @__PURE__ */ jsx4(GlobalStyles, {}),
953
- error && /* @__PURE__ */ jsx4(
987
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
988
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(global_default, {}),
989
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GlobalStyles, {}),
990
+ error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
954
991
  Alert,
955
992
  {
956
993
  type: "error",
@@ -960,7 +997,7 @@ var MitreFormComponent = React3.forwardRef(({
960
997
  children: error.message
961
998
  }
962
999
  ),
963
- successMessage && /* @__PURE__ */ jsx4(
1000
+ successMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
964
1001
  Alert,
965
1002
  {
966
1003
  type: "success",
@@ -970,13 +1007,13 @@ var MitreFormComponent = React3.forwardRef(({
970
1007
  children: successMessage
971
1008
  }
972
1009
  ),
973
- /* @__PURE__ */ jsxs4(FormContainer, { ref, children: [
974
- showHeader && /* @__PURE__ */ jsxs4(HeaderContainer, { children: [
975
- /* @__PURE__ */ jsx4(Title, { $textColor: textColor, children: "Atendimento por mensagem" }),
976
- /* @__PURE__ */ jsx4(Text, { $textColor: textColor, children: "Informe seus dados e retornaremos a mensagem." })
1010
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(FormContainer, { $backgroundColor: backgroundColor, innerPadding, ref, children: [
1011
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(HeaderContainer, { children: [
1012
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Title, { $textColor: textColor, children: "Atendimento por mensagem" }),
1013
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { $textColor: textColor, children: "Informe seus dados e retornaremos a mensagem." })
977
1014
  ] }),
978
- /* @__PURE__ */ jsxs4(Form, { $textColor: textColor, onSubmit: handleSubmit(sendMessage), noValidate: true, children: [
979
- /* @__PURE__ */ jsx4(
1015
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Form, { $textColor: textColor, onSubmit: handleSubmit(sendMessage), noValidate: true, children: [
1016
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
980
1017
  Input2,
981
1018
  {
982
1019
  id: "name",
@@ -990,7 +1027,7 @@ var MitreFormComponent = React3.forwardRef(({
990
1027
  required: true
991
1028
  }
992
1029
  ),
993
- /* @__PURE__ */ jsx4(
1030
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
994
1031
  Input2,
995
1032
  {
996
1033
  id: "email",
@@ -1005,7 +1042,7 @@ var MitreFormComponent = React3.forwardRef(({
1005
1042
  required: true
1006
1043
  }
1007
1044
  ),
1008
- /* @__PURE__ */ jsx4(
1045
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1009
1046
  Input2,
1010
1047
  {
1011
1048
  id: "phone",
@@ -1020,12 +1057,12 @@ var MitreFormComponent = React3.forwardRef(({
1020
1057
  value: phoneValue
1021
1058
  }
1022
1059
  ),
1023
- /* @__PURE__ */ jsx4("h6", { children: "* Campos de preenchimento obrigat\xF3rio." }),
1024
- /* @__PURE__ */ jsx4(ButtonContainer, { children: /* @__PURE__ */ jsx4(Button2, { bgColor: colorPrimary, color: textColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
1025
- /* @__PURE__ */ jsxs4("p", { children: [
1060
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h6", { children: "* Campos de preenchimento obrigat\xF3rio." }),
1061
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ButtonContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button2, { bgColor: colorPrimary, color: textColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
1062
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
1026
1063
  "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",
1027
1064
  " ",
1028
- /* @__PURE__ */ jsx4(
1065
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1029
1066
  "a",
1030
1067
  {
1031
1068
  href: "https://www.mitrerealty.com.br/politica-de-privacidade",
@@ -1046,7 +1083,8 @@ var MitreFormComponent = React3.forwardRef(({
1046
1083
  });
1047
1084
  MitreFormComponent.displayName = "MitreFormComponent";
1048
1085
  var Form_default = MitreFormComponent;
1049
- export {
1050
- Form_default as MitreFormComponent
1051
- };
1052
- //# sourceMappingURL=index.mjs.map
1086
+ // Annotate the CommonJS export names for ESM import in node:
1087
+ 0 && (module.exports = {
1088
+ MitreFormComponent
1089
+ });
1090
+ //# sourceMappingURL=index.cjs.map