@lets-events/react 11.5.4 → 11.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +2 -2
- package/.turbo/turbo-build.log +20 -18
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +103 -11
- package/dist/index.d.ts +103 -11
- package/dist/index.js +990 -133
- package/dist/index.mjs +951 -102
- package/package.json +2 -1
- package/src/components/Alert.tsx +303 -303
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +125 -125
- package/src/components/Box.tsx +3 -3
- package/src/components/Button/index.tsx +16 -16
- package/src/components/Button/styledComponents.ts +287 -287
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +136 -136
- package/src/components/Calendar/styledComponents.ts +209 -209
- package/src/components/Card.tsx +48 -48
- package/src/components/CheckboxGroup.tsx +176 -196
- package/src/components/Container.tsx +39 -39
- package/src/components/Drawer/index.tsx +48 -48
- package/src/components/Drawer/styledComponents.ts +46 -46
- package/src/components/Dropdown.tsx +192 -167
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -0
- package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -0
- package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +45 -0
- package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -0
- package/src/components/FormFields/AddressFormFields/index.tsx +139 -0
- package/src/components/FormFields/BirthDateFormField.tsx +87 -0
- package/src/components/FormFields/CNPJFormField.tsx +89 -0
- package/src/components/FormFields/CPFFormField.tsx +79 -0
- package/src/components/FormFields/CheckboxGroupFormField.tsx +90 -0
- package/src/components/FormFields/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/Form.tsx +29 -25
- package/src/components/FormFields/FormLabel.tsx +29 -29
- package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +42 -0
- package/src/components/FormFields/MultiSelectFormField.tsx +59 -59
- package/src/components/FormFields/PhoneFormField.tsx +130 -130
- package/src/components/FormFields/RadioGroupFormField.tsx +84 -0
- package/src/components/FormFields/SelectFormField.tsx +93 -0
- package/src/components/FormFields/TextAreaFormField.tsx +48 -48
- package/src/components/FormFields/TextFormField.tsx +76 -46
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/MenuDropdown/index.tsx +30 -30
- package/src/components/MenuDropdown/styledComponents.ts +31 -31
- package/src/components/Modal.tsx +90 -90
- package/src/components/MultiSelect.tsx +218 -218
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/Section.tsx +33 -33
- package/src/components/Step.tsx +164 -164
- package/src/components/Switch.tsx +108 -108
- package/src/components/Text.tsx +38 -38
- package/src/components/TextField.tsx +312 -315
- package/src/components/TextareaField.tsx +128 -128
- package/src/components/TimePicker.tsx +298 -298
- package/src/components/Toast/components/ToastItem.tsx +41 -41
- package/src/components/Toast/components/ToastProvider.tsx +63 -63
- package/src/components/Toast/hooks/useToast.ts +12 -12
- package/src/components/Toast/index.tsx +5 -5
- package/src/components/Toast/styles/index.ts +135 -135
- package/src/components/Toast/types/index.ts +46 -46
- package/src/components/Tooltip/index.tsx +66 -66
- package/src/components/Tooltip/styles.ts +77 -77
- package/src/hooks/useCountries.ts +41 -0
- package/src/hooks/useOnClickOutside.tsx +20 -20
- package/src/index.tsx +52 -45
- package/src/styles/index.ts +38 -38
- package/src/types/typographyValues.ts +178 -178
- package/src/utils/getNestedValue.ts +3 -0
- package/src/utils/states.ts +29 -0
- package/tsconfig.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -53,6 +53,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
53
53
|
mod
|
|
54
54
|
));
|
|
55
55
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
56
|
+
var __async = (__this, __arguments, generator) => {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
var fulfilled = (value) => {
|
|
59
|
+
try {
|
|
60
|
+
step(generator.next(value));
|
|
61
|
+
} catch (e) {
|
|
62
|
+
reject(e);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var rejected = (value) => {
|
|
66
|
+
try {
|
|
67
|
+
step(generator.throw(value));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
reject(e);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
73
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
74
|
+
});
|
|
75
|
+
};
|
|
56
76
|
|
|
57
77
|
// ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
|
|
58
78
|
var require_react_is_production_min = __commonJS({
|
|
@@ -236,7 +256,7 @@ var require_react_is_development = __commonJS({
|
|
|
236
256
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
237
257
|
var Element = REACT_ELEMENT_TYPE;
|
|
238
258
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
239
|
-
var
|
|
259
|
+
var Fragment4 = REACT_FRAGMENT_TYPE;
|
|
240
260
|
var Lazy = REACT_LAZY_TYPE;
|
|
241
261
|
var Memo = REACT_MEMO_TYPE;
|
|
242
262
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -295,7 +315,7 @@ var require_react_is_development = __commonJS({
|
|
|
295
315
|
exports.ContextProvider = ContextProvider;
|
|
296
316
|
exports.Element = Element;
|
|
297
317
|
exports.ForwardRef = ForwardRef;
|
|
298
|
-
exports.Fragment =
|
|
318
|
+
exports.Fragment = Fragment4;
|
|
299
319
|
exports.Lazy = Lazy;
|
|
300
320
|
exports.Memo = Memo;
|
|
301
321
|
exports.Portal = Portal;
|
|
@@ -2714,9 +2734,7 @@ var TextField = React.forwardRef(
|
|
|
2714
2734
|
if (maskRef) maskRef.current = r;
|
|
2715
2735
|
if (fowardedRef) {
|
|
2716
2736
|
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
2717
|
-
else
|
|
2718
|
-
fowardedRef.current = r;
|
|
2719
|
-
}
|
|
2737
|
+
else fowardedRef.current = r;
|
|
2720
2738
|
}
|
|
2721
2739
|
}
|
|
2722
2740
|
}, props), {
|
|
@@ -3008,25 +3026,15 @@ var CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
|
|
|
3008
3026
|
cursor: "pointer"
|
|
3009
3027
|
},
|
|
3010
3028
|
"label button[data-state=checked]:before": {
|
|
3011
|
-
|
|
3029
|
+
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")`,
|
|
3012
3030
|
content: "",
|
|
3013
|
-
width: "
|
|
3014
|
-
height: "
|
|
3015
|
-
position: "absolute",
|
|
3016
|
-
top: "2px",
|
|
3017
|
-
right: "2px",
|
|
3018
|
-
zIndex: 2
|
|
3019
|
-
},
|
|
3020
|
-
"label button[data-state=checked]:after": {
|
|
3021
|
-
backgroundColor: "$brand500",
|
|
3022
|
-
content: "",
|
|
3023
|
-
height: "$16",
|
|
3024
|
-
width: "$16",
|
|
3031
|
+
width: "1rem",
|
|
3032
|
+
height: "1rem",
|
|
3025
3033
|
position: "absolute",
|
|
3026
|
-
top: "-
|
|
3034
|
+
top: "-1px",
|
|
3027
3035
|
right: "-2px",
|
|
3028
|
-
|
|
3029
|
-
|
|
3036
|
+
zIndex: 2,
|
|
3037
|
+
backgroundRepeat: "no-repeat"
|
|
3030
3038
|
},
|
|
3031
3039
|
variants: {
|
|
3032
3040
|
color: {
|
|
@@ -3040,8 +3048,8 @@ var CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
|
|
|
3040
3048
|
borderColor: "$green500",
|
|
3041
3049
|
backgroundColor: "$dark50"
|
|
3042
3050
|
},
|
|
3043
|
-
"label button[data-state=checked]:
|
|
3044
|
-
|
|
3051
|
+
"label button[data-state=checked]:before": {
|
|
3052
|
+
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")`
|
|
3045
3053
|
}
|
|
3046
3054
|
},
|
|
3047
3055
|
blue: {},
|
|
@@ -3055,8 +3063,8 @@ var CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
|
|
|
3055
3063
|
borderColor: "$error400",
|
|
3056
3064
|
backgroundColor: "$dark50"
|
|
3057
3065
|
},
|
|
3058
|
-
"label button[data-state=checked]:
|
|
3059
|
-
|
|
3066
|
+
"label button[data-state=checked]:before": {
|
|
3067
|
+
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")`
|
|
3060
3068
|
}
|
|
3061
3069
|
}
|
|
3062
3070
|
},
|
|
@@ -3095,9 +3103,6 @@ var CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
|
|
|
3095
3103
|
},
|
|
3096
3104
|
"label button": {
|
|
3097
3105
|
borderColor: "$dark300"
|
|
3098
|
-
},
|
|
3099
|
-
"label button[data-state=checked]:after": {
|
|
3100
|
-
backgroundColor: "$brand500"
|
|
3101
3106
|
}
|
|
3102
3107
|
}
|
|
3103
3108
|
},
|
|
@@ -3108,9 +3113,6 @@ var CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
|
|
|
3108
3113
|
"label button": {
|
|
3109
3114
|
borderColor: "$brand100",
|
|
3110
3115
|
backgroundColor: "$dark50"
|
|
3111
|
-
},
|
|
3112
|
-
"label button[data-state=checked]:after": {
|
|
3113
|
-
backgroundColor: "$brand100"
|
|
3114
3116
|
}
|
|
3115
3117
|
}
|
|
3116
3118
|
},
|
|
@@ -3121,9 +3123,6 @@ var CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
|
|
|
3121
3123
|
"label button": {
|
|
3122
3124
|
borderColor: "$success100",
|
|
3123
3125
|
backgroundColor: "$dark50"
|
|
3124
|
-
},
|
|
3125
|
-
"label button[data-state=checked]:after": {
|
|
3126
|
-
backgroundColor: "$success100"
|
|
3127
3126
|
}
|
|
3128
3127
|
}
|
|
3129
3128
|
},
|
|
@@ -3134,9 +3133,6 @@ var CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
|
|
|
3134
3133
|
"label button": {
|
|
3135
3134
|
borderColor: "$error100",
|
|
3136
3135
|
backgroundColor: "$dark50"
|
|
3137
|
-
},
|
|
3138
|
-
"label button[data-state=checked]:after": {
|
|
3139
|
-
backgroundColor: "$error100"
|
|
3140
3136
|
}
|
|
3141
3137
|
}
|
|
3142
3138
|
}
|
|
@@ -3297,15 +3293,18 @@ function FilterItem(_a) {
|
|
|
3297
3293
|
}
|
|
3298
3294
|
|
|
3299
3295
|
// src/components/Dropdown.tsx
|
|
3296
|
+
import { useState } from "react";
|
|
3297
|
+
import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons";
|
|
3300
3298
|
import { Theme as Theme2, DropdownMenu as DropdownMenuRadix } from "@radix-ui/themes";
|
|
3299
|
+
import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
|
|
3301
3300
|
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3302
3301
|
var DropdownMenuItemStyled = styled(DropdownMenuRadix.Item, {
|
|
3303
3302
|
fontFamily: "$default",
|
|
3304
3303
|
color: "$dark600",
|
|
3305
3304
|
letterSpacing: "0px",
|
|
3306
|
-
padding: "$8 $
|
|
3305
|
+
padding: "$8 $16",
|
|
3307
3306
|
"&:hover, &:focus": {
|
|
3308
|
-
backgroundColor: "
|
|
3307
|
+
backgroundColor: "$dark100",
|
|
3309
3308
|
border: "none",
|
|
3310
3309
|
outline: "none",
|
|
3311
3310
|
cursor: "pointer"
|
|
@@ -3330,7 +3329,7 @@ var DropdownMenuStyled = styled("div", {
|
|
|
3330
3329
|
padding: "$8 $12",
|
|
3331
3330
|
width: "calc(100% - 24px)",
|
|
3332
3331
|
display: "flex",
|
|
3333
|
-
|
|
3332
|
+
button: {
|
|
3334
3333
|
fontFamily: "$default",
|
|
3335
3334
|
color: "$dark600",
|
|
3336
3335
|
letterSpacing: "0px",
|
|
@@ -3342,82 +3341,111 @@ var DropdownMenuStyled = styled("div", {
|
|
|
3342
3341
|
alignItems: "center",
|
|
3343
3342
|
gap: "$8",
|
|
3344
3343
|
cursor: "pointer",
|
|
3345
|
-
|
|
3344
|
+
svg: {
|
|
3346
3345
|
marginLeft: "auto"
|
|
3347
3346
|
}
|
|
3348
3347
|
},
|
|
3349
3348
|
variants: {
|
|
3350
3349
|
typography: {
|
|
3351
3350
|
labelLarge: {
|
|
3352
|
-
|
|
3351
|
+
button: {
|
|
3353
3352
|
fontSize: "$labelLarge",
|
|
3354
3353
|
lineHeight: "$labelLarge"
|
|
3355
3354
|
}
|
|
3356
3355
|
},
|
|
3357
3356
|
labelMedium: {
|
|
3358
|
-
|
|
3357
|
+
button: {
|
|
3359
3358
|
fontSize: "$labelMedium",
|
|
3360
3359
|
lineHeight: "$labelMedium"
|
|
3361
3360
|
}
|
|
3362
3361
|
},
|
|
3363
3362
|
labelSmall: {
|
|
3364
|
-
|
|
3363
|
+
button: {
|
|
3365
3364
|
fontSize: "$labelSmall",
|
|
3366
3365
|
lineHeight: "$labelSmall"
|
|
3367
3366
|
}
|
|
3368
3367
|
},
|
|
3369
3368
|
labelExtraSmall: {
|
|
3370
|
-
|
|
3369
|
+
button: {
|
|
3371
3370
|
fontSize: "$labelExtraSmall",
|
|
3372
3371
|
lineHeight: "$labelExtraSmall"
|
|
3373
3372
|
}
|
|
3374
3373
|
}
|
|
3375
3374
|
},
|
|
3376
3375
|
fontWeight: {
|
|
3377
|
-
regular: {
|
|
3378
|
-
medium: {
|
|
3379
|
-
semibold: {
|
|
3380
|
-
bold: {
|
|
3376
|
+
regular: { button: { fontWeight: "$regular" } },
|
|
3377
|
+
medium: { button: { fontWeight: "$medium" } },
|
|
3378
|
+
semibold: { button: { fontWeight: "$semibold" } },
|
|
3379
|
+
bold: { button: { fontWeight: "$bold" } }
|
|
3380
|
+
},
|
|
3381
|
+
color: {
|
|
3382
|
+
default: {
|
|
3383
|
+
border: "1px solid $dark300"
|
|
3384
|
+
},
|
|
3385
|
+
error: {
|
|
3386
|
+
border: "1px solid $error400"
|
|
3387
|
+
}
|
|
3381
3388
|
}
|
|
3382
3389
|
}
|
|
3383
3390
|
});
|
|
3384
3391
|
var DropdownMenuContentStyled = styled(DropdownMenuRadix.Content, {
|
|
3385
3392
|
background: "white",
|
|
3386
|
-
padding: "$8 $12",
|
|
3387
3393
|
border: "1px solid $dark300",
|
|
3388
3394
|
borderRadius: "$xs",
|
|
3389
3395
|
boxShadow: "0px 4px 4px 0px rgba(35, 53, 67, 0.08)",
|
|
3390
|
-
width: "calc(var(--radix-popper-anchor-width)
|
|
3396
|
+
width: "calc(var(--radix-popper-anchor-width) + 24px);",
|
|
3391
3397
|
minWidth: "100%",
|
|
3392
|
-
marginTop: "3px"
|
|
3398
|
+
marginTop: "3px",
|
|
3399
|
+
maxHeight: "400px",
|
|
3400
|
+
height: "100%",
|
|
3401
|
+
position: "relative",
|
|
3402
|
+
overflow: "auto"
|
|
3393
3403
|
});
|
|
3394
3404
|
function DropdownMenu2(_a) {
|
|
3395
3405
|
var _b = _a, {
|
|
3396
3406
|
children,
|
|
3397
3407
|
placeholder,
|
|
3398
3408
|
typography,
|
|
3409
|
+
color,
|
|
3399
3410
|
fontWeight
|
|
3400
3411
|
} = _b, props = __objRest(_b, [
|
|
3401
3412
|
"children",
|
|
3402
3413
|
"placeholder",
|
|
3403
3414
|
"typography",
|
|
3415
|
+
"color",
|
|
3404
3416
|
"fontWeight"
|
|
3405
3417
|
]);
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3418
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
3419
|
+
return /* @__PURE__ */ jsx11(Theme2, { children: /* @__PURE__ */ jsx11(DropdownMenuRadix.Root, __spreadProps(__spreadValues({ open: isOpen, onOpenChange: setIsOpen }, props), { children: /* @__PURE__ */ jsxs3(
|
|
3420
|
+
DropdownMenuStyled,
|
|
3421
|
+
{
|
|
3422
|
+
typography,
|
|
3423
|
+
fontWeight,
|
|
3424
|
+
color,
|
|
3425
|
+
children: [
|
|
3426
|
+
/* @__PURE__ */ jsx11(DropdownMenuRadix.Trigger, { children: /* @__PURE__ */ jsxs3("button", { "aria-label": placeholder || "Filtrar", children: [
|
|
3427
|
+
/* @__PURE__ */ jsx11("span", { children: placeholder || "Filtrar" }),
|
|
3428
|
+
/* @__PURE__ */ jsx11(
|
|
3429
|
+
FontAwesomeIcon2,
|
|
3430
|
+
{
|
|
3431
|
+
icon: isOpen ? faChevronUp : faChevronDown,
|
|
3432
|
+
size: "sm",
|
|
3433
|
+
color: colors.dark600
|
|
3434
|
+
}
|
|
3435
|
+
)
|
|
3436
|
+
] }) }),
|
|
3437
|
+
/* @__PURE__ */ jsx11(
|
|
3438
|
+
DropdownMenuContentStyled,
|
|
3439
|
+
{
|
|
3440
|
+
avoidCollisions: false,
|
|
3441
|
+
align: "start",
|
|
3442
|
+
alignOffset: -14,
|
|
3443
|
+
children: /* @__PURE__ */ jsx11(DropdownMenuRadix.Group, { children })
|
|
3444
|
+
}
|
|
3445
|
+
)
|
|
3446
|
+
]
|
|
3447
|
+
}
|
|
3448
|
+
) })) });
|
|
3421
3449
|
}
|
|
3422
3450
|
function DropdownMenuItem(_a) {
|
|
3423
3451
|
var _b = _a, {
|
|
@@ -3622,7 +3650,7 @@ function Modal(_a) {
|
|
|
3622
3650
|
}
|
|
3623
3651
|
|
|
3624
3652
|
// src/components/MenuDropdown/index.tsx
|
|
3625
|
-
import { useState } from "react";
|
|
3653
|
+
import { useState as useState2 } from "react";
|
|
3626
3654
|
|
|
3627
3655
|
// src/components/MenuDropdown/styledComponents.ts
|
|
3628
3656
|
var MenuDropdownContainerStyled = styled("div", {
|
|
@@ -3658,7 +3686,7 @@ var MenuItemsContainerStyled = styled("div", {
|
|
|
3658
3686
|
// src/components/MenuDropdown/index.tsx
|
|
3659
3687
|
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3660
3688
|
function MenuDropdown({ children }) {
|
|
3661
|
-
const [isOpen, setIsOpen] =
|
|
3689
|
+
const [isOpen, setIsOpen] = useState2(false);
|
|
3662
3690
|
function handleMenuDropdown() {
|
|
3663
3691
|
setIsOpen(!isOpen);
|
|
3664
3692
|
}
|
|
@@ -3669,7 +3697,7 @@ function MenuDropdown({ children }) {
|
|
|
3669
3697
|
}
|
|
3670
3698
|
|
|
3671
3699
|
// src/components/Calendar/index.tsx
|
|
3672
|
-
import { useRef, useEffect as useEffect2, useState as
|
|
3700
|
+
import { useRef, useEffect as useEffect2, useState as useState3 } from "react";
|
|
3673
3701
|
|
|
3674
3702
|
// src/hooks/useOnClickOutside.tsx
|
|
3675
3703
|
import { useEffect } from "react";
|
|
@@ -7811,8 +7839,8 @@ function Calendar(_a) {
|
|
|
7811
7839
|
"setSelected",
|
|
7812
7840
|
"position"
|
|
7813
7841
|
]);
|
|
7814
|
-
const [inputValue, setInputValue] =
|
|
7815
|
-
const [showContainer, setShowCalendar] =
|
|
7842
|
+
const [inputValue, setInputValue] = useState3("");
|
|
7843
|
+
const [showContainer, setShowCalendar] = useState3(false);
|
|
7816
7844
|
const dropdownRef = useRef(null);
|
|
7817
7845
|
useOnClickOutside(dropdownRef, () => {
|
|
7818
7846
|
setShowCalendar(false);
|
|
@@ -7969,7 +7997,7 @@ function Drawer({
|
|
|
7969
7997
|
}
|
|
7970
7998
|
|
|
7971
7999
|
// src/components/TimePicker.tsx
|
|
7972
|
-
import { useCallback, useRef as useRef2, useState as
|
|
8000
|
+
import { useCallback, useRef as useRef2, useState as useState4 } from "react";
|
|
7973
8001
|
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
7974
8002
|
var TimePickerStyled = styled("div", {
|
|
7975
8003
|
position: "relative",
|
|
@@ -8073,11 +8101,11 @@ function TimePicker({
|
|
|
8073
8101
|
setSelected,
|
|
8074
8102
|
position = "bottom"
|
|
8075
8103
|
}) {
|
|
8076
|
-
const [hours, setHours] =
|
|
8077
|
-
const [minutes, setMinutes] =
|
|
8078
|
-
const [rawHours, setRawHours] =
|
|
8079
|
-
const [rawMinutes, setRawMinutes] =
|
|
8080
|
-
const [isOpen, setIsOpen] =
|
|
8104
|
+
const [hours, setHours] = useState4("00");
|
|
8105
|
+
const [minutes, setMinutes] = useState4("00");
|
|
8106
|
+
const [rawHours, setRawHours] = useState4("00");
|
|
8107
|
+
const [rawMinutes, setRawMinutes] = useState4("00");
|
|
8108
|
+
const [isOpen, setIsOpen] = useState4(false);
|
|
8081
8109
|
const dropdownRef = useRef2(null);
|
|
8082
8110
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8083
8111
|
const handleIncrement = useCallback(
|
|
@@ -8895,7 +8923,7 @@ var TextareaField = React6.forwardRef((_a, fowardedRef) => {
|
|
|
8895
8923
|
});
|
|
8896
8924
|
|
|
8897
8925
|
// src/components/Toast/components/ToastItem.tsx
|
|
8898
|
-
import { useState as
|
|
8926
|
+
import { useState as useState5 } from "react";
|
|
8899
8927
|
|
|
8900
8928
|
// src/components/Toast/styles/index.ts
|
|
8901
8929
|
import { keyframes as keyframes2 } from "@stitches/react";
|
|
@@ -9026,7 +9054,7 @@ function ToastItem({
|
|
|
9026
9054
|
toast,
|
|
9027
9055
|
onRemove
|
|
9028
9056
|
}) {
|
|
9029
|
-
const [open, setOpen] =
|
|
9057
|
+
const [open, setOpen] = useState5(true);
|
|
9030
9058
|
const handleOpenChange = (open2) => {
|
|
9031
9059
|
setOpen(open2);
|
|
9032
9060
|
if (!open2) {
|
|
@@ -9050,7 +9078,7 @@ function ToastItem({
|
|
|
9050
9078
|
}
|
|
9051
9079
|
|
|
9052
9080
|
// src/components/Toast/components/ToastProvider.tsx
|
|
9053
|
-
import { createContext, useState as
|
|
9081
|
+
import { createContext, useState as useState6 } from "react";
|
|
9054
9082
|
import * as ToastPrimitive2 from "@radix-ui/react-toast";
|
|
9055
9083
|
import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9056
9084
|
var ToastContext = createContext(null);
|
|
@@ -9060,7 +9088,7 @@ function ToastProvider({
|
|
|
9060
9088
|
maxToasts = 5,
|
|
9061
9089
|
swipeDirection = "right"
|
|
9062
9090
|
}) {
|
|
9063
|
-
const [toasts, setToasts] =
|
|
9091
|
+
const [toasts, setToasts] = useState6([]);
|
|
9064
9092
|
const addToast = (toastData) => {
|
|
9065
9093
|
const id = Math.random().toString(36).substr(2, 9);
|
|
9066
9094
|
const newToast = __spreadProps(__spreadValues({
|
|
@@ -9157,13 +9185,13 @@ function Tooltip({
|
|
|
9157
9185
|
|
|
9158
9186
|
// src/components/MultiSelect.tsx
|
|
9159
9187
|
import { DropdownMenu as DropdownMenu3, Theme as Theme4 } from "@radix-ui/themes";
|
|
9160
|
-
import { FontAwesomeIcon as
|
|
9188
|
+
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
9161
9189
|
import {
|
|
9162
|
-
faChevronDown,
|
|
9163
|
-
faChevronUp,
|
|
9190
|
+
faChevronDown as faChevronDown2,
|
|
9191
|
+
faChevronUp as faChevronUp2,
|
|
9164
9192
|
faX
|
|
9165
9193
|
} from "@fortawesome/free-solid-svg-icons";
|
|
9166
|
-
import { useCallback as useCallback2, useMemo, useRef as useRef4, useState as
|
|
9194
|
+
import { useCallback as useCallback2, useMemo, useRef as useRef4, useState as useState7 } from "react";
|
|
9167
9195
|
import React7 from "react";
|
|
9168
9196
|
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9169
9197
|
var StyledContent = styled(DropdownMenu3.Content, {
|
|
@@ -9239,7 +9267,7 @@ var MultiSelect = React7.forwardRef(
|
|
|
9239
9267
|
zIndex = "auto"
|
|
9240
9268
|
}, fowardedRef) => {
|
|
9241
9269
|
var _a;
|
|
9242
|
-
const [isOpen, setIsOpen] =
|
|
9270
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
9243
9271
|
const triggerRef = useRef4(null);
|
|
9244
9272
|
const labelByValue = useMemo(() => {
|
|
9245
9273
|
return options.reduce((prev, curr) => {
|
|
@@ -9286,15 +9314,15 @@ var MultiSelect = React7.forwardRef(
|
|
|
9286
9314
|
handleRemove(value);
|
|
9287
9315
|
},
|
|
9288
9316
|
role: "button",
|
|
9289
|
-
children: /* @__PURE__ */ jsx26(
|
|
9317
|
+
children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faX, size: "xs" })
|
|
9290
9318
|
}
|
|
9291
9319
|
)
|
|
9292
9320
|
] }) }, value);
|
|
9293
9321
|
}) }),
|
|
9294
9322
|
/* @__PURE__ */ jsx26(
|
|
9295
|
-
|
|
9323
|
+
FontAwesomeIcon3,
|
|
9296
9324
|
{
|
|
9297
|
-
icon: isOpen ?
|
|
9325
|
+
icon: isOpen ? faChevronUp2 : faChevronDown2,
|
|
9298
9326
|
size: "sm",
|
|
9299
9327
|
color: colors.dark600
|
|
9300
9328
|
}
|
|
@@ -9518,7 +9546,7 @@ function Section(_a) {
|
|
|
9518
9546
|
|
|
9519
9547
|
// src/components/FormFields/ErrorFormMessage.tsx
|
|
9520
9548
|
import { faXmarkCircle } from "@fortawesome/free-solid-svg-icons";
|
|
9521
|
-
import { FontAwesomeIcon as
|
|
9549
|
+
import { FontAwesomeIcon as FontAwesomeIcon4 } from "@fortawesome/react-fontawesome";
|
|
9522
9550
|
import { jsx as jsx30, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9523
9551
|
var ErrorFormMessage = ({ message: message2 }) => {
|
|
9524
9552
|
if (!message2) return null;
|
|
@@ -9526,7 +9554,7 @@ var ErrorFormMessage = ({ message: message2 }) => {
|
|
|
9526
9554
|
return null;
|
|
9527
9555
|
}
|
|
9528
9556
|
return /* @__PURE__ */ jsxs15(Flex2, { justify: "start", align: "center", gap: 6, children: [
|
|
9529
|
-
/* @__PURE__ */ jsx30(
|
|
9557
|
+
/* @__PURE__ */ jsx30(FontAwesomeIcon4, { icon: faXmarkCircle, color: colors.error600, size: "1x" }),
|
|
9530
9558
|
/* @__PURE__ */ jsx30(Text, { typography: "bodyXS", fontWeight: "medium", color: "error600", children: message2 })
|
|
9531
9559
|
] });
|
|
9532
9560
|
};
|
|
@@ -9601,22 +9629,39 @@ var TextAreaFormField = (_a) => {
|
|
|
9601
9629
|
|
|
9602
9630
|
// src/components/FormFields/TextFormField.tsx
|
|
9603
9631
|
import { useFormContext as useFormContext2 } from "react-hook-form";
|
|
9632
|
+
|
|
9633
|
+
// src/utils/getNestedValue.ts
|
|
9634
|
+
function getNestedValue(obj, path) {
|
|
9635
|
+
return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
9636
|
+
}
|
|
9637
|
+
|
|
9638
|
+
// src/components/FormFields/TextFormField.tsx
|
|
9604
9639
|
import { jsx as jsx33, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
9605
9640
|
var TextFormField = ({
|
|
9606
9641
|
name,
|
|
9607
9642
|
label,
|
|
9608
9643
|
required,
|
|
9609
|
-
placeholder
|
|
9644
|
+
placeholder,
|
|
9645
|
+
mask,
|
|
9646
|
+
validation,
|
|
9647
|
+
validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
|
|
9648
|
+
disabled = false,
|
|
9649
|
+
value,
|
|
9650
|
+
onChange
|
|
9610
9651
|
}) => {
|
|
9611
|
-
var _a;
|
|
9612
9652
|
const {
|
|
9613
9653
|
register,
|
|
9614
9654
|
formState: { errors }
|
|
9615
9655
|
} = useFormContext2();
|
|
9616
|
-
const
|
|
9617
|
-
|
|
9656
|
+
const validationRules = __spreadValues({
|
|
9657
|
+
required: required ? validationErrorMessage : false
|
|
9658
|
+
}, validation);
|
|
9659
|
+
const _a = register(name, validationRules), { ref } = _a, restFieldProps = __objRest(_a, ["ref"]);
|
|
9660
|
+
const fieldError = getNestedValue(errors, name);
|
|
9661
|
+
const haveError = !!fieldError;
|
|
9662
|
+
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
9618
9663
|
return /* @__PURE__ */ jsxs18(Flex2, { direction: "column", children: [
|
|
9619
|
-
/* @__PURE__ */ jsx33(
|
|
9664
|
+
label && /* @__PURE__ */ jsx33(
|
|
9620
9665
|
FormLabel,
|
|
9621
9666
|
{
|
|
9622
9667
|
name,
|
|
@@ -9627,10 +9672,16 @@ var TextFormField = ({
|
|
|
9627
9672
|
),
|
|
9628
9673
|
/* @__PURE__ */ jsx33(
|
|
9629
9674
|
TextField,
|
|
9630
|
-
__spreadProps(__spreadValues({
|
|
9675
|
+
__spreadProps(__spreadValues({
|
|
9676
|
+
mask,
|
|
9631
9677
|
placeholder,
|
|
9678
|
+
disabled,
|
|
9632
9679
|
color: haveError ? "error" : "default",
|
|
9633
9680
|
"aria-labelledby": `${name}-label`
|
|
9681
|
+
}, restFieldProps), {
|
|
9682
|
+
ref,
|
|
9683
|
+
onChange,
|
|
9684
|
+
value
|
|
9634
9685
|
})
|
|
9635
9686
|
),
|
|
9636
9687
|
/* @__PURE__ */ jsx33(ErrorFormMessage, { message: errorMsg })
|
|
@@ -9644,10 +9695,17 @@ import {
|
|
|
9644
9695
|
} from "react-hook-form";
|
|
9645
9696
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
9646
9697
|
var Form = (_a) => {
|
|
9647
|
-
var _b = _a, {
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9698
|
+
var _b = _a, {
|
|
9699
|
+
onSubmit,
|
|
9700
|
+
children,
|
|
9701
|
+
methods
|
|
9702
|
+
} = _b, props = __objRest(_b, [
|
|
9703
|
+
"onSubmit",
|
|
9704
|
+
"children",
|
|
9705
|
+
"methods"
|
|
9706
|
+
]);
|
|
9707
|
+
const formMethods = methods || useForm(props);
|
|
9708
|
+
return /* @__PURE__ */ jsx34(FormProvider, __spreadProps(__spreadValues({}, formMethods), { children: /* @__PURE__ */ jsx34("form", { onSubmit: formMethods.handleSubmit(onSubmit), children }) }));
|
|
9651
9709
|
};
|
|
9652
9710
|
|
|
9653
9711
|
// src/components/FormFields/MultiSelectFormField.tsx
|
|
@@ -9743,7 +9801,791 @@ var PhoneFormField = (_a) => {
|
|
|
9743
9801
|
/* @__PURE__ */ jsx36(ErrorFormMessage, { message: errorMsg })
|
|
9744
9802
|
] });
|
|
9745
9803
|
};
|
|
9804
|
+
|
|
9805
|
+
// src/components/FormFields/CPFFormField.tsx
|
|
9806
|
+
import { useFormContext as useFormContext5, useWatch } from "react-hook-form";
|
|
9807
|
+
import { jsx as jsx37, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
9808
|
+
var isValidCPF = (cpf) => {
|
|
9809
|
+
cpf = cpf.replace(/[^\d]+/g, "");
|
|
9810
|
+
if (cpf.length !== 11 || /^(\d)\1{10}$/.test(cpf)) return false;
|
|
9811
|
+
let sum = 0;
|
|
9812
|
+
for (let i = 0; i < 9; i++) sum += parseInt(cpf.charAt(i)) * (10 - i);
|
|
9813
|
+
let rest = sum * 10 % 11;
|
|
9814
|
+
if (rest === 10 || rest === 11) rest = 0;
|
|
9815
|
+
if (rest !== parseInt(cpf.charAt(9))) return false;
|
|
9816
|
+
sum = 0;
|
|
9817
|
+
for (let i = 0; i < 10; i++) sum += parseInt(cpf.charAt(i)) * (11 - i);
|
|
9818
|
+
rest = sum * 10 % 11;
|
|
9819
|
+
if (rest === 10 || rest === 11) rest = 0;
|
|
9820
|
+
if (rest !== parseInt(cpf.charAt(10))) return false;
|
|
9821
|
+
return true;
|
|
9822
|
+
};
|
|
9823
|
+
var CPFFormField = ({
|
|
9824
|
+
name,
|
|
9825
|
+
label,
|
|
9826
|
+
required,
|
|
9827
|
+
placeholder,
|
|
9828
|
+
validationErrorMessage,
|
|
9829
|
+
foreignerLabel
|
|
9830
|
+
}) => {
|
|
9831
|
+
const { control, setValue } = useFormContext5();
|
|
9832
|
+
const foreigner = useWatch({ name: "foreigner", control });
|
|
9833
|
+
return /* @__PURE__ */ jsxs21(Flex2, { direction: "column", children: [
|
|
9834
|
+
/* @__PURE__ */ jsx37(
|
|
9835
|
+
TextFormField,
|
|
9836
|
+
{
|
|
9837
|
+
name,
|
|
9838
|
+
label,
|
|
9839
|
+
required: required && !foreigner,
|
|
9840
|
+
placeholder: placeholder || "000.000.000-00",
|
|
9841
|
+
mask: {
|
|
9842
|
+
mask: "___.___.___-__",
|
|
9843
|
+
replacement: { _: /[0-9]/ }
|
|
9844
|
+
},
|
|
9845
|
+
validation: {
|
|
9846
|
+
validate: (value) => {
|
|
9847
|
+
if (!required || foreigner) return true;
|
|
9848
|
+
return isValidCPF(value) || validationErrorMessage;
|
|
9849
|
+
}
|
|
9850
|
+
},
|
|
9851
|
+
disabled: foreigner
|
|
9852
|
+
}
|
|
9853
|
+
),
|
|
9854
|
+
/* @__PURE__ */ jsx37(
|
|
9855
|
+
CheckboxGroup,
|
|
9856
|
+
{
|
|
9857
|
+
name: "foreigner",
|
|
9858
|
+
onValueChange: (value) => {
|
|
9859
|
+
const isForeigner = value.includes("true");
|
|
9860
|
+
setValue("foreigner", isForeigner);
|
|
9861
|
+
if (isForeigner) {
|
|
9862
|
+
setValue(name, "");
|
|
9863
|
+
}
|
|
9864
|
+
},
|
|
9865
|
+
children: /* @__PURE__ */ jsx37(CheckboxItem, { value: "true", children: foreignerLabel })
|
|
9866
|
+
}
|
|
9867
|
+
)
|
|
9868
|
+
] });
|
|
9869
|
+
};
|
|
9870
|
+
|
|
9871
|
+
// src/components/FormFields/CNPJFormField.tsx
|
|
9872
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
9873
|
+
var matchesNonDigit = new RegExp(/\D+/g);
|
|
9874
|
+
var getWeights = (size, start, end) => {
|
|
9875
|
+
const weights = [];
|
|
9876
|
+
for (let i = size - 1; i >= 0; i--) {
|
|
9877
|
+
weights.push((end ? i % (end - start + 1) : i) + start);
|
|
9878
|
+
}
|
|
9879
|
+
return weights;
|
|
9880
|
+
};
|
|
9881
|
+
var calcValidatorDigit = (basicDigits, weights) => {
|
|
9882
|
+
const sum = basicDigits.reduce(
|
|
9883
|
+
(sum2, digit, index) => sum2 + digit * weights[index],
|
|
9884
|
+
0
|
|
9885
|
+
);
|
|
9886
|
+
const mod = sum % 11;
|
|
9887
|
+
return mod < 2 ? 0 : 11 - mod;
|
|
9888
|
+
};
|
|
9889
|
+
var cnpjWeights1 = getWeights(12, 2, 9);
|
|
9890
|
+
var cnpjWeights2 = getWeights(13, 2, 9);
|
|
9891
|
+
var isValidCNPJ = (cnpj) => {
|
|
9892
|
+
const digitsOnlyCnpj = cnpj.replace(matchesNonDigit, "");
|
|
9893
|
+
if (digitsOnlyCnpj.length !== 14) {
|
|
9894
|
+
return false;
|
|
9895
|
+
}
|
|
9896
|
+
if (/^(\d)\1+$/.test(digitsOnlyCnpj)) return false;
|
|
9897
|
+
const cnpjArray = digitsOnlyCnpj.split("").map((digit) => Number.parseInt(digit));
|
|
9898
|
+
const validatorDigit1 = cnpjArray[12];
|
|
9899
|
+
const validatorDigit2 = cnpjArray[13];
|
|
9900
|
+
const basicDigits = cnpjArray.slice(0, 12);
|
|
9901
|
+
const expectedValidator1 = calcValidatorDigit(basicDigits, cnpjWeights1);
|
|
9902
|
+
if (expectedValidator1 !== validatorDigit1) {
|
|
9903
|
+
return false;
|
|
9904
|
+
}
|
|
9905
|
+
const expectedValidator2 = calcValidatorDigit(
|
|
9906
|
+
[...basicDigits, validatorDigit1],
|
|
9907
|
+
cnpjWeights2
|
|
9908
|
+
);
|
|
9909
|
+
if (expectedValidator2 !== validatorDigit2) {
|
|
9910
|
+
return false;
|
|
9911
|
+
}
|
|
9912
|
+
return true;
|
|
9913
|
+
};
|
|
9914
|
+
var CNPJFormField = ({
|
|
9915
|
+
name,
|
|
9916
|
+
label,
|
|
9917
|
+
required,
|
|
9918
|
+
placeholder,
|
|
9919
|
+
validationErrorMessage
|
|
9920
|
+
}) => {
|
|
9921
|
+
return /* @__PURE__ */ jsx38(
|
|
9922
|
+
TextFormField,
|
|
9923
|
+
{
|
|
9924
|
+
name,
|
|
9925
|
+
label,
|
|
9926
|
+
required,
|
|
9927
|
+
placeholder: placeholder || "00.000.000/0000-00",
|
|
9928
|
+
mask: {
|
|
9929
|
+
mask: "__.___.___/____-__",
|
|
9930
|
+
replacement: { _: /[0-9]/ }
|
|
9931
|
+
},
|
|
9932
|
+
validation: {
|
|
9933
|
+
validate: (value) => {
|
|
9934
|
+
const isEmpty = value.replace(matchesNonDigit, "").length === 0;
|
|
9935
|
+
if (!required && isEmpty) return true;
|
|
9936
|
+
return isValidCNPJ(value) || validationErrorMessage;
|
|
9937
|
+
}
|
|
9938
|
+
}
|
|
9939
|
+
}
|
|
9940
|
+
);
|
|
9941
|
+
};
|
|
9942
|
+
|
|
9943
|
+
// src/components/FormFields/BirthDateFormField.tsx
|
|
9944
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
9945
|
+
var isValidDate = (day, month, year) => {
|
|
9946
|
+
const date = new Date(year, month - 1, day);
|
|
9947
|
+
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;
|
|
9948
|
+
};
|
|
9949
|
+
var isValidBirthDate = (value, language) => {
|
|
9950
|
+
const [part1, part2, part3] = value.split("/").map(Number);
|
|
9951
|
+
let day = 0, month = 0, year = 0;
|
|
9952
|
+
if (language === "en") {
|
|
9953
|
+
month = part1;
|
|
9954
|
+
day = part2;
|
|
9955
|
+
year = part3;
|
|
9956
|
+
} else {
|
|
9957
|
+
day = part1;
|
|
9958
|
+
month = part2;
|
|
9959
|
+
year = part3;
|
|
9960
|
+
}
|
|
9961
|
+
if (!isValidDate(day, month, year)) return false;
|
|
9962
|
+
const today = /* @__PURE__ */ new Date();
|
|
9963
|
+
const birthDate = new Date(year, month - 1, day);
|
|
9964
|
+
if (birthDate > today) return false;
|
|
9965
|
+
const age = today.getFullYear() - birthDate.getFullYear();
|
|
9966
|
+
const beforeBirthday = today.getMonth() < birthDate.getMonth() || today.getMonth() === birthDate.getMonth() && today.getDate() < birthDate.getDate();
|
|
9967
|
+
const realAge = beforeBirthday ? age - 1 : age;
|
|
9968
|
+
return realAge <= 100;
|
|
9969
|
+
};
|
|
9970
|
+
var BirthDateFormField = ({
|
|
9971
|
+
name,
|
|
9972
|
+
label,
|
|
9973
|
+
required,
|
|
9974
|
+
placeholder,
|
|
9975
|
+
validationErrorMessage,
|
|
9976
|
+
language
|
|
9977
|
+
}) => {
|
|
9978
|
+
const inputPlaceholder = placeholder || (language === "en" ? "MM/DD/YYYY" : "DD/MM/AAAA");
|
|
9979
|
+
return /* @__PURE__ */ jsx39(
|
|
9980
|
+
TextFormField,
|
|
9981
|
+
{
|
|
9982
|
+
name,
|
|
9983
|
+
label,
|
|
9984
|
+
required,
|
|
9985
|
+
placeholder: inputPlaceholder,
|
|
9986
|
+
mask: {
|
|
9987
|
+
mask: "__/__/____",
|
|
9988
|
+
replacement: { _: /[0-9]/ }
|
|
9989
|
+
},
|
|
9990
|
+
validation: {
|
|
9991
|
+
validate: (value) => {
|
|
9992
|
+
const isEmpty = value.replace(/[^\d]+/g, "").length === 0;
|
|
9993
|
+
if (!required && isEmpty) return true;
|
|
9994
|
+
return isValidBirthDate(value, language) || validationErrorMessage;
|
|
9995
|
+
}
|
|
9996
|
+
}
|
|
9997
|
+
}
|
|
9998
|
+
);
|
|
9999
|
+
};
|
|
10000
|
+
|
|
10001
|
+
// src/components/FormFields/IdentityDocumentNumberFormField.tsx
|
|
10002
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
10003
|
+
var isValidRG = (rg) => {
|
|
10004
|
+
const cleaned = rg.replace(/[^\d]/g, "");
|
|
10005
|
+
return /^\d{9}$/.test(cleaned);
|
|
10006
|
+
};
|
|
10007
|
+
var IdentityDocumentNumberFormField = ({
|
|
10008
|
+
name,
|
|
10009
|
+
label,
|
|
10010
|
+
required,
|
|
10011
|
+
placeholder,
|
|
10012
|
+
validationErrorMessage
|
|
10013
|
+
}) => {
|
|
10014
|
+
return /* @__PURE__ */ jsx40(
|
|
10015
|
+
TextFormField,
|
|
10016
|
+
{
|
|
10017
|
+
name,
|
|
10018
|
+
label,
|
|
10019
|
+
required,
|
|
10020
|
+
placeholder: placeholder || "__.___.___-_",
|
|
10021
|
+
mask: {
|
|
10022
|
+
mask: "__.___.___-_",
|
|
10023
|
+
replacement: { _: /[0-9]/ }
|
|
10024
|
+
},
|
|
10025
|
+
validation: {
|
|
10026
|
+
validate: (value) => {
|
|
10027
|
+
const isEmpty = value.replace(/[^\d]/g, "").length === 0;
|
|
10028
|
+
if (!required && isEmpty) return true;
|
|
10029
|
+
return isValidRG(value) || validationErrorMessage;
|
|
10030
|
+
}
|
|
10031
|
+
}
|
|
10032
|
+
}
|
|
10033
|
+
);
|
|
10034
|
+
};
|
|
10035
|
+
|
|
10036
|
+
// src/components/FormFields/AddressFormFields/index.tsx
|
|
10037
|
+
import { useEffect as useEffect4 } from "react";
|
|
10038
|
+
import { useFormContext as useFormContext9, useWatch as useWatch2, useFormState } from "react-hook-form";
|
|
10039
|
+
|
|
10040
|
+
// src/components/FormFields/SelectFormField.tsx
|
|
10041
|
+
import { useFormContext as useFormContext6, Controller } from "react-hook-form";
|
|
10042
|
+
import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
10043
|
+
var SelectFormField = ({
|
|
10044
|
+
name,
|
|
10045
|
+
label,
|
|
10046
|
+
required,
|
|
10047
|
+
placeholder = "Selecione",
|
|
10048
|
+
options,
|
|
10049
|
+
validation,
|
|
10050
|
+
validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
|
|
10051
|
+
defaultValue
|
|
10052
|
+
}) => {
|
|
10053
|
+
const {
|
|
10054
|
+
control,
|
|
10055
|
+
formState: { errors }
|
|
10056
|
+
} = useFormContext6();
|
|
10057
|
+
const fieldError = getNestedValue(errors, name);
|
|
10058
|
+
const haveError = !!fieldError;
|
|
10059
|
+
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10060
|
+
const validationRules = __spreadValues({
|
|
10061
|
+
required: required ? validationErrorMessage : false
|
|
10062
|
+
}, validation);
|
|
10063
|
+
return /* @__PURE__ */ jsxs22(Flex2, { direction: "column", children: [
|
|
10064
|
+
/* @__PURE__ */ jsx41(
|
|
10065
|
+
FormLabel,
|
|
10066
|
+
{
|
|
10067
|
+
name,
|
|
10068
|
+
label,
|
|
10069
|
+
required,
|
|
10070
|
+
haveError
|
|
10071
|
+
}
|
|
10072
|
+
),
|
|
10073
|
+
/* @__PURE__ */ jsx41(
|
|
10074
|
+
Controller,
|
|
10075
|
+
{
|
|
10076
|
+
control,
|
|
10077
|
+
name,
|
|
10078
|
+
rules: validationRules,
|
|
10079
|
+
defaultValue: defaultValue || "",
|
|
10080
|
+
render: ({ field: { value, onChange } }) => {
|
|
10081
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
10082
|
+
return /* @__PURE__ */ jsx41(
|
|
10083
|
+
DropdownMenu2,
|
|
10084
|
+
{
|
|
10085
|
+
placeholder: (selectedOption == null ? void 0 : selectedOption.label) || placeholder,
|
|
10086
|
+
fontWeight: "regular",
|
|
10087
|
+
typography: "labelLarge",
|
|
10088
|
+
color: haveError ? "error" : "default",
|
|
10089
|
+
children: options.map((option, index) => /* @__PURE__ */ jsx41(
|
|
10090
|
+
DropdownMenuItem,
|
|
10091
|
+
{
|
|
10092
|
+
value: option.value,
|
|
10093
|
+
onSelect: () => onChange(option.value),
|
|
10094
|
+
fontWeight: "regular",
|
|
10095
|
+
typography: "labelLarge",
|
|
10096
|
+
children: option.label
|
|
10097
|
+
},
|
|
10098
|
+
`${option.value}${index}`
|
|
10099
|
+
))
|
|
10100
|
+
}
|
|
10101
|
+
);
|
|
10102
|
+
}
|
|
10103
|
+
}
|
|
10104
|
+
),
|
|
10105
|
+
/* @__PURE__ */ jsx41(ErrorFormMessage, { message: errorMsg })
|
|
10106
|
+
] });
|
|
10107
|
+
};
|
|
10108
|
+
|
|
10109
|
+
// src/hooks/useCountries.ts
|
|
10110
|
+
import countries from "i18n-iso-countries";
|
|
10111
|
+
import pt from "i18n-iso-countries/langs/pt.json";
|
|
10112
|
+
import en from "i18n-iso-countries/langs/en.json";
|
|
10113
|
+
import es from "i18n-iso-countries/langs/es.json";
|
|
10114
|
+
function useCountries(language = "pt-BR") {
|
|
10115
|
+
countries.registerLocale(pt);
|
|
10116
|
+
countries.registerLocale(en);
|
|
10117
|
+
countries.registerLocale(es);
|
|
10118
|
+
const langMap = {
|
|
10119
|
+
"pt-BR": "pt",
|
|
10120
|
+
en: "en",
|
|
10121
|
+
es: "es"
|
|
10122
|
+
};
|
|
10123
|
+
const langCode = langMap[language];
|
|
10124
|
+
const namesPT = countries.getNames("pt", { select: "official" });
|
|
10125
|
+
const namesLang = countries.getNames(langCode, { select: "official" });
|
|
10126
|
+
return Object.entries(namesPT).map(([_, namePT]) => {
|
|
10127
|
+
var _a;
|
|
10128
|
+
const nameTranslated = (_a = Object.entries(namesLang).find(([, name]) => namePT === name)) != null ? _a : Object.entries(namesPT).find(([, name]) => name === namePT);
|
|
10129
|
+
const label = (nameTranslated == null ? void 0 : nameTranslated[1]) || namePT;
|
|
10130
|
+
return {
|
|
10131
|
+
value: namePT,
|
|
10132
|
+
label
|
|
10133
|
+
};
|
|
10134
|
+
});
|
|
10135
|
+
}
|
|
10136
|
+
|
|
10137
|
+
// src/components/FormFields/AddressFormFields/CountryFormField.tsx
|
|
10138
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
10139
|
+
function CountryFormField({
|
|
10140
|
+
name,
|
|
10141
|
+
label,
|
|
10142
|
+
required,
|
|
10143
|
+
language = "pt-BR"
|
|
10144
|
+
}) {
|
|
10145
|
+
const countries2 = useCountries(language);
|
|
10146
|
+
return /* @__PURE__ */ jsx42(Flex2, { direction: "column", children: /* @__PURE__ */ jsx42(
|
|
10147
|
+
SelectFormField,
|
|
10148
|
+
{
|
|
10149
|
+
label,
|
|
10150
|
+
name,
|
|
10151
|
+
options: countries2,
|
|
10152
|
+
required,
|
|
10153
|
+
defaultValue: "Brasil"
|
|
10154
|
+
}
|
|
10155
|
+
) });
|
|
10156
|
+
}
|
|
10157
|
+
|
|
10158
|
+
// src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx
|
|
10159
|
+
import { useController as useController2, useFormContext as useFormContext7 } from "react-hook-form";
|
|
10160
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
10161
|
+
var PostalCodeFormField = ({
|
|
10162
|
+
name,
|
|
10163
|
+
label,
|
|
10164
|
+
required,
|
|
10165
|
+
placeholder,
|
|
10166
|
+
validationErrorMessage
|
|
10167
|
+
}) => {
|
|
10168
|
+
const { control } = useFormContext7();
|
|
10169
|
+
const {
|
|
10170
|
+
field: { onChange, value }
|
|
10171
|
+
} = useController2({ name, control });
|
|
10172
|
+
return /* @__PURE__ */ jsx43(
|
|
10173
|
+
TextFormField,
|
|
10174
|
+
{
|
|
10175
|
+
name,
|
|
10176
|
+
label,
|
|
10177
|
+
required,
|
|
10178
|
+
placeholder: placeholder || "00000-000",
|
|
10179
|
+
mask: {
|
|
10180
|
+
mask: "_____-___",
|
|
10181
|
+
replacement: { _: /[0-9]/ }
|
|
10182
|
+
},
|
|
10183
|
+
value,
|
|
10184
|
+
onChange,
|
|
10185
|
+
validation: {
|
|
10186
|
+
validate: (value2) => {
|
|
10187
|
+
const isEmpty = value2.replace(/[^\d]/g, "").length === 0;
|
|
10188
|
+
if (!required && isEmpty) return true;
|
|
10189
|
+
return /^\d{8}$/.test(value2.replace(/\D/g, "")) || validationErrorMessage;
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10192
|
+
}
|
|
10193
|
+
);
|
|
10194
|
+
};
|
|
10195
|
+
|
|
10196
|
+
// src/utils/states.ts
|
|
10197
|
+
var brazilianStates = [
|
|
10198
|
+
{ value: "AC", label: "Acre" },
|
|
10199
|
+
{ value: "AL", label: "Alagoas" },
|
|
10200
|
+
{ value: "AP", label: "Amap\xE1" },
|
|
10201
|
+
{ value: "AM", label: "Amazonas" },
|
|
10202
|
+
{ value: "BA", label: "Bahia" },
|
|
10203
|
+
{ value: "CE", label: "Cear\xE1" },
|
|
10204
|
+
{ value: "DF", label: "Distrito Federal" },
|
|
10205
|
+
{ value: "ES", label: "Esp\xEDrito Santo" },
|
|
10206
|
+
{ value: "GO", label: "Goi\xE1s" },
|
|
10207
|
+
{ value: "MA", label: "Maranh\xE3o" },
|
|
10208
|
+
{ value: "MT", label: "Mato Grosso" },
|
|
10209
|
+
{ value: "MS", label: "Mato Grosso do Sul" },
|
|
10210
|
+
{ value: "MG", label: "Minas Gerais" },
|
|
10211
|
+
{ value: "PA", label: "Par\xE1" },
|
|
10212
|
+
{ value: "PB", label: "Para\xEDba" },
|
|
10213
|
+
{ value: "PR", label: "Paran\xE1" },
|
|
10214
|
+
{ value: "PE", label: "Pernambuco" },
|
|
10215
|
+
{ value: "PI", label: "Piau\xED" },
|
|
10216
|
+
{ value: "RJ", label: "Rio de Janeiro" },
|
|
10217
|
+
{ value: "RN", label: "Rio Grande do Norte" },
|
|
10218
|
+
{ value: "RS", label: "Rio Grande do Sul" },
|
|
10219
|
+
{ value: "RO", label: "Rond\xF4nia" },
|
|
10220
|
+
{ value: "RR", label: "Roraima" },
|
|
10221
|
+
{ value: "SC", label: "Santa Catarina" },
|
|
10222
|
+
{ value: "SP", label: "S\xE3o Paulo" },
|
|
10223
|
+
{ value: "SE", label: "Sergipe" },
|
|
10224
|
+
{ value: "TO", label: "Tocantins" }
|
|
10225
|
+
];
|
|
10226
|
+
|
|
10227
|
+
// src/components/FormFields/AddressFormFields/StateFormField.tsx
|
|
10228
|
+
import { Fragment as Fragment2, jsx as jsx44 } from "react/jsx-runtime";
|
|
10229
|
+
function StateFormField({
|
|
10230
|
+
name,
|
|
10231
|
+
label,
|
|
10232
|
+
required,
|
|
10233
|
+
isBrazil
|
|
10234
|
+
}) {
|
|
10235
|
+
return /* @__PURE__ */ jsx44(Fragment2, { children: isBrazil ? /* @__PURE__ */ jsx44(
|
|
10236
|
+
SelectFormField,
|
|
10237
|
+
{
|
|
10238
|
+
name,
|
|
10239
|
+
options: brazilianStates,
|
|
10240
|
+
required,
|
|
10241
|
+
label
|
|
10242
|
+
}
|
|
10243
|
+
) : /* @__PURE__ */ jsx44(TextFormField, { name, required, label }) });
|
|
10244
|
+
}
|
|
10245
|
+
|
|
10246
|
+
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
10247
|
+
import { useEffect as useEffect3, useState as useState8 } from "react";
|
|
10248
|
+
import { useFormContext as useFormContext8, Controller as Controller2 } from "react-hook-form";
|
|
10249
|
+
import { Fragment as Fragment3, jsx as jsx45 } from "react/jsx-runtime";
|
|
10250
|
+
function CityFormField({
|
|
10251
|
+
name,
|
|
10252
|
+
label,
|
|
10253
|
+
stateName,
|
|
10254
|
+
required,
|
|
10255
|
+
isBrazil,
|
|
10256
|
+
placeholder
|
|
10257
|
+
}) {
|
|
10258
|
+
const { control, watch } = useFormContext8();
|
|
10259
|
+
const selectedState = watch(stateName);
|
|
10260
|
+
const [cities, setCities] = useState8([]);
|
|
10261
|
+
const [loading, setLoading] = useState8(false);
|
|
10262
|
+
useEffect3(() => {
|
|
10263
|
+
if (!isBrazil) {
|
|
10264
|
+
setCities([]);
|
|
10265
|
+
return;
|
|
10266
|
+
}
|
|
10267
|
+
if (!selectedState) {
|
|
10268
|
+
setCities([]);
|
|
10269
|
+
return;
|
|
10270
|
+
}
|
|
10271
|
+
function fetchCities() {
|
|
10272
|
+
return __async(this, null, function* () {
|
|
10273
|
+
setLoading(true);
|
|
10274
|
+
try {
|
|
10275
|
+
const ufResponse = yield fetch(
|
|
10276
|
+
`https://servicodados.ibge.gov.br/api/v1/localidades/estados`
|
|
10277
|
+
);
|
|
10278
|
+
const estados = yield ufResponse.json();
|
|
10279
|
+
const estadoSelecionado = estados.find(
|
|
10280
|
+
(e) => e.sigla === selectedState
|
|
10281
|
+
);
|
|
10282
|
+
if (!estadoSelecionado) {
|
|
10283
|
+
setCities([]);
|
|
10284
|
+
setLoading(false);
|
|
10285
|
+
return;
|
|
10286
|
+
}
|
|
10287
|
+
const response = yield fetch(
|
|
10288
|
+
`https://servicodados.ibge.gov.br/api/v1/localidades/estados/${estadoSelecionado.id}/municipios`
|
|
10289
|
+
);
|
|
10290
|
+
const data = yield response.json();
|
|
10291
|
+
setCities(data);
|
|
10292
|
+
} catch (error) {
|
|
10293
|
+
setCities([]);
|
|
10294
|
+
} finally {
|
|
10295
|
+
setLoading(false);
|
|
10296
|
+
}
|
|
10297
|
+
});
|
|
10298
|
+
}
|
|
10299
|
+
fetchCities();
|
|
10300
|
+
}, [selectedState, isBrazil]);
|
|
10301
|
+
return /* @__PURE__ */ jsx45(Fragment3, { children: isBrazil && cities.length > 0 ? /* @__PURE__ */ jsx45(
|
|
10302
|
+
Controller2,
|
|
10303
|
+
{
|
|
10304
|
+
name,
|
|
10305
|
+
control,
|
|
10306
|
+
rules: { required },
|
|
10307
|
+
render: ({ field }) => /* @__PURE__ */ jsx45(
|
|
10308
|
+
SelectFormField,
|
|
10309
|
+
__spreadProps(__spreadValues({
|
|
10310
|
+
label,
|
|
10311
|
+
required
|
|
10312
|
+
}, field), {
|
|
10313
|
+
options: cities.map((city) => ({
|
|
10314
|
+
value: city.nome,
|
|
10315
|
+
label: city.nome
|
|
10316
|
+
})),
|
|
10317
|
+
placeholder: loading ? "Carregando cidades..." : placeholder || "Selecione a cidade"
|
|
10318
|
+
})
|
|
10319
|
+
)
|
|
10320
|
+
}
|
|
10321
|
+
) : /* @__PURE__ */ jsx45(
|
|
10322
|
+
TextFormField,
|
|
10323
|
+
{
|
|
10324
|
+
name,
|
|
10325
|
+
required,
|
|
10326
|
+
placeholder,
|
|
10327
|
+
label
|
|
10328
|
+
}
|
|
10329
|
+
) });
|
|
10330
|
+
}
|
|
10331
|
+
|
|
10332
|
+
// src/components/FormFields/AddressFormFields/index.tsx
|
|
10333
|
+
import { jsx as jsx46, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
10334
|
+
function getNestedValue2(obj, path) {
|
|
10335
|
+
return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
10336
|
+
}
|
|
10337
|
+
var AddressContainerStyled = styled("div", {
|
|
10338
|
+
variants: {
|
|
10339
|
+
layout: {
|
|
10340
|
+
column: {
|
|
10341
|
+
display: "flex",
|
|
10342
|
+
flexDirection: "column",
|
|
10343
|
+
gap: "$4"
|
|
10344
|
+
},
|
|
10345
|
+
grid: {
|
|
10346
|
+
display: "grid",
|
|
10347
|
+
gap: "$8 $16",
|
|
10348
|
+
gridTemplateColumns: "repeat(2, 1fr)",
|
|
10349
|
+
"& > *:nth-child(1)": {
|
|
10350
|
+
gridColumn: "span 2"
|
|
10351
|
+
}
|
|
10352
|
+
}
|
|
10353
|
+
}
|
|
10354
|
+
}
|
|
10355
|
+
});
|
|
10356
|
+
function AddressFormFields({
|
|
10357
|
+
name,
|
|
10358
|
+
label,
|
|
10359
|
+
required,
|
|
10360
|
+
layout = "column"
|
|
10361
|
+
}) {
|
|
10362
|
+
const { control, setValue } = useFormContext9();
|
|
10363
|
+
const { errors } = useFormState({ control });
|
|
10364
|
+
const selectedCountry = useWatch2({ control, name: `${name}.country` });
|
|
10365
|
+
const cep = useWatch2({ control, name: `${name}.zip_code` });
|
|
10366
|
+
const isBrazil = selectedCountry === "Brasil";
|
|
10367
|
+
const addressErrors = getNestedValue2(errors, name);
|
|
10368
|
+
const haveError = !!addressErrors;
|
|
10369
|
+
useEffect4(() => {
|
|
10370
|
+
const cleanedCep = cep == null ? void 0 : cep.replace(/\D/g, "");
|
|
10371
|
+
if (isBrazil && (cleanedCep == null ? void 0 : cleanedCep.length) === 8) {
|
|
10372
|
+
fetch(`https://viacep.com.br/ws/${cleanedCep}/json`).then((res) => res.json()).then((data) => {
|
|
10373
|
+
if (!data.erro) {
|
|
10374
|
+
setValue(`${name}.street`, data.logradouro || "");
|
|
10375
|
+
setValue(`${name}.neighborhood`, data.bairro || "");
|
|
10376
|
+
setValue(`${name}.city`, data.localidade || "");
|
|
10377
|
+
setValue(`${name}.state`, data.uf || "");
|
|
10378
|
+
}
|
|
10379
|
+
}).catch(() => {
|
|
10380
|
+
console.error("Erro ao buscar CEP");
|
|
10381
|
+
});
|
|
10382
|
+
}
|
|
10383
|
+
}, [cep, isBrazil]);
|
|
10384
|
+
return /* @__PURE__ */ jsxs23(AddressContainerStyled, { layout, children: [
|
|
10385
|
+
/* @__PURE__ */ jsx46(
|
|
10386
|
+
FormLabel,
|
|
10387
|
+
{
|
|
10388
|
+
name,
|
|
10389
|
+
label,
|
|
10390
|
+
required,
|
|
10391
|
+
haveError
|
|
10392
|
+
}
|
|
10393
|
+
),
|
|
10394
|
+
/* @__PURE__ */ jsx46(
|
|
10395
|
+
CountryFormField,
|
|
10396
|
+
{
|
|
10397
|
+
name: `${name}.country`,
|
|
10398
|
+
label: "Pa\xEDs",
|
|
10399
|
+
required,
|
|
10400
|
+
language: "pt-BR"
|
|
10401
|
+
}
|
|
10402
|
+
),
|
|
10403
|
+
isBrazil ? /* @__PURE__ */ jsx46(
|
|
10404
|
+
PostalCodeFormField,
|
|
10405
|
+
{
|
|
10406
|
+
name: `${name}.zip_code`,
|
|
10407
|
+
label: "CEP",
|
|
10408
|
+
required,
|
|
10409
|
+
placeholder: "00000-000",
|
|
10410
|
+
validationErrorMessage: "CEP inv\xE1lido"
|
|
10411
|
+
}
|
|
10412
|
+
) : /* @__PURE__ */ jsx46(
|
|
10413
|
+
TextFormField,
|
|
10414
|
+
{
|
|
10415
|
+
name: `${name}.zip_code`,
|
|
10416
|
+
label: "C\xF3digo Postal",
|
|
10417
|
+
required
|
|
10418
|
+
}
|
|
10419
|
+
),
|
|
10420
|
+
/* @__PURE__ */ jsx46(
|
|
10421
|
+
StateFormField,
|
|
10422
|
+
{
|
|
10423
|
+
name: `${name}.state`,
|
|
10424
|
+
label: "Estado",
|
|
10425
|
+
required,
|
|
10426
|
+
isBrazil
|
|
10427
|
+
}
|
|
10428
|
+
),
|
|
10429
|
+
/* @__PURE__ */ jsx46(
|
|
10430
|
+
CityFormField,
|
|
10431
|
+
{
|
|
10432
|
+
name: `${name}.city`,
|
|
10433
|
+
stateName: `${name}.state`,
|
|
10434
|
+
label: "Cidade",
|
|
10435
|
+
required,
|
|
10436
|
+
isBrazil
|
|
10437
|
+
}
|
|
10438
|
+
),
|
|
10439
|
+
/* @__PURE__ */ jsx46(TextFormField, { name: `${name}.street`, label: "Rua", required }),
|
|
10440
|
+
/* @__PURE__ */ jsx46(
|
|
10441
|
+
TextFormField,
|
|
10442
|
+
{
|
|
10443
|
+
name: `${name}.number`,
|
|
10444
|
+
label: "N\xFAmero",
|
|
10445
|
+
required
|
|
10446
|
+
}
|
|
10447
|
+
),
|
|
10448
|
+
/* @__PURE__ */ jsx46(
|
|
10449
|
+
TextFormField,
|
|
10450
|
+
{
|
|
10451
|
+
name: `${name}.neighborhood`,
|
|
10452
|
+
label: "Bairro",
|
|
10453
|
+
required
|
|
10454
|
+
}
|
|
10455
|
+
),
|
|
10456
|
+
/* @__PURE__ */ jsx46(TextFormField, { name: `${name}.complement`, label: "Complemento" })
|
|
10457
|
+
] });
|
|
10458
|
+
}
|
|
10459
|
+
|
|
10460
|
+
// src/components/FormFields/RadioGroupFormField.tsx
|
|
10461
|
+
import { Controller as Controller3, useFormContext as useFormContext10 } from "react-hook-form";
|
|
10462
|
+
import { jsx as jsx47, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
10463
|
+
var RadioGroupFormField = ({
|
|
10464
|
+
name,
|
|
10465
|
+
label,
|
|
10466
|
+
options,
|
|
10467
|
+
required,
|
|
10468
|
+
defaultValue,
|
|
10469
|
+
validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
|
|
10470
|
+
color = "blue",
|
|
10471
|
+
fontWeight = "regular",
|
|
10472
|
+
disabled = false
|
|
10473
|
+
}) => {
|
|
10474
|
+
const {
|
|
10475
|
+
control,
|
|
10476
|
+
formState: { errors }
|
|
10477
|
+
} = useFormContext10();
|
|
10478
|
+
const fieldError = getNestedValue(errors, name);
|
|
10479
|
+
const haveError = !!fieldError;
|
|
10480
|
+
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10481
|
+
const validationRules = {
|
|
10482
|
+
required: required ? validationErrorMessage : false
|
|
10483
|
+
};
|
|
10484
|
+
return /* @__PURE__ */ jsxs24(Flex2, { direction: "column", children: [
|
|
10485
|
+
/* @__PURE__ */ jsx47(
|
|
10486
|
+
FormLabel,
|
|
10487
|
+
{
|
|
10488
|
+
name,
|
|
10489
|
+
label,
|
|
10490
|
+
required,
|
|
10491
|
+
haveError
|
|
10492
|
+
}
|
|
10493
|
+
),
|
|
10494
|
+
/* @__PURE__ */ jsx47(
|
|
10495
|
+
Controller3,
|
|
10496
|
+
{
|
|
10497
|
+
name,
|
|
10498
|
+
control,
|
|
10499
|
+
defaultValue: defaultValue || "",
|
|
10500
|
+
rules: validationRules,
|
|
10501
|
+
render: ({ field: { value, onChange } }) => /* @__PURE__ */ jsx47(
|
|
10502
|
+
RadioGroup,
|
|
10503
|
+
{
|
|
10504
|
+
value,
|
|
10505
|
+
onValueChange: onChange,
|
|
10506
|
+
color: haveError ? "error" : color,
|
|
10507
|
+
fontWeight,
|
|
10508
|
+
disabled,
|
|
10509
|
+
children: options.map((option) => /* @__PURE__ */ jsxs24("label", { children: [
|
|
10510
|
+
/* @__PURE__ */ jsx47(RadioItem, { value: option.value }),
|
|
10511
|
+
option.label
|
|
10512
|
+
] }, option.value))
|
|
10513
|
+
}
|
|
10514
|
+
)
|
|
10515
|
+
}
|
|
10516
|
+
),
|
|
10517
|
+
/* @__PURE__ */ jsx47(ErrorFormMessage, { message: errorMsg })
|
|
10518
|
+
] });
|
|
10519
|
+
};
|
|
10520
|
+
|
|
10521
|
+
// src/components/FormFields/CheckboxGroupFormField.tsx
|
|
10522
|
+
import { Controller as Controller4, useFormContext as useFormContext11 } from "react-hook-form";
|
|
10523
|
+
import { jsx as jsx48, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
10524
|
+
var CheckboxGroupFormField = ({
|
|
10525
|
+
name,
|
|
10526
|
+
label,
|
|
10527
|
+
options,
|
|
10528
|
+
required,
|
|
10529
|
+
validationErrorMessage = "Selecione pelo menos uma op\xE7\xE3o.",
|
|
10530
|
+
defaultValue = [],
|
|
10531
|
+
color = "blue",
|
|
10532
|
+
fontWeight = "regular",
|
|
10533
|
+
disabled = false
|
|
10534
|
+
}) => {
|
|
10535
|
+
const {
|
|
10536
|
+
control,
|
|
10537
|
+
formState: { errors }
|
|
10538
|
+
} = useFormContext11();
|
|
10539
|
+
const fieldError = getNestedValue(errors, name);
|
|
10540
|
+
const haveError = !!fieldError;
|
|
10541
|
+
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10542
|
+
const validationRules = {
|
|
10543
|
+
required: required ? validationErrorMessage : false,
|
|
10544
|
+
validate: required ? (value) => (value == null ? void 0 : value.length) > 0 || validationErrorMessage : void 0
|
|
10545
|
+
};
|
|
10546
|
+
return /* @__PURE__ */ jsxs25(Flex2, { direction: "column", children: [
|
|
10547
|
+
/* @__PURE__ */ jsx48(
|
|
10548
|
+
FormLabel,
|
|
10549
|
+
{
|
|
10550
|
+
name,
|
|
10551
|
+
label,
|
|
10552
|
+
required,
|
|
10553
|
+
haveError
|
|
10554
|
+
}
|
|
10555
|
+
),
|
|
10556
|
+
/* @__PURE__ */ jsx48(
|
|
10557
|
+
Controller4,
|
|
10558
|
+
{
|
|
10559
|
+
name,
|
|
10560
|
+
control,
|
|
10561
|
+
rules: validationRules,
|
|
10562
|
+
defaultValue,
|
|
10563
|
+
render: ({ field }) => /* @__PURE__ */ jsx48(
|
|
10564
|
+
CheckboxGroup,
|
|
10565
|
+
{
|
|
10566
|
+
name,
|
|
10567
|
+
onValueChange: field.onChange,
|
|
10568
|
+
color: haveError ? "error" : color,
|
|
10569
|
+
fontWeight,
|
|
10570
|
+
disabled,
|
|
10571
|
+
children: options.map((option) => /* @__PURE__ */ jsx48(
|
|
10572
|
+
CheckboxItem,
|
|
10573
|
+
{
|
|
10574
|
+
value: option.value,
|
|
10575
|
+
disabled,
|
|
10576
|
+
children: option.label
|
|
10577
|
+
},
|
|
10578
|
+
option.value
|
|
10579
|
+
))
|
|
10580
|
+
}
|
|
10581
|
+
)
|
|
10582
|
+
}
|
|
10583
|
+
),
|
|
10584
|
+
/* @__PURE__ */ jsx48(ErrorFormMessage, { message: errorMsg })
|
|
10585
|
+
] });
|
|
10586
|
+
};
|
|
9746
10587
|
export {
|
|
10588
|
+
AddressFormFields,
|
|
9747
10589
|
Alert,
|
|
9748
10590
|
AlertDialogCompleteStyled,
|
|
9749
10591
|
AlertDialogDescriptionStyled,
|
|
@@ -9756,16 +10598,20 @@ export {
|
|
|
9756
10598
|
AvatarStyled,
|
|
9757
10599
|
Badge,
|
|
9758
10600
|
BadgeStyled,
|
|
10601
|
+
BirthDateFormField,
|
|
9759
10602
|
Box,
|
|
9760
10603
|
Button,
|
|
9761
10604
|
ButtonGroup,
|
|
9762
10605
|
ButtonGroupStyled,
|
|
9763
10606
|
ButtonItem,
|
|
9764
10607
|
ButtonItemStyled,
|
|
10608
|
+
CNPJFormField,
|
|
10609
|
+
CPFFormField,
|
|
9765
10610
|
Calendar,
|
|
9766
10611
|
Card,
|
|
9767
10612
|
CardStyled,
|
|
9768
10613
|
CheckboxGroup,
|
|
10614
|
+
CheckboxGroupFormField,
|
|
9769
10615
|
CheckboxGroupStyled,
|
|
9770
10616
|
CheckboxItem,
|
|
9771
10617
|
Container,
|
|
@@ -9783,6 +10629,7 @@ export {
|
|
|
9783
10629
|
Grid,
|
|
9784
10630
|
GridStyled,
|
|
9785
10631
|
Icon,
|
|
10632
|
+
IdentityDocumentNumberFormField,
|
|
9786
10633
|
InputStyled,
|
|
9787
10634
|
MenuDropdown,
|
|
9788
10635
|
Modal,
|
|
@@ -9790,6 +10637,7 @@ export {
|
|
|
9790
10637
|
MultiSelectFormField,
|
|
9791
10638
|
PhoneFormField,
|
|
9792
10639
|
RadioGroup,
|
|
10640
|
+
RadioGroupFormField,
|
|
9793
10641
|
RadioGroupStyled,
|
|
9794
10642
|
RadioItem,
|
|
9795
10643
|
Section,
|
|
@@ -9825,6 +10673,7 @@ export {
|
|
|
9825
10673
|
TooltipProvider,
|
|
9826
10674
|
TooltipRoot,
|
|
9827
10675
|
TooltipTrigger,
|
|
10676
|
+
isValidCNPJ,
|
|
9828
10677
|
maskFormat,
|
|
9829
10678
|
maskUnformat,
|
|
9830
10679
|
useToast
|