@lets-events/react 11.7.8 → 11.7.10
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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +12 -0
- package/dist/index.js +77 -62
- package/dist/index.mjs +46 -31
- package/package.json +1 -1
- package/src/components/Drawer/index.tsx +8 -1
- package/src/components/FormFields/CPFFormField.tsx +1 -0
- package/src/components/FormFields/CheckboxGroupFormField.tsx +1 -0
- package/src/components/MenuDropdown/index.tsx +10 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @lets-events/react@11.7.
|
|
3
|
+
> @lets-events/react@11.7.10 build
|
|
4
4
|
> tsup src/index.tsx --format esm,cjs --dts --external react
|
|
5
5
|
|
|
6
6
|
[1G[0K[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
[34mCLI[39m Target: es6
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m321.
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
14
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m321.88 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 556ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.js [22m[32m334.13 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 557ms
|
|
16
16
|
DTS Build start
|
|
17
|
-
DTS ⚡️ Build success in
|
|
17
|
+
DTS ⚡️ Build success in 5866ms
|
|
18
18
|
DTS dist/index.d.mts 374.51 KB
|
|
19
19
|
DTS dist/index.d.ts 374.51 KB
|
|
20
20
|
[1G[0K⠙[1G[0K
|
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -3884,6 +3884,9 @@ function Modal(_a) {
|
|
|
3884
3884
|
] }));
|
|
3885
3885
|
}
|
|
3886
3886
|
|
|
3887
|
+
// src/components/MenuDropdown/index.tsx
|
|
3888
|
+
var import_react6 = require("react");
|
|
3889
|
+
|
|
3887
3890
|
// src/components/MenuDropdown/styledComponents.ts
|
|
3888
3891
|
var MenuDropdownContainerStyled = styled("div", {
|
|
3889
3892
|
position: "relative",
|
|
@@ -3915,22 +3918,6 @@ var MenuItemsContainerStyled = styled("div", {
|
|
|
3915
3918
|
height: "fit-content"
|
|
3916
3919
|
});
|
|
3917
3920
|
|
|
3918
|
-
// src/components/MenuDropdown/index.tsx
|
|
3919
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3920
|
-
function MenuDropdown({
|
|
3921
|
-
children,
|
|
3922
|
-
isOpen,
|
|
3923
|
-
setIsOpen
|
|
3924
|
-
}) {
|
|
3925
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MenuDropdownContainerStyled, { children: [
|
|
3926
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TriggerButtonStyled, { onClick: () => setIsOpen(!isOpen), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon_default, { name: "ellipsis", size: "xl", color: "#FFFFFF" }) }),
|
|
3927
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuItemsContainerStyled, { children })
|
|
3928
|
-
] });
|
|
3929
|
-
}
|
|
3930
|
-
|
|
3931
|
-
// src/components/Calendar/index.tsx
|
|
3932
|
-
var import_react6 = require("react");
|
|
3933
|
-
|
|
3934
3921
|
// src/hooks/useOnClickOutside.tsx
|
|
3935
3922
|
var import_react5 = require("react");
|
|
3936
3923
|
function useOnClickOutside(ref, handler) {
|
|
@@ -3950,7 +3937,25 @@ function useOnClickOutside(ref, handler) {
|
|
|
3950
3937
|
}, [ref, handler]);
|
|
3951
3938
|
}
|
|
3952
3939
|
|
|
3940
|
+
// src/components/MenuDropdown/index.tsx
|
|
3941
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3942
|
+
function MenuDropdown({
|
|
3943
|
+
children,
|
|
3944
|
+
isOpen,
|
|
3945
|
+
setIsOpen
|
|
3946
|
+
}) {
|
|
3947
|
+
const dropdownItemsContainerRef = (0, import_react6.useRef)(null);
|
|
3948
|
+
useOnClickOutside(dropdownItemsContainerRef, () => {
|
|
3949
|
+
setIsOpen(false);
|
|
3950
|
+
});
|
|
3951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MenuDropdownContainerStyled, { children: [
|
|
3952
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TriggerButtonStyled, { onClick: () => setIsOpen(!isOpen), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon_default, { name: "ellipsis", size: "xl", color: "#FFFFFF" }) }),
|
|
3953
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuItemsContainerStyled, { ref: dropdownItemsContainerRef, children })
|
|
3954
|
+
] });
|
|
3955
|
+
}
|
|
3956
|
+
|
|
3953
3957
|
// src/components/Calendar/index.tsx
|
|
3958
|
+
var import_react7 = require("react");
|
|
3954
3959
|
var import_react_day_picker = require("react-day-picker");
|
|
3955
3960
|
|
|
3956
3961
|
// ../../node_modules/date-fns/locale/_lib/buildFormatLongFn.js
|
|
@@ -8071,15 +8076,15 @@ function Calendar(_a) {
|
|
|
8071
8076
|
"setSelected",
|
|
8072
8077
|
"position"
|
|
8073
8078
|
]);
|
|
8074
|
-
const [inputValue, setInputValue] = (0,
|
|
8075
|
-
const [showContainer, setShowCalendar] = (0,
|
|
8076
|
-
const dropdownRef = (0,
|
|
8079
|
+
const [inputValue, setInputValue] = (0, import_react7.useState)("");
|
|
8080
|
+
const [showContainer, setShowCalendar] = (0, import_react7.useState)(false);
|
|
8081
|
+
const dropdownRef = (0, import_react7.useRef)(null);
|
|
8077
8082
|
useOnClickOutside(dropdownRef, () => {
|
|
8078
8083
|
setShowCalendar(false);
|
|
8079
8084
|
});
|
|
8080
8085
|
const today = /* @__PURE__ */ new Date();
|
|
8081
8086
|
const maxDate = addYears(today, 20);
|
|
8082
|
-
(0,
|
|
8087
|
+
(0, import_react7.useEffect)(() => {
|
|
8083
8088
|
if (selected) {
|
|
8084
8089
|
setInputValue(format2(selected, "dd/MM/yyyy"));
|
|
8085
8090
|
} else {
|
|
@@ -8155,6 +8160,9 @@ function Calendar(_a) {
|
|
|
8155
8160
|
] })) });
|
|
8156
8161
|
}
|
|
8157
8162
|
|
|
8163
|
+
// src/components/Drawer/index.tsx
|
|
8164
|
+
var import_react8 = require("react");
|
|
8165
|
+
|
|
8158
8166
|
// src/components/Drawer/styledComponents.ts
|
|
8159
8167
|
var DrawerOverlayStyled = styled("div", {
|
|
8160
8168
|
position: "fixed",
|
|
@@ -8210,9 +8218,14 @@ function Drawer({
|
|
|
8210
8218
|
children
|
|
8211
8219
|
}) {
|
|
8212
8220
|
if (!isOpen) return null;
|
|
8221
|
+
const drawerContainerRef = (0, import_react8.useRef)(null);
|
|
8222
|
+
useOnClickOutside(drawerContainerRef, () => {
|
|
8223
|
+
onClose();
|
|
8224
|
+
});
|
|
8213
8225
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DrawerOverlayStyled, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8214
8226
|
DrawerContainerStyled,
|
|
8215
8227
|
{
|
|
8228
|
+
ref: drawerContainerRef,
|
|
8216
8229
|
style: {
|
|
8217
8230
|
width: width != null ? width : "34.25rem",
|
|
8218
8231
|
backgroundColor: colors[backgroundColor != null ? backgroundColor : "neutral50"]
|
|
@@ -8229,7 +8242,7 @@ function Drawer({
|
|
|
8229
8242
|
}
|
|
8230
8243
|
|
|
8231
8244
|
// src/components/TimePicker.tsx
|
|
8232
|
-
var
|
|
8245
|
+
var import_react9 = require("react");
|
|
8233
8246
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
8234
8247
|
var TimePickerStyled = styled("div", {
|
|
8235
8248
|
position: "relative",
|
|
@@ -8333,14 +8346,14 @@ function TimePicker({
|
|
|
8333
8346
|
setSelected,
|
|
8334
8347
|
position = "bottom"
|
|
8335
8348
|
}) {
|
|
8336
|
-
const [hours, setHours] = (0,
|
|
8337
|
-
const [minutes, setMinutes] = (0,
|
|
8338
|
-
const [rawHours, setRawHours] = (0,
|
|
8339
|
-
const [rawMinutes, setRawMinutes] = (0,
|
|
8340
|
-
const [isOpen, setIsOpen] = (0,
|
|
8341
|
-
const dropdownRef = (0,
|
|
8349
|
+
const [hours, setHours] = (0, import_react9.useState)("00");
|
|
8350
|
+
const [minutes, setMinutes] = (0, import_react9.useState)("00");
|
|
8351
|
+
const [rawHours, setRawHours] = (0, import_react9.useState)("00");
|
|
8352
|
+
const [rawMinutes, setRawMinutes] = (0, import_react9.useState)("00");
|
|
8353
|
+
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
8354
|
+
const dropdownRef = (0, import_react9.useRef)(null);
|
|
8342
8355
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8343
|
-
const handleIncrement = (0,
|
|
8356
|
+
const handleIncrement = (0, import_react9.useCallback)(
|
|
8344
8357
|
(type) => {
|
|
8345
8358
|
if (type === "hours") {
|
|
8346
8359
|
const next = (parseInt(hours) + 1) % 24;
|
|
@@ -8354,7 +8367,7 @@ function TimePicker({
|
|
|
8354
8367
|
},
|
|
8355
8368
|
[hours, minutes]
|
|
8356
8369
|
);
|
|
8357
|
-
const handleDecrement = (0,
|
|
8370
|
+
const handleDecrement = (0, import_react9.useCallback)(
|
|
8358
8371
|
(type) => {
|
|
8359
8372
|
if (type === "hours") {
|
|
8360
8373
|
const prev = (parseInt(hours) - 1 + 24) % 24;
|
|
@@ -8876,7 +8889,7 @@ function Switch(props) {
|
|
|
8876
8889
|
}
|
|
8877
8890
|
|
|
8878
8891
|
// src/components/Step.tsx
|
|
8879
|
-
var
|
|
8892
|
+
var import_react10 = __toESM(require("react"));
|
|
8880
8893
|
var import_themes15 = require("@radix-ui/themes");
|
|
8881
8894
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
8882
8895
|
var StepStyled = styled("div", {
|
|
@@ -8992,9 +9005,9 @@ function StepList(_a) {
|
|
|
8992
9005
|
"children",
|
|
8993
9006
|
"currentStep"
|
|
8994
9007
|
]);
|
|
8995
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StepListStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
8996
|
-
if (
|
|
8997
|
-
return
|
|
9008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StepListStyled, __spreadProps(__spreadValues({}, props), { children: import_react10.default.Children.map(children, (child) => {
|
|
9009
|
+
if (import_react10.default.isValidElement(child) && child.type === StepTrigger) {
|
|
9010
|
+
return import_react10.default.cloneElement(child, { currentStep });
|
|
8998
9011
|
}
|
|
8999
9012
|
return child;
|
|
9000
9013
|
}) }));
|
|
@@ -9051,7 +9064,7 @@ function Card(_a) {
|
|
|
9051
9064
|
|
|
9052
9065
|
// src/components/TextareaField.tsx
|
|
9053
9066
|
var import_themes17 = require("@radix-ui/themes");
|
|
9054
|
-
var
|
|
9067
|
+
var import_react11 = __toESM(require("react"));
|
|
9055
9068
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
9056
9069
|
var TextareaFieldStyle = styled(import_themes17.TextArea, {
|
|
9057
9070
|
display: "flex",
|
|
@@ -9116,10 +9129,10 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
9116
9129
|
padding: "$4"
|
|
9117
9130
|
}
|
|
9118
9131
|
});
|
|
9119
|
-
var TextareaField =
|
|
9132
|
+
var TextareaField = import_react11.default.forwardRef((_a, fowardedRef) => {
|
|
9120
9133
|
var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
|
|
9121
|
-
const inputRef = (0,
|
|
9122
|
-
const badgeRef = (0,
|
|
9134
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
9135
|
+
const badgeRef = (0, import_react11.useRef)(null);
|
|
9123
9136
|
const updateCharCountBadge = () => {
|
|
9124
9137
|
var _a2, _b2;
|
|
9125
9138
|
if (!maxLength || !badgeRef.current) return;
|
|
@@ -9155,12 +9168,12 @@ var TextareaField = import_react9.default.forwardRef((_a, fowardedRef) => {
|
|
|
9155
9168
|
});
|
|
9156
9169
|
|
|
9157
9170
|
// src/components/Toast/components/ToastItem.tsx
|
|
9158
|
-
var
|
|
9171
|
+
var import_react13 = require("react");
|
|
9159
9172
|
|
|
9160
9173
|
// src/components/Toast/styles/index.ts
|
|
9161
|
-
var
|
|
9174
|
+
var import_react12 = require("@stitches/react");
|
|
9162
9175
|
var ToastPrimitive = __toESM(require("@radix-ui/react-toast"));
|
|
9163
|
-
var slideIn = (0,
|
|
9176
|
+
var slideIn = (0, import_react12.keyframes)({
|
|
9164
9177
|
from: {
|
|
9165
9178
|
transform: "translateX(calc(100% + 25px))",
|
|
9166
9179
|
opacity: 0
|
|
@@ -9170,7 +9183,7 @@ var slideIn = (0, import_react10.keyframes)({
|
|
|
9170
9183
|
opacity: 1
|
|
9171
9184
|
}
|
|
9172
9185
|
});
|
|
9173
|
-
var slideOut = (0,
|
|
9186
|
+
var slideOut = (0, import_react12.keyframes)({
|
|
9174
9187
|
from: {
|
|
9175
9188
|
transform: "translateX(0)",
|
|
9176
9189
|
opacity: 1
|
|
@@ -9180,7 +9193,7 @@ var slideOut = (0, import_react10.keyframes)({
|
|
|
9180
9193
|
opacity: 0
|
|
9181
9194
|
}
|
|
9182
9195
|
});
|
|
9183
|
-
var swipeOut = (0,
|
|
9196
|
+
var swipeOut = (0, import_react12.keyframes)({
|
|
9184
9197
|
from: {
|
|
9185
9198
|
transform: "translateX(var(--radix-toast-swipe-end-x))",
|
|
9186
9199
|
opacity: 1
|
|
@@ -9286,7 +9299,7 @@ function ToastItem({
|
|
|
9286
9299
|
toast,
|
|
9287
9300
|
onRemove
|
|
9288
9301
|
}) {
|
|
9289
|
-
const [open, setOpen] = (0,
|
|
9302
|
+
const [open, setOpen] = (0, import_react13.useState)(true);
|
|
9290
9303
|
const handleOpenChange = (open2) => {
|
|
9291
9304
|
setOpen(open2);
|
|
9292
9305
|
if (!open2) {
|
|
@@ -9310,17 +9323,17 @@ function ToastItem({
|
|
|
9310
9323
|
}
|
|
9311
9324
|
|
|
9312
9325
|
// src/components/Toast/components/ToastProvider.tsx
|
|
9313
|
-
var
|
|
9326
|
+
var import_react14 = require("react");
|
|
9314
9327
|
var ToastPrimitive2 = __toESM(require("@radix-ui/react-toast"));
|
|
9315
9328
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
9316
|
-
var ToastContext = (0,
|
|
9329
|
+
var ToastContext = (0, import_react14.createContext)(null);
|
|
9317
9330
|
function ToastProvider({
|
|
9318
9331
|
children,
|
|
9319
9332
|
defaultDuration = 5e3,
|
|
9320
9333
|
maxToasts = 5,
|
|
9321
9334
|
swipeDirection = "right"
|
|
9322
9335
|
}) {
|
|
9323
|
-
const [toasts, setToasts] = (0,
|
|
9336
|
+
const [toasts, setToasts] = (0, import_react14.useState)([]);
|
|
9324
9337
|
const addToast = (toastData) => {
|
|
9325
9338
|
const id = Math.random().toString(36).substr(2, 9);
|
|
9326
9339
|
const newToast = __spreadProps(__spreadValues({
|
|
@@ -9356,9 +9369,9 @@ function ToastProvider({
|
|
|
9356
9369
|
}
|
|
9357
9370
|
|
|
9358
9371
|
// src/components/Toast/hooks/useToast.ts
|
|
9359
|
-
var
|
|
9372
|
+
var import_react15 = require("react");
|
|
9360
9373
|
var useToast = () => {
|
|
9361
|
-
const context = (0,
|
|
9374
|
+
const context = (0, import_react15.useContext)(ToastContext);
|
|
9362
9375
|
if (!context) {
|
|
9363
9376
|
throw new Error("useToast deve ser usado dentro de um ToastProvider");
|
|
9364
9377
|
}
|
|
@@ -9419,8 +9432,8 @@ function Tooltip({
|
|
|
9419
9432
|
var import_themes18 = require("@radix-ui/themes");
|
|
9420
9433
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
9421
9434
|
var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
|
|
9422
|
-
var
|
|
9423
|
-
var
|
|
9435
|
+
var import_react16 = require("react");
|
|
9436
|
+
var import_react17 = __toESM(require("react"));
|
|
9424
9437
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
9425
9438
|
var StyledContent = styled(import_themes18.DropdownMenu.Content, {
|
|
9426
9439
|
backgroundColor: "$dark50",
|
|
@@ -9484,7 +9497,7 @@ var BadgeCloseBtn = styled("div", {
|
|
|
9484
9497
|
backgroundColor: "$dark600"
|
|
9485
9498
|
}
|
|
9486
9499
|
});
|
|
9487
|
-
var MultiSelect =
|
|
9500
|
+
var MultiSelect = import_react17.default.forwardRef(
|
|
9488
9501
|
({
|
|
9489
9502
|
placeholder,
|
|
9490
9503
|
value: selectedValues = [],
|
|
@@ -9495,16 +9508,16 @@ var MultiSelect = import_react15.default.forwardRef(
|
|
|
9495
9508
|
zIndex = "auto"
|
|
9496
9509
|
}, fowardedRef) => {
|
|
9497
9510
|
var _a;
|
|
9498
|
-
const [isOpen, setIsOpen] = (0,
|
|
9499
|
-
const triggerRef = (0,
|
|
9500
|
-
const labelByValue = (0,
|
|
9511
|
+
const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
|
|
9512
|
+
const triggerRef = (0, import_react16.useRef)(null);
|
|
9513
|
+
const labelByValue = (0, import_react16.useMemo)(() => {
|
|
9501
9514
|
return options.reduce((prev, curr) => {
|
|
9502
9515
|
return __spreadProps(__spreadValues({}, prev), {
|
|
9503
9516
|
[curr.value]: curr.label
|
|
9504
9517
|
});
|
|
9505
9518
|
}, {});
|
|
9506
9519
|
}, [options]);
|
|
9507
|
-
const handleRemove = (0,
|
|
9520
|
+
const handleRemove = (0, import_react16.useCallback)(
|
|
9508
9521
|
(value) => {
|
|
9509
9522
|
const newValue = selectedValues.filter((v) => v !== value);
|
|
9510
9523
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
@@ -9857,7 +9870,7 @@ var TextAreaFormField = (_a) => {
|
|
|
9857
9870
|
|
|
9858
9871
|
// src/components/FormFields/TextFormField.tsx
|
|
9859
9872
|
var import_react_hook_form2 = require("react-hook-form");
|
|
9860
|
-
var
|
|
9873
|
+
var import_react18 = require("react");
|
|
9861
9874
|
var import_mask2 = require("@react-input/mask");
|
|
9862
9875
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
9863
9876
|
var TextFormField = (_a) => {
|
|
@@ -9880,7 +9893,7 @@ var TextFormField = (_a) => {
|
|
|
9880
9893
|
"onChange",
|
|
9881
9894
|
"valueFormatter"
|
|
9882
9895
|
]);
|
|
9883
|
-
const handleValidate = (0,
|
|
9896
|
+
const handleValidate = (0, import_react18.useCallback)(
|
|
9884
9897
|
(value) => {
|
|
9885
9898
|
var _a2;
|
|
9886
9899
|
if (value === void 0 || value === null || !required && value.trim() === "")
|
|
@@ -9902,7 +9915,7 @@ var TextFormField = (_a) => {
|
|
|
9902
9915
|
const haveError = !!fieldError;
|
|
9903
9916
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
9904
9917
|
const { value: formValue, onChange: formChange } = field;
|
|
9905
|
-
const formattedValue = (0,
|
|
9918
|
+
const formattedValue = (0, import_react18.useMemo)(() => {
|
|
9906
9919
|
let value = formValue;
|
|
9907
9920
|
if (valueFormatter) value = valueFormatter.format(value);
|
|
9908
9921
|
if (mask) value = (0, import_mask2.format)(value != null ? value : "", mask);
|
|
@@ -10109,6 +10122,7 @@ var CPFFormField = ({
|
|
|
10109
10122
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10110
10123
|
CheckboxGroup,
|
|
10111
10124
|
{
|
|
10125
|
+
value: foreigner ? ["true"] : [],
|
|
10112
10126
|
name: "foreigner",
|
|
10113
10127
|
onValueChange: (value) => {
|
|
10114
10128
|
const isForeigner = value.includes("true");
|
|
@@ -10494,7 +10508,7 @@ function StateFormField({
|
|
|
10494
10508
|
}
|
|
10495
10509
|
|
|
10496
10510
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
10497
|
-
var
|
|
10511
|
+
var import_react19 = require("react");
|
|
10498
10512
|
var import_react_hook_form7 = require("react-hook-form");
|
|
10499
10513
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
10500
10514
|
function CityFormField({
|
|
@@ -10507,9 +10521,9 @@ function CityFormField({
|
|
|
10507
10521
|
}) {
|
|
10508
10522
|
const { control, watch } = (0, import_react_hook_form7.useFormContext)();
|
|
10509
10523
|
const selectedState = watch(stateName);
|
|
10510
|
-
const [cities, setCities] = (0,
|
|
10511
|
-
const [loading, setLoading] = (0,
|
|
10512
|
-
(0,
|
|
10524
|
+
const [cities, setCities] = (0, import_react19.useState)([]);
|
|
10525
|
+
const [loading, setLoading] = (0, import_react19.useState)(false);
|
|
10526
|
+
(0, import_react19.useEffect)(() => {
|
|
10513
10527
|
if (!isBrazil) {
|
|
10514
10528
|
setCities([]);
|
|
10515
10529
|
return;
|
|
@@ -10814,6 +10828,7 @@ var CheckboxGroupFormField = ({
|
|
|
10814
10828
|
CheckboxGroup,
|
|
10815
10829
|
{
|
|
10816
10830
|
name,
|
|
10831
|
+
value: field.value,
|
|
10817
10832
|
onValueChange: field.onChange,
|
|
10818
10833
|
color: haveError ? "error" : color,
|
|
10819
10834
|
fontWeight,
|
package/dist/index.mjs
CHANGED
|
@@ -3781,6 +3781,9 @@ function Modal(_a) {
|
|
|
3781
3781
|
] }));
|
|
3782
3782
|
}
|
|
3783
3783
|
|
|
3784
|
+
// src/components/MenuDropdown/index.tsx
|
|
3785
|
+
import { useRef as useRef2 } from "react";
|
|
3786
|
+
|
|
3784
3787
|
// src/components/MenuDropdown/styledComponents.ts
|
|
3785
3788
|
var MenuDropdownContainerStyled = styled("div", {
|
|
3786
3789
|
position: "relative",
|
|
@@ -3812,22 +3815,6 @@ var MenuItemsContainerStyled = styled("div", {
|
|
|
3812
3815
|
height: "fit-content"
|
|
3813
3816
|
});
|
|
3814
3817
|
|
|
3815
|
-
// src/components/MenuDropdown/index.tsx
|
|
3816
|
-
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3817
|
-
function MenuDropdown({
|
|
3818
|
-
children,
|
|
3819
|
-
isOpen,
|
|
3820
|
-
setIsOpen
|
|
3821
|
-
}) {
|
|
3822
|
-
return /* @__PURE__ */ jsxs5(MenuDropdownContainerStyled, { children: [
|
|
3823
|
-
/* @__PURE__ */ jsx14(TriggerButtonStyled, { onClick: () => setIsOpen(!isOpen), children: /* @__PURE__ */ jsx14(Icon_default, { name: "ellipsis", size: "xl", color: "#FFFFFF" }) }),
|
|
3824
|
-
isOpen && /* @__PURE__ */ jsx14(MenuItemsContainerStyled, { children })
|
|
3825
|
-
] });
|
|
3826
|
-
}
|
|
3827
|
-
|
|
3828
|
-
// src/components/Calendar/index.tsx
|
|
3829
|
-
import { useRef as useRef2, useEffect as useEffect3, useState as useState2 } from "react";
|
|
3830
|
-
|
|
3831
3818
|
// src/hooks/useOnClickOutside.tsx
|
|
3832
3819
|
import { useEffect as useEffect2 } from "react";
|
|
3833
3820
|
function useOnClickOutside(ref, handler) {
|
|
@@ -3847,7 +3834,25 @@ function useOnClickOutside(ref, handler) {
|
|
|
3847
3834
|
}, [ref, handler]);
|
|
3848
3835
|
}
|
|
3849
3836
|
|
|
3837
|
+
// src/components/MenuDropdown/index.tsx
|
|
3838
|
+
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3839
|
+
function MenuDropdown({
|
|
3840
|
+
children,
|
|
3841
|
+
isOpen,
|
|
3842
|
+
setIsOpen
|
|
3843
|
+
}) {
|
|
3844
|
+
const dropdownItemsContainerRef = useRef2(null);
|
|
3845
|
+
useOnClickOutside(dropdownItemsContainerRef, () => {
|
|
3846
|
+
setIsOpen(false);
|
|
3847
|
+
});
|
|
3848
|
+
return /* @__PURE__ */ jsxs5(MenuDropdownContainerStyled, { children: [
|
|
3849
|
+
/* @__PURE__ */ jsx14(TriggerButtonStyled, { onClick: () => setIsOpen(!isOpen), children: /* @__PURE__ */ jsx14(Icon_default, { name: "ellipsis", size: "xl", color: "#FFFFFF" }) }),
|
|
3850
|
+
isOpen && /* @__PURE__ */ jsx14(MenuItemsContainerStyled, { ref: dropdownItemsContainerRef, children })
|
|
3851
|
+
] });
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3850
3854
|
// src/components/Calendar/index.tsx
|
|
3855
|
+
import { useRef as useRef3, useEffect as useEffect3, useState as useState2 } from "react";
|
|
3851
3856
|
import { DayPicker } from "react-day-picker";
|
|
3852
3857
|
|
|
3853
3858
|
// ../../node_modules/date-fns/locale/_lib/buildFormatLongFn.js
|
|
@@ -7970,7 +7975,7 @@ function Calendar(_a) {
|
|
|
7970
7975
|
]);
|
|
7971
7976
|
const [inputValue, setInputValue] = useState2("");
|
|
7972
7977
|
const [showContainer, setShowCalendar] = useState2(false);
|
|
7973
|
-
const dropdownRef =
|
|
7978
|
+
const dropdownRef = useRef3(null);
|
|
7974
7979
|
useOnClickOutside(dropdownRef, () => {
|
|
7975
7980
|
setShowCalendar(false);
|
|
7976
7981
|
});
|
|
@@ -8052,6 +8057,9 @@ function Calendar(_a) {
|
|
|
8052
8057
|
] })) });
|
|
8053
8058
|
}
|
|
8054
8059
|
|
|
8060
|
+
// src/components/Drawer/index.tsx
|
|
8061
|
+
import { useRef as useRef4 } from "react";
|
|
8062
|
+
|
|
8055
8063
|
// src/components/Drawer/styledComponents.ts
|
|
8056
8064
|
var DrawerOverlayStyled = styled("div", {
|
|
8057
8065
|
position: "fixed",
|
|
@@ -8107,9 +8115,14 @@ function Drawer({
|
|
|
8107
8115
|
children
|
|
8108
8116
|
}) {
|
|
8109
8117
|
if (!isOpen) return null;
|
|
8118
|
+
const drawerContainerRef = useRef4(null);
|
|
8119
|
+
useOnClickOutside(drawerContainerRef, () => {
|
|
8120
|
+
onClose();
|
|
8121
|
+
});
|
|
8110
8122
|
return /* @__PURE__ */ jsx16(DrawerOverlayStyled, { children: /* @__PURE__ */ jsxs7(
|
|
8111
8123
|
DrawerContainerStyled,
|
|
8112
8124
|
{
|
|
8125
|
+
ref: drawerContainerRef,
|
|
8113
8126
|
style: {
|
|
8114
8127
|
width: width != null ? width : "34.25rem",
|
|
8115
8128
|
backgroundColor: colors[backgroundColor != null ? backgroundColor : "neutral50"]
|
|
@@ -8126,7 +8139,7 @@ function Drawer({
|
|
|
8126
8139
|
}
|
|
8127
8140
|
|
|
8128
8141
|
// src/components/TimePicker.tsx
|
|
8129
|
-
import { useCallback, useRef as
|
|
8142
|
+
import { useCallback, useRef as useRef5, useState as useState3 } from "react";
|
|
8130
8143
|
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
8131
8144
|
var TimePickerStyled = styled("div", {
|
|
8132
8145
|
position: "relative",
|
|
@@ -8235,7 +8248,7 @@ function TimePicker({
|
|
|
8235
8248
|
const [rawHours, setRawHours] = useState3("00");
|
|
8236
8249
|
const [rawMinutes, setRawMinutes] = useState3("00");
|
|
8237
8250
|
const [isOpen, setIsOpen] = useState3(false);
|
|
8238
|
-
const dropdownRef =
|
|
8251
|
+
const dropdownRef = useRef5(null);
|
|
8239
8252
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8240
8253
|
const handleIncrement = useCallback(
|
|
8241
8254
|
(type) => {
|
|
@@ -8773,7 +8786,7 @@ function Switch(props) {
|
|
|
8773
8786
|
}
|
|
8774
8787
|
|
|
8775
8788
|
// src/components/Step.tsx
|
|
8776
|
-
import
|
|
8789
|
+
import React7 from "react";
|
|
8777
8790
|
import { Box as Box2, Tabs as StepRadix } from "@radix-ui/themes";
|
|
8778
8791
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
8779
8792
|
var StepStyled = styled("div", {
|
|
@@ -8889,9 +8902,9 @@ function StepList(_a) {
|
|
|
8889
8902
|
"children",
|
|
8890
8903
|
"currentStep"
|
|
8891
8904
|
]);
|
|
8892
|
-
return /* @__PURE__ */ jsx20(StepListStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
8893
|
-
if (
|
|
8894
|
-
return
|
|
8905
|
+
return /* @__PURE__ */ jsx20(StepListStyled, __spreadProps(__spreadValues({}, props), { children: React7.Children.map(children, (child) => {
|
|
8906
|
+
if (React7.isValidElement(child) && child.type === StepTrigger) {
|
|
8907
|
+
return React7.cloneElement(child, { currentStep });
|
|
8895
8908
|
}
|
|
8896
8909
|
return child;
|
|
8897
8910
|
}) }));
|
|
@@ -8948,7 +8961,7 @@ function Card(_a) {
|
|
|
8948
8961
|
|
|
8949
8962
|
// src/components/TextareaField.tsx
|
|
8950
8963
|
import { TextArea as TextAreaRadix } from "@radix-ui/themes";
|
|
8951
|
-
import
|
|
8964
|
+
import React8, { useRef as useRef6 } from "react";
|
|
8952
8965
|
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
8953
8966
|
var TextareaFieldStyle = styled(TextAreaRadix, {
|
|
8954
8967
|
display: "flex",
|
|
@@ -9013,10 +9026,10 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
9013
9026
|
padding: "$4"
|
|
9014
9027
|
}
|
|
9015
9028
|
});
|
|
9016
|
-
var TextareaField =
|
|
9029
|
+
var TextareaField = React8.forwardRef((_a, fowardedRef) => {
|
|
9017
9030
|
var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
|
|
9018
|
-
const inputRef =
|
|
9019
|
-
const badgeRef =
|
|
9031
|
+
const inputRef = useRef6(null);
|
|
9032
|
+
const badgeRef = useRef6(null);
|
|
9020
9033
|
const updateCharCountBadge = () => {
|
|
9021
9034
|
var _a2, _b2;
|
|
9022
9035
|
if (!maxLength || !badgeRef.current) return;
|
|
@@ -9320,8 +9333,8 @@ import {
|
|
|
9320
9333
|
faChevronUp as faChevronUp2,
|
|
9321
9334
|
faX
|
|
9322
9335
|
} from "@fortawesome/free-solid-svg-icons";
|
|
9323
|
-
import { useCallback as useCallback2, useMemo, useRef as
|
|
9324
|
-
import
|
|
9336
|
+
import { useCallback as useCallback2, useMemo, useRef as useRef7, useState as useState6 } from "react";
|
|
9337
|
+
import React9 from "react";
|
|
9325
9338
|
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9326
9339
|
var StyledContent = styled(DropdownMenu3.Content, {
|
|
9327
9340
|
backgroundColor: "$dark50",
|
|
@@ -9385,7 +9398,7 @@ var BadgeCloseBtn = styled("div", {
|
|
|
9385
9398
|
backgroundColor: "$dark600"
|
|
9386
9399
|
}
|
|
9387
9400
|
});
|
|
9388
|
-
var MultiSelect =
|
|
9401
|
+
var MultiSelect = React9.forwardRef(
|
|
9389
9402
|
({
|
|
9390
9403
|
placeholder,
|
|
9391
9404
|
value: selectedValues = [],
|
|
@@ -9397,7 +9410,7 @@ var MultiSelect = React8.forwardRef(
|
|
|
9397
9410
|
}, fowardedRef) => {
|
|
9398
9411
|
var _a;
|
|
9399
9412
|
const [isOpen, setIsOpen] = useState6(false);
|
|
9400
|
-
const triggerRef =
|
|
9413
|
+
const triggerRef = useRef7(null);
|
|
9401
9414
|
const labelByValue = useMemo(() => {
|
|
9402
9415
|
return options.reduce((prev, curr) => {
|
|
9403
9416
|
return __spreadProps(__spreadValues({}, prev), {
|
|
@@ -10015,6 +10028,7 @@ var CPFFormField = ({
|
|
|
10015
10028
|
/* @__PURE__ */ jsx37(
|
|
10016
10029
|
CheckboxGroup,
|
|
10017
10030
|
{
|
|
10031
|
+
value: foreigner ? ["true"] : [],
|
|
10018
10032
|
name: "foreigner",
|
|
10019
10033
|
onValueChange: (value) => {
|
|
10020
10034
|
const isForeigner = value.includes("true");
|
|
@@ -10720,6 +10734,7 @@ var CheckboxGroupFormField = ({
|
|
|
10720
10734
|
CheckboxGroup,
|
|
10721
10735
|
{
|
|
10722
10736
|
name,
|
|
10737
|
+
value: field.value,
|
|
10723
10738
|
onValueChange: field.onChange,
|
|
10724
10739
|
color: haveError ? "error" : color,
|
|
10725
10740
|
fontWeight,
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps, ReactNode } from "react";
|
|
1
|
+
import { ComponentProps, ReactNode, useRef } from "react";
|
|
2
2
|
import { colors, Colors } from "@lets-events/tokens";
|
|
3
3
|
import Icon from "../Icon";
|
|
4
4
|
import {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
DrawerHeaderTitle,
|
|
9
9
|
DrawerHeaderCloseButton,
|
|
10
10
|
} from "./styledComponents";
|
|
11
|
+
import { useOnClickOutside } from "../../hooks/useOnClickOutside";
|
|
11
12
|
|
|
12
13
|
export type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
|
|
13
14
|
isOpen: boolean;
|
|
@@ -27,9 +28,15 @@ export function Drawer({
|
|
|
27
28
|
children,
|
|
28
29
|
}: DrawerProps) {
|
|
29
30
|
if (!isOpen) return null;
|
|
31
|
+
const drawerContainerRef = useRef<HTMLDivElement>(null);
|
|
32
|
+
|
|
33
|
+
useOnClickOutside(drawerContainerRef, () => {
|
|
34
|
+
onClose();
|
|
35
|
+
});
|
|
30
36
|
return (
|
|
31
37
|
<DrawerOverlayStyled>
|
|
32
38
|
<DrawerContainerStyled
|
|
39
|
+
ref={drawerContainerRef}
|
|
33
40
|
style={{
|
|
34
41
|
width: width ?? "34.25rem",
|
|
35
42
|
backgroundColor: colors[backgroundColor ?? "neutral50"],
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { ReactNode, HTMLAttributes } from "react";
|
|
1
|
+
import React, { ReactNode, HTMLAttributes, useRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
MenuDropdownContainerStyled,
|
|
4
4
|
TriggerButtonStyled,
|
|
5
5
|
MenuItemsContainerStyled,
|
|
6
6
|
} from "./styledComponents";
|
|
7
7
|
import Icon from "../Icon";
|
|
8
|
+
import { useOnClickOutside } from "../../hooks/useOnClickOutside";
|
|
8
9
|
|
|
9
10
|
export type MenuDropdownProps = HTMLAttributes<HTMLDivElement> & {
|
|
10
11
|
children: ReactNode;
|
|
@@ -17,13 +18,20 @@ export function MenuDropdown({
|
|
|
17
18
|
isOpen,
|
|
18
19
|
setIsOpen,
|
|
19
20
|
}: MenuDropdownProps) {
|
|
21
|
+
const dropdownItemsContainerRef = useRef<HTMLDivElement>(null);
|
|
22
|
+
|
|
23
|
+
useOnClickOutside(dropdownItemsContainerRef, () => {
|
|
24
|
+
setIsOpen(false);
|
|
25
|
+
});
|
|
20
26
|
return (
|
|
21
27
|
<MenuDropdownContainerStyled>
|
|
22
28
|
<TriggerButtonStyled onClick={() => setIsOpen(!isOpen)}>
|
|
23
29
|
<Icon name="ellipsis" size="xl" color="#FFFFFF" />
|
|
24
30
|
</TriggerButtonStyled>
|
|
25
31
|
{isOpen && (
|
|
26
|
-
<MenuItemsContainerStyled
|
|
32
|
+
<MenuItemsContainerStyled ref={dropdownItemsContainerRef}>
|
|
33
|
+
{children}
|
|
34
|
+
</MenuItemsContainerStyled>
|
|
27
35
|
)}
|
|
28
36
|
</MenuDropdownContainerStyled>
|
|
29
37
|
);
|