@mlw-packages/react-components 1.7.26 → 1.7.28
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/dist/index.css +128 -54
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1030 -833
- package/dist/index.mjs +902 -705
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1004,7 +1004,7 @@ var DialogContentBase = React2.forwardRef(
|
|
|
1004
1004
|
{
|
|
1005
1005
|
ref,
|
|
1006
1006
|
className: cn(
|
|
1007
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-hidden",
|
|
1007
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-hidden rounded-md",
|
|
1008
1008
|
className
|
|
1009
1009
|
),
|
|
1010
1010
|
"data-testid": dataTestId,
|
|
@@ -1217,22 +1217,47 @@ var CommandInputBase = React5.forwardRef(({ className, testid: dataTestId = "com
|
|
|
1217
1217
|
)
|
|
1218
1218
|
] }));
|
|
1219
1219
|
CommandInputBase.displayName = import_cmdk.Command.Input.displayName;
|
|
1220
|
-
var CommandListBase = React5.forwardRef(({ className, testid: dataTestId = "command-list", ...props }, ref) =>
|
|
1221
|
-
|
|
1222
|
-
{
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
"
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1220
|
+
var CommandListBase = React5.forwardRef(({ className, testid: dataTestId = "command-list", ...props }, ref) => {
|
|
1221
|
+
const listRef = React5.useRef(null);
|
|
1222
|
+
React5.useEffect(() => {
|
|
1223
|
+
const element = listRef.current;
|
|
1224
|
+
if (!element) return;
|
|
1225
|
+
const handleWheel = (e) => {
|
|
1226
|
+
e.stopPropagation();
|
|
1227
|
+
};
|
|
1228
|
+
element.addEventListener("wheel", handleWheel, { passive: false });
|
|
1229
|
+
return () => {
|
|
1230
|
+
element.removeEventListener("wheel", handleWheel);
|
|
1231
|
+
};
|
|
1232
|
+
}, []);
|
|
1233
|
+
const combinedRef = React5.useCallback(
|
|
1234
|
+
(node) => {
|
|
1235
|
+
listRef.current = node;
|
|
1236
|
+
if (typeof ref === "function") {
|
|
1237
|
+
ref(node);
|
|
1238
|
+
} else if (ref) {
|
|
1239
|
+
ref.current = node;
|
|
1240
|
+
}
|
|
1232
1241
|
},
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
)
|
|
1242
|
+
[ref]
|
|
1243
|
+
);
|
|
1244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1245
|
+
import_cmdk.Command.List,
|
|
1246
|
+
{
|
|
1247
|
+
ref: combinedRef,
|
|
1248
|
+
className: cn(
|
|
1249
|
+
"max-h-[300px] overflow-y-auto overflow-x-hidden scroll-smooth [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/50",
|
|
1250
|
+
className
|
|
1251
|
+
),
|
|
1252
|
+
"data-testid": dataTestId,
|
|
1253
|
+
style: {
|
|
1254
|
+
overscrollBehavior: "contain",
|
|
1255
|
+
WebkitOverflowScrolling: "touch"
|
|
1256
|
+
},
|
|
1257
|
+
...props
|
|
1258
|
+
}
|
|
1259
|
+
);
|
|
1260
|
+
});
|
|
1236
1261
|
CommandListBase.displayName = import_cmdk.Command.List.displayName;
|
|
1237
1262
|
var CommandEmptyBase = React5.forwardRef(({ testid: dataTestId = "command-empty", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1238
1263
|
import_cmdk.Command.Empty,
|
|
@@ -7297,8 +7322,87 @@ var import_date_fns = require("date-fns");
|
|
|
7297
7322
|
// src/components/ui/picker/calendar.tsx
|
|
7298
7323
|
var React37 = __toESM(require("react"));
|
|
7299
7324
|
var import_react_day_picker2 = require("react-day-picker");
|
|
7300
|
-
var
|
|
7301
|
-
var
|
|
7325
|
+
var import_locale = require("date-fns/locale");
|
|
7326
|
+
var import_react40 = require("@phosphor-icons/react");
|
|
7327
|
+
|
|
7328
|
+
// src/hooks/use-drag.tsx
|
|
7329
|
+
var import_react39 = require("react");
|
|
7330
|
+
var useDrag = (options = {}) => {
|
|
7331
|
+
const [isDragging, setIsDragging] = (0, import_react39.useState)(null);
|
|
7332
|
+
const [positions, setPositions] = (0, import_react39.useState)({});
|
|
7333
|
+
const dragStartPos = (0, import_react39.useRef)(null);
|
|
7334
|
+
const dragId = (0, import_react39.useRef)(null);
|
|
7335
|
+
const handleMouseDown = (0, import_react39.useCallback)((id, e) => {
|
|
7336
|
+
e.preventDefault();
|
|
7337
|
+
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
7338
|
+
dragStartPos.current = {
|
|
7339
|
+
x: e.clientX,
|
|
7340
|
+
y: e.clientY,
|
|
7341
|
+
elementX: currentPosition.left,
|
|
7342
|
+
elementY: currentPosition.top
|
|
7343
|
+
};
|
|
7344
|
+
dragId.current = id;
|
|
7345
|
+
setIsDragging(id);
|
|
7346
|
+
options.onDragStart?.(id);
|
|
7347
|
+
}, [positions, options]);
|
|
7348
|
+
const handleMouseMove = (0, import_react39.useCallback)((e) => {
|
|
7349
|
+
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
7350
|
+
const deltaX = e.clientX - dragStartPos.current.x;
|
|
7351
|
+
const deltaY = e.clientY - dragStartPos.current.y;
|
|
7352
|
+
const newPosition = {
|
|
7353
|
+
left: dragStartPos.current.elementX + deltaX,
|
|
7354
|
+
top: dragStartPos.current.elementY + deltaY
|
|
7355
|
+
};
|
|
7356
|
+
newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
|
|
7357
|
+
newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
|
|
7358
|
+
setPositions((prev) => ({
|
|
7359
|
+
...prev,
|
|
7360
|
+
[dragId.current]: newPosition
|
|
7361
|
+
}));
|
|
7362
|
+
options.onDrag?.(dragId.current, newPosition);
|
|
7363
|
+
}, [isDragging, options]);
|
|
7364
|
+
const handleMouseUp = (0, import_react39.useCallback)(() => {
|
|
7365
|
+
if (dragId.current) {
|
|
7366
|
+
options.onDragEnd?.(dragId.current);
|
|
7367
|
+
}
|
|
7368
|
+
setIsDragging(null);
|
|
7369
|
+
dragStartPos.current = null;
|
|
7370
|
+
dragId.current = null;
|
|
7371
|
+
}, [options]);
|
|
7372
|
+
(0, import_react39.useEffect)(() => {
|
|
7373
|
+
if (isDragging) {
|
|
7374
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
7375
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
7376
|
+
document.body.style.userSelect = "none";
|
|
7377
|
+
return () => {
|
|
7378
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
7379
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
7380
|
+
document.body.style.userSelect = "";
|
|
7381
|
+
};
|
|
7382
|
+
}
|
|
7383
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
7384
|
+
const setPosition = (0, import_react39.useCallback)((id, position) => {
|
|
7385
|
+
setPositions((prev) => ({
|
|
7386
|
+
...prev,
|
|
7387
|
+
[id]: position
|
|
7388
|
+
}));
|
|
7389
|
+
}, []);
|
|
7390
|
+
const getPosition = (0, import_react39.useCallback)((id) => {
|
|
7391
|
+
return positions[id] || { top: 0, left: 0 };
|
|
7392
|
+
}, [positions]);
|
|
7393
|
+
const isElementDragging = (0, import_react39.useCallback)((id) => {
|
|
7394
|
+
return isDragging === id;
|
|
7395
|
+
}, [isDragging]);
|
|
7396
|
+
return {
|
|
7397
|
+
handleMouseDown,
|
|
7398
|
+
getPosition,
|
|
7399
|
+
setPosition,
|
|
7400
|
+
isElementDragging,
|
|
7401
|
+
isDragging: isDragging !== null
|
|
7402
|
+
};
|
|
7403
|
+
};
|
|
7404
|
+
|
|
7405
|
+
// src/components/ui/picker/calendar.tsx
|
|
7302
7406
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
7303
7407
|
function CalendarBase2({
|
|
7304
7408
|
className,
|
|
@@ -7306,16 +7410,7 @@ function CalendarBase2({
|
|
|
7306
7410
|
showOutsideDays = true,
|
|
7307
7411
|
...props
|
|
7308
7412
|
}) {
|
|
7309
|
-
const
|
|
7310
|
-
props.month || props.defaultMonth || /* @__PURE__ */ new Date()
|
|
7311
|
-
);
|
|
7312
|
-
const [direction, setDirection] = React37.useState(1);
|
|
7313
|
-
const handleMonthChange = (newMonth) => {
|
|
7314
|
-
const isNext = newMonth > month ? 1 : -1;
|
|
7315
|
-
setDirection(isNext);
|
|
7316
|
-
setMonth(newMonth);
|
|
7317
|
-
props.onMonthChange?.(newMonth);
|
|
7318
|
-
};
|
|
7413
|
+
const isMobile = useIsMobile();
|
|
7319
7414
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7320
7415
|
"div",
|
|
7321
7416
|
{
|
|
@@ -7323,80 +7418,75 @@ function CalendarBase2({
|
|
|
7323
7418
|
"rounded-md border bg-background p-3 overflow-hidden flex flex-col",
|
|
7324
7419
|
className
|
|
7325
7420
|
),
|
|
7326
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7327
|
-
|
|
7421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7422
|
+
import_react_day_picker2.DayPicker,
|
|
7328
7423
|
{
|
|
7424
|
+
showOutsideDays,
|
|
7425
|
+
fixedWeeks: true,
|
|
7426
|
+
weekStartsOn: 1,
|
|
7427
|
+
locale: import_locale.ptBR,
|
|
7428
|
+
navLayout: "around",
|
|
7329
7429
|
className: "w-full h-full flex flex-col",
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
...classNames
|
|
7375
|
-
},
|
|
7376
|
-
components: {
|
|
7377
|
-
Chevron: ({ orientation }) => {
|
|
7378
|
-
if (orientation === "left") {
|
|
7379
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react39.CaretLeftIcon, { className: "h-4 w-4" });
|
|
7380
|
-
}
|
|
7381
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react39.CaretRightIcon, { className: "h-4 w-4" });
|
|
7382
|
-
}
|
|
7383
|
-
},
|
|
7384
|
-
...props
|
|
7430
|
+
classNames: {
|
|
7431
|
+
months: "flex flex-col sm:flex-row gap-3 sm:gap-4 w-full",
|
|
7432
|
+
month: "relative flex-1 min-w-0",
|
|
7433
|
+
month_caption: "flex items-center gap-2 min-h-[2.25rem] mb-4",
|
|
7434
|
+
caption_label: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize",
|
|
7435
|
+
nav: "hidden ",
|
|
7436
|
+
button_previous: cn(
|
|
7437
|
+
buttonVariantsBase({ variant: "outline" }),
|
|
7438
|
+
"h-8 w-8 flex items-center justify-center p-0 rounded-md transition-transform duration-150 ease-out focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/40 active:scale-95 absolute right-11 top-0 z-10",
|
|
7439
|
+
isMobile ? "mr-8" : ""
|
|
7440
|
+
),
|
|
7441
|
+
button_next: cn(
|
|
7442
|
+
buttonVariantsBase({ variant: "outline" }),
|
|
7443
|
+
"h-8 w-8 flex items-center justify-center p-0 rounded-md transition-transform duration-150 ease-out focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/40 active:scale-95 absolute right-0 top-0 z-10",
|
|
7444
|
+
isMobile ? "mr-8" : ""
|
|
7445
|
+
),
|
|
7446
|
+
month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
|
|
7447
|
+
weekdays: "grid grid-cols-7 gap-1 mb-1",
|
|
7448
|
+
weekday: "text-muted-foreground rounded-md font-semibold text-[clamp(0.575rem,1.2vw,0.75rem)] sm:text-[clamp(0.65rem,1.1vw,0.825rem)] text-center pb-1 uppercase tracking-wider",
|
|
7449
|
+
week: "grid grid-cols-7 gap-1",
|
|
7450
|
+
day: cn(
|
|
7451
|
+
"min-w-0 h-9 sm:h-10 md:h-10 p-0 relative flex items-center justify-center",
|
|
7452
|
+
"[&:has([aria-selected].day-range-end)]:rounded-r-lg",
|
|
7453
|
+
"[&:has([aria-selected].day-range-start)]:rounded-l-lg",
|
|
7454
|
+
"[&:has([aria-selected].day-outside)]:bg-muted/50",
|
|
7455
|
+
"[&:has([aria-selected])]:bg-muted"
|
|
7456
|
+
),
|
|
7457
|
+
day_button: cn(
|
|
7458
|
+
buttonVariantsBase({ variant: "ghost" }),
|
|
7459
|
+
"w-full h-full p-0 m-0 flex items-center justify-center text-[clamp(0.775rem,1.2vw,0.95rem)] sm:text-sm",
|
|
7460
|
+
"aria-selected:opacity-100 hover:bg-muted transition-all duration-150 ease-out active:scale-95"
|
|
7461
|
+
),
|
|
7462
|
+
selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white rounded-md",
|
|
7463
|
+
today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
|
|
7464
|
+
outside: "text-muted-foreground/40 opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
|
|
7465
|
+
disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
|
|
7466
|
+
range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
|
|
7467
|
+
hidden: "invisible",
|
|
7468
|
+
...classNames
|
|
7469
|
+
},
|
|
7470
|
+
components: {
|
|
7471
|
+
Chevron: ({ orientation }) => {
|
|
7472
|
+
if (orientation === "left") {
|
|
7473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react40.CaretLeftIcon, { className: "h-4 w-4" });
|
|
7385
7474
|
}
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react40.CaretRightIcon, { className: "h-4 w-4" });
|
|
7476
|
+
}
|
|
7477
|
+
},
|
|
7478
|
+
...props
|
|
7479
|
+
}
|
|
7480
|
+
) })
|
|
7391
7481
|
}
|
|
7392
7482
|
);
|
|
7393
7483
|
}
|
|
7394
7484
|
CalendarBase2.displayName = "CalendarBase";
|
|
7395
7485
|
|
|
7396
7486
|
// src/components/ui/picker/DateTimePicker.tsx
|
|
7397
|
-
var
|
|
7398
|
-
var
|
|
7399
|
-
var
|
|
7487
|
+
var import_locale2 = require("date-fns/locale");
|
|
7488
|
+
var import_react43 = require("react");
|
|
7489
|
+
var import_react44 = require("@phosphor-icons/react");
|
|
7400
7490
|
|
|
7401
7491
|
// src/components/ui/shared/ClearButton.tsx
|
|
7402
7492
|
var import_ssr2 = require("@phosphor-icons/react/dist/ssr");
|
|
@@ -7429,27 +7519,33 @@ function ClearButton({
|
|
|
7429
7519
|
}
|
|
7430
7520
|
|
|
7431
7521
|
// src/components/ui/picker/TimeScrollPicker.tsx
|
|
7432
|
-
var
|
|
7522
|
+
var import_react41 = require("react");
|
|
7433
7523
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7434
|
-
var ITEM_HEIGHT =
|
|
7524
|
+
var ITEM_HEIGHT = 39;
|
|
7435
7525
|
var ITEM_HEIGHT_MOBILE = 32;
|
|
7436
7526
|
var VISIBLE_ITEMS = 5;
|
|
7437
7527
|
var VISIBLE_ITEMS_MOBILE = 3;
|
|
7438
7528
|
var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
|
|
7439
7529
|
var CENTER_INDEX_MOBILE = Math.floor(VISIBLE_ITEMS_MOBILE / 2);
|
|
7440
|
-
function ScrollColumn({
|
|
7530
|
+
function ScrollColumn({
|
|
7531
|
+
value,
|
|
7532
|
+
onChange,
|
|
7533
|
+
max,
|
|
7534
|
+
label,
|
|
7535
|
+
hideSeconds
|
|
7536
|
+
}) {
|
|
7441
7537
|
const isMobile = useIsMobile();
|
|
7442
|
-
const containerRef = (0,
|
|
7538
|
+
const containerRef = (0, import_react41.useRef)(null);
|
|
7443
7539
|
const items = Array.from({ length: max }, (_, i) => i);
|
|
7444
|
-
const [isDragging, setIsDragging] = (0,
|
|
7445
|
-
const [startY, setStartY] = (0,
|
|
7446
|
-
const [scrollTop, setScrollTop] = (0,
|
|
7447
|
-
const scrollTimeoutRef = (0,
|
|
7540
|
+
const [isDragging, setIsDragging] = (0, import_react41.useState)(false);
|
|
7541
|
+
const [startY, setStartY] = (0, import_react41.useState)(0);
|
|
7542
|
+
const [scrollTop, setScrollTop] = (0, import_react41.useState)(0);
|
|
7543
|
+
const scrollTimeoutRef = (0, import_react41.useRef)(null);
|
|
7448
7544
|
const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
|
|
7449
7545
|
const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
|
|
7450
7546
|
const visibleItems = isMobile ? VISIBLE_ITEMS_MOBILE : VISIBLE_ITEMS;
|
|
7451
7547
|
const containerHeight = visibleItems * itemHeight;
|
|
7452
|
-
(0,
|
|
7548
|
+
(0, import_react41.useEffect)(() => {
|
|
7453
7549
|
if (containerRef.current && !isDragging) {
|
|
7454
7550
|
requestAnimationFrame(() => {
|
|
7455
7551
|
if (containerRef.current) {
|
|
@@ -7459,7 +7555,7 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7459
7555
|
});
|
|
7460
7556
|
}
|
|
7461
7557
|
}, [value, isDragging, itemHeight]);
|
|
7462
|
-
(0,
|
|
7558
|
+
(0, import_react41.useEffect)(() => {
|
|
7463
7559
|
return () => {
|
|
7464
7560
|
if (scrollTimeoutRef.current) {
|
|
7465
7561
|
clearTimeout(scrollTimeoutRef.current);
|
|
@@ -7504,55 +7600,44 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7504
7600
|
const handleMouseLeave = () => {
|
|
7505
7601
|
if (isDragging) handleMouseUp();
|
|
7506
7602
|
};
|
|
7603
|
+
const containerWidth = isMobile ? hideSeconds ? "w-16" : "w-8" : "w-16";
|
|
7507
7604
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col items-center gap-1", children: [
|
|
7508
7605
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-muted-foreground rounded-md font-semibold text-[clamp(0.575rem,1.2vw,0.75rem)] sm:text-[clamp(0.65rem,1.1vw,0.825rem)] text-center pb-1 uppercase tracking-wider", children: label }),
|
|
7509
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
|
|
7545
|
-
),
|
|
7546
|
-
style: { height: `${itemHeight}px` },
|
|
7547
|
-
onClick: () => !isDragging && onChange(item),
|
|
7548
|
-
children: item.toString().padStart(2, "0")
|
|
7549
|
-
},
|
|
7550
|
-
item
|
|
7551
|
-
);
|
|
7552
|
-
})
|
|
7553
|
-
}
|
|
7554
|
-
)
|
|
7555
|
-
] })
|
|
7606
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: cn("relative", containerWidth), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
7607
|
+
"div",
|
|
7608
|
+
{
|
|
7609
|
+
ref: containerRef,
|
|
7610
|
+
className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
|
|
7611
|
+
onScroll: handleScroll,
|
|
7612
|
+
onMouseDown: handleMouseDown,
|
|
7613
|
+
onMouseMove: handleMouseMove,
|
|
7614
|
+
onMouseUp: handleMouseUp,
|
|
7615
|
+
onMouseLeave: handleMouseLeave,
|
|
7616
|
+
style: {
|
|
7617
|
+
height: `${containerHeight}px`,
|
|
7618
|
+
paddingTop: `${centerIndex * itemHeight}px`,
|
|
7619
|
+
paddingBottom: `${centerIndex * itemHeight}px`,
|
|
7620
|
+
cursor: isDragging ? "grabbing" : ""
|
|
7621
|
+
},
|
|
7622
|
+
children: items.map((item) => {
|
|
7623
|
+
const isSelected = item === value;
|
|
7624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
7625
|
+
"div",
|
|
7626
|
+
{
|
|
7627
|
+
className: cn(
|
|
7628
|
+
"flex items-center justify-center select-none font-semibold tabular-nums",
|
|
7629
|
+
isDragging ? "cursor-grabbing" : "",
|
|
7630
|
+
isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
|
|
7631
|
+
),
|
|
7632
|
+
style: { height: `${itemHeight}px` },
|
|
7633
|
+
onClick: () => !isDragging && onChange(item),
|
|
7634
|
+
children: item.toString().padStart(2, "0")
|
|
7635
|
+
},
|
|
7636
|
+
item
|
|
7637
|
+
);
|
|
7638
|
+
})
|
|
7639
|
+
}
|
|
7640
|
+
) })
|
|
7556
7641
|
] });
|
|
7557
7642
|
}
|
|
7558
7643
|
function TimeScrollPicker({
|
|
@@ -7560,7 +7645,10 @@ function TimeScrollPicker({
|
|
|
7560
7645
|
setDate,
|
|
7561
7646
|
hideSeconds = false
|
|
7562
7647
|
}) {
|
|
7648
|
+
const isMobile = useIsMobile();
|
|
7563
7649
|
const currentDate = date || /* @__PURE__ */ new Date();
|
|
7650
|
+
const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
|
|
7651
|
+
const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
|
|
7564
7652
|
const handleTimeChange = (type, value) => {
|
|
7565
7653
|
const newDate = new Date(currentDate);
|
|
7566
7654
|
if (type === "hours") newDate.setHours(value);
|
|
@@ -7568,14 +7656,25 @@ function TimeScrollPicker({
|
|
|
7568
7656
|
else newDate.setSeconds(value);
|
|
7569
7657
|
setDate(newDate);
|
|
7570
7658
|
};
|
|
7571
|
-
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex gap-2
|
|
7659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: cn("relative flex gap-2"), children: [
|
|
7660
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
7661
|
+
"div",
|
|
7662
|
+
{
|
|
7663
|
+
className: "absolute left-0 right-0 pointer-events-none z-10 rounded-md bg-primary/5",
|
|
7664
|
+
style: {
|
|
7665
|
+
top: `calc(1.75rem + ${centerIndex * itemHeight}px)`,
|
|
7666
|
+
height: `${itemHeight}px`
|
|
7667
|
+
}
|
|
7668
|
+
}
|
|
7669
|
+
),
|
|
7572
7670
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
7573
7671
|
ScrollColumn,
|
|
7574
7672
|
{
|
|
7575
7673
|
value: currentDate.getHours(),
|
|
7576
7674
|
onChange: (v) => handleTimeChange("hours", v),
|
|
7577
7675
|
max: 24,
|
|
7578
|
-
label: "Hora"
|
|
7676
|
+
label: "Hora",
|
|
7677
|
+
hideSeconds
|
|
7579
7678
|
}
|
|
7580
7679
|
),
|
|
7581
7680
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
@@ -7584,7 +7683,8 @@ function TimeScrollPicker({
|
|
|
7584
7683
|
value: currentDate.getMinutes(),
|
|
7585
7684
|
onChange: (v) => handleTimeChange("minutes", v),
|
|
7586
7685
|
max: 60,
|
|
7587
|
-
label: "Min"
|
|
7686
|
+
label: "Min",
|
|
7687
|
+
hideSeconds
|
|
7588
7688
|
}
|
|
7589
7689
|
),
|
|
7590
7690
|
!hideSeconds && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
@@ -7593,12 +7693,44 @@ function TimeScrollPicker({
|
|
|
7593
7693
|
value: currentDate.getSeconds(),
|
|
7594
7694
|
onChange: (v) => handleTimeChange("seconds", v),
|
|
7595
7695
|
max: 60,
|
|
7596
|
-
label: "Seg"
|
|
7696
|
+
label: "Seg",
|
|
7697
|
+
hideSeconds
|
|
7597
7698
|
}
|
|
7598
7699
|
)
|
|
7599
7700
|
] }) });
|
|
7600
7701
|
}
|
|
7601
7702
|
|
|
7703
|
+
// src/hooks/use-auto-center.tsx
|
|
7704
|
+
var import_react42 = require("react");
|
|
7705
|
+
function useAutoCenter(open) {
|
|
7706
|
+
const ref = (0, import_react42.useRef)(null);
|
|
7707
|
+
const [center, setCenter] = (0, import_react42.useState)(false);
|
|
7708
|
+
(0, import_react42.useEffect)(() => {
|
|
7709
|
+
if (!open) {
|
|
7710
|
+
setCenter(false);
|
|
7711
|
+
return;
|
|
7712
|
+
}
|
|
7713
|
+
let raf = 0;
|
|
7714
|
+
const check = () => {
|
|
7715
|
+
const el = ref.current;
|
|
7716
|
+
if (!el) return setCenter(false);
|
|
7717
|
+
const rect = el.getBoundingClientRect();
|
|
7718
|
+
const overflow = rect.left < 0 || rect.top < 0 || rect.right > window.innerWidth || rect.bottom > window.innerHeight;
|
|
7719
|
+
setCenter(Boolean(overflow));
|
|
7720
|
+
};
|
|
7721
|
+
raf = requestAnimationFrame(check);
|
|
7722
|
+
window.addEventListener("resize", check);
|
|
7723
|
+
window.addEventListener("scroll", check, { passive: true });
|
|
7724
|
+
return () => {
|
|
7725
|
+
cancelAnimationFrame(raf);
|
|
7726
|
+
window.removeEventListener("resize", check);
|
|
7727
|
+
window.removeEventListener("scroll", check);
|
|
7728
|
+
};
|
|
7729
|
+
}, [open]);
|
|
7730
|
+
return { ref, center };
|
|
7731
|
+
}
|
|
7732
|
+
var use_auto_center_default = useAutoCenter;
|
|
7733
|
+
|
|
7602
7734
|
// src/components/ui/picker/DateTimePicker.tsx
|
|
7603
7735
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
7604
7736
|
function DateTimePicker({
|
|
@@ -7615,11 +7747,14 @@ function DateTimePicker({
|
|
|
7615
7747
|
className,
|
|
7616
7748
|
error
|
|
7617
7749
|
}) {
|
|
7618
|
-
const [internalDate, setInternalDate] = (0,
|
|
7619
|
-
const [open, setOpen] = (0,
|
|
7750
|
+
const [internalDate, setInternalDate] = (0, import_react43.useState)(date);
|
|
7751
|
+
const [open, setOpen] = (0, import_react43.useState)(false);
|
|
7752
|
+
const isMobile = useIsMobile();
|
|
7620
7753
|
const handleSelect = (newDay) => {
|
|
7621
7754
|
if (!newDay) return;
|
|
7622
7755
|
if (!internalDate) {
|
|
7756
|
+
const now = /* @__PURE__ */ new Date();
|
|
7757
|
+
newDay.setHours(now.getHours(), now.getMinutes(), now.getSeconds());
|
|
7623
7758
|
setInternalDate(newDay);
|
|
7624
7759
|
onChange?.(newDay);
|
|
7625
7760
|
return;
|
|
@@ -7647,110 +7782,153 @@ function DateTimePicker({
|
|
|
7647
7782
|
if (!timeFormat) return "dd MMMM yyyy";
|
|
7648
7783
|
return `dd MMMM yyyy - ${timeFormat}`;
|
|
7649
7784
|
};
|
|
7650
|
-
(0,
|
|
7785
|
+
(0, import_react43.useEffect)(() => {
|
|
7651
7786
|
setInternalDate(date);
|
|
7652
7787
|
}, [date, open]);
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
{
|
|
7665
|
-
variant: "outline",
|
|
7666
|
-
disabled,
|
|
7667
|
-
className: cn(
|
|
7668
|
-
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
7669
|
-
!date && "text-muted-foreground"
|
|
7670
|
-
),
|
|
7671
|
-
children: [
|
|
7672
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7673
|
-
"span",
|
|
7674
|
-
{
|
|
7675
|
-
className: cn(
|
|
7676
|
-
"truncate flex-1",
|
|
7677
|
-
!date && "text-muted-foreground"
|
|
7678
|
-
),
|
|
7679
|
-
children: date ? (0, import_date_fns.format)(date, getDisplayFormat(), { locale: import_locale.ptBR }) : "Selecione uma data"
|
|
7680
|
-
}
|
|
7681
|
-
),
|
|
7682
|
-
date && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7683
|
-
ClearButton,
|
|
7684
|
-
{
|
|
7685
|
-
className: "-mr-3",
|
|
7686
|
-
onClick: (e) => {
|
|
7687
|
-
e?.stopPropagation();
|
|
7688
|
-
setInternalDate(null);
|
|
7689
|
-
onChange?.(null);
|
|
7690
|
-
onConfirm?.(null);
|
|
7691
|
-
}
|
|
7692
|
-
}
|
|
7693
|
-
),
|
|
7694
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react42.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
7695
|
-
]
|
|
7696
|
-
}
|
|
7697
|
-
)
|
|
7698
|
-
}
|
|
7788
|
+
const { ref: contentRef, center } = use_auto_center_default(open);
|
|
7789
|
+
const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none";
|
|
7790
|
+
const centeredPopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-50";
|
|
7791
|
+
const renderTriggerButton = () => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
7792
|
+
ButtonBase,
|
|
7793
|
+
{
|
|
7794
|
+
variant: "outline",
|
|
7795
|
+
disabled,
|
|
7796
|
+
className: cn(
|
|
7797
|
+
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
7798
|
+
!date && "text-muted-foreground"
|
|
7699
7799
|
),
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.
|
|
7800
|
+
children: [
|
|
7801
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: cn("truncate flex-1", !date && "text-muted-foreground"), children: date ? (0, import_date_fns.format)(date, getDisplayFormat(), { locale: import_locale2.ptBR }) : "Selecione uma data" }),
|
|
7802
|
+
date && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7803
|
+
ClearButton,
|
|
7804
|
+
{
|
|
7805
|
+
className: "-mr-3",
|
|
7806
|
+
onClick: (e) => {
|
|
7807
|
+
e?.stopPropagation();
|
|
7808
|
+
setInternalDate(null);
|
|
7809
|
+
onChange?.(null);
|
|
7810
|
+
onConfirm?.(null);
|
|
7811
|
+
}
|
|
7812
|
+
}
|
|
7813
|
+
),
|
|
7814
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react44.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
7815
|
+
]
|
|
7816
|
+
}
|
|
7817
|
+
);
|
|
7818
|
+
const renderPickerContent = () => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
7819
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
7820
|
+
"div",
|
|
7821
|
+
{
|
|
7822
|
+
ref: contentRef,
|
|
7823
|
+
className: "flex sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
|
|
7824
|
+
children: [
|
|
7703
7825
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7704
7826
|
CalendarBase2,
|
|
7705
7827
|
{
|
|
7706
7828
|
mode: "single",
|
|
7707
|
-
locale:
|
|
7829
|
+
locale: import_locale2.ptBR,
|
|
7708
7830
|
selected: internalDate ?? void 0,
|
|
7709
7831
|
onSelect: (d) => handleSelect(d ?? null),
|
|
7710
|
-
|
|
7832
|
+
autoFocus: true,
|
|
7711
7833
|
defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
|
|
7712
|
-
fromDate,
|
|
7713
|
-
toDate,
|
|
7834
|
+
...fromDate && { startMonth: fromDate },
|
|
7835
|
+
...toDate && { endMonth: toDate },
|
|
7836
|
+
...fromDate || toDate ? {
|
|
7837
|
+
hidden: [
|
|
7838
|
+
...fromDate ? [{ before: fromDate }] : [],
|
|
7839
|
+
...toDate ? [{ after: toDate }] : []
|
|
7840
|
+
]
|
|
7841
|
+
} : {},
|
|
7714
7842
|
className: cn(
|
|
7715
7843
|
"w-max rounded-none",
|
|
7716
|
-
!hideTime && "sm:rounded-r-none rounded-b-none"
|
|
7844
|
+
!hideTime && "sm:rounded-r-none rounded-b-none",
|
|
7845
|
+
isMobile ? "border-b-transparent w-full" : ""
|
|
7717
7846
|
)
|
|
7718
7847
|
}
|
|
7719
7848
|
),
|
|
7720
|
-
!hideTime && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
7721
|
-
|
|
7722
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7723
|
-
TimeScrollPicker,
|
|
7724
|
-
{
|
|
7725
|
-
setDate: (d) => handleTimeChange(d ?? null),
|
|
7726
|
-
date: internalDate,
|
|
7727
|
-
hideSeconds
|
|
7728
|
-
}
|
|
7729
|
-
)
|
|
7730
|
-
] })
|
|
7731
|
-
] }),
|
|
7732
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex border-none rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "grid grid-cols-2 w-full", children: [
|
|
7733
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7734
|
-
ButtonBase,
|
|
7735
|
-
{
|
|
7736
|
-
className: "no-active-animation rounded-none rounded-bl-md bg-background text-gray-800 border-b border-l hover:bg-muted/50 overflow-y-hidden rounded-tl-none",
|
|
7737
|
-
onClick: () => setOpen(false),
|
|
7738
|
-
children: "Cancelar"
|
|
7739
|
-
}
|
|
7740
|
-
),
|
|
7741
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7742
|
-
ButtonBase,
|
|
7849
|
+
!hideTime && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
7850
|
+
"div",
|
|
7743
7851
|
{
|
|
7744
|
-
className:
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7852
|
+
className: cn(
|
|
7853
|
+
"flex flex-col items-center justify-center",
|
|
7854
|
+
isMobile ? "border-none" : " border border-t-0 sm:border-t sm:border-b sm:border-r rounded-b-md sm:rounded-b-none sm:rounded-r-md"
|
|
7855
|
+
),
|
|
7856
|
+
children: [
|
|
7857
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize text-left", children: "Hor\xE1rio" }),
|
|
7858
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7859
|
+
TimeScrollPicker,
|
|
7860
|
+
{
|
|
7861
|
+
setDate: (d) => handleTimeChange(d ?? null),
|
|
7862
|
+
date: internalDate,
|
|
7863
|
+
hideSeconds
|
|
7864
|
+
}
|
|
7865
|
+
)
|
|
7866
|
+
]
|
|
7750
7867
|
}
|
|
7751
7868
|
)
|
|
7752
|
-
]
|
|
7753
|
-
|
|
7869
|
+
]
|
|
7870
|
+
}
|
|
7871
|
+
),
|
|
7872
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex rounded-md -mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "grid grid-cols-2 w-full", children: [
|
|
7873
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7874
|
+
ButtonBase,
|
|
7875
|
+
{
|
|
7876
|
+
className: "no-active-animation rounded-none rounded-bl-md bg-background text-gray-800 border-b border-l hover:bg-muted/50 overflow-y-hidden rounded-tl-none",
|
|
7877
|
+
onClick: () => setOpen(false),
|
|
7878
|
+
children: "Cancelar"
|
|
7879
|
+
}
|
|
7880
|
+
),
|
|
7881
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7882
|
+
ButtonBase,
|
|
7883
|
+
{
|
|
7884
|
+
className: cn(
|
|
7885
|
+
"no-active-animation rounded-none bg-emerald-600",
|
|
7886
|
+
internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed",
|
|
7887
|
+
isMobile ? "rounded-md-md" : "rounded-none"
|
|
7888
|
+
),
|
|
7889
|
+
disabled: !internalDate,
|
|
7890
|
+
onClick: () => {
|
|
7891
|
+
if (!internalDate) return;
|
|
7892
|
+
setOpen(false);
|
|
7893
|
+
onConfirm?.(internalDate);
|
|
7894
|
+
},
|
|
7895
|
+
children: "Confirmar"
|
|
7896
|
+
}
|
|
7897
|
+
)
|
|
7898
|
+
] }) })
|
|
7899
|
+
] });
|
|
7900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
7901
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LabelBase_default, { children: label }),
|
|
7902
|
+
isMobile ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(DialogBase, { open, onOpenChange: setOpen, children: [
|
|
7903
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7904
|
+
DialogTriggerBase,
|
|
7905
|
+
{
|
|
7906
|
+
disabled,
|
|
7907
|
+
asChild: true,
|
|
7908
|
+
className: cn(error && "border-red-500"),
|
|
7909
|
+
children: renderTriggerButton()
|
|
7910
|
+
}
|
|
7911
|
+
),
|
|
7912
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorMessage_default, { error }),
|
|
7913
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[90vh] overflow-hidden", children: renderPickerContent() })
|
|
7914
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
7915
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7916
|
+
PopoverTriggerBase,
|
|
7917
|
+
{
|
|
7918
|
+
disabled,
|
|
7919
|
+
asChild: true,
|
|
7920
|
+
className: cn(error && "border-red-500"),
|
|
7921
|
+
children: renderTriggerButton()
|
|
7922
|
+
}
|
|
7923
|
+
),
|
|
7924
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorMessage_default, { error }),
|
|
7925
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7926
|
+
PopoverContentBase,
|
|
7927
|
+
{
|
|
7928
|
+
className: center ? centeredPopoverClass : basePopoverClass,
|
|
7929
|
+
children: renderPickerContent()
|
|
7930
|
+
}
|
|
7931
|
+
)
|
|
7754
7932
|
] })
|
|
7755
7933
|
] });
|
|
7756
7934
|
}
|
|
@@ -7760,8 +7938,8 @@ var React38 = __toESM(require("react"));
|
|
|
7760
7938
|
var import_react_day_picker3 = require("react-day-picker");
|
|
7761
7939
|
var import_pt_BR = __toESM(require("date-fns/locale/pt-BR"));
|
|
7762
7940
|
var import_date_fns2 = require("date-fns");
|
|
7763
|
-
var
|
|
7764
|
-
var
|
|
7941
|
+
var import_react45 = require("@phosphor-icons/react");
|
|
7942
|
+
var import_framer_motion11 = require("framer-motion");
|
|
7765
7943
|
var import_ssr3 = require("@phosphor-icons/react/dist/ssr");
|
|
7766
7944
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
7767
7945
|
var dateFnsLocale = import_pt_BR.default?.default ?? import_pt_BR.default;
|
|
@@ -7789,6 +7967,9 @@ function RangePicker({
|
|
|
7789
7967
|
setRange(void 0);
|
|
7790
7968
|
onChange?.(void 0);
|
|
7791
7969
|
};
|
|
7970
|
+
const { ref: contentRef, center } = use_auto_center_default(open);
|
|
7971
|
+
const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border shadow-none";
|
|
7972
|
+
const centeredPopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border shadow-none fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-50";
|
|
7792
7973
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
7793
7974
|
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(LabelBase_default, { children: label }),
|
|
7794
7975
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
@@ -7830,28 +8011,33 @@ function RangePicker({
|
|
|
7830
8011
|
}
|
|
7831
8012
|
}
|
|
7832
8013
|
),
|
|
7833
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8014
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react45.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
7834
8015
|
]
|
|
7835
8016
|
}
|
|
7836
8017
|
)
|
|
7837
8018
|
}
|
|
7838
8019
|
),
|
|
7839
8020
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ErrorMessage_default, { error }),
|
|
7840
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8021
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_framer_motion11.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7841
8022
|
PopoverContentBase,
|
|
7842
8023
|
{
|
|
7843
8024
|
asChild: true,
|
|
7844
|
-
className:
|
|
8025
|
+
className: center ? centeredPopoverClass : basePopoverClass,
|
|
8026
|
+
side: "top",
|
|
8027
|
+
align: "center",
|
|
8028
|
+
sideOffset: -240,
|
|
7845
8029
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
7846
|
-
|
|
8030
|
+
import_framer_motion11.motion.div,
|
|
7847
8031
|
{
|
|
7848
|
-
|
|
8032
|
+
ref: contentRef,
|
|
8033
|
+
initial: { opacity: 0, y: -4 },
|
|
7849
8034
|
animate: { opacity: 1, y: 0 },
|
|
7850
|
-
exit: { opacity: 0, y:
|
|
8035
|
+
exit: { opacity: 0, y: -4 },
|
|
7851
8036
|
transition: { duration: 0.18, ease: "easeOut" },
|
|
8037
|
+
className: "border rounded-md shadow-xl ",
|
|
7852
8038
|
children: [
|
|
7853
8039
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7854
|
-
|
|
8040
|
+
import_framer_motion11.motion.div,
|
|
7855
8041
|
{
|
|
7856
8042
|
initial: { opacity: 0, y: 8 },
|
|
7857
8043
|
animate: { opacity: 1, y: 0 },
|
|
@@ -7866,50 +8052,59 @@ function RangePicker({
|
|
|
7866
8052
|
onSelect: handleSelect,
|
|
7867
8053
|
locale: dateFnsLocale,
|
|
7868
8054
|
showOutsideDays: true,
|
|
7869
|
-
|
|
7870
|
-
|
|
8055
|
+
fixedWeeks: true,
|
|
8056
|
+
weekStartsOn: 1,
|
|
8057
|
+
navLayout: "around",
|
|
8058
|
+
hidden: minDate || maxDate ? {
|
|
8059
|
+
before: minDate,
|
|
8060
|
+
after: maxDate
|
|
8061
|
+
} : void 0,
|
|
7871
8062
|
className: "min-w-0 flex flex-col",
|
|
7872
8063
|
classNames: {
|
|
7873
8064
|
months: "flex flex-col sm:flex-row gap-3 sm:gap-4 w-full",
|
|
7874
|
-
month: "flex-1 min-w-0",
|
|
7875
|
-
|
|
7876
|
-
caption_label: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize
|
|
7877
|
-
nav: "
|
|
7878
|
-
|
|
8065
|
+
month: "relative flex-1 min-w-0",
|
|
8066
|
+
month_caption: "flex items-center gap-2 min-h-[2.25rem] mb-4",
|
|
8067
|
+
caption_label: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize",
|
|
8068
|
+
nav: "block",
|
|
8069
|
+
button_previous: cn(
|
|
7879
8070
|
buttonVariantsBase({ variant: "outline" }),
|
|
7880
|
-
"h-8 w-8
|
|
8071
|
+
"h-8 w-8 flex items-center justify-center p-0 rounded-md transition-transform duration-150 ease-out focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/40 active:scale-95 absolute right-11 top-0 z-10"
|
|
7881
8072
|
),
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
"
|
|
8073
|
+
button_next: cn(
|
|
8074
|
+
buttonVariantsBase({ variant: "outline" }),
|
|
8075
|
+
"h-8 w-8 flex items-center justify-center p-0 rounded-md transition-transform duration-150 ease-out focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/40 active:scale-95 absolute right-0 top-0 z-10"
|
|
8076
|
+
),
|
|
8077
|
+
month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
|
|
8078
|
+
weekdays: "grid grid-cols-7 gap-1 mb-1",
|
|
8079
|
+
weekday: "text-muted-foreground rounded-md font-semibold text-[clamp(0.575rem,1.2vw,0.75rem)] sm:text-[clamp(0.65rem,1.1vw,0.825rem)] text-center pb-1 uppercase tracking-wider",
|
|
8080
|
+
week: "grid grid-cols-7 gap-1",
|
|
8081
|
+
day: cn(
|
|
8082
|
+
"min-w-0 h-9 sm:h-10 md:h-10 p-0 relative flex items-center justify-center",
|
|
8083
|
+
"[&:has([aria-selected].range-end)]:rounded-r-lg",
|
|
8084
|
+
"[&:has([aria-selected].range-start)]:rounded-l-lg",
|
|
7892
8085
|
"[&:has([aria-selected].day-outside)]:bg-muted/50",
|
|
7893
8086
|
"[&:has([aria-selected])]:bg-muted"
|
|
7894
8087
|
),
|
|
7895
|
-
|
|
8088
|
+
day_button: cn(
|
|
7896
8089
|
buttonVariantsBase({ variant: "ghost" }),
|
|
7897
8090
|
"w-full h-full p-0 m-0 flex items-center justify-center text-[clamp(0.775rem,1.2vw,0.95rem)] sm:text-sm",
|
|
7898
|
-
"aria-selected:opacity-100
|
|
8091
|
+
"aria-selected:opacity-100 transition-all duration-150 ease-out active:scale-95 hover:bg-background/20 hover:text-primary/90 rounded-none "
|
|
7899
8092
|
),
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
8093
|
+
selected: "bg-primary text-primary-foreground font-semibold hover:text-white",
|
|
8094
|
+
today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
|
|
8095
|
+
outside: "day-outside text-muted-foreground/40 opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
|
|
8096
|
+
disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
|
|
8097
|
+
range_start: "range-start rounded-l-lg aria-selected:bg-primary aria-selected:text-primary-foreground",
|
|
8098
|
+
range_end: "range-end rounded-r-lg aria-selected:bg-primary aria-selected:text-primary-foreground",
|
|
8099
|
+
range_middle: "range-middle rounded-none aria-selected:bg-muted aria-selected:text-foreground",
|
|
8100
|
+
hidden: "invisible"
|
|
7906
8101
|
},
|
|
7907
8102
|
components: {
|
|
7908
8103
|
Chevron: ({ orientation }) => {
|
|
7909
8104
|
if (orientation === "left") {
|
|
7910
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react45.CaretLeftIcon, { className: "h-4 w-4" });
|
|
7911
8106
|
}
|
|
7912
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react45.CaretRightIcon, { className: "h-4 w-4" });
|
|
7913
8108
|
}
|
|
7914
8109
|
}
|
|
7915
8110
|
}
|
|
@@ -7918,7 +8113,7 @@ function RangePicker({
|
|
|
7918
8113
|
) }),
|
|
7919
8114
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex justify-end gap-2 px-4 pb-4", children: [
|
|
7920
8115
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { style: { display: "inline-block" }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7921
|
-
|
|
8116
|
+
import_framer_motion11.motion.div,
|
|
7922
8117
|
{
|
|
7923
8118
|
whileHover: { scale: 1.03 },
|
|
7924
8119
|
whileTap: { scale: 0.95 },
|
|
@@ -7938,7 +8133,7 @@ function RangePicker({
|
|
|
7938
8133
|
}
|
|
7939
8134
|
) }),
|
|
7940
8135
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { style: { display: "inline-block" }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7941
|
-
|
|
8136
|
+
import_framer_motion11.motion.div,
|
|
7942
8137
|
{
|
|
7943
8138
|
whileHover: { scale: 1.03 },
|
|
7944
8139
|
whileTap: { scale: 0.95 },
|
|
@@ -7955,19 +8150,23 @@ function RangePicker({
|
|
|
7955
8150
|
}
|
|
7956
8151
|
) }),
|
|
7957
8152
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { style: { display: "inline-block", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7958
|
-
|
|
8153
|
+
import_framer_motion11.motion.div,
|
|
7959
8154
|
{
|
|
7960
8155
|
whileHover: { scale: 1.02 },
|
|
7961
8156
|
whileTap: { scale: 0.98 },
|
|
7962
8157
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7963
8158
|
ButtonBase,
|
|
7964
8159
|
{
|
|
7965
|
-
className:
|
|
8160
|
+
className: cn(
|
|
8161
|
+
"font-semibold w-full text-center",
|
|
8162
|
+
range?.from && range?.to ? "bg-emerald-600 hover:bg-emerald-700 text-white" : "opacity-50 cursor-not-allowed"
|
|
8163
|
+
),
|
|
8164
|
+
disabled: !range?.from || !range?.to,
|
|
7966
8165
|
onClick: () => {
|
|
8166
|
+
if (!range?.from || !range?.to) return;
|
|
7967
8167
|
onConfirm?.(range);
|
|
7968
8168
|
setOpen(false);
|
|
7969
8169
|
},
|
|
7970
|
-
disabled: !range?.from || !range?.to,
|
|
7971
8170
|
children: "Selecionar"
|
|
7972
8171
|
}
|
|
7973
8172
|
)
|
|
@@ -7985,12 +8184,12 @@ function RangePicker({
|
|
|
7985
8184
|
RangePicker.displayName = "RangePicker";
|
|
7986
8185
|
|
|
7987
8186
|
// src/components/ui/picker/TimePicker.tsx
|
|
7988
|
-
var
|
|
8187
|
+
var import_framer_motion12 = require("framer-motion");
|
|
7989
8188
|
var React40 = __toESM(require("react"));
|
|
7990
8189
|
|
|
7991
8190
|
// src/components/ui/picker/TimePickerInput.tsx
|
|
7992
|
-
var
|
|
7993
|
-
var
|
|
8191
|
+
var import_react46 = require("@phosphor-icons/react");
|
|
8192
|
+
var import_react47 = __toESM(require("react"));
|
|
7994
8193
|
|
|
7995
8194
|
// src/components/ui/picker/utils/time-picker-utils.ts
|
|
7996
8195
|
function isValidHour(value) {
|
|
@@ -8133,7 +8332,7 @@ function display12HourValue(hours) {
|
|
|
8133
8332
|
|
|
8134
8333
|
// src/components/ui/picker/TimePickerInput.tsx
|
|
8135
8334
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
8136
|
-
var TimePickerInput =
|
|
8335
|
+
var TimePickerInput = import_react47.default.forwardRef(
|
|
8137
8336
|
({
|
|
8138
8337
|
className,
|
|
8139
8338
|
type = "tel",
|
|
@@ -8152,10 +8351,10 @@ var TimePickerInput = import_react45.default.forwardRef(
|
|
|
8152
8351
|
label,
|
|
8153
8352
|
...props
|
|
8154
8353
|
}, ref) => {
|
|
8155
|
-
const [flag, setFlag] =
|
|
8156
|
-
const [prevIntKey, setPrevIntKey] =
|
|
8157
|
-
const [isFocused, setIsFocused] =
|
|
8158
|
-
|
|
8354
|
+
const [flag, setFlag] = import_react47.default.useState(false);
|
|
8355
|
+
const [prevIntKey, setPrevIntKey] = import_react47.default.useState("0");
|
|
8356
|
+
const [isFocused, setIsFocused] = import_react47.default.useState(false);
|
|
8357
|
+
import_react47.default.useEffect(() => {
|
|
8159
8358
|
if (flag) {
|
|
8160
8359
|
const timer = setTimeout(() => {
|
|
8161
8360
|
setFlag(false);
|
|
@@ -8163,7 +8362,7 @@ var TimePickerInput = import_react45.default.forwardRef(
|
|
|
8163
8362
|
return () => clearTimeout(timer);
|
|
8164
8363
|
}
|
|
8165
8364
|
}, [flag]);
|
|
8166
|
-
const calculatedValue =
|
|
8365
|
+
const calculatedValue = import_react47.default.useMemo(() => {
|
|
8167
8366
|
const safeDate = date ?? new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
|
|
8168
8367
|
return getDateByType(safeDate, picker);
|
|
8169
8368
|
}, [date, picker]);
|
|
@@ -8259,7 +8458,7 @@ var TimePickerInput = import_react45.default.forwardRef(
|
|
|
8259
8458
|
),
|
|
8260
8459
|
tabIndex: -1,
|
|
8261
8460
|
"aria-label": `Incrementar ${getPickerLabel().toLowerCase()}`,
|
|
8262
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8461
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react46.CaretUpIcon, { size: 14, className: "sm:w-4 sm:h-4" })
|
|
8263
8462
|
}
|
|
8264
8463
|
),
|
|
8265
8464
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "relative", children: [
|
|
@@ -8326,7 +8525,7 @@ var TimePickerInput = import_react45.default.forwardRef(
|
|
|
8326
8525
|
),
|
|
8327
8526
|
tabIndex: -1,
|
|
8328
8527
|
"aria-label": `Decrementar ${getPickerLabel().toLowerCase()}`,
|
|
8329
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react46.CaretDownIcon, { size: 14, className: "sm:w-4 sm:h-4" })
|
|
8330
8529
|
}
|
|
8331
8530
|
)
|
|
8332
8531
|
]
|
|
@@ -8364,7 +8563,7 @@ function TimePicker({
|
|
|
8364
8563
|
visible: { opacity: 1, y: 0 }
|
|
8365
8564
|
};
|
|
8366
8565
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
8367
|
-
|
|
8566
|
+
import_framer_motion12.motion.div,
|
|
8368
8567
|
{
|
|
8369
8568
|
variants: containerVariants,
|
|
8370
8569
|
initial: "hidden",
|
|
@@ -8372,7 +8571,7 @@ function TimePicker({
|
|
|
8372
8571
|
className: "flex items-end justify-center gap-2 sm:gap-3 p-2 sm:p-3 md:p-4 rounded-lg bg-muted/20 border border-border/50 w-full max-w-full overflow-hidden",
|
|
8373
8572
|
children: [
|
|
8374
8573
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
8375
|
-
|
|
8574
|
+
import_framer_motion12.motion.div,
|
|
8376
8575
|
{
|
|
8377
8576
|
variants: itemVariants2,
|
|
8378
8577
|
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
@@ -8390,7 +8589,7 @@ function TimePicker({
|
|
|
8390
8589
|
}
|
|
8391
8590
|
),
|
|
8392
8591
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
8393
|
-
|
|
8592
|
+
import_framer_motion12.motion.div,
|
|
8394
8593
|
{
|
|
8395
8594
|
variants: itemVariants2,
|
|
8396
8595
|
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
@@ -8408,8 +8607,8 @@ function TimePicker({
|
|
|
8408
8607
|
)
|
|
8409
8608
|
}
|
|
8410
8609
|
),
|
|
8411
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
8412
|
-
|
|
8610
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_framer_motion12.AnimatePresence, { children: !hideSeconds && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_jsx_runtime61.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
8611
|
+
import_framer_motion12.motion.div,
|
|
8413
8612
|
{
|
|
8414
8613
|
variants: itemVariants2,
|
|
8415
8614
|
initial: "hidden",
|
|
@@ -8436,9 +8635,9 @@ function TimePicker({
|
|
|
8436
8635
|
|
|
8437
8636
|
// src/components/ui/event-calendar-view/Agenda.tsx
|
|
8438
8637
|
var import_date_fns3 = require("date-fns");
|
|
8439
|
-
var
|
|
8440
|
-
var
|
|
8441
|
-
var
|
|
8638
|
+
var import_locale3 = require("date-fns/locale");
|
|
8639
|
+
var import_react48 = require("react");
|
|
8640
|
+
var import_react49 = require("@phosphor-icons/react");
|
|
8442
8641
|
var import_tailwind_merge2 = require("tailwind-merge");
|
|
8443
8642
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
8444
8643
|
function Agenda({
|
|
@@ -8455,15 +8654,15 @@ function Agenda({
|
|
|
8455
8654
|
return false;
|
|
8456
8655
|
}
|
|
8457
8656
|
};
|
|
8458
|
-
const datedEvents = (0,
|
|
8657
|
+
const datedEvents = (0, import_react48.useMemo)(
|
|
8459
8658
|
() => events.filter((e) => isValidDate5(e.start) || isValidDate5(e.end)),
|
|
8460
8659
|
[events]
|
|
8461
8660
|
);
|
|
8462
|
-
const undatedEvents = (0,
|
|
8661
|
+
const undatedEvents = (0, import_react48.useMemo)(
|
|
8463
8662
|
() => events.filter((e) => !(isValidDate5(e.start) || isValidDate5(e.end))),
|
|
8464
8663
|
[events]
|
|
8465
8664
|
);
|
|
8466
|
-
const days = (0,
|
|
8665
|
+
const days = (0, import_react48.useMemo)(() => {
|
|
8467
8666
|
const start = (0, import_date_fns3.startOfMonth)(new Date(currentDate));
|
|
8468
8667
|
const end = (0, import_date_fns3.endOfMonth)(new Date(currentDate));
|
|
8469
8668
|
return (0, import_date_fns3.eachDayOfInterval)({ start, end });
|
|
@@ -8476,7 +8675,7 @@ function Agenda({
|
|
|
8476
8675
|
(day) => getAgendaEventsForDayAgenda(datedEvents, day).length > 0
|
|
8477
8676
|
);
|
|
8478
8677
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "border-border/70 border-t px-4", children: !hasEvents && !(showUndatedEvents && undatedEvents.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center px-4", children: [
|
|
8479
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8678
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react49.CalendarIcon, { className: "mb-2 text-muted-foreground/50", size: 32 }),
|
|
8480
8679
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h3", { className: "font-semibold text-sm sm:text-base md:text-lg lg:text-xl min-w-0 truncate sm:whitespace-normal", children: "Nenhum evento encontrado" }),
|
|
8481
8680
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-muted-foreground text-sm sm:text-base md:text-md max-w-prose", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
|
|
8482
8681
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
@@ -8495,13 +8694,13 @@ function Agenda({
|
|
|
8495
8694
|
"span",
|
|
8496
8695
|
{
|
|
8497
8696
|
className: (0, import_tailwind_merge2.twMerge)(
|
|
8498
|
-
"-top-3 absolute left-0 flex h-6 items-center bg-background pe-4
|
|
8697
|
+
"-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 data-today:font-extrabold sm:pe-4 text-sm sm:text-md md:text-md font-bold min-w-0",
|
|
8499
8698
|
(0, import_date_fns3.isToday)(day) ? "text-blue-500" : ""
|
|
8500
8699
|
),
|
|
8501
8700
|
"data-today": (0, import_date_fns3.isToday)(day) || void 0,
|
|
8502
8701
|
children: [
|
|
8503
8702
|
(() => {
|
|
8504
|
-
const s = (0, import_date_fns3.format)(day, "d MMM, EEEE", { locale:
|
|
8703
|
+
const s = (0, import_date_fns3.format)(day, "d MMM, EEEE", { locale: import_locale3.ptBR });
|
|
8505
8704
|
return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
|
|
8506
8705
|
})(),
|
|
8507
8706
|
(0, import_date_fns3.isToday)(day) ? " - Hoje" : ""
|
|
@@ -8538,11 +8737,11 @@ function Agenda({
|
|
|
8538
8737
|
// src/components/ui/event-calendar-view/CalendarDND.tsx
|
|
8539
8738
|
var import_core = require("@dnd-kit/core");
|
|
8540
8739
|
var import_date_fns4 = require("date-fns");
|
|
8541
|
-
var
|
|
8740
|
+
var import_react51 = require("react");
|
|
8542
8741
|
|
|
8543
8742
|
// src/components/ui/event-calendar-view/hooks.ts
|
|
8544
|
-
var
|
|
8545
|
-
var CalendarDndContext = (0,
|
|
8743
|
+
var import_react50 = require("react");
|
|
8744
|
+
var CalendarDndContext = (0, import_react50.createContext)({
|
|
8546
8745
|
activeEvent: null,
|
|
8547
8746
|
activeId: null,
|
|
8548
8747
|
activeView: null,
|
|
@@ -8552,7 +8751,7 @@ var CalendarDndContext = (0, import_react48.createContext)({
|
|
|
8552
8751
|
isMultiDay: false,
|
|
8553
8752
|
multiDayWidth: null
|
|
8554
8753
|
});
|
|
8555
|
-
var useCalendarDndAgenda = () => (0,
|
|
8754
|
+
var useCalendarDndAgenda = () => (0, import_react50.useContext)(CalendarDndContext);
|
|
8556
8755
|
|
|
8557
8756
|
// src/components/ui/event-calendar-view/CalendarDND.tsx
|
|
8558
8757
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
@@ -8560,19 +8759,19 @@ function CalendarDndProviderAgenda({
|
|
|
8560
8759
|
children,
|
|
8561
8760
|
onEventUpdate
|
|
8562
8761
|
}) {
|
|
8563
|
-
const [activeEvent, setActiveEvent] = (0,
|
|
8762
|
+
const [activeEvent, setActiveEvent] = (0, import_react51.useState)(
|
|
8564
8763
|
null
|
|
8565
8764
|
);
|
|
8566
|
-
const [activeId, setActiveId] = (0,
|
|
8567
|
-
const [activeView, setActiveView] = (0,
|
|
8765
|
+
const [activeId, setActiveId] = (0, import_react51.useState)(null);
|
|
8766
|
+
const [activeView, setActiveView] = (0, import_react51.useState)(
|
|
8568
8767
|
null
|
|
8569
8768
|
);
|
|
8570
|
-
const [currentTime, setCurrentTime] = (0,
|
|
8571
|
-
const [eventHeight, setEventHeight] = (0,
|
|
8572
|
-
const [isMultiDay, setIsMultiDay] = (0,
|
|
8573
|
-
const [multiDayWidth, setMultiDayWidth] = (0,
|
|
8574
|
-
const [dragHandlePosition, setDragHandlePosition] = (0,
|
|
8575
|
-
const eventDimensions = (0,
|
|
8769
|
+
const [currentTime, setCurrentTime] = (0, import_react51.useState)(null);
|
|
8770
|
+
const [eventHeight, setEventHeight] = (0, import_react51.useState)(null);
|
|
8771
|
+
const [isMultiDay, setIsMultiDay] = (0, import_react51.useState)(false);
|
|
8772
|
+
const [multiDayWidth, setMultiDayWidth] = (0, import_react51.useState)(null);
|
|
8773
|
+
const [dragHandlePosition, setDragHandlePosition] = (0, import_react51.useState)(null);
|
|
8774
|
+
const eventDimensions = (0, import_react51.useRef)({ height: 0 });
|
|
8576
8775
|
const sensors = (0, import_core.useSensors)(
|
|
8577
8776
|
(0, import_core.useSensor)(import_core.MouseSensor, {
|
|
8578
8777
|
// Require the mouse to move by 5px before activating
|
|
@@ -8594,7 +8793,7 @@ function CalendarDndProviderAgenda({
|
|
|
8594
8793
|
}
|
|
8595
8794
|
})
|
|
8596
8795
|
);
|
|
8597
|
-
const dndContextId = (0,
|
|
8796
|
+
const dndContextId = (0, import_react51.useId)();
|
|
8598
8797
|
const handleDragStart = (event) => {
|
|
8599
8798
|
const { active } = event;
|
|
8600
8799
|
if (!active.data.current) {
|
|
@@ -8792,7 +8991,7 @@ var DefaultEndHourAgenda = 10;
|
|
|
8792
8991
|
|
|
8793
8992
|
// src/components/ui/event-calendar-view/DayView.tsx
|
|
8794
8993
|
var import_date_fns8 = require("date-fns");
|
|
8795
|
-
var
|
|
8994
|
+
var import_react54 = require("react");
|
|
8796
8995
|
|
|
8797
8996
|
// src/components/ui/event-calendar-view/utils.ts
|
|
8798
8997
|
var import_date_fns5 = require("date-fns");
|
|
@@ -8922,12 +9121,12 @@ function addHoursToDateAgenda(date, hours) {
|
|
|
8922
9121
|
|
|
8923
9122
|
// src/components/ui/event-calendar-view/hooks/use-current-time-indicator.ts
|
|
8924
9123
|
var import_date_fns6 = require("date-fns");
|
|
8925
|
-
var
|
|
8926
|
-
var
|
|
9124
|
+
var import_locale4 = require("date-fns/locale");
|
|
9125
|
+
var import_react52 = require("react");
|
|
8927
9126
|
function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
8928
|
-
const [currentTimePosition, setCurrentTimePosition] = (0,
|
|
8929
|
-
const [currentTimeVisible, setCurrentTimeVisible] = (0,
|
|
8930
|
-
(0,
|
|
9127
|
+
const [currentTimePosition, setCurrentTimePosition] = (0, import_react52.useState)(0);
|
|
9128
|
+
const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react52.useState)(false);
|
|
9129
|
+
(0, import_react52.useEffect)(() => {
|
|
8931
9130
|
const calculateTimePosition = () => {
|
|
8932
9131
|
const now = /* @__PURE__ */ new Date();
|
|
8933
9132
|
const hours = now.getHours();
|
|
@@ -8940,8 +9139,8 @@ function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
|
8940
9139
|
if (view === "day") {
|
|
8941
9140
|
isCurrentTimeVisible = (0, import_date_fns6.isSameDay)(now, currentDate);
|
|
8942
9141
|
} else if (view === "week") {
|
|
8943
|
-
const startOfWeekDate = (0, import_date_fns6.startOfWeek)(currentDate, { locale:
|
|
8944
|
-
const endOfWeekDate = (0, import_date_fns6.endOfWeek)(currentDate, { locale:
|
|
9142
|
+
const startOfWeekDate = (0, import_date_fns6.startOfWeek)(currentDate, { locale: import_locale4.ptBR });
|
|
9143
|
+
const endOfWeekDate = (0, import_date_fns6.endOfWeek)(currentDate, { locale: import_locale4.ptBR });
|
|
8945
9144
|
isCurrentTimeVisible = (0, import_date_fns6.isWithinInterval)(now, {
|
|
8946
9145
|
end: endOfWeekDate,
|
|
8947
9146
|
start: startOfWeekDate
|
|
@@ -8959,7 +9158,7 @@ function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
|
8959
9158
|
|
|
8960
9159
|
// src/components/ui/event-calendar-view/EventItemAgenda.tsx
|
|
8961
9160
|
var import_date_fns7 = require("date-fns");
|
|
8962
|
-
var
|
|
9161
|
+
var import_react53 = require("react");
|
|
8963
9162
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
8964
9163
|
var formatTimeWithOptionalMinutes = (date) => {
|
|
8965
9164
|
return (0, import_date_fns7.format)(date, "HH:mm");
|
|
@@ -9041,13 +9240,13 @@ function EventItemAgenda({
|
|
|
9041
9240
|
const endDate = getEventEndDate(event);
|
|
9042
9241
|
const hasValidTime = !!startDate || !!endDate;
|
|
9043
9242
|
const colorClasses = hasValidTime ? getEventColorClassesAgenda(eventColor) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
|
|
9044
|
-
const displayStart = (0,
|
|
9243
|
+
const displayStart = (0, import_react53.useMemo)(() => {
|
|
9045
9244
|
if (!hasValidTime) return void 0;
|
|
9046
9245
|
if (startDate) return currentTime || startDate;
|
|
9047
9246
|
if (endDate) return currentTime || endDate;
|
|
9048
9247
|
return void 0;
|
|
9049
9248
|
}, [currentTime, startDate, endDate, hasValidTime]);
|
|
9050
|
-
const displayEnd = (0,
|
|
9249
|
+
const displayEnd = (0, import_react53.useMemo)(() => {
|
|
9051
9250
|
if (!hasValidTime) return void 0;
|
|
9052
9251
|
if (endDate) {
|
|
9053
9252
|
return currentTime ? new Date(
|
|
@@ -9059,7 +9258,7 @@ function EventItemAgenda({
|
|
|
9059
9258
|
}
|
|
9060
9259
|
return void 0;
|
|
9061
9260
|
}, [currentTime, startDate, endDate, hasValidTime]);
|
|
9062
|
-
const durationMinutes = (0,
|
|
9261
|
+
const durationMinutes = (0, import_react53.useMemo)(() => {
|
|
9063
9262
|
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
9064
9263
|
return (0, import_date_fns7.differenceInMinutes)(displayEnd, displayStart);
|
|
9065
9264
|
}, [displayStart, displayEnd, hasValidTime]);
|
|
@@ -9307,14 +9506,14 @@ function DayViewAgenda({
|
|
|
9307
9506
|
onEventSelect,
|
|
9308
9507
|
showUndatedEvents
|
|
9309
9508
|
}) {
|
|
9310
|
-
const hours = (0,
|
|
9509
|
+
const hours = (0, import_react54.useMemo)(() => {
|
|
9311
9510
|
const dayStart = (0, import_date_fns8.startOfDay)(currentDate);
|
|
9312
9511
|
return (0, import_date_fns8.eachHourOfInterval)({
|
|
9313
9512
|
end: (0, import_date_fns8.addHours)(dayStart, EndHourAgenda - 1),
|
|
9314
9513
|
start: (0, import_date_fns8.addHours)(dayStart, StartHourAgenda)
|
|
9315
9514
|
});
|
|
9316
9515
|
}, [currentDate]);
|
|
9317
|
-
const dayEvents = (0,
|
|
9516
|
+
const dayEvents = (0, import_react54.useMemo)(() => {
|
|
9318
9517
|
return events.filter((event) => {
|
|
9319
9518
|
if (event.start == null) return false;
|
|
9320
9519
|
const eventStart = getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
@@ -9324,17 +9523,17 @@ function DayViewAgenda({
|
|
|
9324
9523
|
(a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()
|
|
9325
9524
|
);
|
|
9326
9525
|
}, [currentDate, events]);
|
|
9327
|
-
const allDayEvents = (0,
|
|
9526
|
+
const allDayEvents = (0, import_react54.useMemo)(() => {
|
|
9328
9527
|
return dayEvents.filter((event) => {
|
|
9329
9528
|
return event.allDay || isMultiDayEventAgenda(event);
|
|
9330
9529
|
});
|
|
9331
9530
|
}, [dayEvents]);
|
|
9332
|
-
const timeEvents = (0,
|
|
9531
|
+
const timeEvents = (0, import_react54.useMemo)(() => {
|
|
9333
9532
|
return dayEvents.filter((event) => {
|
|
9334
9533
|
return !event.allDay && !isMultiDayEventAgenda(event);
|
|
9335
9534
|
});
|
|
9336
9535
|
}, [dayEvents]);
|
|
9337
|
-
const positionedEvents = (0,
|
|
9536
|
+
const positionedEvents = (0, import_react54.useMemo)(() => {
|
|
9338
9537
|
const result = [];
|
|
9339
9538
|
const dayStart = (0, import_date_fns8.startOfDay)(currentDate);
|
|
9340
9539
|
const sortedEvents = [...timeEvents].sort((a, b) => {
|
|
@@ -9531,14 +9730,14 @@ function DayViewAgenda({
|
|
|
9531
9730
|
|
|
9532
9731
|
// src/components/ui/event-calendar-view/EventAgenda.tsx
|
|
9533
9732
|
var import_date_fns9 = require("date-fns");
|
|
9534
|
-
var
|
|
9535
|
-
var
|
|
9733
|
+
var import_locale5 = require("date-fns/locale");
|
|
9734
|
+
var import_react57 = __toESM(require("react"));
|
|
9536
9735
|
var import_sonner2 = require("sonner");
|
|
9537
|
-
var
|
|
9736
|
+
var import_react58 = require("@phosphor-icons/react");
|
|
9538
9737
|
|
|
9539
9738
|
// src/components/ui/selects/Select.tsx
|
|
9540
|
-
var
|
|
9541
|
-
var
|
|
9739
|
+
var import_react55 = require("react");
|
|
9740
|
+
var import_react56 = require("@phosphor-icons/react");
|
|
9542
9741
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
9543
9742
|
function Select({
|
|
9544
9743
|
items,
|
|
@@ -9554,13 +9753,13 @@ function Select({
|
|
|
9554
9753
|
className,
|
|
9555
9754
|
pagination
|
|
9556
9755
|
}) {
|
|
9557
|
-
const [page, setPage] = (0,
|
|
9558
|
-
const [animating, setAnimating] = (0,
|
|
9756
|
+
const [page, setPage] = (0, import_react55.useState)(1);
|
|
9757
|
+
const [animating, setAnimating] = (0, import_react55.useState)(false);
|
|
9559
9758
|
const groupCount = groupItems ? Object.keys(groupItems).length : 0;
|
|
9560
|
-
(0,
|
|
9759
|
+
(0, import_react55.useEffect)(() => {
|
|
9561
9760
|
setPage(1);
|
|
9562
9761
|
}, [items?.length, groupCount, pagination]);
|
|
9563
|
-
const paged = (0,
|
|
9762
|
+
const paged = (0, import_react55.useMemo)(() => {
|
|
9564
9763
|
if (!pagination || pagination <= 0) return null;
|
|
9565
9764
|
if (groupItems) {
|
|
9566
9765
|
const flattened = Object.keys(groupItems).flatMap(
|
|
@@ -9587,7 +9786,7 @@ function Select({
|
|
|
9587
9786
|
}, [items, groupItems, page, pagination]);
|
|
9588
9787
|
const goPrev = () => setPage((p) => Math.max(1, p - 1));
|
|
9589
9788
|
const goNext = () => setPage((p) => paged ? Math.min(paged.totalPages, p + 1) : p + 1);
|
|
9590
|
-
(0,
|
|
9789
|
+
(0, import_react55.useEffect)(() => {
|
|
9591
9790
|
if (!pagination) return;
|
|
9592
9791
|
setAnimating(true);
|
|
9593
9792
|
const id = setTimeout(() => setAnimating(false), 220);
|
|
@@ -9677,7 +9876,7 @@ function Select({
|
|
|
9677
9876
|
"data-testid": testIds.paginationPrev ?? "select-pagination-prev",
|
|
9678
9877
|
"aria-label": "Previous page",
|
|
9679
9878
|
className: "text-xs px-2 py-1 rounded disabled:opacity-50 flex items-center gap-2 hover:scale-105 active:scale-95 transition-transform",
|
|
9680
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9879
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react56.CaretLeftIcon, { className: "h-4 w-4 opacity-80" })
|
|
9681
9880
|
}
|
|
9682
9881
|
),
|
|
9683
9882
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: " flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "px-2 py-0.5 rounded bg-gray-100 dark:bg-slate-800 text-xs", children: `${page} / ${paged.totalPages}` }) }),
|
|
@@ -9690,7 +9889,7 @@ function Select({
|
|
|
9690
9889
|
"data-testid": testIds.paginationNext ?? "select-pagination-next",
|
|
9691
9890
|
"aria-label": "Next page",
|
|
9692
9891
|
className: "text-xs px-2 py-1 rounded disabled:opacity-50 flex items-center gap-2 hover:scale-105 active:scale-95 transition-transform",
|
|
9693
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9892
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react56.CaretRightIcon, { className: "h-4 w-4 opacity-80" })
|
|
9694
9893
|
}
|
|
9695
9894
|
)
|
|
9696
9895
|
] })
|
|
@@ -9750,11 +9949,11 @@ function EventAgenda({
|
|
|
9750
9949
|
initialDate,
|
|
9751
9950
|
onClick
|
|
9752
9951
|
}) {
|
|
9753
|
-
const [currentDate, setCurrentDate] = (0,
|
|
9952
|
+
const [currentDate, setCurrentDate] = (0, import_react57.useState)(
|
|
9754
9953
|
initialDate && new Date(initialDate) || /* @__PURE__ */ new Date()
|
|
9755
9954
|
);
|
|
9756
|
-
const [view, setView] = (0,
|
|
9757
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
9955
|
+
const [view, setView] = (0, import_react57.useState)(initialView);
|
|
9956
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react57.useState)(null);
|
|
9758
9957
|
const goPrevious = () => {
|
|
9759
9958
|
if (view === "month") setCurrentDate((d) => (0, import_date_fns9.subMonths)(d, 1));
|
|
9760
9959
|
else if (view === "week") setCurrentDate((d) => (0, import_date_fns9.subWeeks)(d, 1));
|
|
@@ -9778,7 +9977,7 @@ function EventAgenda({
|
|
|
9778
9977
|
);
|
|
9779
9978
|
return;
|
|
9780
9979
|
}
|
|
9781
|
-
if (
|
|
9980
|
+
if (import_react57.default.isValidElement(onClick)) {
|
|
9782
9981
|
setSelectedEvent(event);
|
|
9783
9982
|
return;
|
|
9784
9983
|
}
|
|
@@ -9796,7 +9995,7 @@ function EventAgenda({
|
|
|
9796
9995
|
onEventUpdate?.(updatedEvent);
|
|
9797
9996
|
const startDate = new Date(updatedEvent.start);
|
|
9798
9997
|
(0, import_sonner2.toast)(`Evento "${updatedEvent.title}" movido`, {
|
|
9799
|
-
description: (0, import_date_fns9.format)(startDate, "d 'de' MMMM 'de' yyyy", { locale:
|
|
9998
|
+
description: (0, import_date_fns9.format)(startDate, "d 'de' MMMM 'de' yyyy", { locale: import_locale5.ptBR }),
|
|
9800
9999
|
position: "bottom-left"
|
|
9801
10000
|
});
|
|
9802
10001
|
};
|
|
@@ -9810,26 +10009,26 @@ function EventAgenda({
|
|
|
9810
10009
|
const entry = labels[v] || { full: v, short: v };
|
|
9811
10010
|
return condensed ? entry.short : entry.full;
|
|
9812
10011
|
};
|
|
9813
|
-
const viewTitle = (0,
|
|
10012
|
+
const viewTitle = (0, import_react57.useMemo)(() => {
|
|
9814
10013
|
const capitalize = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
9815
10014
|
if (view === "month")
|
|
9816
|
-
return capitalize((0, import_date_fns9.format)(currentDate, "MMMM yyyy", { locale:
|
|
10015
|
+
return capitalize((0, import_date_fns9.format)(currentDate, "MMMM yyyy", { locale: import_locale5.ptBR }));
|
|
9817
10016
|
if (view === "week") {
|
|
9818
10017
|
const start = (0, import_date_fns9.startOfWeek)(currentDate, { weekStartsOn: 1 });
|
|
9819
10018
|
const end = (0, import_date_fns9.endOfWeek)(currentDate, { weekStartsOn: 1 });
|
|
9820
10019
|
if ((0, import_date_fns9.isSameMonth)(start, end))
|
|
9821
|
-
return capitalize((0, import_date_fns9.format)(start, "MMMM yyyy", { locale:
|
|
9822
|
-
const s1 = capitalize((0, import_date_fns9.format)(start, "MMM", { locale:
|
|
9823
|
-
const s2 = capitalize((0, import_date_fns9.format)(end, "MMM yyyy", { locale:
|
|
10020
|
+
return capitalize((0, import_date_fns9.format)(start, "MMMM yyyy", { locale: import_locale5.ptBR }));
|
|
10021
|
+
const s1 = capitalize((0, import_date_fns9.format)(start, "MMM", { locale: import_locale5.ptBR }));
|
|
10022
|
+
const s2 = capitalize((0, import_date_fns9.format)(end, "MMM yyyy", { locale: import_locale5.ptBR }));
|
|
9824
10023
|
return `${s1} - ${s2}`;
|
|
9825
10024
|
}
|
|
9826
10025
|
if (view === "day")
|
|
9827
|
-
return (0, import_date_fns9.format)(currentDate, "d 'de' MMMM 'de' yyyy", { locale:
|
|
10026
|
+
return (0, import_date_fns9.format)(currentDate, "d 'de' MMMM 'de' yyyy", { locale: import_locale5.ptBR });
|
|
9828
10027
|
if (view === "agenda") {
|
|
9829
10028
|
const start = currentDate;
|
|
9830
|
-
return capitalize((0, import_date_fns9.format)(start, "MMMM yyyy", { locale:
|
|
10029
|
+
return capitalize((0, import_date_fns9.format)(start, "MMMM yyyy", { locale: import_locale5.ptBR }));
|
|
9831
10030
|
}
|
|
9832
|
-
return capitalize((0, import_date_fns9.format)(currentDate, "MMMM yyyy", { locale:
|
|
10031
|
+
return capitalize((0, import_date_fns9.format)(currentDate, "MMMM yyyy", { locale: import_locale5.ptBR }));
|
|
9833
10032
|
}, [currentDate, view]);
|
|
9834
10033
|
const selectItems = ["month", "week", "day", "agenda"].map((v) => ({
|
|
9835
10034
|
label: viewLabel(v),
|
|
@@ -9859,7 +10058,7 @@ function EventAgenda({
|
|
|
9859
10058
|
onClick: goPrevious,
|
|
9860
10059
|
size: "icon",
|
|
9861
10060
|
variant: "ghost",
|
|
9862
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10061
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react58.CaretLeftIcon, { "aria-hidden": true, size: 16 })
|
|
9863
10062
|
}
|
|
9864
10063
|
),
|
|
9865
10064
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
@@ -9869,7 +10068,7 @@ function EventAgenda({
|
|
|
9869
10068
|
onClick: goNext,
|
|
9870
10069
|
size: "icon",
|
|
9871
10070
|
variant: "ghost",
|
|
9872
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10071
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react58.CaretRightIcon, { "aria-hidden": true, size: 16 })
|
|
9873
10072
|
}
|
|
9874
10073
|
)
|
|
9875
10074
|
] }),
|
|
@@ -9930,7 +10129,7 @@ function EventAgenda({
|
|
|
9930
10129
|
}
|
|
9931
10130
|
)
|
|
9932
10131
|
] }),
|
|
9933
|
-
selectedEvent &&
|
|
10132
|
+
selectedEvent && import_react57.default.isValidElement(onClick) ? import_react57.default.cloneElement(onClick, {
|
|
9934
10133
|
event: selectedEvent,
|
|
9935
10134
|
onClose: () => setSelectedEvent(null)
|
|
9936
10135
|
}) : null
|
|
@@ -9940,7 +10139,7 @@ function EventAgenda({
|
|
|
9940
10139
|
}
|
|
9941
10140
|
|
|
9942
10141
|
// src/components/ui/event-calendar-view/UndatedEvents.tsx
|
|
9943
|
-
var
|
|
10142
|
+
var import_react59 = require("react");
|
|
9944
10143
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
9945
10144
|
var isValidDate2 = (d) => {
|
|
9946
10145
|
try {
|
|
@@ -9957,7 +10156,7 @@ function UndatedEvents({
|
|
|
9957
10156
|
title = "Data de Atendimento n\xE3o Prevista",
|
|
9958
10157
|
show = true
|
|
9959
10158
|
}) {
|
|
9960
|
-
const undatedEvents = (0,
|
|
10159
|
+
const undatedEvents = (0, import_react59.useMemo)(
|
|
9961
10160
|
() => events.filter((e) => !(isValidDate2(e.start) || isValidDate2(e.end))),
|
|
9962
10161
|
[events]
|
|
9963
10162
|
);
|
|
@@ -9979,15 +10178,15 @@ function UndatedEvents({
|
|
|
9979
10178
|
}
|
|
9980
10179
|
|
|
9981
10180
|
// src/components/ui/event-calendar-view/hooks/use-event-visibility.ts
|
|
9982
|
-
var
|
|
10181
|
+
var import_react60 = require("react");
|
|
9983
10182
|
function useEventVisibilityAgenda({
|
|
9984
10183
|
eventHeight,
|
|
9985
10184
|
eventGap
|
|
9986
10185
|
}) {
|
|
9987
|
-
const contentRef = (0,
|
|
9988
|
-
const observerRef = (0,
|
|
9989
|
-
const [contentHeight, setContentHeight] = (0,
|
|
9990
|
-
(0,
|
|
10186
|
+
const contentRef = (0, import_react60.useRef)(null);
|
|
10187
|
+
const observerRef = (0, import_react60.useRef)(null);
|
|
10188
|
+
const [contentHeight, setContentHeight] = (0, import_react60.useState)(null);
|
|
10189
|
+
(0, import_react60.useLayoutEffect)(() => {
|
|
9991
10190
|
if (!contentRef.current) return;
|
|
9992
10191
|
const updateHeight = () => {
|
|
9993
10192
|
if (contentRef.current) {
|
|
@@ -10007,7 +10206,7 @@ function useEventVisibilityAgenda({
|
|
|
10007
10206
|
}
|
|
10008
10207
|
};
|
|
10009
10208
|
}, []);
|
|
10010
|
-
const getVisibleEventCount = (0,
|
|
10209
|
+
const getVisibleEventCount = (0, import_react60.useMemo)(() => {
|
|
10011
10210
|
return (totalEvents) => {
|
|
10012
10211
|
if (!contentHeight) return totalEvents;
|
|
10013
10212
|
const maxEvents = Math.floor(contentHeight / (eventHeight + eventGap));
|
|
@@ -10026,8 +10225,8 @@ function useEventVisibilityAgenda({
|
|
|
10026
10225
|
|
|
10027
10226
|
// src/components/ui/event-calendar-view/MonthView.tsx
|
|
10028
10227
|
var import_date_fns10 = require("date-fns");
|
|
10029
|
-
var
|
|
10030
|
-
var
|
|
10228
|
+
var import_locale6 = require("date-fns/locale");
|
|
10229
|
+
var import_react61 = require("react");
|
|
10031
10230
|
var import_tailwind_merge3 = require("tailwind-merge");
|
|
10032
10231
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10033
10232
|
function MonthViewAgenda({
|
|
@@ -10036,21 +10235,21 @@ function MonthViewAgenda({
|
|
|
10036
10235
|
onEventSelect,
|
|
10037
10236
|
showUndatedEvents
|
|
10038
10237
|
}) {
|
|
10039
|
-
const days = (0,
|
|
10238
|
+
const days = (0, import_react61.useMemo)(() => {
|
|
10040
10239
|
const monthStart = (0, import_date_fns10.startOfMonth)(currentDate);
|
|
10041
10240
|
const monthEnd = (0, import_date_fns10.endOfMonth)(monthStart);
|
|
10042
10241
|
const calendarStart = (0, import_date_fns10.startOfWeek)(monthStart, { weekStartsOn: 0 });
|
|
10043
10242
|
const calendarEnd = (0, import_date_fns10.endOfWeek)(monthEnd, { weekStartsOn: 0 });
|
|
10044
10243
|
return (0, import_date_fns10.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
|
|
10045
10244
|
}, [currentDate]);
|
|
10046
|
-
const weekdays = (0,
|
|
10245
|
+
const weekdays = (0, import_react61.useMemo)(() => {
|
|
10047
10246
|
return Array.from({ length: 7 }).map((_, i) => {
|
|
10048
10247
|
const date = (0, import_date_fns10.addDays)((0, import_date_fns10.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
|
|
10049
|
-
const short = (0, import_date_fns10.format)(date, "EEE", { locale:
|
|
10248
|
+
const short = (0, import_date_fns10.format)(date, "EEE", { locale: import_locale6.ptBR });
|
|
10050
10249
|
return short.charAt(0).toUpperCase() + short.slice(1);
|
|
10051
10250
|
});
|
|
10052
10251
|
}, []);
|
|
10053
|
-
const weeks = (0,
|
|
10252
|
+
const weeks = (0, import_react61.useMemo)(() => {
|
|
10054
10253
|
const result = [];
|
|
10055
10254
|
let week = [];
|
|
10056
10255
|
for (let i = 0; i < days.length; i++) {
|
|
@@ -10066,12 +10265,12 @@ function MonthViewAgenda({
|
|
|
10066
10265
|
e.stopPropagation();
|
|
10067
10266
|
onEventSelect(event, e);
|
|
10068
10267
|
};
|
|
10069
|
-
const [isMounted, setIsMounted] = (0,
|
|
10268
|
+
const [isMounted, setIsMounted] = (0, import_react61.useState)(false);
|
|
10070
10269
|
const { contentRef, getVisibleEventCount } = useEventVisibilityAgenda({
|
|
10071
10270
|
eventGap: EventGapAgenda,
|
|
10072
10271
|
eventHeight: EventHeightAgenda
|
|
10073
10272
|
});
|
|
10074
|
-
(0,
|
|
10273
|
+
(0, import_react61.useEffect)(() => {
|
|
10075
10274
|
setIsMounted(true);
|
|
10076
10275
|
}, []);
|
|
10077
10276
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "contents", "data-slot": "month-view", children: [
|
|
@@ -10210,7 +10409,7 @@ function MonthViewAgenda({
|
|
|
10210
10409
|
"aria-label": `Show ${remainingCount} more events on ${(0, import_date_fns10.format)(
|
|
10211
10410
|
day,
|
|
10212
10411
|
"PPP",
|
|
10213
|
-
{ locale:
|
|
10412
|
+
{ locale: import_locale6.ptBR }
|
|
10214
10413
|
)}`,
|
|
10215
10414
|
children: [
|
|
10216
10415
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "font-medium", children: [
|
|
@@ -10230,7 +10429,7 @@ function MonthViewAgenda({
|
|
|
10230
10429
|
"--event-height": `${EventHeightAgenda}px`
|
|
10231
10430
|
},
|
|
10232
10431
|
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-2", children: [
|
|
10233
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "font-medium text-sm", children: (0, import_date_fns10.format)(day, "EEE d", { locale:
|
|
10432
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "font-medium text-sm", children: (0, import_date_fns10.format)(day, "EEE d", { locale: import_locale6.ptBR }) }),
|
|
10234
10433
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "space-y-1", children: sortEventsAgenda(allEvents).map((event) => {
|
|
10235
10434
|
const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
|
|
10236
10435
|
const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
@@ -10279,8 +10478,8 @@ function MonthViewAgenda({
|
|
|
10279
10478
|
|
|
10280
10479
|
// src/components/ui/event-calendar-view/WeekView.tsx
|
|
10281
10480
|
var import_date_fns12 = require("date-fns");
|
|
10282
|
-
var
|
|
10283
|
-
var
|
|
10481
|
+
var import_locale7 = require("date-fns/locale");
|
|
10482
|
+
var import_react63 = require("react");
|
|
10284
10483
|
|
|
10285
10484
|
// src/components/ui/event-calendar/constants.ts
|
|
10286
10485
|
var EventHeight = 24;
|
|
@@ -10296,7 +10495,7 @@ var DefaultEndHour = 10;
|
|
|
10296
10495
|
var import_core3 = require("@dnd-kit/core");
|
|
10297
10496
|
var import_utilities = require("@dnd-kit/utilities");
|
|
10298
10497
|
var import_date_fns11 = require("date-fns");
|
|
10299
|
-
var
|
|
10498
|
+
var import_react62 = require("react");
|
|
10300
10499
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10301
10500
|
function DraggableEvent({
|
|
10302
10501
|
event,
|
|
@@ -10312,8 +10511,8 @@ function DraggableEvent({
|
|
|
10312
10511
|
draggable = true
|
|
10313
10512
|
}) {
|
|
10314
10513
|
const { activeId } = useCalendarDndAgenda();
|
|
10315
|
-
const elementRef = (0,
|
|
10316
|
-
const [dragHandlePosition, setDragHandlePosition] = (0,
|
|
10514
|
+
const elementRef = (0, import_react62.useRef)(null);
|
|
10515
|
+
const [dragHandlePosition, setDragHandlePosition] = (0, import_react62.useState)(null);
|
|
10317
10516
|
const eventStart = getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
10318
10517
|
const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
10319
10518
|
const isMultiDayEvent2 = isMultiDay || event.allDay || (0, import_date_fns11.differenceInDays)(eventEnd, eventStart) >= 1;
|
|
@@ -10410,23 +10609,23 @@ function WeekViewAgenda({
|
|
|
10410
10609
|
onEventCreate,
|
|
10411
10610
|
showUndatedEvents
|
|
10412
10611
|
}) {
|
|
10413
|
-
const days = (0,
|
|
10612
|
+
const days = (0, import_react63.useMemo)(() => {
|
|
10414
10613
|
const weekStart2 = (0, import_date_fns12.startOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
10415
10614
|
const weekEnd = (0, import_date_fns12.endOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
10416
10615
|
return (0, import_date_fns12.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
|
|
10417
10616
|
}, [currentDate]);
|
|
10418
|
-
const weekStart = (0,
|
|
10617
|
+
const weekStart = (0, import_react63.useMemo)(
|
|
10419
10618
|
() => (0, import_date_fns12.startOfWeek)(currentDate, { weekStartsOn: 0 }),
|
|
10420
10619
|
[currentDate]
|
|
10421
10620
|
);
|
|
10422
|
-
const hours = (0,
|
|
10621
|
+
const hours = (0, import_react63.useMemo)(() => {
|
|
10423
10622
|
const dayStart = (0, import_date_fns12.startOfDay)(currentDate);
|
|
10424
10623
|
return (0, import_date_fns12.eachHourOfInterval)({
|
|
10425
10624
|
end: (0, import_date_fns12.addHours)(dayStart, EndHour - 1),
|
|
10426
10625
|
start: (0, import_date_fns12.addHours)(dayStart, StartHour)
|
|
10427
10626
|
});
|
|
10428
10627
|
}, [currentDate]);
|
|
10429
|
-
const allDayEvents = (0,
|
|
10628
|
+
const allDayEvents = (0, import_react63.useMemo)(() => {
|
|
10430
10629
|
const isValidStart = (ev) => {
|
|
10431
10630
|
try {
|
|
10432
10631
|
if (ev.start == null) return false;
|
|
@@ -10451,7 +10650,7 @@ function WeekViewAgenda({
|
|
|
10451
10650
|
});
|
|
10452
10651
|
});
|
|
10453
10652
|
}, [events, days]);
|
|
10454
|
-
const processedDayEvents = (0,
|
|
10653
|
+
const processedDayEvents = (0, import_react63.useMemo)(() => {
|
|
10455
10654
|
const result = days.map((day) => {
|
|
10456
10655
|
const dayEvents = events.filter((event) => {
|
|
10457
10656
|
if (event.allDay || isMultiDayEventAgenda(event)) return false;
|
|
@@ -10540,11 +10739,11 @@ function WeekViewAgenda({
|
|
|
10540
10739
|
"data-today": (0, import_date_fns12.isToday)(day) || void 0,
|
|
10541
10740
|
children: [
|
|
10542
10741
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { "aria-hidden": "true", className: "sm:hidden", children: [
|
|
10543
|
-
(0, import_date_fns12.format)(day, "EEE", { locale:
|
|
10742
|
+
(0, import_date_fns12.format)(day, "EEE", { locale: import_locale7.ptBR })[0],
|
|
10544
10743
|
" ",
|
|
10545
|
-
(0, import_date_fns12.format)(day, "d", { locale:
|
|
10744
|
+
(0, import_date_fns12.format)(day, "d", { locale: import_locale7.ptBR })
|
|
10546
10745
|
] }),
|
|
10547
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns12.format)(day, "EEE dd", { locale:
|
|
10746
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns12.format)(day, "EEE dd", { locale: import_locale7.ptBR }) })
|
|
10548
10747
|
]
|
|
10549
10748
|
},
|
|
10550
10749
|
day.toString()
|
|
@@ -10705,9 +10904,9 @@ function WeekViewAgenda({
|
|
|
10705
10904
|
|
|
10706
10905
|
// src/components/ui/event-calendar/AgendaView.tsx
|
|
10707
10906
|
var import_date_fns13 = require("date-fns");
|
|
10708
|
-
var
|
|
10709
|
-
var
|
|
10710
|
-
var
|
|
10907
|
+
var import_locale8 = require("date-fns/locale");
|
|
10908
|
+
var import_react64 = require("react");
|
|
10909
|
+
var import_react65 = require("@phosphor-icons/react");
|
|
10711
10910
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
10712
10911
|
function AgendaView({
|
|
10713
10912
|
currentDate,
|
|
@@ -10723,15 +10922,15 @@ function AgendaView({
|
|
|
10723
10922
|
return false;
|
|
10724
10923
|
}
|
|
10725
10924
|
};
|
|
10726
|
-
const datedEvents = (0,
|
|
10925
|
+
const datedEvents = (0, import_react64.useMemo)(
|
|
10727
10926
|
() => events.filter((e) => isValidDate5(e.start) || isValidDate5(e.end)),
|
|
10728
10927
|
[events]
|
|
10729
10928
|
);
|
|
10730
|
-
const undatedEvents = (0,
|
|
10929
|
+
const undatedEvents = (0, import_react64.useMemo)(
|
|
10731
10930
|
() => events.filter((e) => !(isValidDate5(e.start) || isValidDate5(e.end))),
|
|
10732
10931
|
[events]
|
|
10733
10932
|
);
|
|
10734
|
-
const days = (0,
|
|
10933
|
+
const days = (0, import_react64.useMemo)(() => {
|
|
10735
10934
|
return Array.from(
|
|
10736
10935
|
{ length: AgendaDaysToShow },
|
|
10737
10936
|
(_, i) => (0, import_date_fns13.addDays)(new Date(currentDate), i)
|
|
@@ -10745,7 +10944,7 @@ function AgendaView({
|
|
|
10745
10944
|
(day) => getAgendaEventsForDay(datedEvents, day).length > 0
|
|
10746
10945
|
);
|
|
10747
10946
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "border-border/70 border-t px-4", children: !hasEvents && !(showUndatedEvents && undatedEvents.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center", children: [
|
|
10748
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
10947
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react65.CalendarIcon, { className: "mb-2 text-muted-foreground/50", size: 32 }),
|
|
10749
10948
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("h3", { className: "font-medium text-lg", children: "Nenhum evento encontrado" }),
|
|
10750
10949
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-muted-foreground", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
|
|
10751
10950
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
@@ -10763,7 +10962,7 @@ function AgendaView({
|
|
|
10763
10962
|
className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 text-[10px] uppercase data-today:font-medium sm:pe-4 sm:text-xs",
|
|
10764
10963
|
"data-today": (0, import_date_fns13.isToday)(day) || void 0,
|
|
10765
10964
|
children: (() => {
|
|
10766
|
-
const s = (0, import_date_fns13.format)(day, "d MMM, EEEE", { locale:
|
|
10965
|
+
const s = (0, import_date_fns13.format)(day, "d MMM, EEEE", { locale: import_locale8.ptBR });
|
|
10767
10966
|
return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
|
|
10768
10967
|
})()
|
|
10769
10968
|
}
|
|
@@ -10804,11 +11003,11 @@ function AgendaView({
|
|
|
10804
11003
|
// src/components/ui/event-calendar/CalendarDND.tsx
|
|
10805
11004
|
var import_core4 = require("@dnd-kit/core");
|
|
10806
11005
|
var import_date_fns14 = require("date-fns");
|
|
10807
|
-
var
|
|
11006
|
+
var import_react67 = require("react");
|
|
10808
11007
|
|
|
10809
11008
|
// src/components/ui/event-calendar/hooks.ts
|
|
10810
|
-
var
|
|
10811
|
-
var CalendarDndContext2 = (0,
|
|
11009
|
+
var import_react66 = require("react");
|
|
11010
|
+
var CalendarDndContext2 = (0, import_react66.createContext)({
|
|
10812
11011
|
activeEvent: null,
|
|
10813
11012
|
activeId: null,
|
|
10814
11013
|
activeView: null,
|
|
@@ -10818,7 +11017,7 @@ var CalendarDndContext2 = (0, import_react64.createContext)({
|
|
|
10818
11017
|
isMultiDay: false,
|
|
10819
11018
|
multiDayWidth: null
|
|
10820
11019
|
});
|
|
10821
|
-
var useCalendarDnd = () => (0,
|
|
11020
|
+
var useCalendarDnd = () => (0, import_react66.useContext)(CalendarDndContext2);
|
|
10822
11021
|
|
|
10823
11022
|
// src/components/ui/event-calendar/CalendarDND.tsx
|
|
10824
11023
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
@@ -10826,17 +11025,17 @@ function CalendarDndProvider({
|
|
|
10826
11025
|
children,
|
|
10827
11026
|
onEventUpdate
|
|
10828
11027
|
}) {
|
|
10829
|
-
const [activeEvent, setActiveEvent] = (0,
|
|
10830
|
-
const [activeId, setActiveId] = (0,
|
|
10831
|
-
const [activeView, setActiveView] = (0,
|
|
11028
|
+
const [activeEvent, setActiveEvent] = (0, import_react67.useState)(null);
|
|
11029
|
+
const [activeId, setActiveId] = (0, import_react67.useState)(null);
|
|
11030
|
+
const [activeView, setActiveView] = (0, import_react67.useState)(
|
|
10832
11031
|
null
|
|
10833
11032
|
);
|
|
10834
|
-
const [currentTime, setCurrentTime] = (0,
|
|
10835
|
-
const [eventHeight, setEventHeight] = (0,
|
|
10836
|
-
const [isMultiDay, setIsMultiDay] = (0,
|
|
10837
|
-
const [multiDayWidth, setMultiDayWidth] = (0,
|
|
10838
|
-
const [dragHandlePosition, setDragHandlePosition] = (0,
|
|
10839
|
-
const eventDimensions = (0,
|
|
11033
|
+
const [currentTime, setCurrentTime] = (0, import_react67.useState)(null);
|
|
11034
|
+
const [eventHeight, setEventHeight] = (0, import_react67.useState)(null);
|
|
11035
|
+
const [isMultiDay, setIsMultiDay] = (0, import_react67.useState)(false);
|
|
11036
|
+
const [multiDayWidth, setMultiDayWidth] = (0, import_react67.useState)(null);
|
|
11037
|
+
const [dragHandlePosition, setDragHandlePosition] = (0, import_react67.useState)(null);
|
|
11038
|
+
const eventDimensions = (0, import_react67.useRef)({ height: 0 });
|
|
10840
11039
|
const sensors = (0, import_core4.useSensors)(
|
|
10841
11040
|
(0, import_core4.useSensor)(import_core4.MouseSensor, {
|
|
10842
11041
|
// Require the mouse to move by 5px before activating
|
|
@@ -10858,7 +11057,7 @@ function CalendarDndProvider({
|
|
|
10858
11057
|
}
|
|
10859
11058
|
})
|
|
10860
11059
|
);
|
|
10861
|
-
const dndContextId = (0,
|
|
11060
|
+
const dndContextId = (0, import_react67.useId)();
|
|
10862
11061
|
const handleDragStart = (event) => {
|
|
10863
11062
|
const { active } = event;
|
|
10864
11063
|
if (!active.data.current) {
|
|
@@ -11040,7 +11239,7 @@ function CalendarDndProvider({
|
|
|
11040
11239
|
|
|
11041
11240
|
// src/components/ui/event-calendar/DayView.tsx
|
|
11042
11241
|
var import_date_fns15 = require("date-fns");
|
|
11043
|
-
var
|
|
11242
|
+
var import_react68 = require("react");
|
|
11044
11243
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
11045
11244
|
function DayView({
|
|
11046
11245
|
currentDate,
|
|
@@ -11048,14 +11247,14 @@ function DayView({
|
|
|
11048
11247
|
onEventSelect,
|
|
11049
11248
|
onEventCreate
|
|
11050
11249
|
}) {
|
|
11051
|
-
const hours = (0,
|
|
11250
|
+
const hours = (0, import_react68.useMemo)(() => {
|
|
11052
11251
|
const dayStart = (0, import_date_fns15.startOfDay)(currentDate);
|
|
11053
11252
|
return (0, import_date_fns15.eachHourOfInterval)({
|
|
11054
11253
|
end: (0, import_date_fns15.addHours)(dayStart, EndHour - 1),
|
|
11055
11254
|
start: (0, import_date_fns15.addHours)(dayStart, StartHour)
|
|
11056
11255
|
});
|
|
11057
11256
|
}, [currentDate]);
|
|
11058
|
-
const dayEvents = (0,
|
|
11257
|
+
const dayEvents = (0, import_react68.useMemo)(() => {
|
|
11059
11258
|
return events.filter((event) => {
|
|
11060
11259
|
const eventStart = new Date(event.start);
|
|
11061
11260
|
const eventEnd = new Date(event.end);
|
|
@@ -11064,17 +11263,17 @@ function DayView({
|
|
|
11064
11263
|
(a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()
|
|
11065
11264
|
);
|
|
11066
11265
|
}, [currentDate, events]);
|
|
11067
|
-
const allDayEvents = (0,
|
|
11266
|
+
const allDayEvents = (0, import_react68.useMemo)(() => {
|
|
11068
11267
|
return dayEvents.filter((event) => {
|
|
11069
11268
|
return event.allDay || isMultiDayEvent(event);
|
|
11070
11269
|
});
|
|
11071
11270
|
}, [dayEvents]);
|
|
11072
|
-
const timeEvents = (0,
|
|
11271
|
+
const timeEvents = (0, import_react68.useMemo)(() => {
|
|
11073
11272
|
return dayEvents.filter((event) => {
|
|
11074
11273
|
return !event.allDay && !isMultiDayEvent(event);
|
|
11075
11274
|
});
|
|
11076
11275
|
}, [dayEvents]);
|
|
11077
|
-
const positionedEvents = (0,
|
|
11276
|
+
const positionedEvents = (0, import_react68.useMemo)(() => {
|
|
11078
11277
|
const result = [];
|
|
11079
11278
|
const dayStart = (0, import_date_fns15.startOfDay)(currentDate);
|
|
11080
11279
|
const sortedEvents = [...timeEvents].sort((a, b) => {
|
|
@@ -11255,7 +11454,7 @@ function DayView({
|
|
|
11255
11454
|
var import_core5 = require("@dnd-kit/core");
|
|
11256
11455
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
11257
11456
|
var import_date_fns16 = require("date-fns");
|
|
11258
|
-
var
|
|
11457
|
+
var import_react69 = require("react");
|
|
11259
11458
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11260
11459
|
function DraggableEvent2({
|
|
11261
11460
|
event,
|
|
@@ -11270,8 +11469,8 @@ function DraggableEvent2({
|
|
|
11270
11469
|
"aria-hidden": ariaHidden
|
|
11271
11470
|
}) {
|
|
11272
11471
|
const { activeId } = useCalendarDnd();
|
|
11273
|
-
const elementRef = (0,
|
|
11274
|
-
const [dragHandlePosition, setDragHandlePosition] = (0,
|
|
11472
|
+
const elementRef = (0, import_react69.useRef)(null);
|
|
11473
|
+
const [dragHandlePosition, setDragHandlePosition] = (0, import_react69.useState)(null);
|
|
11275
11474
|
const eventStart = new Date(event.start);
|
|
11276
11475
|
const eventEnd = new Date(event.end);
|
|
11277
11476
|
const isMultiDayEvent2 = isMultiDay || event.allDay || (0, import_date_fns16.differenceInDays)(eventEnd, eventStart) >= 1;
|
|
@@ -11395,10 +11594,10 @@ function DroppableCell({
|
|
|
11395
11594
|
|
|
11396
11595
|
// src/components/ui/event-calendar/EventCalendar.tsx
|
|
11397
11596
|
var import_date_fns17 = require("date-fns");
|
|
11398
|
-
var
|
|
11399
|
-
var
|
|
11597
|
+
var import_locale9 = require("date-fns/locale");
|
|
11598
|
+
var import_react70 = require("react");
|
|
11400
11599
|
var import_sonner3 = require("sonner");
|
|
11401
|
-
var
|
|
11600
|
+
var import_react71 = require("@phosphor-icons/react");
|
|
11402
11601
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
11403
11602
|
function EventCalendar({
|
|
11404
11603
|
events = [],
|
|
@@ -11408,11 +11607,11 @@ function EventCalendar({
|
|
|
11408
11607
|
className,
|
|
11409
11608
|
initialView = "month"
|
|
11410
11609
|
}) {
|
|
11411
|
-
const [currentDate, setCurrentDate] = (0,
|
|
11412
|
-
const [view, setView] = (0,
|
|
11413
|
-
const [isFading, setIsFading] = (0,
|
|
11610
|
+
const [currentDate, setCurrentDate] = (0, import_react70.useState)(/* @__PURE__ */ new Date());
|
|
11611
|
+
const [view, setView] = (0, import_react70.useState)(initialView);
|
|
11612
|
+
const [isFading, setIsFading] = (0, import_react70.useState)(false);
|
|
11414
11613
|
const FADE_DURATION = 220;
|
|
11415
|
-
const changeView = (0,
|
|
11614
|
+
const changeView = (0, import_react70.useCallback)(
|
|
11416
11615
|
(next) => {
|
|
11417
11616
|
if (next === view) return;
|
|
11418
11617
|
setIsFading(true);
|
|
@@ -11423,12 +11622,12 @@ function EventCalendar({
|
|
|
11423
11622
|
},
|
|
11424
11623
|
[view]
|
|
11425
11624
|
);
|
|
11426
|
-
const [isPaging, setIsPaging] = (0,
|
|
11427
|
-
const [pageDirection, setPageDirection] = (0,
|
|
11625
|
+
const [isPaging, setIsPaging] = (0, import_react70.useState)(false);
|
|
11626
|
+
const [pageDirection, setPageDirection] = (0, import_react70.useState)(
|
|
11428
11627
|
null
|
|
11429
11628
|
);
|
|
11430
11629
|
const PAGE_DURATION = 200;
|
|
11431
|
-
const pageTransition = (0,
|
|
11630
|
+
const pageTransition = (0, import_react70.useCallback)(
|
|
11432
11631
|
(applyDateChange, direction) => {
|
|
11433
11632
|
setIsPaging(true);
|
|
11434
11633
|
setPageDirection(direction);
|
|
@@ -11442,11 +11641,11 @@ function EventCalendar({
|
|
|
11442
11641
|
},
|
|
11443
11642
|
[]
|
|
11444
11643
|
);
|
|
11445
|
-
const [isEventDialogOpen, setIsEventDialogOpen] = (0,
|
|
11446
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
11644
|
+
const [isEventDialogOpen, setIsEventDialogOpen] = (0, import_react70.useState)(false);
|
|
11645
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react70.useState)(
|
|
11447
11646
|
null
|
|
11448
11647
|
);
|
|
11449
|
-
(0,
|
|
11648
|
+
(0, import_react70.useEffect)(() => {
|
|
11450
11649
|
const handleKeyDown = (e) => {
|
|
11451
11650
|
if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
|
|
11452
11651
|
return;
|
|
@@ -11535,7 +11734,7 @@ function EventCalendar({
|
|
|
11535
11734
|
new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
|
|
11536
11735
|
"d 'de' MMMM 'de' yyyy",
|
|
11537
11736
|
{
|
|
11538
|
-
locale:
|
|
11737
|
+
locale: import_locale9.ptBR
|
|
11539
11738
|
}
|
|
11540
11739
|
),
|
|
11541
11740
|
position: "bottom-left"
|
|
@@ -11549,7 +11748,7 @@ function EventCalendar({
|
|
|
11549
11748
|
description: (0, import_date_fns17.format)(
|
|
11550
11749
|
new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
|
|
11551
11750
|
"d 'de' MMMM 'de' yyyy",
|
|
11552
|
-
{ locale:
|
|
11751
|
+
{ locale: import_locale9.ptBR }
|
|
11553
11752
|
),
|
|
11554
11753
|
position: "bottom-left"
|
|
11555
11754
|
});
|
|
@@ -11569,7 +11768,7 @@ function EventCalendar({
|
|
|
11569
11768
|
deletedEvent.start ?? deletedEvent.attend_date ?? deletedEvent.end ?? Date.now()
|
|
11570
11769
|
),
|
|
11571
11770
|
"d 'de' MMMM 'de' yyyy",
|
|
11572
|
-
{ locale:
|
|
11771
|
+
{ locale: import_locale9.ptBR }
|
|
11573
11772
|
),
|
|
11574
11773
|
position: "bottom-left"
|
|
11575
11774
|
});
|
|
@@ -11583,33 +11782,33 @@ function EventCalendar({
|
|
|
11583
11782
|
updatedEvent.start ?? updatedEvent.attend_date ?? updatedEvent.end ?? Date.now()
|
|
11584
11783
|
),
|
|
11585
11784
|
"d 'de' MMMM 'de' yyyy",
|
|
11586
|
-
{ locale:
|
|
11785
|
+
{ locale: import_locale9.ptBR }
|
|
11587
11786
|
),
|
|
11588
11787
|
position: "bottom-left"
|
|
11589
11788
|
});
|
|
11590
11789
|
};
|
|
11591
|
-
const viewTitle = (0,
|
|
11790
|
+
const viewTitle = (0, import_react70.useMemo)(() => {
|
|
11592
11791
|
const capitalize = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
11593
11792
|
if (view === "month") {
|
|
11594
|
-
return capitalize((0, import_date_fns17.format)(currentDate, "MMMM yyyy", { locale:
|
|
11793
|
+
return capitalize((0, import_date_fns17.format)(currentDate, "MMMM yyyy", { locale: import_locale9.ptBR }));
|
|
11595
11794
|
}
|
|
11596
11795
|
if (view === "week") {
|
|
11597
11796
|
const start = (0, import_date_fns17.startOfWeek)(currentDate, { weekStartsOn: 1 });
|
|
11598
11797
|
const end = (0, import_date_fns17.endOfWeek)(currentDate, { weekStartsOn: 1 });
|
|
11599
11798
|
if ((0, import_date_fns17.isSameMonth)(start, end)) {
|
|
11600
|
-
return capitalize((0, import_date_fns17.format)(start, "MMMM yyyy", { locale:
|
|
11799
|
+
return capitalize((0, import_date_fns17.format)(start, "MMMM yyyy", { locale: import_locale9.ptBR }));
|
|
11601
11800
|
}
|
|
11602
|
-
const s1 = capitalize((0, import_date_fns17.format)(start, "MMM", { locale:
|
|
11603
|
-
const s2 = capitalize((0, import_date_fns17.format)(end, "MMM yyyy", { locale:
|
|
11801
|
+
const s1 = capitalize((0, import_date_fns17.format)(start, "MMM", { locale: import_locale9.ptBR }));
|
|
11802
|
+
const s2 = capitalize((0, import_date_fns17.format)(end, "MMM yyyy", { locale: import_locale9.ptBR }));
|
|
11604
11803
|
return `${s1} - ${s2}`;
|
|
11605
11804
|
}
|
|
11606
11805
|
if (view === "day") {
|
|
11607
|
-
const dayNum = (0, import_date_fns17.format)(currentDate, "d", { locale:
|
|
11608
|
-
const month = capitalize((0, import_date_fns17.format)(currentDate, "MMMM", { locale:
|
|
11609
|
-
const year = (0, import_date_fns17.format)(currentDate, "yyyy", { locale:
|
|
11806
|
+
const dayNum = (0, import_date_fns17.format)(currentDate, "d", { locale: import_locale9.ptBR });
|
|
11807
|
+
const month = capitalize((0, import_date_fns17.format)(currentDate, "MMMM", { locale: import_locale9.ptBR }));
|
|
11808
|
+
const year = (0, import_date_fns17.format)(currentDate, "yyyy", { locale: import_locale9.ptBR });
|
|
11610
11809
|
const short = `${dayNum} de ${month} de ${year}`;
|
|
11611
11810
|
const long = `${(0, import_date_fns17.format)(currentDate, "EEE", {
|
|
11612
|
-
locale:
|
|
11811
|
+
locale: import_locale9.ptBR
|
|
11613
11812
|
})}, ${dayNum} de ${month} de ${year}`;
|
|
11614
11813
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
11615
11814
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
|
|
@@ -11621,13 +11820,13 @@ function EventCalendar({
|
|
|
11621
11820
|
const start = currentDate;
|
|
11622
11821
|
const end = (0, import_date_fns17.addDays)(currentDate, AgendaDaysToShow - 1);
|
|
11623
11822
|
if ((0, import_date_fns17.isSameMonth)(start, end)) {
|
|
11624
|
-
return capitalize((0, import_date_fns17.format)(start, "MMMM yyyy", { locale:
|
|
11823
|
+
return capitalize((0, import_date_fns17.format)(start, "MMMM yyyy", { locale: import_locale9.ptBR }));
|
|
11625
11824
|
}
|
|
11626
|
-
const s1 = capitalize((0, import_date_fns17.format)(start, "MMM", { locale:
|
|
11627
|
-
const s2 = capitalize((0, import_date_fns17.format)(end, "MMM yyyy", { locale:
|
|
11825
|
+
const s1 = capitalize((0, import_date_fns17.format)(start, "MMM", { locale: import_locale9.ptBR }));
|
|
11826
|
+
const s2 = capitalize((0, import_date_fns17.format)(end, "MMM yyyy", { locale: import_locale9.ptBR }));
|
|
11628
11827
|
return `${s1} - ${s2}`;
|
|
11629
11828
|
}
|
|
11630
|
-
return capitalize((0, import_date_fns17.format)(currentDate, "MMMM yyyy", { locale:
|
|
11829
|
+
return capitalize((0, import_date_fns17.format)(currentDate, "MMMM yyyy", { locale: import_locale9.ptBR }));
|
|
11631
11830
|
}, [currentDate, view]);
|
|
11632
11831
|
const calendarContent = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
11633
11832
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
@@ -11647,7 +11846,7 @@ function EventCalendar({
|
|
|
11647
11846
|
variant: "outline",
|
|
11648
11847
|
children: [
|
|
11649
11848
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11650
|
-
|
|
11849
|
+
import_react71.CalendarIcon,
|
|
11651
11850
|
{
|
|
11652
11851
|
"aria-hidden": "true",
|
|
11653
11852
|
className: "min-[480px]:hidden",
|
|
@@ -11666,7 +11865,7 @@ function EventCalendar({
|
|
|
11666
11865
|
onClick: handlePrevious,
|
|
11667
11866
|
size: "icon",
|
|
11668
11867
|
variant: "ghost",
|
|
11669
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11868
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react71.CaretLeft, { "aria-hidden": "true", size: 16 })
|
|
11670
11869
|
}
|
|
11671
11870
|
),
|
|
11672
11871
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
@@ -11676,7 +11875,7 @@ function EventCalendar({
|
|
|
11676
11875
|
onClick: handleNext,
|
|
11677
11876
|
size: "icon",
|
|
11678
11877
|
variant: "ghost",
|
|
11679
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11878
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react71.CaretRight, { "aria-hidden": "true", size: 16 })
|
|
11680
11879
|
}
|
|
11681
11880
|
)
|
|
11682
11881
|
] }),
|
|
@@ -11711,7 +11910,7 @@ function EventCalendar({
|
|
|
11711
11910
|
})() })
|
|
11712
11911
|
] }),
|
|
11713
11912
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11714
|
-
|
|
11913
|
+
import_react71.ArrowDownIcon,
|
|
11715
11914
|
{
|
|
11716
11915
|
"aria-hidden": "true",
|
|
11717
11916
|
className: "-me-1 opacity-60",
|
|
@@ -11751,7 +11950,7 @@ function EventCalendar({
|
|
|
11751
11950
|
size: "sm",
|
|
11752
11951
|
children: [
|
|
11753
11952
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11754
|
-
|
|
11953
|
+
import_react71.PlusIcon,
|
|
11755
11954
|
{
|
|
11756
11955
|
"aria-hidden": "true",
|
|
11757
11956
|
className: "sm:-ms-1 opacity-60",
|
|
@@ -11843,11 +12042,11 @@ function EventCalendar({
|
|
|
11843
12042
|
|
|
11844
12043
|
// src/components/ui/event-calendar/EventDialog.tsx
|
|
11845
12044
|
var import_date_fns18 = require("date-fns");
|
|
11846
|
-
var
|
|
12045
|
+
var import_react72 = require("react");
|
|
11847
12046
|
var import_react_radio_group = require("@radix-ui/react-radio-group");
|
|
11848
|
-
var
|
|
11849
|
-
var
|
|
11850
|
-
var
|
|
12047
|
+
var import_framer_motion13 = require("framer-motion");
|
|
12048
|
+
var import_locale10 = require("date-fns/locale");
|
|
12049
|
+
var import_react73 = require("@phosphor-icons/react");
|
|
11851
12050
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11852
12051
|
function EventDialog({
|
|
11853
12052
|
event,
|
|
@@ -11856,21 +12055,21 @@ function EventDialog({
|
|
|
11856
12055
|
onSave,
|
|
11857
12056
|
onDelete
|
|
11858
12057
|
}) {
|
|
11859
|
-
const [title, setTitle] = (0,
|
|
11860
|
-
const [description, setDescription] = (0,
|
|
11861
|
-
const [startDate, setStartDate] = (0,
|
|
11862
|
-
const [endDate, setEndDate] = (0,
|
|
11863
|
-
const [startTime, setStartTime] = (0,
|
|
11864
|
-
const [endTime, setEndTime] = (0,
|
|
11865
|
-
const [allDay, setAllDay] = (0,
|
|
11866
|
-
const [location, setLocation] = (0,
|
|
11867
|
-
const [color, setColor] = (0,
|
|
11868
|
-
const [error, setError] = (0,
|
|
11869
|
-
const [startDateOpen, setStartDateOpen] = (0,
|
|
11870
|
-
const [endDateOpen, setEndDateOpen] = (0,
|
|
11871
|
-
(0,
|
|
12058
|
+
const [title, setTitle] = (0, import_react72.useState)("");
|
|
12059
|
+
const [description, setDescription] = (0, import_react72.useState)("");
|
|
12060
|
+
const [startDate, setStartDate] = (0, import_react72.useState)(/* @__PURE__ */ new Date());
|
|
12061
|
+
const [endDate, setEndDate] = (0, import_react72.useState)(/* @__PURE__ */ new Date());
|
|
12062
|
+
const [startTime, setStartTime] = (0, import_react72.useState)(`${DefaultStartHour}:00`);
|
|
12063
|
+
const [endTime, setEndTime] = (0, import_react72.useState)(`${DefaultEndHour}:00`);
|
|
12064
|
+
const [allDay, setAllDay] = (0, import_react72.useState)(false);
|
|
12065
|
+
const [location, setLocation] = (0, import_react72.useState)("");
|
|
12066
|
+
const [color, setColor] = (0, import_react72.useState)("sky");
|
|
12067
|
+
const [error, setError] = (0, import_react72.useState)(null);
|
|
12068
|
+
const [startDateOpen, setStartDateOpen] = (0, import_react72.useState)(false);
|
|
12069
|
+
const [endDateOpen, setEndDateOpen] = (0, import_react72.useState)(false);
|
|
12070
|
+
(0, import_react72.useEffect)(() => {
|
|
11872
12071
|
}, [event]);
|
|
11873
|
-
const resetForm = (0,
|
|
12072
|
+
const resetForm = (0, import_react72.useCallback)(() => {
|
|
11874
12073
|
setTitle("");
|
|
11875
12074
|
setDescription("");
|
|
11876
12075
|
setStartDate(/* @__PURE__ */ new Date());
|
|
@@ -11882,12 +12081,12 @@ function EventDialog({
|
|
|
11882
12081
|
setColor("sky");
|
|
11883
12082
|
setError(null);
|
|
11884
12083
|
}, []);
|
|
11885
|
-
const formatTimeForInput = (0,
|
|
12084
|
+
const formatTimeForInput = (0, import_react72.useCallback)((date) => {
|
|
11886
12085
|
const hours = date.getHours().toString().padStart(2, "0");
|
|
11887
12086
|
const minutes = Math.floor(date.getMinutes() / 15) * 15;
|
|
11888
12087
|
return `${hours}:${minutes.toString().padStart(2, "0")}`;
|
|
11889
12088
|
}, []);
|
|
11890
|
-
(0,
|
|
12089
|
+
(0, import_react72.useEffect)(() => {
|
|
11891
12090
|
if (event) {
|
|
11892
12091
|
setTitle(event.title || "");
|
|
11893
12092
|
setDescription(event.description || "");
|
|
@@ -11905,7 +12104,7 @@ function EventDialog({
|
|
|
11905
12104
|
resetForm();
|
|
11906
12105
|
}
|
|
11907
12106
|
}, [event, formatTimeForInput, resetForm]);
|
|
11908
|
-
const timeOptions = (0,
|
|
12107
|
+
const timeOptions = (0, import_react72.useMemo)(() => {
|
|
11909
12108
|
const options = [];
|
|
11910
12109
|
for (let hour = StartHour; hour <= EndHour; hour++) {
|
|
11911
12110
|
for (let minute = 0; minute < 60; minute += 15) {
|
|
@@ -11913,7 +12112,7 @@ function EventDialog({
|
|
|
11913
12112
|
const formattedMinute = minute.toString().padStart(2, "0");
|
|
11914
12113
|
const value = `${formattedHour}:${formattedMinute}`;
|
|
11915
12114
|
const date = new Date(2e3, 0, 1, hour, minute);
|
|
11916
|
-
const label = (0, import_date_fns18.format)(date, "HH:mm", { locale:
|
|
12115
|
+
const label = (0, import_date_fns18.format)(date, "HH:mm", { locale: import_locale10.ptBR });
|
|
11917
12116
|
options.push({ label, value });
|
|
11918
12117
|
}
|
|
11919
12118
|
}
|
|
@@ -12007,7 +12206,7 @@ function EventDialog({
|
|
|
12007
12206
|
exit: { opacity: 0, y: 8, scale: 0.995, transition: { duration: 0.12 } }
|
|
12008
12207
|
};
|
|
12009
12208
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DialogBase, { onOpenChange: (open) => !open && onClose(), open: isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DialogContentBase, { className: "sm:max-w-[425px]", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
12010
|
-
|
|
12209
|
+
import_framer_motion13.motion.div,
|
|
12011
12210
|
{
|
|
12012
12211
|
variants: dialogVariants2,
|
|
12013
12212
|
initial: "hidden",
|
|
@@ -12090,11 +12289,11 @@ function EventDialog({
|
|
|
12090
12289
|
"truncate",
|
|
12091
12290
|
!startDate && "text-muted-foreground"
|
|
12092
12291
|
),
|
|
12093
|
-
children: startDate ? (0, import_date_fns18.format)(startDate, "PPP", { locale:
|
|
12292
|
+
children: startDate ? (0, import_date_fns18.format)(startDate, "PPP", { locale: import_locale10.ptBR }) : "Escolher data"
|
|
12094
12293
|
}
|
|
12095
12294
|
),
|
|
12096
12295
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12097
|
-
|
|
12296
|
+
import_react73.CalendarIcon,
|
|
12098
12297
|
{
|
|
12099
12298
|
"aria-hidden": "true",
|
|
12100
12299
|
className: "shrink-0 text-muted-foreground/80",
|
|
@@ -12169,11 +12368,11 @@ function EventDialog({
|
|
|
12169
12368
|
"truncate",
|
|
12170
12369
|
!endDate && "text-muted-foreground"
|
|
12171
12370
|
),
|
|
12172
|
-
children: endDate ? (0, import_date_fns18.format)(endDate, "PPP", { locale:
|
|
12371
|
+
children: endDate ? (0, import_date_fns18.format)(endDate, "PPP", { locale: import_locale10.ptBR }) : "Escolher data"
|
|
12173
12372
|
}
|
|
12174
12373
|
),
|
|
12175
12374
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12176
|
-
|
|
12375
|
+
import_react73.CalendarIcon,
|
|
12177
12376
|
{
|
|
12178
12377
|
"aria-hidden": "true",
|
|
12179
12378
|
className: "shrink-0 text-muted-foreground/80",
|
|
@@ -12231,7 +12430,7 @@ function EventDialog({
|
|
|
12231
12430
|
allDay ? "bg-primary border-transparent text-white" : " border border-input"
|
|
12232
12431
|
),
|
|
12233
12432
|
children: [
|
|
12234
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12433
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react73.CalendarIcon, { size: 14, "aria-hidden": "true" }),
|
|
12235
12434
|
"Dia inteiro"
|
|
12236
12435
|
]
|
|
12237
12436
|
}
|
|
@@ -12290,7 +12489,7 @@ function EventDialog({
|
|
|
12290
12489
|
onClick: handleDelete,
|
|
12291
12490
|
size: "icon",
|
|
12292
12491
|
variant: "outline",
|
|
12293
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react73.TrashIcon, { "aria-hidden": "true", size: 16 })
|
|
12294
12493
|
}
|
|
12295
12494
|
),
|
|
12296
12495
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-1 justify-end gap-2", children: [
|
|
@@ -12305,8 +12504,8 @@ function EventDialog({
|
|
|
12305
12504
|
|
|
12306
12505
|
// src/components/ui/event-calendar/EventItem.tsx
|
|
12307
12506
|
var import_date_fns19 = require("date-fns");
|
|
12308
|
-
var
|
|
12309
|
-
var
|
|
12507
|
+
var import_react74 = require("react");
|
|
12508
|
+
var import_react75 = require("@phosphor-icons/react");
|
|
12310
12509
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
12311
12510
|
var formatTimeWithOptionalMinutes2 = (date) => {
|
|
12312
12511
|
return (0, import_date_fns19.format)(date, "HH:mm");
|
|
@@ -12390,7 +12589,7 @@ function EventItem({
|
|
|
12390
12589
|
const eventColor = event.color;
|
|
12391
12590
|
const hasValidTime = isValidDate3(event.start) && isValidDate3(event.end) || isValidDate3(event.attend_date);
|
|
12392
12591
|
const colorClasses = hasValidTime ? getEventColorClasses(eventColor) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
|
|
12393
|
-
const displayStart = (0,
|
|
12592
|
+
const displayStart = (0, import_react74.useMemo)(() => {
|
|
12394
12593
|
if (!hasValidTime) return void 0;
|
|
12395
12594
|
if (isValidDate3(event.start))
|
|
12396
12595
|
return currentTime || new Date(event.start);
|
|
@@ -12398,7 +12597,7 @@ function EventItem({
|
|
|
12398
12597
|
return currentTime || new Date(event.attend_date);
|
|
12399
12598
|
return void 0;
|
|
12400
12599
|
}, [currentTime, event.start, event.attend_date, hasValidTime]);
|
|
12401
|
-
const displayEnd = (0,
|
|
12600
|
+
const displayEnd = (0, import_react74.useMemo)(() => {
|
|
12402
12601
|
if (!hasValidTime) return void 0;
|
|
12403
12602
|
if (isValidDate3(event.end)) {
|
|
12404
12603
|
return currentTime ? new Date(
|
|
@@ -12411,7 +12610,7 @@ function EventItem({
|
|
|
12411
12610
|
}
|
|
12412
12611
|
return void 0;
|
|
12413
12612
|
}, [currentTime, event.start, event.end, event.attend_date, hasValidTime]);
|
|
12414
|
-
const durationMinutes = (0,
|
|
12613
|
+
const durationMinutes = (0, import_react74.useMemo)(() => {
|
|
12415
12614
|
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
12416
12615
|
return (0, import_date_fns19.differenceInMinutes)(displayEnd, displayStart);
|
|
12417
12616
|
}, [displayStart, displayEnd, hasValidTime]);
|
|
@@ -12586,7 +12785,7 @@ function EventItem({
|
|
|
12586
12785
|
formatTimeWithOptionalMinutes2(displayStart),
|
|
12587
12786
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "opacity-70", children: "-" }),
|
|
12588
12787
|
formatTimeWithOptionalMinutes2(displayEnd),
|
|
12589
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12788
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react75.ClockUserIcon, {})
|
|
12590
12789
|
] })
|
|
12591
12790
|
}
|
|
12592
12791
|
)
|
|
@@ -12613,10 +12812,10 @@ function EventItem({
|
|
|
12613
12812
|
|
|
12614
12813
|
// src/components/ui/event-calendar/EventsPopUp.tsx
|
|
12615
12814
|
var import_date_fns20 = require("date-fns");
|
|
12616
|
-
var
|
|
12617
|
-
var
|
|
12618
|
-
var
|
|
12619
|
-
var
|
|
12815
|
+
var import_locale11 = require("date-fns/locale");
|
|
12816
|
+
var import_react76 = require("react");
|
|
12817
|
+
var import_framer_motion14 = require("framer-motion");
|
|
12818
|
+
var import_react77 = require("@phosphor-icons/react");
|
|
12620
12819
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
12621
12820
|
function EventsPopup({
|
|
12622
12821
|
date,
|
|
@@ -12625,8 +12824,8 @@ function EventsPopup({
|
|
|
12625
12824
|
onClose,
|
|
12626
12825
|
onEventSelect
|
|
12627
12826
|
}) {
|
|
12628
|
-
const popupRef = (0,
|
|
12629
|
-
(0,
|
|
12827
|
+
const popupRef = (0, import_react76.useRef)(null);
|
|
12828
|
+
(0, import_react76.useEffect)(() => {
|
|
12630
12829
|
const handleClickOutside = (event) => {
|
|
12631
12830
|
if (popupRef.current && !popupRef.current.contains(event.target)) {
|
|
12632
12831
|
onClose();
|
|
@@ -12637,7 +12836,7 @@ function EventsPopup({
|
|
|
12637
12836
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
12638
12837
|
};
|
|
12639
12838
|
}, [onClose]);
|
|
12640
|
-
(0,
|
|
12839
|
+
(0, import_react76.useEffect)(() => {
|
|
12641
12840
|
const handleEscKey = (event) => {
|
|
12642
12841
|
if (event.key === "Escape") {
|
|
12643
12842
|
onClose();
|
|
@@ -12652,7 +12851,7 @@ function EventsPopup({
|
|
|
12652
12851
|
if (onEventSelect) onEventSelect(event);
|
|
12653
12852
|
onClose();
|
|
12654
12853
|
};
|
|
12655
|
-
const adjustedPosition = (0,
|
|
12854
|
+
const adjustedPosition = (0, import_react76.useMemo)(() => {
|
|
12656
12855
|
const positionCopy = { ...position };
|
|
12657
12856
|
if (popupRef.current) {
|
|
12658
12857
|
const rect = popupRef.current.getBoundingClientRect();
|
|
@@ -12668,7 +12867,7 @@ function EventsPopup({
|
|
|
12668
12867
|
return positionCopy;
|
|
12669
12868
|
}, [position]);
|
|
12670
12869
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
12671
|
-
|
|
12870
|
+
import_framer_motion14.motion.div,
|
|
12672
12871
|
{
|
|
12673
12872
|
className: "absolute z-50 max-h-96 w-80 overflow-auto rounded-md border bg-background shadow-lg",
|
|
12674
12873
|
ref: popupRef,
|
|
@@ -12683,9 +12882,9 @@ function EventsPopup({
|
|
|
12683
12882
|
children: [
|
|
12684
12883
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "sticky top-0 flex items-center justify-between border-b bg-background p-3", children: [
|
|
12685
12884
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("h3", { className: "font-medium", children: (() => {
|
|
12686
|
-
const dayNum = (0, import_date_fns20.format)(date, "d", { locale:
|
|
12687
|
-
const month = (0, import_date_fns20.format)(date, "MMMM", { locale:
|
|
12688
|
-
const year = (0, import_date_fns20.format)(date, "yyyy", { locale:
|
|
12885
|
+
const dayNum = (0, import_date_fns20.format)(date, "d", { locale: import_locale11.ptBR });
|
|
12886
|
+
const month = (0, import_date_fns20.format)(date, "MMMM", { locale: import_locale11.ptBR });
|
|
12887
|
+
const year = (0, import_date_fns20.format)(date, "yyyy", { locale: import_locale11.ptBR });
|
|
12689
12888
|
const monthCap = month.charAt(0).toUpperCase() + month.slice(1);
|
|
12690
12889
|
return `${dayNum} de ${monthCap} de ${year}`;
|
|
12691
12890
|
})() }),
|
|
@@ -12696,7 +12895,7 @@ function EventsPopup({
|
|
|
12696
12895
|
className: "rounded-full p-1 hover:bg-muted",
|
|
12697
12896
|
onClick: onClose,
|
|
12698
12897
|
type: "button",
|
|
12699
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react77.XIcon, { className: "h-4 w-4" })
|
|
12700
12899
|
}
|
|
12701
12900
|
)
|
|
12702
12901
|
] }),
|
|
@@ -12732,12 +12931,12 @@ function EventsPopup({
|
|
|
12732
12931
|
|
|
12733
12932
|
// src/components/ui/event-calendar/hooks/use-current-time-indicator.ts
|
|
12734
12933
|
var import_date_fns21 = require("date-fns");
|
|
12735
|
-
var
|
|
12736
|
-
var
|
|
12934
|
+
var import_locale12 = require("date-fns/locale");
|
|
12935
|
+
var import_react78 = require("react");
|
|
12737
12936
|
function useCurrentTimeIndicator(currentDate, view) {
|
|
12738
|
-
const [currentTimePosition, setCurrentTimePosition] = (0,
|
|
12739
|
-
const [currentTimeVisible, setCurrentTimeVisible] = (0,
|
|
12740
|
-
(0,
|
|
12937
|
+
const [currentTimePosition, setCurrentTimePosition] = (0, import_react78.useState)(0);
|
|
12938
|
+
const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react78.useState)(false);
|
|
12939
|
+
(0, import_react78.useEffect)(() => {
|
|
12741
12940
|
const calculateTimePosition = () => {
|
|
12742
12941
|
const now = /* @__PURE__ */ new Date();
|
|
12743
12942
|
const hours = now.getHours();
|
|
@@ -12750,8 +12949,8 @@ function useCurrentTimeIndicator(currentDate, view) {
|
|
|
12750
12949
|
if (view === "day") {
|
|
12751
12950
|
isCurrentTimeVisible = (0, import_date_fns21.isSameDay)(now, currentDate);
|
|
12752
12951
|
} else if (view === "week") {
|
|
12753
|
-
const startOfWeekDate = (0, import_date_fns21.startOfWeek)(currentDate, { locale:
|
|
12754
|
-
const endOfWeekDate = (0, import_date_fns21.endOfWeek)(currentDate, { locale:
|
|
12952
|
+
const startOfWeekDate = (0, import_date_fns21.startOfWeek)(currentDate, { locale: import_locale12.ptBR });
|
|
12953
|
+
const endOfWeekDate = (0, import_date_fns21.endOfWeek)(currentDate, { locale: import_locale12.ptBR });
|
|
12755
12954
|
isCurrentTimeVisible = (0, import_date_fns21.isWithinInterval)(now, {
|
|
12756
12955
|
end: endOfWeekDate,
|
|
12757
12956
|
start: startOfWeekDate
|
|
@@ -12768,15 +12967,15 @@ function useCurrentTimeIndicator(currentDate, view) {
|
|
|
12768
12967
|
}
|
|
12769
12968
|
|
|
12770
12969
|
// src/components/ui/event-calendar/hooks/use-event-visibility.ts
|
|
12771
|
-
var
|
|
12970
|
+
var import_react79 = require("react");
|
|
12772
12971
|
function useEventVisibility({
|
|
12773
12972
|
eventHeight,
|
|
12774
12973
|
eventGap
|
|
12775
12974
|
}) {
|
|
12776
|
-
const contentRef = (0,
|
|
12777
|
-
const observerRef = (0,
|
|
12778
|
-
const [contentHeight, setContentHeight] = (0,
|
|
12779
|
-
(0,
|
|
12975
|
+
const contentRef = (0, import_react79.useRef)(null);
|
|
12976
|
+
const observerRef = (0, import_react79.useRef)(null);
|
|
12977
|
+
const [contentHeight, setContentHeight] = (0, import_react79.useState)(null);
|
|
12978
|
+
(0, import_react79.useLayoutEffect)(() => {
|
|
12780
12979
|
if (!contentRef.current) return;
|
|
12781
12980
|
const updateHeight = () => {
|
|
12782
12981
|
if (contentRef.current) {
|
|
@@ -12796,7 +12995,7 @@ function useEventVisibility({
|
|
|
12796
12995
|
}
|
|
12797
12996
|
};
|
|
12798
12997
|
}, []);
|
|
12799
|
-
const getVisibleEventCount = (0,
|
|
12998
|
+
const getVisibleEventCount = (0, import_react79.useMemo)(() => {
|
|
12800
12999
|
return (totalEvents) => {
|
|
12801
13000
|
if (!contentHeight) return totalEvents;
|
|
12802
13001
|
const maxEvents = Math.floor(contentHeight / (eventHeight + eventGap));
|
|
@@ -12815,8 +13014,8 @@ function useEventVisibility({
|
|
|
12815
13014
|
|
|
12816
13015
|
// src/components/ui/event-calendar/MonthView.tsx
|
|
12817
13016
|
var import_date_fns22 = require("date-fns");
|
|
12818
|
-
var
|
|
12819
|
-
var
|
|
13017
|
+
var import_locale13 = require("date-fns/locale");
|
|
13018
|
+
var import_react80 = require("react");
|
|
12820
13019
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
12821
13020
|
function MonthView({
|
|
12822
13021
|
currentDate,
|
|
@@ -12824,21 +13023,21 @@ function MonthView({
|
|
|
12824
13023
|
onEventSelect,
|
|
12825
13024
|
onEventCreate
|
|
12826
13025
|
}) {
|
|
12827
|
-
const days = (0,
|
|
13026
|
+
const days = (0, import_react80.useMemo)(() => {
|
|
12828
13027
|
const monthStart = (0, import_date_fns22.startOfMonth)(currentDate);
|
|
12829
13028
|
const monthEnd = (0, import_date_fns22.endOfMonth)(monthStart);
|
|
12830
13029
|
const calendarStart = (0, import_date_fns22.startOfWeek)(monthStart, { weekStartsOn: 0 });
|
|
12831
13030
|
const calendarEnd = (0, import_date_fns22.endOfWeek)(monthEnd, { weekStartsOn: 0 });
|
|
12832
13031
|
return (0, import_date_fns22.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
|
|
12833
13032
|
}, [currentDate]);
|
|
12834
|
-
const weekdays = (0,
|
|
13033
|
+
const weekdays = (0, import_react80.useMemo)(() => {
|
|
12835
13034
|
return Array.from({ length: 7 }).map((_, i) => {
|
|
12836
13035
|
const date = (0, import_date_fns22.addDays)((0, import_date_fns22.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
|
|
12837
|
-
const short = (0, import_date_fns22.format)(date, "EEE", { locale:
|
|
13036
|
+
const short = (0, import_date_fns22.format)(date, "EEE", { locale: import_locale13.ptBR });
|
|
12838
13037
|
return short.charAt(0).toUpperCase() + short.slice(1);
|
|
12839
13038
|
});
|
|
12840
13039
|
}, []);
|
|
12841
|
-
const weeks = (0,
|
|
13040
|
+
const weeks = (0, import_react80.useMemo)(() => {
|
|
12842
13041
|
const result = [];
|
|
12843
13042
|
let week = [];
|
|
12844
13043
|
for (let i = 0; i < days.length; i++) {
|
|
@@ -12854,12 +13053,12 @@ function MonthView({
|
|
|
12854
13053
|
e.stopPropagation();
|
|
12855
13054
|
onEventSelect(event);
|
|
12856
13055
|
};
|
|
12857
|
-
const [isMounted, setIsMounted] = (0,
|
|
13056
|
+
const [isMounted, setIsMounted] = (0, import_react80.useState)(false);
|
|
12858
13057
|
const { contentRef, getVisibleEventCount } = useEventVisibility({
|
|
12859
13058
|
eventGap: EventGap,
|
|
12860
13059
|
eventHeight: EventHeight
|
|
12861
13060
|
});
|
|
12862
|
-
(0,
|
|
13061
|
+
(0, import_react80.useEffect)(() => {
|
|
12863
13062
|
setIsMounted(true);
|
|
12864
13063
|
}, []);
|
|
12865
13064
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "contents", "data-slot": "month-view", children: [
|
|
@@ -12974,7 +13173,7 @@ function MonthView({
|
|
|
12974
13173
|
"aria-label": `Show ${remainingCount} more events on ${(0, import_date_fns22.format)(
|
|
12975
13174
|
day,
|
|
12976
13175
|
"PPP",
|
|
12977
|
-
{ locale:
|
|
13176
|
+
{ locale: import_locale13.ptBR }
|
|
12978
13177
|
)}`,
|
|
12979
13178
|
children: [
|
|
12980
13179
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("span", { className: "font-medium", children: [
|
|
@@ -12994,7 +13193,7 @@ function MonthView({
|
|
|
12994
13193
|
"--event-height": `${EventHeight}px`
|
|
12995
13194
|
},
|
|
12996
13195
|
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "space-y-2", children: [
|
|
12997
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "font-medium text-sm", children: (0, import_date_fns22.format)(day, "EEE d", { locale:
|
|
13196
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "font-medium text-sm", children: (0, import_date_fns22.format)(day, "EEE d", { locale: import_locale13.ptBR }) }),
|
|
12998
13197
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "space-y-1", children: sortEvents(allEvents).map((event) => {
|
|
12999
13198
|
const eventStart = new Date(event.start);
|
|
13000
13199
|
const eventEnd = new Date(event.end);
|
|
@@ -13134,8 +13333,8 @@ function addHoursToDate(date, hours) {
|
|
|
13134
13333
|
|
|
13135
13334
|
// src/components/ui/event-calendar/WeekView.tsx
|
|
13136
13335
|
var import_date_fns25 = require("date-fns");
|
|
13137
|
-
var
|
|
13138
|
-
var
|
|
13336
|
+
var import_locale14 = require("date-fns/locale");
|
|
13337
|
+
var import_react81 = require("react");
|
|
13139
13338
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
13140
13339
|
function WeekView({
|
|
13141
13340
|
currentDate,
|
|
@@ -13143,23 +13342,23 @@ function WeekView({
|
|
|
13143
13342
|
onEventSelect,
|
|
13144
13343
|
onEventCreate
|
|
13145
13344
|
}) {
|
|
13146
|
-
const days = (0,
|
|
13345
|
+
const days = (0, import_react81.useMemo)(() => {
|
|
13147
13346
|
const weekStart2 = (0, import_date_fns25.startOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
13148
13347
|
const weekEnd = (0, import_date_fns25.endOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
13149
13348
|
return (0, import_date_fns25.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
|
|
13150
13349
|
}, [currentDate]);
|
|
13151
|
-
const weekStart = (0,
|
|
13350
|
+
const weekStart = (0, import_react81.useMemo)(
|
|
13152
13351
|
() => (0, import_date_fns25.startOfWeek)(currentDate, { weekStartsOn: 0 }),
|
|
13153
13352
|
[currentDate]
|
|
13154
13353
|
);
|
|
13155
|
-
const hours = (0,
|
|
13354
|
+
const hours = (0, import_react81.useMemo)(() => {
|
|
13156
13355
|
const dayStart = (0, import_date_fns25.startOfDay)(currentDate);
|
|
13157
13356
|
return (0, import_date_fns25.eachHourOfInterval)({
|
|
13158
13357
|
end: (0, import_date_fns25.addHours)(dayStart, EndHour - 1),
|
|
13159
13358
|
start: (0, import_date_fns25.addHours)(dayStart, StartHour)
|
|
13160
13359
|
});
|
|
13161
13360
|
}, [currentDate]);
|
|
13162
|
-
const allDayEvents = (0,
|
|
13361
|
+
const allDayEvents = (0, import_react81.useMemo)(() => {
|
|
13163
13362
|
return events.filter((event) => {
|
|
13164
13363
|
return event.allDay || isMultiDayEvent(event);
|
|
13165
13364
|
}).filter((event) => {
|
|
@@ -13170,7 +13369,7 @@ function WeekView({
|
|
|
13170
13369
|
);
|
|
13171
13370
|
});
|
|
13172
13371
|
}, [events, days]);
|
|
13173
|
-
const processedDayEvents = (0,
|
|
13372
|
+
const processedDayEvents = (0, import_react81.useMemo)(() => {
|
|
13174
13373
|
const result = days.map((day) => {
|
|
13175
13374
|
const dayEvents = events.filter((event) => {
|
|
13176
13375
|
if (event.allDay || isMultiDayEvent(event)) return false;
|
|
@@ -13263,11 +13462,11 @@ function WeekView({
|
|
|
13263
13462
|
"data-today": (0, import_date_fns25.isToday)(day) || void 0,
|
|
13264
13463
|
children: [
|
|
13265
13464
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { "aria-hidden": "true", className: "sm:hidden", children: [
|
|
13266
|
-
(0, import_date_fns25.format)(day, "EEE", { locale:
|
|
13465
|
+
(0, import_date_fns25.format)(day, "EEE", { locale: import_locale14.ptBR })[0],
|
|
13267
13466
|
" ",
|
|
13268
|
-
(0, import_date_fns25.format)(day, "d", { locale:
|
|
13467
|
+
(0, import_date_fns25.format)(day, "d", { locale: import_locale14.ptBR })
|
|
13269
13468
|
] }),
|
|
13270
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns25.format)(day, "EEE dd", { locale:
|
|
13469
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns25.format)(day, "EEE dd", { locale: import_locale14.ptBR }) })
|
|
13271
13470
|
]
|
|
13272
13471
|
},
|
|
13273
13472
|
day.toString()
|
|
@@ -13416,8 +13615,8 @@ function WeekView({
|
|
|
13416
13615
|
}
|
|
13417
13616
|
|
|
13418
13617
|
// src/components/ui/selects/AvatarCombobox.tsx
|
|
13419
|
-
var
|
|
13420
|
-
var
|
|
13618
|
+
var import_react82 = require("react");
|
|
13619
|
+
var import_react83 = require("@phosphor-icons/react");
|
|
13421
13620
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
13422
13621
|
var DEFAULT_COLORS = [
|
|
13423
13622
|
"bg-purple-100 text-purple-700",
|
|
@@ -13461,8 +13660,8 @@ function AvatarCombobox({
|
|
|
13461
13660
|
className,
|
|
13462
13661
|
colors: colors2
|
|
13463
13662
|
}) {
|
|
13464
|
-
const [open, setOpen] = (0,
|
|
13465
|
-
const id = (0,
|
|
13663
|
+
const [open, setOpen] = (0, import_react82.useState)(false);
|
|
13664
|
+
const id = (0, import_react82.useId)();
|
|
13466
13665
|
const allItems = items || (groupItems ? Object.values(groupItems).flat() : []);
|
|
13467
13666
|
const selectedItem = allItems.find((item) => item.value === selected);
|
|
13468
13667
|
const renderItem = (item) => {
|
|
@@ -13499,7 +13698,7 @@ function AvatarCombobox({
|
|
|
13499
13698
|
"data-testid": testIds.trigger ?? "avatar-select-trigger",
|
|
13500
13699
|
children: [
|
|
13501
13700
|
selectedItem ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "flex items-center gap-2 truncate", children: renderItem(selectedItem) }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "text-muted-foreground", children: placeholder }),
|
|
13502
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13701
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react83.CaretDownIcon, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
13503
13702
|
]
|
|
13504
13703
|
}
|
|
13505
13704
|
) }),
|
|
@@ -13525,7 +13724,7 @@ function AvatarCombobox({
|
|
|
13525
13724
|
children: [
|
|
13526
13725
|
renderItem(item),
|
|
13527
13726
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13528
|
-
|
|
13727
|
+
import_react83.CheckIcon,
|
|
13529
13728
|
{
|
|
13530
13729
|
className: cn(
|
|
13531
13730
|
"ml-auto h-4 w-4",
|
|
@@ -13548,7 +13747,7 @@ function AvatarCombobox({
|
|
|
13548
13747
|
children: [
|
|
13549
13748
|
renderItem(item),
|
|
13550
13749
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13551
|
-
|
|
13750
|
+
import_react83.CheckIcon,
|
|
13552
13751
|
{
|
|
13553
13752
|
className: cn(
|
|
13554
13753
|
"ml-auto h-4 w-4",
|
|
@@ -13570,11 +13769,11 @@ function AvatarCombobox({
|
|
|
13570
13769
|
}
|
|
13571
13770
|
|
|
13572
13771
|
// src/components/ui/selects/MultiSelectBase.tsx
|
|
13573
|
-
var
|
|
13574
|
-
var
|
|
13575
|
-
var
|
|
13772
|
+
var import_react84 = require("@phosphor-icons/react");
|
|
13773
|
+
var import_react85 = require("react");
|
|
13774
|
+
var import_framer_motion15 = require("framer-motion");
|
|
13576
13775
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
13577
|
-
var MultiSelectContext = (0,
|
|
13776
|
+
var MultiSelectContext = (0, import_react85.createContext)(null);
|
|
13578
13777
|
function MultiSelectBase({
|
|
13579
13778
|
children,
|
|
13580
13779
|
values,
|
|
@@ -13584,12 +13783,12 @@ function MultiSelectBase({
|
|
|
13584
13783
|
empty,
|
|
13585
13784
|
error
|
|
13586
13785
|
}) {
|
|
13587
|
-
const [open, setOpen] = (0,
|
|
13588
|
-
const [internalValues, setInternalValues] = (0,
|
|
13786
|
+
const [open, setOpen] = (0, import_react85.useState)(false);
|
|
13787
|
+
const [internalValues, setInternalValues] = (0, import_react85.useState)(
|
|
13589
13788
|
new Set(values ?? defaultValues)
|
|
13590
13789
|
);
|
|
13591
13790
|
const selectedValues = values ? new Set(values) : internalValues;
|
|
13592
|
-
const [items, setItems] = (0,
|
|
13791
|
+
const [items, setItems] = (0, import_react85.useState)(/* @__PURE__ */ new Map());
|
|
13593
13792
|
function toggleValue(value) {
|
|
13594
13793
|
if (disabled) return;
|
|
13595
13794
|
const getNewSet = (prev) => {
|
|
@@ -13604,7 +13803,7 @@ function MultiSelectBase({
|
|
|
13604
13803
|
setInternalValues(getNewSet);
|
|
13605
13804
|
onValuesChange?.([...getNewSet(selectedValues)]);
|
|
13606
13805
|
}
|
|
13607
|
-
const onItemAdded = (0,
|
|
13806
|
+
const onItemAdded = (0, import_react85.useCallback)((value, label) => {
|
|
13608
13807
|
setItems((prev) => {
|
|
13609
13808
|
if (prev.get(value) === label) return prev;
|
|
13610
13809
|
return new Map(prev).set(value, label);
|
|
@@ -13661,7 +13860,7 @@ function MultiSelectTriggerBase({
|
|
|
13661
13860
|
),
|
|
13662
13861
|
children: [
|
|
13663
13862
|
children,
|
|
13664
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13863
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react84.CaretUpDownIcon, { className: "size-4 shrink-0 opacity-50" })
|
|
13665
13864
|
]
|
|
13666
13865
|
}
|
|
13667
13866
|
) }),
|
|
@@ -13676,13 +13875,13 @@ function MultiSelectValueBase({
|
|
|
13676
13875
|
...props
|
|
13677
13876
|
}) {
|
|
13678
13877
|
const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
|
|
13679
|
-
const [overflowAmount, setOverflowAmount] = (0,
|
|
13680
|
-
const valueRef = (0,
|
|
13681
|
-
const overflowRef = (0,
|
|
13682
|
-
const mutationObserverRef = (0,
|
|
13683
|
-
const resizeObserverRef = (0,
|
|
13878
|
+
const [overflowAmount, setOverflowAmount] = (0, import_react85.useState)(0);
|
|
13879
|
+
const valueRef = (0, import_react85.useRef)(null);
|
|
13880
|
+
const overflowRef = (0, import_react85.useRef)(null);
|
|
13881
|
+
const mutationObserverRef = (0, import_react85.useRef)(null);
|
|
13882
|
+
const resizeObserverRef = (0, import_react85.useRef)(null);
|
|
13684
13883
|
const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
|
|
13685
|
-
const checkOverflow = (0,
|
|
13884
|
+
const checkOverflow = (0, import_react85.useCallback)(() => {
|
|
13686
13885
|
if (valueRef.current == null) return;
|
|
13687
13886
|
const containerElement = valueRef.current;
|
|
13688
13887
|
const overflowElement = overflowRef.current;
|
|
@@ -13703,7 +13902,7 @@ function MultiSelectValueBase({
|
|
|
13703
13902
|
}
|
|
13704
13903
|
setOverflowAmount(amount);
|
|
13705
13904
|
}, []);
|
|
13706
|
-
const handleResize = (0,
|
|
13905
|
+
const handleResize = (0, import_react85.useCallback)(
|
|
13707
13906
|
(node) => {
|
|
13708
13907
|
if (node == null) {
|
|
13709
13908
|
valueRef.current = null;
|
|
@@ -13769,7 +13968,7 @@ function MultiSelectValueBase({
|
|
|
13769
13968
|
} : void 0,
|
|
13770
13969
|
children: [
|
|
13771
13970
|
items.get(value),
|
|
13772
|
-
clickToRemove && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13971
|
+
clickToRemove && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react84.XIcon, { className: "size-3 text-muted-foreground group-hover:text-destructive" })
|
|
13773
13972
|
]
|
|
13774
13973
|
},
|
|
13775
13974
|
value
|
|
@@ -13799,7 +13998,7 @@ function MultiSelectContentBase({
|
|
|
13799
13998
|
const canSearch = typeof search === "object" ? true : search;
|
|
13800
13999
|
const { emptyMessage } = useMultiSelectContext();
|
|
13801
14000
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_jsx_runtime85.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PopoverContentBase, { className: "w-[--radix-popover-trigger-width] relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md p-0", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13802
|
-
|
|
14001
|
+
import_framer_motion15.motion.div,
|
|
13803
14002
|
{
|
|
13804
14003
|
initial: { opacity: 0, scale: 0.95 },
|
|
13805
14004
|
animate: { opacity: 1, scale: 1 },
|
|
@@ -13829,7 +14028,7 @@ function MultiSelectItemBase({
|
|
|
13829
14028
|
}) {
|
|
13830
14029
|
const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
|
|
13831
14030
|
const isSelected = selectedValues.has(value);
|
|
13832
|
-
(0,
|
|
14031
|
+
(0, import_react85.useEffect)(() => {
|
|
13833
14032
|
onItemAdded(value, badgeLabel ?? children);
|
|
13834
14033
|
}, [value, children, onItemAdded, badgeLabel]);
|
|
13835
14034
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
@@ -13841,17 +14040,17 @@ function MultiSelectItemBase({
|
|
|
13841
14040
|
onSelect?.(value);
|
|
13842
14041
|
},
|
|
13843
14042
|
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
13844
|
-
|
|
14043
|
+
import_framer_motion15.motion.div,
|
|
13845
14044
|
{
|
|
13846
14045
|
transition: { duration: 0.1 },
|
|
13847
14046
|
children: [
|
|
13848
14047
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13849
|
-
|
|
14048
|
+
import_framer_motion15.motion.div,
|
|
13850
14049
|
{
|
|
13851
14050
|
initial: { scale: 0 },
|
|
13852
14051
|
animate: { scale: isSelected ? 1 : 0 },
|
|
13853
14052
|
transition: { type: "spring", stiffness: 500, damping: 30 },
|
|
13854
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
14053
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react84.CheckIcon, { className: "size-4" })
|
|
13855
14054
|
}
|
|
13856
14055
|
) }),
|
|
13857
14056
|
children
|
|
@@ -13868,7 +14067,7 @@ function MultiSelectSeparatorBase(props) {
|
|
|
13868
14067
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandSeparatorBase, { ...props });
|
|
13869
14068
|
}
|
|
13870
14069
|
function useMultiSelectContext() {
|
|
13871
|
-
const context = (0,
|
|
14070
|
+
const context = (0, import_react85.useContext)(MultiSelectContext);
|
|
13872
14071
|
if (context == null) {
|
|
13873
14072
|
throw new Error(
|
|
13874
14073
|
"useMultiSelectContext must be used within a MultiSelectContext"
|
|
@@ -13885,7 +14084,7 @@ function debounce(func, wait) {
|
|
|
13885
14084
|
}
|
|
13886
14085
|
|
|
13887
14086
|
// src/components/ui/charts/Chart.tsx
|
|
13888
|
-
var
|
|
14087
|
+
var import_react90 = require("react");
|
|
13889
14088
|
var import_recharts = require("recharts");
|
|
13890
14089
|
|
|
13891
14090
|
// src/components/ui/charts/utils/helpers.ts
|
|
@@ -14032,8 +14231,8 @@ var resolveChartMargins = (margins, chartMargins, showLabels) => {
|
|
|
14032
14231
|
var import_sonner4 = require("sonner");
|
|
14033
14232
|
|
|
14034
14233
|
// src/components/ui/charts/components/controls/PeriodsDropdown.tsx
|
|
14035
|
-
var
|
|
14036
|
-
var
|
|
14234
|
+
var import_react86 = require("react");
|
|
14235
|
+
var import_framer_motion16 = require("framer-motion");
|
|
14037
14236
|
var import_ssr4 = require("@phosphor-icons/react/dist/ssr");
|
|
14038
14237
|
var import_ssr5 = require("@phosphor-icons/react/dist/ssr");
|
|
14039
14238
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
@@ -14055,11 +14254,11 @@ function PeriodsDropdown({
|
|
|
14055
14254
|
activePeriods
|
|
14056
14255
|
}) {
|
|
14057
14256
|
const periods = processedData.map((d) => String(d.name));
|
|
14058
|
-
const [open, setOpen] = (0,
|
|
14059
|
-
const wrapperRef = (0,
|
|
14060
|
-
const firstItemRef = (0,
|
|
14061
|
-
const listRef = (0,
|
|
14062
|
-
(0,
|
|
14257
|
+
const [open, setOpen] = (0, import_react86.useState)(false);
|
|
14258
|
+
const wrapperRef = (0, import_react86.useRef)(null);
|
|
14259
|
+
const firstItemRef = (0, import_react86.useRef)(null);
|
|
14260
|
+
const listRef = (0, import_react86.useRef)(null);
|
|
14261
|
+
(0, import_react86.useEffect)(() => {
|
|
14063
14262
|
const handleClickOutside = (e) => {
|
|
14064
14263
|
if (!wrapperRef.current) return;
|
|
14065
14264
|
if (!wrapperRef.current.contains(e.target)) setOpen(false);
|
|
@@ -14074,7 +14273,7 @@ function PeriodsDropdown({
|
|
|
14074
14273
|
document.removeEventListener("keydown", handleEscape);
|
|
14075
14274
|
};
|
|
14076
14275
|
}, []);
|
|
14077
|
-
(0,
|
|
14276
|
+
(0, import_react86.useEffect)(() => {
|
|
14078
14277
|
if (open && firstItemRef.current) {
|
|
14079
14278
|
firstItemRef.current.focus();
|
|
14080
14279
|
}
|
|
@@ -14108,8 +14307,8 @@ function PeriodsDropdown({
|
|
|
14108
14307
|
]
|
|
14109
14308
|
}
|
|
14110
14309
|
),
|
|
14111
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14112
|
-
|
|
14310
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_framer_motion16.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
14311
|
+
import_framer_motion16.motion.div,
|
|
14113
14312
|
{
|
|
14114
14313
|
initial: "hidden",
|
|
14115
14314
|
animate: "visible",
|
|
@@ -14138,7 +14337,7 @@ function PeriodsDropdown({
|
|
|
14138
14337
|
className: "flex flex-col p-2 gap-1",
|
|
14139
14338
|
style: { maxHeight: 200, overflowY: "auto" },
|
|
14140
14339
|
children: periods.map((p, idx) => /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
14141
|
-
|
|
14340
|
+
import_framer_motion16.motion.button,
|
|
14142
14341
|
{
|
|
14143
14342
|
className: "flex items-center justify-between w-full text-left px-3 py-2.5 rounded focus:outline-none transition-colors " + (activePeriods && activePeriods.includes(p) || p === activePeriod ? "bg-accent/10 font-medium" : "hover:bg-accent/15 focus-visible:ring-2 focus-visible:ring-accent/30"),
|
|
14144
14343
|
variants: itemVariants,
|
|
@@ -14166,8 +14365,8 @@ function PeriodsDropdown({
|
|
|
14166
14365
|
var PeriodsDropdown_default = PeriodsDropdown;
|
|
14167
14366
|
|
|
14168
14367
|
// src/components/ui/charts/components/controls/ShowOnly.tsx
|
|
14169
|
-
var
|
|
14170
|
-
var
|
|
14368
|
+
var import_framer_motion17 = require("framer-motion");
|
|
14369
|
+
var import_react87 = require("@phosphor-icons/react");
|
|
14171
14370
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
14172
14371
|
var ShowOnly = ({
|
|
14173
14372
|
showOnlyHighlighted,
|
|
@@ -14177,7 +14376,7 @@ var ShowOnly = ({
|
|
|
14177
14376
|
const hasHighlights = highlightedSeriesSize > 0;
|
|
14178
14377
|
if (!hasHighlights) return null;
|
|
14179
14378
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
14180
|
-
|
|
14379
|
+
import_framer_motion17.motion.div,
|
|
14181
14380
|
{
|
|
14182
14381
|
whileTap: { scale: hasHighlights ? 0.985 : 1 },
|
|
14183
14382
|
whileHover: { y: hasHighlights ? -2 : 0 },
|
|
@@ -14196,10 +14395,10 @@ var ShowOnly = ({
|
|
|
14196
14395
|
!hasHighlights ? "opacity-60 cursor-not-allowed pointer-events-none" : showOnlyHighlighted ? "bg-primary/10 text-primary shadow-sm border border-primary/20" : "bg-transparent text-muted-foreground border border-transparent hover:bg-muted/10 hover:text-foreground"
|
|
14197
14396
|
),
|
|
14198
14397
|
children: showOnlyHighlighted ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
14199
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
14398
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react87.EyeSlash, { size: 16, weight: "regular" }),
|
|
14200
14399
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "sr-only", children: "Exibir todos" })
|
|
14201
14400
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
14202
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
14401
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react87.Eye, { size: 16, weight: "bold" }),
|
|
14203
14402
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "sr-only", children: "Mostrar somente destacados" })
|
|
14204
14403
|
] })
|
|
14205
14404
|
}
|
|
@@ -14210,7 +14409,7 @@ var ShowOnly = ({
|
|
|
14210
14409
|
var ShowOnly_default = ShowOnly;
|
|
14211
14410
|
|
|
14212
14411
|
// src/components/ui/charts/components/controls/Highlights.tsx
|
|
14213
|
-
var
|
|
14412
|
+
var import_framer_motion18 = require("framer-motion");
|
|
14214
14413
|
var import_ssr6 = require("@phosphor-icons/react/dist/ssr");
|
|
14215
14414
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
14216
14415
|
var Highlights = ({
|
|
@@ -14231,13 +14430,13 @@ var Highlights = ({
|
|
|
14231
14430
|
visible: { opacity: 1, transition: { staggerChildren: 0.03 } }
|
|
14232
14431
|
};
|
|
14233
14432
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14234
|
-
|
|
14433
|
+
import_framer_motion18.motion.div,
|
|
14235
14434
|
{
|
|
14236
14435
|
className: "flex-1 flex items-center gap-2 flex-wrap",
|
|
14237
14436
|
initial: "hidden",
|
|
14238
14437
|
animate: "visible",
|
|
14239
14438
|
variants: containerVariants,
|
|
14240
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_framer_motion18.AnimatePresence, { initial: false, mode: "popLayout", children: allKeys.map((k) => {
|
|
14241
14440
|
const isHighlighted = highlightedSeries.has(k);
|
|
14242
14441
|
const label = mapperConfig[k]?.label ?? k;
|
|
14243
14442
|
const color = finalColors[k];
|
|
@@ -14247,14 +14446,14 @@ var Highlights = ({
|
|
|
14247
14446
|
isHighlighted ? "bg-card/95 border-2 text-foreground shadow-[0_6px_18px_rgba(0,0,0,0.12)]" : "bg-muted/10 border-border text-muted-foreground hover:bg-muted/5"
|
|
14248
14447
|
);
|
|
14249
14448
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14250
|
-
|
|
14449
|
+
import_framer_motion18.motion.div,
|
|
14251
14450
|
{
|
|
14252
14451
|
layout: true,
|
|
14253
14452
|
initial: "hidden",
|
|
14254
14453
|
animate: "visible",
|
|
14255
14454
|
exit: "exit",
|
|
14256
14455
|
children: (() => {
|
|
14257
|
-
const MotionButtonBase = (0,
|
|
14456
|
+
const MotionButtonBase = (0, import_framer_motion18.motion)(
|
|
14258
14457
|
ButtonBase
|
|
14259
14458
|
);
|
|
14260
14459
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
@@ -14271,7 +14470,7 @@ var Highlights = ({
|
|
|
14271
14470
|
animate: isHighlighted ? { scale: 1.02 } : { scale: 1 },
|
|
14272
14471
|
children: [
|
|
14273
14472
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14274
|
-
|
|
14473
|
+
import_framer_motion18.motion.span,
|
|
14275
14474
|
{
|
|
14276
14475
|
className: cn("w-3 h-3 rounded-sm flex-shrink-0 border"),
|
|
14277
14476
|
style: {
|
|
@@ -14290,14 +14489,14 @@ var Highlights = ({
|
|
|
14290
14489
|
}
|
|
14291
14490
|
),
|
|
14292
14491
|
showFullLabel ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14293
|
-
|
|
14492
|
+
import_framer_motion18.motion.span,
|
|
14294
14493
|
{
|
|
14295
14494
|
className: "truncate max-w-[10rem] mt-0.5",
|
|
14296
14495
|
layout: true,
|
|
14297
14496
|
children: label
|
|
14298
14497
|
}
|
|
14299
14498
|
) : showShortLabel ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14300
|
-
|
|
14499
|
+
import_framer_motion18.motion.span,
|
|
14301
14500
|
{
|
|
14302
14501
|
className: "truncate max-w-[6rem] text-xs pr-2",
|
|
14303
14502
|
layout: true,
|
|
@@ -14305,7 +14504,7 @@ var Highlights = ({
|
|
|
14305
14504
|
}
|
|
14306
14505
|
) : null,
|
|
14307
14506
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14308
|
-
|
|
14507
|
+
import_framer_motion18.motion.span,
|
|
14309
14508
|
{
|
|
14310
14509
|
"aria-hidden": true,
|
|
14311
14510
|
initial: { opacity: 0, scale: 0.6 },
|
|
@@ -14417,9 +14616,9 @@ var CloseAllButton = ({
|
|
|
14417
14616
|
var CloseAllButton_default = CloseAllButton;
|
|
14418
14617
|
|
|
14419
14618
|
// src/components/ui/charts/components/tooltips/DraggableTooltip.tsx
|
|
14420
|
-
var
|
|
14421
|
-
var
|
|
14422
|
-
var
|
|
14619
|
+
var import_react88 = __toESM(require("react"));
|
|
14620
|
+
var import_framer_motion19 = require("framer-motion");
|
|
14621
|
+
var import_react89 = require("@phosphor-icons/react");
|
|
14423
14622
|
var import_ssr8 = require("@phosphor-icons/react/dist/ssr");
|
|
14424
14623
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
14425
14624
|
var ALIGNMENT_THRESHOLD = 25;
|
|
@@ -14498,12 +14697,12 @@ var DraggableTooltipComponent = ({
|
|
|
14498
14697
|
valueFormatter: valueFormatter2,
|
|
14499
14698
|
categoryFormatter
|
|
14500
14699
|
}) => {
|
|
14501
|
-
const visibleKeys = (0,
|
|
14700
|
+
const visibleKeys = (0, import_react88.useMemo)(
|
|
14502
14701
|
() => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
|
|
14503
14702
|
[showOnlyHighlighted, highlightedSeries, dataKeys]
|
|
14504
14703
|
);
|
|
14505
|
-
const TotalDisplay =
|
|
14506
|
-
const total = (0,
|
|
14704
|
+
const TotalDisplay = import_react88.default.memo(({ data: data2, visibleKeys: visibleKeys2, valueFormatter: localformatter }) => {
|
|
14705
|
+
const total = (0, import_react88.useMemo)(() => {
|
|
14507
14706
|
const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
|
|
14508
14707
|
return numeric.reduce((s, v) => s + (v || 0), 0);
|
|
14509
14708
|
}, [data2, visibleKeys2]);
|
|
@@ -14525,14 +14724,14 @@ var DraggableTooltipComponent = ({
|
|
|
14525
14724
|
)
|
|
14526
14725
|
] });
|
|
14527
14726
|
});
|
|
14528
|
-
const [localPos, setLocalPos] = (0,
|
|
14529
|
-
const [dragging, setDragging] = (0,
|
|
14530
|
-
const offsetRef = (0,
|
|
14531
|
-
const lastMouse = (0,
|
|
14532
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
14533
|
-
const [globalTooltipCountLocal, setGlobalTooltipCountLocal] = (0,
|
|
14534
|
-
(0,
|
|
14535
|
-
const getAllTooltips = (0,
|
|
14727
|
+
const [localPos, setLocalPos] = (0, import_react88.useState)(position);
|
|
14728
|
+
const [dragging, setDragging] = (0, import_react88.useState)(false);
|
|
14729
|
+
const offsetRef = (0, import_react88.useRef)({ x: 0, y: 0 });
|
|
14730
|
+
const lastMouse = (0, import_react88.useRef)({ x: 0, y: 0 });
|
|
14731
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react88.useState)([]);
|
|
14732
|
+
const [globalTooltipCountLocal, setGlobalTooltipCountLocal] = (0, import_react88.useState)(0);
|
|
14733
|
+
(0, import_react88.useEffect)(() => setLocalPos(position), [position]);
|
|
14734
|
+
const getAllTooltips = (0, import_react88.useCallback)(() => {
|
|
14536
14735
|
const response = [];
|
|
14537
14736
|
const ev = new CustomEvent("requestGlobalTooltips", {
|
|
14538
14737
|
detail: { requesterId: id, response }
|
|
@@ -14540,7 +14739,7 @@ var DraggableTooltipComponent = ({
|
|
|
14540
14739
|
window.dispatchEvent(ev);
|
|
14541
14740
|
return response;
|
|
14542
14741
|
}, [id]);
|
|
14543
|
-
const updateAlignmentGuides = (0,
|
|
14742
|
+
const updateAlignmentGuides = (0, import_react88.useCallback)(
|
|
14544
14743
|
(currentPosition) => {
|
|
14545
14744
|
const allTooltips = getAllTooltips();
|
|
14546
14745
|
const otherTooltips = allTooltips.filter((t) => t.id !== id);
|
|
@@ -14589,7 +14788,7 @@ var DraggableTooltipComponent = ({
|
|
|
14589
14788
|
},
|
|
14590
14789
|
[getAllTooltips, id]
|
|
14591
14790
|
);
|
|
14592
|
-
const snapToGuides = (0,
|
|
14791
|
+
const snapToGuides = (0, import_react88.useCallback)(
|
|
14593
14792
|
(position2) => {
|
|
14594
14793
|
const snappedPosition = { ...position2 };
|
|
14595
14794
|
let hasSnapped = false;
|
|
@@ -14636,7 +14835,7 @@ var DraggableTooltipComponent = ({
|
|
|
14636
14835
|
},
|
|
14637
14836
|
[alignmentGuides]
|
|
14638
14837
|
);
|
|
14639
|
-
(0,
|
|
14838
|
+
(0, import_react88.useEffect)(() => {
|
|
14640
14839
|
let rafId = null;
|
|
14641
14840
|
const handleMouseMove = (e) => {
|
|
14642
14841
|
if (!dragging) return;
|
|
@@ -14678,7 +14877,7 @@ var DraggableTooltipComponent = ({
|
|
|
14678
14877
|
document.body.style.userSelect = "";
|
|
14679
14878
|
};
|
|
14680
14879
|
}, [dragging, snapToGuides, updateAlignmentGuides, id, onPositionChange]);
|
|
14681
|
-
(0,
|
|
14880
|
+
(0, import_react88.useEffect)(() => {
|
|
14682
14881
|
const handleCloseAll = () => onClose(id);
|
|
14683
14882
|
const handleRequestTooltipCount = () => {
|
|
14684
14883
|
window.dispatchEvent(
|
|
@@ -14709,7 +14908,7 @@ var DraggableTooltipComponent = ({
|
|
|
14709
14908
|
});
|
|
14710
14909
|
};
|
|
14711
14910
|
}, [id, localPos, onClose]);
|
|
14712
|
-
(0,
|
|
14911
|
+
(0, import_react88.useEffect)(() => {
|
|
14713
14912
|
if (dragging) return;
|
|
14714
14913
|
let total = 0;
|
|
14715
14914
|
const timeoutId = setTimeout(() => {
|
|
@@ -14727,7 +14926,7 @@ var DraggableTooltipComponent = ({
|
|
|
14727
14926
|
}, 0);
|
|
14728
14927
|
return () => clearTimeout(timeoutId);
|
|
14729
14928
|
}, [localPos, dragging]);
|
|
14730
|
-
(0,
|
|
14929
|
+
(0, import_react88.useEffect)(() => {
|
|
14731
14930
|
const recount = () => {
|
|
14732
14931
|
if (dragging) return;
|
|
14733
14932
|
let total = 0;
|
|
@@ -14745,7 +14944,7 @@ var DraggableTooltipComponent = ({
|
|
|
14745
14944
|
window.addEventListener("recountTooltips", recount);
|
|
14746
14945
|
return () => window.removeEventListener("recountTooltips", recount);
|
|
14747
14946
|
}, [dragging]);
|
|
14748
|
-
const handleMouseDownLocal = (0,
|
|
14947
|
+
const handleMouseDownLocal = (0, import_react88.useCallback)(
|
|
14749
14948
|
(e) => {
|
|
14750
14949
|
e.preventDefault();
|
|
14751
14950
|
e.stopPropagation();
|
|
@@ -14756,7 +14955,7 @@ var DraggableTooltipComponent = ({
|
|
|
14756
14955
|
},
|
|
14757
14956
|
[id, onMouseDown]
|
|
14758
14957
|
);
|
|
14759
|
-
const handleTouchStartLocal = (0,
|
|
14958
|
+
const handleTouchStartLocal = (0, import_react88.useCallback)(
|
|
14760
14959
|
(e) => {
|
|
14761
14960
|
e.stopPropagation();
|
|
14762
14961
|
const touch = e.touches[0];
|
|
@@ -14771,7 +14970,7 @@ var DraggableTooltipComponent = ({
|
|
|
14771
14970
|
},
|
|
14772
14971
|
[id, onMouseDown]
|
|
14773
14972
|
);
|
|
14774
|
-
const handleCloseClick = (0,
|
|
14973
|
+
const handleCloseClick = (0, import_react88.useCallback)(
|
|
14775
14974
|
(e) => {
|
|
14776
14975
|
e.stopPropagation();
|
|
14777
14976
|
onClose(id);
|
|
@@ -14800,7 +14999,7 @@ var DraggableTooltipComponent = ({
|
|
|
14800
14999
|
);
|
|
14801
15000
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { children: [
|
|
14802
15001
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14803
|
-
|
|
15002
|
+
import_framer_motion19.motion.div,
|
|
14804
15003
|
{
|
|
14805
15004
|
className: "fixed pointer-events-none z-30",
|
|
14806
15005
|
variants: guideVariants,
|
|
@@ -14822,7 +15021,7 @@ var DraggableTooltipComponent = ({
|
|
|
14822
15021
|
}
|
|
14823
15022
|
),
|
|
14824
15023
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14825
|
-
|
|
15024
|
+
import_framer_motion19.motion.div,
|
|
14826
15025
|
{
|
|
14827
15026
|
className: "fixed pointer-events-none z-31",
|
|
14828
15027
|
variants: guideDotVariants,
|
|
@@ -14841,7 +15040,7 @@ var DraggableTooltipComponent = ({
|
|
|
14841
15040
|
}
|
|
14842
15041
|
),
|
|
14843
15042
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14844
|
-
|
|
15043
|
+
import_framer_motion19.motion.div,
|
|
14845
15044
|
{
|
|
14846
15045
|
className: "fixed pointer-events-none z-31",
|
|
14847
15046
|
variants: guideDotVariants,
|
|
@@ -14861,8 +15060,8 @@ var DraggableTooltipComponent = ({
|
|
|
14861
15060
|
)
|
|
14862
15061
|
] }, index);
|
|
14863
15062
|
}),
|
|
14864
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14865
|
-
|
|
15063
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_framer_motion19.AnimatePresence, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
15064
|
+
import_framer_motion19.motion.div,
|
|
14866
15065
|
{
|
|
14867
15066
|
className: "fixed bg-card border border-border rounded-lg shadow-lg z-50 min-w-80 select-none",
|
|
14868
15067
|
variants: tooltipVariants,
|
|
@@ -14887,7 +15086,7 @@ var DraggableTooltipComponent = ({
|
|
|
14887
15086
|
onTouchStart: handleTouchStartLocal,
|
|
14888
15087
|
style: { touchAction: "none" },
|
|
14889
15088
|
children: [
|
|
14890
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15089
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react89.DotsSixVerticalIcon, { size: 16 }),
|
|
14891
15090
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "flex flex-col gap-1", children: title && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "flex items-center gap-2 pb-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "font-bold text-foreground text-base", children: title }) }) }),
|
|
14892
15091
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14893
15092
|
"button",
|
|
@@ -14917,7 +15116,7 @@ var DraggableTooltipComponent = ({
|
|
|
14917
15116
|
] }) }),
|
|
14918
15117
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "p-3 pt-2 space-y-2", children: [
|
|
14919
15118
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2", children: dataLabel }),
|
|
14920
|
-
(0,
|
|
15119
|
+
(0, import_react88.useMemo)(
|
|
14921
15120
|
() => visibleKeys.map((key) => {
|
|
14922
15121
|
const value = data[key];
|
|
14923
15122
|
if (value === void 0) return null;
|
|
@@ -15035,7 +15234,7 @@ var DraggableTooltipComponent = ({
|
|
|
15035
15234
|
)
|
|
15036
15235
|
] });
|
|
15037
15236
|
};
|
|
15038
|
-
var DraggableTooltip =
|
|
15237
|
+
var DraggableTooltip = import_react88.default.memo(DraggableTooltipComponent);
|
|
15039
15238
|
DraggableTooltip.displayName = "DraggableTooltip";
|
|
15040
15239
|
var DraggableTooltip_default = DraggableTooltip;
|
|
15041
15240
|
|
|
@@ -15492,17 +15691,19 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
|
|
|
15492
15691
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
15493
15692
|
var NoData = ({
|
|
15494
15693
|
paddingLeft = 0,
|
|
15495
|
-
height =
|
|
15694
|
+
height = 400,
|
|
15496
15695
|
message = "Sem dados para exibir",
|
|
15497
|
-
className
|
|
15696
|
+
className,
|
|
15697
|
+
title
|
|
15498
15698
|
}) => {
|
|
15499
|
-
const svgHeight = typeof height === "number" ? height :
|
|
15699
|
+
const svgHeight = typeof height === "number" ? height : 400;
|
|
15500
15700
|
const bars = [
|
|
15501
|
-
{ x:
|
|
15502
|
-
{ x:
|
|
15503
|
-
{ x:
|
|
15504
|
-
{ x:
|
|
15505
|
-
{ x:
|
|
15701
|
+
{ x: 100, w: 100, h: svgHeight * 0.35 },
|
|
15702
|
+
{ x: 220, w: 100, h: svgHeight * 0.65 },
|
|
15703
|
+
{ x: 340, w: 100, h: svgHeight * 0.5 },
|
|
15704
|
+
{ x: 460, w: 100, h: svgHeight * 0.75 },
|
|
15705
|
+
{ x: 580, w: 100, h: svgHeight * 0.45 },
|
|
15706
|
+
{ x: 700, w: 100, h: svgHeight * 0.3 }
|
|
15506
15707
|
];
|
|
15507
15708
|
const styleVars = {
|
|
15508
15709
|
["--pl"]: `${paddingLeft}px`,
|
|
@@ -15512,27 +15713,59 @@ var NoData = ({
|
|
|
15512
15713
|
"div",
|
|
15513
15714
|
{
|
|
15514
15715
|
className: cn(
|
|
15515
|
-
"rounded-
|
|
15716
|
+
"rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm",
|
|
15516
15717
|
className
|
|
15517
15718
|
),
|
|
15518
15719
|
style: styleVars,
|
|
15519
15720
|
role: "img",
|
|
15520
15721
|
"aria-label": message,
|
|
15521
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)]
|
|
15722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "w-full max-w-[900px] relative", children: [
|
|
15522
15723
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
15523
15724
|
"svg",
|
|
15524
15725
|
{
|
|
15525
|
-
className: "w-full h-[var(--svg-h)]",
|
|
15726
|
+
className: "w-full h-[var(--svg-h)] opacity-40",
|
|
15526
15727
|
width: "100%",
|
|
15527
15728
|
viewBox: `0 0 900 ${svgHeight}`,
|
|
15528
15729
|
preserveAspectRatio: "none",
|
|
15529
15730
|
children: [
|
|
15530
15731
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("defs", { children: [
|
|
15531
15732
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("linearGradient", { id: "barGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
15532
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15533
|
-
|
|
15733
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15734
|
+
"stop",
|
|
15735
|
+
{
|
|
15736
|
+
offset: "0%",
|
|
15737
|
+
stopColor: "hsl(var(--primary))",
|
|
15738
|
+
stopOpacity: "0.15"
|
|
15739
|
+
}
|
|
15740
|
+
),
|
|
15741
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15742
|
+
"stop",
|
|
15743
|
+
{
|
|
15744
|
+
offset: "100%",
|
|
15745
|
+
stopColor: "hsl(var(--primary))",
|
|
15746
|
+
stopOpacity: "0.05"
|
|
15747
|
+
}
|
|
15748
|
+
)
|
|
15534
15749
|
] }),
|
|
15535
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.
|
|
15750
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("linearGradient", { id: "gridGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
15751
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15752
|
+
"stop",
|
|
15753
|
+
{
|
|
15754
|
+
offset: "0%",
|
|
15755
|
+
stopColor: "hsl(var(--border))",
|
|
15756
|
+
stopOpacity: "0.4"
|
|
15757
|
+
}
|
|
15758
|
+
),
|
|
15759
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15760
|
+
"stop",
|
|
15761
|
+
{
|
|
15762
|
+
offset: "100%",
|
|
15763
|
+
stopColor: "hsl(var(--border))",
|
|
15764
|
+
stopOpacity: "0.1"
|
|
15765
|
+
}
|
|
15766
|
+
)
|
|
15767
|
+
] }),
|
|
15768
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
15536
15769
|
"filter",
|
|
15537
15770
|
{
|
|
15538
15771
|
id: "softShadow",
|
|
@@ -15540,16 +15773,15 @@ var NoData = ({
|
|
|
15540
15773
|
y: "-20%",
|
|
15541
15774
|
width: "140%",
|
|
15542
15775
|
height: "140%",
|
|
15543
|
-
children:
|
|
15544
|
-
"
|
|
15545
|
-
{
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
)
|
|
15776
|
+
children: [
|
|
15777
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3" }),
|
|
15778
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("feOffset", { dx: "0", dy: "2", result: "offsetblur" }),
|
|
15779
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("feComponentTransfer", { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("feFuncA", { type: "linear", slope: "0.2" }) }),
|
|
15780
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("feMerge", { children: [
|
|
15781
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("feMergeNode", {}),
|
|
15782
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("feMergeNode", { in: "SourceGraphic" })
|
|
15783
|
+
] })
|
|
15784
|
+
]
|
|
15553
15785
|
}
|
|
15554
15786
|
)
|
|
15555
15787
|
] }),
|
|
@@ -15560,66 +15792,97 @@ var NoData = ({
|
|
|
15560
15792
|
y: 0,
|
|
15561
15793
|
width: 900,
|
|
15562
15794
|
height: svgHeight,
|
|
15563
|
-
fill: "
|
|
15795
|
+
fill: "hsl(var(--muted)/0.2)",
|
|
15796
|
+
rx: 8
|
|
15564
15797
|
}
|
|
15565
15798
|
),
|
|
15566
|
-
Array.from({ length:
|
|
15567
|
-
const y = 40 + (svgHeight - 80) /
|
|
15799
|
+
Array.from({ length: 6 }).map((_, i) => {
|
|
15800
|
+
const y = 40 + (svgHeight - 80) / 5 * i;
|
|
15568
15801
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15569
15802
|
"line",
|
|
15570
15803
|
{
|
|
15571
|
-
x1:
|
|
15572
|
-
x2:
|
|
15804
|
+
x1: 50,
|
|
15805
|
+
x2: 850,
|
|
15573
15806
|
y1: y,
|
|
15574
15807
|
y2: y,
|
|
15575
|
-
stroke: "
|
|
15576
|
-
strokeWidth: 1
|
|
15808
|
+
stroke: "url(#gridGradient)",
|
|
15809
|
+
strokeWidth: 1.5,
|
|
15810
|
+
strokeDasharray: "4 4"
|
|
15577
15811
|
},
|
|
15578
15812
|
`g-${i}`
|
|
15579
15813
|
);
|
|
15580
15814
|
}),
|
|
15815
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15816
|
+
"line",
|
|
15817
|
+
{
|
|
15818
|
+
x1: 50,
|
|
15819
|
+
y1: 30,
|
|
15820
|
+
x2: 50,
|
|
15821
|
+
y2: svgHeight - 40,
|
|
15822
|
+
stroke: "hsl(var(--foreground))",
|
|
15823
|
+
strokeWidth: 2,
|
|
15824
|
+
opacity: 0.5
|
|
15825
|
+
}
|
|
15826
|
+
),
|
|
15827
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15828
|
+
"line",
|
|
15829
|
+
{
|
|
15830
|
+
x1: 50,
|
|
15831
|
+
y1: svgHeight - 40,
|
|
15832
|
+
x2: 850,
|
|
15833
|
+
y2: svgHeight - 40,
|
|
15834
|
+
stroke: "hsl(var(--foreground))",
|
|
15835
|
+
strokeWidth: 2,
|
|
15836
|
+
opacity: 0.5
|
|
15837
|
+
}
|
|
15838
|
+
),
|
|
15581
15839
|
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("g", { children: [
|
|
15582
15840
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15583
15841
|
"rect",
|
|
15584
15842
|
{
|
|
15585
15843
|
x: b.x,
|
|
15586
|
-
y: svgHeight -
|
|
15844
|
+
y: svgHeight - 40 - b.h,
|
|
15587
15845
|
width: b.w,
|
|
15588
15846
|
height: b.h,
|
|
15589
|
-
rx:
|
|
15847
|
+
rx: 4,
|
|
15590
15848
|
fill: "url(#barGradient)",
|
|
15591
|
-
filter: "url(#softShadow)"
|
|
15592
|
-
opacity: 0.95
|
|
15849
|
+
filter: "url(#softShadow)"
|
|
15593
15850
|
}
|
|
15594
15851
|
),
|
|
15595
15852
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15596
15853
|
"rect",
|
|
15597
15854
|
{
|
|
15598
15855
|
x: b.x,
|
|
15599
|
-
y: svgHeight -
|
|
15856
|
+
y: svgHeight - 40 - b.h,
|
|
15600
15857
|
width: b.w,
|
|
15601
15858
|
height: b.h,
|
|
15602
|
-
rx:
|
|
15859
|
+
rx: 4,
|
|
15603
15860
|
fill: "none",
|
|
15604
|
-
stroke: "
|
|
15861
|
+
stroke: "hsl(var(--foreground))",
|
|
15862
|
+
strokeWidth: 1,
|
|
15863
|
+
opacity: 0.3
|
|
15605
15864
|
}
|
|
15606
15865
|
),
|
|
15607
15866
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15608
|
-
"
|
|
15867
|
+
"line",
|
|
15609
15868
|
{
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15869
|
+
x1: b.x + b.w / 2,
|
|
15870
|
+
y1: svgHeight - 40,
|
|
15871
|
+
x2: b.x + b.w / 2,
|
|
15872
|
+
y2: svgHeight - 35,
|
|
15873
|
+
stroke: "hsl(var(--foreground))",
|
|
15874
|
+
strokeWidth: 1.5,
|
|
15875
|
+
opacity: 0.4
|
|
15616
15876
|
}
|
|
15617
15877
|
)
|
|
15618
15878
|
] }, `barg-${i}`))
|
|
15619
15879
|
]
|
|
15620
15880
|
}
|
|
15621
15881
|
),
|
|
15622
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime94.
|
|
15882
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "pointer-events-auto bg-card/95 backdrop-blur-sm px-8 py-6 rounded-xl border border-border/50 shadow-lg text-center max-w-md", children: [
|
|
15883
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h3", { className: "text-xl font-semibold text-foreground mb-2", children: title }),
|
|
15884
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "text-lg font-medium text-foreground/90 mb-2", children: message })
|
|
15885
|
+
] }) })
|
|
15623
15886
|
] }) })
|
|
15624
15887
|
}
|
|
15625
15888
|
);
|
|
@@ -15660,7 +15923,7 @@ var Chart = ({
|
|
|
15660
15923
|
formatBR = false,
|
|
15661
15924
|
chartMargin
|
|
15662
15925
|
}) => {
|
|
15663
|
-
const smartConfig = (0,
|
|
15926
|
+
const smartConfig = (0, import_react90.useMemo)(() => {
|
|
15664
15927
|
const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
|
|
15665
15928
|
const xAxisConfig2 = typeof xAxis === "string" ? {
|
|
15666
15929
|
dataKey: resolvedXAxisKey,
|
|
@@ -15684,12 +15947,12 @@ var Chart = ({
|
|
|
15684
15947
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
15685
15948
|
}, [data, xAxis, labelMap]);
|
|
15686
15949
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
15687
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
15688
|
-
const [highlightedSeries, setHighlightedSeries] = (0,
|
|
15950
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react90.useState)([]);
|
|
15951
|
+
const [highlightedSeries, setHighlightedSeries] = (0, import_react90.useState)(
|
|
15689
15952
|
/* @__PURE__ */ new Set()
|
|
15690
15953
|
);
|
|
15691
|
-
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0,
|
|
15692
|
-
(0,
|
|
15954
|
+
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react90.useState)(false);
|
|
15955
|
+
(0, import_react90.useEffect)(() => {
|
|
15693
15956
|
if (highlightedSeries.size === 0 && showOnlyHighlighted) {
|
|
15694
15957
|
setShowOnlyHighlighted(false);
|
|
15695
15958
|
}
|
|
@@ -15698,9 +15961,9 @@ var Chart = ({
|
|
|
15698
15961
|
...item,
|
|
15699
15962
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
15700
15963
|
}));
|
|
15701
|
-
const wrapperRef = (0,
|
|
15702
|
-
const [measuredWidth, setMeasuredWidth] = (0,
|
|
15703
|
-
(0,
|
|
15964
|
+
const wrapperRef = (0, import_react90.useRef)(null);
|
|
15965
|
+
const [measuredWidth, setMeasuredWidth] = (0, import_react90.useState)(null);
|
|
15966
|
+
(0, import_react90.useLayoutEffect)(() => {
|
|
15704
15967
|
const el = wrapperRef.current;
|
|
15705
15968
|
if (!el) return;
|
|
15706
15969
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -15727,7 +15990,7 @@ var Chart = ({
|
|
|
15727
15990
|
);
|
|
15728
15991
|
}
|
|
15729
15992
|
const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
|
|
15730
|
-
const generateColors = (0,
|
|
15993
|
+
const generateColors = (0, import_react90.useCallback)(
|
|
15731
15994
|
(dataKeys) => {
|
|
15732
15995
|
const colorMap = {};
|
|
15733
15996
|
const allColors = generateAdditionalColors(colors2, dataKeys.length);
|
|
@@ -15738,17 +16001,17 @@ var Chart = ({
|
|
|
15738
16001
|
},
|
|
15739
16002
|
[colors2, mapperConfig]
|
|
15740
16003
|
);
|
|
15741
|
-
const finalColors = (0,
|
|
16004
|
+
const finalColors = (0, import_react90.useMemo)(
|
|
15742
16005
|
() => generateColors(allKeys),
|
|
15743
16006
|
[generateColors, allKeys]
|
|
15744
16007
|
);
|
|
15745
|
-
const biaxialConfigNormalized = (0,
|
|
16008
|
+
const biaxialConfigNormalized = (0, import_react90.useMemo)(() => {
|
|
15746
16009
|
if (!biaxial) return null;
|
|
15747
16010
|
if (typeof biaxial === "string") return { key: [biaxial] };
|
|
15748
16011
|
if (Array.isArray(biaxial)) return { key: biaxial };
|
|
15749
16012
|
return biaxial;
|
|
15750
16013
|
}, [biaxial]);
|
|
15751
|
-
(0,
|
|
16014
|
+
(0, import_react90.useMemo)(() => {
|
|
15752
16015
|
if (!biaxialConfigNormalized) return;
|
|
15753
16016
|
const leftLabelMissing = !yAxisLabel || String(yAxisLabel).trim() === "";
|
|
15754
16017
|
const rightLabelMissing = !biaxialConfigNormalized.label || String(biaxialConfigNormalized.label).trim() === "";
|
|
@@ -15758,29 +16021,29 @@ var Chart = ({
|
|
|
15758
16021
|
);
|
|
15759
16022
|
}
|
|
15760
16023
|
}, [biaxialConfigNormalized, yAxisLabel]);
|
|
15761
|
-
const rightKeys = (0,
|
|
16024
|
+
const rightKeys = (0, import_react90.useMemo)(
|
|
15762
16025
|
() => biaxialConfigNormalized?.key ?? [],
|
|
15763
16026
|
[biaxialConfigNormalized]
|
|
15764
16027
|
);
|
|
15765
|
-
const leftKeys = (0,
|
|
16028
|
+
const leftKeys = (0, import_react90.useMemo)(
|
|
15766
16029
|
() => allKeys.filter((k) => !rightKeys.includes(k)),
|
|
15767
16030
|
[allKeys, rightKeys]
|
|
15768
16031
|
);
|
|
15769
|
-
const adaptDataForTooltip = (0,
|
|
16032
|
+
const adaptDataForTooltip = (0, import_react90.useCallback)(
|
|
15770
16033
|
(universalData) => ({
|
|
15771
16034
|
...universalData,
|
|
15772
16035
|
name: String(universalData[xAxisConfig.dataKey] || "N/A")
|
|
15773
16036
|
}),
|
|
15774
16037
|
[xAxisConfig.dataKey]
|
|
15775
16038
|
);
|
|
15776
|
-
const activePeriods = (0,
|
|
16039
|
+
const activePeriods = (0, import_react90.useMemo)(
|
|
15777
16040
|
() => activeTooltips.map((t) => adaptDataForTooltip(t.data).name),
|
|
15778
16041
|
[activeTooltips, adaptDataForTooltip]
|
|
15779
16042
|
);
|
|
15780
|
-
(0,
|
|
16043
|
+
(0, import_react90.useEffect)(() => {
|
|
15781
16044
|
window.dispatchEvent(new Event("recountTooltips"));
|
|
15782
16045
|
}, [activeTooltips.length]);
|
|
15783
|
-
const toggleHighlight = (0,
|
|
16046
|
+
const toggleHighlight = (0, import_react90.useCallback)((key) => {
|
|
15784
16047
|
setHighlightedSeries((prev) => {
|
|
15785
16048
|
const next = new Set(prev);
|
|
15786
16049
|
if (next.has(key)) next.delete(key);
|
|
@@ -15788,7 +16051,7 @@ var Chart = ({
|
|
|
15788
16051
|
return next;
|
|
15789
16052
|
});
|
|
15790
16053
|
}, []);
|
|
15791
|
-
const maxLeftDataValue = (0,
|
|
16054
|
+
const maxLeftDataValue = (0, import_react90.useMemo)(() => {
|
|
15792
16055
|
let max = 0;
|
|
15793
16056
|
const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
|
|
15794
16057
|
for (const row of processedData) {
|
|
@@ -15800,7 +16063,7 @@ var Chart = ({
|
|
|
15800
16063
|
}
|
|
15801
16064
|
return max;
|
|
15802
16065
|
}, [processedData, leftKeys, allKeys]);
|
|
15803
|
-
const minLeftDataValue = (0,
|
|
16066
|
+
const minLeftDataValue = (0, import_react90.useMemo)(() => {
|
|
15804
16067
|
let min = 0;
|
|
15805
16068
|
const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
|
|
15806
16069
|
for (const row of processedData) {
|
|
@@ -15813,7 +16076,7 @@ var Chart = ({
|
|
|
15813
16076
|
}
|
|
15814
16077
|
return min;
|
|
15815
16078
|
}, [processedData, leftKeys, allKeys]);
|
|
15816
|
-
const maxRightDataValue = (0,
|
|
16079
|
+
const maxRightDataValue = (0, import_react90.useMemo)(() => {
|
|
15817
16080
|
let max = 0;
|
|
15818
16081
|
if (rightKeys.length === 0) return max;
|
|
15819
16082
|
for (const row of processedData) {
|
|
@@ -15825,7 +16088,7 @@ var Chart = ({
|
|
|
15825
16088
|
}
|
|
15826
16089
|
return max;
|
|
15827
16090
|
}, [processedData, rightKeys]);
|
|
15828
|
-
const minRightDataValue = (0,
|
|
16091
|
+
const minRightDataValue = (0, import_react90.useMemo)(() => {
|
|
15829
16092
|
let min = 0;
|
|
15830
16093
|
if (rightKeys.length === 0) return min;
|
|
15831
16094
|
for (const row of processedData) {
|
|
@@ -15838,7 +16101,7 @@ var Chart = ({
|
|
|
15838
16101
|
}
|
|
15839
16102
|
return min;
|
|
15840
16103
|
}, [processedData, rightKeys]);
|
|
15841
|
-
const computeNiceMax = (0,
|
|
16104
|
+
const computeNiceMax = (0, import_react90.useCallback)((maxValue) => {
|
|
15842
16105
|
let padding = 0.08;
|
|
15843
16106
|
if (maxValue > 1e6) padding = 0.05;
|
|
15844
16107
|
if (maxValue > 1e7) padding = 0.03;
|
|
@@ -15846,15 +16109,15 @@ var Chart = ({
|
|
|
15846
16109
|
const padded = maxValue * (1 + padding);
|
|
15847
16110
|
return niceCeil(padded);
|
|
15848
16111
|
}, []);
|
|
15849
|
-
const niceMaxLeft = (0,
|
|
16112
|
+
const niceMaxLeft = (0, import_react90.useMemo)(
|
|
15850
16113
|
() => computeNiceMax(maxLeftDataValue),
|
|
15851
16114
|
[computeNiceMax, maxLeftDataValue]
|
|
15852
16115
|
);
|
|
15853
|
-
const niceMaxRight = (0,
|
|
16116
|
+
const niceMaxRight = (0, import_react90.useMemo)(
|
|
15854
16117
|
() => computeNiceMax(maxRightDataValue),
|
|
15855
16118
|
[computeNiceMax, maxRightDataValue]
|
|
15856
16119
|
);
|
|
15857
|
-
const computedWidth = (0,
|
|
16120
|
+
const computedWidth = (0, import_react90.useMemo)(() => {
|
|
15858
16121
|
if (typeof width === "number") return width;
|
|
15859
16122
|
const points = Math.max(1, processedData.length);
|
|
15860
16123
|
const barCount = series?.bar?.length ?? 0;
|
|
@@ -15885,7 +16148,7 @@ var Chart = ({
|
|
|
15885
16148
|
niceMaxLeft,
|
|
15886
16149
|
niceMaxRight
|
|
15887
16150
|
]);
|
|
15888
|
-
const toggleTooltip = (0,
|
|
16151
|
+
const toggleTooltip = (0, import_react90.useCallback)(
|
|
15889
16152
|
(tooltipId, data2, basePosition) => {
|
|
15890
16153
|
const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
|
|
15891
16154
|
if (existingIndex !== -1) {
|
|
@@ -15914,7 +16177,7 @@ var Chart = ({
|
|
|
15914
16177
|
},
|
|
15915
16178
|
[activeTooltips, maxTooltips]
|
|
15916
16179
|
);
|
|
15917
|
-
const handleChartClick = (0,
|
|
16180
|
+
const handleChartClick = (0, import_react90.useCallback)(
|
|
15918
16181
|
(e) => {
|
|
15919
16182
|
if (!enableDraggableTooltips) return;
|
|
15920
16183
|
const ev = e;
|
|
@@ -15932,7 +16195,7 @@ var Chart = ({
|
|
|
15932
16195
|
},
|
|
15933
16196
|
[enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
|
|
15934
16197
|
);
|
|
15935
|
-
const handleBarClick = (0,
|
|
16198
|
+
const handleBarClick = (0, import_react90.useCallback)(
|
|
15936
16199
|
(data2, index, event) => {
|
|
15937
16200
|
if (!enableDraggableTooltips) return;
|
|
15938
16201
|
event.stopPropagation();
|
|
@@ -15946,7 +16209,7 @@ var Chart = ({
|
|
|
15946
16209
|
},
|
|
15947
16210
|
[enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
|
|
15948
16211
|
);
|
|
15949
|
-
const handleSeriesClick = (0,
|
|
16212
|
+
const handleSeriesClick = (0, import_react90.useCallback)(
|
|
15950
16213
|
(...args) => {
|
|
15951
16214
|
if (args.length >= 3) {
|
|
15952
16215
|
const [data2, index, event] = args;
|
|
@@ -15957,7 +16220,7 @@ var Chart = ({
|
|
|
15957
16220
|
},
|
|
15958
16221
|
[handleBarClick, handleChartClick]
|
|
15959
16222
|
);
|
|
15960
|
-
const onTooltipPositionChange = (0,
|
|
16223
|
+
const onTooltipPositionChange = (0, import_react90.useCallback)(
|
|
15961
16224
|
(id, position) => {
|
|
15962
16225
|
setActiveTooltips(
|
|
15963
16226
|
(prev) => prev.map((t) => t.id === id ? { ...t, position } : t)
|
|
@@ -15965,11 +16228,11 @@ var Chart = ({
|
|
|
15965
16228
|
},
|
|
15966
16229
|
[]
|
|
15967
16230
|
);
|
|
15968
|
-
const titleClassName = (0,
|
|
16231
|
+
const titleClassName = (0, import_react90.useMemo)(
|
|
15969
16232
|
() => "text-[1.4rem] font-semibold text-foreground mb-3",
|
|
15970
16233
|
[]
|
|
15971
16234
|
);
|
|
15972
|
-
const finalValueFormatter = (0,
|
|
16235
|
+
const finalValueFormatter = (0, import_react90.useMemo)(() => {
|
|
15973
16236
|
const nf = new Intl.NumberFormat("pt-BR", {
|
|
15974
16237
|
minimumFractionDigits: 2,
|
|
15975
16238
|
maximumFractionDigits: 2
|
|
@@ -16009,7 +16272,7 @@ var Chart = ({
|
|
|
16009
16272
|
};
|
|
16010
16273
|
return builtIn;
|
|
16011
16274
|
}, [valueFormatter2, formatBR]);
|
|
16012
|
-
const yTickFormatter = (0,
|
|
16275
|
+
const yTickFormatter = (0, import_react90.useMemo)(() => {
|
|
16013
16276
|
const nf = new Intl.NumberFormat("pt-BR", {
|
|
16014
16277
|
minimumFractionDigits: 2,
|
|
16015
16278
|
maximumFractionDigits: 2
|
|
@@ -16040,15 +16303,26 @@ var Chart = ({
|
|
|
16040
16303
|
const containerPaddingLeft = -6;
|
|
16041
16304
|
const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
|
|
16042
16305
|
const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
|
|
16043
|
-
const yAxisTickWidth = (0,
|
|
16306
|
+
const yAxisTickWidth = (0, import_react90.useMemo)(() => {
|
|
16044
16307
|
if (typeof chartMargin?.left === "number") return chartMargin.left;
|
|
16045
16308
|
if (yAxisLabel) return axisLabelMargin;
|
|
16046
|
-
const samples = [
|
|
16309
|
+
const samples = [
|
|
16310
|
+
minLeftDataValue,
|
|
16311
|
+
niceMaxLeft,
|
|
16312
|
+
Math.round((minLeftDataValue + niceMaxLeft) / 2),
|
|
16313
|
+
0
|
|
16314
|
+
];
|
|
16047
16315
|
const formatted = samples.map((v) => String(yTickFormatter(v)));
|
|
16048
16316
|
const maxLen = formatted.reduce((m, s) => Math.max(m, s.length), 0);
|
|
16049
16317
|
const estimated = Math.max(48, Math.min(220, maxLen * 8 + 24));
|
|
16050
16318
|
return estimated;
|
|
16051
|
-
}, [
|
|
16319
|
+
}, [
|
|
16320
|
+
chartMargin?.left,
|
|
16321
|
+
yAxisLabel,
|
|
16322
|
+
yTickFormatter,
|
|
16323
|
+
minLeftDataValue,
|
|
16324
|
+
niceMaxLeft
|
|
16325
|
+
]);
|
|
16052
16326
|
const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
|
|
16053
16327
|
const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
|
|
16054
16328
|
const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
|
|
@@ -16061,7 +16335,7 @@ var Chart = ({
|
|
|
16061
16335
|
const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
|
|
16062
16336
|
const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
|
|
16063
16337
|
const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
|
|
16064
|
-
const openTooltipForPeriod = (0,
|
|
16338
|
+
const openTooltipForPeriod = (0, import_react90.useCallback)(
|
|
16065
16339
|
(periodName) => {
|
|
16066
16340
|
if (!enableDraggableTooltips) return;
|
|
16067
16341
|
const row = processedData.find((r) => String(r.name) === periodName);
|
|
@@ -16118,7 +16392,7 @@ var Chart = ({
|
|
|
16118
16392
|
style: {
|
|
16119
16393
|
paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`
|
|
16120
16394
|
},
|
|
16121
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(NoData_default, {})
|
|
16395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(NoData_default, { title })
|
|
16122
16396
|
}
|
|
16123
16397
|
)
|
|
16124
16398
|
}
|
|
@@ -16567,7 +16841,7 @@ var Chart = ({
|
|
|
16567
16841
|
var Chart_default = Chart;
|
|
16568
16842
|
|
|
16569
16843
|
// src/components/ui/charts/BarChart.tsx
|
|
16570
|
-
var
|
|
16844
|
+
var import_react91 = require("react");
|
|
16571
16845
|
var import_recharts2 = require("recharts");
|
|
16572
16846
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
16573
16847
|
var DEFAULT_COLORS3 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
@@ -16599,7 +16873,7 @@ var BarChart = ({
|
|
|
16599
16873
|
containerPaddingLeft,
|
|
16600
16874
|
16
|
|
16601
16875
|
);
|
|
16602
|
-
const smartConfig = (0,
|
|
16876
|
+
const smartConfig = (0, import_react91.useMemo)(() => {
|
|
16603
16877
|
const providedMapper = yAxis ?? mapper;
|
|
16604
16878
|
if (autoDetect === true || xAxis == null || providedMapper == null) {
|
|
16605
16879
|
const detectedXAxis = detectXAxis(data);
|
|
@@ -16649,14 +16923,14 @@ var BarChart = ({
|
|
|
16649
16923
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
16650
16924
|
}, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
|
|
16651
16925
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
16652
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
16653
|
-
const [isDragging, setIsDragging] = (0,
|
|
16654
|
-
const [dragOffset, setDragOffset] = (0,
|
|
16926
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react91.useState)([]);
|
|
16927
|
+
const [isDragging, setIsDragging] = (0, import_react91.useState)(null);
|
|
16928
|
+
const [dragOffset, setDragOffset] = (0, import_react91.useState)({
|
|
16655
16929
|
x: 0,
|
|
16656
16930
|
y: 0
|
|
16657
16931
|
});
|
|
16658
|
-
const [globalTooltipCount, setGlobalTooltipCount] = (0,
|
|
16659
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
16932
|
+
const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react91.useState)(0);
|
|
16933
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react91.useState)([]);
|
|
16660
16934
|
const processedData = data.map((item) => ({
|
|
16661
16935
|
...item,
|
|
16662
16936
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
@@ -16679,7 +16953,7 @@ var BarChart = ({
|
|
|
16679
16953
|
// Garantir que tem a propriedade 'name'
|
|
16680
16954
|
};
|
|
16681
16955
|
};
|
|
16682
|
-
const maxDataValue = (0,
|
|
16956
|
+
const maxDataValue = (0, import_react91.useMemo)(() => {
|
|
16683
16957
|
let max = 0;
|
|
16684
16958
|
const keys = Object.keys(mapperConfig);
|
|
16685
16959
|
for (const row of processedData) {
|
|
@@ -16692,7 +16966,7 @@ var BarChart = ({
|
|
|
16692
16966
|
}
|
|
16693
16967
|
return max;
|
|
16694
16968
|
}, [processedData, mapperConfig]);
|
|
16695
|
-
const niceMax = (0,
|
|
16969
|
+
const niceMax = (0, import_react91.useMemo)(() => {
|
|
16696
16970
|
let padding2 = 0.08;
|
|
16697
16971
|
if (maxDataValue > 1e6) padding2 = 0.05;
|
|
16698
16972
|
if (maxDataValue > 1e7) padding2 = 0.03;
|
|
@@ -16733,7 +17007,7 @@ var BarChart = ({
|
|
|
16733
17007
|
const GUIDE_THRESHOLD2 = 60;
|
|
16734
17008
|
const STRONG_SNAP_THRESHOLD2 = 35;
|
|
16735
17009
|
const PRECISION_SNAP_THRESHOLD2 = 8;
|
|
16736
|
-
const updateAlignmentGuides = (0,
|
|
17010
|
+
const updateAlignmentGuides = (0, import_react91.useCallback)(
|
|
16737
17011
|
(draggedTooltipId, currentPosition) => {
|
|
16738
17012
|
if (!isDragging) return;
|
|
16739
17013
|
const getAllTooltips = () => {
|
|
@@ -16797,7 +17071,7 @@ var BarChart = ({
|
|
|
16797
17071
|
},
|
|
16798
17072
|
[isDragging, activeTooltips]
|
|
16799
17073
|
);
|
|
16800
|
-
const snapToGuides = (0,
|
|
17074
|
+
const snapToGuides = (0, import_react91.useCallback)(
|
|
16801
17075
|
(position) => {
|
|
16802
17076
|
const snappedPosition = { ...position };
|
|
16803
17077
|
let hasSnapped = false;
|
|
@@ -16859,7 +17133,7 @@ var BarChart = ({
|
|
|
16859
17133
|
setIsDragging(tooltipId);
|
|
16860
17134
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
16861
17135
|
};
|
|
16862
|
-
(0,
|
|
17136
|
+
(0, import_react91.useEffect)(() => {
|
|
16863
17137
|
let rafId;
|
|
16864
17138
|
let lastMousePosition = { x: 0, y: 0 };
|
|
16865
17139
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -16917,7 +17191,7 @@ var BarChart = ({
|
|
|
16917
17191
|
updateAlignmentGuides,
|
|
16918
17192
|
snapToGuides
|
|
16919
17193
|
]);
|
|
16920
|
-
(0,
|
|
17194
|
+
(0, import_react91.useEffect)(() => {
|
|
16921
17195
|
const handleCloseAllTooltips = () => {
|
|
16922
17196
|
setActiveTooltips([]);
|
|
16923
17197
|
setGlobalTooltipCount(0);
|
|
@@ -16927,7 +17201,7 @@ var BarChart = ({
|
|
|
16927
17201
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
|
|
16928
17202
|
};
|
|
16929
17203
|
}, []);
|
|
16930
|
-
(0,
|
|
17204
|
+
(0, import_react91.useEffect)(() => {
|
|
16931
17205
|
const handleTooltipCountRequest = () => {
|
|
16932
17206
|
window.dispatchEvent(
|
|
16933
17207
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -16966,7 +17240,7 @@ var BarChart = ({
|
|
|
16966
17240
|
);
|
|
16967
17241
|
};
|
|
16968
17242
|
}, [activeTooltips]);
|
|
16969
|
-
(0,
|
|
17243
|
+
(0, import_react91.useEffect)(() => {
|
|
16970
17244
|
if (isDragging) return;
|
|
16971
17245
|
let totalCount = 0;
|
|
16972
17246
|
const handleCountResponse = (event) => {
|
|
@@ -17232,7 +17506,7 @@ var BarChart = ({
|
|
|
17232
17506
|
var BarChart_default = BarChart;
|
|
17233
17507
|
|
|
17234
17508
|
// src/components/ui/charts/LineChart.tsx
|
|
17235
|
-
var
|
|
17509
|
+
var import_react92 = require("react");
|
|
17236
17510
|
var import_recharts3 = require("recharts");
|
|
17237
17511
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
17238
17512
|
var defaultData = [
|
|
@@ -17266,14 +17540,14 @@ var CustomLineChart = ({
|
|
|
17266
17540
|
containerPaddingLeft,
|
|
17267
17541
|
16
|
|
17268
17542
|
);
|
|
17269
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
17270
|
-
const [isDragging, setIsDragging] = (0,
|
|
17271
|
-
const [dragOffset, setDragOffset] = (0,
|
|
17543
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react92.useState)([]);
|
|
17544
|
+
const [isDragging, setIsDragging] = (0, import_react92.useState)(null);
|
|
17545
|
+
const [dragOffset, setDragOffset] = (0, import_react92.useState)({
|
|
17272
17546
|
x: 0,
|
|
17273
17547
|
y: 0
|
|
17274
17548
|
});
|
|
17275
|
-
const [globalTooltipCount, setGlobalTooltipCount] = (0,
|
|
17276
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
17549
|
+
const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react92.useState)(0);
|
|
17550
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react92.useState)([]);
|
|
17277
17551
|
const generateColors = (dataKeys2) => {
|
|
17278
17552
|
const colorMap = {};
|
|
17279
17553
|
const allColors = generateAdditionalColors(colors2, dataKeys2.length);
|
|
@@ -17282,12 +17556,12 @@ var CustomLineChart = ({
|
|
|
17282
17556
|
});
|
|
17283
17557
|
return colorMap;
|
|
17284
17558
|
};
|
|
17285
|
-
const dataKeys = (0,
|
|
17559
|
+
const dataKeys = (0, import_react92.useMemo)(
|
|
17286
17560
|
() => data.length > 0 ? Object.keys(data[0]).filter((key) => key !== "name") : [],
|
|
17287
17561
|
[data]
|
|
17288
17562
|
);
|
|
17289
17563
|
const finalColors = generateColors(dataKeys);
|
|
17290
|
-
const maxDataValue = (0,
|
|
17564
|
+
const maxDataValue = (0, import_react92.useMemo)(() => {
|
|
17291
17565
|
let max = 0;
|
|
17292
17566
|
for (const row of data) {
|
|
17293
17567
|
const r = row;
|
|
@@ -17299,7 +17573,7 @@ var CustomLineChart = ({
|
|
|
17299
17573
|
}
|
|
17300
17574
|
return max;
|
|
17301
17575
|
}, [data, dataKeys]);
|
|
17302
|
-
const niceMax = (0,
|
|
17576
|
+
const niceMax = (0, import_react92.useMemo)(() => {
|
|
17303
17577
|
let padding2 = 0.08;
|
|
17304
17578
|
if (maxDataValue > 1e6) padding2 = 0.05;
|
|
17305
17579
|
if (maxDataValue > 1e7) padding2 = 0.03;
|
|
@@ -17375,10 +17649,10 @@ var CustomLineChart = ({
|
|
|
17375
17649
|
const handleChartBackgroundClick = () => {
|
|
17376
17650
|
setActiveTooltips([]);
|
|
17377
17651
|
};
|
|
17378
|
-
const handleCloseAllTooltips = (0,
|
|
17652
|
+
const handleCloseAllTooltips = (0, import_react92.useCallback)(() => {
|
|
17379
17653
|
window.dispatchEvent(new CustomEvent("closeAllTooltips"));
|
|
17380
17654
|
}, []);
|
|
17381
|
-
const updateAlignmentGuides = (0,
|
|
17655
|
+
const updateAlignmentGuides = (0, import_react92.useCallback)(
|
|
17382
17656
|
(draggedTooltipId, draggedPosition) => {
|
|
17383
17657
|
const SNAP_THRESHOLD = 15;
|
|
17384
17658
|
const draggedTooltip = activeTooltips.find(
|
|
@@ -17459,7 +17733,7 @@ var CustomLineChart = ({
|
|
|
17459
17733
|
},
|
|
17460
17734
|
[activeTooltips]
|
|
17461
17735
|
);
|
|
17462
|
-
const snapToGuides = (0,
|
|
17736
|
+
const snapToGuides = (0, import_react92.useCallback)(
|
|
17463
17737
|
(position) => {
|
|
17464
17738
|
const SNAP_DISTANCE = 10;
|
|
17465
17739
|
const snappedPosition = { ...position };
|
|
@@ -17487,7 +17761,7 @@ var CustomLineChart = ({
|
|
|
17487
17761
|
setIsDragging(tooltipId);
|
|
17488
17762
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
17489
17763
|
};
|
|
17490
|
-
(0,
|
|
17764
|
+
(0, import_react92.useEffect)(() => {
|
|
17491
17765
|
let rafId;
|
|
17492
17766
|
let lastMousePosition = { x: 0, y: 0 };
|
|
17493
17767
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -17534,7 +17808,7 @@ var CustomLineChart = ({
|
|
|
17534
17808
|
updateAlignmentGuides,
|
|
17535
17809
|
snapToGuides
|
|
17536
17810
|
]);
|
|
17537
|
-
(0,
|
|
17811
|
+
(0, import_react92.useEffect)(() => {
|
|
17538
17812
|
const handleCloseAllTooltips2 = () => {
|
|
17539
17813
|
setActiveTooltips([]);
|
|
17540
17814
|
setGlobalTooltipCount(0);
|
|
@@ -17544,7 +17818,7 @@ var CustomLineChart = ({
|
|
|
17544
17818
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
|
|
17545
17819
|
};
|
|
17546
17820
|
}, []);
|
|
17547
|
-
(0,
|
|
17821
|
+
(0, import_react92.useEffect)(() => {
|
|
17548
17822
|
const handleTooltipCountRequest = () => {
|
|
17549
17823
|
window.dispatchEvent(
|
|
17550
17824
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -17588,7 +17862,7 @@ var CustomLineChart = ({
|
|
|
17588
17862
|
);
|
|
17589
17863
|
};
|
|
17590
17864
|
}, [activeTooltips]);
|
|
17591
|
-
(0,
|
|
17865
|
+
(0, import_react92.useEffect)(() => {
|
|
17592
17866
|
if (isDragging) return;
|
|
17593
17867
|
let totalCount = 0;
|
|
17594
17868
|
const handleCountResponse = (event) => {
|
|
@@ -17910,13 +18184,13 @@ var CustomPieChart = ({
|
|
|
17910
18184
|
var PieChart_default = CustomPieChart;
|
|
17911
18185
|
|
|
17912
18186
|
// src/components/ui/charts/hooks/useChartHighlights.tsx
|
|
17913
|
-
var
|
|
18187
|
+
var import_react93 = require("react");
|
|
17914
18188
|
var useChartHighlights = () => {
|
|
17915
|
-
const [highlightedSeries, setHighlightedSeries] = (0,
|
|
18189
|
+
const [highlightedSeries, setHighlightedSeries] = (0, import_react93.useState)(
|
|
17916
18190
|
/* @__PURE__ */ new Set()
|
|
17917
18191
|
);
|
|
17918
|
-
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0,
|
|
17919
|
-
const toggleHighlight = (0,
|
|
18192
|
+
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react93.useState)(false);
|
|
18193
|
+
const toggleHighlight = (0, import_react93.useCallback)((key) => {
|
|
17920
18194
|
setHighlightedSeries((prev) => {
|
|
17921
18195
|
const next = new Set(prev);
|
|
17922
18196
|
if (next.has(key)) {
|
|
@@ -17927,17 +18201,17 @@ var useChartHighlights = () => {
|
|
|
17927
18201
|
return next;
|
|
17928
18202
|
});
|
|
17929
18203
|
}, []);
|
|
17930
|
-
const clearHighlights = (0,
|
|
18204
|
+
const clearHighlights = (0, import_react93.useCallback)(() => {
|
|
17931
18205
|
setHighlightedSeries(/* @__PURE__ */ new Set());
|
|
17932
18206
|
setShowOnlyHighlighted(false);
|
|
17933
18207
|
}, []);
|
|
17934
|
-
const isHighlighted = (0,
|
|
18208
|
+
const isHighlighted = (0, import_react93.useCallback)(
|
|
17935
18209
|
(key) => {
|
|
17936
18210
|
return highlightedSeries.has(key);
|
|
17937
18211
|
},
|
|
17938
18212
|
[highlightedSeries]
|
|
17939
18213
|
);
|
|
17940
|
-
const getSeriesStyle = (0,
|
|
18214
|
+
const getSeriesStyle = (0, import_react93.useCallback)(
|
|
17941
18215
|
(key) => {
|
|
17942
18216
|
const hasHighlights = highlightedSeries.size > 0;
|
|
17943
18217
|
const isSeriesHighlighted = highlightedSeries.has(key);
|
|
@@ -17981,80 +18255,3 @@ var useChartHighlights = () => {
|
|
|
17981
18255
|
isHighlighted
|
|
17982
18256
|
};
|
|
17983
18257
|
};
|
|
17984
|
-
|
|
17985
|
-
// src/hooks/use-drag.tsx
|
|
17986
|
-
var import_react92 = require("react");
|
|
17987
|
-
var useDrag = (options = {}) => {
|
|
17988
|
-
const [isDragging, setIsDragging] = (0, import_react92.useState)(null);
|
|
17989
|
-
const [positions, setPositions] = (0, import_react92.useState)({});
|
|
17990
|
-
const dragStartPos = (0, import_react92.useRef)(null);
|
|
17991
|
-
const dragId = (0, import_react92.useRef)(null);
|
|
17992
|
-
const handleMouseDown = (0, import_react92.useCallback)((id, e) => {
|
|
17993
|
-
e.preventDefault();
|
|
17994
|
-
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
17995
|
-
dragStartPos.current = {
|
|
17996
|
-
x: e.clientX,
|
|
17997
|
-
y: e.clientY,
|
|
17998
|
-
elementX: currentPosition.left,
|
|
17999
|
-
elementY: currentPosition.top
|
|
18000
|
-
};
|
|
18001
|
-
dragId.current = id;
|
|
18002
|
-
setIsDragging(id);
|
|
18003
|
-
options.onDragStart?.(id);
|
|
18004
|
-
}, [positions, options]);
|
|
18005
|
-
const handleMouseMove = (0, import_react92.useCallback)((e) => {
|
|
18006
|
-
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
18007
|
-
const deltaX = e.clientX - dragStartPos.current.x;
|
|
18008
|
-
const deltaY = e.clientY - dragStartPos.current.y;
|
|
18009
|
-
const newPosition = {
|
|
18010
|
-
left: dragStartPos.current.elementX + deltaX,
|
|
18011
|
-
top: dragStartPos.current.elementY + deltaY
|
|
18012
|
-
};
|
|
18013
|
-
newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
|
|
18014
|
-
newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
|
|
18015
|
-
setPositions((prev) => ({
|
|
18016
|
-
...prev,
|
|
18017
|
-
[dragId.current]: newPosition
|
|
18018
|
-
}));
|
|
18019
|
-
options.onDrag?.(dragId.current, newPosition);
|
|
18020
|
-
}, [isDragging, options]);
|
|
18021
|
-
const handleMouseUp = (0, import_react92.useCallback)(() => {
|
|
18022
|
-
if (dragId.current) {
|
|
18023
|
-
options.onDragEnd?.(dragId.current);
|
|
18024
|
-
}
|
|
18025
|
-
setIsDragging(null);
|
|
18026
|
-
dragStartPos.current = null;
|
|
18027
|
-
dragId.current = null;
|
|
18028
|
-
}, [options]);
|
|
18029
|
-
(0, import_react92.useEffect)(() => {
|
|
18030
|
-
if (isDragging) {
|
|
18031
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
18032
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
18033
|
-
document.body.style.userSelect = "none";
|
|
18034
|
-
return () => {
|
|
18035
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
18036
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
18037
|
-
document.body.style.userSelect = "";
|
|
18038
|
-
};
|
|
18039
|
-
}
|
|
18040
|
-
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
18041
|
-
const setPosition = (0, import_react92.useCallback)((id, position) => {
|
|
18042
|
-
setPositions((prev) => ({
|
|
18043
|
-
...prev,
|
|
18044
|
-
[id]: position
|
|
18045
|
-
}));
|
|
18046
|
-
}, []);
|
|
18047
|
-
const getPosition = (0, import_react92.useCallback)((id) => {
|
|
18048
|
-
return positions[id] || { top: 0, left: 0 };
|
|
18049
|
-
}, [positions]);
|
|
18050
|
-
const isElementDragging = (0, import_react92.useCallback)((id) => {
|
|
18051
|
-
return isDragging === id;
|
|
18052
|
-
}, [isDragging]);
|
|
18053
|
-
return {
|
|
18054
|
-
handleMouseDown,
|
|
18055
|
-
getPosition,
|
|
18056
|
-
setPosition,
|
|
18057
|
-
isElementDragging,
|
|
18058
|
-
isDragging: isDragging !== null
|
|
18059
|
-
};
|
|
18060
|
-
};
|