@lets-events/react 11.6.4 → 11.7.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 +18 -20
- package/CHANGELOG.md +12 -0
- package/dist/index.css +171 -0
- package/dist/index.d.mts +65 -435
- package/dist/index.d.ts +65 -435
- package/dist/index.js +364 -269
- package/dist/index.mjs +365 -264
- package/package.json +1 -2
- 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 -176
- 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 +302 -194
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
- package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
- package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -45
- package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
- package/src/components/FormFields/AddressFormFields/index.tsx +141 -139
- package/src/components/FormFields/BirthDateFormField.tsx +85 -87
- package/src/components/FormFields/CNPJFormField.tsx +87 -89
- package/src/components/FormFields/CPFFormField.tsx +77 -79
- package/src/components/FormFields/CheckboxGroupFormField.tsx +90 -90
- package/src/components/FormFields/Form.tsx +28 -29
- package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +40 -42
- package/src/components/FormFields/MultiSelectFormField.tsx +55 -59
- package/src/components/FormFields/PhoneFormField.tsx +40 -130
- package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
- package/src/components/FormFields/SelectFormField.tsx +93 -93
- package/src/components/FormFields/TextAreaFormField.tsx +48 -48
- package/src/components/FormFields/TextFormField.tsx +107 -76
- package/src/components/FormFields/{ErrorFormMessage.tsx → subComponents/ErrorFormMessage.tsx} +36 -36
- package/src/components/FormFields/{FormLabel.tsx → subComponents/FormLabel.tsx} +29 -29
- package/src/components/FormFields/utils/validation.ts +20 -0
- 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 +316 -312
- 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 -41
- package/src/hooks/useOnClickOutside.tsx +20 -20
- package/src/index.tsx +54 -54
- package/src/styles/index.ts +38 -38
- package/src/types/typographyValues.ts +178 -178
- package/src/utils/getNestedValue.ts +3 -3
- package/src/utils/states.ts +29 -29
- package/tsconfig.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -2655,7 +2655,10 @@ var TextFieldStyled = styled(TextFieldRadix.Root, {
|
|
|
2655
2655
|
}
|
|
2656
2656
|
}
|
|
2657
2657
|
}
|
|
2658
|
-
]
|
|
2658
|
+
],
|
|
2659
|
+
defaultVariants: {
|
|
2660
|
+
typography: "labelSmall"
|
|
2661
|
+
}
|
|
2659
2662
|
});
|
|
2660
2663
|
var TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
|
|
2661
2664
|
display: "flex",
|
|
@@ -2690,7 +2693,17 @@ var InputAddon = styled(TextStyle, {
|
|
|
2690
2693
|
display: "flex",
|
|
2691
2694
|
flexWrap: "nowrap",
|
|
2692
2695
|
alignItems: "center",
|
|
2693
|
-
lineHeight: 1
|
|
2696
|
+
lineHeight: 1,
|
|
2697
|
+
variants: {
|
|
2698
|
+
color: {
|
|
2699
|
+
default: {
|
|
2700
|
+
borderColor: "$dark300"
|
|
2701
|
+
},
|
|
2702
|
+
error: {
|
|
2703
|
+
borderColor: "$error400"
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2694
2707
|
});
|
|
2695
2708
|
var maskFormat = format;
|
|
2696
2709
|
var maskUnformat = unformat;
|
|
@@ -2719,7 +2732,7 @@ var TextField = React.forwardRef(
|
|
|
2719
2732
|
]);
|
|
2720
2733
|
const maskRef = mask ? useMask(mask) : void 0;
|
|
2721
2734
|
return /* @__PURE__ */ jsxs(Flex2, { gap: "0", css: { width: "100%" }, children: [
|
|
2722
|
-
!!addon && /* @__PURE__ */ jsx7(InputAddon, { typography: "labelSmall", children: addon }),
|
|
2735
|
+
!!addon && /* @__PURE__ */ jsx7(InputAddon, { color, typography: "labelSmall", children: addon }),
|
|
2723
2736
|
/* @__PURE__ */ jsxs(
|
|
2724
2737
|
TextFieldStyled,
|
|
2725
2738
|
__spreadProps(__spreadValues({
|
|
@@ -2782,27 +2795,17 @@ function TextFieldSlot(_a) {
|
|
|
2782
2795
|
}, props), {
|
|
2783
2796
|
color: void 0
|
|
2784
2797
|
});
|
|
2785
|
-
return
|
|
2798
|
+
return /* @__PURE__ */ jsx7(
|
|
2786
2799
|
TextFieldSlotStyled,
|
|
2787
2800
|
__spreadProps(__spreadValues({}, sharedStyles), {
|
|
2788
2801
|
style: {
|
|
2789
2802
|
float: position === "flex-start" ? "left" : "right",
|
|
2790
2803
|
order: position === "flex-start" ? 0 : 2,
|
|
2791
2804
|
textAlign,
|
|
2792
|
-
zIndex: 2,
|
|
2793
|
-
cursor: "pointer"
|
|
2794
|
-
},
|
|
2795
|
-
onClick: () => onClick(),
|
|
2796
|
-
children
|
|
2797
|
-
})
|
|
2798
|
-
) : /* @__PURE__ */ jsx7(
|
|
2799
|
-
TextFieldSlotStyled,
|
|
2800
|
-
__spreadProps(__spreadValues({}, sharedStyles), {
|
|
2801
|
-
style: {
|
|
2802
|
-
float: position === "flex-start" ? "left" : "right",
|
|
2803
|
-
order: position === "flex-start" ? 0 : 2,
|
|
2804
|
-
textAlign
|
|
2805
|
+
zIndex: onClick ? 2 : void 0,
|
|
2806
|
+
cursor: onClick ? "pointer" : void 0
|
|
2805
2807
|
},
|
|
2808
|
+
onClick,
|
|
2806
2809
|
children
|
|
2807
2810
|
})
|
|
2808
2811
|
);
|
|
@@ -3293,21 +3296,24 @@ function FilterItem(_a) {
|
|
|
3293
3296
|
}
|
|
3294
3297
|
|
|
3295
3298
|
// src/components/Dropdown.tsx
|
|
3296
|
-
import {
|
|
3299
|
+
import React2, {
|
|
3300
|
+
useState,
|
|
3301
|
+
useRef,
|
|
3302
|
+
useEffect
|
|
3303
|
+
} from "react";
|
|
3297
3304
|
import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons";
|
|
3298
|
-
import { Theme as Theme2, DropdownMenu as DropdownMenuRadix } from "@radix-ui/themes";
|
|
3299
3305
|
import { FontAwesomeIcon as FontAwesomeIcon2 } from "@fortawesome/react-fontawesome";
|
|
3300
3306
|
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
3301
|
-
var DropdownMenuItemStyled = styled(
|
|
3307
|
+
var DropdownMenuItemStyled = styled("div", {
|
|
3302
3308
|
fontFamily: "$default",
|
|
3303
3309
|
color: "$dark600",
|
|
3304
3310
|
letterSpacing: "0px",
|
|
3305
3311
|
padding: "$8 $16",
|
|
3312
|
+
cursor: "pointer",
|
|
3306
3313
|
"&:hover, &:focus": {
|
|
3307
3314
|
backgroundColor: "$dark100",
|
|
3308
3315
|
border: "none",
|
|
3309
|
-
outline: "none"
|
|
3310
|
-
cursor: "pointer"
|
|
3316
|
+
outline: "none"
|
|
3311
3317
|
},
|
|
3312
3318
|
variants: {
|
|
3313
3319
|
typography: typographyLabelValues,
|
|
@@ -3320,16 +3326,18 @@ var DropdownMenuItemStyled = styled(DropdownMenuRadix.Item, {
|
|
|
3320
3326
|
}
|
|
3321
3327
|
});
|
|
3322
3328
|
var DropdownMenuStyled = styled("div", {
|
|
3329
|
+
boxSizing: "border-box",
|
|
3323
3330
|
fontFamily: "$default",
|
|
3324
3331
|
color: "$dark600",
|
|
3325
3332
|
letterSpacing: "0px",
|
|
3326
3333
|
cursor: "pointer",
|
|
3327
3334
|
border: "1px solid $dark300",
|
|
3328
3335
|
borderRadius: "$xs",
|
|
3329
|
-
|
|
3330
|
-
width: "100%",
|
|
3336
|
+
maxWidth: "100%",
|
|
3331
3337
|
display: "flex",
|
|
3338
|
+
position: "relative",
|
|
3332
3339
|
button: {
|
|
3340
|
+
boxSizing: "border-box",
|
|
3333
3341
|
fontFamily: "$default",
|
|
3334
3342
|
color: "$dark600",
|
|
3335
3343
|
letterSpacing: "0px",
|
|
@@ -3340,6 +3348,7 @@ var DropdownMenuStyled = styled("div", {
|
|
|
3340
3348
|
display: "flex",
|
|
3341
3349
|
alignItems: "center",
|
|
3342
3350
|
gap: "$8",
|
|
3351
|
+
padding: "$8 $12",
|
|
3343
3352
|
cursor: "pointer",
|
|
3344
3353
|
svg: {
|
|
3345
3354
|
marginLeft: "auto"
|
|
@@ -3388,17 +3397,17 @@ var DropdownMenuStyled = styled("div", {
|
|
|
3388
3397
|
}
|
|
3389
3398
|
}
|
|
3390
3399
|
});
|
|
3391
|
-
var DropdownMenuContentStyled = styled(
|
|
3400
|
+
var DropdownMenuContentStyled = styled("div", {
|
|
3401
|
+
position: "absolute",
|
|
3402
|
+
top: "100%",
|
|
3403
|
+
left: 0,
|
|
3404
|
+
width: "100%",
|
|
3392
3405
|
background: "white",
|
|
3393
3406
|
border: "1px solid $dark300",
|
|
3394
3407
|
borderRadius: "$xs",
|
|
3395
3408
|
boxShadow: "0px 4px 4px 0px rgba(35, 53, 67, 0.08)",
|
|
3396
|
-
width: "100%",
|
|
3397
|
-
minWidth: "100%",
|
|
3398
3409
|
marginTop: "3px",
|
|
3399
3410
|
maxHeight: "400px",
|
|
3400
|
-
height: "100%",
|
|
3401
|
-
position: "relative",
|
|
3402
3411
|
overflow: "auto",
|
|
3403
3412
|
zIndex: 9999999999
|
|
3404
3413
|
});
|
|
@@ -3407,63 +3416,144 @@ function DropdownMenu2(_a) {
|
|
|
3407
3416
|
children,
|
|
3408
3417
|
placeholder,
|
|
3409
3418
|
typography,
|
|
3410
|
-
color,
|
|
3411
|
-
fontWeight
|
|
3419
|
+
color = "default",
|
|
3420
|
+
fontWeight,
|
|
3421
|
+
open: controlledOpen,
|
|
3422
|
+
onOpenChange,
|
|
3423
|
+
defaultOpen = false
|
|
3412
3424
|
} = _b, props = __objRest(_b, [
|
|
3413
3425
|
"children",
|
|
3414
3426
|
"placeholder",
|
|
3415
3427
|
"typography",
|
|
3416
3428
|
"color",
|
|
3417
|
-
"fontWeight"
|
|
3429
|
+
"fontWeight",
|
|
3430
|
+
"open",
|
|
3431
|
+
"onOpenChange",
|
|
3432
|
+
"defaultOpen"
|
|
3418
3433
|
]);
|
|
3419
|
-
const [
|
|
3420
|
-
|
|
3434
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
3435
|
+
const dropdownRef = useRef(null);
|
|
3436
|
+
const isControlled = controlledOpen !== void 0;
|
|
3437
|
+
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
3438
|
+
const handleToggle = () => {
|
|
3439
|
+
const newOpen = !isOpen;
|
|
3440
|
+
if (!isControlled) {
|
|
3441
|
+
setInternalOpen(newOpen);
|
|
3442
|
+
}
|
|
3443
|
+
onOpenChange == null ? void 0 : onOpenChange(newOpen);
|
|
3444
|
+
};
|
|
3445
|
+
const handleClose = () => {
|
|
3446
|
+
if (!isControlled) {
|
|
3447
|
+
setInternalOpen(false);
|
|
3448
|
+
}
|
|
3449
|
+
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
3450
|
+
};
|
|
3451
|
+
useEffect(() => {
|
|
3452
|
+
const handleClickOutside = (event) => {
|
|
3453
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
3454
|
+
handleClose();
|
|
3455
|
+
}
|
|
3456
|
+
};
|
|
3457
|
+
const handleEscape = (event) => {
|
|
3458
|
+
if (event.key === "Escape") {
|
|
3459
|
+
handleClose();
|
|
3460
|
+
}
|
|
3461
|
+
};
|
|
3462
|
+
if (isOpen) {
|
|
3463
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
3464
|
+
document.addEventListener("keydown", handleEscape);
|
|
3465
|
+
}
|
|
3466
|
+
return () => {
|
|
3467
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
3468
|
+
document.removeEventListener("keydown", handleEscape);
|
|
3469
|
+
};
|
|
3470
|
+
}, [isOpen]);
|
|
3471
|
+
return /* @__PURE__ */ jsxs3(
|
|
3421
3472
|
DropdownMenuStyled,
|
|
3422
|
-
{
|
|
3473
|
+
__spreadProps(__spreadValues({
|
|
3474
|
+
ref: dropdownRef,
|
|
3423
3475
|
typography,
|
|
3424
3476
|
fontWeight,
|
|
3425
|
-
color
|
|
3477
|
+
color
|
|
3478
|
+
}, props), {
|
|
3426
3479
|
children: [
|
|
3427
|
-
/* @__PURE__ */
|
|
3428
|
-
|
|
3429
|
-
/* @__PURE__ */ jsx11(
|
|
3430
|
-
FontAwesomeIcon2,
|
|
3431
|
-
{
|
|
3432
|
-
icon: isOpen ? faChevronUp : faChevronDown,
|
|
3433
|
-
size: "sm",
|
|
3434
|
-
color: colors.dark600
|
|
3435
|
-
}
|
|
3436
|
-
)
|
|
3437
|
-
] }) }),
|
|
3438
|
-
/* @__PURE__ */ jsx11(
|
|
3439
|
-
DropdownMenuContentStyled,
|
|
3480
|
+
/* @__PURE__ */ jsxs3(
|
|
3481
|
+
"button",
|
|
3440
3482
|
{
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3483
|
+
"aria-label": placeholder || "Filtrar",
|
|
3484
|
+
"aria-expanded": isOpen,
|
|
3485
|
+
"aria-haspopup": "listbox",
|
|
3486
|
+
onClick: handleToggle,
|
|
3487
|
+
type: "button",
|
|
3488
|
+
onKeyDown: (e) => {
|
|
3489
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3490
|
+
e.preventDefault();
|
|
3491
|
+
handleToggle();
|
|
3492
|
+
}
|
|
3493
|
+
},
|
|
3494
|
+
children: [
|
|
3495
|
+
/* @__PURE__ */ jsx11("span", { children: placeholder || "Filtrar" }),
|
|
3496
|
+
/* @__PURE__ */ jsx11(
|
|
3497
|
+
FontAwesomeIcon2,
|
|
3498
|
+
{
|
|
3499
|
+
icon: isOpen ? faChevronUp : faChevronDown,
|
|
3500
|
+
size: "sm",
|
|
3501
|
+
color: colors.dark600
|
|
3502
|
+
}
|
|
3503
|
+
)
|
|
3504
|
+
]
|
|
3446
3505
|
}
|
|
3447
|
-
)
|
|
3506
|
+
),
|
|
3507
|
+
isOpen && /* @__PURE__ */ jsx11(DropdownMenuContentStyled, { role: "listbox", children: /* @__PURE__ */ jsx11(DropdownMenuProvider, { onItemSelect: handleClose, children }) })
|
|
3448
3508
|
]
|
|
3449
|
-
}
|
|
3450
|
-
)
|
|
3509
|
+
})
|
|
3510
|
+
);
|
|
3511
|
+
}
|
|
3512
|
+
var DropdownMenuContext = React2.createContext(null);
|
|
3513
|
+
function DropdownMenuProvider({
|
|
3514
|
+
children,
|
|
3515
|
+
onItemSelect
|
|
3516
|
+
}) {
|
|
3517
|
+
return /* @__PURE__ */ jsx11(DropdownMenuContext.Provider, { value: { onItemSelect }, children });
|
|
3451
3518
|
}
|
|
3452
3519
|
function DropdownMenuItem(_a) {
|
|
3453
3520
|
var _b = _a, {
|
|
3454
3521
|
children,
|
|
3455
3522
|
typography,
|
|
3456
|
-
fontWeight
|
|
3523
|
+
fontWeight,
|
|
3524
|
+
value,
|
|
3525
|
+
onSelect,
|
|
3526
|
+
onClick
|
|
3457
3527
|
} = _b, props = __objRest(_b, [
|
|
3458
3528
|
"children",
|
|
3459
3529
|
"typography",
|
|
3460
|
-
"fontWeight"
|
|
3530
|
+
"fontWeight",
|
|
3531
|
+
"value",
|
|
3532
|
+
"onSelect",
|
|
3533
|
+
"onClick"
|
|
3461
3534
|
]);
|
|
3535
|
+
const context = React2.useContext(DropdownMenuContext);
|
|
3536
|
+
const handleClick = (event) => {
|
|
3537
|
+
onClick == null ? void 0 : onClick(event);
|
|
3538
|
+
onSelect == null ? void 0 : onSelect(value);
|
|
3539
|
+
context == null ? void 0 : context.onItemSelect();
|
|
3540
|
+
};
|
|
3541
|
+
const handleKeyDown = (event) => {
|
|
3542
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
3543
|
+
event.preventDefault();
|
|
3544
|
+
onSelect == null ? void 0 : onSelect(value);
|
|
3545
|
+
context == null ? void 0 : context.onItemSelect();
|
|
3546
|
+
}
|
|
3547
|
+
};
|
|
3462
3548
|
return /* @__PURE__ */ jsx11(
|
|
3463
3549
|
DropdownMenuItemStyled,
|
|
3464
3550
|
__spreadProps(__spreadValues({
|
|
3465
3551
|
typography,
|
|
3466
|
-
fontWeight
|
|
3552
|
+
fontWeight,
|
|
3553
|
+
onClick: handleClick,
|
|
3554
|
+
onKeyDown: handleKeyDown,
|
|
3555
|
+
tabIndex: 0,
|
|
3556
|
+
role: "option"
|
|
3467
3557
|
}, props), {
|
|
3468
3558
|
children
|
|
3469
3559
|
})
|
|
@@ -3471,7 +3561,7 @@ function DropdownMenuItem(_a) {
|
|
|
3471
3561
|
}
|
|
3472
3562
|
|
|
3473
3563
|
// src/components/Badge.tsx
|
|
3474
|
-
import
|
|
3564
|
+
import React3 from "react";
|
|
3475
3565
|
import { Badge as BadgeRadix } from "@radix-ui/themes";
|
|
3476
3566
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3477
3567
|
var BadgeStyled = styled(BadgeRadix, {
|
|
@@ -3575,9 +3665,9 @@ var BadgeStyled = styled(BadgeRadix, {
|
|
|
3575
3665
|
});
|
|
3576
3666
|
function Badge(_a) {
|
|
3577
3667
|
var _b = _a, { asChild, children } = _b, props = __objRest(_b, ["asChild", "children"]);
|
|
3578
|
-
return /* @__PURE__ */ jsx12(BadgeStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
3579
|
-
if (
|
|
3580
|
-
return
|
|
3668
|
+
return /* @__PURE__ */ jsx12(BadgeStyled, __spreadProps(__spreadValues({}, props), { children: React3.Children.map(children, (child) => {
|
|
3669
|
+
if (React3.isValidElement(child)) {
|
|
3670
|
+
return React3.cloneElement(child, { size: props.size });
|
|
3581
3671
|
}
|
|
3582
3672
|
return child;
|
|
3583
3673
|
}) }));
|
|
@@ -3699,12 +3789,12 @@ function MenuDropdown({ children }) {
|
|
|
3699
3789
|
}
|
|
3700
3790
|
|
|
3701
3791
|
// src/components/Calendar/index.tsx
|
|
3702
|
-
import { useRef, useEffect as
|
|
3792
|
+
import { useRef as useRef2, useEffect as useEffect3, useState as useState3 } from "react";
|
|
3703
3793
|
|
|
3704
3794
|
// src/hooks/useOnClickOutside.tsx
|
|
3705
|
-
import { useEffect } from "react";
|
|
3795
|
+
import { useEffect as useEffect2 } from "react";
|
|
3706
3796
|
function useOnClickOutside(ref, handler) {
|
|
3707
|
-
|
|
3797
|
+
useEffect2(() => {
|
|
3708
3798
|
const listener = (event) => {
|
|
3709
3799
|
if (!ref.current || ref.current.contains(event.target)) {
|
|
3710
3800
|
return;
|
|
@@ -3727,8 +3817,8 @@ import { DayPicker } from "react-day-picker";
|
|
|
3727
3817
|
function buildFormatLongFn(args) {
|
|
3728
3818
|
return (options = {}) => {
|
|
3729
3819
|
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
3730
|
-
const
|
|
3731
|
-
return
|
|
3820
|
+
const format4 = args.formats[width] || args.formats[args.defaultWidth];
|
|
3821
|
+
return format4;
|
|
3732
3822
|
};
|
|
3733
3823
|
}
|
|
3734
3824
|
|
|
@@ -4423,11 +4513,11 @@ var formatRelativeLocale2 = {
|
|
|
4423
4513
|
other: "P"
|
|
4424
4514
|
};
|
|
4425
4515
|
var formatRelative2 = (token, date, _baseDate, _options) => {
|
|
4426
|
-
const
|
|
4427
|
-
if (typeof
|
|
4428
|
-
return
|
|
4516
|
+
const format4 = formatRelativeLocale2[token];
|
|
4517
|
+
if (typeof format4 === "function") {
|
|
4518
|
+
return format4(date);
|
|
4429
4519
|
}
|
|
4430
|
-
return
|
|
4520
|
+
return format4;
|
|
4431
4521
|
};
|
|
4432
4522
|
|
|
4433
4523
|
// ../../node_modules/date-fns/locale/pt-BR/_lib/localize.js
|
|
@@ -5695,14 +5785,14 @@ function isProtectedDayOfYearToken(token) {
|
|
|
5695
5785
|
function isProtectedWeekYearToken(token) {
|
|
5696
5786
|
return weekYearTokenRE.test(token);
|
|
5697
5787
|
}
|
|
5698
|
-
function warnOrThrowProtectedError(token,
|
|
5699
|
-
const _message = message(token,
|
|
5788
|
+
function warnOrThrowProtectedError(token, format4, input) {
|
|
5789
|
+
const _message = message(token, format4, input);
|
|
5700
5790
|
console.warn(_message);
|
|
5701
5791
|
if (throwTokens.includes(token)) throw new RangeError(_message);
|
|
5702
5792
|
}
|
|
5703
|
-
function message(token,
|
|
5793
|
+
function message(token, format4, input) {
|
|
5704
5794
|
const subject = token[0] === "Y" ? "years" : "days of the month";
|
|
5705
|
-
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${
|
|
5795
|
+
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format4}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
5706
5796
|
}
|
|
5707
5797
|
|
|
5708
5798
|
// ../../node_modules/date-fns/format.js
|
|
@@ -7843,13 +7933,13 @@ function Calendar(_a) {
|
|
|
7843
7933
|
]);
|
|
7844
7934
|
const [inputValue, setInputValue] = useState3("");
|
|
7845
7935
|
const [showContainer, setShowCalendar] = useState3(false);
|
|
7846
|
-
const dropdownRef =
|
|
7936
|
+
const dropdownRef = useRef2(null);
|
|
7847
7937
|
useOnClickOutside(dropdownRef, () => {
|
|
7848
7938
|
setShowCalendar(false);
|
|
7849
7939
|
});
|
|
7850
7940
|
const today = /* @__PURE__ */ new Date();
|
|
7851
7941
|
const maxDate = addYears(today, 20);
|
|
7852
|
-
|
|
7942
|
+
useEffect3(() => {
|
|
7853
7943
|
if (selected) {
|
|
7854
7944
|
setInputValue(format2(selected, "dd/MM/yyyy"));
|
|
7855
7945
|
} else {
|
|
@@ -7999,7 +8089,7 @@ function Drawer({
|
|
|
7999
8089
|
}
|
|
8000
8090
|
|
|
8001
8091
|
// src/components/TimePicker.tsx
|
|
8002
|
-
import { useCallback, useRef as
|
|
8092
|
+
import { useCallback, useRef as useRef3, useState as useState4 } from "react";
|
|
8003
8093
|
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
8004
8094
|
var TimePickerStyled = styled("div", {
|
|
8005
8095
|
position: "relative",
|
|
@@ -8108,7 +8198,7 @@ function TimePicker({
|
|
|
8108
8198
|
const [rawHours, setRawHours] = useState4("00");
|
|
8109
8199
|
const [rawMinutes, setRawMinutes] = useState4("00");
|
|
8110
8200
|
const [isOpen, setIsOpen] = useState4(false);
|
|
8111
|
-
const dropdownRef =
|
|
8201
|
+
const dropdownRef = useRef3(null);
|
|
8112
8202
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8113
8203
|
const handleIncrement = useCallback(
|
|
8114
8204
|
(type) => {
|
|
@@ -8307,7 +8397,7 @@ function TimePicker({
|
|
|
8307
8397
|
}
|
|
8308
8398
|
|
|
8309
8399
|
// src/components/Alert.tsx
|
|
8310
|
-
import { Theme as
|
|
8400
|
+
import { Theme as Theme2, AlertDialog } from "@radix-ui/themes";
|
|
8311
8401
|
import { Fragment, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
8312
8402
|
var AlertDialogSimpleStyled = styled(AlertDialog.Content, {
|
|
8313
8403
|
fontFamily: "$default",
|
|
@@ -8423,14 +8513,14 @@ function Alert(_a) {
|
|
|
8423
8513
|
"simpleAlert"
|
|
8424
8514
|
]);
|
|
8425
8515
|
return /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
8426
|
-
simpleAlert && /* @__PURE__ */ jsx18(
|
|
8516
|
+
simpleAlert && /* @__PURE__ */ jsx18(Theme2, { children: /* @__PURE__ */ jsxs9(AlertDialog.Root, { children: [
|
|
8427
8517
|
/* @__PURE__ */ jsx18(AlertDialog.Trigger, { children: trigger }),
|
|
8428
8518
|
/* @__PURE__ */ jsx18(Fragment, { children: /* @__PURE__ */ jsxs9(AlertDialogSimpleStyled, __spreadProps(__spreadValues({}, props), { children: [
|
|
8429
8519
|
/* @__PURE__ */ jsx18(AlertDialogDescriptionStyled, { children: simpleAlert.description }),
|
|
8430
8520
|
simpleAlert.cancel && /* @__PURE__ */ jsx18(AlertDialog.Cancel, { children: /* @__PURE__ */ jsx18(Button, { variant: "text", children: /* @__PURE__ */ jsx18(Icon_default, { name: "close" }) }) })
|
|
8431
8521
|
] })) })
|
|
8432
8522
|
] }) }),
|
|
8433
|
-
completAlert && /* @__PURE__ */ jsx18(
|
|
8523
|
+
completAlert && /* @__PURE__ */ jsx18(Theme2, { children: /* @__PURE__ */ jsxs9(AlertDialog.Root, { children: [
|
|
8434
8524
|
/* @__PURE__ */ jsx18(AlertDialog.Trigger, { children: trigger }),
|
|
8435
8525
|
/* @__PURE__ */ jsxs9(AlertDialogCompleteStyled, { children: [
|
|
8436
8526
|
/* @__PURE__ */ jsxs9(AlertDialogRowStyled, { className: "le-alert-dialog-row", children: [
|
|
@@ -8646,7 +8736,7 @@ function Switch(props) {
|
|
|
8646
8736
|
}
|
|
8647
8737
|
|
|
8648
8738
|
// src/components/Step.tsx
|
|
8649
|
-
import
|
|
8739
|
+
import React6 from "react";
|
|
8650
8740
|
import { Box as Box2, Tabs as StepRadix } from "@radix-ui/themes";
|
|
8651
8741
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
8652
8742
|
var StepStyled = styled("div", {
|
|
@@ -8762,9 +8852,9 @@ function StepList(_a) {
|
|
|
8762
8852
|
"children",
|
|
8763
8853
|
"currentStep"
|
|
8764
8854
|
]);
|
|
8765
|
-
return /* @__PURE__ */ jsx20(StepListStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
8766
|
-
if (
|
|
8767
|
-
return
|
|
8855
|
+
return /* @__PURE__ */ jsx20(StepListStyled, __spreadProps(__spreadValues({}, props), { children: React6.Children.map(children, (child) => {
|
|
8856
|
+
if (React6.isValidElement(child) && child.type === StepTrigger) {
|
|
8857
|
+
return React6.cloneElement(child, { currentStep });
|
|
8768
8858
|
}
|
|
8769
8859
|
return child;
|
|
8770
8860
|
}) }));
|
|
@@ -8821,7 +8911,7 @@ function Card(_a) {
|
|
|
8821
8911
|
|
|
8822
8912
|
// src/components/TextareaField.tsx
|
|
8823
8913
|
import { TextArea as TextAreaRadix } from "@radix-ui/themes";
|
|
8824
|
-
import
|
|
8914
|
+
import React7, { useRef as useRef4 } from "react";
|
|
8825
8915
|
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
8826
8916
|
var TextareaFieldStyle = styled(TextAreaRadix, {
|
|
8827
8917
|
display: "flex",
|
|
@@ -8886,10 +8976,10 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
8886
8976
|
padding: "$4"
|
|
8887
8977
|
}
|
|
8888
8978
|
});
|
|
8889
|
-
var TextareaField =
|
|
8979
|
+
var TextareaField = React7.forwardRef((_a, fowardedRef) => {
|
|
8890
8980
|
var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
|
|
8891
|
-
const inputRef =
|
|
8892
|
-
const badgeRef =
|
|
8981
|
+
const inputRef = useRef4(null);
|
|
8982
|
+
const badgeRef = useRef4(null);
|
|
8893
8983
|
const updateCharCountBadge = () => {
|
|
8894
8984
|
var _a2, _b2;
|
|
8895
8985
|
if (!maxLength || !badgeRef.current) return;
|
|
@@ -9186,15 +9276,15 @@ function Tooltip({
|
|
|
9186
9276
|
}
|
|
9187
9277
|
|
|
9188
9278
|
// src/components/MultiSelect.tsx
|
|
9189
|
-
import { DropdownMenu as DropdownMenu3, Theme as
|
|
9279
|
+
import { DropdownMenu as DropdownMenu3, Theme as Theme3 } from "@radix-ui/themes";
|
|
9190
9280
|
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
9191
9281
|
import {
|
|
9192
9282
|
faChevronDown as faChevronDown2,
|
|
9193
9283
|
faChevronUp as faChevronUp2,
|
|
9194
9284
|
faX
|
|
9195
9285
|
} from "@fortawesome/free-solid-svg-icons";
|
|
9196
|
-
import { useCallback as useCallback2, useMemo, useRef as
|
|
9197
|
-
import
|
|
9286
|
+
import { useCallback as useCallback2, useMemo, useRef as useRef5, useState as useState7 } from "react";
|
|
9287
|
+
import React8 from "react";
|
|
9198
9288
|
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9199
9289
|
var StyledContent = styled(DropdownMenu3.Content, {
|
|
9200
9290
|
backgroundColor: "$dark50",
|
|
@@ -9258,7 +9348,7 @@ var BadgeCloseBtn = styled("div", {
|
|
|
9258
9348
|
backgroundColor: "$dark600"
|
|
9259
9349
|
}
|
|
9260
9350
|
});
|
|
9261
|
-
var MultiSelect =
|
|
9351
|
+
var MultiSelect = React8.forwardRef(
|
|
9262
9352
|
({
|
|
9263
9353
|
placeholder,
|
|
9264
9354
|
value: selectedValues = [],
|
|
@@ -9270,7 +9360,7 @@ var MultiSelect = React7.forwardRef(
|
|
|
9270
9360
|
}, fowardedRef) => {
|
|
9271
9361
|
var _a;
|
|
9272
9362
|
const [isOpen, setIsOpen] = useState7(false);
|
|
9273
|
-
const triggerRef =
|
|
9363
|
+
const triggerRef = useRef5(null);
|
|
9274
9364
|
const labelByValue = useMemo(() => {
|
|
9275
9365
|
return options.reduce((prev, curr) => {
|
|
9276
9366
|
return __spreadProps(__spreadValues({}, prev), {
|
|
@@ -9286,7 +9376,7 @@ var MultiSelect = React7.forwardRef(
|
|
|
9286
9376
|
[selectedValues, onValueChange]
|
|
9287
9377
|
);
|
|
9288
9378
|
const menuWidth = (_a = triggerRef.current) == null ? void 0 : _a.offsetWidth;
|
|
9289
|
-
return /* @__PURE__ */ jsx26(
|
|
9379
|
+
return /* @__PURE__ */ jsx26(Theme3, { children: /* @__PURE__ */ jsxs14(DropdownMenu3.Root, { open: isOpen, onOpenChange: () => setIsOpen(false), children: [
|
|
9290
9380
|
/* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { onClick: () => setIsOpen(true), children: /* @__PURE__ */ jsxs14(
|
|
9291
9381
|
StyledTrigger,
|
|
9292
9382
|
{
|
|
@@ -9546,7 +9636,7 @@ function Section(_a) {
|
|
|
9546
9636
|
return /* @__PURE__ */ jsx29(SectionStyled, __spreadProps(__spreadValues({}, props), { children }));
|
|
9547
9637
|
}
|
|
9548
9638
|
|
|
9549
|
-
// src/components/FormFields/ErrorFormMessage.tsx
|
|
9639
|
+
// src/components/FormFields/subComponents/ErrorFormMessage.tsx
|
|
9550
9640
|
import { faXmarkCircle } from "@fortawesome/free-solid-svg-icons";
|
|
9551
9641
|
import { FontAwesomeIcon as FontAwesomeIcon4 } from "@fortawesome/react-fontawesome";
|
|
9552
9642
|
import { jsx as jsx30, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
@@ -9561,7 +9651,7 @@ var ErrorFormMessage = ({ message: message2 }) => {
|
|
|
9561
9651
|
] });
|
|
9562
9652
|
};
|
|
9563
9653
|
|
|
9564
|
-
// src/components/FormFields/FormLabel.tsx
|
|
9654
|
+
// src/components/FormFields/subComponents/FormLabel.tsx
|
|
9565
9655
|
import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
9566
9656
|
var FormLabel = ({
|
|
9567
9657
|
name,
|
|
@@ -9630,38 +9720,65 @@ var TextAreaFormField = (_a) => {
|
|
|
9630
9720
|
};
|
|
9631
9721
|
|
|
9632
9722
|
// src/components/FormFields/TextFormField.tsx
|
|
9633
|
-
import {
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
}
|
|
9639
|
-
|
|
9640
|
-
// src/components/FormFields/TextFormField.tsx
|
|
9723
|
+
import {
|
|
9724
|
+
useController
|
|
9725
|
+
} from "react-hook-form";
|
|
9726
|
+
import { useCallback as useCallback3, useMemo as useMemo2 } from "react";
|
|
9727
|
+
import { format as format3, unformat as unformat2 } from "@react-input/mask";
|
|
9641
9728
|
import { jsx as jsx33, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
9642
|
-
var TextFormField = ({
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
const
|
|
9729
|
+
var TextFormField = (_a) => {
|
|
9730
|
+
var _b = _a, {
|
|
9731
|
+
name,
|
|
9732
|
+
label,
|
|
9733
|
+
required,
|
|
9734
|
+
mask,
|
|
9735
|
+
validate,
|
|
9736
|
+
validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
|
|
9737
|
+
onChange,
|
|
9738
|
+
valueFormatter
|
|
9739
|
+
} = _b, inputProps = __objRest(_b, [
|
|
9740
|
+
"name",
|
|
9741
|
+
"label",
|
|
9742
|
+
"required",
|
|
9743
|
+
"mask",
|
|
9744
|
+
"validate",
|
|
9745
|
+
"validationErrorMessage",
|
|
9746
|
+
"onChange",
|
|
9747
|
+
"valueFormatter"
|
|
9748
|
+
]);
|
|
9749
|
+
const handleValidate = useCallback3(
|
|
9750
|
+
(value) => {
|
|
9751
|
+
var _a2;
|
|
9752
|
+
if (!required && value.trim() === "") return true;
|
|
9753
|
+
return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
|
|
9754
|
+
},
|
|
9755
|
+
[validate, required]
|
|
9756
|
+
);
|
|
9757
|
+
const { field, fieldState } = useController({
|
|
9758
|
+
name,
|
|
9759
|
+
rules: {
|
|
9760
|
+
required: required ? validationErrorMessage : false,
|
|
9761
|
+
validate: handleValidate,
|
|
9762
|
+
onChange
|
|
9763
|
+
},
|
|
9764
|
+
defaultValue: ""
|
|
9765
|
+
});
|
|
9766
|
+
const fieldError = fieldState.error;
|
|
9663
9767
|
const haveError = !!fieldError;
|
|
9664
9768
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
9769
|
+
const { value: formValue, onChange: formChange } = field;
|
|
9770
|
+
const formattedValue = useMemo2(() => {
|
|
9771
|
+
let value = formValue;
|
|
9772
|
+
if (valueFormatter) value = valueFormatter.format(value);
|
|
9773
|
+
if (mask) value = format3(value != null ? value : "", mask);
|
|
9774
|
+
return value;
|
|
9775
|
+
}, [formValue, valueFormatter, mask]);
|
|
9776
|
+
const handleChange = (e) => {
|
|
9777
|
+
let value = e.target.value;
|
|
9778
|
+
if (mask) value = unformat2(value, mask);
|
|
9779
|
+
if (valueFormatter) value = valueFormatter.unformat(value);
|
|
9780
|
+
formChange(value);
|
|
9781
|
+
};
|
|
9665
9782
|
return /* @__PURE__ */ jsxs18(Flex2, { direction: "column", children: [
|
|
9666
9783
|
label && /* @__PURE__ */ jsx33(
|
|
9667
9784
|
FormLabel,
|
|
@@ -9674,16 +9791,13 @@ var TextFormField = ({
|
|
|
9674
9791
|
),
|
|
9675
9792
|
/* @__PURE__ */ jsx33(
|
|
9676
9793
|
TextField,
|
|
9677
|
-
__spreadProps(__spreadValues({
|
|
9794
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
9678
9795
|
mask,
|
|
9679
|
-
placeholder,
|
|
9680
|
-
disabled,
|
|
9681
9796
|
color: haveError ? "error" : "default",
|
|
9682
9797
|
"aria-labelledby": `${name}-label`
|
|
9683
|
-
},
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
value
|
|
9798
|
+
}, inputProps), field), {
|
|
9799
|
+
onChange: handleChange,
|
|
9800
|
+
value: formattedValue
|
|
9687
9801
|
})
|
|
9688
9802
|
),
|
|
9689
9803
|
/* @__PURE__ */ jsx33(ErrorFormMessage, { message: errorMsg })
|
|
@@ -9699,19 +9813,17 @@ import { jsx as jsx34 } from "react/jsx-runtime";
|
|
|
9699
9813
|
var Form = (_a) => {
|
|
9700
9814
|
var _b = _a, {
|
|
9701
9815
|
onSubmit,
|
|
9702
|
-
children
|
|
9703
|
-
methods
|
|
9816
|
+
children
|
|
9704
9817
|
} = _b, props = __objRest(_b, [
|
|
9705
9818
|
"onSubmit",
|
|
9706
|
-
"children"
|
|
9707
|
-
"methods"
|
|
9819
|
+
"children"
|
|
9708
9820
|
]);
|
|
9709
|
-
const formMethods =
|
|
9821
|
+
const formMethods = useForm(props);
|
|
9710
9822
|
return /* @__PURE__ */ jsx34(FormProvider, __spreadProps(__spreadValues({}, formMethods), { children: /* @__PURE__ */ jsx34("form", { onSubmit: formMethods.handleSubmit(onSubmit), children }) }));
|
|
9711
9823
|
};
|
|
9712
9824
|
|
|
9713
9825
|
// src/components/FormFields/MultiSelectFormField.tsx
|
|
9714
|
-
import { useController
|
|
9826
|
+
import { useController as useController2 } from "react-hook-form";
|
|
9715
9827
|
import { jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
9716
9828
|
var MultiSelectFormField = (_a) => {
|
|
9717
9829
|
var _b = _a, {
|
|
@@ -9724,10 +9836,7 @@ var MultiSelectFormField = (_a) => {
|
|
|
9724
9836
|
"required"
|
|
9725
9837
|
]);
|
|
9726
9838
|
var _a2;
|
|
9727
|
-
const {
|
|
9728
|
-
formState: { errors }
|
|
9729
|
-
} = useFormContext3();
|
|
9730
|
-
const { field } = useController({
|
|
9839
|
+
const { field, fieldState } = useController2({
|
|
9731
9840
|
name,
|
|
9732
9841
|
rules: {
|
|
9733
9842
|
required
|
|
@@ -9735,8 +9844,8 @@ var MultiSelectFormField = (_a) => {
|
|
|
9735
9844
|
defaultValue: []
|
|
9736
9845
|
});
|
|
9737
9846
|
const { value, onChange, ref, onBlur, disabled } = field;
|
|
9738
|
-
const haveError = !!
|
|
9739
|
-
const errorMsg = (_a2 =
|
|
9847
|
+
const haveError = !!fieldState.error;
|
|
9848
|
+
const errorMsg = (_a2 = fieldState.error) == null ? void 0 : _a2.message;
|
|
9740
9849
|
const handleChange = (v) => {
|
|
9741
9850
|
onChange(v);
|
|
9742
9851
|
};
|
|
@@ -9763,50 +9872,51 @@ var MultiSelectFormField = (_a) => {
|
|
|
9763
9872
|
] });
|
|
9764
9873
|
};
|
|
9765
9874
|
|
|
9875
|
+
// src/components/FormFields/utils/validation.ts
|
|
9876
|
+
var minMaxLength = (min, max, errorMsg) => (value) => {
|
|
9877
|
+
console.log(value);
|
|
9878
|
+
var length = value.length;
|
|
9879
|
+
return length > max || length < min ? errorMsg : true;
|
|
9880
|
+
};
|
|
9881
|
+
|
|
9766
9882
|
// src/components/FormFields/PhoneFormField.tsx
|
|
9767
|
-
import {
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
{
|
|
9797
|
-
name,
|
|
9798
|
-
label,
|
|
9799
|
-
required,
|
|
9800
|
-
haveError
|
|
9883
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
9884
|
+
var PhoneFormField = ({
|
|
9885
|
+
name,
|
|
9886
|
+
label,
|
|
9887
|
+
required
|
|
9888
|
+
}) => {
|
|
9889
|
+
return /* @__PURE__ */ jsx36(
|
|
9890
|
+
TextFormField,
|
|
9891
|
+
{
|
|
9892
|
+
name,
|
|
9893
|
+
label,
|
|
9894
|
+
required,
|
|
9895
|
+
addon: "+ 55",
|
|
9896
|
+
mask: {
|
|
9897
|
+
mask: "(__) _____-____}",
|
|
9898
|
+
replacement: { _: /\d/ }
|
|
9899
|
+
},
|
|
9900
|
+
placeholder: "(00) 00000-0000",
|
|
9901
|
+
type: "tel",
|
|
9902
|
+
validate: minMaxLength(12, 13, "Telefone inv\xE1lido"),
|
|
9903
|
+
valueFormatter: {
|
|
9904
|
+
format(v) {
|
|
9905
|
+
if (!v || v === "") return v;
|
|
9906
|
+
return v.replace(/\b55/, "");
|
|
9907
|
+
},
|
|
9908
|
+
unformat(v) {
|
|
9909
|
+
if (!v || v === "") return v;
|
|
9910
|
+
return "55" + v;
|
|
9911
|
+
}
|
|
9801
9912
|
}
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
] });
|
|
9913
|
+
}
|
|
9914
|
+
);
|
|
9805
9915
|
};
|
|
9806
9916
|
|
|
9807
9917
|
// src/components/FormFields/CPFFormField.tsx
|
|
9808
|
-
import { useFormContext as
|
|
9809
|
-
import { jsx as jsx37, jsxs as
|
|
9918
|
+
import { useFormContext as useFormContext4, useWatch } from "react-hook-form";
|
|
9919
|
+
import { jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
9810
9920
|
var isValidCPF = (cpf) => {
|
|
9811
9921
|
cpf = cpf.replace(/[^\d]+/g, "");
|
|
9812
9922
|
if (cpf.length !== 11 || /^(\d)\1{10}$/.test(cpf)) return false;
|
|
@@ -9830,9 +9940,9 @@ var CPFFormField = ({
|
|
|
9830
9940
|
validationErrorMessage,
|
|
9831
9941
|
foreignerLabel
|
|
9832
9942
|
}) => {
|
|
9833
|
-
const { control, setValue } =
|
|
9943
|
+
const { control, setValue } = useFormContext4();
|
|
9834
9944
|
const foreigner = useWatch({ name: "foreigner", control });
|
|
9835
|
-
return /* @__PURE__ */
|
|
9945
|
+
return /* @__PURE__ */ jsxs20(Flex2, { direction: "column", children: [
|
|
9836
9946
|
/* @__PURE__ */ jsx37(
|
|
9837
9947
|
TextFormField,
|
|
9838
9948
|
{
|
|
@@ -9844,11 +9954,9 @@ var CPFFormField = ({
|
|
|
9844
9954
|
mask: "___.___.___-__",
|
|
9845
9955
|
replacement: { _: /[0-9]/ }
|
|
9846
9956
|
},
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
return isValidCPF(value) || validationErrorMessage;
|
|
9851
|
-
}
|
|
9957
|
+
validate: (value) => {
|
|
9958
|
+
if (!required || foreigner) return true;
|
|
9959
|
+
return isValidCPF(value) || validationErrorMessage;
|
|
9852
9960
|
},
|
|
9853
9961
|
disabled: foreigner
|
|
9854
9962
|
}
|
|
@@ -9931,12 +10039,10 @@ var CNPJFormField = ({
|
|
|
9931
10039
|
mask: "__.___.___/____-__",
|
|
9932
10040
|
replacement: { _: /[0-9]/ }
|
|
9933
10041
|
},
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
return isValidCNPJ(value) || validationErrorMessage;
|
|
9939
|
-
}
|
|
10042
|
+
validate: (value) => {
|
|
10043
|
+
const isEmpty = value.replace(matchesNonDigit, "").length === 0;
|
|
10044
|
+
if (!required && isEmpty) return true;
|
|
10045
|
+
return isValidCNPJ(value) || validationErrorMessage;
|
|
9940
10046
|
}
|
|
9941
10047
|
}
|
|
9942
10048
|
);
|
|
@@ -9989,12 +10095,10 @@ var BirthDateFormField = ({
|
|
|
9989
10095
|
mask: "__/__/____",
|
|
9990
10096
|
replacement: { _: /[0-9]/ }
|
|
9991
10097
|
},
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
return isValidBirthDate(value, language) || validationErrorMessage;
|
|
9997
|
-
}
|
|
10098
|
+
validate: (value) => {
|
|
10099
|
+
const isEmpty = value.replace(/[^\d]+/g, "").length === 0;
|
|
10100
|
+
if (!required && isEmpty) return true;
|
|
10101
|
+
return isValidBirthDate(value, language) || validationErrorMessage;
|
|
9998
10102
|
}
|
|
9999
10103
|
}
|
|
10000
10104
|
);
|
|
@@ -10024,24 +10128,28 @@ var IdentityDocumentNumberFormField = ({
|
|
|
10024
10128
|
mask: "__.___.___-_",
|
|
10025
10129
|
replacement: { _: /[0-9]/ }
|
|
10026
10130
|
},
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
return isValidRG(value) || validationErrorMessage;
|
|
10032
|
-
}
|
|
10131
|
+
validate: (value) => {
|
|
10132
|
+
const isEmpty = value.replace(/[^\d]/g, "").length === 0;
|
|
10133
|
+
if (!required && isEmpty) return true;
|
|
10134
|
+
return isValidRG(value) || validationErrorMessage;
|
|
10033
10135
|
}
|
|
10034
10136
|
}
|
|
10035
10137
|
);
|
|
10036
10138
|
};
|
|
10037
10139
|
|
|
10038
10140
|
// src/components/FormFields/AddressFormFields/index.tsx
|
|
10039
|
-
import {
|
|
10040
|
-
import { useFormContext as useFormContext9, useWatch as useWatch2, useFormState } from "react-hook-form";
|
|
10141
|
+
import { useFormContext as useFormContext7, useWatch as useWatch2, useFormState } from "react-hook-form";
|
|
10041
10142
|
|
|
10042
10143
|
// src/components/FormFields/SelectFormField.tsx
|
|
10043
|
-
import { useFormContext as
|
|
10044
|
-
|
|
10144
|
+
import { useFormContext as useFormContext5, Controller } from "react-hook-form";
|
|
10145
|
+
|
|
10146
|
+
// src/utils/getNestedValue.ts
|
|
10147
|
+
function getNestedValue(obj, path) {
|
|
10148
|
+
return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
10149
|
+
}
|
|
10150
|
+
|
|
10151
|
+
// src/components/FormFields/SelectFormField.tsx
|
|
10152
|
+
import { jsx as jsx41, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10045
10153
|
var SelectFormField = ({
|
|
10046
10154
|
name,
|
|
10047
10155
|
label,
|
|
@@ -10055,14 +10163,14 @@ var SelectFormField = ({
|
|
|
10055
10163
|
const {
|
|
10056
10164
|
control,
|
|
10057
10165
|
formState: { errors }
|
|
10058
|
-
} =
|
|
10166
|
+
} = useFormContext5();
|
|
10059
10167
|
const fieldError = getNestedValue(errors, name);
|
|
10060
10168
|
const haveError = !!fieldError;
|
|
10061
10169
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10062
10170
|
const validationRules = __spreadValues({
|
|
10063
10171
|
required: required ? validationErrorMessage : false
|
|
10064
10172
|
}, validation);
|
|
10065
|
-
return /* @__PURE__ */
|
|
10173
|
+
return /* @__PURE__ */ jsxs21(Flex2, { direction: "column", children: [
|
|
10066
10174
|
/* @__PURE__ */ jsx41(
|
|
10067
10175
|
FormLabel,
|
|
10068
10176
|
{
|
|
@@ -10158,19 +10266,15 @@ function CountryFormField({
|
|
|
10158
10266
|
}
|
|
10159
10267
|
|
|
10160
10268
|
// src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx
|
|
10161
|
-
import { useController as useController3, useFormContext as useFormContext7 } from "react-hook-form";
|
|
10162
10269
|
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
10163
10270
|
var PostalCodeFormField = ({
|
|
10164
10271
|
name,
|
|
10165
10272
|
label,
|
|
10166
10273
|
required,
|
|
10167
10274
|
placeholder,
|
|
10168
|
-
validationErrorMessage
|
|
10275
|
+
validationErrorMessage,
|
|
10276
|
+
onChange
|
|
10169
10277
|
}) => {
|
|
10170
|
-
const { control } = useFormContext7();
|
|
10171
|
-
const {
|
|
10172
|
-
field: { onChange, value }
|
|
10173
|
-
} = useController3({ name, control });
|
|
10174
10278
|
return /* @__PURE__ */ jsx43(
|
|
10175
10279
|
TextFormField,
|
|
10176
10280
|
{
|
|
@@ -10182,14 +10286,11 @@ var PostalCodeFormField = ({
|
|
|
10182
10286
|
mask: "_____-___",
|
|
10183
10287
|
replacement: { _: /[0-9]/ }
|
|
10184
10288
|
},
|
|
10185
|
-
value,
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
if (!required && isEmpty) return true;
|
|
10191
|
-
return /^\d{8}$/.test(value2.replace(/\D/g, "")) || validationErrorMessage;
|
|
10192
|
-
}
|
|
10289
|
+
onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
|
|
10290
|
+
validate: (value) => {
|
|
10291
|
+
const isEmpty = value.replace(/[^\d]/g, "").length === 0;
|
|
10292
|
+
if (!required && isEmpty) return true;
|
|
10293
|
+
return /^\d{8}$/.test(value.replace(/\D/g, "")) || validationErrorMessage;
|
|
10193
10294
|
}
|
|
10194
10295
|
}
|
|
10195
10296
|
);
|
|
@@ -10246,8 +10347,8 @@ function StateFormField({
|
|
|
10246
10347
|
}
|
|
10247
10348
|
|
|
10248
10349
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
10249
|
-
import { useEffect as
|
|
10250
|
-
import { useFormContext as
|
|
10350
|
+
import { useEffect as useEffect4, useState as useState8 } from "react";
|
|
10351
|
+
import { useFormContext as useFormContext6, Controller as Controller2 } from "react-hook-form";
|
|
10251
10352
|
import { Fragment as Fragment3, jsx as jsx45 } from "react/jsx-runtime";
|
|
10252
10353
|
function CityFormField({
|
|
10253
10354
|
name,
|
|
@@ -10257,11 +10358,11 @@ function CityFormField({
|
|
|
10257
10358
|
isBrazil,
|
|
10258
10359
|
placeholder
|
|
10259
10360
|
}) {
|
|
10260
|
-
const { control, watch } =
|
|
10361
|
+
const { control, watch } = useFormContext6();
|
|
10261
10362
|
const selectedState = watch(stateName);
|
|
10262
10363
|
const [cities, setCities] = useState8([]);
|
|
10263
10364
|
const [loading, setLoading] = useState8(false);
|
|
10264
|
-
|
|
10365
|
+
useEffect4(() => {
|
|
10265
10366
|
if (!isBrazil) {
|
|
10266
10367
|
setCities([]);
|
|
10267
10368
|
return;
|
|
@@ -10332,7 +10433,7 @@ function CityFormField({
|
|
|
10332
10433
|
}
|
|
10333
10434
|
|
|
10334
10435
|
// src/components/FormFields/AddressFormFields/index.tsx
|
|
10335
|
-
import { jsx as jsx46, jsxs as
|
|
10436
|
+
import { jsx as jsx46, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
10336
10437
|
function getNestedValue2(obj, path) {
|
|
10337
10438
|
return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
10338
10439
|
}
|
|
@@ -10361,29 +10462,28 @@ function AddressFormFields({
|
|
|
10361
10462
|
required,
|
|
10362
10463
|
layout = "column"
|
|
10363
10464
|
}) {
|
|
10364
|
-
const { control, setValue } =
|
|
10465
|
+
const { control, setValue } = useFormContext7();
|
|
10365
10466
|
const { errors } = useFormState({ control });
|
|
10366
10467
|
const selectedCountry = useWatch2({ control, name: `${name}.country` });
|
|
10367
|
-
const cep = useWatch2({ control, name: `${name}.zip_code` });
|
|
10368
10468
|
const isBrazil = selectedCountry === "Brasil";
|
|
10369
10469
|
const addressErrors = getNestedValue2(errors, name);
|
|
10370
10470
|
const haveError = !!addressErrors;
|
|
10371
|
-
|
|
10471
|
+
const handleCEPChange = (cep) => {
|
|
10472
|
+
if (!isBrazil) return;
|
|
10372
10473
|
const cleanedCep = cep == null ? void 0 : cep.replace(/\D/g, "");
|
|
10373
|
-
if (
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
return /* @__PURE__ */ jsxs23(AddressContainerStyled, { layout, children: [
|
|
10474
|
+
if ((cleanedCep == null ? void 0 : cleanedCep.length) !== 8) return;
|
|
10475
|
+
fetch(`https://viacep.com.br/ws/${cleanedCep}/json`).then((res) => res.json()).then((data) => {
|
|
10476
|
+
if (!data.erro) {
|
|
10477
|
+
setValue(`${name}.street`, data.logradouro || "");
|
|
10478
|
+
setValue(`${name}.neighborhood`, data.bairro || "");
|
|
10479
|
+
setValue(`${name}.city`, data.localidade || "");
|
|
10480
|
+
setValue(`${name}.state`, data.uf || "");
|
|
10481
|
+
}
|
|
10482
|
+
}).catch(() => {
|
|
10483
|
+
console.error("Erro ao buscar CEP");
|
|
10484
|
+
});
|
|
10485
|
+
};
|
|
10486
|
+
return /* @__PURE__ */ jsxs22(AddressContainerStyled, { layout, children: [
|
|
10387
10487
|
/* @__PURE__ */ jsx46(
|
|
10388
10488
|
FormLabel,
|
|
10389
10489
|
{
|
|
@@ -10409,7 +10509,8 @@ function AddressFormFields({
|
|
|
10409
10509
|
label: "CEP",
|
|
10410
10510
|
required,
|
|
10411
10511
|
placeholder: "00000-000",
|
|
10412
|
-
validationErrorMessage: "CEP inv\xE1lido"
|
|
10512
|
+
validationErrorMessage: "CEP inv\xE1lido",
|
|
10513
|
+
onChange: handleCEPChange
|
|
10413
10514
|
}
|
|
10414
10515
|
) : /* @__PURE__ */ jsx46(
|
|
10415
10516
|
TextFormField,
|
|
@@ -10460,8 +10561,8 @@ function AddressFormFields({
|
|
|
10460
10561
|
}
|
|
10461
10562
|
|
|
10462
10563
|
// src/components/FormFields/RadioGroupFormField.tsx
|
|
10463
|
-
import { Controller as Controller3, useFormContext as
|
|
10464
|
-
import { jsx as jsx47, jsxs as
|
|
10564
|
+
import { Controller as Controller3, useFormContext as useFormContext8 } from "react-hook-form";
|
|
10565
|
+
import { jsx as jsx47, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
10465
10566
|
var RadioGroupFormField = ({
|
|
10466
10567
|
name,
|
|
10467
10568
|
label,
|
|
@@ -10476,14 +10577,14 @@ var RadioGroupFormField = ({
|
|
|
10476
10577
|
const {
|
|
10477
10578
|
control,
|
|
10478
10579
|
formState: { errors }
|
|
10479
|
-
} =
|
|
10580
|
+
} = useFormContext8();
|
|
10480
10581
|
const fieldError = getNestedValue(errors, name);
|
|
10481
10582
|
const haveError = !!fieldError;
|
|
10482
10583
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10483
10584
|
const validationRules = {
|
|
10484
10585
|
required: required ? validationErrorMessage : false
|
|
10485
10586
|
};
|
|
10486
|
-
return /* @__PURE__ */
|
|
10587
|
+
return /* @__PURE__ */ jsxs23(Flex2, { direction: "column", children: [
|
|
10487
10588
|
/* @__PURE__ */ jsx47(
|
|
10488
10589
|
FormLabel,
|
|
10489
10590
|
{
|
|
@@ -10508,7 +10609,7 @@ var RadioGroupFormField = ({
|
|
|
10508
10609
|
color: haveError ? "error" : color,
|
|
10509
10610
|
fontWeight,
|
|
10510
10611
|
disabled,
|
|
10511
|
-
children: options.map((option) => /* @__PURE__ */
|
|
10612
|
+
children: options.map((option) => /* @__PURE__ */ jsxs23("label", { children: [
|
|
10512
10613
|
/* @__PURE__ */ jsx47(RadioItem, { value: option.value }),
|
|
10513
10614
|
option.label
|
|
10514
10615
|
] }, option.value))
|
|
@@ -10521,8 +10622,8 @@ var RadioGroupFormField = ({
|
|
|
10521
10622
|
};
|
|
10522
10623
|
|
|
10523
10624
|
// src/components/FormFields/CheckboxGroupFormField.tsx
|
|
10524
|
-
import { Controller as Controller4, useFormContext as
|
|
10525
|
-
import { jsx as jsx48, jsxs as
|
|
10625
|
+
import { Controller as Controller4, useFormContext as useFormContext9 } from "react-hook-form";
|
|
10626
|
+
import { jsx as jsx48, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
10526
10627
|
var CheckboxGroupFormField = ({
|
|
10527
10628
|
name,
|
|
10528
10629
|
label,
|
|
@@ -10537,7 +10638,7 @@ var CheckboxGroupFormField = ({
|
|
|
10537
10638
|
const {
|
|
10538
10639
|
control,
|
|
10539
10640
|
formState: { errors }
|
|
10540
|
-
} =
|
|
10641
|
+
} = useFormContext9();
|
|
10541
10642
|
const fieldError = getNestedValue(errors, name);
|
|
10542
10643
|
const haveError = !!fieldError;
|
|
10543
10644
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
@@ -10545,7 +10646,7 @@ var CheckboxGroupFormField = ({
|
|
|
10545
10646
|
required: required ? validationErrorMessage : false,
|
|
10546
10647
|
validate: required ? (value) => (value == null ? void 0 : value.length) > 0 || validationErrorMessage : void 0
|
|
10547
10648
|
};
|
|
10548
|
-
return /* @__PURE__ */
|
|
10649
|
+
return /* @__PURE__ */ jsxs24(Flex2, { direction: "column", children: [
|
|
10549
10650
|
/* @__PURE__ */ jsx48(
|
|
10550
10651
|
FormLabel,
|
|
10551
10652
|
{
|