@mlw-packages/react-components 1.7.27 → 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 +30 -16
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +845 -638
- package/dist/index.mjs +746 -539
- 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,
|
|
@@ -7298,7 +7323,86 @@ var import_date_fns = require("date-fns");
|
|
|
7298
7323
|
var React37 = __toESM(require("react"));
|
|
7299
7324
|
var import_react_day_picker2 = require("react-day-picker");
|
|
7300
7325
|
var import_locale = require("date-fns/locale");
|
|
7301
|
-
var
|
|
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,6 +7410,7 @@ function CalendarBase2({
|
|
|
7306
7410
|
showOutsideDays = true,
|
|
7307
7411
|
...props
|
|
7308
7412
|
}) {
|
|
7413
|
+
const isMobile = useIsMobile();
|
|
7309
7414
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7310
7415
|
"div",
|
|
7311
7416
|
{
|
|
@@ -7327,14 +7432,16 @@ function CalendarBase2({
|
|
|
7327
7432
|
month: "relative flex-1 min-w-0",
|
|
7328
7433
|
month_caption: "flex items-center gap-2 min-h-[2.25rem] mb-4",
|
|
7329
7434
|
caption_label: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize",
|
|
7330
|
-
nav: "hidden",
|
|
7435
|
+
nav: "hidden ",
|
|
7331
7436
|
button_previous: cn(
|
|
7332
7437
|
buttonVariantsBase({ variant: "outline" }),
|
|
7333
|
-
"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"
|
|
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" : ""
|
|
7334
7440
|
),
|
|
7335
7441
|
button_next: cn(
|
|
7336
7442
|
buttonVariantsBase({ variant: "outline" }),
|
|
7337
|
-
"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"
|
|
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" : ""
|
|
7338
7445
|
),
|
|
7339
7446
|
month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
|
|
7340
7447
|
weekdays: "grid grid-cols-7 gap-1 mb-1",
|
|
@@ -7363,9 +7470,9 @@ function CalendarBase2({
|
|
|
7363
7470
|
components: {
|
|
7364
7471
|
Chevron: ({ orientation }) => {
|
|
7365
7472
|
if (orientation === "left") {
|
|
7366
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react40.CaretLeftIcon, { className: "h-4 w-4" });
|
|
7367
7474
|
}
|
|
7368
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react40.CaretRightIcon, { className: "h-4 w-4" });
|
|
7369
7476
|
}
|
|
7370
7477
|
},
|
|
7371
7478
|
...props
|
|
@@ -7378,8 +7485,8 @@ CalendarBase2.displayName = "CalendarBase";
|
|
|
7378
7485
|
|
|
7379
7486
|
// src/components/ui/picker/DateTimePicker.tsx
|
|
7380
7487
|
var import_locale2 = require("date-fns/locale");
|
|
7381
|
-
var
|
|
7382
|
-
var
|
|
7488
|
+
var import_react43 = require("react");
|
|
7489
|
+
var import_react44 = require("@phosphor-icons/react");
|
|
7383
7490
|
|
|
7384
7491
|
// src/components/ui/shared/ClearButton.tsx
|
|
7385
7492
|
var import_ssr2 = require("@phosphor-icons/react/dist/ssr");
|
|
@@ -7412,27 +7519,33 @@ function ClearButton({
|
|
|
7412
7519
|
}
|
|
7413
7520
|
|
|
7414
7521
|
// src/components/ui/picker/TimeScrollPicker.tsx
|
|
7415
|
-
var
|
|
7522
|
+
var import_react41 = require("react");
|
|
7416
7523
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7417
|
-
var ITEM_HEIGHT =
|
|
7524
|
+
var ITEM_HEIGHT = 39;
|
|
7418
7525
|
var ITEM_HEIGHT_MOBILE = 32;
|
|
7419
7526
|
var VISIBLE_ITEMS = 5;
|
|
7420
7527
|
var VISIBLE_ITEMS_MOBILE = 3;
|
|
7421
7528
|
var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
|
|
7422
7529
|
var CENTER_INDEX_MOBILE = Math.floor(VISIBLE_ITEMS_MOBILE / 2);
|
|
7423
|
-
function ScrollColumn({
|
|
7530
|
+
function ScrollColumn({
|
|
7531
|
+
value,
|
|
7532
|
+
onChange,
|
|
7533
|
+
max,
|
|
7534
|
+
label,
|
|
7535
|
+
hideSeconds
|
|
7536
|
+
}) {
|
|
7424
7537
|
const isMobile = useIsMobile();
|
|
7425
|
-
const containerRef = (0,
|
|
7538
|
+
const containerRef = (0, import_react41.useRef)(null);
|
|
7426
7539
|
const items = Array.from({ length: max }, (_, i) => i);
|
|
7427
|
-
const [isDragging, setIsDragging] = (0,
|
|
7428
|
-
const [startY, setStartY] = (0,
|
|
7429
|
-
const [scrollTop, setScrollTop] = (0,
|
|
7430
|
-
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);
|
|
7431
7544
|
const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
|
|
7432
7545
|
const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
|
|
7433
7546
|
const visibleItems = isMobile ? VISIBLE_ITEMS_MOBILE : VISIBLE_ITEMS;
|
|
7434
7547
|
const containerHeight = visibleItems * itemHeight;
|
|
7435
|
-
(0,
|
|
7548
|
+
(0, import_react41.useEffect)(() => {
|
|
7436
7549
|
if (containerRef.current && !isDragging) {
|
|
7437
7550
|
requestAnimationFrame(() => {
|
|
7438
7551
|
if (containerRef.current) {
|
|
@@ -7442,7 +7555,7 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7442
7555
|
});
|
|
7443
7556
|
}
|
|
7444
7557
|
}, [value, isDragging, itemHeight]);
|
|
7445
|
-
(0,
|
|
7558
|
+
(0, import_react41.useEffect)(() => {
|
|
7446
7559
|
return () => {
|
|
7447
7560
|
if (scrollTimeoutRef.current) {
|
|
7448
7561
|
clearTimeout(scrollTimeoutRef.current);
|
|
@@ -7487,55 +7600,44 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7487
7600
|
const handleMouseLeave = () => {
|
|
7488
7601
|
if (isDragging) handleMouseUp();
|
|
7489
7602
|
};
|
|
7603
|
+
const containerWidth = isMobile ? hideSeconds ? "w-16" : "w-8" : "w-16";
|
|
7490
7604
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col items-center gap-1", children: [
|
|
7491
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 }),
|
|
7492
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
|
|
7528
|
-
),
|
|
7529
|
-
style: { height: `${itemHeight}px` },
|
|
7530
|
-
onClick: () => !isDragging && onChange(item),
|
|
7531
|
-
children: item.toString().padStart(2, "0")
|
|
7532
|
-
},
|
|
7533
|
-
item
|
|
7534
|
-
);
|
|
7535
|
-
})
|
|
7536
|
-
}
|
|
7537
|
-
)
|
|
7538
|
-
] })
|
|
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
|
+
) })
|
|
7539
7641
|
] });
|
|
7540
7642
|
}
|
|
7541
7643
|
function TimeScrollPicker({
|
|
@@ -7543,7 +7645,10 @@ function TimeScrollPicker({
|
|
|
7543
7645
|
setDate,
|
|
7544
7646
|
hideSeconds = false
|
|
7545
7647
|
}) {
|
|
7648
|
+
const isMobile = useIsMobile();
|
|
7546
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;
|
|
7547
7652
|
const handleTimeChange = (type, value) => {
|
|
7548
7653
|
const newDate = new Date(currentDate);
|
|
7549
7654
|
if (type === "hours") newDate.setHours(value);
|
|
@@ -7551,14 +7656,25 @@ function TimeScrollPicker({
|
|
|
7551
7656
|
else newDate.setSeconds(value);
|
|
7552
7657
|
setDate(newDate);
|
|
7553
7658
|
};
|
|
7554
|
-
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
|
+
),
|
|
7555
7670
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
7556
7671
|
ScrollColumn,
|
|
7557
7672
|
{
|
|
7558
7673
|
value: currentDate.getHours(),
|
|
7559
7674
|
onChange: (v) => handleTimeChange("hours", v),
|
|
7560
7675
|
max: 24,
|
|
7561
|
-
label: "Hora"
|
|
7676
|
+
label: "Hora",
|
|
7677
|
+
hideSeconds
|
|
7562
7678
|
}
|
|
7563
7679
|
),
|
|
7564
7680
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
@@ -7567,7 +7683,8 @@ function TimeScrollPicker({
|
|
|
7567
7683
|
value: currentDate.getMinutes(),
|
|
7568
7684
|
onChange: (v) => handleTimeChange("minutes", v),
|
|
7569
7685
|
max: 60,
|
|
7570
|
-
label: "Min"
|
|
7686
|
+
label: "Min",
|
|
7687
|
+
hideSeconds
|
|
7571
7688
|
}
|
|
7572
7689
|
),
|
|
7573
7690
|
!hideSeconds && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
@@ -7576,12 +7693,44 @@ function TimeScrollPicker({
|
|
|
7576
7693
|
value: currentDate.getSeconds(),
|
|
7577
7694
|
onChange: (v) => handleTimeChange("seconds", v),
|
|
7578
7695
|
max: 60,
|
|
7579
|
-
label: "Seg"
|
|
7696
|
+
label: "Seg",
|
|
7697
|
+
hideSeconds
|
|
7580
7698
|
}
|
|
7581
7699
|
)
|
|
7582
7700
|
] }) });
|
|
7583
7701
|
}
|
|
7584
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
|
+
|
|
7585
7734
|
// src/components/ui/picker/DateTimePicker.tsx
|
|
7586
7735
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
7587
7736
|
function DateTimePicker({
|
|
@@ -7598,11 +7747,14 @@ function DateTimePicker({
|
|
|
7598
7747
|
className,
|
|
7599
7748
|
error
|
|
7600
7749
|
}) {
|
|
7601
|
-
const [internalDate, setInternalDate] = (0,
|
|
7602
|
-
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();
|
|
7603
7753
|
const handleSelect = (newDay) => {
|
|
7604
7754
|
if (!newDay) return;
|
|
7605
7755
|
if (!internalDate) {
|
|
7756
|
+
const now = /* @__PURE__ */ new Date();
|
|
7757
|
+
newDay.setHours(now.getHours(), now.getMinutes(), now.getSeconds());
|
|
7606
7758
|
setInternalDate(newDay);
|
|
7607
7759
|
onChange?.(newDay);
|
|
7608
7760
|
return;
|
|
@@ -7630,59 +7782,46 @@ function DateTimePicker({
|
|
|
7630
7782
|
if (!timeFormat) return "dd MMMM yyyy";
|
|
7631
7783
|
return `dd MMMM yyyy - ${timeFormat}`;
|
|
7632
7784
|
};
|
|
7633
|
-
(0,
|
|
7785
|
+
(0, import_react43.useEffect)(() => {
|
|
7634
7786
|
setInternalDate(date);
|
|
7635
7787
|
}, [date, open]);
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
{
|
|
7648
|
-
variant: "outline",
|
|
7649
|
-
disabled,
|
|
7650
|
-
className: cn(
|
|
7651
|
-
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
7652
|
-
!date && "text-muted-foreground"
|
|
7653
|
-
),
|
|
7654
|
-
children: [
|
|
7655
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7656
|
-
"span",
|
|
7657
|
-
{
|
|
7658
|
-
className: cn(
|
|
7659
|
-
"truncate flex-1",
|
|
7660
|
-
!date && "text-muted-foreground"
|
|
7661
|
-
),
|
|
7662
|
-
children: date ? (0, import_date_fns.format)(date, getDisplayFormat(), { locale: import_locale2.ptBR }) : "Selecione uma data"
|
|
7663
|
-
}
|
|
7664
|
-
),
|
|
7665
|
-
date && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7666
|
-
ClearButton,
|
|
7667
|
-
{
|
|
7668
|
-
className: "-mr-3",
|
|
7669
|
-
onClick: (e) => {
|
|
7670
|
-
e?.stopPropagation();
|
|
7671
|
-
setInternalDate(null);
|
|
7672
|
-
onChange?.(null);
|
|
7673
|
-
onConfirm?.(null);
|
|
7674
|
-
}
|
|
7675
|
-
}
|
|
7676
|
-
),
|
|
7677
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react42.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
7678
|
-
]
|
|
7679
|
-
}
|
|
7680
|
-
)
|
|
7681
|
-
}
|
|
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"
|
|
7682
7799
|
),
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
/* @__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: [
|
|
7686
7825
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7687
7826
|
CalendarBase2,
|
|
7688
7827
|
{
|
|
@@ -7690,50 +7829,106 @@ function DateTimePicker({
|
|
|
7690
7829
|
locale: import_locale2.ptBR,
|
|
7691
7830
|
selected: internalDate ?? void 0,
|
|
7692
7831
|
onSelect: (d) => handleSelect(d ?? null),
|
|
7693
|
-
|
|
7832
|
+
autoFocus: true,
|
|
7694
7833
|
defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
|
|
7695
|
-
fromDate,
|
|
7696
|
-
toDate,
|
|
7834
|
+
...fromDate && { startMonth: fromDate },
|
|
7835
|
+
...toDate && { endMonth: toDate },
|
|
7836
|
+
...fromDate || toDate ? {
|
|
7837
|
+
hidden: [
|
|
7838
|
+
...fromDate ? [{ before: fromDate }] : [],
|
|
7839
|
+
...toDate ? [{ after: toDate }] : []
|
|
7840
|
+
]
|
|
7841
|
+
} : {},
|
|
7697
7842
|
className: cn(
|
|
7698
7843
|
"w-max rounded-none",
|
|
7699
|
-
!hideTime && "sm:rounded-r-none rounded-b-none"
|
|
7844
|
+
!hideTime && "sm:rounded-r-none rounded-b-none",
|
|
7845
|
+
isMobile ? "border-b-transparent w-full" : ""
|
|
7700
7846
|
)
|
|
7701
7847
|
}
|
|
7702
7848
|
),
|
|
7703
|
-
!hideTime && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
7704
|
-
|
|
7705
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7706
|
-
TimeScrollPicker,
|
|
7707
|
-
{
|
|
7708
|
-
setDate: (d) => handleTimeChange(d ?? null),
|
|
7709
|
-
date: internalDate,
|
|
7710
|
-
hideSeconds
|
|
7711
|
-
}
|
|
7712
|
-
)
|
|
7713
|
-
] })
|
|
7714
|
-
] }),
|
|
7715
|
-
/* @__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: [
|
|
7716
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7717
|
-
ButtonBase,
|
|
7718
|
-
{
|
|
7719
|
-
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",
|
|
7720
|
-
onClick: () => setOpen(false),
|
|
7721
|
-
children: "Cancelar"
|
|
7722
|
-
}
|
|
7723
|
-
),
|
|
7724
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
7725
|
-
ButtonBase,
|
|
7849
|
+
!hideTime && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
7850
|
+
"div",
|
|
7726
7851
|
{
|
|
7727
|
-
className:
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
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
|
+
]
|
|
7733
7867
|
}
|
|
7734
7868
|
)
|
|
7735
|
-
]
|
|
7736
|
-
|
|
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
|
+
)
|
|
7737
7932
|
] })
|
|
7738
7933
|
] });
|
|
7739
7934
|
}
|
|
@@ -7743,7 +7938,7 @@ var React38 = __toESM(require("react"));
|
|
|
7743
7938
|
var import_react_day_picker3 = require("react-day-picker");
|
|
7744
7939
|
var import_pt_BR = __toESM(require("date-fns/locale/pt-BR"));
|
|
7745
7940
|
var import_date_fns2 = require("date-fns");
|
|
7746
|
-
var
|
|
7941
|
+
var import_react45 = require("@phosphor-icons/react");
|
|
7747
7942
|
var import_framer_motion11 = require("framer-motion");
|
|
7748
7943
|
var import_ssr3 = require("@phosphor-icons/react/dist/ssr");
|
|
7749
7944
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
@@ -7772,6 +7967,9 @@ function RangePicker({
|
|
|
7772
7967
|
setRange(void 0);
|
|
7773
7968
|
onChange?.(void 0);
|
|
7774
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";
|
|
7775
7973
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
7776
7974
|
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(LabelBase_default, { children: label }),
|
|
7777
7975
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
@@ -7813,7 +8011,7 @@ function RangePicker({
|
|
|
7813
8011
|
}
|
|
7814
8012
|
}
|
|
7815
8013
|
),
|
|
7816
|
-
/* @__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" })
|
|
7817
8015
|
]
|
|
7818
8016
|
}
|
|
7819
8017
|
)
|
|
@@ -7824,14 +8022,19 @@ function RangePicker({
|
|
|
7824
8022
|
PopoverContentBase,
|
|
7825
8023
|
{
|
|
7826
8024
|
asChild: true,
|
|
7827
|
-
className:
|
|
8025
|
+
className: center ? centeredPopoverClass : basePopoverClass,
|
|
8026
|
+
side: "top",
|
|
8027
|
+
align: "center",
|
|
8028
|
+
sideOffset: -240,
|
|
7828
8029
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
7829
8030
|
import_framer_motion11.motion.div,
|
|
7830
8031
|
{
|
|
7831
|
-
|
|
8032
|
+
ref: contentRef,
|
|
8033
|
+
initial: { opacity: 0, y: -4 },
|
|
7832
8034
|
animate: { opacity: 1, y: 0 },
|
|
7833
|
-
exit: { opacity: 0, y:
|
|
8035
|
+
exit: { opacity: 0, y: -4 },
|
|
7834
8036
|
transition: { duration: 0.18, ease: "easeOut" },
|
|
8037
|
+
className: "border rounded-md shadow-xl ",
|
|
7835
8038
|
children: [
|
|
7836
8039
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7837
8040
|
import_framer_motion11.motion.div,
|
|
@@ -7852,8 +8055,10 @@ function RangePicker({
|
|
|
7852
8055
|
fixedWeeks: true,
|
|
7853
8056
|
weekStartsOn: 1,
|
|
7854
8057
|
navLayout: "around",
|
|
7855
|
-
|
|
7856
|
-
|
|
8058
|
+
hidden: minDate || maxDate ? {
|
|
8059
|
+
before: minDate,
|
|
8060
|
+
after: maxDate
|
|
8061
|
+
} : void 0,
|
|
7857
8062
|
className: "min-w-0 flex flex-col",
|
|
7858
8063
|
classNames: {
|
|
7859
8064
|
months: "flex flex-col sm:flex-row gap-3 sm:gap-4 w-full",
|
|
@@ -7883,7 +8088,7 @@ function RangePicker({
|
|
|
7883
8088
|
day_button: cn(
|
|
7884
8089
|
buttonVariantsBase({ variant: "ghost" }),
|
|
7885
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",
|
|
7886
|
-
"aria-selected:opacity-100 transition-all duration-150 ease-out active:scale-95 hover:bg-background/
|
|
8091
|
+
"aria-selected:opacity-100 transition-all duration-150 ease-out active:scale-95 hover:bg-background/20 hover:text-primary/90 rounded-none "
|
|
7887
8092
|
),
|
|
7888
8093
|
selected: "bg-primary text-primary-foreground font-semibold hover:text-white",
|
|
7889
8094
|
today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
|
|
@@ -7897,9 +8102,9 @@ function RangePicker({
|
|
|
7897
8102
|
components: {
|
|
7898
8103
|
Chevron: ({ orientation }) => {
|
|
7899
8104
|
if (orientation === "left") {
|
|
7900
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react45.CaretLeftIcon, { className: "h-4 w-4" });
|
|
7901
8106
|
}
|
|
7902
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react45.CaretRightIcon, { className: "h-4 w-4" });
|
|
7903
8108
|
}
|
|
7904
8109
|
}
|
|
7905
8110
|
}
|
|
@@ -7952,12 +8157,16 @@ function RangePicker({
|
|
|
7952
8157
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
7953
8158
|
ButtonBase,
|
|
7954
8159
|
{
|
|
7955
|
-
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,
|
|
7956
8165
|
onClick: () => {
|
|
8166
|
+
if (!range?.from || !range?.to) return;
|
|
7957
8167
|
onConfirm?.(range);
|
|
7958
8168
|
setOpen(false);
|
|
7959
8169
|
},
|
|
7960
|
-
disabled: !range?.from || !range?.to,
|
|
7961
8170
|
children: "Selecionar"
|
|
7962
8171
|
}
|
|
7963
8172
|
)
|
|
@@ -7979,8 +8188,8 @@ var import_framer_motion12 = require("framer-motion");
|
|
|
7979
8188
|
var React40 = __toESM(require("react"));
|
|
7980
8189
|
|
|
7981
8190
|
// src/components/ui/picker/TimePickerInput.tsx
|
|
7982
|
-
var
|
|
7983
|
-
var
|
|
8191
|
+
var import_react46 = require("@phosphor-icons/react");
|
|
8192
|
+
var import_react47 = __toESM(require("react"));
|
|
7984
8193
|
|
|
7985
8194
|
// src/components/ui/picker/utils/time-picker-utils.ts
|
|
7986
8195
|
function isValidHour(value) {
|
|
@@ -8123,7 +8332,7 @@ function display12HourValue(hours) {
|
|
|
8123
8332
|
|
|
8124
8333
|
// src/components/ui/picker/TimePickerInput.tsx
|
|
8125
8334
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
8126
|
-
var TimePickerInput =
|
|
8335
|
+
var TimePickerInput = import_react47.default.forwardRef(
|
|
8127
8336
|
({
|
|
8128
8337
|
className,
|
|
8129
8338
|
type = "tel",
|
|
@@ -8142,10 +8351,10 @@ var TimePickerInput = import_react45.default.forwardRef(
|
|
|
8142
8351
|
label,
|
|
8143
8352
|
...props
|
|
8144
8353
|
}, ref) => {
|
|
8145
|
-
const [flag, setFlag] =
|
|
8146
|
-
const [prevIntKey, setPrevIntKey] =
|
|
8147
|
-
const [isFocused, setIsFocused] =
|
|
8148
|
-
|
|
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(() => {
|
|
8149
8358
|
if (flag) {
|
|
8150
8359
|
const timer = setTimeout(() => {
|
|
8151
8360
|
setFlag(false);
|
|
@@ -8153,7 +8362,7 @@ var TimePickerInput = import_react45.default.forwardRef(
|
|
|
8153
8362
|
return () => clearTimeout(timer);
|
|
8154
8363
|
}
|
|
8155
8364
|
}, [flag]);
|
|
8156
|
-
const calculatedValue =
|
|
8365
|
+
const calculatedValue = import_react47.default.useMemo(() => {
|
|
8157
8366
|
const safeDate = date ?? new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
|
|
8158
8367
|
return getDateByType(safeDate, picker);
|
|
8159
8368
|
}, [date, picker]);
|
|
@@ -8249,7 +8458,7 @@ var TimePickerInput = import_react45.default.forwardRef(
|
|
|
8249
8458
|
),
|
|
8250
8459
|
tabIndex: -1,
|
|
8251
8460
|
"aria-label": `Incrementar ${getPickerLabel().toLowerCase()}`,
|
|
8252
|
-
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" })
|
|
8253
8462
|
}
|
|
8254
8463
|
),
|
|
8255
8464
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "relative", children: [
|
|
@@ -8316,7 +8525,7 @@ var TimePickerInput = import_react45.default.forwardRef(
|
|
|
8316
8525
|
),
|
|
8317
8526
|
tabIndex: -1,
|
|
8318
8527
|
"aria-label": `Decrementar ${getPickerLabel().toLowerCase()}`,
|
|
8319
|
-
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" })
|
|
8320
8529
|
}
|
|
8321
8530
|
)
|
|
8322
8531
|
]
|
|
@@ -8427,8 +8636,8 @@ function TimePicker({
|
|
|
8427
8636
|
// src/components/ui/event-calendar-view/Agenda.tsx
|
|
8428
8637
|
var import_date_fns3 = require("date-fns");
|
|
8429
8638
|
var import_locale3 = require("date-fns/locale");
|
|
8430
|
-
var
|
|
8431
|
-
var
|
|
8639
|
+
var import_react48 = require("react");
|
|
8640
|
+
var import_react49 = require("@phosphor-icons/react");
|
|
8432
8641
|
var import_tailwind_merge2 = require("tailwind-merge");
|
|
8433
8642
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
8434
8643
|
function Agenda({
|
|
@@ -8445,15 +8654,15 @@ function Agenda({
|
|
|
8445
8654
|
return false;
|
|
8446
8655
|
}
|
|
8447
8656
|
};
|
|
8448
|
-
const datedEvents = (0,
|
|
8657
|
+
const datedEvents = (0, import_react48.useMemo)(
|
|
8449
8658
|
() => events.filter((e) => isValidDate5(e.start) || isValidDate5(e.end)),
|
|
8450
8659
|
[events]
|
|
8451
8660
|
);
|
|
8452
|
-
const undatedEvents = (0,
|
|
8661
|
+
const undatedEvents = (0, import_react48.useMemo)(
|
|
8453
8662
|
() => events.filter((e) => !(isValidDate5(e.start) || isValidDate5(e.end))),
|
|
8454
8663
|
[events]
|
|
8455
8664
|
);
|
|
8456
|
-
const days = (0,
|
|
8665
|
+
const days = (0, import_react48.useMemo)(() => {
|
|
8457
8666
|
const start = (0, import_date_fns3.startOfMonth)(new Date(currentDate));
|
|
8458
8667
|
const end = (0, import_date_fns3.endOfMonth)(new Date(currentDate));
|
|
8459
8668
|
return (0, import_date_fns3.eachDayOfInterval)({ start, end });
|
|
@@ -8466,7 +8675,7 @@ function Agenda({
|
|
|
8466
8675
|
(day) => getAgendaEventsForDayAgenda(datedEvents, day).length > 0
|
|
8467
8676
|
);
|
|
8468
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: [
|
|
8469
|
-
/* @__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 }),
|
|
8470
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" }),
|
|
8471
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." })
|
|
8472
8681
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
@@ -8485,7 +8694,7 @@ function Agenda({
|
|
|
8485
8694
|
"span",
|
|
8486
8695
|
{
|
|
8487
8696
|
className: (0, import_tailwind_merge2.twMerge)(
|
|
8488
|
-
"-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",
|
|
8489
8698
|
(0, import_date_fns3.isToday)(day) ? "text-blue-500" : ""
|
|
8490
8699
|
),
|
|
8491
8700
|
"data-today": (0, import_date_fns3.isToday)(day) || void 0,
|
|
@@ -8528,11 +8737,11 @@ function Agenda({
|
|
|
8528
8737
|
// src/components/ui/event-calendar-view/CalendarDND.tsx
|
|
8529
8738
|
var import_core = require("@dnd-kit/core");
|
|
8530
8739
|
var import_date_fns4 = require("date-fns");
|
|
8531
|
-
var
|
|
8740
|
+
var import_react51 = require("react");
|
|
8532
8741
|
|
|
8533
8742
|
// src/components/ui/event-calendar-view/hooks.ts
|
|
8534
|
-
var
|
|
8535
|
-
var CalendarDndContext = (0,
|
|
8743
|
+
var import_react50 = require("react");
|
|
8744
|
+
var CalendarDndContext = (0, import_react50.createContext)({
|
|
8536
8745
|
activeEvent: null,
|
|
8537
8746
|
activeId: null,
|
|
8538
8747
|
activeView: null,
|
|
@@ -8542,7 +8751,7 @@ var CalendarDndContext = (0, import_react48.createContext)({
|
|
|
8542
8751
|
isMultiDay: false,
|
|
8543
8752
|
multiDayWidth: null
|
|
8544
8753
|
});
|
|
8545
|
-
var useCalendarDndAgenda = () => (0,
|
|
8754
|
+
var useCalendarDndAgenda = () => (0, import_react50.useContext)(CalendarDndContext);
|
|
8546
8755
|
|
|
8547
8756
|
// src/components/ui/event-calendar-view/CalendarDND.tsx
|
|
8548
8757
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
@@ -8550,19 +8759,19 @@ function CalendarDndProviderAgenda({
|
|
|
8550
8759
|
children,
|
|
8551
8760
|
onEventUpdate
|
|
8552
8761
|
}) {
|
|
8553
|
-
const [activeEvent, setActiveEvent] = (0,
|
|
8762
|
+
const [activeEvent, setActiveEvent] = (0, import_react51.useState)(
|
|
8554
8763
|
null
|
|
8555
8764
|
);
|
|
8556
|
-
const [activeId, setActiveId] = (0,
|
|
8557
|
-
const [activeView, setActiveView] = (0,
|
|
8765
|
+
const [activeId, setActiveId] = (0, import_react51.useState)(null);
|
|
8766
|
+
const [activeView, setActiveView] = (0, import_react51.useState)(
|
|
8558
8767
|
null
|
|
8559
8768
|
);
|
|
8560
|
-
const [currentTime, setCurrentTime] = (0,
|
|
8561
|
-
const [eventHeight, setEventHeight] = (0,
|
|
8562
|
-
const [isMultiDay, setIsMultiDay] = (0,
|
|
8563
|
-
const [multiDayWidth, setMultiDayWidth] = (0,
|
|
8564
|
-
const [dragHandlePosition, setDragHandlePosition] = (0,
|
|
8565
|
-
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 });
|
|
8566
8775
|
const sensors = (0, import_core.useSensors)(
|
|
8567
8776
|
(0, import_core.useSensor)(import_core.MouseSensor, {
|
|
8568
8777
|
// Require the mouse to move by 5px before activating
|
|
@@ -8584,7 +8793,7 @@ function CalendarDndProviderAgenda({
|
|
|
8584
8793
|
}
|
|
8585
8794
|
})
|
|
8586
8795
|
);
|
|
8587
|
-
const dndContextId = (0,
|
|
8796
|
+
const dndContextId = (0, import_react51.useId)();
|
|
8588
8797
|
const handleDragStart = (event) => {
|
|
8589
8798
|
const { active } = event;
|
|
8590
8799
|
if (!active.data.current) {
|
|
@@ -8782,7 +8991,7 @@ var DefaultEndHourAgenda = 10;
|
|
|
8782
8991
|
|
|
8783
8992
|
// src/components/ui/event-calendar-view/DayView.tsx
|
|
8784
8993
|
var import_date_fns8 = require("date-fns");
|
|
8785
|
-
var
|
|
8994
|
+
var import_react54 = require("react");
|
|
8786
8995
|
|
|
8787
8996
|
// src/components/ui/event-calendar-view/utils.ts
|
|
8788
8997
|
var import_date_fns5 = require("date-fns");
|
|
@@ -8913,11 +9122,11 @@ function addHoursToDateAgenda(date, hours) {
|
|
|
8913
9122
|
// src/components/ui/event-calendar-view/hooks/use-current-time-indicator.ts
|
|
8914
9123
|
var import_date_fns6 = require("date-fns");
|
|
8915
9124
|
var import_locale4 = require("date-fns/locale");
|
|
8916
|
-
var
|
|
9125
|
+
var import_react52 = require("react");
|
|
8917
9126
|
function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
8918
|
-
const [currentTimePosition, setCurrentTimePosition] = (0,
|
|
8919
|
-
const [currentTimeVisible, setCurrentTimeVisible] = (0,
|
|
8920
|
-
(0,
|
|
9127
|
+
const [currentTimePosition, setCurrentTimePosition] = (0, import_react52.useState)(0);
|
|
9128
|
+
const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react52.useState)(false);
|
|
9129
|
+
(0, import_react52.useEffect)(() => {
|
|
8921
9130
|
const calculateTimePosition = () => {
|
|
8922
9131
|
const now = /* @__PURE__ */ new Date();
|
|
8923
9132
|
const hours = now.getHours();
|
|
@@ -8949,7 +9158,7 @@ function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
|
8949
9158
|
|
|
8950
9159
|
// src/components/ui/event-calendar-view/EventItemAgenda.tsx
|
|
8951
9160
|
var import_date_fns7 = require("date-fns");
|
|
8952
|
-
var
|
|
9161
|
+
var import_react53 = require("react");
|
|
8953
9162
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
8954
9163
|
var formatTimeWithOptionalMinutes = (date) => {
|
|
8955
9164
|
return (0, import_date_fns7.format)(date, "HH:mm");
|
|
@@ -9031,13 +9240,13 @@ function EventItemAgenda({
|
|
|
9031
9240
|
const endDate = getEventEndDate(event);
|
|
9032
9241
|
const hasValidTime = !!startDate || !!endDate;
|
|
9033
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";
|
|
9034
|
-
const displayStart = (0,
|
|
9243
|
+
const displayStart = (0, import_react53.useMemo)(() => {
|
|
9035
9244
|
if (!hasValidTime) return void 0;
|
|
9036
9245
|
if (startDate) return currentTime || startDate;
|
|
9037
9246
|
if (endDate) return currentTime || endDate;
|
|
9038
9247
|
return void 0;
|
|
9039
9248
|
}, [currentTime, startDate, endDate, hasValidTime]);
|
|
9040
|
-
const displayEnd = (0,
|
|
9249
|
+
const displayEnd = (0, import_react53.useMemo)(() => {
|
|
9041
9250
|
if (!hasValidTime) return void 0;
|
|
9042
9251
|
if (endDate) {
|
|
9043
9252
|
return currentTime ? new Date(
|
|
@@ -9049,7 +9258,7 @@ function EventItemAgenda({
|
|
|
9049
9258
|
}
|
|
9050
9259
|
return void 0;
|
|
9051
9260
|
}, [currentTime, startDate, endDate, hasValidTime]);
|
|
9052
|
-
const durationMinutes = (0,
|
|
9261
|
+
const durationMinutes = (0, import_react53.useMemo)(() => {
|
|
9053
9262
|
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
9054
9263
|
return (0, import_date_fns7.differenceInMinutes)(displayEnd, displayStart);
|
|
9055
9264
|
}, [displayStart, displayEnd, hasValidTime]);
|
|
@@ -9297,14 +9506,14 @@ function DayViewAgenda({
|
|
|
9297
9506
|
onEventSelect,
|
|
9298
9507
|
showUndatedEvents
|
|
9299
9508
|
}) {
|
|
9300
|
-
const hours = (0,
|
|
9509
|
+
const hours = (0, import_react54.useMemo)(() => {
|
|
9301
9510
|
const dayStart = (0, import_date_fns8.startOfDay)(currentDate);
|
|
9302
9511
|
return (0, import_date_fns8.eachHourOfInterval)({
|
|
9303
9512
|
end: (0, import_date_fns8.addHours)(dayStart, EndHourAgenda - 1),
|
|
9304
9513
|
start: (0, import_date_fns8.addHours)(dayStart, StartHourAgenda)
|
|
9305
9514
|
});
|
|
9306
9515
|
}, [currentDate]);
|
|
9307
|
-
const dayEvents = (0,
|
|
9516
|
+
const dayEvents = (0, import_react54.useMemo)(() => {
|
|
9308
9517
|
return events.filter((event) => {
|
|
9309
9518
|
if (event.start == null) return false;
|
|
9310
9519
|
const eventStart = getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
@@ -9314,17 +9523,17 @@ function DayViewAgenda({
|
|
|
9314
9523
|
(a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()
|
|
9315
9524
|
);
|
|
9316
9525
|
}, [currentDate, events]);
|
|
9317
|
-
const allDayEvents = (0,
|
|
9526
|
+
const allDayEvents = (0, import_react54.useMemo)(() => {
|
|
9318
9527
|
return dayEvents.filter((event) => {
|
|
9319
9528
|
return event.allDay || isMultiDayEventAgenda(event);
|
|
9320
9529
|
});
|
|
9321
9530
|
}, [dayEvents]);
|
|
9322
|
-
const timeEvents = (0,
|
|
9531
|
+
const timeEvents = (0, import_react54.useMemo)(() => {
|
|
9323
9532
|
return dayEvents.filter((event) => {
|
|
9324
9533
|
return !event.allDay && !isMultiDayEventAgenda(event);
|
|
9325
9534
|
});
|
|
9326
9535
|
}, [dayEvents]);
|
|
9327
|
-
const positionedEvents = (0,
|
|
9536
|
+
const positionedEvents = (0, import_react54.useMemo)(() => {
|
|
9328
9537
|
const result = [];
|
|
9329
9538
|
const dayStart = (0, import_date_fns8.startOfDay)(currentDate);
|
|
9330
9539
|
const sortedEvents = [...timeEvents].sort((a, b) => {
|
|
@@ -9522,13 +9731,13 @@ function DayViewAgenda({
|
|
|
9522
9731
|
// src/components/ui/event-calendar-view/EventAgenda.tsx
|
|
9523
9732
|
var import_date_fns9 = require("date-fns");
|
|
9524
9733
|
var import_locale5 = require("date-fns/locale");
|
|
9525
|
-
var
|
|
9734
|
+
var import_react57 = __toESM(require("react"));
|
|
9526
9735
|
var import_sonner2 = require("sonner");
|
|
9527
|
-
var
|
|
9736
|
+
var import_react58 = require("@phosphor-icons/react");
|
|
9528
9737
|
|
|
9529
9738
|
// src/components/ui/selects/Select.tsx
|
|
9530
|
-
var
|
|
9531
|
-
var
|
|
9739
|
+
var import_react55 = require("react");
|
|
9740
|
+
var import_react56 = require("@phosphor-icons/react");
|
|
9532
9741
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
9533
9742
|
function Select({
|
|
9534
9743
|
items,
|
|
@@ -9544,13 +9753,13 @@ function Select({
|
|
|
9544
9753
|
className,
|
|
9545
9754
|
pagination
|
|
9546
9755
|
}) {
|
|
9547
|
-
const [page, setPage] = (0,
|
|
9548
|
-
const [animating, setAnimating] = (0,
|
|
9756
|
+
const [page, setPage] = (0, import_react55.useState)(1);
|
|
9757
|
+
const [animating, setAnimating] = (0, import_react55.useState)(false);
|
|
9549
9758
|
const groupCount = groupItems ? Object.keys(groupItems).length : 0;
|
|
9550
|
-
(0,
|
|
9759
|
+
(0, import_react55.useEffect)(() => {
|
|
9551
9760
|
setPage(1);
|
|
9552
9761
|
}, [items?.length, groupCount, pagination]);
|
|
9553
|
-
const paged = (0,
|
|
9762
|
+
const paged = (0, import_react55.useMemo)(() => {
|
|
9554
9763
|
if (!pagination || pagination <= 0) return null;
|
|
9555
9764
|
if (groupItems) {
|
|
9556
9765
|
const flattened = Object.keys(groupItems).flatMap(
|
|
@@ -9577,7 +9786,7 @@ function Select({
|
|
|
9577
9786
|
}, [items, groupItems, page, pagination]);
|
|
9578
9787
|
const goPrev = () => setPage((p) => Math.max(1, p - 1));
|
|
9579
9788
|
const goNext = () => setPage((p) => paged ? Math.min(paged.totalPages, p + 1) : p + 1);
|
|
9580
|
-
(0,
|
|
9789
|
+
(0, import_react55.useEffect)(() => {
|
|
9581
9790
|
if (!pagination) return;
|
|
9582
9791
|
setAnimating(true);
|
|
9583
9792
|
const id = setTimeout(() => setAnimating(false), 220);
|
|
@@ -9667,7 +9876,7 @@ function Select({
|
|
|
9667
9876
|
"data-testid": testIds.paginationPrev ?? "select-pagination-prev",
|
|
9668
9877
|
"aria-label": "Previous page",
|
|
9669
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",
|
|
9670
|
-
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" })
|
|
9671
9880
|
}
|
|
9672
9881
|
),
|
|
9673
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}` }) }),
|
|
@@ -9680,7 +9889,7 @@ function Select({
|
|
|
9680
9889
|
"data-testid": testIds.paginationNext ?? "select-pagination-next",
|
|
9681
9890
|
"aria-label": "Next page",
|
|
9682
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",
|
|
9683
|
-
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" })
|
|
9684
9893
|
}
|
|
9685
9894
|
)
|
|
9686
9895
|
] })
|
|
@@ -9740,11 +9949,11 @@ function EventAgenda({
|
|
|
9740
9949
|
initialDate,
|
|
9741
9950
|
onClick
|
|
9742
9951
|
}) {
|
|
9743
|
-
const [currentDate, setCurrentDate] = (0,
|
|
9952
|
+
const [currentDate, setCurrentDate] = (0, import_react57.useState)(
|
|
9744
9953
|
initialDate && new Date(initialDate) || /* @__PURE__ */ new Date()
|
|
9745
9954
|
);
|
|
9746
|
-
const [view, setView] = (0,
|
|
9747
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
9955
|
+
const [view, setView] = (0, import_react57.useState)(initialView);
|
|
9956
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react57.useState)(null);
|
|
9748
9957
|
const goPrevious = () => {
|
|
9749
9958
|
if (view === "month") setCurrentDate((d) => (0, import_date_fns9.subMonths)(d, 1));
|
|
9750
9959
|
else if (view === "week") setCurrentDate((d) => (0, import_date_fns9.subWeeks)(d, 1));
|
|
@@ -9768,7 +9977,7 @@ function EventAgenda({
|
|
|
9768
9977
|
);
|
|
9769
9978
|
return;
|
|
9770
9979
|
}
|
|
9771
|
-
if (
|
|
9980
|
+
if (import_react57.default.isValidElement(onClick)) {
|
|
9772
9981
|
setSelectedEvent(event);
|
|
9773
9982
|
return;
|
|
9774
9983
|
}
|
|
@@ -9800,7 +10009,7 @@ function EventAgenda({
|
|
|
9800
10009
|
const entry = labels[v] || { full: v, short: v };
|
|
9801
10010
|
return condensed ? entry.short : entry.full;
|
|
9802
10011
|
};
|
|
9803
|
-
const viewTitle = (0,
|
|
10012
|
+
const viewTitle = (0, import_react57.useMemo)(() => {
|
|
9804
10013
|
const capitalize = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
9805
10014
|
if (view === "month")
|
|
9806
10015
|
return capitalize((0, import_date_fns9.format)(currentDate, "MMMM yyyy", { locale: import_locale5.ptBR }));
|
|
@@ -9849,7 +10058,7 @@ function EventAgenda({
|
|
|
9849
10058
|
onClick: goPrevious,
|
|
9850
10059
|
size: "icon",
|
|
9851
10060
|
variant: "ghost",
|
|
9852
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10061
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react58.CaretLeftIcon, { "aria-hidden": true, size: 16 })
|
|
9853
10062
|
}
|
|
9854
10063
|
),
|
|
9855
10064
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
@@ -9859,7 +10068,7 @@ function EventAgenda({
|
|
|
9859
10068
|
onClick: goNext,
|
|
9860
10069
|
size: "icon",
|
|
9861
10070
|
variant: "ghost",
|
|
9862
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10071
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react58.CaretRightIcon, { "aria-hidden": true, size: 16 })
|
|
9863
10072
|
}
|
|
9864
10073
|
)
|
|
9865
10074
|
] }),
|
|
@@ -9920,7 +10129,7 @@ function EventAgenda({
|
|
|
9920
10129
|
}
|
|
9921
10130
|
)
|
|
9922
10131
|
] }),
|
|
9923
|
-
selectedEvent &&
|
|
10132
|
+
selectedEvent && import_react57.default.isValidElement(onClick) ? import_react57.default.cloneElement(onClick, {
|
|
9924
10133
|
event: selectedEvent,
|
|
9925
10134
|
onClose: () => setSelectedEvent(null)
|
|
9926
10135
|
}) : null
|
|
@@ -9930,7 +10139,7 @@ function EventAgenda({
|
|
|
9930
10139
|
}
|
|
9931
10140
|
|
|
9932
10141
|
// src/components/ui/event-calendar-view/UndatedEvents.tsx
|
|
9933
|
-
var
|
|
10142
|
+
var import_react59 = require("react");
|
|
9934
10143
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
9935
10144
|
var isValidDate2 = (d) => {
|
|
9936
10145
|
try {
|
|
@@ -9947,7 +10156,7 @@ function UndatedEvents({
|
|
|
9947
10156
|
title = "Data de Atendimento n\xE3o Prevista",
|
|
9948
10157
|
show = true
|
|
9949
10158
|
}) {
|
|
9950
|
-
const undatedEvents = (0,
|
|
10159
|
+
const undatedEvents = (0, import_react59.useMemo)(
|
|
9951
10160
|
() => events.filter((e) => !(isValidDate2(e.start) || isValidDate2(e.end))),
|
|
9952
10161
|
[events]
|
|
9953
10162
|
);
|
|
@@ -9969,15 +10178,15 @@ function UndatedEvents({
|
|
|
9969
10178
|
}
|
|
9970
10179
|
|
|
9971
10180
|
// src/components/ui/event-calendar-view/hooks/use-event-visibility.ts
|
|
9972
|
-
var
|
|
10181
|
+
var import_react60 = require("react");
|
|
9973
10182
|
function useEventVisibilityAgenda({
|
|
9974
10183
|
eventHeight,
|
|
9975
10184
|
eventGap
|
|
9976
10185
|
}) {
|
|
9977
|
-
const contentRef = (0,
|
|
9978
|
-
const observerRef = (0,
|
|
9979
|
-
const [contentHeight, setContentHeight] = (0,
|
|
9980
|
-
(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)(() => {
|
|
9981
10190
|
if (!contentRef.current) return;
|
|
9982
10191
|
const updateHeight = () => {
|
|
9983
10192
|
if (contentRef.current) {
|
|
@@ -9997,7 +10206,7 @@ function useEventVisibilityAgenda({
|
|
|
9997
10206
|
}
|
|
9998
10207
|
};
|
|
9999
10208
|
}, []);
|
|
10000
|
-
const getVisibleEventCount = (0,
|
|
10209
|
+
const getVisibleEventCount = (0, import_react60.useMemo)(() => {
|
|
10001
10210
|
return (totalEvents) => {
|
|
10002
10211
|
if (!contentHeight) return totalEvents;
|
|
10003
10212
|
const maxEvents = Math.floor(contentHeight / (eventHeight + eventGap));
|
|
@@ -10017,7 +10226,7 @@ function useEventVisibilityAgenda({
|
|
|
10017
10226
|
// src/components/ui/event-calendar-view/MonthView.tsx
|
|
10018
10227
|
var import_date_fns10 = require("date-fns");
|
|
10019
10228
|
var import_locale6 = require("date-fns/locale");
|
|
10020
|
-
var
|
|
10229
|
+
var import_react61 = require("react");
|
|
10021
10230
|
var import_tailwind_merge3 = require("tailwind-merge");
|
|
10022
10231
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10023
10232
|
function MonthViewAgenda({
|
|
@@ -10026,21 +10235,21 @@ function MonthViewAgenda({
|
|
|
10026
10235
|
onEventSelect,
|
|
10027
10236
|
showUndatedEvents
|
|
10028
10237
|
}) {
|
|
10029
|
-
const days = (0,
|
|
10238
|
+
const days = (0, import_react61.useMemo)(() => {
|
|
10030
10239
|
const monthStart = (0, import_date_fns10.startOfMonth)(currentDate);
|
|
10031
10240
|
const monthEnd = (0, import_date_fns10.endOfMonth)(monthStart);
|
|
10032
10241
|
const calendarStart = (0, import_date_fns10.startOfWeek)(monthStart, { weekStartsOn: 0 });
|
|
10033
10242
|
const calendarEnd = (0, import_date_fns10.endOfWeek)(monthEnd, { weekStartsOn: 0 });
|
|
10034
10243
|
return (0, import_date_fns10.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
|
|
10035
10244
|
}, [currentDate]);
|
|
10036
|
-
const weekdays = (0,
|
|
10245
|
+
const weekdays = (0, import_react61.useMemo)(() => {
|
|
10037
10246
|
return Array.from({ length: 7 }).map((_, i) => {
|
|
10038
10247
|
const date = (0, import_date_fns10.addDays)((0, import_date_fns10.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
|
|
10039
10248
|
const short = (0, import_date_fns10.format)(date, "EEE", { locale: import_locale6.ptBR });
|
|
10040
10249
|
return short.charAt(0).toUpperCase() + short.slice(1);
|
|
10041
10250
|
});
|
|
10042
10251
|
}, []);
|
|
10043
|
-
const weeks = (0,
|
|
10252
|
+
const weeks = (0, import_react61.useMemo)(() => {
|
|
10044
10253
|
const result = [];
|
|
10045
10254
|
let week = [];
|
|
10046
10255
|
for (let i = 0; i < days.length; i++) {
|
|
@@ -10056,12 +10265,12 @@ function MonthViewAgenda({
|
|
|
10056
10265
|
e.stopPropagation();
|
|
10057
10266
|
onEventSelect(event, e);
|
|
10058
10267
|
};
|
|
10059
|
-
const [isMounted, setIsMounted] = (0,
|
|
10268
|
+
const [isMounted, setIsMounted] = (0, import_react61.useState)(false);
|
|
10060
10269
|
const { contentRef, getVisibleEventCount } = useEventVisibilityAgenda({
|
|
10061
10270
|
eventGap: EventGapAgenda,
|
|
10062
10271
|
eventHeight: EventHeightAgenda
|
|
10063
10272
|
});
|
|
10064
|
-
(0,
|
|
10273
|
+
(0, import_react61.useEffect)(() => {
|
|
10065
10274
|
setIsMounted(true);
|
|
10066
10275
|
}, []);
|
|
10067
10276
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "contents", "data-slot": "month-view", children: [
|
|
@@ -10270,7 +10479,7 @@ function MonthViewAgenda({
|
|
|
10270
10479
|
// src/components/ui/event-calendar-view/WeekView.tsx
|
|
10271
10480
|
var import_date_fns12 = require("date-fns");
|
|
10272
10481
|
var import_locale7 = require("date-fns/locale");
|
|
10273
|
-
var
|
|
10482
|
+
var import_react63 = require("react");
|
|
10274
10483
|
|
|
10275
10484
|
// src/components/ui/event-calendar/constants.ts
|
|
10276
10485
|
var EventHeight = 24;
|
|
@@ -10286,7 +10495,7 @@ var DefaultEndHour = 10;
|
|
|
10286
10495
|
var import_core3 = require("@dnd-kit/core");
|
|
10287
10496
|
var import_utilities = require("@dnd-kit/utilities");
|
|
10288
10497
|
var import_date_fns11 = require("date-fns");
|
|
10289
|
-
var
|
|
10498
|
+
var import_react62 = require("react");
|
|
10290
10499
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10291
10500
|
function DraggableEvent({
|
|
10292
10501
|
event,
|
|
@@ -10302,8 +10511,8 @@ function DraggableEvent({
|
|
|
10302
10511
|
draggable = true
|
|
10303
10512
|
}) {
|
|
10304
10513
|
const { activeId } = useCalendarDndAgenda();
|
|
10305
|
-
const elementRef = (0,
|
|
10306
|
-
const [dragHandlePosition, setDragHandlePosition] = (0,
|
|
10514
|
+
const elementRef = (0, import_react62.useRef)(null);
|
|
10515
|
+
const [dragHandlePosition, setDragHandlePosition] = (0, import_react62.useState)(null);
|
|
10307
10516
|
const eventStart = getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
10308
10517
|
const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
10309
10518
|
const isMultiDayEvent2 = isMultiDay || event.allDay || (0, import_date_fns11.differenceInDays)(eventEnd, eventStart) >= 1;
|
|
@@ -10400,23 +10609,23 @@ function WeekViewAgenda({
|
|
|
10400
10609
|
onEventCreate,
|
|
10401
10610
|
showUndatedEvents
|
|
10402
10611
|
}) {
|
|
10403
|
-
const days = (0,
|
|
10612
|
+
const days = (0, import_react63.useMemo)(() => {
|
|
10404
10613
|
const weekStart2 = (0, import_date_fns12.startOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
10405
10614
|
const weekEnd = (0, import_date_fns12.endOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
10406
10615
|
return (0, import_date_fns12.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
|
|
10407
10616
|
}, [currentDate]);
|
|
10408
|
-
const weekStart = (0,
|
|
10617
|
+
const weekStart = (0, import_react63.useMemo)(
|
|
10409
10618
|
() => (0, import_date_fns12.startOfWeek)(currentDate, { weekStartsOn: 0 }),
|
|
10410
10619
|
[currentDate]
|
|
10411
10620
|
);
|
|
10412
|
-
const hours = (0,
|
|
10621
|
+
const hours = (0, import_react63.useMemo)(() => {
|
|
10413
10622
|
const dayStart = (0, import_date_fns12.startOfDay)(currentDate);
|
|
10414
10623
|
return (0, import_date_fns12.eachHourOfInterval)({
|
|
10415
10624
|
end: (0, import_date_fns12.addHours)(dayStart, EndHour - 1),
|
|
10416
10625
|
start: (0, import_date_fns12.addHours)(dayStart, StartHour)
|
|
10417
10626
|
});
|
|
10418
10627
|
}, [currentDate]);
|
|
10419
|
-
const allDayEvents = (0,
|
|
10628
|
+
const allDayEvents = (0, import_react63.useMemo)(() => {
|
|
10420
10629
|
const isValidStart = (ev) => {
|
|
10421
10630
|
try {
|
|
10422
10631
|
if (ev.start == null) return false;
|
|
@@ -10441,7 +10650,7 @@ function WeekViewAgenda({
|
|
|
10441
10650
|
});
|
|
10442
10651
|
});
|
|
10443
10652
|
}, [events, days]);
|
|
10444
|
-
const processedDayEvents = (0,
|
|
10653
|
+
const processedDayEvents = (0, import_react63.useMemo)(() => {
|
|
10445
10654
|
const result = days.map((day) => {
|
|
10446
10655
|
const dayEvents = events.filter((event) => {
|
|
10447
10656
|
if (event.allDay || isMultiDayEventAgenda(event)) return false;
|
|
@@ -10696,8 +10905,8 @@ function WeekViewAgenda({
|
|
|
10696
10905
|
// src/components/ui/event-calendar/AgendaView.tsx
|
|
10697
10906
|
var import_date_fns13 = require("date-fns");
|
|
10698
10907
|
var import_locale8 = require("date-fns/locale");
|
|
10699
|
-
var
|
|
10700
|
-
var
|
|
10908
|
+
var import_react64 = require("react");
|
|
10909
|
+
var import_react65 = require("@phosphor-icons/react");
|
|
10701
10910
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
10702
10911
|
function AgendaView({
|
|
10703
10912
|
currentDate,
|
|
@@ -10713,15 +10922,15 @@ function AgendaView({
|
|
|
10713
10922
|
return false;
|
|
10714
10923
|
}
|
|
10715
10924
|
};
|
|
10716
|
-
const datedEvents = (0,
|
|
10925
|
+
const datedEvents = (0, import_react64.useMemo)(
|
|
10717
10926
|
() => events.filter((e) => isValidDate5(e.start) || isValidDate5(e.end)),
|
|
10718
10927
|
[events]
|
|
10719
10928
|
);
|
|
10720
|
-
const undatedEvents = (0,
|
|
10929
|
+
const undatedEvents = (0, import_react64.useMemo)(
|
|
10721
10930
|
() => events.filter((e) => !(isValidDate5(e.start) || isValidDate5(e.end))),
|
|
10722
10931
|
[events]
|
|
10723
10932
|
);
|
|
10724
|
-
const days = (0,
|
|
10933
|
+
const days = (0, import_react64.useMemo)(() => {
|
|
10725
10934
|
return Array.from(
|
|
10726
10935
|
{ length: AgendaDaysToShow },
|
|
10727
10936
|
(_, i) => (0, import_date_fns13.addDays)(new Date(currentDate), i)
|
|
@@ -10735,7 +10944,7 @@ function AgendaView({
|
|
|
10735
10944
|
(day) => getAgendaEventsForDay(datedEvents, day).length > 0
|
|
10736
10945
|
);
|
|
10737
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: [
|
|
10738
|
-
/* @__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 }),
|
|
10739
10948
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("h3", { className: "font-medium text-lg", children: "Nenhum evento encontrado" }),
|
|
10740
10949
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-muted-foreground", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
|
|
10741
10950
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
@@ -10794,11 +11003,11 @@ function AgendaView({
|
|
|
10794
11003
|
// src/components/ui/event-calendar/CalendarDND.tsx
|
|
10795
11004
|
var import_core4 = require("@dnd-kit/core");
|
|
10796
11005
|
var import_date_fns14 = require("date-fns");
|
|
10797
|
-
var
|
|
11006
|
+
var import_react67 = require("react");
|
|
10798
11007
|
|
|
10799
11008
|
// src/components/ui/event-calendar/hooks.ts
|
|
10800
|
-
var
|
|
10801
|
-
var CalendarDndContext2 = (0,
|
|
11009
|
+
var import_react66 = require("react");
|
|
11010
|
+
var CalendarDndContext2 = (0, import_react66.createContext)({
|
|
10802
11011
|
activeEvent: null,
|
|
10803
11012
|
activeId: null,
|
|
10804
11013
|
activeView: null,
|
|
@@ -10808,7 +11017,7 @@ var CalendarDndContext2 = (0, import_react64.createContext)({
|
|
|
10808
11017
|
isMultiDay: false,
|
|
10809
11018
|
multiDayWidth: null
|
|
10810
11019
|
});
|
|
10811
|
-
var useCalendarDnd = () => (0,
|
|
11020
|
+
var useCalendarDnd = () => (0, import_react66.useContext)(CalendarDndContext2);
|
|
10812
11021
|
|
|
10813
11022
|
// src/components/ui/event-calendar/CalendarDND.tsx
|
|
10814
11023
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
@@ -10816,17 +11025,17 @@ function CalendarDndProvider({
|
|
|
10816
11025
|
children,
|
|
10817
11026
|
onEventUpdate
|
|
10818
11027
|
}) {
|
|
10819
|
-
const [activeEvent, setActiveEvent] = (0,
|
|
10820
|
-
const [activeId, setActiveId] = (0,
|
|
10821
|
-
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)(
|
|
10822
11031
|
null
|
|
10823
11032
|
);
|
|
10824
|
-
const [currentTime, setCurrentTime] = (0,
|
|
10825
|
-
const [eventHeight, setEventHeight] = (0,
|
|
10826
|
-
const [isMultiDay, setIsMultiDay] = (0,
|
|
10827
|
-
const [multiDayWidth, setMultiDayWidth] = (0,
|
|
10828
|
-
const [dragHandlePosition, setDragHandlePosition] = (0,
|
|
10829
|
-
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 });
|
|
10830
11039
|
const sensors = (0, import_core4.useSensors)(
|
|
10831
11040
|
(0, import_core4.useSensor)(import_core4.MouseSensor, {
|
|
10832
11041
|
// Require the mouse to move by 5px before activating
|
|
@@ -10848,7 +11057,7 @@ function CalendarDndProvider({
|
|
|
10848
11057
|
}
|
|
10849
11058
|
})
|
|
10850
11059
|
);
|
|
10851
|
-
const dndContextId = (0,
|
|
11060
|
+
const dndContextId = (0, import_react67.useId)();
|
|
10852
11061
|
const handleDragStart = (event) => {
|
|
10853
11062
|
const { active } = event;
|
|
10854
11063
|
if (!active.data.current) {
|
|
@@ -11030,7 +11239,7 @@ function CalendarDndProvider({
|
|
|
11030
11239
|
|
|
11031
11240
|
// src/components/ui/event-calendar/DayView.tsx
|
|
11032
11241
|
var import_date_fns15 = require("date-fns");
|
|
11033
|
-
var
|
|
11242
|
+
var import_react68 = require("react");
|
|
11034
11243
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
11035
11244
|
function DayView({
|
|
11036
11245
|
currentDate,
|
|
@@ -11038,14 +11247,14 @@ function DayView({
|
|
|
11038
11247
|
onEventSelect,
|
|
11039
11248
|
onEventCreate
|
|
11040
11249
|
}) {
|
|
11041
|
-
const hours = (0,
|
|
11250
|
+
const hours = (0, import_react68.useMemo)(() => {
|
|
11042
11251
|
const dayStart = (0, import_date_fns15.startOfDay)(currentDate);
|
|
11043
11252
|
return (0, import_date_fns15.eachHourOfInterval)({
|
|
11044
11253
|
end: (0, import_date_fns15.addHours)(dayStart, EndHour - 1),
|
|
11045
11254
|
start: (0, import_date_fns15.addHours)(dayStart, StartHour)
|
|
11046
11255
|
});
|
|
11047
11256
|
}, [currentDate]);
|
|
11048
|
-
const dayEvents = (0,
|
|
11257
|
+
const dayEvents = (0, import_react68.useMemo)(() => {
|
|
11049
11258
|
return events.filter((event) => {
|
|
11050
11259
|
const eventStart = new Date(event.start);
|
|
11051
11260
|
const eventEnd = new Date(event.end);
|
|
@@ -11054,17 +11263,17 @@ function DayView({
|
|
|
11054
11263
|
(a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()
|
|
11055
11264
|
);
|
|
11056
11265
|
}, [currentDate, events]);
|
|
11057
|
-
const allDayEvents = (0,
|
|
11266
|
+
const allDayEvents = (0, import_react68.useMemo)(() => {
|
|
11058
11267
|
return dayEvents.filter((event) => {
|
|
11059
11268
|
return event.allDay || isMultiDayEvent(event);
|
|
11060
11269
|
});
|
|
11061
11270
|
}, [dayEvents]);
|
|
11062
|
-
const timeEvents = (0,
|
|
11271
|
+
const timeEvents = (0, import_react68.useMemo)(() => {
|
|
11063
11272
|
return dayEvents.filter((event) => {
|
|
11064
11273
|
return !event.allDay && !isMultiDayEvent(event);
|
|
11065
11274
|
});
|
|
11066
11275
|
}, [dayEvents]);
|
|
11067
|
-
const positionedEvents = (0,
|
|
11276
|
+
const positionedEvents = (0, import_react68.useMemo)(() => {
|
|
11068
11277
|
const result = [];
|
|
11069
11278
|
const dayStart = (0, import_date_fns15.startOfDay)(currentDate);
|
|
11070
11279
|
const sortedEvents = [...timeEvents].sort((a, b) => {
|
|
@@ -11245,7 +11454,7 @@ function DayView({
|
|
|
11245
11454
|
var import_core5 = require("@dnd-kit/core");
|
|
11246
11455
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
11247
11456
|
var import_date_fns16 = require("date-fns");
|
|
11248
|
-
var
|
|
11457
|
+
var import_react69 = require("react");
|
|
11249
11458
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11250
11459
|
function DraggableEvent2({
|
|
11251
11460
|
event,
|
|
@@ -11260,8 +11469,8 @@ function DraggableEvent2({
|
|
|
11260
11469
|
"aria-hidden": ariaHidden
|
|
11261
11470
|
}) {
|
|
11262
11471
|
const { activeId } = useCalendarDnd();
|
|
11263
|
-
const elementRef = (0,
|
|
11264
|
-
const [dragHandlePosition, setDragHandlePosition] = (0,
|
|
11472
|
+
const elementRef = (0, import_react69.useRef)(null);
|
|
11473
|
+
const [dragHandlePosition, setDragHandlePosition] = (0, import_react69.useState)(null);
|
|
11265
11474
|
const eventStart = new Date(event.start);
|
|
11266
11475
|
const eventEnd = new Date(event.end);
|
|
11267
11476
|
const isMultiDayEvent2 = isMultiDay || event.allDay || (0, import_date_fns16.differenceInDays)(eventEnd, eventStart) >= 1;
|
|
@@ -11386,9 +11595,9 @@ function DroppableCell({
|
|
|
11386
11595
|
// src/components/ui/event-calendar/EventCalendar.tsx
|
|
11387
11596
|
var import_date_fns17 = require("date-fns");
|
|
11388
11597
|
var import_locale9 = require("date-fns/locale");
|
|
11389
|
-
var
|
|
11598
|
+
var import_react70 = require("react");
|
|
11390
11599
|
var import_sonner3 = require("sonner");
|
|
11391
|
-
var
|
|
11600
|
+
var import_react71 = require("@phosphor-icons/react");
|
|
11392
11601
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
11393
11602
|
function EventCalendar({
|
|
11394
11603
|
events = [],
|
|
@@ -11398,11 +11607,11 @@ function EventCalendar({
|
|
|
11398
11607
|
className,
|
|
11399
11608
|
initialView = "month"
|
|
11400
11609
|
}) {
|
|
11401
|
-
const [currentDate, setCurrentDate] = (0,
|
|
11402
|
-
const [view, setView] = (0,
|
|
11403
|
-
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);
|
|
11404
11613
|
const FADE_DURATION = 220;
|
|
11405
|
-
const changeView = (0,
|
|
11614
|
+
const changeView = (0, import_react70.useCallback)(
|
|
11406
11615
|
(next) => {
|
|
11407
11616
|
if (next === view) return;
|
|
11408
11617
|
setIsFading(true);
|
|
@@ -11413,12 +11622,12 @@ function EventCalendar({
|
|
|
11413
11622
|
},
|
|
11414
11623
|
[view]
|
|
11415
11624
|
);
|
|
11416
|
-
const [isPaging, setIsPaging] = (0,
|
|
11417
|
-
const [pageDirection, setPageDirection] = (0,
|
|
11625
|
+
const [isPaging, setIsPaging] = (0, import_react70.useState)(false);
|
|
11626
|
+
const [pageDirection, setPageDirection] = (0, import_react70.useState)(
|
|
11418
11627
|
null
|
|
11419
11628
|
);
|
|
11420
11629
|
const PAGE_DURATION = 200;
|
|
11421
|
-
const pageTransition = (0,
|
|
11630
|
+
const pageTransition = (0, import_react70.useCallback)(
|
|
11422
11631
|
(applyDateChange, direction) => {
|
|
11423
11632
|
setIsPaging(true);
|
|
11424
11633
|
setPageDirection(direction);
|
|
@@ -11432,11 +11641,11 @@ function EventCalendar({
|
|
|
11432
11641
|
},
|
|
11433
11642
|
[]
|
|
11434
11643
|
);
|
|
11435
|
-
const [isEventDialogOpen, setIsEventDialogOpen] = (0,
|
|
11436
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
11644
|
+
const [isEventDialogOpen, setIsEventDialogOpen] = (0, import_react70.useState)(false);
|
|
11645
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react70.useState)(
|
|
11437
11646
|
null
|
|
11438
11647
|
);
|
|
11439
|
-
(0,
|
|
11648
|
+
(0, import_react70.useEffect)(() => {
|
|
11440
11649
|
const handleKeyDown = (e) => {
|
|
11441
11650
|
if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
|
|
11442
11651
|
return;
|
|
@@ -11578,7 +11787,7 @@ function EventCalendar({
|
|
|
11578
11787
|
position: "bottom-left"
|
|
11579
11788
|
});
|
|
11580
11789
|
};
|
|
11581
|
-
const viewTitle = (0,
|
|
11790
|
+
const viewTitle = (0, import_react70.useMemo)(() => {
|
|
11582
11791
|
const capitalize = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
11583
11792
|
if (view === "month") {
|
|
11584
11793
|
return capitalize((0, import_date_fns17.format)(currentDate, "MMMM yyyy", { locale: import_locale9.ptBR }));
|
|
@@ -11637,7 +11846,7 @@ function EventCalendar({
|
|
|
11637
11846
|
variant: "outline",
|
|
11638
11847
|
children: [
|
|
11639
11848
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11640
|
-
|
|
11849
|
+
import_react71.CalendarIcon,
|
|
11641
11850
|
{
|
|
11642
11851
|
"aria-hidden": "true",
|
|
11643
11852
|
className: "min-[480px]:hidden",
|
|
@@ -11656,7 +11865,7 @@ function EventCalendar({
|
|
|
11656
11865
|
onClick: handlePrevious,
|
|
11657
11866
|
size: "icon",
|
|
11658
11867
|
variant: "ghost",
|
|
11659
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11868
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react71.CaretLeft, { "aria-hidden": "true", size: 16 })
|
|
11660
11869
|
}
|
|
11661
11870
|
),
|
|
11662
11871
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
@@ -11666,7 +11875,7 @@ function EventCalendar({
|
|
|
11666
11875
|
onClick: handleNext,
|
|
11667
11876
|
size: "icon",
|
|
11668
11877
|
variant: "ghost",
|
|
11669
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11878
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react71.CaretRight, { "aria-hidden": "true", size: 16 })
|
|
11670
11879
|
}
|
|
11671
11880
|
)
|
|
11672
11881
|
] }),
|
|
@@ -11701,7 +11910,7 @@ function EventCalendar({
|
|
|
11701
11910
|
})() })
|
|
11702
11911
|
] }),
|
|
11703
11912
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11704
|
-
|
|
11913
|
+
import_react71.ArrowDownIcon,
|
|
11705
11914
|
{
|
|
11706
11915
|
"aria-hidden": "true",
|
|
11707
11916
|
className: "-me-1 opacity-60",
|
|
@@ -11741,7 +11950,7 @@ function EventCalendar({
|
|
|
11741
11950
|
size: "sm",
|
|
11742
11951
|
children: [
|
|
11743
11952
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
11744
|
-
|
|
11953
|
+
import_react71.PlusIcon,
|
|
11745
11954
|
{
|
|
11746
11955
|
"aria-hidden": "true",
|
|
11747
11956
|
className: "sm:-ms-1 opacity-60",
|
|
@@ -11833,11 +12042,11 @@ function EventCalendar({
|
|
|
11833
12042
|
|
|
11834
12043
|
// src/components/ui/event-calendar/EventDialog.tsx
|
|
11835
12044
|
var import_date_fns18 = require("date-fns");
|
|
11836
|
-
var
|
|
12045
|
+
var import_react72 = require("react");
|
|
11837
12046
|
var import_react_radio_group = require("@radix-ui/react-radio-group");
|
|
11838
12047
|
var import_framer_motion13 = require("framer-motion");
|
|
11839
12048
|
var import_locale10 = require("date-fns/locale");
|
|
11840
|
-
var
|
|
12049
|
+
var import_react73 = require("@phosphor-icons/react");
|
|
11841
12050
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11842
12051
|
function EventDialog({
|
|
11843
12052
|
event,
|
|
@@ -11846,21 +12055,21 @@ function EventDialog({
|
|
|
11846
12055
|
onSave,
|
|
11847
12056
|
onDelete
|
|
11848
12057
|
}) {
|
|
11849
|
-
const [title, setTitle] = (0,
|
|
11850
|
-
const [description, setDescription] = (0,
|
|
11851
|
-
const [startDate, setStartDate] = (0,
|
|
11852
|
-
const [endDate, setEndDate] = (0,
|
|
11853
|
-
const [startTime, setStartTime] = (0,
|
|
11854
|
-
const [endTime, setEndTime] = (0,
|
|
11855
|
-
const [allDay, setAllDay] = (0,
|
|
11856
|
-
const [location, setLocation] = (0,
|
|
11857
|
-
const [color, setColor] = (0,
|
|
11858
|
-
const [error, setError] = (0,
|
|
11859
|
-
const [startDateOpen, setStartDateOpen] = (0,
|
|
11860
|
-
const [endDateOpen, setEndDateOpen] = (0,
|
|
11861
|
-
(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)(() => {
|
|
11862
12071
|
}, [event]);
|
|
11863
|
-
const resetForm = (0,
|
|
12072
|
+
const resetForm = (0, import_react72.useCallback)(() => {
|
|
11864
12073
|
setTitle("");
|
|
11865
12074
|
setDescription("");
|
|
11866
12075
|
setStartDate(/* @__PURE__ */ new Date());
|
|
@@ -11872,12 +12081,12 @@ function EventDialog({
|
|
|
11872
12081
|
setColor("sky");
|
|
11873
12082
|
setError(null);
|
|
11874
12083
|
}, []);
|
|
11875
|
-
const formatTimeForInput = (0,
|
|
12084
|
+
const formatTimeForInput = (0, import_react72.useCallback)((date) => {
|
|
11876
12085
|
const hours = date.getHours().toString().padStart(2, "0");
|
|
11877
12086
|
const minutes = Math.floor(date.getMinutes() / 15) * 15;
|
|
11878
12087
|
return `${hours}:${minutes.toString().padStart(2, "0")}`;
|
|
11879
12088
|
}, []);
|
|
11880
|
-
(0,
|
|
12089
|
+
(0, import_react72.useEffect)(() => {
|
|
11881
12090
|
if (event) {
|
|
11882
12091
|
setTitle(event.title || "");
|
|
11883
12092
|
setDescription(event.description || "");
|
|
@@ -11895,7 +12104,7 @@ function EventDialog({
|
|
|
11895
12104
|
resetForm();
|
|
11896
12105
|
}
|
|
11897
12106
|
}, [event, formatTimeForInput, resetForm]);
|
|
11898
|
-
const timeOptions = (0,
|
|
12107
|
+
const timeOptions = (0, import_react72.useMemo)(() => {
|
|
11899
12108
|
const options = [];
|
|
11900
12109
|
for (let hour = StartHour; hour <= EndHour; hour++) {
|
|
11901
12110
|
for (let minute = 0; minute < 60; minute += 15) {
|
|
@@ -12084,7 +12293,7 @@ function EventDialog({
|
|
|
12084
12293
|
}
|
|
12085
12294
|
),
|
|
12086
12295
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12087
|
-
|
|
12296
|
+
import_react73.CalendarIcon,
|
|
12088
12297
|
{
|
|
12089
12298
|
"aria-hidden": "true",
|
|
12090
12299
|
className: "shrink-0 text-muted-foreground/80",
|
|
@@ -12163,7 +12372,7 @@ function EventDialog({
|
|
|
12163
12372
|
}
|
|
12164
12373
|
),
|
|
12165
12374
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12166
|
-
|
|
12375
|
+
import_react73.CalendarIcon,
|
|
12167
12376
|
{
|
|
12168
12377
|
"aria-hidden": "true",
|
|
12169
12378
|
className: "shrink-0 text-muted-foreground/80",
|
|
@@ -12221,7 +12430,7 @@ function EventDialog({
|
|
|
12221
12430
|
allDay ? "bg-primary border-transparent text-white" : " border border-input"
|
|
12222
12431
|
),
|
|
12223
12432
|
children: [
|
|
12224
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12433
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react73.CalendarIcon, { size: 14, "aria-hidden": "true" }),
|
|
12225
12434
|
"Dia inteiro"
|
|
12226
12435
|
]
|
|
12227
12436
|
}
|
|
@@ -12280,7 +12489,7 @@ function EventDialog({
|
|
|
12280
12489
|
onClick: handleDelete,
|
|
12281
12490
|
size: "icon",
|
|
12282
12491
|
variant: "outline",
|
|
12283
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react73.TrashIcon, { "aria-hidden": "true", size: 16 })
|
|
12284
12493
|
}
|
|
12285
12494
|
),
|
|
12286
12495
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-1 justify-end gap-2", children: [
|
|
@@ -12295,8 +12504,8 @@ function EventDialog({
|
|
|
12295
12504
|
|
|
12296
12505
|
// src/components/ui/event-calendar/EventItem.tsx
|
|
12297
12506
|
var import_date_fns19 = require("date-fns");
|
|
12298
|
-
var
|
|
12299
|
-
var
|
|
12507
|
+
var import_react74 = require("react");
|
|
12508
|
+
var import_react75 = require("@phosphor-icons/react");
|
|
12300
12509
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
12301
12510
|
var formatTimeWithOptionalMinutes2 = (date) => {
|
|
12302
12511
|
return (0, import_date_fns19.format)(date, "HH:mm");
|
|
@@ -12380,7 +12589,7 @@ function EventItem({
|
|
|
12380
12589
|
const eventColor = event.color;
|
|
12381
12590
|
const hasValidTime = isValidDate3(event.start) && isValidDate3(event.end) || isValidDate3(event.attend_date);
|
|
12382
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";
|
|
12383
|
-
const displayStart = (0,
|
|
12592
|
+
const displayStart = (0, import_react74.useMemo)(() => {
|
|
12384
12593
|
if (!hasValidTime) return void 0;
|
|
12385
12594
|
if (isValidDate3(event.start))
|
|
12386
12595
|
return currentTime || new Date(event.start);
|
|
@@ -12388,7 +12597,7 @@ function EventItem({
|
|
|
12388
12597
|
return currentTime || new Date(event.attend_date);
|
|
12389
12598
|
return void 0;
|
|
12390
12599
|
}, [currentTime, event.start, event.attend_date, hasValidTime]);
|
|
12391
|
-
const displayEnd = (0,
|
|
12600
|
+
const displayEnd = (0, import_react74.useMemo)(() => {
|
|
12392
12601
|
if (!hasValidTime) return void 0;
|
|
12393
12602
|
if (isValidDate3(event.end)) {
|
|
12394
12603
|
return currentTime ? new Date(
|
|
@@ -12401,7 +12610,7 @@ function EventItem({
|
|
|
12401
12610
|
}
|
|
12402
12611
|
return void 0;
|
|
12403
12612
|
}, [currentTime, event.start, event.end, event.attend_date, hasValidTime]);
|
|
12404
|
-
const durationMinutes = (0,
|
|
12613
|
+
const durationMinutes = (0, import_react74.useMemo)(() => {
|
|
12405
12614
|
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
12406
12615
|
return (0, import_date_fns19.differenceInMinutes)(displayEnd, displayStart);
|
|
12407
12616
|
}, [displayStart, displayEnd, hasValidTime]);
|
|
@@ -12576,7 +12785,7 @@ function EventItem({
|
|
|
12576
12785
|
formatTimeWithOptionalMinutes2(displayStart),
|
|
12577
12786
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "opacity-70", children: "-" }),
|
|
12578
12787
|
formatTimeWithOptionalMinutes2(displayEnd),
|
|
12579
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12788
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react75.ClockUserIcon, {})
|
|
12580
12789
|
] })
|
|
12581
12790
|
}
|
|
12582
12791
|
)
|
|
@@ -12604,9 +12813,9 @@ function EventItem({
|
|
|
12604
12813
|
// src/components/ui/event-calendar/EventsPopUp.tsx
|
|
12605
12814
|
var import_date_fns20 = require("date-fns");
|
|
12606
12815
|
var import_locale11 = require("date-fns/locale");
|
|
12607
|
-
var
|
|
12816
|
+
var import_react76 = require("react");
|
|
12608
12817
|
var import_framer_motion14 = require("framer-motion");
|
|
12609
|
-
var
|
|
12818
|
+
var import_react77 = require("@phosphor-icons/react");
|
|
12610
12819
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
12611
12820
|
function EventsPopup({
|
|
12612
12821
|
date,
|
|
@@ -12615,8 +12824,8 @@ function EventsPopup({
|
|
|
12615
12824
|
onClose,
|
|
12616
12825
|
onEventSelect
|
|
12617
12826
|
}) {
|
|
12618
|
-
const popupRef = (0,
|
|
12619
|
-
(0,
|
|
12827
|
+
const popupRef = (0, import_react76.useRef)(null);
|
|
12828
|
+
(0, import_react76.useEffect)(() => {
|
|
12620
12829
|
const handleClickOutside = (event) => {
|
|
12621
12830
|
if (popupRef.current && !popupRef.current.contains(event.target)) {
|
|
12622
12831
|
onClose();
|
|
@@ -12627,7 +12836,7 @@ function EventsPopup({
|
|
|
12627
12836
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
12628
12837
|
};
|
|
12629
12838
|
}, [onClose]);
|
|
12630
|
-
(0,
|
|
12839
|
+
(0, import_react76.useEffect)(() => {
|
|
12631
12840
|
const handleEscKey = (event) => {
|
|
12632
12841
|
if (event.key === "Escape") {
|
|
12633
12842
|
onClose();
|
|
@@ -12642,7 +12851,7 @@ function EventsPopup({
|
|
|
12642
12851
|
if (onEventSelect) onEventSelect(event);
|
|
12643
12852
|
onClose();
|
|
12644
12853
|
};
|
|
12645
|
-
const adjustedPosition = (0,
|
|
12854
|
+
const adjustedPosition = (0, import_react76.useMemo)(() => {
|
|
12646
12855
|
const positionCopy = { ...position };
|
|
12647
12856
|
if (popupRef.current) {
|
|
12648
12857
|
const rect = popupRef.current.getBoundingClientRect();
|
|
@@ -12686,7 +12895,7 @@ function EventsPopup({
|
|
|
12686
12895
|
className: "rounded-full p-1 hover:bg-muted",
|
|
12687
12896
|
onClick: onClose,
|
|
12688
12897
|
type: "button",
|
|
12689
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
12898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react77.XIcon, { className: "h-4 w-4" })
|
|
12690
12899
|
}
|
|
12691
12900
|
)
|
|
12692
12901
|
] }),
|
|
@@ -12723,11 +12932,11 @@ function EventsPopup({
|
|
|
12723
12932
|
// src/components/ui/event-calendar/hooks/use-current-time-indicator.ts
|
|
12724
12933
|
var import_date_fns21 = require("date-fns");
|
|
12725
12934
|
var import_locale12 = require("date-fns/locale");
|
|
12726
|
-
var
|
|
12935
|
+
var import_react78 = require("react");
|
|
12727
12936
|
function useCurrentTimeIndicator(currentDate, view) {
|
|
12728
|
-
const [currentTimePosition, setCurrentTimePosition] = (0,
|
|
12729
|
-
const [currentTimeVisible, setCurrentTimeVisible] = (0,
|
|
12730
|
-
(0,
|
|
12937
|
+
const [currentTimePosition, setCurrentTimePosition] = (0, import_react78.useState)(0);
|
|
12938
|
+
const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react78.useState)(false);
|
|
12939
|
+
(0, import_react78.useEffect)(() => {
|
|
12731
12940
|
const calculateTimePosition = () => {
|
|
12732
12941
|
const now = /* @__PURE__ */ new Date();
|
|
12733
12942
|
const hours = now.getHours();
|
|
@@ -12758,15 +12967,15 @@ function useCurrentTimeIndicator(currentDate, view) {
|
|
|
12758
12967
|
}
|
|
12759
12968
|
|
|
12760
12969
|
// src/components/ui/event-calendar/hooks/use-event-visibility.ts
|
|
12761
|
-
var
|
|
12970
|
+
var import_react79 = require("react");
|
|
12762
12971
|
function useEventVisibility({
|
|
12763
12972
|
eventHeight,
|
|
12764
12973
|
eventGap
|
|
12765
12974
|
}) {
|
|
12766
|
-
const contentRef = (0,
|
|
12767
|
-
const observerRef = (0,
|
|
12768
|
-
const [contentHeight, setContentHeight] = (0,
|
|
12769
|
-
(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)(() => {
|
|
12770
12979
|
if (!contentRef.current) return;
|
|
12771
12980
|
const updateHeight = () => {
|
|
12772
12981
|
if (contentRef.current) {
|
|
@@ -12786,7 +12995,7 @@ function useEventVisibility({
|
|
|
12786
12995
|
}
|
|
12787
12996
|
};
|
|
12788
12997
|
}, []);
|
|
12789
|
-
const getVisibleEventCount = (0,
|
|
12998
|
+
const getVisibleEventCount = (0, import_react79.useMemo)(() => {
|
|
12790
12999
|
return (totalEvents) => {
|
|
12791
13000
|
if (!contentHeight) return totalEvents;
|
|
12792
13001
|
const maxEvents = Math.floor(contentHeight / (eventHeight + eventGap));
|
|
@@ -12806,7 +13015,7 @@ function useEventVisibility({
|
|
|
12806
13015
|
// src/components/ui/event-calendar/MonthView.tsx
|
|
12807
13016
|
var import_date_fns22 = require("date-fns");
|
|
12808
13017
|
var import_locale13 = require("date-fns/locale");
|
|
12809
|
-
var
|
|
13018
|
+
var import_react80 = require("react");
|
|
12810
13019
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
12811
13020
|
function MonthView({
|
|
12812
13021
|
currentDate,
|
|
@@ -12814,21 +13023,21 @@ function MonthView({
|
|
|
12814
13023
|
onEventSelect,
|
|
12815
13024
|
onEventCreate
|
|
12816
13025
|
}) {
|
|
12817
|
-
const days = (0,
|
|
13026
|
+
const days = (0, import_react80.useMemo)(() => {
|
|
12818
13027
|
const monthStart = (0, import_date_fns22.startOfMonth)(currentDate);
|
|
12819
13028
|
const monthEnd = (0, import_date_fns22.endOfMonth)(monthStart);
|
|
12820
13029
|
const calendarStart = (0, import_date_fns22.startOfWeek)(monthStart, { weekStartsOn: 0 });
|
|
12821
13030
|
const calendarEnd = (0, import_date_fns22.endOfWeek)(monthEnd, { weekStartsOn: 0 });
|
|
12822
13031
|
return (0, import_date_fns22.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
|
|
12823
13032
|
}, [currentDate]);
|
|
12824
|
-
const weekdays = (0,
|
|
13033
|
+
const weekdays = (0, import_react80.useMemo)(() => {
|
|
12825
13034
|
return Array.from({ length: 7 }).map((_, i) => {
|
|
12826
13035
|
const date = (0, import_date_fns22.addDays)((0, import_date_fns22.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
|
|
12827
13036
|
const short = (0, import_date_fns22.format)(date, "EEE", { locale: import_locale13.ptBR });
|
|
12828
13037
|
return short.charAt(0).toUpperCase() + short.slice(1);
|
|
12829
13038
|
});
|
|
12830
13039
|
}, []);
|
|
12831
|
-
const weeks = (0,
|
|
13040
|
+
const weeks = (0, import_react80.useMemo)(() => {
|
|
12832
13041
|
const result = [];
|
|
12833
13042
|
let week = [];
|
|
12834
13043
|
for (let i = 0; i < days.length; i++) {
|
|
@@ -12844,12 +13053,12 @@ function MonthView({
|
|
|
12844
13053
|
e.stopPropagation();
|
|
12845
13054
|
onEventSelect(event);
|
|
12846
13055
|
};
|
|
12847
|
-
const [isMounted, setIsMounted] = (0,
|
|
13056
|
+
const [isMounted, setIsMounted] = (0, import_react80.useState)(false);
|
|
12848
13057
|
const { contentRef, getVisibleEventCount } = useEventVisibility({
|
|
12849
13058
|
eventGap: EventGap,
|
|
12850
13059
|
eventHeight: EventHeight
|
|
12851
13060
|
});
|
|
12852
|
-
(0,
|
|
13061
|
+
(0, import_react80.useEffect)(() => {
|
|
12853
13062
|
setIsMounted(true);
|
|
12854
13063
|
}, []);
|
|
12855
13064
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "contents", "data-slot": "month-view", children: [
|
|
@@ -13125,7 +13334,7 @@ function addHoursToDate(date, hours) {
|
|
|
13125
13334
|
// src/components/ui/event-calendar/WeekView.tsx
|
|
13126
13335
|
var import_date_fns25 = require("date-fns");
|
|
13127
13336
|
var import_locale14 = require("date-fns/locale");
|
|
13128
|
-
var
|
|
13337
|
+
var import_react81 = require("react");
|
|
13129
13338
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
13130
13339
|
function WeekView({
|
|
13131
13340
|
currentDate,
|
|
@@ -13133,23 +13342,23 @@ function WeekView({
|
|
|
13133
13342
|
onEventSelect,
|
|
13134
13343
|
onEventCreate
|
|
13135
13344
|
}) {
|
|
13136
|
-
const days = (0,
|
|
13345
|
+
const days = (0, import_react81.useMemo)(() => {
|
|
13137
13346
|
const weekStart2 = (0, import_date_fns25.startOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
13138
13347
|
const weekEnd = (0, import_date_fns25.endOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
13139
13348
|
return (0, import_date_fns25.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
|
|
13140
13349
|
}, [currentDate]);
|
|
13141
|
-
const weekStart = (0,
|
|
13350
|
+
const weekStart = (0, import_react81.useMemo)(
|
|
13142
13351
|
() => (0, import_date_fns25.startOfWeek)(currentDate, { weekStartsOn: 0 }),
|
|
13143
13352
|
[currentDate]
|
|
13144
13353
|
);
|
|
13145
|
-
const hours = (0,
|
|
13354
|
+
const hours = (0, import_react81.useMemo)(() => {
|
|
13146
13355
|
const dayStart = (0, import_date_fns25.startOfDay)(currentDate);
|
|
13147
13356
|
return (0, import_date_fns25.eachHourOfInterval)({
|
|
13148
13357
|
end: (0, import_date_fns25.addHours)(dayStart, EndHour - 1),
|
|
13149
13358
|
start: (0, import_date_fns25.addHours)(dayStart, StartHour)
|
|
13150
13359
|
});
|
|
13151
13360
|
}, [currentDate]);
|
|
13152
|
-
const allDayEvents = (0,
|
|
13361
|
+
const allDayEvents = (0, import_react81.useMemo)(() => {
|
|
13153
13362
|
return events.filter((event) => {
|
|
13154
13363
|
return event.allDay || isMultiDayEvent(event);
|
|
13155
13364
|
}).filter((event) => {
|
|
@@ -13160,7 +13369,7 @@ function WeekView({
|
|
|
13160
13369
|
);
|
|
13161
13370
|
});
|
|
13162
13371
|
}, [events, days]);
|
|
13163
|
-
const processedDayEvents = (0,
|
|
13372
|
+
const processedDayEvents = (0, import_react81.useMemo)(() => {
|
|
13164
13373
|
const result = days.map((day) => {
|
|
13165
13374
|
const dayEvents = events.filter((event) => {
|
|
13166
13375
|
if (event.allDay || isMultiDayEvent(event)) return false;
|
|
@@ -13406,8 +13615,8 @@ function WeekView({
|
|
|
13406
13615
|
}
|
|
13407
13616
|
|
|
13408
13617
|
// src/components/ui/selects/AvatarCombobox.tsx
|
|
13409
|
-
var
|
|
13410
|
-
var
|
|
13618
|
+
var import_react82 = require("react");
|
|
13619
|
+
var import_react83 = require("@phosphor-icons/react");
|
|
13411
13620
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
13412
13621
|
var DEFAULT_COLORS = [
|
|
13413
13622
|
"bg-purple-100 text-purple-700",
|
|
@@ -13451,8 +13660,8 @@ function AvatarCombobox({
|
|
|
13451
13660
|
className,
|
|
13452
13661
|
colors: colors2
|
|
13453
13662
|
}) {
|
|
13454
|
-
const [open, setOpen] = (0,
|
|
13455
|
-
const id = (0,
|
|
13663
|
+
const [open, setOpen] = (0, import_react82.useState)(false);
|
|
13664
|
+
const id = (0, import_react82.useId)();
|
|
13456
13665
|
const allItems = items || (groupItems ? Object.values(groupItems).flat() : []);
|
|
13457
13666
|
const selectedItem = allItems.find((item) => item.value === selected);
|
|
13458
13667
|
const renderItem = (item) => {
|
|
@@ -13489,7 +13698,7 @@ function AvatarCombobox({
|
|
|
13489
13698
|
"data-testid": testIds.trigger ?? "avatar-select-trigger",
|
|
13490
13699
|
children: [
|
|
13491
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 }),
|
|
13492
|
-
/* @__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" })
|
|
13493
13702
|
]
|
|
13494
13703
|
}
|
|
13495
13704
|
) }),
|
|
@@ -13515,7 +13724,7 @@ function AvatarCombobox({
|
|
|
13515
13724
|
children: [
|
|
13516
13725
|
renderItem(item),
|
|
13517
13726
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13518
|
-
|
|
13727
|
+
import_react83.CheckIcon,
|
|
13519
13728
|
{
|
|
13520
13729
|
className: cn(
|
|
13521
13730
|
"ml-auto h-4 w-4",
|
|
@@ -13538,7 +13747,7 @@ function AvatarCombobox({
|
|
|
13538
13747
|
children: [
|
|
13539
13748
|
renderItem(item),
|
|
13540
13749
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13541
|
-
|
|
13750
|
+
import_react83.CheckIcon,
|
|
13542
13751
|
{
|
|
13543
13752
|
className: cn(
|
|
13544
13753
|
"ml-auto h-4 w-4",
|
|
@@ -13560,11 +13769,11 @@ function AvatarCombobox({
|
|
|
13560
13769
|
}
|
|
13561
13770
|
|
|
13562
13771
|
// src/components/ui/selects/MultiSelectBase.tsx
|
|
13563
|
-
var
|
|
13564
|
-
var
|
|
13772
|
+
var import_react84 = require("@phosphor-icons/react");
|
|
13773
|
+
var import_react85 = require("react");
|
|
13565
13774
|
var import_framer_motion15 = require("framer-motion");
|
|
13566
13775
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
13567
|
-
var MultiSelectContext = (0,
|
|
13776
|
+
var MultiSelectContext = (0, import_react85.createContext)(null);
|
|
13568
13777
|
function MultiSelectBase({
|
|
13569
13778
|
children,
|
|
13570
13779
|
values,
|
|
@@ -13574,12 +13783,12 @@ function MultiSelectBase({
|
|
|
13574
13783
|
empty,
|
|
13575
13784
|
error
|
|
13576
13785
|
}) {
|
|
13577
|
-
const [open, setOpen] = (0,
|
|
13578
|
-
const [internalValues, setInternalValues] = (0,
|
|
13786
|
+
const [open, setOpen] = (0, import_react85.useState)(false);
|
|
13787
|
+
const [internalValues, setInternalValues] = (0, import_react85.useState)(
|
|
13579
13788
|
new Set(values ?? defaultValues)
|
|
13580
13789
|
);
|
|
13581
13790
|
const selectedValues = values ? new Set(values) : internalValues;
|
|
13582
|
-
const [items, setItems] = (0,
|
|
13791
|
+
const [items, setItems] = (0, import_react85.useState)(/* @__PURE__ */ new Map());
|
|
13583
13792
|
function toggleValue(value) {
|
|
13584
13793
|
if (disabled) return;
|
|
13585
13794
|
const getNewSet = (prev) => {
|
|
@@ -13594,7 +13803,7 @@ function MultiSelectBase({
|
|
|
13594
13803
|
setInternalValues(getNewSet);
|
|
13595
13804
|
onValuesChange?.([...getNewSet(selectedValues)]);
|
|
13596
13805
|
}
|
|
13597
|
-
const onItemAdded = (0,
|
|
13806
|
+
const onItemAdded = (0, import_react85.useCallback)((value, label) => {
|
|
13598
13807
|
setItems((prev) => {
|
|
13599
13808
|
if (prev.get(value) === label) return prev;
|
|
13600
13809
|
return new Map(prev).set(value, label);
|
|
@@ -13651,7 +13860,7 @@ function MultiSelectTriggerBase({
|
|
|
13651
13860
|
),
|
|
13652
13861
|
children: [
|
|
13653
13862
|
children,
|
|
13654
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13863
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react84.CaretUpDownIcon, { className: "size-4 shrink-0 opacity-50" })
|
|
13655
13864
|
]
|
|
13656
13865
|
}
|
|
13657
13866
|
) }),
|
|
@@ -13666,13 +13875,13 @@ function MultiSelectValueBase({
|
|
|
13666
13875
|
...props
|
|
13667
13876
|
}) {
|
|
13668
13877
|
const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
|
|
13669
|
-
const [overflowAmount, setOverflowAmount] = (0,
|
|
13670
|
-
const valueRef = (0,
|
|
13671
|
-
const overflowRef = (0,
|
|
13672
|
-
const mutationObserverRef = (0,
|
|
13673
|
-
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);
|
|
13674
13883
|
const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
|
|
13675
|
-
const checkOverflow = (0,
|
|
13884
|
+
const checkOverflow = (0, import_react85.useCallback)(() => {
|
|
13676
13885
|
if (valueRef.current == null) return;
|
|
13677
13886
|
const containerElement = valueRef.current;
|
|
13678
13887
|
const overflowElement = overflowRef.current;
|
|
@@ -13693,7 +13902,7 @@ function MultiSelectValueBase({
|
|
|
13693
13902
|
}
|
|
13694
13903
|
setOverflowAmount(amount);
|
|
13695
13904
|
}, []);
|
|
13696
|
-
const handleResize = (0,
|
|
13905
|
+
const handleResize = (0, import_react85.useCallback)(
|
|
13697
13906
|
(node) => {
|
|
13698
13907
|
if (node == null) {
|
|
13699
13908
|
valueRef.current = null;
|
|
@@ -13759,7 +13968,7 @@ function MultiSelectValueBase({
|
|
|
13759
13968
|
} : void 0,
|
|
13760
13969
|
children: [
|
|
13761
13970
|
items.get(value),
|
|
13762
|
-
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" })
|
|
13763
13972
|
]
|
|
13764
13973
|
},
|
|
13765
13974
|
value
|
|
@@ -13819,7 +14028,7 @@ function MultiSelectItemBase({
|
|
|
13819
14028
|
}) {
|
|
13820
14029
|
const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
|
|
13821
14030
|
const isSelected = selectedValues.has(value);
|
|
13822
|
-
(0,
|
|
14031
|
+
(0, import_react85.useEffect)(() => {
|
|
13823
14032
|
onItemAdded(value, badgeLabel ?? children);
|
|
13824
14033
|
}, [value, children, onItemAdded, badgeLabel]);
|
|
13825
14034
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
@@ -13841,7 +14050,7 @@ function MultiSelectItemBase({
|
|
|
13841
14050
|
initial: { scale: 0 },
|
|
13842
14051
|
animate: { scale: isSelected ? 1 : 0 },
|
|
13843
14052
|
transition: { type: "spring", stiffness: 500, damping: 30 },
|
|
13844
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
14053
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react84.CheckIcon, { className: "size-4" })
|
|
13845
14054
|
}
|
|
13846
14055
|
) }),
|
|
13847
14056
|
children
|
|
@@ -13858,7 +14067,7 @@ function MultiSelectSeparatorBase(props) {
|
|
|
13858
14067
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandSeparatorBase, { ...props });
|
|
13859
14068
|
}
|
|
13860
14069
|
function useMultiSelectContext() {
|
|
13861
|
-
const context = (0,
|
|
14070
|
+
const context = (0, import_react85.useContext)(MultiSelectContext);
|
|
13862
14071
|
if (context == null) {
|
|
13863
14072
|
throw new Error(
|
|
13864
14073
|
"useMultiSelectContext must be used within a MultiSelectContext"
|
|
@@ -13875,7 +14084,7 @@ function debounce(func, wait) {
|
|
|
13875
14084
|
}
|
|
13876
14085
|
|
|
13877
14086
|
// src/components/ui/charts/Chart.tsx
|
|
13878
|
-
var
|
|
14087
|
+
var import_react90 = require("react");
|
|
13879
14088
|
var import_recharts = require("recharts");
|
|
13880
14089
|
|
|
13881
14090
|
// src/components/ui/charts/utils/helpers.ts
|
|
@@ -14022,7 +14231,7 @@ var resolveChartMargins = (margins, chartMargins, showLabels) => {
|
|
|
14022
14231
|
var import_sonner4 = require("sonner");
|
|
14023
14232
|
|
|
14024
14233
|
// src/components/ui/charts/components/controls/PeriodsDropdown.tsx
|
|
14025
|
-
var
|
|
14234
|
+
var import_react86 = require("react");
|
|
14026
14235
|
var import_framer_motion16 = require("framer-motion");
|
|
14027
14236
|
var import_ssr4 = require("@phosphor-icons/react/dist/ssr");
|
|
14028
14237
|
var import_ssr5 = require("@phosphor-icons/react/dist/ssr");
|
|
@@ -14045,11 +14254,11 @@ function PeriodsDropdown({
|
|
|
14045
14254
|
activePeriods
|
|
14046
14255
|
}) {
|
|
14047
14256
|
const periods = processedData.map((d) => String(d.name));
|
|
14048
|
-
const [open, setOpen] = (0,
|
|
14049
|
-
const wrapperRef = (0,
|
|
14050
|
-
const firstItemRef = (0,
|
|
14051
|
-
const listRef = (0,
|
|
14052
|
-
(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)(() => {
|
|
14053
14262
|
const handleClickOutside = (e) => {
|
|
14054
14263
|
if (!wrapperRef.current) return;
|
|
14055
14264
|
if (!wrapperRef.current.contains(e.target)) setOpen(false);
|
|
@@ -14064,7 +14273,7 @@ function PeriodsDropdown({
|
|
|
14064
14273
|
document.removeEventListener("keydown", handleEscape);
|
|
14065
14274
|
};
|
|
14066
14275
|
}, []);
|
|
14067
|
-
(0,
|
|
14276
|
+
(0, import_react86.useEffect)(() => {
|
|
14068
14277
|
if (open && firstItemRef.current) {
|
|
14069
14278
|
firstItemRef.current.focus();
|
|
14070
14279
|
}
|
|
@@ -14157,7 +14366,7 @@ var PeriodsDropdown_default = PeriodsDropdown;
|
|
|
14157
14366
|
|
|
14158
14367
|
// src/components/ui/charts/components/controls/ShowOnly.tsx
|
|
14159
14368
|
var import_framer_motion17 = require("framer-motion");
|
|
14160
|
-
var
|
|
14369
|
+
var import_react87 = require("@phosphor-icons/react");
|
|
14161
14370
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
14162
14371
|
var ShowOnly = ({
|
|
14163
14372
|
showOnlyHighlighted,
|
|
@@ -14186,10 +14395,10 @@ var ShowOnly = ({
|
|
|
14186
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"
|
|
14187
14396
|
),
|
|
14188
14397
|
children: showOnlyHighlighted ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
14189
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
14398
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react87.EyeSlash, { size: 16, weight: "regular" }),
|
|
14190
14399
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "sr-only", children: "Exibir todos" })
|
|
14191
14400
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
14192
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
14401
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react87.Eye, { size: 16, weight: "bold" }),
|
|
14193
14402
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "sr-only", children: "Mostrar somente destacados" })
|
|
14194
14403
|
] })
|
|
14195
14404
|
}
|
|
@@ -14407,9 +14616,9 @@ var CloseAllButton = ({
|
|
|
14407
14616
|
var CloseAllButton_default = CloseAllButton;
|
|
14408
14617
|
|
|
14409
14618
|
// src/components/ui/charts/components/tooltips/DraggableTooltip.tsx
|
|
14410
|
-
var
|
|
14619
|
+
var import_react88 = __toESM(require("react"));
|
|
14411
14620
|
var import_framer_motion19 = require("framer-motion");
|
|
14412
|
-
var
|
|
14621
|
+
var import_react89 = require("@phosphor-icons/react");
|
|
14413
14622
|
var import_ssr8 = require("@phosphor-icons/react/dist/ssr");
|
|
14414
14623
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
14415
14624
|
var ALIGNMENT_THRESHOLD = 25;
|
|
@@ -14488,12 +14697,12 @@ var DraggableTooltipComponent = ({
|
|
|
14488
14697
|
valueFormatter: valueFormatter2,
|
|
14489
14698
|
categoryFormatter
|
|
14490
14699
|
}) => {
|
|
14491
|
-
const visibleKeys = (0,
|
|
14700
|
+
const visibleKeys = (0, import_react88.useMemo)(
|
|
14492
14701
|
() => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
|
|
14493
14702
|
[showOnlyHighlighted, highlightedSeries, dataKeys]
|
|
14494
14703
|
);
|
|
14495
|
-
const TotalDisplay =
|
|
14496
|
-
const total = (0,
|
|
14704
|
+
const TotalDisplay = import_react88.default.memo(({ data: data2, visibleKeys: visibleKeys2, valueFormatter: localformatter }) => {
|
|
14705
|
+
const total = (0, import_react88.useMemo)(() => {
|
|
14497
14706
|
const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
|
|
14498
14707
|
return numeric.reduce((s, v) => s + (v || 0), 0);
|
|
14499
14708
|
}, [data2, visibleKeys2]);
|
|
@@ -14515,14 +14724,14 @@ var DraggableTooltipComponent = ({
|
|
|
14515
14724
|
)
|
|
14516
14725
|
] });
|
|
14517
14726
|
});
|
|
14518
|
-
const [localPos, setLocalPos] = (0,
|
|
14519
|
-
const [dragging, setDragging] = (0,
|
|
14520
|
-
const offsetRef = (0,
|
|
14521
|
-
const lastMouse = (0,
|
|
14522
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
14523
|
-
const [globalTooltipCountLocal, setGlobalTooltipCountLocal] = (0,
|
|
14524
|
-
(0,
|
|
14525
|
-
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)(() => {
|
|
14526
14735
|
const response = [];
|
|
14527
14736
|
const ev = new CustomEvent("requestGlobalTooltips", {
|
|
14528
14737
|
detail: { requesterId: id, response }
|
|
@@ -14530,7 +14739,7 @@ var DraggableTooltipComponent = ({
|
|
|
14530
14739
|
window.dispatchEvent(ev);
|
|
14531
14740
|
return response;
|
|
14532
14741
|
}, [id]);
|
|
14533
|
-
const updateAlignmentGuides = (0,
|
|
14742
|
+
const updateAlignmentGuides = (0, import_react88.useCallback)(
|
|
14534
14743
|
(currentPosition) => {
|
|
14535
14744
|
const allTooltips = getAllTooltips();
|
|
14536
14745
|
const otherTooltips = allTooltips.filter((t) => t.id !== id);
|
|
@@ -14579,7 +14788,7 @@ var DraggableTooltipComponent = ({
|
|
|
14579
14788
|
},
|
|
14580
14789
|
[getAllTooltips, id]
|
|
14581
14790
|
);
|
|
14582
|
-
const snapToGuides = (0,
|
|
14791
|
+
const snapToGuides = (0, import_react88.useCallback)(
|
|
14583
14792
|
(position2) => {
|
|
14584
14793
|
const snappedPosition = { ...position2 };
|
|
14585
14794
|
let hasSnapped = false;
|
|
@@ -14626,7 +14835,7 @@ var DraggableTooltipComponent = ({
|
|
|
14626
14835
|
},
|
|
14627
14836
|
[alignmentGuides]
|
|
14628
14837
|
);
|
|
14629
|
-
(0,
|
|
14838
|
+
(0, import_react88.useEffect)(() => {
|
|
14630
14839
|
let rafId = null;
|
|
14631
14840
|
const handleMouseMove = (e) => {
|
|
14632
14841
|
if (!dragging) return;
|
|
@@ -14668,7 +14877,7 @@ var DraggableTooltipComponent = ({
|
|
|
14668
14877
|
document.body.style.userSelect = "";
|
|
14669
14878
|
};
|
|
14670
14879
|
}, [dragging, snapToGuides, updateAlignmentGuides, id, onPositionChange]);
|
|
14671
|
-
(0,
|
|
14880
|
+
(0, import_react88.useEffect)(() => {
|
|
14672
14881
|
const handleCloseAll = () => onClose(id);
|
|
14673
14882
|
const handleRequestTooltipCount = () => {
|
|
14674
14883
|
window.dispatchEvent(
|
|
@@ -14699,7 +14908,7 @@ var DraggableTooltipComponent = ({
|
|
|
14699
14908
|
});
|
|
14700
14909
|
};
|
|
14701
14910
|
}, [id, localPos, onClose]);
|
|
14702
|
-
(0,
|
|
14911
|
+
(0, import_react88.useEffect)(() => {
|
|
14703
14912
|
if (dragging) return;
|
|
14704
14913
|
let total = 0;
|
|
14705
14914
|
const timeoutId = setTimeout(() => {
|
|
@@ -14717,7 +14926,7 @@ var DraggableTooltipComponent = ({
|
|
|
14717
14926
|
}, 0);
|
|
14718
14927
|
return () => clearTimeout(timeoutId);
|
|
14719
14928
|
}, [localPos, dragging]);
|
|
14720
|
-
(0,
|
|
14929
|
+
(0, import_react88.useEffect)(() => {
|
|
14721
14930
|
const recount = () => {
|
|
14722
14931
|
if (dragging) return;
|
|
14723
14932
|
let total = 0;
|
|
@@ -14735,7 +14944,7 @@ var DraggableTooltipComponent = ({
|
|
|
14735
14944
|
window.addEventListener("recountTooltips", recount);
|
|
14736
14945
|
return () => window.removeEventListener("recountTooltips", recount);
|
|
14737
14946
|
}, [dragging]);
|
|
14738
|
-
const handleMouseDownLocal = (0,
|
|
14947
|
+
const handleMouseDownLocal = (0, import_react88.useCallback)(
|
|
14739
14948
|
(e) => {
|
|
14740
14949
|
e.preventDefault();
|
|
14741
14950
|
e.stopPropagation();
|
|
@@ -14746,7 +14955,7 @@ var DraggableTooltipComponent = ({
|
|
|
14746
14955
|
},
|
|
14747
14956
|
[id, onMouseDown]
|
|
14748
14957
|
);
|
|
14749
|
-
const handleTouchStartLocal = (0,
|
|
14958
|
+
const handleTouchStartLocal = (0, import_react88.useCallback)(
|
|
14750
14959
|
(e) => {
|
|
14751
14960
|
e.stopPropagation();
|
|
14752
14961
|
const touch = e.touches[0];
|
|
@@ -14761,7 +14970,7 @@ var DraggableTooltipComponent = ({
|
|
|
14761
14970
|
},
|
|
14762
14971
|
[id, onMouseDown]
|
|
14763
14972
|
);
|
|
14764
|
-
const handleCloseClick = (0,
|
|
14973
|
+
const handleCloseClick = (0, import_react88.useCallback)(
|
|
14765
14974
|
(e) => {
|
|
14766
14975
|
e.stopPropagation();
|
|
14767
14976
|
onClose(id);
|
|
@@ -14877,7 +15086,7 @@ var DraggableTooltipComponent = ({
|
|
|
14877
15086
|
onTouchStart: handleTouchStartLocal,
|
|
14878
15087
|
style: { touchAction: "none" },
|
|
14879
15088
|
children: [
|
|
14880
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15089
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react89.DotsSixVerticalIcon, { size: 16 }),
|
|
14881
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 }) }) }),
|
|
14882
15091
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14883
15092
|
"button",
|
|
@@ -14907,7 +15116,7 @@ var DraggableTooltipComponent = ({
|
|
|
14907
15116
|
] }) }),
|
|
14908
15117
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "p-3 pt-2 space-y-2", children: [
|
|
14909
15118
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2", children: dataLabel }),
|
|
14910
|
-
(0,
|
|
15119
|
+
(0, import_react88.useMemo)(
|
|
14911
15120
|
() => visibleKeys.map((key) => {
|
|
14912
15121
|
const value = data[key];
|
|
14913
15122
|
if (value === void 0) return null;
|
|
@@ -15025,7 +15234,7 @@ var DraggableTooltipComponent = ({
|
|
|
15025
15234
|
)
|
|
15026
15235
|
] });
|
|
15027
15236
|
};
|
|
15028
|
-
var DraggableTooltip =
|
|
15237
|
+
var DraggableTooltip = import_react88.default.memo(DraggableTooltipComponent);
|
|
15029
15238
|
DraggableTooltip.displayName = "DraggableTooltip";
|
|
15030
15239
|
var DraggableTooltip_default = DraggableTooltip;
|
|
15031
15240
|
|
|
@@ -15482,17 +15691,19 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
|
|
|
15482
15691
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
15483
15692
|
var NoData = ({
|
|
15484
15693
|
paddingLeft = 0,
|
|
15485
|
-
height =
|
|
15694
|
+
height = 400,
|
|
15486
15695
|
message = "Sem dados para exibir",
|
|
15487
|
-
className
|
|
15696
|
+
className,
|
|
15697
|
+
title
|
|
15488
15698
|
}) => {
|
|
15489
|
-
const svgHeight = typeof height === "number" ? height :
|
|
15699
|
+
const svgHeight = typeof height === "number" ? height : 400;
|
|
15490
15700
|
const bars = [
|
|
15491
|
-
{ x:
|
|
15492
|
-
{ x:
|
|
15493
|
-
{ x:
|
|
15494
|
-
{ x:
|
|
15495
|
-
{ 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 }
|
|
15496
15707
|
];
|
|
15497
15708
|
const styleVars = {
|
|
15498
15709
|
["--pl"]: `${paddingLeft}px`,
|
|
@@ -15502,27 +15713,59 @@ var NoData = ({
|
|
|
15502
15713
|
"div",
|
|
15503
15714
|
{
|
|
15504
15715
|
className: cn(
|
|
15505
|
-
"rounded-
|
|
15716
|
+
"rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm",
|
|
15506
15717
|
className
|
|
15507
15718
|
),
|
|
15508
15719
|
style: styleVars,
|
|
15509
15720
|
role: "img",
|
|
15510
15721
|
"aria-label": message,
|
|
15511
|
-
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: [
|
|
15512
15723
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
15513
15724
|
"svg",
|
|
15514
15725
|
{
|
|
15515
|
-
className: "w-full h-[var(--svg-h)]",
|
|
15726
|
+
className: "w-full h-[var(--svg-h)] opacity-40",
|
|
15516
15727
|
width: "100%",
|
|
15517
15728
|
viewBox: `0 0 900 ${svgHeight}`,
|
|
15518
15729
|
preserveAspectRatio: "none",
|
|
15519
15730
|
children: [
|
|
15520
15731
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("defs", { children: [
|
|
15521
15732
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("linearGradient", { id: "barGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
15522
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15523
|
-
|
|
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
|
+
)
|
|
15524
15749
|
] }),
|
|
15525
|
-
/* @__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)(
|
|
15526
15769
|
"filter",
|
|
15527
15770
|
{
|
|
15528
15771
|
id: "softShadow",
|
|
@@ -15530,16 +15773,15 @@ var NoData = ({
|
|
|
15530
15773
|
y: "-20%",
|
|
15531
15774
|
width: "140%",
|
|
15532
15775
|
height: "140%",
|
|
15533
|
-
children:
|
|
15534
|
-
"
|
|
15535
|
-
{
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
)
|
|
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
|
+
]
|
|
15543
15785
|
}
|
|
15544
15786
|
)
|
|
15545
15787
|
] }),
|
|
@@ -15550,66 +15792,97 @@ var NoData = ({
|
|
|
15550
15792
|
y: 0,
|
|
15551
15793
|
width: 900,
|
|
15552
15794
|
height: svgHeight,
|
|
15553
|
-
fill: "
|
|
15795
|
+
fill: "hsl(var(--muted)/0.2)",
|
|
15796
|
+
rx: 8
|
|
15554
15797
|
}
|
|
15555
15798
|
),
|
|
15556
|
-
Array.from({ length:
|
|
15557
|
-
const y = 40 + (svgHeight - 80) /
|
|
15799
|
+
Array.from({ length: 6 }).map((_, i) => {
|
|
15800
|
+
const y = 40 + (svgHeight - 80) / 5 * i;
|
|
15558
15801
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15559
15802
|
"line",
|
|
15560
15803
|
{
|
|
15561
|
-
x1:
|
|
15562
|
-
x2:
|
|
15804
|
+
x1: 50,
|
|
15805
|
+
x2: 850,
|
|
15563
15806
|
y1: y,
|
|
15564
15807
|
y2: y,
|
|
15565
|
-
stroke: "
|
|
15566
|
-
strokeWidth: 1
|
|
15808
|
+
stroke: "url(#gridGradient)",
|
|
15809
|
+
strokeWidth: 1.5,
|
|
15810
|
+
strokeDasharray: "4 4"
|
|
15567
15811
|
},
|
|
15568
15812
|
`g-${i}`
|
|
15569
15813
|
);
|
|
15570
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
|
+
),
|
|
15571
15839
|
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("g", { children: [
|
|
15572
15840
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15573
15841
|
"rect",
|
|
15574
15842
|
{
|
|
15575
15843
|
x: b.x,
|
|
15576
|
-
y: svgHeight -
|
|
15844
|
+
y: svgHeight - 40 - b.h,
|
|
15577
15845
|
width: b.w,
|
|
15578
15846
|
height: b.h,
|
|
15579
|
-
rx:
|
|
15847
|
+
rx: 4,
|
|
15580
15848
|
fill: "url(#barGradient)",
|
|
15581
|
-
filter: "url(#softShadow)"
|
|
15582
|
-
opacity: 0.95
|
|
15849
|
+
filter: "url(#softShadow)"
|
|
15583
15850
|
}
|
|
15584
15851
|
),
|
|
15585
15852
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15586
15853
|
"rect",
|
|
15587
15854
|
{
|
|
15588
15855
|
x: b.x,
|
|
15589
|
-
y: svgHeight -
|
|
15856
|
+
y: svgHeight - 40 - b.h,
|
|
15590
15857
|
width: b.w,
|
|
15591
15858
|
height: b.h,
|
|
15592
|
-
rx:
|
|
15859
|
+
rx: 4,
|
|
15593
15860
|
fill: "none",
|
|
15594
|
-
stroke: "
|
|
15861
|
+
stroke: "hsl(var(--foreground))",
|
|
15862
|
+
strokeWidth: 1,
|
|
15863
|
+
opacity: 0.3
|
|
15595
15864
|
}
|
|
15596
15865
|
),
|
|
15597
15866
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
15598
|
-
"
|
|
15867
|
+
"line",
|
|
15599
15868
|
{
|
|
15600
|
-
|
|
15601
|
-
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
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
|
|
15606
15876
|
}
|
|
15607
15877
|
)
|
|
15608
15878
|
] }, `barg-${i}`))
|
|
15609
15879
|
]
|
|
15610
15880
|
}
|
|
15611
15881
|
),
|
|
15612
|
-
/* @__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
|
+
] }) })
|
|
15613
15886
|
] }) })
|
|
15614
15887
|
}
|
|
15615
15888
|
);
|
|
@@ -15650,7 +15923,7 @@ var Chart = ({
|
|
|
15650
15923
|
formatBR = false,
|
|
15651
15924
|
chartMargin
|
|
15652
15925
|
}) => {
|
|
15653
|
-
const smartConfig = (0,
|
|
15926
|
+
const smartConfig = (0, import_react90.useMemo)(() => {
|
|
15654
15927
|
const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
|
|
15655
15928
|
const xAxisConfig2 = typeof xAxis === "string" ? {
|
|
15656
15929
|
dataKey: resolvedXAxisKey,
|
|
@@ -15674,12 +15947,12 @@ var Chart = ({
|
|
|
15674
15947
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
15675
15948
|
}, [data, xAxis, labelMap]);
|
|
15676
15949
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
15677
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
15678
|
-
const [highlightedSeries, setHighlightedSeries] = (0,
|
|
15950
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react90.useState)([]);
|
|
15951
|
+
const [highlightedSeries, setHighlightedSeries] = (0, import_react90.useState)(
|
|
15679
15952
|
/* @__PURE__ */ new Set()
|
|
15680
15953
|
);
|
|
15681
|
-
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0,
|
|
15682
|
-
(0,
|
|
15954
|
+
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react90.useState)(false);
|
|
15955
|
+
(0, import_react90.useEffect)(() => {
|
|
15683
15956
|
if (highlightedSeries.size === 0 && showOnlyHighlighted) {
|
|
15684
15957
|
setShowOnlyHighlighted(false);
|
|
15685
15958
|
}
|
|
@@ -15688,9 +15961,9 @@ var Chart = ({
|
|
|
15688
15961
|
...item,
|
|
15689
15962
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
15690
15963
|
}));
|
|
15691
|
-
const wrapperRef = (0,
|
|
15692
|
-
const [measuredWidth, setMeasuredWidth] = (0,
|
|
15693
|
-
(0,
|
|
15964
|
+
const wrapperRef = (0, import_react90.useRef)(null);
|
|
15965
|
+
const [measuredWidth, setMeasuredWidth] = (0, import_react90.useState)(null);
|
|
15966
|
+
(0, import_react90.useLayoutEffect)(() => {
|
|
15694
15967
|
const el = wrapperRef.current;
|
|
15695
15968
|
if (!el) return;
|
|
15696
15969
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -15717,7 +15990,7 @@ var Chart = ({
|
|
|
15717
15990
|
);
|
|
15718
15991
|
}
|
|
15719
15992
|
const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
|
|
15720
|
-
const generateColors = (0,
|
|
15993
|
+
const generateColors = (0, import_react90.useCallback)(
|
|
15721
15994
|
(dataKeys) => {
|
|
15722
15995
|
const colorMap = {};
|
|
15723
15996
|
const allColors = generateAdditionalColors(colors2, dataKeys.length);
|
|
@@ -15728,17 +16001,17 @@ var Chart = ({
|
|
|
15728
16001
|
},
|
|
15729
16002
|
[colors2, mapperConfig]
|
|
15730
16003
|
);
|
|
15731
|
-
const finalColors = (0,
|
|
16004
|
+
const finalColors = (0, import_react90.useMemo)(
|
|
15732
16005
|
() => generateColors(allKeys),
|
|
15733
16006
|
[generateColors, allKeys]
|
|
15734
16007
|
);
|
|
15735
|
-
const biaxialConfigNormalized = (0,
|
|
16008
|
+
const biaxialConfigNormalized = (0, import_react90.useMemo)(() => {
|
|
15736
16009
|
if (!biaxial) return null;
|
|
15737
16010
|
if (typeof biaxial === "string") return { key: [biaxial] };
|
|
15738
16011
|
if (Array.isArray(biaxial)) return { key: biaxial };
|
|
15739
16012
|
return biaxial;
|
|
15740
16013
|
}, [biaxial]);
|
|
15741
|
-
(0,
|
|
16014
|
+
(0, import_react90.useMemo)(() => {
|
|
15742
16015
|
if (!biaxialConfigNormalized) return;
|
|
15743
16016
|
const leftLabelMissing = !yAxisLabel || String(yAxisLabel).trim() === "";
|
|
15744
16017
|
const rightLabelMissing = !biaxialConfigNormalized.label || String(biaxialConfigNormalized.label).trim() === "";
|
|
@@ -15748,29 +16021,29 @@ var Chart = ({
|
|
|
15748
16021
|
);
|
|
15749
16022
|
}
|
|
15750
16023
|
}, [biaxialConfigNormalized, yAxisLabel]);
|
|
15751
|
-
const rightKeys = (0,
|
|
16024
|
+
const rightKeys = (0, import_react90.useMemo)(
|
|
15752
16025
|
() => biaxialConfigNormalized?.key ?? [],
|
|
15753
16026
|
[biaxialConfigNormalized]
|
|
15754
16027
|
);
|
|
15755
|
-
const leftKeys = (0,
|
|
16028
|
+
const leftKeys = (0, import_react90.useMemo)(
|
|
15756
16029
|
() => allKeys.filter((k) => !rightKeys.includes(k)),
|
|
15757
16030
|
[allKeys, rightKeys]
|
|
15758
16031
|
);
|
|
15759
|
-
const adaptDataForTooltip = (0,
|
|
16032
|
+
const adaptDataForTooltip = (0, import_react90.useCallback)(
|
|
15760
16033
|
(universalData) => ({
|
|
15761
16034
|
...universalData,
|
|
15762
16035
|
name: String(universalData[xAxisConfig.dataKey] || "N/A")
|
|
15763
16036
|
}),
|
|
15764
16037
|
[xAxisConfig.dataKey]
|
|
15765
16038
|
);
|
|
15766
|
-
const activePeriods = (0,
|
|
16039
|
+
const activePeriods = (0, import_react90.useMemo)(
|
|
15767
16040
|
() => activeTooltips.map((t) => adaptDataForTooltip(t.data).name),
|
|
15768
16041
|
[activeTooltips, adaptDataForTooltip]
|
|
15769
16042
|
);
|
|
15770
|
-
(0,
|
|
16043
|
+
(0, import_react90.useEffect)(() => {
|
|
15771
16044
|
window.dispatchEvent(new Event("recountTooltips"));
|
|
15772
16045
|
}, [activeTooltips.length]);
|
|
15773
|
-
const toggleHighlight = (0,
|
|
16046
|
+
const toggleHighlight = (0, import_react90.useCallback)((key) => {
|
|
15774
16047
|
setHighlightedSeries((prev) => {
|
|
15775
16048
|
const next = new Set(prev);
|
|
15776
16049
|
if (next.has(key)) next.delete(key);
|
|
@@ -15778,7 +16051,7 @@ var Chart = ({
|
|
|
15778
16051
|
return next;
|
|
15779
16052
|
});
|
|
15780
16053
|
}, []);
|
|
15781
|
-
const maxLeftDataValue = (0,
|
|
16054
|
+
const maxLeftDataValue = (0, import_react90.useMemo)(() => {
|
|
15782
16055
|
let max = 0;
|
|
15783
16056
|
const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
|
|
15784
16057
|
for (const row of processedData) {
|
|
@@ -15790,7 +16063,7 @@ var Chart = ({
|
|
|
15790
16063
|
}
|
|
15791
16064
|
return max;
|
|
15792
16065
|
}, [processedData, leftKeys, allKeys]);
|
|
15793
|
-
const minLeftDataValue = (0,
|
|
16066
|
+
const minLeftDataValue = (0, import_react90.useMemo)(() => {
|
|
15794
16067
|
let min = 0;
|
|
15795
16068
|
const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
|
|
15796
16069
|
for (const row of processedData) {
|
|
@@ -15803,7 +16076,7 @@ var Chart = ({
|
|
|
15803
16076
|
}
|
|
15804
16077
|
return min;
|
|
15805
16078
|
}, [processedData, leftKeys, allKeys]);
|
|
15806
|
-
const maxRightDataValue = (0,
|
|
16079
|
+
const maxRightDataValue = (0, import_react90.useMemo)(() => {
|
|
15807
16080
|
let max = 0;
|
|
15808
16081
|
if (rightKeys.length === 0) return max;
|
|
15809
16082
|
for (const row of processedData) {
|
|
@@ -15815,7 +16088,7 @@ var Chart = ({
|
|
|
15815
16088
|
}
|
|
15816
16089
|
return max;
|
|
15817
16090
|
}, [processedData, rightKeys]);
|
|
15818
|
-
const minRightDataValue = (0,
|
|
16091
|
+
const minRightDataValue = (0, import_react90.useMemo)(() => {
|
|
15819
16092
|
let min = 0;
|
|
15820
16093
|
if (rightKeys.length === 0) return min;
|
|
15821
16094
|
for (const row of processedData) {
|
|
@@ -15828,7 +16101,7 @@ var Chart = ({
|
|
|
15828
16101
|
}
|
|
15829
16102
|
return min;
|
|
15830
16103
|
}, [processedData, rightKeys]);
|
|
15831
|
-
const computeNiceMax = (0,
|
|
16104
|
+
const computeNiceMax = (0, import_react90.useCallback)((maxValue) => {
|
|
15832
16105
|
let padding = 0.08;
|
|
15833
16106
|
if (maxValue > 1e6) padding = 0.05;
|
|
15834
16107
|
if (maxValue > 1e7) padding = 0.03;
|
|
@@ -15836,15 +16109,15 @@ var Chart = ({
|
|
|
15836
16109
|
const padded = maxValue * (1 + padding);
|
|
15837
16110
|
return niceCeil(padded);
|
|
15838
16111
|
}, []);
|
|
15839
|
-
const niceMaxLeft = (0,
|
|
16112
|
+
const niceMaxLeft = (0, import_react90.useMemo)(
|
|
15840
16113
|
() => computeNiceMax(maxLeftDataValue),
|
|
15841
16114
|
[computeNiceMax, maxLeftDataValue]
|
|
15842
16115
|
);
|
|
15843
|
-
const niceMaxRight = (0,
|
|
16116
|
+
const niceMaxRight = (0, import_react90.useMemo)(
|
|
15844
16117
|
() => computeNiceMax(maxRightDataValue),
|
|
15845
16118
|
[computeNiceMax, maxRightDataValue]
|
|
15846
16119
|
);
|
|
15847
|
-
const computedWidth = (0,
|
|
16120
|
+
const computedWidth = (0, import_react90.useMemo)(() => {
|
|
15848
16121
|
if (typeof width === "number") return width;
|
|
15849
16122
|
const points = Math.max(1, processedData.length);
|
|
15850
16123
|
const barCount = series?.bar?.length ?? 0;
|
|
@@ -15875,7 +16148,7 @@ var Chart = ({
|
|
|
15875
16148
|
niceMaxLeft,
|
|
15876
16149
|
niceMaxRight
|
|
15877
16150
|
]);
|
|
15878
|
-
const toggleTooltip = (0,
|
|
16151
|
+
const toggleTooltip = (0, import_react90.useCallback)(
|
|
15879
16152
|
(tooltipId, data2, basePosition) => {
|
|
15880
16153
|
const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
|
|
15881
16154
|
if (existingIndex !== -1) {
|
|
@@ -15904,7 +16177,7 @@ var Chart = ({
|
|
|
15904
16177
|
},
|
|
15905
16178
|
[activeTooltips, maxTooltips]
|
|
15906
16179
|
);
|
|
15907
|
-
const handleChartClick = (0,
|
|
16180
|
+
const handleChartClick = (0, import_react90.useCallback)(
|
|
15908
16181
|
(e) => {
|
|
15909
16182
|
if (!enableDraggableTooltips) return;
|
|
15910
16183
|
const ev = e;
|
|
@@ -15922,7 +16195,7 @@ var Chart = ({
|
|
|
15922
16195
|
},
|
|
15923
16196
|
[enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
|
|
15924
16197
|
);
|
|
15925
|
-
const handleBarClick = (0,
|
|
16198
|
+
const handleBarClick = (0, import_react90.useCallback)(
|
|
15926
16199
|
(data2, index, event) => {
|
|
15927
16200
|
if (!enableDraggableTooltips) return;
|
|
15928
16201
|
event.stopPropagation();
|
|
@@ -15936,7 +16209,7 @@ var Chart = ({
|
|
|
15936
16209
|
},
|
|
15937
16210
|
[enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
|
|
15938
16211
|
);
|
|
15939
|
-
const handleSeriesClick = (0,
|
|
16212
|
+
const handleSeriesClick = (0, import_react90.useCallback)(
|
|
15940
16213
|
(...args) => {
|
|
15941
16214
|
if (args.length >= 3) {
|
|
15942
16215
|
const [data2, index, event] = args;
|
|
@@ -15947,7 +16220,7 @@ var Chart = ({
|
|
|
15947
16220
|
},
|
|
15948
16221
|
[handleBarClick, handleChartClick]
|
|
15949
16222
|
);
|
|
15950
|
-
const onTooltipPositionChange = (0,
|
|
16223
|
+
const onTooltipPositionChange = (0, import_react90.useCallback)(
|
|
15951
16224
|
(id, position) => {
|
|
15952
16225
|
setActiveTooltips(
|
|
15953
16226
|
(prev) => prev.map((t) => t.id === id ? { ...t, position } : t)
|
|
@@ -15955,11 +16228,11 @@ var Chart = ({
|
|
|
15955
16228
|
},
|
|
15956
16229
|
[]
|
|
15957
16230
|
);
|
|
15958
|
-
const titleClassName = (0,
|
|
16231
|
+
const titleClassName = (0, import_react90.useMemo)(
|
|
15959
16232
|
() => "text-[1.4rem] font-semibold text-foreground mb-3",
|
|
15960
16233
|
[]
|
|
15961
16234
|
);
|
|
15962
|
-
const finalValueFormatter = (0,
|
|
16235
|
+
const finalValueFormatter = (0, import_react90.useMemo)(() => {
|
|
15963
16236
|
const nf = new Intl.NumberFormat("pt-BR", {
|
|
15964
16237
|
minimumFractionDigits: 2,
|
|
15965
16238
|
maximumFractionDigits: 2
|
|
@@ -15999,7 +16272,7 @@ var Chart = ({
|
|
|
15999
16272
|
};
|
|
16000
16273
|
return builtIn;
|
|
16001
16274
|
}, [valueFormatter2, formatBR]);
|
|
16002
|
-
const yTickFormatter = (0,
|
|
16275
|
+
const yTickFormatter = (0, import_react90.useMemo)(() => {
|
|
16003
16276
|
const nf = new Intl.NumberFormat("pt-BR", {
|
|
16004
16277
|
minimumFractionDigits: 2,
|
|
16005
16278
|
maximumFractionDigits: 2
|
|
@@ -16030,15 +16303,26 @@ var Chart = ({
|
|
|
16030
16303
|
const containerPaddingLeft = -6;
|
|
16031
16304
|
const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
|
|
16032
16305
|
const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
|
|
16033
|
-
const yAxisTickWidth = (0,
|
|
16306
|
+
const yAxisTickWidth = (0, import_react90.useMemo)(() => {
|
|
16034
16307
|
if (typeof chartMargin?.left === "number") return chartMargin.left;
|
|
16035
16308
|
if (yAxisLabel) return axisLabelMargin;
|
|
16036
|
-
const samples = [
|
|
16309
|
+
const samples = [
|
|
16310
|
+
minLeftDataValue,
|
|
16311
|
+
niceMaxLeft,
|
|
16312
|
+
Math.round((minLeftDataValue + niceMaxLeft) / 2),
|
|
16313
|
+
0
|
|
16314
|
+
];
|
|
16037
16315
|
const formatted = samples.map((v) => String(yTickFormatter(v)));
|
|
16038
16316
|
const maxLen = formatted.reduce((m, s) => Math.max(m, s.length), 0);
|
|
16039
16317
|
const estimated = Math.max(48, Math.min(220, maxLen * 8 + 24));
|
|
16040
16318
|
return estimated;
|
|
16041
|
-
}, [
|
|
16319
|
+
}, [
|
|
16320
|
+
chartMargin?.left,
|
|
16321
|
+
yAxisLabel,
|
|
16322
|
+
yTickFormatter,
|
|
16323
|
+
minLeftDataValue,
|
|
16324
|
+
niceMaxLeft
|
|
16325
|
+
]);
|
|
16042
16326
|
const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
|
|
16043
16327
|
const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
|
|
16044
16328
|
const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
|
|
@@ -16051,7 +16335,7 @@ var Chart = ({
|
|
|
16051
16335
|
const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
|
|
16052
16336
|
const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
|
|
16053
16337
|
const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
|
|
16054
|
-
const openTooltipForPeriod = (0,
|
|
16338
|
+
const openTooltipForPeriod = (0, import_react90.useCallback)(
|
|
16055
16339
|
(periodName) => {
|
|
16056
16340
|
if (!enableDraggableTooltips) return;
|
|
16057
16341
|
const row = processedData.find((r) => String(r.name) === periodName);
|
|
@@ -16108,7 +16392,7 @@ var Chart = ({
|
|
|
16108
16392
|
style: {
|
|
16109
16393
|
paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`
|
|
16110
16394
|
},
|
|
16111
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(NoData_default, {})
|
|
16395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(NoData_default, { title })
|
|
16112
16396
|
}
|
|
16113
16397
|
)
|
|
16114
16398
|
}
|
|
@@ -16557,7 +16841,7 @@ var Chart = ({
|
|
|
16557
16841
|
var Chart_default = Chart;
|
|
16558
16842
|
|
|
16559
16843
|
// src/components/ui/charts/BarChart.tsx
|
|
16560
|
-
var
|
|
16844
|
+
var import_react91 = require("react");
|
|
16561
16845
|
var import_recharts2 = require("recharts");
|
|
16562
16846
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
16563
16847
|
var DEFAULT_COLORS3 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
@@ -16589,7 +16873,7 @@ var BarChart = ({
|
|
|
16589
16873
|
containerPaddingLeft,
|
|
16590
16874
|
16
|
|
16591
16875
|
);
|
|
16592
|
-
const smartConfig = (0,
|
|
16876
|
+
const smartConfig = (0, import_react91.useMemo)(() => {
|
|
16593
16877
|
const providedMapper = yAxis ?? mapper;
|
|
16594
16878
|
if (autoDetect === true || xAxis == null || providedMapper == null) {
|
|
16595
16879
|
const detectedXAxis = detectXAxis(data);
|
|
@@ -16639,14 +16923,14 @@ var BarChart = ({
|
|
|
16639
16923
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
16640
16924
|
}, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
|
|
16641
16925
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
16642
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
16643
|
-
const [isDragging, setIsDragging] = (0,
|
|
16644
|
-
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)({
|
|
16645
16929
|
x: 0,
|
|
16646
16930
|
y: 0
|
|
16647
16931
|
});
|
|
16648
|
-
const [globalTooltipCount, setGlobalTooltipCount] = (0,
|
|
16649
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
16932
|
+
const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react91.useState)(0);
|
|
16933
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react91.useState)([]);
|
|
16650
16934
|
const processedData = data.map((item) => ({
|
|
16651
16935
|
...item,
|
|
16652
16936
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
@@ -16669,7 +16953,7 @@ var BarChart = ({
|
|
|
16669
16953
|
// Garantir que tem a propriedade 'name'
|
|
16670
16954
|
};
|
|
16671
16955
|
};
|
|
16672
|
-
const maxDataValue = (0,
|
|
16956
|
+
const maxDataValue = (0, import_react91.useMemo)(() => {
|
|
16673
16957
|
let max = 0;
|
|
16674
16958
|
const keys = Object.keys(mapperConfig);
|
|
16675
16959
|
for (const row of processedData) {
|
|
@@ -16682,7 +16966,7 @@ var BarChart = ({
|
|
|
16682
16966
|
}
|
|
16683
16967
|
return max;
|
|
16684
16968
|
}, [processedData, mapperConfig]);
|
|
16685
|
-
const niceMax = (0,
|
|
16969
|
+
const niceMax = (0, import_react91.useMemo)(() => {
|
|
16686
16970
|
let padding2 = 0.08;
|
|
16687
16971
|
if (maxDataValue > 1e6) padding2 = 0.05;
|
|
16688
16972
|
if (maxDataValue > 1e7) padding2 = 0.03;
|
|
@@ -16723,7 +17007,7 @@ var BarChart = ({
|
|
|
16723
17007
|
const GUIDE_THRESHOLD2 = 60;
|
|
16724
17008
|
const STRONG_SNAP_THRESHOLD2 = 35;
|
|
16725
17009
|
const PRECISION_SNAP_THRESHOLD2 = 8;
|
|
16726
|
-
const updateAlignmentGuides = (0,
|
|
17010
|
+
const updateAlignmentGuides = (0, import_react91.useCallback)(
|
|
16727
17011
|
(draggedTooltipId, currentPosition) => {
|
|
16728
17012
|
if (!isDragging) return;
|
|
16729
17013
|
const getAllTooltips = () => {
|
|
@@ -16787,7 +17071,7 @@ var BarChart = ({
|
|
|
16787
17071
|
},
|
|
16788
17072
|
[isDragging, activeTooltips]
|
|
16789
17073
|
);
|
|
16790
|
-
const snapToGuides = (0,
|
|
17074
|
+
const snapToGuides = (0, import_react91.useCallback)(
|
|
16791
17075
|
(position) => {
|
|
16792
17076
|
const snappedPosition = { ...position };
|
|
16793
17077
|
let hasSnapped = false;
|
|
@@ -16849,7 +17133,7 @@ var BarChart = ({
|
|
|
16849
17133
|
setIsDragging(tooltipId);
|
|
16850
17134
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
16851
17135
|
};
|
|
16852
|
-
(0,
|
|
17136
|
+
(0, import_react91.useEffect)(() => {
|
|
16853
17137
|
let rafId;
|
|
16854
17138
|
let lastMousePosition = { x: 0, y: 0 };
|
|
16855
17139
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -16907,7 +17191,7 @@ var BarChart = ({
|
|
|
16907
17191
|
updateAlignmentGuides,
|
|
16908
17192
|
snapToGuides
|
|
16909
17193
|
]);
|
|
16910
|
-
(0,
|
|
17194
|
+
(0, import_react91.useEffect)(() => {
|
|
16911
17195
|
const handleCloseAllTooltips = () => {
|
|
16912
17196
|
setActiveTooltips([]);
|
|
16913
17197
|
setGlobalTooltipCount(0);
|
|
@@ -16917,7 +17201,7 @@ var BarChart = ({
|
|
|
16917
17201
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
|
|
16918
17202
|
};
|
|
16919
17203
|
}, []);
|
|
16920
|
-
(0,
|
|
17204
|
+
(0, import_react91.useEffect)(() => {
|
|
16921
17205
|
const handleTooltipCountRequest = () => {
|
|
16922
17206
|
window.dispatchEvent(
|
|
16923
17207
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -16956,7 +17240,7 @@ var BarChart = ({
|
|
|
16956
17240
|
);
|
|
16957
17241
|
};
|
|
16958
17242
|
}, [activeTooltips]);
|
|
16959
|
-
(0,
|
|
17243
|
+
(0, import_react91.useEffect)(() => {
|
|
16960
17244
|
if (isDragging) return;
|
|
16961
17245
|
let totalCount = 0;
|
|
16962
17246
|
const handleCountResponse = (event) => {
|
|
@@ -17222,7 +17506,7 @@ var BarChart = ({
|
|
|
17222
17506
|
var BarChart_default = BarChart;
|
|
17223
17507
|
|
|
17224
17508
|
// src/components/ui/charts/LineChart.tsx
|
|
17225
|
-
var
|
|
17509
|
+
var import_react92 = require("react");
|
|
17226
17510
|
var import_recharts3 = require("recharts");
|
|
17227
17511
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
17228
17512
|
var defaultData = [
|
|
@@ -17256,14 +17540,14 @@ var CustomLineChart = ({
|
|
|
17256
17540
|
containerPaddingLeft,
|
|
17257
17541
|
16
|
|
17258
17542
|
);
|
|
17259
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
17260
|
-
const [isDragging, setIsDragging] = (0,
|
|
17261
|
-
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)({
|
|
17262
17546
|
x: 0,
|
|
17263
17547
|
y: 0
|
|
17264
17548
|
});
|
|
17265
|
-
const [globalTooltipCount, setGlobalTooltipCount] = (0,
|
|
17266
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
17549
|
+
const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react92.useState)(0);
|
|
17550
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react92.useState)([]);
|
|
17267
17551
|
const generateColors = (dataKeys2) => {
|
|
17268
17552
|
const colorMap = {};
|
|
17269
17553
|
const allColors = generateAdditionalColors(colors2, dataKeys2.length);
|
|
@@ -17272,12 +17556,12 @@ var CustomLineChart = ({
|
|
|
17272
17556
|
});
|
|
17273
17557
|
return colorMap;
|
|
17274
17558
|
};
|
|
17275
|
-
const dataKeys = (0,
|
|
17559
|
+
const dataKeys = (0, import_react92.useMemo)(
|
|
17276
17560
|
() => data.length > 0 ? Object.keys(data[0]).filter((key) => key !== "name") : [],
|
|
17277
17561
|
[data]
|
|
17278
17562
|
);
|
|
17279
17563
|
const finalColors = generateColors(dataKeys);
|
|
17280
|
-
const maxDataValue = (0,
|
|
17564
|
+
const maxDataValue = (0, import_react92.useMemo)(() => {
|
|
17281
17565
|
let max = 0;
|
|
17282
17566
|
for (const row of data) {
|
|
17283
17567
|
const r = row;
|
|
@@ -17289,7 +17573,7 @@ var CustomLineChart = ({
|
|
|
17289
17573
|
}
|
|
17290
17574
|
return max;
|
|
17291
17575
|
}, [data, dataKeys]);
|
|
17292
|
-
const niceMax = (0,
|
|
17576
|
+
const niceMax = (0, import_react92.useMemo)(() => {
|
|
17293
17577
|
let padding2 = 0.08;
|
|
17294
17578
|
if (maxDataValue > 1e6) padding2 = 0.05;
|
|
17295
17579
|
if (maxDataValue > 1e7) padding2 = 0.03;
|
|
@@ -17365,10 +17649,10 @@ var CustomLineChart = ({
|
|
|
17365
17649
|
const handleChartBackgroundClick = () => {
|
|
17366
17650
|
setActiveTooltips([]);
|
|
17367
17651
|
};
|
|
17368
|
-
const handleCloseAllTooltips = (0,
|
|
17652
|
+
const handleCloseAllTooltips = (0, import_react92.useCallback)(() => {
|
|
17369
17653
|
window.dispatchEvent(new CustomEvent("closeAllTooltips"));
|
|
17370
17654
|
}, []);
|
|
17371
|
-
const updateAlignmentGuides = (0,
|
|
17655
|
+
const updateAlignmentGuides = (0, import_react92.useCallback)(
|
|
17372
17656
|
(draggedTooltipId, draggedPosition) => {
|
|
17373
17657
|
const SNAP_THRESHOLD = 15;
|
|
17374
17658
|
const draggedTooltip = activeTooltips.find(
|
|
@@ -17449,7 +17733,7 @@ var CustomLineChart = ({
|
|
|
17449
17733
|
},
|
|
17450
17734
|
[activeTooltips]
|
|
17451
17735
|
);
|
|
17452
|
-
const snapToGuides = (0,
|
|
17736
|
+
const snapToGuides = (0, import_react92.useCallback)(
|
|
17453
17737
|
(position) => {
|
|
17454
17738
|
const SNAP_DISTANCE = 10;
|
|
17455
17739
|
const snappedPosition = { ...position };
|
|
@@ -17477,7 +17761,7 @@ var CustomLineChart = ({
|
|
|
17477
17761
|
setIsDragging(tooltipId);
|
|
17478
17762
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
17479
17763
|
};
|
|
17480
|
-
(0,
|
|
17764
|
+
(0, import_react92.useEffect)(() => {
|
|
17481
17765
|
let rafId;
|
|
17482
17766
|
let lastMousePosition = { x: 0, y: 0 };
|
|
17483
17767
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -17524,7 +17808,7 @@ var CustomLineChart = ({
|
|
|
17524
17808
|
updateAlignmentGuides,
|
|
17525
17809
|
snapToGuides
|
|
17526
17810
|
]);
|
|
17527
|
-
(0,
|
|
17811
|
+
(0, import_react92.useEffect)(() => {
|
|
17528
17812
|
const handleCloseAllTooltips2 = () => {
|
|
17529
17813
|
setActiveTooltips([]);
|
|
17530
17814
|
setGlobalTooltipCount(0);
|
|
@@ -17534,7 +17818,7 @@ var CustomLineChart = ({
|
|
|
17534
17818
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
|
|
17535
17819
|
};
|
|
17536
17820
|
}, []);
|
|
17537
|
-
(0,
|
|
17821
|
+
(0, import_react92.useEffect)(() => {
|
|
17538
17822
|
const handleTooltipCountRequest = () => {
|
|
17539
17823
|
window.dispatchEvent(
|
|
17540
17824
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -17578,7 +17862,7 @@ var CustomLineChart = ({
|
|
|
17578
17862
|
);
|
|
17579
17863
|
};
|
|
17580
17864
|
}, [activeTooltips]);
|
|
17581
|
-
(0,
|
|
17865
|
+
(0, import_react92.useEffect)(() => {
|
|
17582
17866
|
if (isDragging) return;
|
|
17583
17867
|
let totalCount = 0;
|
|
17584
17868
|
const handleCountResponse = (event) => {
|
|
@@ -17900,13 +18184,13 @@ var CustomPieChart = ({
|
|
|
17900
18184
|
var PieChart_default = CustomPieChart;
|
|
17901
18185
|
|
|
17902
18186
|
// src/components/ui/charts/hooks/useChartHighlights.tsx
|
|
17903
|
-
var
|
|
18187
|
+
var import_react93 = require("react");
|
|
17904
18188
|
var useChartHighlights = () => {
|
|
17905
|
-
const [highlightedSeries, setHighlightedSeries] = (0,
|
|
18189
|
+
const [highlightedSeries, setHighlightedSeries] = (0, import_react93.useState)(
|
|
17906
18190
|
/* @__PURE__ */ new Set()
|
|
17907
18191
|
);
|
|
17908
|
-
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0,
|
|
17909
|
-
const toggleHighlight = (0,
|
|
18192
|
+
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react93.useState)(false);
|
|
18193
|
+
const toggleHighlight = (0, import_react93.useCallback)((key) => {
|
|
17910
18194
|
setHighlightedSeries((prev) => {
|
|
17911
18195
|
const next = new Set(prev);
|
|
17912
18196
|
if (next.has(key)) {
|
|
@@ -17917,17 +18201,17 @@ var useChartHighlights = () => {
|
|
|
17917
18201
|
return next;
|
|
17918
18202
|
});
|
|
17919
18203
|
}, []);
|
|
17920
|
-
const clearHighlights = (0,
|
|
18204
|
+
const clearHighlights = (0, import_react93.useCallback)(() => {
|
|
17921
18205
|
setHighlightedSeries(/* @__PURE__ */ new Set());
|
|
17922
18206
|
setShowOnlyHighlighted(false);
|
|
17923
18207
|
}, []);
|
|
17924
|
-
const isHighlighted = (0,
|
|
18208
|
+
const isHighlighted = (0, import_react93.useCallback)(
|
|
17925
18209
|
(key) => {
|
|
17926
18210
|
return highlightedSeries.has(key);
|
|
17927
18211
|
},
|
|
17928
18212
|
[highlightedSeries]
|
|
17929
18213
|
);
|
|
17930
|
-
const getSeriesStyle = (0,
|
|
18214
|
+
const getSeriesStyle = (0, import_react93.useCallback)(
|
|
17931
18215
|
(key) => {
|
|
17932
18216
|
const hasHighlights = highlightedSeries.size > 0;
|
|
17933
18217
|
const isSeriesHighlighted = highlightedSeries.has(key);
|
|
@@ -17971,80 +18255,3 @@ var useChartHighlights = () => {
|
|
|
17971
18255
|
isHighlighted
|
|
17972
18256
|
};
|
|
17973
18257
|
};
|
|
17974
|
-
|
|
17975
|
-
// src/hooks/use-drag.tsx
|
|
17976
|
-
var import_react92 = require("react");
|
|
17977
|
-
var useDrag = (options = {}) => {
|
|
17978
|
-
const [isDragging, setIsDragging] = (0, import_react92.useState)(null);
|
|
17979
|
-
const [positions, setPositions] = (0, import_react92.useState)({});
|
|
17980
|
-
const dragStartPos = (0, import_react92.useRef)(null);
|
|
17981
|
-
const dragId = (0, import_react92.useRef)(null);
|
|
17982
|
-
const handleMouseDown = (0, import_react92.useCallback)((id, e) => {
|
|
17983
|
-
e.preventDefault();
|
|
17984
|
-
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
17985
|
-
dragStartPos.current = {
|
|
17986
|
-
x: e.clientX,
|
|
17987
|
-
y: e.clientY,
|
|
17988
|
-
elementX: currentPosition.left,
|
|
17989
|
-
elementY: currentPosition.top
|
|
17990
|
-
};
|
|
17991
|
-
dragId.current = id;
|
|
17992
|
-
setIsDragging(id);
|
|
17993
|
-
options.onDragStart?.(id);
|
|
17994
|
-
}, [positions, options]);
|
|
17995
|
-
const handleMouseMove = (0, import_react92.useCallback)((e) => {
|
|
17996
|
-
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
17997
|
-
const deltaX = e.clientX - dragStartPos.current.x;
|
|
17998
|
-
const deltaY = e.clientY - dragStartPos.current.y;
|
|
17999
|
-
const newPosition = {
|
|
18000
|
-
left: dragStartPos.current.elementX + deltaX,
|
|
18001
|
-
top: dragStartPos.current.elementY + deltaY
|
|
18002
|
-
};
|
|
18003
|
-
newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
|
|
18004
|
-
newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
|
|
18005
|
-
setPositions((prev) => ({
|
|
18006
|
-
...prev,
|
|
18007
|
-
[dragId.current]: newPosition
|
|
18008
|
-
}));
|
|
18009
|
-
options.onDrag?.(dragId.current, newPosition);
|
|
18010
|
-
}, [isDragging, options]);
|
|
18011
|
-
const handleMouseUp = (0, import_react92.useCallback)(() => {
|
|
18012
|
-
if (dragId.current) {
|
|
18013
|
-
options.onDragEnd?.(dragId.current);
|
|
18014
|
-
}
|
|
18015
|
-
setIsDragging(null);
|
|
18016
|
-
dragStartPos.current = null;
|
|
18017
|
-
dragId.current = null;
|
|
18018
|
-
}, [options]);
|
|
18019
|
-
(0, import_react92.useEffect)(() => {
|
|
18020
|
-
if (isDragging) {
|
|
18021
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
18022
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
18023
|
-
document.body.style.userSelect = "none";
|
|
18024
|
-
return () => {
|
|
18025
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
18026
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
18027
|
-
document.body.style.userSelect = "";
|
|
18028
|
-
};
|
|
18029
|
-
}
|
|
18030
|
-
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
18031
|
-
const setPosition = (0, import_react92.useCallback)((id, position) => {
|
|
18032
|
-
setPositions((prev) => ({
|
|
18033
|
-
...prev,
|
|
18034
|
-
[id]: position
|
|
18035
|
-
}));
|
|
18036
|
-
}, []);
|
|
18037
|
-
const getPosition = (0, import_react92.useCallback)((id) => {
|
|
18038
|
-
return positions[id] || { top: 0, left: 0 };
|
|
18039
|
-
}, [positions]);
|
|
18040
|
-
const isElementDragging = (0, import_react92.useCallback)((id) => {
|
|
18041
|
-
return isDragging === id;
|
|
18042
|
-
}, [isDragging]);
|
|
18043
|
-
return {
|
|
18044
|
-
handleMouseDown,
|
|
18045
|
-
getPosition,
|
|
18046
|
-
setPosition,
|
|
18047
|
-
isElementDragging,
|
|
18048
|
-
isDragging: isDragging !== null
|
|
18049
|
-
};
|
|
18050
|
-
};
|