@lets-events/react 11.5.4 → 11.6.1

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.
Files changed (74) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +20 -18
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.d.mts +103 -11
  5. package/dist/index.d.ts +103 -11
  6. package/dist/index.js +990 -133
  7. package/dist/index.mjs +951 -102
  8. package/package.json +2 -1
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +125 -125
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +16 -16
  14. package/src/components/Button/styledComponents.ts +287 -287
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +136 -136
  17. package/src/components/Calendar/styledComponents.ts +209 -209
  18. package/src/components/Card.tsx +48 -48
  19. package/src/components/CheckboxGroup.tsx +176 -196
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Drawer/index.tsx +48 -48
  22. package/src/components/Drawer/styledComponents.ts +46 -46
  23. package/src/components/Dropdown.tsx +192 -167
  24. package/src/components/Filter.tsx +164 -164
  25. package/src/components/Flex.tsx +118 -118
  26. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -0
  27. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -0
  28. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +45 -0
  29. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -0
  30. package/src/components/FormFields/AddressFormFields/index.tsx +139 -0
  31. package/src/components/FormFields/BirthDateFormField.tsx +87 -0
  32. package/src/components/FormFields/CNPJFormField.tsx +89 -0
  33. package/src/components/FormFields/CPFFormField.tsx +79 -0
  34. package/src/components/FormFields/CheckboxGroupFormField.tsx +90 -0
  35. package/src/components/FormFields/ErrorFormMessage.tsx +36 -36
  36. package/src/components/FormFields/Form.tsx +29 -25
  37. package/src/components/FormFields/FormLabel.tsx +29 -29
  38. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +42 -0
  39. package/src/components/FormFields/MultiSelectFormField.tsx +59 -59
  40. package/src/components/FormFields/PhoneFormField.tsx +130 -130
  41. package/src/components/FormFields/RadioGroupFormField.tsx +84 -0
  42. package/src/components/FormFields/SelectFormField.tsx +93 -0
  43. package/src/components/FormFields/TextAreaFormField.tsx +48 -48
  44. package/src/components/FormFields/TextFormField.tsx +76 -46
  45. package/src/components/Grid.tsx +137 -137
  46. package/src/components/Icon.tsx +47 -47
  47. package/src/components/MenuDropdown/index.tsx +30 -30
  48. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  49. package/src/components/Modal.tsx +90 -90
  50. package/src/components/MultiSelect.tsx +218 -218
  51. package/src/components/RadioGroup.tsx +210 -210
  52. package/src/components/Section.tsx +33 -33
  53. package/src/components/Step.tsx +164 -164
  54. package/src/components/Switch.tsx +108 -108
  55. package/src/components/Text.tsx +38 -38
  56. package/src/components/TextField.tsx +312 -315
  57. package/src/components/TextareaField.tsx +128 -128
  58. package/src/components/TimePicker.tsx +298 -298
  59. package/src/components/Toast/components/ToastItem.tsx +41 -41
  60. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  61. package/src/components/Toast/hooks/useToast.ts +12 -12
  62. package/src/components/Toast/index.tsx +5 -5
  63. package/src/components/Toast/styles/index.ts +135 -135
  64. package/src/components/Toast/types/index.ts +46 -46
  65. package/src/components/Tooltip/index.tsx +66 -66
  66. package/src/components/Tooltip/styles.ts +77 -77
  67. package/src/hooks/useCountries.ts +41 -0
  68. package/src/hooks/useOnClickOutside.tsx +20 -20
  69. package/src/index.tsx +52 -45
  70. package/src/styles/index.ts +38 -38
  71. package/src/types/typographyValues.ts +178 -178
  72. package/src/utils/getNestedValue.ts +3 -0
  73. package/src/utils/states.ts +29 -0
  74. package/tsconfig.json +3 -3
package/dist/index.js CHANGED
@@ -59,6 +59,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
59
59
  ));
60
60
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
61
61
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
62
+ var __async = (__this, __arguments, generator) => {
63
+ return new Promise((resolve, reject) => {
64
+ var fulfilled = (value) => {
65
+ try {
66
+ step(generator.next(value));
67
+ } catch (e) {
68
+ reject(e);
69
+ }
70
+ };
71
+ var rejected = (value) => {
72
+ try {
73
+ step(generator.throw(value));
74
+ } catch (e) {
75
+ reject(e);
76
+ }
77
+ };
78
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
79
+ step((generator = generator.apply(__this, __arguments)).next());
80
+ });
81
+ };
62
82
 
63
83
  // ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
64
84
  var require_react_is_production_min = __commonJS({
@@ -242,7 +262,7 @@ var require_react_is_development = __commonJS({
242
262
  var ContextProvider = REACT_PROVIDER_TYPE;
243
263
  var Element = REACT_ELEMENT_TYPE;
244
264
  var ForwardRef = REACT_FORWARD_REF_TYPE;
245
- var Fragment2 = REACT_FRAGMENT_TYPE;
265
+ var Fragment4 = REACT_FRAGMENT_TYPE;
246
266
  var Lazy = REACT_LAZY_TYPE;
247
267
  var Memo = REACT_MEMO_TYPE;
248
268
  var Portal = REACT_PORTAL_TYPE;
@@ -301,7 +321,7 @@ var require_react_is_development = __commonJS({
301
321
  exports2.ContextProvider = ContextProvider;
302
322
  exports2.Element = Element;
303
323
  exports2.ForwardRef = ForwardRef;
304
- exports2.Fragment = Fragment2;
324
+ exports2.Fragment = Fragment4;
305
325
  exports2.Lazy = Lazy;
306
326
  exports2.Memo = Memo;
307
327
  exports2.Portal = Portal;
@@ -1011,6 +1031,7 @@ var require_prop_types = __commonJS({
1011
1031
  // src/index.tsx
1012
1032
  var index_exports = {};
1013
1033
  __export(index_exports, {
1034
+ AddressFormFields: () => AddressFormFields,
1014
1035
  Alert: () => Alert,
1015
1036
  AlertDialogCompleteStyled: () => AlertDialogCompleteStyled,
1016
1037
  AlertDialogDescriptionStyled: () => AlertDialogDescriptionStyled,
@@ -1023,16 +1044,20 @@ __export(index_exports, {
1023
1044
  AvatarStyled: () => AvatarStyled,
1024
1045
  Badge: () => Badge,
1025
1046
  BadgeStyled: () => BadgeStyled,
1047
+ BirthDateFormField: () => BirthDateFormField,
1026
1048
  Box: () => Box,
1027
1049
  Button: () => Button,
1028
1050
  ButtonGroup: () => ButtonGroup,
1029
1051
  ButtonGroupStyled: () => ButtonGroupStyled,
1030
1052
  ButtonItem: () => ButtonItem,
1031
1053
  ButtonItemStyled: () => ButtonItemStyled,
1054
+ CNPJFormField: () => CNPJFormField,
1055
+ CPFFormField: () => CPFFormField,
1032
1056
  Calendar: () => Calendar,
1033
1057
  Card: () => Card,
1034
1058
  CardStyled: () => CardStyled,
1035
1059
  CheckboxGroup: () => CheckboxGroup,
1060
+ CheckboxGroupFormField: () => CheckboxGroupFormField,
1036
1061
  CheckboxGroupStyled: () => CheckboxGroupStyled,
1037
1062
  CheckboxItem: () => CheckboxItem,
1038
1063
  Container: () => Container,
@@ -1050,6 +1075,7 @@ __export(index_exports, {
1050
1075
  Grid: () => Grid,
1051
1076
  GridStyled: () => GridStyled,
1052
1077
  Icon: () => Icon,
1078
+ IdentityDocumentNumberFormField: () => IdentityDocumentNumberFormField,
1053
1079
  InputStyled: () => InputStyled,
1054
1080
  MenuDropdown: () => MenuDropdown,
1055
1081
  Modal: () => Modal,
@@ -1057,6 +1083,7 @@ __export(index_exports, {
1057
1083
  MultiSelectFormField: () => MultiSelectFormField,
1058
1084
  PhoneFormField: () => PhoneFormField,
1059
1085
  RadioGroup: () => RadioGroup,
1086
+ RadioGroupFormField: () => RadioGroupFormField,
1060
1087
  RadioGroupStyled: () => RadioGroupStyled,
1061
1088
  RadioItem: () => RadioItem,
1062
1089
  Section: () => Section,
@@ -1092,6 +1119,7 @@ __export(index_exports, {
1092
1119
  TooltipProvider: () => TooltipProvider,
1093
1120
  TooltipRoot: () => TooltipRoot,
1094
1121
  TooltipTrigger: () => TooltipTrigger,
1122
+ isValidCNPJ: () => isValidCNPJ,
1095
1123
  maskFormat: () => maskFormat,
1096
1124
  maskUnformat: () => maskUnformat,
1097
1125
  useToast: () => useToast
@@ -2810,9 +2838,7 @@ var TextField = import_react2.default.forwardRef(
2810
2838
  if (maskRef) maskRef.current = r;
2811
2839
  if (fowardedRef) {
2812
2840
  if (typeof fowardedRef === "function") fowardedRef(r);
2813
- else {
2814
- fowardedRef.current = r;
2815
- }
2841
+ else fowardedRef.current = r;
2816
2842
  }
2817
2843
  }
2818
2844
  }, props), {
@@ -3104,25 +3130,15 @@ var CheckboxGroupStyled = styled(import_themes9.CheckboxGroup.Root, {
3104
3130
  cursor: "pointer"
3105
3131
  },
3106
3132
  "label button[data-state=checked]:before": {
3107
- backgroundColor: "$dark50",
3133
+ backgroundImage: `url("data:image/svg+xml,%3Csvg%20width='16'%20height='16'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cpath%20d='M2%200C0.896875%200%200%200.896875%200%202V12C0%2013.1031%200.896875%2014%202%2014H12C13.1031%2014%2014%2013.1031%2014%2012V2C14%200.896875%2013.1031%200%2012%200H2ZM10.5312%205.53125L6.53125%209.53125C6.2375%209.825%205.7625%209.825%205.47188%209.53125L3.47187%207.53125C3.17812%207.2375%203.17812%206.7625%203.47187%206.47188C3.76562%206.18125%204.24062%206.17813%204.53125%206.47188L6%207.94063L9.46875%204.46875C9.7625%204.175%2010.2375%204.175%2010.5281%204.46875C10.8187%204.7625%2010.8219%205.2375%2010.5281%205.52812L10.5312%205.53125Z'%20fill='%23004ED2'/%3E%3C/svg%3E")`,
3108
3134
  content: "",
3109
- width: "8px",
3110
- height: "8px",
3111
- position: "absolute",
3112
- top: "2px",
3113
- right: "2px",
3114
- zIndex: 2
3115
- },
3116
- "label button[data-state=checked]:after": {
3117
- backgroundColor: "$brand500",
3118
- content: "",
3119
- height: "$16",
3120
- width: "$16",
3135
+ width: "1rem",
3136
+ height: "1rem",
3121
3137
  position: "absolute",
3122
- top: "-2px",
3138
+ top: "-1px",
3123
3139
  right: "-2px",
3124
- borderRadius: "2px",
3125
- zIndex: 1
3140
+ zIndex: 2,
3141
+ backgroundRepeat: "no-repeat"
3126
3142
  },
3127
3143
  variants: {
3128
3144
  color: {
@@ -3136,8 +3152,8 @@ var CheckboxGroupStyled = styled(import_themes9.CheckboxGroup.Root, {
3136
3152
  borderColor: "$green500",
3137
3153
  backgroundColor: "$dark50"
3138
3154
  },
3139
- "label button[data-state=checked]:after": {
3140
- backgroundColor: "$green500"
3155
+ "label button[data-state=checked]:before": {
3156
+ backgroundImage: `url("data:image/svg+xml,%3Csvg%20width='16'%20height='16'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cpath%20d='M2%200C0.896875%200%200%200.896875%200%202V12C0%2013.1031%200.896875%2014%202%2014H12C13.1031%2014%2014%2013.1031%2014%2012V2C14%200.896875%2013.1031%200%2012%200H2ZM10.5312%205.53125L6.53125%209.53125C6.2375%209.825%205.7625%209.825%205.47188%209.53125L3.47187%207.53125C3.17812%207.2375%203.17812%206.7625%203.47187%206.47188C3.76562%206.18125%204.24062%206.17813%204.53125%206.47188L6%207.94063L9.46875%204.46875C9.7625%204.175%2010.2375%204.175%2010.5281%204.46875C10.8187%204.7625%2010.8219%205.2375%2010.5281%205.52812L10.5312%205.53125Z'%20fill='%2326A743'/%3E%3C/svg%3E")`
3141
3157
  }
3142
3158
  },
3143
3159
  blue: {},
@@ -3151,8 +3167,8 @@ var CheckboxGroupStyled = styled(import_themes9.CheckboxGroup.Root, {
3151
3167
  borderColor: "$error400",
3152
3168
  backgroundColor: "$dark50"
3153
3169
  },
3154
- "label button[data-state=checked]:after": {
3155
- backgroundColor: "$error600"
3170
+ "label button[data-state=checked]:before": {
3171
+ backgroundImage: `url("data:image/svg+xml,%3Csvg%20width='16'%20height='16'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cpath%20d='M2%200C0.896875%200%200%200.896875%200%202V12C0%2013.1031%200.896875%2014%202%2014H12C13.1031%2014%2014%2013.1031%2014%2012V2C14%200.896875%2013.1031%200%2012%200H2ZM10.5312%205.53125L6.53125%209.53125C6.2375%209.825%205.7625%209.825%205.47188%209.53125L3.47187%207.53125C3.17812%207.2375%203.17812%206.7625%203.47187%206.47188C3.76562%206.18125%204.24062%206.17813%204.53125%206.47188L6%207.94063L9.46875%204.46875C9.7625%204.175%2010.2375%204.175%2010.5281%204.46875C10.8187%204.7625%2010.8219%205.2375%2010.5281%205.52812L10.5312%205.53125Z'%20fill='%23DB3644'/%3E%3C/svg%3E")`
3156
3172
  }
3157
3173
  }
3158
3174
  },
@@ -3191,9 +3207,6 @@ var CheckboxGroupStyled = styled(import_themes9.CheckboxGroup.Root, {
3191
3207
  },
3192
3208
  "label button": {
3193
3209
  borderColor: "$dark300"
3194
- },
3195
- "label button[data-state=checked]:after": {
3196
- backgroundColor: "$brand500"
3197
3210
  }
3198
3211
  }
3199
3212
  },
@@ -3204,9 +3217,6 @@ var CheckboxGroupStyled = styled(import_themes9.CheckboxGroup.Root, {
3204
3217
  "label button": {
3205
3218
  borderColor: "$brand100",
3206
3219
  backgroundColor: "$dark50"
3207
- },
3208
- "label button[data-state=checked]:after": {
3209
- backgroundColor: "$brand100"
3210
3220
  }
3211
3221
  }
3212
3222
  },
@@ -3217,9 +3227,6 @@ var CheckboxGroupStyled = styled(import_themes9.CheckboxGroup.Root, {
3217
3227
  "label button": {
3218
3228
  borderColor: "$success100",
3219
3229
  backgroundColor: "$dark50"
3220
- },
3221
- "label button[data-state=checked]:after": {
3222
- backgroundColor: "$success100"
3223
3230
  }
3224
3231
  }
3225
3232
  },
@@ -3230,9 +3237,6 @@ var CheckboxGroupStyled = styled(import_themes9.CheckboxGroup.Root, {
3230
3237
  "label button": {
3231
3238
  borderColor: "$error100",
3232
3239
  backgroundColor: "$dark50"
3233
- },
3234
- "label button[data-state=checked]:after": {
3235
- backgroundColor: "$error100"
3236
3240
  }
3237
3241
  }
3238
3242
  }
@@ -3393,15 +3397,18 @@ function FilterItem(_a) {
3393
3397
  }
3394
3398
 
3395
3399
  // src/components/Dropdown.tsx
3400
+ var import_react3 = require("react");
3401
+ var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
3396
3402
  var import_themes11 = require("@radix-ui/themes");
3403
+ var import_react_fontawesome2 = require("@fortawesome/react-fontawesome");
3397
3404
  var import_jsx_runtime11 = require("react/jsx-runtime");
3398
3405
  var DropdownMenuItemStyled = styled(import_themes11.DropdownMenu.Item, {
3399
3406
  fontFamily: "$default",
3400
3407
  color: "$dark600",
3401
3408
  letterSpacing: "0px",
3402
- padding: "$8 $12",
3409
+ padding: "$8 $16",
3403
3410
  "&:hover, &:focus": {
3404
- backgroundColor: "transparent",
3411
+ backgroundColor: "$dark100",
3405
3412
  border: "none",
3406
3413
  outline: "none",
3407
3414
  cursor: "pointer"
@@ -3426,7 +3433,7 @@ var DropdownMenuStyled = styled("div", {
3426
3433
  padding: "$8 $12",
3427
3434
  width: "calc(100% - 24px)",
3428
3435
  display: "flex",
3429
- "button": {
3436
+ button: {
3430
3437
  fontFamily: "$default",
3431
3438
  color: "$dark600",
3432
3439
  letterSpacing: "0px",
@@ -3438,82 +3445,111 @@ var DropdownMenuStyled = styled("div", {
3438
3445
  alignItems: "center",
3439
3446
  gap: "$8",
3440
3447
  cursor: "pointer",
3441
- "svg": {
3448
+ svg: {
3442
3449
  marginLeft: "auto"
3443
3450
  }
3444
3451
  },
3445
3452
  variants: {
3446
3453
  typography: {
3447
3454
  labelLarge: {
3448
- "button": {
3455
+ button: {
3449
3456
  fontSize: "$labelLarge",
3450
3457
  lineHeight: "$labelLarge"
3451
3458
  }
3452
3459
  },
3453
3460
  labelMedium: {
3454
- "button": {
3461
+ button: {
3455
3462
  fontSize: "$labelMedium",
3456
3463
  lineHeight: "$labelMedium"
3457
3464
  }
3458
3465
  },
3459
3466
  labelSmall: {
3460
- "button": {
3467
+ button: {
3461
3468
  fontSize: "$labelSmall",
3462
3469
  lineHeight: "$labelSmall"
3463
3470
  }
3464
3471
  },
3465
3472
  labelExtraSmall: {
3466
- "button": {
3473
+ button: {
3467
3474
  fontSize: "$labelExtraSmall",
3468
3475
  lineHeight: "$labelExtraSmall"
3469
3476
  }
3470
3477
  }
3471
3478
  },
3472
3479
  fontWeight: {
3473
- regular: { "button": { fontWeight: "$regular" } },
3474
- medium: { "button": { fontWeight: "$medium" } },
3475
- semibold: { "button": { fontWeight: "$semibold" } },
3476
- bold: { "button": { fontWeight: "$bold" } }
3480
+ regular: { button: { fontWeight: "$regular" } },
3481
+ medium: { button: { fontWeight: "$medium" } },
3482
+ semibold: { button: { fontWeight: "$semibold" } },
3483
+ bold: { button: { fontWeight: "$bold" } }
3484
+ },
3485
+ color: {
3486
+ default: {
3487
+ border: "1px solid $dark300"
3488
+ },
3489
+ error: {
3490
+ border: "1px solid $error400"
3491
+ }
3477
3492
  }
3478
3493
  }
3479
3494
  });
3480
3495
  var DropdownMenuContentStyled = styled(import_themes11.DropdownMenu.Content, {
3481
3496
  background: "white",
3482
- padding: "$8 $12",
3483
3497
  border: "1px solid $dark300",
3484
3498
  borderRadius: "$xs",
3485
3499
  boxShadow: "0px 4px 4px 0px rgba(35, 53, 67, 0.08)",
3486
- width: "calc(var(--radix-popper-anchor-width) - 24px);",
3500
+ width: "calc(var(--radix-popper-anchor-width) + 24px);",
3487
3501
  minWidth: "100%",
3488
- marginTop: "3px"
3502
+ marginTop: "3px",
3503
+ maxHeight: "400px",
3504
+ height: "100%",
3505
+ position: "relative",
3506
+ overflow: "auto"
3489
3507
  });
3490
3508
  function DropdownMenu2(_a) {
3491
3509
  var _b = _a, {
3492
3510
  children,
3493
3511
  placeholder,
3494
3512
  typography,
3513
+ color,
3495
3514
  fontWeight
3496
3515
  } = _b, props = __objRest(_b, [
3497
3516
  "children",
3498
3517
  "placeholder",
3499
3518
  "typography",
3519
+ "color",
3500
3520
  "fontWeight"
3501
3521
  ]);
3502
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.DropdownMenu.Root, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DropdownMenuStyled, { typography, fontWeight, children: [
3503
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.DropdownMenu.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { "aria-label": placeholder || "Filtrar", children: [
3504
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: placeholder || "Filtrar" }),
3505
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.DropdownMenu.TriggerIcon, {})
3506
- ] }) }),
3507
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3508
- DropdownMenuContentStyled,
3509
- {
3510
- avoidCollisions: false,
3511
- align: "start",
3512
- alignOffset: -14,
3513
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.DropdownMenu.Group, { children })
3514
- }
3515
- )
3516
- ] }) })) });
3522
+ const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
3523
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.DropdownMenu.Root, __spreadProps(__spreadValues({ open: isOpen, onOpenChange: setIsOpen }, props), { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3524
+ DropdownMenuStyled,
3525
+ {
3526
+ typography,
3527
+ fontWeight,
3528
+ color,
3529
+ children: [
3530
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.DropdownMenu.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { "aria-label": placeholder || "Filtrar", children: [
3531
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: placeholder || "Filtrar" }),
3532
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3533
+ import_react_fontawesome2.FontAwesomeIcon,
3534
+ {
3535
+ icon: isOpen ? import_free_solid_svg_icons2.faChevronUp : import_free_solid_svg_icons2.faChevronDown,
3536
+ size: "sm",
3537
+ color: colors.dark600
3538
+ }
3539
+ )
3540
+ ] }) }),
3541
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3542
+ DropdownMenuContentStyled,
3543
+ {
3544
+ avoidCollisions: false,
3545
+ align: "start",
3546
+ alignOffset: -14,
3547
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_themes11.DropdownMenu.Group, { children })
3548
+ }
3549
+ )
3550
+ ]
3551
+ }
3552
+ ) })) });
3517
3553
  }
3518
3554
  function DropdownMenuItem(_a) {
3519
3555
  var _b = _a, {
@@ -3537,7 +3573,7 @@ function DropdownMenuItem(_a) {
3537
3573
  }
3538
3574
 
3539
3575
  // src/components/Badge.tsx
3540
- var import_react3 = __toESM(require("react"));
3576
+ var import_react4 = __toESM(require("react"));
3541
3577
  var import_themes12 = require("@radix-ui/themes");
3542
3578
  var import_jsx_runtime12 = require("react/jsx-runtime");
3543
3579
  var BadgeStyled = styled(import_themes12.Badge, {
@@ -3641,9 +3677,9 @@ var BadgeStyled = styled(import_themes12.Badge, {
3641
3677
  });
3642
3678
  function Badge(_a) {
3643
3679
  var _b = _a, { asChild, children } = _b, props = __objRest(_b, ["asChild", "children"]);
3644
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BadgeStyled, __spreadProps(__spreadValues({}, props), { children: import_react3.default.Children.map(children, (child) => {
3645
- if (import_react3.default.isValidElement(child)) {
3646
- return import_react3.default.cloneElement(child, { size: props.size });
3680
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BadgeStyled, __spreadProps(__spreadValues({}, props), { children: import_react4.default.Children.map(children, (child) => {
3681
+ if (import_react4.default.isValidElement(child)) {
3682
+ return import_react4.default.cloneElement(child, { size: props.size });
3647
3683
  }
3648
3684
  return child;
3649
3685
  }) }));
@@ -3718,7 +3754,7 @@ function Modal(_a) {
3718
3754
  }
3719
3755
 
3720
3756
  // src/components/MenuDropdown/index.tsx
3721
- var import_react4 = require("react");
3757
+ var import_react5 = require("react");
3722
3758
 
3723
3759
  // src/components/MenuDropdown/styledComponents.ts
3724
3760
  var MenuDropdownContainerStyled = styled("div", {
@@ -3754,7 +3790,7 @@ var MenuItemsContainerStyled = styled("div", {
3754
3790
  // src/components/MenuDropdown/index.tsx
3755
3791
  var import_jsx_runtime14 = require("react/jsx-runtime");
3756
3792
  function MenuDropdown({ children }) {
3757
- const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
3793
+ const [isOpen, setIsOpen] = (0, import_react5.useState)(false);
3758
3794
  function handleMenuDropdown() {
3759
3795
  setIsOpen(!isOpen);
3760
3796
  }
@@ -3765,12 +3801,12 @@ function MenuDropdown({ children }) {
3765
3801
  }
3766
3802
 
3767
3803
  // src/components/Calendar/index.tsx
3768
- var import_react6 = require("react");
3804
+ var import_react7 = require("react");
3769
3805
 
3770
3806
  // src/hooks/useOnClickOutside.tsx
3771
- var import_react5 = require("react");
3807
+ var import_react6 = require("react");
3772
3808
  function useOnClickOutside(ref, handler) {
3773
- (0, import_react5.useEffect)(() => {
3809
+ (0, import_react6.useEffect)(() => {
3774
3810
  const listener = (event) => {
3775
3811
  if (!ref.current || ref.current.contains(event.target)) {
3776
3812
  return;
@@ -7907,15 +7943,15 @@ function Calendar(_a) {
7907
7943
  "setSelected",
7908
7944
  "position"
7909
7945
  ]);
7910
- const [inputValue, setInputValue] = (0, import_react6.useState)("");
7911
- const [showContainer, setShowCalendar] = (0, import_react6.useState)(false);
7912
- const dropdownRef = (0, import_react6.useRef)(null);
7946
+ const [inputValue, setInputValue] = (0, import_react7.useState)("");
7947
+ const [showContainer, setShowCalendar] = (0, import_react7.useState)(false);
7948
+ const dropdownRef = (0, import_react7.useRef)(null);
7913
7949
  useOnClickOutside(dropdownRef, () => {
7914
7950
  setShowCalendar(false);
7915
7951
  });
7916
7952
  const today = /* @__PURE__ */ new Date();
7917
7953
  const maxDate = addYears(today, 20);
7918
- (0, import_react6.useEffect)(() => {
7954
+ (0, import_react7.useEffect)(() => {
7919
7955
  if (selected) {
7920
7956
  setInputValue(format2(selected, "dd/MM/yyyy"));
7921
7957
  } else {
@@ -8065,7 +8101,7 @@ function Drawer({
8065
8101
  }
8066
8102
 
8067
8103
  // src/components/TimePicker.tsx
8068
- var import_react7 = require("react");
8104
+ var import_react8 = require("react");
8069
8105
  var import_jsx_runtime17 = require("react/jsx-runtime");
8070
8106
  var TimePickerStyled = styled("div", {
8071
8107
  position: "relative",
@@ -8169,14 +8205,14 @@ function TimePicker({
8169
8205
  setSelected,
8170
8206
  position = "bottom"
8171
8207
  }) {
8172
- const [hours, setHours] = (0, import_react7.useState)("00");
8173
- const [minutes, setMinutes] = (0, import_react7.useState)("00");
8174
- const [rawHours, setRawHours] = (0, import_react7.useState)("00");
8175
- const [rawMinutes, setRawMinutes] = (0, import_react7.useState)("00");
8176
- const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
8177
- const dropdownRef = (0, import_react7.useRef)(null);
8208
+ const [hours, setHours] = (0, import_react8.useState)("00");
8209
+ const [minutes, setMinutes] = (0, import_react8.useState)("00");
8210
+ const [rawHours, setRawHours] = (0, import_react8.useState)("00");
8211
+ const [rawMinutes, setRawMinutes] = (0, import_react8.useState)("00");
8212
+ const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
8213
+ const dropdownRef = (0, import_react8.useRef)(null);
8178
8214
  useOnClickOutside(dropdownRef, () => setIsOpen(false));
8179
- const handleIncrement = (0, import_react7.useCallback)(
8215
+ const handleIncrement = (0, import_react8.useCallback)(
8180
8216
  (type) => {
8181
8217
  if (type === "hours") {
8182
8218
  const next = (parseInt(hours) + 1) % 24;
@@ -8190,7 +8226,7 @@ function TimePicker({
8190
8226
  },
8191
8227
  [hours, minutes]
8192
8228
  );
8193
- const handleDecrement = (0, import_react7.useCallback)(
8229
+ const handleDecrement = (0, import_react8.useCallback)(
8194
8230
  (type) => {
8195
8231
  if (type === "hours") {
8196
8232
  const prev = (parseInt(hours) - 1 + 24) % 24;
@@ -8712,7 +8748,7 @@ function Switch(props) {
8712
8748
  }
8713
8749
 
8714
8750
  // src/components/Step.tsx
8715
- var import_react8 = __toESM(require("react"));
8751
+ var import_react9 = __toESM(require("react"));
8716
8752
  var import_themes16 = require("@radix-ui/themes");
8717
8753
  var import_jsx_runtime20 = require("react/jsx-runtime");
8718
8754
  var StepStyled = styled("div", {
@@ -8828,9 +8864,9 @@ function StepList(_a) {
8828
8864
  "children",
8829
8865
  "currentStep"
8830
8866
  ]);
8831
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StepListStyled, __spreadProps(__spreadValues({}, props), { children: import_react8.default.Children.map(children, (child) => {
8832
- if (import_react8.default.isValidElement(child) && child.type === StepTrigger) {
8833
- return import_react8.default.cloneElement(child, { currentStep });
8867
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StepListStyled, __spreadProps(__spreadValues({}, props), { children: import_react9.default.Children.map(children, (child) => {
8868
+ if (import_react9.default.isValidElement(child) && child.type === StepTrigger) {
8869
+ return import_react9.default.cloneElement(child, { currentStep });
8834
8870
  }
8835
8871
  return child;
8836
8872
  }) }));
@@ -8887,7 +8923,7 @@ function Card(_a) {
8887
8923
 
8888
8924
  // src/components/TextareaField.tsx
8889
8925
  var import_themes18 = require("@radix-ui/themes");
8890
- var import_react9 = __toESM(require("react"));
8926
+ var import_react10 = __toESM(require("react"));
8891
8927
  var import_jsx_runtime22 = require("react/jsx-runtime");
8892
8928
  var TextareaFieldStyle = styled(import_themes18.TextArea, {
8893
8929
  display: "flex",
@@ -8952,10 +8988,10 @@ var TextareaLimitIndicator = styled("div", {
8952
8988
  padding: "$4"
8953
8989
  }
8954
8990
  });
8955
- var TextareaField = import_react9.default.forwardRef((_a, fowardedRef) => {
8991
+ var TextareaField = import_react10.default.forwardRef((_a, fowardedRef) => {
8956
8992
  var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
8957
- const inputRef = (0, import_react9.useRef)(null);
8958
- const badgeRef = (0, import_react9.useRef)(null);
8993
+ const inputRef = (0, import_react10.useRef)(null);
8994
+ const badgeRef = (0, import_react10.useRef)(null);
8959
8995
  const updateCharCountBadge = () => {
8960
8996
  var _a2, _b2;
8961
8997
  if (!maxLength || !badgeRef.current) return;
@@ -8991,12 +9027,12 @@ var TextareaField = import_react9.default.forwardRef((_a, fowardedRef) => {
8991
9027
  });
8992
9028
 
8993
9029
  // src/components/Toast/components/ToastItem.tsx
8994
- var import_react11 = require("react");
9030
+ var import_react12 = require("react");
8995
9031
 
8996
9032
  // src/components/Toast/styles/index.ts
8997
- var import_react10 = require("@stitches/react");
9033
+ var import_react11 = require("@stitches/react");
8998
9034
  var ToastPrimitive = __toESM(require("@radix-ui/react-toast"));
8999
- var slideIn = (0, import_react10.keyframes)({
9035
+ var slideIn = (0, import_react11.keyframes)({
9000
9036
  from: {
9001
9037
  transform: "translateX(calc(100% + 25px))",
9002
9038
  opacity: 0
@@ -9006,7 +9042,7 @@ var slideIn = (0, import_react10.keyframes)({
9006
9042
  opacity: 1
9007
9043
  }
9008
9044
  });
9009
- var slideOut = (0, import_react10.keyframes)({
9045
+ var slideOut = (0, import_react11.keyframes)({
9010
9046
  from: {
9011
9047
  transform: "translateX(0)",
9012
9048
  opacity: 1
@@ -9016,7 +9052,7 @@ var slideOut = (0, import_react10.keyframes)({
9016
9052
  opacity: 0
9017
9053
  }
9018
9054
  });
9019
- var swipeOut = (0, import_react10.keyframes)({
9055
+ var swipeOut = (0, import_react11.keyframes)({
9020
9056
  from: {
9021
9057
  transform: "translateX(var(--radix-toast-swipe-end-x))",
9022
9058
  opacity: 1
@@ -9122,7 +9158,7 @@ function ToastItem({
9122
9158
  toast,
9123
9159
  onRemove
9124
9160
  }) {
9125
- const [open, setOpen] = (0, import_react11.useState)(true);
9161
+ const [open, setOpen] = (0, import_react12.useState)(true);
9126
9162
  const handleOpenChange = (open2) => {
9127
9163
  setOpen(open2);
9128
9164
  if (!open2) {
@@ -9146,17 +9182,17 @@ function ToastItem({
9146
9182
  }
9147
9183
 
9148
9184
  // src/components/Toast/components/ToastProvider.tsx
9149
- var import_react12 = require("react");
9185
+ var import_react13 = require("react");
9150
9186
  var ToastPrimitive2 = __toESM(require("@radix-ui/react-toast"));
9151
9187
  var import_jsx_runtime24 = require("react/jsx-runtime");
9152
- var ToastContext = (0, import_react12.createContext)(null);
9188
+ var ToastContext = (0, import_react13.createContext)(null);
9153
9189
  function ToastProvider({
9154
9190
  children,
9155
9191
  defaultDuration = 5e3,
9156
9192
  maxToasts = 5,
9157
9193
  swipeDirection = "right"
9158
9194
  }) {
9159
- const [toasts, setToasts] = (0, import_react12.useState)([]);
9195
+ const [toasts, setToasts] = (0, import_react13.useState)([]);
9160
9196
  const addToast = (toastData) => {
9161
9197
  const id = Math.random().toString(36).substr(2, 9);
9162
9198
  const newToast = __spreadProps(__spreadValues({
@@ -9192,9 +9228,9 @@ function ToastProvider({
9192
9228
  }
9193
9229
 
9194
9230
  // src/components/Toast/hooks/useToast.ts
9195
- var import_react13 = require("react");
9231
+ var import_react14 = require("react");
9196
9232
  var useToast = () => {
9197
- const context = (0, import_react13.useContext)(ToastContext);
9233
+ const context = (0, import_react14.useContext)(ToastContext);
9198
9234
  if (!context) {
9199
9235
  throw new Error("useToast deve ser usado dentro de um ToastProvider");
9200
9236
  }
@@ -9253,10 +9289,10 @@ function Tooltip({
9253
9289
 
9254
9290
  // src/components/MultiSelect.tsx
9255
9291
  var import_themes19 = require("@radix-ui/themes");
9256
- var import_react_fontawesome2 = require("@fortawesome/react-fontawesome");
9257
- var import_free_solid_svg_icons2 = require("@fortawesome/free-solid-svg-icons");
9258
- var import_react14 = require("react");
9259
- var import_react15 = __toESM(require("react"));
9292
+ var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
9293
+ var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
9294
+ var import_react15 = require("react");
9295
+ var import_react16 = __toESM(require("react"));
9260
9296
  var import_jsx_runtime26 = require("react/jsx-runtime");
9261
9297
  var StyledContent = styled(import_themes19.DropdownMenu.Content, {
9262
9298
  backgroundColor: "$dark50",
@@ -9320,7 +9356,7 @@ var BadgeCloseBtn = styled("div", {
9320
9356
  backgroundColor: "$dark600"
9321
9357
  }
9322
9358
  });
9323
- var MultiSelect = import_react15.default.forwardRef(
9359
+ var MultiSelect = import_react16.default.forwardRef(
9324
9360
  ({
9325
9361
  placeholder,
9326
9362
  value: selectedValues = [],
@@ -9331,16 +9367,16 @@ var MultiSelect = import_react15.default.forwardRef(
9331
9367
  zIndex = "auto"
9332
9368
  }, fowardedRef) => {
9333
9369
  var _a;
9334
- const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
9335
- const triggerRef = (0, import_react14.useRef)(null);
9336
- const labelByValue = (0, import_react14.useMemo)(() => {
9370
+ const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
9371
+ const triggerRef = (0, import_react15.useRef)(null);
9372
+ const labelByValue = (0, import_react15.useMemo)(() => {
9337
9373
  return options.reduce((prev, curr) => {
9338
9374
  return __spreadProps(__spreadValues({}, prev), {
9339
9375
  [curr.value]: curr.label
9340
9376
  });
9341
9377
  }, {});
9342
9378
  }, [options]);
9343
- const handleRemove = (0, import_react14.useCallback)(
9379
+ const handleRemove = (0, import_react15.useCallback)(
9344
9380
  (value) => {
9345
9381
  const newValue = selectedValues.filter((v) => v !== value);
9346
9382
  onValueChange == null ? void 0 : onValueChange(newValue);
@@ -9378,15 +9414,15 @@ var MultiSelect = import_react15.default.forwardRef(
9378
9414
  handleRemove(value);
9379
9415
  },
9380
9416
  role: "button",
9381
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_fontawesome2.FontAwesomeIcon, { icon: import_free_solid_svg_icons2.faX, size: "xs" })
9417
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faX, size: "xs" })
9382
9418
  }
9383
9419
  )
9384
9420
  ] }) }, value);
9385
9421
  }) }),
9386
9422
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9387
- import_react_fontawesome2.FontAwesomeIcon,
9423
+ import_react_fontawesome3.FontAwesomeIcon,
9388
9424
  {
9389
- icon: isOpen ? import_free_solid_svg_icons2.faChevronUp : import_free_solid_svg_icons2.faChevronDown,
9425
+ icon: isOpen ? import_free_solid_svg_icons3.faChevronUp : import_free_solid_svg_icons3.faChevronDown,
9390
9426
  size: "sm",
9391
9427
  color: colors.dark600
9392
9428
  }
@@ -9609,8 +9645,8 @@ function Section(_a) {
9609
9645
  }
9610
9646
 
9611
9647
  // src/components/FormFields/ErrorFormMessage.tsx
9612
- var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
9613
- var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
9648
+ var import_free_solid_svg_icons4 = require("@fortawesome/free-solid-svg-icons");
9649
+ var import_react_fontawesome4 = require("@fortawesome/react-fontawesome");
9614
9650
  var import_jsx_runtime30 = require("react/jsx-runtime");
9615
9651
  var ErrorFormMessage = ({ message: message2 }) => {
9616
9652
  if (!message2) return null;
@@ -9618,7 +9654,7 @@ var ErrorFormMessage = ({ message: message2 }) => {
9618
9654
  return null;
9619
9655
  }
9620
9656
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex2, { justify: "start", align: "center", gap: 6, children: [
9621
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faXmarkCircle, color: colors.error600, size: "1x" }),
9657
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_fontawesome4.FontAwesomeIcon, { icon: import_free_solid_svg_icons4.faXmarkCircle, color: colors.error600, size: "1x" }),
9622
9658
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { typography: "bodyXS", fontWeight: "medium", color: "error600", children: message2 })
9623
9659
  ] });
9624
9660
  };
@@ -9693,22 +9729,39 @@ var TextAreaFormField = (_a) => {
9693
9729
 
9694
9730
  // src/components/FormFields/TextFormField.tsx
9695
9731
  var import_react_hook_form2 = require("react-hook-form");
9732
+
9733
+ // src/utils/getNestedValue.ts
9734
+ function getNestedValue(obj, path) {
9735
+ return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
9736
+ }
9737
+
9738
+ // src/components/FormFields/TextFormField.tsx
9696
9739
  var import_jsx_runtime33 = require("react/jsx-runtime");
9697
9740
  var TextFormField = ({
9698
9741
  name,
9699
9742
  label,
9700
9743
  required,
9701
- placeholder
9744
+ placeholder,
9745
+ mask,
9746
+ validation,
9747
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
9748
+ disabled = false,
9749
+ value,
9750
+ onChange
9702
9751
  }) => {
9703
- var _a;
9704
9752
  const {
9705
9753
  register,
9706
9754
  formState: { errors }
9707
9755
  } = (0, import_react_hook_form2.useFormContext)();
9708
- const haveError = !!errors[name];
9709
- const errorMsg = (_a = errors[name]) == null ? void 0 : _a.message;
9756
+ const validationRules = __spreadValues({
9757
+ required: required ? validationErrorMessage : false
9758
+ }, validation);
9759
+ const _a = register(name, validationRules), { ref } = _a, restFieldProps = __objRest(_a, ["ref"]);
9760
+ const fieldError = getNestedValue(errors, name);
9761
+ const haveError = !!fieldError;
9762
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
9710
9763
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex2, { direction: "column", children: [
9711
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
9764
+ label && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
9712
9765
  FormLabel,
9713
9766
  {
9714
9767
  name,
@@ -9719,10 +9772,16 @@ var TextFormField = ({
9719
9772
  ),
9720
9773
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
9721
9774
  TextField,
9722
- __spreadProps(__spreadValues({}, register(name, { required })), {
9775
+ __spreadProps(__spreadValues({
9776
+ mask,
9723
9777
  placeholder,
9778
+ disabled,
9724
9779
  color: haveError ? "error" : "default",
9725
9780
  "aria-labelledby": `${name}-label`
9781
+ }, restFieldProps), {
9782
+ ref,
9783
+ onChange,
9784
+ value
9726
9785
  })
9727
9786
  ),
9728
9787
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ErrorFormMessage, { message: errorMsg })
@@ -9733,10 +9792,17 @@ var TextFormField = ({
9733
9792
  var import_react_hook_form3 = require("react-hook-form");
9734
9793
  var import_jsx_runtime34 = require("react/jsx-runtime");
9735
9794
  var Form = (_a) => {
9736
- var _b = _a, { onSubmit, children } = _b, props = __objRest(_b, ["onSubmit", "children"]);
9737
- const methods = (0, import_react_hook_form3.useForm)(props);
9738
- const { handleSubmit } = methods;
9739
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_hook_form3.FormProvider, __spreadProps(__spreadValues({}, methods), { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("form", { onSubmit: handleSubmit(onSubmit), children }) }));
9795
+ var _b = _a, {
9796
+ onSubmit,
9797
+ children,
9798
+ methods
9799
+ } = _b, props = __objRest(_b, [
9800
+ "onSubmit",
9801
+ "children",
9802
+ "methods"
9803
+ ]);
9804
+ const formMethods = methods || (0, import_react_hook_form3.useForm)(props);
9805
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_hook_form3.FormProvider, __spreadProps(__spreadValues({}, formMethods), { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("form", { onSubmit: formMethods.handleSubmit(onSubmit), children }) }));
9740
9806
  };
9741
9807
 
9742
9808
  // src/components/FormFields/MultiSelectFormField.tsx
@@ -9832,8 +9898,792 @@ var PhoneFormField = (_a) => {
9832
9898
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ErrorFormMessage, { message: errorMsg })
9833
9899
  ] });
9834
9900
  };
9901
+
9902
+ // src/components/FormFields/CPFFormField.tsx
9903
+ var import_react_hook_form6 = require("react-hook-form");
9904
+ var import_jsx_runtime37 = require("react/jsx-runtime");
9905
+ var isValidCPF = (cpf) => {
9906
+ cpf = cpf.replace(/[^\d]+/g, "");
9907
+ if (cpf.length !== 11 || /^(\d)\1{10}$/.test(cpf)) return false;
9908
+ let sum = 0;
9909
+ for (let i = 0; i < 9; i++) sum += parseInt(cpf.charAt(i)) * (10 - i);
9910
+ let rest = sum * 10 % 11;
9911
+ if (rest === 10 || rest === 11) rest = 0;
9912
+ if (rest !== parseInt(cpf.charAt(9))) return false;
9913
+ sum = 0;
9914
+ for (let i = 0; i < 10; i++) sum += parseInt(cpf.charAt(i)) * (11 - i);
9915
+ rest = sum * 10 % 11;
9916
+ if (rest === 10 || rest === 11) rest = 0;
9917
+ if (rest !== parseInt(cpf.charAt(10))) return false;
9918
+ return true;
9919
+ };
9920
+ var CPFFormField = ({
9921
+ name,
9922
+ label,
9923
+ required,
9924
+ placeholder,
9925
+ validationErrorMessage,
9926
+ foreignerLabel
9927
+ }) => {
9928
+ const { control, setValue } = (0, import_react_hook_form6.useFormContext)();
9929
+ const foreigner = (0, import_react_hook_form6.useWatch)({ name: "foreigner", control });
9930
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex2, { direction: "column", children: [
9931
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
9932
+ TextFormField,
9933
+ {
9934
+ name,
9935
+ label,
9936
+ required: required && !foreigner,
9937
+ placeholder: placeholder || "000.000.000-00",
9938
+ mask: {
9939
+ mask: "___.___.___-__",
9940
+ replacement: { _: /[0-9]/ }
9941
+ },
9942
+ validation: {
9943
+ validate: (value) => {
9944
+ if (!required || foreigner) return true;
9945
+ return isValidCPF(value) || validationErrorMessage;
9946
+ }
9947
+ },
9948
+ disabled: foreigner
9949
+ }
9950
+ ),
9951
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
9952
+ CheckboxGroup,
9953
+ {
9954
+ name: "foreigner",
9955
+ onValueChange: (value) => {
9956
+ const isForeigner = value.includes("true");
9957
+ setValue("foreigner", isForeigner);
9958
+ if (isForeigner) {
9959
+ setValue(name, "");
9960
+ }
9961
+ },
9962
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CheckboxItem, { value: "true", children: foreignerLabel })
9963
+ }
9964
+ )
9965
+ ] });
9966
+ };
9967
+
9968
+ // src/components/FormFields/CNPJFormField.tsx
9969
+ var import_jsx_runtime38 = require("react/jsx-runtime");
9970
+ var matchesNonDigit = new RegExp(/\D+/g);
9971
+ var getWeights = (size, start, end) => {
9972
+ const weights = [];
9973
+ for (let i = size - 1; i >= 0; i--) {
9974
+ weights.push((end ? i % (end - start + 1) : i) + start);
9975
+ }
9976
+ return weights;
9977
+ };
9978
+ var calcValidatorDigit = (basicDigits, weights) => {
9979
+ const sum = basicDigits.reduce(
9980
+ (sum2, digit, index) => sum2 + digit * weights[index],
9981
+ 0
9982
+ );
9983
+ const mod = sum % 11;
9984
+ return mod < 2 ? 0 : 11 - mod;
9985
+ };
9986
+ var cnpjWeights1 = getWeights(12, 2, 9);
9987
+ var cnpjWeights2 = getWeights(13, 2, 9);
9988
+ var isValidCNPJ = (cnpj) => {
9989
+ const digitsOnlyCnpj = cnpj.replace(matchesNonDigit, "");
9990
+ if (digitsOnlyCnpj.length !== 14) {
9991
+ return false;
9992
+ }
9993
+ if (/^(\d)\1+$/.test(digitsOnlyCnpj)) return false;
9994
+ const cnpjArray = digitsOnlyCnpj.split("").map((digit) => Number.parseInt(digit));
9995
+ const validatorDigit1 = cnpjArray[12];
9996
+ const validatorDigit2 = cnpjArray[13];
9997
+ const basicDigits = cnpjArray.slice(0, 12);
9998
+ const expectedValidator1 = calcValidatorDigit(basicDigits, cnpjWeights1);
9999
+ if (expectedValidator1 !== validatorDigit1) {
10000
+ return false;
10001
+ }
10002
+ const expectedValidator2 = calcValidatorDigit(
10003
+ [...basicDigits, validatorDigit1],
10004
+ cnpjWeights2
10005
+ );
10006
+ if (expectedValidator2 !== validatorDigit2) {
10007
+ return false;
10008
+ }
10009
+ return true;
10010
+ };
10011
+ var CNPJFormField = ({
10012
+ name,
10013
+ label,
10014
+ required,
10015
+ placeholder,
10016
+ validationErrorMessage
10017
+ }) => {
10018
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
10019
+ TextFormField,
10020
+ {
10021
+ name,
10022
+ label,
10023
+ required,
10024
+ placeholder: placeholder || "00.000.000/0000-00",
10025
+ mask: {
10026
+ mask: "__.___.___/____-__",
10027
+ replacement: { _: /[0-9]/ }
10028
+ },
10029
+ validation: {
10030
+ validate: (value) => {
10031
+ const isEmpty = value.replace(matchesNonDigit, "").length === 0;
10032
+ if (!required && isEmpty) return true;
10033
+ return isValidCNPJ(value) || validationErrorMessage;
10034
+ }
10035
+ }
10036
+ }
10037
+ );
10038
+ };
10039
+
10040
+ // src/components/FormFields/BirthDateFormField.tsx
10041
+ var import_jsx_runtime39 = require("react/jsx-runtime");
10042
+ var isValidDate = (day, month, year) => {
10043
+ const date = new Date(year, month - 1, day);
10044
+ return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;
10045
+ };
10046
+ var isValidBirthDate = (value, language) => {
10047
+ const [part1, part2, part3] = value.split("/").map(Number);
10048
+ let day = 0, month = 0, year = 0;
10049
+ if (language === "en") {
10050
+ month = part1;
10051
+ day = part2;
10052
+ year = part3;
10053
+ } else {
10054
+ day = part1;
10055
+ month = part2;
10056
+ year = part3;
10057
+ }
10058
+ if (!isValidDate(day, month, year)) return false;
10059
+ const today = /* @__PURE__ */ new Date();
10060
+ const birthDate = new Date(year, month - 1, day);
10061
+ if (birthDate > today) return false;
10062
+ const age = today.getFullYear() - birthDate.getFullYear();
10063
+ const beforeBirthday = today.getMonth() < birthDate.getMonth() || today.getMonth() === birthDate.getMonth() && today.getDate() < birthDate.getDate();
10064
+ const realAge = beforeBirthday ? age - 1 : age;
10065
+ return realAge <= 100;
10066
+ };
10067
+ var BirthDateFormField = ({
10068
+ name,
10069
+ label,
10070
+ required,
10071
+ placeholder,
10072
+ validationErrorMessage,
10073
+ language
10074
+ }) => {
10075
+ const inputPlaceholder = placeholder || (language === "en" ? "MM/DD/YYYY" : "DD/MM/AAAA");
10076
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10077
+ TextFormField,
10078
+ {
10079
+ name,
10080
+ label,
10081
+ required,
10082
+ placeholder: inputPlaceholder,
10083
+ mask: {
10084
+ mask: "__/__/____",
10085
+ replacement: { _: /[0-9]/ }
10086
+ },
10087
+ validation: {
10088
+ validate: (value) => {
10089
+ const isEmpty = value.replace(/[^\d]+/g, "").length === 0;
10090
+ if (!required && isEmpty) return true;
10091
+ return isValidBirthDate(value, language) || validationErrorMessage;
10092
+ }
10093
+ }
10094
+ }
10095
+ );
10096
+ };
10097
+
10098
+ // src/components/FormFields/IdentityDocumentNumberFormField.tsx
10099
+ var import_jsx_runtime40 = require("react/jsx-runtime");
10100
+ var isValidRG = (rg) => {
10101
+ const cleaned = rg.replace(/[^\d]/g, "");
10102
+ return /^\d{9}$/.test(cleaned);
10103
+ };
10104
+ var IdentityDocumentNumberFormField = ({
10105
+ name,
10106
+ label,
10107
+ required,
10108
+ placeholder,
10109
+ validationErrorMessage
10110
+ }) => {
10111
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
10112
+ TextFormField,
10113
+ {
10114
+ name,
10115
+ label,
10116
+ required,
10117
+ placeholder: placeholder || "__.___.___-_",
10118
+ mask: {
10119
+ mask: "__.___.___-_",
10120
+ replacement: { _: /[0-9]/ }
10121
+ },
10122
+ validation: {
10123
+ validate: (value) => {
10124
+ const isEmpty = value.replace(/[^\d]/g, "").length === 0;
10125
+ if (!required && isEmpty) return true;
10126
+ return isValidRG(value) || validationErrorMessage;
10127
+ }
10128
+ }
10129
+ }
10130
+ );
10131
+ };
10132
+
10133
+ // src/components/FormFields/AddressFormFields/index.tsx
10134
+ var import_react18 = require("react");
10135
+ var import_react_hook_form10 = require("react-hook-form");
10136
+
10137
+ // src/components/FormFields/SelectFormField.tsx
10138
+ var import_react_hook_form7 = require("react-hook-form");
10139
+ var import_jsx_runtime41 = require("react/jsx-runtime");
10140
+ var SelectFormField = ({
10141
+ name,
10142
+ label,
10143
+ required,
10144
+ placeholder = "Selecione",
10145
+ options,
10146
+ validation,
10147
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
10148
+ defaultValue
10149
+ }) => {
10150
+ const {
10151
+ control,
10152
+ formState: { errors }
10153
+ } = (0, import_react_hook_form7.useFormContext)();
10154
+ const fieldError = getNestedValue(errors, name);
10155
+ const haveError = !!fieldError;
10156
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
10157
+ const validationRules = __spreadValues({
10158
+ required: required ? validationErrorMessage : false
10159
+ }, validation);
10160
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Flex2, { direction: "column", children: [
10161
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
10162
+ FormLabel,
10163
+ {
10164
+ name,
10165
+ label,
10166
+ required,
10167
+ haveError
10168
+ }
10169
+ ),
10170
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
10171
+ import_react_hook_form7.Controller,
10172
+ {
10173
+ control,
10174
+ name,
10175
+ rules: validationRules,
10176
+ defaultValue: defaultValue || "",
10177
+ render: ({ field: { value, onChange } }) => {
10178
+ const selectedOption = options.find((opt) => opt.value === value);
10179
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
10180
+ DropdownMenu2,
10181
+ {
10182
+ placeholder: (selectedOption == null ? void 0 : selectedOption.label) || placeholder,
10183
+ fontWeight: "regular",
10184
+ typography: "labelLarge",
10185
+ color: haveError ? "error" : "default",
10186
+ children: options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
10187
+ DropdownMenuItem,
10188
+ {
10189
+ value: option.value,
10190
+ onSelect: () => onChange(option.value),
10191
+ fontWeight: "regular",
10192
+ typography: "labelLarge",
10193
+ children: option.label
10194
+ },
10195
+ `${option.value}${index}`
10196
+ ))
10197
+ }
10198
+ );
10199
+ }
10200
+ }
10201
+ ),
10202
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ErrorFormMessage, { message: errorMsg })
10203
+ ] });
10204
+ };
10205
+
10206
+ // src/hooks/useCountries.ts
10207
+ var import_i18n_iso_countries = __toESM(require("i18n-iso-countries"));
10208
+ var import_pt = __toESM(require("i18n-iso-countries/langs/pt.json"));
10209
+ var import_en = __toESM(require("i18n-iso-countries/langs/en.json"));
10210
+ var import_es = __toESM(require("i18n-iso-countries/langs/es.json"));
10211
+ function useCountries(language = "pt-BR") {
10212
+ import_i18n_iso_countries.default.registerLocale(import_pt.default);
10213
+ import_i18n_iso_countries.default.registerLocale(import_en.default);
10214
+ import_i18n_iso_countries.default.registerLocale(import_es.default);
10215
+ const langMap = {
10216
+ "pt-BR": "pt",
10217
+ en: "en",
10218
+ es: "es"
10219
+ };
10220
+ const langCode = langMap[language];
10221
+ const namesPT = import_i18n_iso_countries.default.getNames("pt", { select: "official" });
10222
+ const namesLang = import_i18n_iso_countries.default.getNames(langCode, { select: "official" });
10223
+ return Object.entries(namesPT).map(([_, namePT]) => {
10224
+ var _a;
10225
+ const nameTranslated = (_a = Object.entries(namesLang).find(([, name]) => namePT === name)) != null ? _a : Object.entries(namesPT).find(([, name]) => name === namePT);
10226
+ const label = (nameTranslated == null ? void 0 : nameTranslated[1]) || namePT;
10227
+ return {
10228
+ value: namePT,
10229
+ label
10230
+ };
10231
+ });
10232
+ }
10233
+
10234
+ // src/components/FormFields/AddressFormFields/CountryFormField.tsx
10235
+ var import_jsx_runtime42 = require("react/jsx-runtime");
10236
+ function CountryFormField({
10237
+ name,
10238
+ label,
10239
+ required,
10240
+ language = "pt-BR"
10241
+ }) {
10242
+ const countries2 = useCountries(language);
10243
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Flex2, { direction: "column", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10244
+ SelectFormField,
10245
+ {
10246
+ label,
10247
+ name,
10248
+ options: countries2,
10249
+ required,
10250
+ defaultValue: "Brasil"
10251
+ }
10252
+ ) });
10253
+ }
10254
+
10255
+ // src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx
10256
+ var import_react_hook_form8 = require("react-hook-form");
10257
+ var import_jsx_runtime43 = require("react/jsx-runtime");
10258
+ var PostalCodeFormField = ({
10259
+ name,
10260
+ label,
10261
+ required,
10262
+ placeholder,
10263
+ validationErrorMessage
10264
+ }) => {
10265
+ const { control } = (0, import_react_hook_form8.useFormContext)();
10266
+ const {
10267
+ field: { onChange, value }
10268
+ } = (0, import_react_hook_form8.useController)({ name, control });
10269
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
10270
+ TextFormField,
10271
+ {
10272
+ name,
10273
+ label,
10274
+ required,
10275
+ placeholder: placeholder || "00000-000",
10276
+ mask: {
10277
+ mask: "_____-___",
10278
+ replacement: { _: /[0-9]/ }
10279
+ },
10280
+ value,
10281
+ onChange,
10282
+ validation: {
10283
+ validate: (value2) => {
10284
+ const isEmpty = value2.replace(/[^\d]/g, "").length === 0;
10285
+ if (!required && isEmpty) return true;
10286
+ return /^\d{8}$/.test(value2.replace(/\D/g, "")) || validationErrorMessage;
10287
+ }
10288
+ }
10289
+ }
10290
+ );
10291
+ };
10292
+
10293
+ // src/utils/states.ts
10294
+ var brazilianStates = [
10295
+ { value: "AC", label: "Acre" },
10296
+ { value: "AL", label: "Alagoas" },
10297
+ { value: "AP", label: "Amap\xE1" },
10298
+ { value: "AM", label: "Amazonas" },
10299
+ { value: "BA", label: "Bahia" },
10300
+ { value: "CE", label: "Cear\xE1" },
10301
+ { value: "DF", label: "Distrito Federal" },
10302
+ { value: "ES", label: "Esp\xEDrito Santo" },
10303
+ { value: "GO", label: "Goi\xE1s" },
10304
+ { value: "MA", label: "Maranh\xE3o" },
10305
+ { value: "MT", label: "Mato Grosso" },
10306
+ { value: "MS", label: "Mato Grosso do Sul" },
10307
+ { value: "MG", label: "Minas Gerais" },
10308
+ { value: "PA", label: "Par\xE1" },
10309
+ { value: "PB", label: "Para\xEDba" },
10310
+ { value: "PR", label: "Paran\xE1" },
10311
+ { value: "PE", label: "Pernambuco" },
10312
+ { value: "PI", label: "Piau\xED" },
10313
+ { value: "RJ", label: "Rio de Janeiro" },
10314
+ { value: "RN", label: "Rio Grande do Norte" },
10315
+ { value: "RS", label: "Rio Grande do Sul" },
10316
+ { value: "RO", label: "Rond\xF4nia" },
10317
+ { value: "RR", label: "Roraima" },
10318
+ { value: "SC", label: "Santa Catarina" },
10319
+ { value: "SP", label: "S\xE3o Paulo" },
10320
+ { value: "SE", label: "Sergipe" },
10321
+ { value: "TO", label: "Tocantins" }
10322
+ ];
10323
+
10324
+ // src/components/FormFields/AddressFormFields/StateFormField.tsx
10325
+ var import_jsx_runtime44 = require("react/jsx-runtime");
10326
+ function StateFormField({
10327
+ name,
10328
+ label,
10329
+ required,
10330
+ isBrazil
10331
+ }) {
10332
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: isBrazil ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
10333
+ SelectFormField,
10334
+ {
10335
+ name,
10336
+ options: brazilianStates,
10337
+ required,
10338
+ label
10339
+ }
10340
+ ) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TextFormField, { name, required, label }) });
10341
+ }
10342
+
10343
+ // src/components/FormFields/AddressFormFields/CityFormField.tsx
10344
+ var import_react17 = require("react");
10345
+ var import_react_hook_form9 = require("react-hook-form");
10346
+ var import_jsx_runtime45 = require("react/jsx-runtime");
10347
+ function CityFormField({
10348
+ name,
10349
+ label,
10350
+ stateName,
10351
+ required,
10352
+ isBrazil,
10353
+ placeholder
10354
+ }) {
10355
+ const { control, watch } = (0, import_react_hook_form9.useFormContext)();
10356
+ const selectedState = watch(stateName);
10357
+ const [cities, setCities] = (0, import_react17.useState)([]);
10358
+ const [loading, setLoading] = (0, import_react17.useState)(false);
10359
+ (0, import_react17.useEffect)(() => {
10360
+ if (!isBrazil) {
10361
+ setCities([]);
10362
+ return;
10363
+ }
10364
+ if (!selectedState) {
10365
+ setCities([]);
10366
+ return;
10367
+ }
10368
+ function fetchCities() {
10369
+ return __async(this, null, function* () {
10370
+ setLoading(true);
10371
+ try {
10372
+ const ufResponse = yield fetch(
10373
+ `https://servicodados.ibge.gov.br/api/v1/localidades/estados`
10374
+ );
10375
+ const estados = yield ufResponse.json();
10376
+ const estadoSelecionado = estados.find(
10377
+ (e) => e.sigla === selectedState
10378
+ );
10379
+ if (!estadoSelecionado) {
10380
+ setCities([]);
10381
+ setLoading(false);
10382
+ return;
10383
+ }
10384
+ const response = yield fetch(
10385
+ `https://servicodados.ibge.gov.br/api/v1/localidades/estados/${estadoSelecionado.id}/municipios`
10386
+ );
10387
+ const data = yield response.json();
10388
+ setCities(data);
10389
+ } catch (error) {
10390
+ setCities([]);
10391
+ } finally {
10392
+ setLoading(false);
10393
+ }
10394
+ });
10395
+ }
10396
+ fetchCities();
10397
+ }, [selectedState, isBrazil]);
10398
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_jsx_runtime45.Fragment, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10399
+ import_react_hook_form9.Controller,
10400
+ {
10401
+ name,
10402
+ control,
10403
+ rules: { required },
10404
+ render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10405
+ SelectFormField,
10406
+ __spreadProps(__spreadValues({
10407
+ label,
10408
+ required
10409
+ }, field), {
10410
+ options: cities.map((city) => ({
10411
+ value: city.nome,
10412
+ label: city.nome
10413
+ })),
10414
+ placeholder: loading ? "Carregando cidades..." : placeholder || "Selecione a cidade"
10415
+ })
10416
+ )
10417
+ }
10418
+ ) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10419
+ TextFormField,
10420
+ {
10421
+ name,
10422
+ required,
10423
+ placeholder,
10424
+ label
10425
+ }
10426
+ ) });
10427
+ }
10428
+
10429
+ // src/components/FormFields/AddressFormFields/index.tsx
10430
+ var import_jsx_runtime46 = require("react/jsx-runtime");
10431
+ function getNestedValue2(obj, path) {
10432
+ return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
10433
+ }
10434
+ var AddressContainerStyled = styled("div", {
10435
+ variants: {
10436
+ layout: {
10437
+ column: {
10438
+ display: "flex",
10439
+ flexDirection: "column",
10440
+ gap: "$4"
10441
+ },
10442
+ grid: {
10443
+ display: "grid",
10444
+ gap: "$8 $16",
10445
+ gridTemplateColumns: "repeat(2, 1fr)",
10446
+ "& > *:nth-child(1)": {
10447
+ gridColumn: "span 2"
10448
+ }
10449
+ }
10450
+ }
10451
+ }
10452
+ });
10453
+ function AddressFormFields({
10454
+ name,
10455
+ label,
10456
+ required,
10457
+ layout = "column"
10458
+ }) {
10459
+ const { control, setValue } = (0, import_react_hook_form10.useFormContext)();
10460
+ const { errors } = (0, import_react_hook_form10.useFormState)({ control });
10461
+ const selectedCountry = (0, import_react_hook_form10.useWatch)({ control, name: `${name}.country` });
10462
+ const cep = (0, import_react_hook_form10.useWatch)({ control, name: `${name}.zip_code` });
10463
+ const isBrazil = selectedCountry === "Brasil";
10464
+ const addressErrors = getNestedValue2(errors, name);
10465
+ const haveError = !!addressErrors;
10466
+ (0, import_react18.useEffect)(() => {
10467
+ const cleanedCep = cep == null ? void 0 : cep.replace(/\D/g, "");
10468
+ if (isBrazil && (cleanedCep == null ? void 0 : cleanedCep.length) === 8) {
10469
+ fetch(`https://viacep.com.br/ws/${cleanedCep}/json`).then((res) => res.json()).then((data) => {
10470
+ if (!data.erro) {
10471
+ setValue(`${name}.street`, data.logradouro || "");
10472
+ setValue(`${name}.neighborhood`, data.bairro || "");
10473
+ setValue(`${name}.city`, data.localidade || "");
10474
+ setValue(`${name}.state`, data.uf || "");
10475
+ }
10476
+ }).catch(() => {
10477
+ console.error("Erro ao buscar CEP");
10478
+ });
10479
+ }
10480
+ }, [cep, isBrazil]);
10481
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(AddressContainerStyled, { layout, children: [
10482
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10483
+ FormLabel,
10484
+ {
10485
+ name,
10486
+ label,
10487
+ required,
10488
+ haveError
10489
+ }
10490
+ ),
10491
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10492
+ CountryFormField,
10493
+ {
10494
+ name: `${name}.country`,
10495
+ label: "Pa\xEDs",
10496
+ required,
10497
+ language: "pt-BR"
10498
+ }
10499
+ ),
10500
+ isBrazil ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10501
+ PostalCodeFormField,
10502
+ {
10503
+ name: `${name}.zip_code`,
10504
+ label: "CEP",
10505
+ required,
10506
+ placeholder: "00000-000",
10507
+ validationErrorMessage: "CEP inv\xE1lido"
10508
+ }
10509
+ ) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10510
+ TextFormField,
10511
+ {
10512
+ name: `${name}.zip_code`,
10513
+ label: "C\xF3digo Postal",
10514
+ required
10515
+ }
10516
+ ),
10517
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10518
+ StateFormField,
10519
+ {
10520
+ name: `${name}.state`,
10521
+ label: "Estado",
10522
+ required,
10523
+ isBrazil
10524
+ }
10525
+ ),
10526
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10527
+ CityFormField,
10528
+ {
10529
+ name: `${name}.city`,
10530
+ stateName: `${name}.state`,
10531
+ label: "Cidade",
10532
+ required,
10533
+ isBrazil
10534
+ }
10535
+ ),
10536
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TextFormField, { name: `${name}.street`, label: "Rua", required }),
10537
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10538
+ TextFormField,
10539
+ {
10540
+ name: `${name}.number`,
10541
+ label: "N\xFAmero",
10542
+ required
10543
+ }
10544
+ ),
10545
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10546
+ TextFormField,
10547
+ {
10548
+ name: `${name}.neighborhood`,
10549
+ label: "Bairro",
10550
+ required
10551
+ }
10552
+ ),
10553
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TextFormField, { name: `${name}.complement`, label: "Complemento" })
10554
+ ] });
10555
+ }
10556
+
10557
+ // src/components/FormFields/RadioGroupFormField.tsx
10558
+ var import_react_hook_form11 = require("react-hook-form");
10559
+ var import_jsx_runtime47 = require("react/jsx-runtime");
10560
+ var RadioGroupFormField = ({
10561
+ name,
10562
+ label,
10563
+ options,
10564
+ required,
10565
+ defaultValue,
10566
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
10567
+ color = "blue",
10568
+ fontWeight = "regular",
10569
+ disabled = false
10570
+ }) => {
10571
+ const {
10572
+ control,
10573
+ formState: { errors }
10574
+ } = (0, import_react_hook_form11.useFormContext)();
10575
+ const fieldError = getNestedValue(errors, name);
10576
+ const haveError = !!fieldError;
10577
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
10578
+ const validationRules = {
10579
+ required: required ? validationErrorMessage : false
10580
+ };
10581
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Flex2, { direction: "column", children: [
10582
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10583
+ FormLabel,
10584
+ {
10585
+ name,
10586
+ label,
10587
+ required,
10588
+ haveError
10589
+ }
10590
+ ),
10591
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10592
+ import_react_hook_form11.Controller,
10593
+ {
10594
+ name,
10595
+ control,
10596
+ defaultValue: defaultValue || "",
10597
+ rules: validationRules,
10598
+ render: ({ field: { value, onChange } }) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10599
+ RadioGroup,
10600
+ {
10601
+ value,
10602
+ onValueChange: onChange,
10603
+ color: haveError ? "error" : color,
10604
+ fontWeight,
10605
+ disabled,
10606
+ children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { children: [
10607
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RadioItem, { value: option.value }),
10608
+ option.label
10609
+ ] }, option.value))
10610
+ }
10611
+ )
10612
+ }
10613
+ ),
10614
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ErrorFormMessage, { message: errorMsg })
10615
+ ] });
10616
+ };
10617
+
10618
+ // src/components/FormFields/CheckboxGroupFormField.tsx
10619
+ var import_react_hook_form12 = require("react-hook-form");
10620
+ var import_jsx_runtime48 = require("react/jsx-runtime");
10621
+ var CheckboxGroupFormField = ({
10622
+ name,
10623
+ label,
10624
+ options,
10625
+ required,
10626
+ validationErrorMessage = "Selecione pelo menos uma op\xE7\xE3o.",
10627
+ defaultValue = [],
10628
+ color = "blue",
10629
+ fontWeight = "regular",
10630
+ disabled = false
10631
+ }) => {
10632
+ const {
10633
+ control,
10634
+ formState: { errors }
10635
+ } = (0, import_react_hook_form12.useFormContext)();
10636
+ const fieldError = getNestedValue(errors, name);
10637
+ const haveError = !!fieldError;
10638
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
10639
+ const validationRules = {
10640
+ required: required ? validationErrorMessage : false,
10641
+ validate: required ? (value) => (value == null ? void 0 : value.length) > 0 || validationErrorMessage : void 0
10642
+ };
10643
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Flex2, { direction: "column", children: [
10644
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10645
+ FormLabel,
10646
+ {
10647
+ name,
10648
+ label,
10649
+ required,
10650
+ haveError
10651
+ }
10652
+ ),
10653
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10654
+ import_react_hook_form12.Controller,
10655
+ {
10656
+ name,
10657
+ control,
10658
+ rules: validationRules,
10659
+ defaultValue,
10660
+ render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10661
+ CheckboxGroup,
10662
+ {
10663
+ name,
10664
+ onValueChange: field.onChange,
10665
+ color: haveError ? "error" : color,
10666
+ fontWeight,
10667
+ disabled,
10668
+ children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
10669
+ CheckboxItem,
10670
+ {
10671
+ value: option.value,
10672
+ disabled,
10673
+ children: option.label
10674
+ },
10675
+ option.value
10676
+ ))
10677
+ }
10678
+ )
10679
+ }
10680
+ ),
10681
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ErrorFormMessage, { message: errorMsg })
10682
+ ] });
10683
+ };
9835
10684
  // Annotate the CommonJS export names for ESM import in node:
9836
10685
  0 && (module.exports = {
10686
+ AddressFormFields,
9837
10687
  Alert,
9838
10688
  AlertDialogCompleteStyled,
9839
10689
  AlertDialogDescriptionStyled,
@@ -9846,16 +10696,20 @@ var PhoneFormField = (_a) => {
9846
10696
  AvatarStyled,
9847
10697
  Badge,
9848
10698
  BadgeStyled,
10699
+ BirthDateFormField,
9849
10700
  Box,
9850
10701
  Button,
9851
10702
  ButtonGroup,
9852
10703
  ButtonGroupStyled,
9853
10704
  ButtonItem,
9854
10705
  ButtonItemStyled,
10706
+ CNPJFormField,
10707
+ CPFFormField,
9855
10708
  Calendar,
9856
10709
  Card,
9857
10710
  CardStyled,
9858
10711
  CheckboxGroup,
10712
+ CheckboxGroupFormField,
9859
10713
  CheckboxGroupStyled,
9860
10714
  CheckboxItem,
9861
10715
  Container,
@@ -9873,6 +10727,7 @@ var PhoneFormField = (_a) => {
9873
10727
  Grid,
9874
10728
  GridStyled,
9875
10729
  Icon,
10730
+ IdentityDocumentNumberFormField,
9876
10731
  InputStyled,
9877
10732
  MenuDropdown,
9878
10733
  Modal,
@@ -9880,6 +10735,7 @@ var PhoneFormField = (_a) => {
9880
10735
  MultiSelectFormField,
9881
10736
  PhoneFormField,
9882
10737
  RadioGroup,
10738
+ RadioGroupFormField,
9883
10739
  RadioGroupStyled,
9884
10740
  RadioItem,
9885
10741
  Section,
@@ -9915,6 +10771,7 @@ var PhoneFormField = (_a) => {
9915
10771
  TooltipProvider,
9916
10772
  TooltipRoot,
9917
10773
  TooltipTrigger,
10774
+ isValidCNPJ,
9918
10775
  maskFormat,
9919
10776
  maskUnformat,
9920
10777
  useToast