@mlw-packages/react-components 1.7.26 → 1.7.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +128 -54
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1030 -833
- package/dist/index.mjs +902 -705
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -477,7 +477,7 @@ var require_colors2 = __commonJS({
|
|
|
477
477
|
});
|
|
478
478
|
|
|
479
479
|
// src/components/ui/FilterBase.tsx
|
|
480
|
-
import { useState as useState2, useCallback as
|
|
480
|
+
import { useState as useState2, useCallback as useCallback4, useMemo as useMemo3, useEffect as useEffect2 } from "react";
|
|
481
481
|
|
|
482
482
|
// src/components/ui/form/ButtonBase.tsx
|
|
483
483
|
import * as React from "react";
|
|
@@ -628,7 +628,7 @@ var DialogContentBase = React2.forwardRef(
|
|
|
628
628
|
{
|
|
629
629
|
ref,
|
|
630
630
|
className: cn(
|
|
631
|
-
"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",
|
|
631
|
+
"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",
|
|
632
632
|
className
|
|
633
633
|
),
|
|
634
634
|
"data-testid": dataTestId,
|
|
@@ -784,7 +784,7 @@ var InputBase = React4.forwardRef(
|
|
|
784
784
|
InputBase.displayName = "Input";
|
|
785
785
|
|
|
786
786
|
// src/components/ui/selects/Combobox.tsx
|
|
787
|
-
import { useCallback, useMemo } from "react";
|
|
787
|
+
import { useCallback as useCallback2, useMemo } from "react";
|
|
788
788
|
|
|
789
789
|
// src/components/ui/navigation/CommandBase.tsx
|
|
790
790
|
import * as React5 from "react";
|
|
@@ -841,22 +841,47 @@ var CommandInputBase = React5.forwardRef(({ className, testid: dataTestId = "com
|
|
|
841
841
|
)
|
|
842
842
|
] }));
|
|
843
843
|
CommandInputBase.displayName = CommandPrimitive.Input.displayName;
|
|
844
|
-
var CommandListBase = React5.forwardRef(({ className, testid: dataTestId = "command-list", ...props }, ref) =>
|
|
845
|
-
|
|
846
|
-
{
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
"
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
844
|
+
var CommandListBase = React5.forwardRef(({ className, testid: dataTestId = "command-list", ...props }, ref) => {
|
|
845
|
+
const listRef = React5.useRef(null);
|
|
846
|
+
React5.useEffect(() => {
|
|
847
|
+
const element = listRef.current;
|
|
848
|
+
if (!element) return;
|
|
849
|
+
const handleWheel = (e) => {
|
|
850
|
+
e.stopPropagation();
|
|
851
|
+
};
|
|
852
|
+
element.addEventListener("wheel", handleWheel, { passive: false });
|
|
853
|
+
return () => {
|
|
854
|
+
element.removeEventListener("wheel", handleWheel);
|
|
855
|
+
};
|
|
856
|
+
}, []);
|
|
857
|
+
const combinedRef = React5.useCallback(
|
|
858
|
+
(node) => {
|
|
859
|
+
listRef.current = node;
|
|
860
|
+
if (typeof ref === "function") {
|
|
861
|
+
ref(node);
|
|
862
|
+
} else if (ref) {
|
|
863
|
+
ref.current = node;
|
|
864
|
+
}
|
|
856
865
|
},
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
866
|
+
[ref]
|
|
867
|
+
);
|
|
868
|
+
return /* @__PURE__ */ jsx6(
|
|
869
|
+
CommandPrimitive.List,
|
|
870
|
+
{
|
|
871
|
+
ref: combinedRef,
|
|
872
|
+
className: cn(
|
|
873
|
+
"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",
|
|
874
|
+
className
|
|
875
|
+
),
|
|
876
|
+
"data-testid": dataTestId,
|
|
877
|
+
style: {
|
|
878
|
+
overscrollBehavior: "contain",
|
|
879
|
+
WebkitOverflowScrolling: "touch"
|
|
880
|
+
},
|
|
881
|
+
...props
|
|
882
|
+
}
|
|
883
|
+
);
|
|
884
|
+
});
|
|
860
885
|
CommandListBase.displayName = CommandPrimitive.List.displayName;
|
|
861
886
|
var CommandEmptyBase = React5.forwardRef(({ testid: dataTestId = "command-empty", ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
862
887
|
CommandPrimitive.Empty,
|
|
@@ -1132,11 +1157,11 @@ function Combobox({
|
|
|
1132
1157
|
}
|
|
1133
1158
|
);
|
|
1134
1159
|
}, [placeholder, selectedItem, testIds?.selected, disabled]);
|
|
1135
|
-
const checkIsSelected =
|
|
1160
|
+
const checkIsSelected = useCallback2(
|
|
1136
1161
|
(value) => selected == null ? false : selected == value,
|
|
1137
1162
|
[selected]
|
|
1138
1163
|
);
|
|
1139
|
-
const handleSelection =
|
|
1164
|
+
const handleSelection = useCallback2(
|
|
1140
1165
|
(value) => {
|
|
1141
1166
|
onChange(value === selected ? null : value);
|
|
1142
1167
|
},
|
|
@@ -1162,7 +1187,7 @@ function Combobox({
|
|
|
1162
1187
|
}
|
|
1163
1188
|
|
|
1164
1189
|
// src/components/ui/selects/MultiCombobox.tsx
|
|
1165
|
-
import { useCallback as
|
|
1190
|
+
import { useCallback as useCallback3, useMemo as useMemo2 } from "react";
|
|
1166
1191
|
import { XIcon as XIcon2 } from "@phosphor-icons/react";
|
|
1167
1192
|
import { motion as motion3, AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
1168
1193
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -1183,11 +1208,11 @@ function MultiCombobox({
|
|
|
1183
1208
|
empty
|
|
1184
1209
|
}) {
|
|
1185
1210
|
const selectedItems = items.filter((item) => selected.includes(item.value));
|
|
1186
|
-
const checkIsSelected =
|
|
1211
|
+
const checkIsSelected = useCallback3(
|
|
1187
1212
|
(value) => selected.includes(value),
|
|
1188
1213
|
[selected]
|
|
1189
1214
|
);
|
|
1190
|
-
const handleSelection =
|
|
1215
|
+
const handleSelection = useCallback3(
|
|
1191
1216
|
(value) => {
|
|
1192
1217
|
const isSelected = selected.includes(value);
|
|
1193
1218
|
if (isSelected) {
|
|
@@ -1659,7 +1684,7 @@ var DropDownMenuShortcutBase = ({
|
|
|
1659
1684
|
DropDownMenuShortcutBase.displayName = "DropDownMenuShortcutBase";
|
|
1660
1685
|
|
|
1661
1686
|
// src/components/theme/theme-provider.tsx
|
|
1662
|
-
import { createContext, useContext, useEffect as
|
|
1687
|
+
import { createContext, useContext, useEffect as useEffect3, useState as useState3 } from "react";
|
|
1663
1688
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1664
1689
|
var initialState = {
|
|
1665
1690
|
theme: "system",
|
|
@@ -1673,7 +1698,7 @@ function ThemeProviderBase({
|
|
|
1673
1698
|
...props
|
|
1674
1699
|
}) {
|
|
1675
1700
|
const [theme, setThemeState] = useState3(defaultTheme);
|
|
1676
|
-
|
|
1701
|
+
useEffect3(() => {
|
|
1677
1702
|
const root = window.document.documentElement;
|
|
1678
1703
|
root.classList.remove(
|
|
1679
1704
|
"light",
|
|
@@ -1699,7 +1724,7 @@ function ThemeProviderBase({
|
|
|
1699
1724
|
document.body.style.color = "";
|
|
1700
1725
|
}
|
|
1701
1726
|
}, [theme]);
|
|
1702
|
-
|
|
1727
|
+
useEffect3(() => {
|
|
1703
1728
|
const stored = localStorage.getItem(storageKey);
|
|
1704
1729
|
if (stored) setThemeState(stored);
|
|
1705
1730
|
}, [storageKey]);
|
|
@@ -5970,7 +5995,7 @@ function DrawerDescriptionBase({
|
|
|
5970
5995
|
}
|
|
5971
5996
|
|
|
5972
5997
|
// src/hooks/use-universal-tooltip.tsx
|
|
5973
|
-
import { createContext as createContext4, useContext as useContext5, useState as useState10, useCallback as
|
|
5998
|
+
import { createContext as createContext4, useContext as useContext5, useState as useState10, useCallback as useCallback7, useEffect as useEffect11, useRef as useRef5 } from "react";
|
|
5974
5999
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
5975
6000
|
var UniversalTooltipContext = createContext4(null);
|
|
5976
6001
|
var useUniversalTooltip = () => {
|
|
@@ -5982,7 +6007,7 @@ var useUniversalTooltip = () => {
|
|
|
5982
6007
|
};
|
|
5983
6008
|
var useTooltip = () => {
|
|
5984
6009
|
const { addTooltip, removeTooltip, startDrag } = useUniversalTooltip();
|
|
5985
|
-
const createTooltip =
|
|
6010
|
+
const createTooltip = useCallback7((element, content, options) => {
|
|
5986
6011
|
const rect = element.getBoundingClientRect();
|
|
5987
6012
|
let position;
|
|
5988
6013
|
switch (options?.position || "auto") {
|
|
@@ -6012,7 +6037,7 @@ var useTooltip = () => {
|
|
|
6012
6037
|
metadata: options?.metadata
|
|
6013
6038
|
});
|
|
6014
6039
|
}, [addTooltip]);
|
|
6015
|
-
const handleElementMouseDown =
|
|
6040
|
+
const handleElementMouseDown = useCallback7((tooltipId, event) => {
|
|
6016
6041
|
const rect = event.target.getBoundingClientRect();
|
|
6017
6042
|
const offset = {
|
|
6018
6043
|
x: event.clientX - rect.left,
|
|
@@ -6759,7 +6784,7 @@ function StatusIndicator({
|
|
|
6759
6784
|
}
|
|
6760
6785
|
|
|
6761
6786
|
// src/components/ui/form/DebouncedInput.tsx
|
|
6762
|
-
import { useEffect as
|
|
6787
|
+
import { useEffect as useEffect12, useState as useState11 } from "react";
|
|
6763
6788
|
import { CircleNotchIcon as CircleNotchIcon2 } from "@phosphor-icons/react";
|
|
6764
6789
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
6765
6790
|
function DebouncedInput({
|
|
@@ -6777,10 +6802,10 @@ function DebouncedInput({
|
|
|
6777
6802
|
}) {
|
|
6778
6803
|
const [value, setValue] = useState11(initialValue);
|
|
6779
6804
|
const [isDebouncing, setIsDebouncing] = useState11(false);
|
|
6780
|
-
|
|
6805
|
+
useEffect12(() => {
|
|
6781
6806
|
setValue(initialValue);
|
|
6782
6807
|
}, [initialValue]);
|
|
6783
|
-
|
|
6808
|
+
useEffect12(() => {
|
|
6784
6809
|
if (value !== initialValue) {
|
|
6785
6810
|
setIsDebouncing(true);
|
|
6786
6811
|
}
|
|
@@ -6816,7 +6841,7 @@ function DebouncedInput({
|
|
|
6816
6841
|
}
|
|
6817
6842
|
|
|
6818
6843
|
// src/components/ui/form/CheckBoxThree.tsx
|
|
6819
|
-
import { useCallback as
|
|
6844
|
+
import { useCallback as useCallback8, useMemo as useMemo5, useState as useState12, useEffect as useEffect13, useRef as useRef6 } from "react";
|
|
6820
6845
|
import { motion as motion10, AnimatePresence as AnimatePresence6 } from "framer-motion";
|
|
6821
6846
|
import { jsx as jsx53, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
6822
6847
|
function useCheckboxTree(initialTree) {
|
|
@@ -6832,7 +6857,7 @@ function useCheckboxTree(initialTree) {
|
|
|
6832
6857
|
return checkedSet;
|
|
6833
6858
|
}, [initialTree]);
|
|
6834
6859
|
const [checkedNodes, setCheckedNodes] = useState12(initialCheckedNodes);
|
|
6835
|
-
const isChecked =
|
|
6860
|
+
const isChecked = useCallback8(
|
|
6836
6861
|
(node) => {
|
|
6837
6862
|
if (!node.children) {
|
|
6838
6863
|
return checkedNodes.has(node.id);
|
|
@@ -6850,7 +6875,7 @@ function useCheckboxTree(initialTree) {
|
|
|
6850
6875
|
},
|
|
6851
6876
|
[checkedNodes]
|
|
6852
6877
|
);
|
|
6853
|
-
const handleCheck =
|
|
6878
|
+
const handleCheck = useCallback8(
|
|
6854
6879
|
(node) => {
|
|
6855
6880
|
const newCheckedNodes = new Set(checkedNodes);
|
|
6856
6881
|
const toggleNode = (n, check) => {
|
|
@@ -6881,8 +6906,8 @@ function CheckboxTree({ tree, renderNode }) {
|
|
|
6881
6906
|
children
|
|
6882
6907
|
}) => {
|
|
6883
6908
|
const [open, setOpen] = useState12(() => !!node.children && status !== false);
|
|
6884
|
-
const checkboxRef =
|
|
6885
|
-
|
|
6909
|
+
const checkboxRef = useRef6(null);
|
|
6910
|
+
useEffect13(() => {
|
|
6886
6911
|
if (checkboxRef.current) {
|
|
6887
6912
|
checkboxRef.current.indeterminate = status === "indeterminate";
|
|
6888
6913
|
}
|
|
@@ -6976,13 +7001,92 @@ import { add, format } from "date-fns";
|
|
|
6976
7001
|
// src/components/ui/picker/calendar.tsx
|
|
6977
7002
|
import * as React37 from "react";
|
|
6978
7003
|
import { DayPicker as DayPicker2 } from "react-day-picker";
|
|
7004
|
+
import { ptBR } from "date-fns/locale";
|
|
6979
7005
|
import {
|
|
6980
7006
|
CaretLeftIcon as CaretLeftIcon2,
|
|
6981
7007
|
CaretRightIcon as CaretRightIcon5,
|
|
6982
7008
|
XIcon as XIcon9,
|
|
6983
7009
|
CalendarIcon
|
|
6984
7010
|
} from "@phosphor-icons/react";
|
|
6985
|
-
|
|
7011
|
+
|
|
7012
|
+
// src/hooks/use-drag.tsx
|
|
7013
|
+
import { useState as useState14, useCallback as useCallback9, useRef as useRef7, useEffect as useEffect14 } from "react";
|
|
7014
|
+
var useDrag = (options = {}) => {
|
|
7015
|
+
const [isDragging, setIsDragging] = useState14(null);
|
|
7016
|
+
const [positions, setPositions] = useState14({});
|
|
7017
|
+
const dragStartPos = useRef7(null);
|
|
7018
|
+
const dragId = useRef7(null);
|
|
7019
|
+
const handleMouseDown = useCallback9((id, e) => {
|
|
7020
|
+
e.preventDefault();
|
|
7021
|
+
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
7022
|
+
dragStartPos.current = {
|
|
7023
|
+
x: e.clientX,
|
|
7024
|
+
y: e.clientY,
|
|
7025
|
+
elementX: currentPosition.left,
|
|
7026
|
+
elementY: currentPosition.top
|
|
7027
|
+
};
|
|
7028
|
+
dragId.current = id;
|
|
7029
|
+
setIsDragging(id);
|
|
7030
|
+
options.onDragStart?.(id);
|
|
7031
|
+
}, [positions, options]);
|
|
7032
|
+
const handleMouseMove = useCallback9((e) => {
|
|
7033
|
+
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
7034
|
+
const deltaX = e.clientX - dragStartPos.current.x;
|
|
7035
|
+
const deltaY = e.clientY - dragStartPos.current.y;
|
|
7036
|
+
const newPosition = {
|
|
7037
|
+
left: dragStartPos.current.elementX + deltaX,
|
|
7038
|
+
top: dragStartPos.current.elementY + deltaY
|
|
7039
|
+
};
|
|
7040
|
+
newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
|
|
7041
|
+
newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
|
|
7042
|
+
setPositions((prev) => ({
|
|
7043
|
+
...prev,
|
|
7044
|
+
[dragId.current]: newPosition
|
|
7045
|
+
}));
|
|
7046
|
+
options.onDrag?.(dragId.current, newPosition);
|
|
7047
|
+
}, [isDragging, options]);
|
|
7048
|
+
const handleMouseUp = useCallback9(() => {
|
|
7049
|
+
if (dragId.current) {
|
|
7050
|
+
options.onDragEnd?.(dragId.current);
|
|
7051
|
+
}
|
|
7052
|
+
setIsDragging(null);
|
|
7053
|
+
dragStartPos.current = null;
|
|
7054
|
+
dragId.current = null;
|
|
7055
|
+
}, [options]);
|
|
7056
|
+
useEffect14(() => {
|
|
7057
|
+
if (isDragging) {
|
|
7058
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
7059
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
7060
|
+
document.body.style.userSelect = "none";
|
|
7061
|
+
return () => {
|
|
7062
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
7063
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
7064
|
+
document.body.style.userSelect = "";
|
|
7065
|
+
};
|
|
7066
|
+
}
|
|
7067
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
7068
|
+
const setPosition = useCallback9((id, position) => {
|
|
7069
|
+
setPositions((prev) => ({
|
|
7070
|
+
...prev,
|
|
7071
|
+
[id]: position
|
|
7072
|
+
}));
|
|
7073
|
+
}, []);
|
|
7074
|
+
const getPosition = useCallback9((id) => {
|
|
7075
|
+
return positions[id] || { top: 0, left: 0 };
|
|
7076
|
+
}, [positions]);
|
|
7077
|
+
const isElementDragging = useCallback9((id) => {
|
|
7078
|
+
return isDragging === id;
|
|
7079
|
+
}, [isDragging]);
|
|
7080
|
+
return {
|
|
7081
|
+
handleMouseDown,
|
|
7082
|
+
getPosition,
|
|
7083
|
+
setPosition,
|
|
7084
|
+
isElementDragging,
|
|
7085
|
+
isDragging: isDragging !== null
|
|
7086
|
+
};
|
|
7087
|
+
};
|
|
7088
|
+
|
|
7089
|
+
// src/components/ui/picker/calendar.tsx
|
|
6986
7090
|
import { jsx as jsx55, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
6987
7091
|
function CalendarBase2({
|
|
6988
7092
|
className,
|
|
@@ -6990,16 +7094,7 @@ function CalendarBase2({
|
|
|
6990
7094
|
showOutsideDays = true,
|
|
6991
7095
|
...props
|
|
6992
7096
|
}) {
|
|
6993
|
-
const
|
|
6994
|
-
props.month || props.defaultMonth || /* @__PURE__ */ new Date()
|
|
6995
|
-
);
|
|
6996
|
-
const [direction, setDirection] = React37.useState(1);
|
|
6997
|
-
const handleMonthChange = (newMonth) => {
|
|
6998
|
-
const isNext = newMonth > month ? 1 : -1;
|
|
6999
|
-
setDirection(isNext);
|
|
7000
|
-
setMonth(newMonth);
|
|
7001
|
-
props.onMonthChange?.(newMonth);
|
|
7002
|
-
};
|
|
7097
|
+
const isMobile = useIsMobile();
|
|
7003
7098
|
return /* @__PURE__ */ jsx55(
|
|
7004
7099
|
"div",
|
|
7005
7100
|
{
|
|
@@ -7007,79 +7102,74 @@ function CalendarBase2({
|
|
|
7007
7102
|
"rounded-md border bg-background p-3 overflow-hidden flex flex-col",
|
|
7008
7103
|
className
|
|
7009
7104
|
),
|
|
7010
|
-
children: /* @__PURE__ */ jsx55("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsx55(
|
|
7011
|
-
|
|
7105
|
+
children: /* @__PURE__ */ jsx55("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsx55(
|
|
7106
|
+
DayPicker2,
|
|
7012
7107
|
{
|
|
7108
|
+
showOutsideDays,
|
|
7109
|
+
fixedWeeks: true,
|
|
7110
|
+
weekStartsOn: 1,
|
|
7111
|
+
locale: ptBR,
|
|
7112
|
+
navLayout: "around",
|
|
7013
7113
|
className: "w-full h-full flex flex-col",
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
...classNames
|
|
7059
|
-
},
|
|
7060
|
-
components: {
|
|
7061
|
-
Chevron: ({ orientation }) => {
|
|
7062
|
-
if (orientation === "left") {
|
|
7063
|
-
return /* @__PURE__ */ jsx55(CaretLeftIcon2, { className: "h-4 w-4" });
|
|
7064
|
-
}
|
|
7065
|
-
return /* @__PURE__ */ jsx55(CaretRightIcon5, { className: "h-4 w-4" });
|
|
7066
|
-
}
|
|
7067
|
-
},
|
|
7068
|
-
...props
|
|
7114
|
+
classNames: {
|
|
7115
|
+
months: "flex flex-col sm:flex-row gap-3 sm:gap-4 w-full",
|
|
7116
|
+
month: "relative flex-1 min-w-0",
|
|
7117
|
+
month_caption: "flex items-center gap-2 min-h-[2.25rem] mb-4",
|
|
7118
|
+
caption_label: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize",
|
|
7119
|
+
nav: "hidden ",
|
|
7120
|
+
button_previous: cn(
|
|
7121
|
+
buttonVariantsBase({ variant: "outline" }),
|
|
7122
|
+
"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",
|
|
7123
|
+
isMobile ? "mr-8" : ""
|
|
7124
|
+
),
|
|
7125
|
+
button_next: cn(
|
|
7126
|
+
buttonVariantsBase({ variant: "outline" }),
|
|
7127
|
+
"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",
|
|
7128
|
+
isMobile ? "mr-8" : ""
|
|
7129
|
+
),
|
|
7130
|
+
month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
|
|
7131
|
+
weekdays: "grid grid-cols-7 gap-1 mb-1",
|
|
7132
|
+
weekday: "text-muted-foreground rounded-md font-semibold text-[clamp(0.575rem,1.2vw,0.75rem)] sm:text-[clamp(0.65rem,1.1vw,0.825rem)] text-center pb-1 uppercase tracking-wider",
|
|
7133
|
+
week: "grid grid-cols-7 gap-1",
|
|
7134
|
+
day: cn(
|
|
7135
|
+
"min-w-0 h-9 sm:h-10 md:h-10 p-0 relative flex items-center justify-center",
|
|
7136
|
+
"[&:has([aria-selected].day-range-end)]:rounded-r-lg",
|
|
7137
|
+
"[&:has([aria-selected].day-range-start)]:rounded-l-lg",
|
|
7138
|
+
"[&:has([aria-selected].day-outside)]:bg-muted/50",
|
|
7139
|
+
"[&:has([aria-selected])]:bg-muted"
|
|
7140
|
+
),
|
|
7141
|
+
day_button: cn(
|
|
7142
|
+
buttonVariantsBase({ variant: "ghost" }),
|
|
7143
|
+
"w-full h-full p-0 m-0 flex items-center justify-center text-[clamp(0.775rem,1.2vw,0.95rem)] sm:text-sm",
|
|
7144
|
+
"aria-selected:opacity-100 hover:bg-muted transition-all duration-150 ease-out active:scale-95"
|
|
7145
|
+
),
|
|
7146
|
+
selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white rounded-md",
|
|
7147
|
+
today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
|
|
7148
|
+
outside: "text-muted-foreground/40 opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
|
|
7149
|
+
disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
|
|
7150
|
+
range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
|
|
7151
|
+
hidden: "invisible",
|
|
7152
|
+
...classNames
|
|
7153
|
+
},
|
|
7154
|
+
components: {
|
|
7155
|
+
Chevron: ({ orientation }) => {
|
|
7156
|
+
if (orientation === "left") {
|
|
7157
|
+
return /* @__PURE__ */ jsx55(CaretLeftIcon2, { className: "h-4 w-4" });
|
|
7069
7158
|
}
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7159
|
+
return /* @__PURE__ */ jsx55(CaretRightIcon5, { className: "h-4 w-4" });
|
|
7160
|
+
}
|
|
7161
|
+
},
|
|
7162
|
+
...props
|
|
7163
|
+
}
|
|
7164
|
+
) })
|
|
7075
7165
|
}
|
|
7076
7166
|
);
|
|
7077
7167
|
}
|
|
7078
7168
|
CalendarBase2.displayName = "CalendarBase";
|
|
7079
7169
|
|
|
7080
7170
|
// src/components/ui/picker/DateTimePicker.tsx
|
|
7081
|
-
import { ptBR } from "date-fns/locale";
|
|
7082
|
-
import { useEffect as
|
|
7171
|
+
import { ptBR as ptBR2 } from "date-fns/locale";
|
|
7172
|
+
import { useEffect as useEffect17, useState as useState18 } from "react";
|
|
7083
7173
|
import { CalendarBlankIcon } from "@phosphor-icons/react";
|
|
7084
7174
|
|
|
7085
7175
|
// src/components/ui/shared/ClearButton.tsx
|
|
@@ -7113,27 +7203,33 @@ function ClearButton({
|
|
|
7113
7203
|
}
|
|
7114
7204
|
|
|
7115
7205
|
// src/components/ui/picker/TimeScrollPicker.tsx
|
|
7116
|
-
import { useEffect as
|
|
7206
|
+
import { useEffect as useEffect15, useRef as useRef8, useState as useState16 } from "react";
|
|
7117
7207
|
import { jsx as jsx57, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
7118
|
-
var ITEM_HEIGHT =
|
|
7208
|
+
var ITEM_HEIGHT = 39;
|
|
7119
7209
|
var ITEM_HEIGHT_MOBILE = 32;
|
|
7120
7210
|
var VISIBLE_ITEMS = 5;
|
|
7121
7211
|
var VISIBLE_ITEMS_MOBILE = 3;
|
|
7122
7212
|
var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
|
|
7123
7213
|
var CENTER_INDEX_MOBILE = Math.floor(VISIBLE_ITEMS_MOBILE / 2);
|
|
7124
|
-
function ScrollColumn({
|
|
7214
|
+
function ScrollColumn({
|
|
7215
|
+
value,
|
|
7216
|
+
onChange,
|
|
7217
|
+
max,
|
|
7218
|
+
label,
|
|
7219
|
+
hideSeconds
|
|
7220
|
+
}) {
|
|
7125
7221
|
const isMobile = useIsMobile();
|
|
7126
|
-
const containerRef =
|
|
7222
|
+
const containerRef = useRef8(null);
|
|
7127
7223
|
const items = Array.from({ length: max }, (_, i) => i);
|
|
7128
|
-
const [isDragging, setIsDragging] =
|
|
7129
|
-
const [startY, setStartY] =
|
|
7130
|
-
const [scrollTop, setScrollTop] =
|
|
7131
|
-
const scrollTimeoutRef =
|
|
7224
|
+
const [isDragging, setIsDragging] = useState16(false);
|
|
7225
|
+
const [startY, setStartY] = useState16(0);
|
|
7226
|
+
const [scrollTop, setScrollTop] = useState16(0);
|
|
7227
|
+
const scrollTimeoutRef = useRef8(null);
|
|
7132
7228
|
const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
|
|
7133
7229
|
const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
|
|
7134
7230
|
const visibleItems = isMobile ? VISIBLE_ITEMS_MOBILE : VISIBLE_ITEMS;
|
|
7135
7231
|
const containerHeight = visibleItems * itemHeight;
|
|
7136
|
-
|
|
7232
|
+
useEffect15(() => {
|
|
7137
7233
|
if (containerRef.current && !isDragging) {
|
|
7138
7234
|
requestAnimationFrame(() => {
|
|
7139
7235
|
if (containerRef.current) {
|
|
@@ -7143,7 +7239,7 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7143
7239
|
});
|
|
7144
7240
|
}
|
|
7145
7241
|
}, [value, isDragging, itemHeight]);
|
|
7146
|
-
|
|
7242
|
+
useEffect15(() => {
|
|
7147
7243
|
return () => {
|
|
7148
7244
|
if (scrollTimeoutRef.current) {
|
|
7149
7245
|
clearTimeout(scrollTimeoutRef.current);
|
|
@@ -7188,55 +7284,44 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7188
7284
|
const handleMouseLeave = () => {
|
|
7189
7285
|
if (isDragging) handleMouseUp();
|
|
7190
7286
|
};
|
|
7287
|
+
const containerWidth = isMobile ? hideSeconds ? "w-16" : "w-8" : "w-16";
|
|
7191
7288
|
return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col items-center gap-1", children: [
|
|
7192
7289
|
/* @__PURE__ */ jsx57("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 }),
|
|
7193
|
-
/* @__PURE__ */
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
|
|
7229
|
-
),
|
|
7230
|
-
style: { height: `${itemHeight}px` },
|
|
7231
|
-
onClick: () => !isDragging && onChange(item),
|
|
7232
|
-
children: item.toString().padStart(2, "0")
|
|
7233
|
-
},
|
|
7234
|
-
item
|
|
7235
|
-
);
|
|
7236
|
-
})
|
|
7237
|
-
}
|
|
7238
|
-
)
|
|
7239
|
-
] })
|
|
7290
|
+
/* @__PURE__ */ jsx57("div", { className: cn("relative", containerWidth), children: /* @__PURE__ */ jsx57(
|
|
7291
|
+
"div",
|
|
7292
|
+
{
|
|
7293
|
+
ref: containerRef,
|
|
7294
|
+
className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
|
|
7295
|
+
onScroll: handleScroll,
|
|
7296
|
+
onMouseDown: handleMouseDown,
|
|
7297
|
+
onMouseMove: handleMouseMove,
|
|
7298
|
+
onMouseUp: handleMouseUp,
|
|
7299
|
+
onMouseLeave: handleMouseLeave,
|
|
7300
|
+
style: {
|
|
7301
|
+
height: `${containerHeight}px`,
|
|
7302
|
+
paddingTop: `${centerIndex * itemHeight}px`,
|
|
7303
|
+
paddingBottom: `${centerIndex * itemHeight}px`,
|
|
7304
|
+
cursor: isDragging ? "grabbing" : ""
|
|
7305
|
+
},
|
|
7306
|
+
children: items.map((item) => {
|
|
7307
|
+
const isSelected = item === value;
|
|
7308
|
+
return /* @__PURE__ */ jsx57(
|
|
7309
|
+
"div",
|
|
7310
|
+
{
|
|
7311
|
+
className: cn(
|
|
7312
|
+
"flex items-center justify-center select-none font-semibold tabular-nums",
|
|
7313
|
+
isDragging ? "cursor-grabbing" : "",
|
|
7314
|
+
isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
|
|
7315
|
+
),
|
|
7316
|
+
style: { height: `${itemHeight}px` },
|
|
7317
|
+
onClick: () => !isDragging && onChange(item),
|
|
7318
|
+
children: item.toString().padStart(2, "0")
|
|
7319
|
+
},
|
|
7320
|
+
item
|
|
7321
|
+
);
|
|
7322
|
+
})
|
|
7323
|
+
}
|
|
7324
|
+
) })
|
|
7240
7325
|
] });
|
|
7241
7326
|
}
|
|
7242
7327
|
function TimeScrollPicker({
|
|
@@ -7244,7 +7329,10 @@ function TimeScrollPicker({
|
|
|
7244
7329
|
setDate,
|
|
7245
7330
|
hideSeconds = false
|
|
7246
7331
|
}) {
|
|
7332
|
+
const isMobile = useIsMobile();
|
|
7247
7333
|
const currentDate = date || /* @__PURE__ */ new Date();
|
|
7334
|
+
const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
|
|
7335
|
+
const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
|
|
7248
7336
|
const handleTimeChange = (type, value) => {
|
|
7249
7337
|
const newDate = new Date(currentDate);
|
|
7250
7338
|
if (type === "hours") newDate.setHours(value);
|
|
@@ -7252,14 +7340,25 @@ function TimeScrollPicker({
|
|
|
7252
7340
|
else newDate.setSeconds(value);
|
|
7253
7341
|
setDate(newDate);
|
|
7254
7342
|
};
|
|
7255
|
-
return /* @__PURE__ */ jsx57("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ jsxs38("div", { className: "flex gap-2
|
|
7343
|
+
return /* @__PURE__ */ jsx57("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ jsxs38("div", { className: cn("relative flex gap-2"), children: [
|
|
7344
|
+
/* @__PURE__ */ jsx57(
|
|
7345
|
+
"div",
|
|
7346
|
+
{
|
|
7347
|
+
className: "absolute left-0 right-0 pointer-events-none z-10 rounded-md bg-primary/5",
|
|
7348
|
+
style: {
|
|
7349
|
+
top: `calc(1.75rem + ${centerIndex * itemHeight}px)`,
|
|
7350
|
+
height: `${itemHeight}px`
|
|
7351
|
+
}
|
|
7352
|
+
}
|
|
7353
|
+
),
|
|
7256
7354
|
/* @__PURE__ */ jsx57(
|
|
7257
7355
|
ScrollColumn,
|
|
7258
7356
|
{
|
|
7259
7357
|
value: currentDate.getHours(),
|
|
7260
7358
|
onChange: (v) => handleTimeChange("hours", v),
|
|
7261
7359
|
max: 24,
|
|
7262
|
-
label: "Hora"
|
|
7360
|
+
label: "Hora",
|
|
7361
|
+
hideSeconds
|
|
7263
7362
|
}
|
|
7264
7363
|
),
|
|
7265
7364
|
/* @__PURE__ */ jsx57(
|
|
@@ -7268,7 +7367,8 @@ function TimeScrollPicker({
|
|
|
7268
7367
|
value: currentDate.getMinutes(),
|
|
7269
7368
|
onChange: (v) => handleTimeChange("minutes", v),
|
|
7270
7369
|
max: 60,
|
|
7271
|
-
label: "Min"
|
|
7370
|
+
label: "Min",
|
|
7371
|
+
hideSeconds
|
|
7272
7372
|
}
|
|
7273
7373
|
),
|
|
7274
7374
|
!hideSeconds && /* @__PURE__ */ jsx57(
|
|
@@ -7277,14 +7377,46 @@ function TimeScrollPicker({
|
|
|
7277
7377
|
value: currentDate.getSeconds(),
|
|
7278
7378
|
onChange: (v) => handleTimeChange("seconds", v),
|
|
7279
7379
|
max: 60,
|
|
7280
|
-
label: "Seg"
|
|
7380
|
+
label: "Seg",
|
|
7381
|
+
hideSeconds
|
|
7281
7382
|
}
|
|
7282
7383
|
)
|
|
7283
7384
|
] }) });
|
|
7284
7385
|
}
|
|
7285
7386
|
|
|
7387
|
+
// src/hooks/use-auto-center.tsx
|
|
7388
|
+
import { useEffect as useEffect16, useRef as useRef9, useState as useState17 } from "react";
|
|
7389
|
+
function useAutoCenter(open) {
|
|
7390
|
+
const ref = useRef9(null);
|
|
7391
|
+
const [center, setCenter] = useState17(false);
|
|
7392
|
+
useEffect16(() => {
|
|
7393
|
+
if (!open) {
|
|
7394
|
+
setCenter(false);
|
|
7395
|
+
return;
|
|
7396
|
+
}
|
|
7397
|
+
let raf = 0;
|
|
7398
|
+
const check = () => {
|
|
7399
|
+
const el = ref.current;
|
|
7400
|
+
if (!el) return setCenter(false);
|
|
7401
|
+
const rect = el.getBoundingClientRect();
|
|
7402
|
+
const overflow = rect.left < 0 || rect.top < 0 || rect.right > window.innerWidth || rect.bottom > window.innerHeight;
|
|
7403
|
+
setCenter(Boolean(overflow));
|
|
7404
|
+
};
|
|
7405
|
+
raf = requestAnimationFrame(check);
|
|
7406
|
+
window.addEventListener("resize", check);
|
|
7407
|
+
window.addEventListener("scroll", check, { passive: true });
|
|
7408
|
+
return () => {
|
|
7409
|
+
cancelAnimationFrame(raf);
|
|
7410
|
+
window.removeEventListener("resize", check);
|
|
7411
|
+
window.removeEventListener("scroll", check);
|
|
7412
|
+
};
|
|
7413
|
+
}, [open]);
|
|
7414
|
+
return { ref, center };
|
|
7415
|
+
}
|
|
7416
|
+
var use_auto_center_default = useAutoCenter;
|
|
7417
|
+
|
|
7286
7418
|
// src/components/ui/picker/DateTimePicker.tsx
|
|
7287
|
-
import { jsx as jsx58, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
7419
|
+
import { Fragment as Fragment5, jsx as jsx58, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
7288
7420
|
function DateTimePicker({
|
|
7289
7421
|
label,
|
|
7290
7422
|
date,
|
|
@@ -7299,11 +7431,14 @@ function DateTimePicker({
|
|
|
7299
7431
|
className,
|
|
7300
7432
|
error
|
|
7301
7433
|
}) {
|
|
7302
|
-
const [internalDate, setInternalDate] =
|
|
7303
|
-
const [open, setOpen] =
|
|
7434
|
+
const [internalDate, setInternalDate] = useState18(date);
|
|
7435
|
+
const [open, setOpen] = useState18(false);
|
|
7436
|
+
const isMobile = useIsMobile();
|
|
7304
7437
|
const handleSelect = (newDay) => {
|
|
7305
7438
|
if (!newDay) return;
|
|
7306
7439
|
if (!internalDate) {
|
|
7440
|
+
const now = /* @__PURE__ */ new Date();
|
|
7441
|
+
newDay.setHours(now.getHours(), now.getMinutes(), now.getSeconds());
|
|
7307
7442
|
setInternalDate(newDay);
|
|
7308
7443
|
onChange?.(newDay);
|
|
7309
7444
|
return;
|
|
@@ -7331,110 +7466,153 @@ function DateTimePicker({
|
|
|
7331
7466
|
if (!timeFormat) return "dd MMMM yyyy";
|
|
7332
7467
|
return `dd MMMM yyyy - ${timeFormat}`;
|
|
7333
7468
|
};
|
|
7334
|
-
|
|
7469
|
+
useEffect17(() => {
|
|
7335
7470
|
setInternalDate(date);
|
|
7336
7471
|
}, [date, open]);
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
{
|
|
7349
|
-
variant: "outline",
|
|
7350
|
-
disabled,
|
|
7351
|
-
className: cn(
|
|
7352
|
-
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
7353
|
-
!date && "text-muted-foreground"
|
|
7354
|
-
),
|
|
7355
|
-
children: [
|
|
7356
|
-
/* @__PURE__ */ jsx58(
|
|
7357
|
-
"span",
|
|
7358
|
-
{
|
|
7359
|
-
className: cn(
|
|
7360
|
-
"truncate flex-1",
|
|
7361
|
-
!date && "text-muted-foreground"
|
|
7362
|
-
),
|
|
7363
|
-
children: date ? format(date, getDisplayFormat(), { locale: ptBR }) : "Selecione uma data"
|
|
7364
|
-
}
|
|
7365
|
-
),
|
|
7366
|
-
date && /* @__PURE__ */ jsx58(
|
|
7367
|
-
ClearButton,
|
|
7368
|
-
{
|
|
7369
|
-
className: "-mr-3",
|
|
7370
|
-
onClick: (e) => {
|
|
7371
|
-
e?.stopPropagation();
|
|
7372
|
-
setInternalDate(null);
|
|
7373
|
-
onChange?.(null);
|
|
7374
|
-
onConfirm?.(null);
|
|
7375
|
-
}
|
|
7376
|
-
}
|
|
7377
|
-
),
|
|
7378
|
-
/* @__PURE__ */ jsx58(CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
7379
|
-
]
|
|
7380
|
-
}
|
|
7381
|
-
)
|
|
7382
|
-
}
|
|
7472
|
+
const { ref: contentRef, center } = use_auto_center_default(open);
|
|
7473
|
+
const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none";
|
|
7474
|
+
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";
|
|
7475
|
+
const renderTriggerButton = () => /* @__PURE__ */ jsxs39(
|
|
7476
|
+
ButtonBase,
|
|
7477
|
+
{
|
|
7478
|
+
variant: "outline",
|
|
7479
|
+
disabled,
|
|
7480
|
+
className: cn(
|
|
7481
|
+
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
7482
|
+
!date && "text-muted-foreground"
|
|
7383
7483
|
),
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
/* @__PURE__ */
|
|
7484
|
+
children: [
|
|
7485
|
+
/* @__PURE__ */ jsx58("span", { className: cn("truncate flex-1", !date && "text-muted-foreground"), children: date ? format(date, getDisplayFormat(), { locale: ptBR2 }) : "Selecione uma data" }),
|
|
7486
|
+
date && /* @__PURE__ */ jsx58(
|
|
7487
|
+
ClearButton,
|
|
7488
|
+
{
|
|
7489
|
+
className: "-mr-3",
|
|
7490
|
+
onClick: (e) => {
|
|
7491
|
+
e?.stopPropagation();
|
|
7492
|
+
setInternalDate(null);
|
|
7493
|
+
onChange?.(null);
|
|
7494
|
+
onConfirm?.(null);
|
|
7495
|
+
}
|
|
7496
|
+
}
|
|
7497
|
+
),
|
|
7498
|
+
/* @__PURE__ */ jsx58(CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
7499
|
+
]
|
|
7500
|
+
}
|
|
7501
|
+
);
|
|
7502
|
+
const renderPickerContent = () => /* @__PURE__ */ jsxs39(Fragment5, { children: [
|
|
7503
|
+
/* @__PURE__ */ jsxs39(
|
|
7504
|
+
"div",
|
|
7505
|
+
{
|
|
7506
|
+
ref: contentRef,
|
|
7507
|
+
className: "flex sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
|
|
7508
|
+
children: [
|
|
7387
7509
|
/* @__PURE__ */ jsx58(
|
|
7388
7510
|
CalendarBase2,
|
|
7389
7511
|
{
|
|
7390
7512
|
mode: "single",
|
|
7391
|
-
locale:
|
|
7513
|
+
locale: ptBR2,
|
|
7392
7514
|
selected: internalDate ?? void 0,
|
|
7393
7515
|
onSelect: (d) => handleSelect(d ?? null),
|
|
7394
|
-
|
|
7516
|
+
autoFocus: true,
|
|
7395
7517
|
defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
|
|
7396
|
-
fromDate,
|
|
7397
|
-
toDate,
|
|
7518
|
+
...fromDate && { startMonth: fromDate },
|
|
7519
|
+
...toDate && { endMonth: toDate },
|
|
7520
|
+
...fromDate || toDate ? {
|
|
7521
|
+
hidden: [
|
|
7522
|
+
...fromDate ? [{ before: fromDate }] : [],
|
|
7523
|
+
...toDate ? [{ after: toDate }] : []
|
|
7524
|
+
]
|
|
7525
|
+
} : {},
|
|
7398
7526
|
className: cn(
|
|
7399
7527
|
"w-max rounded-none",
|
|
7400
|
-
!hideTime && "sm:rounded-r-none rounded-b-none"
|
|
7528
|
+
!hideTime && "sm:rounded-r-none rounded-b-none",
|
|
7529
|
+
isMobile ? "border-b-transparent w-full" : ""
|
|
7401
7530
|
)
|
|
7402
7531
|
}
|
|
7403
7532
|
),
|
|
7404
|
-
!hideTime && /* @__PURE__ */ jsxs39(
|
|
7405
|
-
|
|
7406
|
-
/* @__PURE__ */ jsx58(
|
|
7407
|
-
TimeScrollPicker,
|
|
7408
|
-
{
|
|
7409
|
-
setDate: (d) => handleTimeChange(d ?? null),
|
|
7410
|
-
date: internalDate,
|
|
7411
|
-
hideSeconds
|
|
7412
|
-
}
|
|
7413
|
-
)
|
|
7414
|
-
] })
|
|
7415
|
-
] }),
|
|
7416
|
-
/* @__PURE__ */ jsx58("div", { className: "flex border-none rounded-md", children: /* @__PURE__ */ jsxs39("div", { className: "grid grid-cols-2 w-full", children: [
|
|
7417
|
-
/* @__PURE__ */ jsx58(
|
|
7418
|
-
ButtonBase,
|
|
7419
|
-
{
|
|
7420
|
-
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",
|
|
7421
|
-
onClick: () => setOpen(false),
|
|
7422
|
-
children: "Cancelar"
|
|
7423
|
-
}
|
|
7424
|
-
),
|
|
7425
|
-
/* @__PURE__ */ jsx58(
|
|
7426
|
-
ButtonBase,
|
|
7533
|
+
!hideTime && /* @__PURE__ */ jsxs39(
|
|
7534
|
+
"div",
|
|
7427
7535
|
{
|
|
7428
|
-
className:
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7536
|
+
className: cn(
|
|
7537
|
+
"flex flex-col items-center justify-center",
|
|
7538
|
+
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"
|
|
7539
|
+
),
|
|
7540
|
+
children: [
|
|
7541
|
+
/* @__PURE__ */ jsx58("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" }),
|
|
7542
|
+
/* @__PURE__ */ jsx58(
|
|
7543
|
+
TimeScrollPicker,
|
|
7544
|
+
{
|
|
7545
|
+
setDate: (d) => handleTimeChange(d ?? null),
|
|
7546
|
+
date: internalDate,
|
|
7547
|
+
hideSeconds
|
|
7548
|
+
}
|
|
7549
|
+
)
|
|
7550
|
+
]
|
|
7434
7551
|
}
|
|
7435
7552
|
)
|
|
7436
|
-
]
|
|
7437
|
-
|
|
7553
|
+
]
|
|
7554
|
+
}
|
|
7555
|
+
),
|
|
7556
|
+
/* @__PURE__ */ jsx58("div", { className: "flex rounded-md -mt-4", children: /* @__PURE__ */ jsxs39("div", { className: "grid grid-cols-2 w-full", children: [
|
|
7557
|
+
/* @__PURE__ */ jsx58(
|
|
7558
|
+
ButtonBase,
|
|
7559
|
+
{
|
|
7560
|
+
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",
|
|
7561
|
+
onClick: () => setOpen(false),
|
|
7562
|
+
children: "Cancelar"
|
|
7563
|
+
}
|
|
7564
|
+
),
|
|
7565
|
+
/* @__PURE__ */ jsx58(
|
|
7566
|
+
ButtonBase,
|
|
7567
|
+
{
|
|
7568
|
+
className: cn(
|
|
7569
|
+
"no-active-animation rounded-none bg-emerald-600",
|
|
7570
|
+
internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed",
|
|
7571
|
+
isMobile ? "rounded-md-md" : "rounded-none"
|
|
7572
|
+
),
|
|
7573
|
+
disabled: !internalDate,
|
|
7574
|
+
onClick: () => {
|
|
7575
|
+
if (!internalDate) return;
|
|
7576
|
+
setOpen(false);
|
|
7577
|
+
onConfirm?.(internalDate);
|
|
7578
|
+
},
|
|
7579
|
+
children: "Confirmar"
|
|
7580
|
+
}
|
|
7581
|
+
)
|
|
7582
|
+
] }) })
|
|
7583
|
+
] });
|
|
7584
|
+
return /* @__PURE__ */ jsxs39("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
7585
|
+
label && /* @__PURE__ */ jsx58(LabelBase_default, { children: label }),
|
|
7586
|
+
isMobile ? /* @__PURE__ */ jsxs39(DialogBase, { open, onOpenChange: setOpen, children: [
|
|
7587
|
+
/* @__PURE__ */ jsx58(
|
|
7588
|
+
DialogTriggerBase,
|
|
7589
|
+
{
|
|
7590
|
+
disabled,
|
|
7591
|
+
asChild: true,
|
|
7592
|
+
className: cn(error && "border-red-500"),
|
|
7593
|
+
children: renderTriggerButton()
|
|
7594
|
+
}
|
|
7595
|
+
),
|
|
7596
|
+
/* @__PURE__ */ jsx58(ErrorMessage_default, { error }),
|
|
7597
|
+
/* @__PURE__ */ jsx58(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[90vh] overflow-hidden", children: renderPickerContent() })
|
|
7598
|
+
] }) : /* @__PURE__ */ jsxs39(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
7599
|
+
/* @__PURE__ */ jsx58(
|
|
7600
|
+
PopoverTriggerBase,
|
|
7601
|
+
{
|
|
7602
|
+
disabled,
|
|
7603
|
+
asChild: true,
|
|
7604
|
+
className: cn(error && "border-red-500"),
|
|
7605
|
+
children: renderTriggerButton()
|
|
7606
|
+
}
|
|
7607
|
+
),
|
|
7608
|
+
/* @__PURE__ */ jsx58(ErrorMessage_default, { error }),
|
|
7609
|
+
/* @__PURE__ */ jsx58(
|
|
7610
|
+
PopoverContentBase,
|
|
7611
|
+
{
|
|
7612
|
+
className: center ? centeredPopoverClass : basePopoverClass,
|
|
7613
|
+
children: renderPickerContent()
|
|
7614
|
+
}
|
|
7615
|
+
)
|
|
7438
7616
|
] })
|
|
7439
7617
|
] });
|
|
7440
7618
|
}
|
|
@@ -7444,17 +7622,17 @@ import * as React38 from "react";
|
|
|
7444
7622
|
import {
|
|
7445
7623
|
DayPicker as DayPicker3
|
|
7446
7624
|
} from "react-day-picker";
|
|
7447
|
-
import
|
|
7625
|
+
import ptBR3 from "date-fns/locale/pt-BR";
|
|
7448
7626
|
import { format as format2 } from "date-fns";
|
|
7449
7627
|
import {
|
|
7450
7628
|
CaretLeftIcon as CaretLeftIcon3,
|
|
7451
7629
|
CaretRightIcon as CaretRightIcon6,
|
|
7452
7630
|
CalendarBlankIcon as CalendarBlankIcon2
|
|
7453
7631
|
} from "@phosphor-icons/react";
|
|
7454
|
-
import { motion as motion11, AnimatePresence as
|
|
7632
|
+
import { motion as motion11, AnimatePresence as AnimatePresence7 } from "framer-motion";
|
|
7455
7633
|
import { CalendarDotIcon } from "@phosphor-icons/react/dist/ssr";
|
|
7456
7634
|
import { jsx as jsx59, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
7457
|
-
var dateFnsLocale =
|
|
7635
|
+
var dateFnsLocale = ptBR3?.default ?? ptBR3;
|
|
7458
7636
|
function RangePicker({
|
|
7459
7637
|
value,
|
|
7460
7638
|
onChange,
|
|
@@ -7479,6 +7657,9 @@ function RangePicker({
|
|
|
7479
7657
|
setRange(void 0);
|
|
7480
7658
|
onChange?.(void 0);
|
|
7481
7659
|
};
|
|
7660
|
+
const { ref: contentRef, center } = use_auto_center_default(open);
|
|
7661
|
+
const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border shadow-none";
|
|
7662
|
+
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";
|
|
7482
7663
|
return /* @__PURE__ */ jsxs40("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
7483
7664
|
label && /* @__PURE__ */ jsx59(LabelBase_default, { children: label }),
|
|
7484
7665
|
/* @__PURE__ */ jsxs40(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
@@ -7527,18 +7708,23 @@ function RangePicker({
|
|
|
7527
7708
|
}
|
|
7528
7709
|
),
|
|
7529
7710
|
/* @__PURE__ */ jsx59(ErrorMessage_default, { error }),
|
|
7530
|
-
/* @__PURE__ */ jsx59(
|
|
7711
|
+
/* @__PURE__ */ jsx59(AnimatePresence7, { children: open && /* @__PURE__ */ jsx59(
|
|
7531
7712
|
PopoverContentBase,
|
|
7532
7713
|
{
|
|
7533
7714
|
asChild: true,
|
|
7534
|
-
className:
|
|
7715
|
+
className: center ? centeredPopoverClass : basePopoverClass,
|
|
7716
|
+
side: "top",
|
|
7717
|
+
align: "center",
|
|
7718
|
+
sideOffset: -240,
|
|
7535
7719
|
children: /* @__PURE__ */ jsxs40(
|
|
7536
7720
|
motion11.div,
|
|
7537
7721
|
{
|
|
7538
|
-
|
|
7722
|
+
ref: contentRef,
|
|
7723
|
+
initial: { opacity: 0, y: -4 },
|
|
7539
7724
|
animate: { opacity: 1, y: 0 },
|
|
7540
|
-
exit: { opacity: 0, y:
|
|
7725
|
+
exit: { opacity: 0, y: -4 },
|
|
7541
7726
|
transition: { duration: 0.18, ease: "easeOut" },
|
|
7727
|
+
className: "border rounded-md shadow-xl ",
|
|
7542
7728
|
children: [
|
|
7543
7729
|
/* @__PURE__ */ jsx59("div", { className: "p-4", children: /* @__PURE__ */ jsx59(
|
|
7544
7730
|
motion11.div,
|
|
@@ -7556,43 +7742,52 @@ function RangePicker({
|
|
|
7556
7742
|
onSelect: handleSelect,
|
|
7557
7743
|
locale: dateFnsLocale,
|
|
7558
7744
|
showOutsideDays: true,
|
|
7559
|
-
|
|
7560
|
-
|
|
7745
|
+
fixedWeeks: true,
|
|
7746
|
+
weekStartsOn: 1,
|
|
7747
|
+
navLayout: "around",
|
|
7748
|
+
hidden: minDate || maxDate ? {
|
|
7749
|
+
before: minDate,
|
|
7750
|
+
after: maxDate
|
|
7751
|
+
} : void 0,
|
|
7561
7752
|
className: "min-w-0 flex flex-col",
|
|
7562
7753
|
classNames: {
|
|
7563
7754
|
months: "flex flex-col sm:flex-row gap-3 sm:gap-4 w-full",
|
|
7564
|
-
month: "flex-1 min-w-0",
|
|
7565
|
-
|
|
7566
|
-
caption_label: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize
|
|
7567
|
-
nav: "
|
|
7568
|
-
|
|
7755
|
+
month: "relative flex-1 min-w-0",
|
|
7756
|
+
month_caption: "flex items-center gap-2 min-h-[2.25rem] mb-4",
|
|
7757
|
+
caption_label: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize",
|
|
7758
|
+
nav: "block",
|
|
7759
|
+
button_previous: cn(
|
|
7760
|
+
buttonVariantsBase({ variant: "outline" }),
|
|
7761
|
+
"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"
|
|
7762
|
+
),
|
|
7763
|
+
button_next: cn(
|
|
7569
7764
|
buttonVariantsBase({ variant: "outline" }),
|
|
7570
|
-
"h-8 w-8
|
|
7765
|
+
"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"
|
|
7571
7766
|
),
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
"
|
|
7580
|
-
"[&:has([aria-selected].day-range-end)]:rounded-r-lg",
|
|
7581
|
-
"[&:has([aria-selected].day-range-start)]:rounded-l-lg",
|
|
7767
|
+
month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
|
|
7768
|
+
weekdays: "grid grid-cols-7 gap-1 mb-1",
|
|
7769
|
+
weekday: "text-muted-foreground rounded-md font-semibold text-[clamp(0.575rem,1.2vw,0.75rem)] sm:text-[clamp(0.65rem,1.1vw,0.825rem)] text-center pb-1 uppercase tracking-wider",
|
|
7770
|
+
week: "grid grid-cols-7 gap-1",
|
|
7771
|
+
day: cn(
|
|
7772
|
+
"min-w-0 h-9 sm:h-10 md:h-10 p-0 relative flex items-center justify-center",
|
|
7773
|
+
"[&:has([aria-selected].range-end)]:rounded-r-lg",
|
|
7774
|
+
"[&:has([aria-selected].range-start)]:rounded-l-lg",
|
|
7582
7775
|
"[&:has([aria-selected].day-outside)]:bg-muted/50",
|
|
7583
7776
|
"[&:has([aria-selected])]:bg-muted"
|
|
7584
7777
|
),
|
|
7585
|
-
|
|
7778
|
+
day_button: cn(
|
|
7586
7779
|
buttonVariantsBase({ variant: "ghost" }),
|
|
7587
7780
|
"w-full h-full p-0 m-0 flex items-center justify-center text-[clamp(0.775rem,1.2vw,0.95rem)] sm:text-sm",
|
|
7588
|
-
"aria-selected:opacity-100
|
|
7781
|
+
"aria-selected:opacity-100 transition-all duration-150 ease-out active:scale-95 hover:bg-background/20 hover:text-primary/90 rounded-none "
|
|
7589
7782
|
),
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7783
|
+
selected: "bg-primary text-primary-foreground font-semibold hover:text-white",
|
|
7784
|
+
today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
|
|
7785
|
+
outside: "day-outside text-muted-foreground/40 opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
|
|
7786
|
+
disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
|
|
7787
|
+
range_start: "range-start rounded-l-lg aria-selected:bg-primary aria-selected:text-primary-foreground",
|
|
7788
|
+
range_end: "range-end rounded-r-lg aria-selected:bg-primary aria-selected:text-primary-foreground",
|
|
7789
|
+
range_middle: "range-middle rounded-none aria-selected:bg-muted aria-selected:text-foreground",
|
|
7790
|
+
hidden: "invisible"
|
|
7596
7791
|
},
|
|
7597
7792
|
components: {
|
|
7598
7793
|
Chevron: ({ orientation }) => {
|
|
@@ -7652,12 +7847,16 @@ function RangePicker({
|
|
|
7652
7847
|
children: /* @__PURE__ */ jsx59(
|
|
7653
7848
|
ButtonBase,
|
|
7654
7849
|
{
|
|
7655
|
-
className:
|
|
7850
|
+
className: cn(
|
|
7851
|
+
"font-semibold w-full text-center",
|
|
7852
|
+
range?.from && range?.to ? "bg-emerald-600 hover:bg-emerald-700 text-white" : "opacity-50 cursor-not-allowed"
|
|
7853
|
+
),
|
|
7854
|
+
disabled: !range?.from || !range?.to,
|
|
7656
7855
|
onClick: () => {
|
|
7856
|
+
if (!range?.from || !range?.to) return;
|
|
7657
7857
|
onConfirm?.(range);
|
|
7658
7858
|
setOpen(false);
|
|
7659
7859
|
},
|
|
7660
|
-
disabled: !range?.from || !range?.to,
|
|
7661
7860
|
children: "Selecionar"
|
|
7662
7861
|
}
|
|
7663
7862
|
)
|
|
@@ -7675,7 +7874,7 @@ function RangePicker({
|
|
|
7675
7874
|
RangePicker.displayName = "RangePicker";
|
|
7676
7875
|
|
|
7677
7876
|
// src/components/ui/picker/TimePicker.tsx
|
|
7678
|
-
import { motion as motion12, AnimatePresence as
|
|
7877
|
+
import { motion as motion12, AnimatePresence as AnimatePresence8 } from "framer-motion";
|
|
7679
7878
|
import * as React40 from "react";
|
|
7680
7879
|
|
|
7681
7880
|
// src/components/ui/picker/TimePickerInput.tsx
|
|
@@ -8028,7 +8227,7 @@ var TimePickerInput = React39.forwardRef(
|
|
|
8028
8227
|
TimePickerInput.displayName = "TimePickerInput";
|
|
8029
8228
|
|
|
8030
8229
|
// src/components/ui/picker/TimePicker.tsx
|
|
8031
|
-
import { Fragment as
|
|
8230
|
+
import { Fragment as Fragment6, jsx as jsx61, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
8032
8231
|
function TimePicker({
|
|
8033
8232
|
date,
|
|
8034
8233
|
setDate,
|
|
@@ -8098,7 +8297,7 @@ function TimePicker({
|
|
|
8098
8297
|
)
|
|
8099
8298
|
}
|
|
8100
8299
|
),
|
|
8101
|
-
/* @__PURE__ */ jsx61(
|
|
8300
|
+
/* @__PURE__ */ jsx61(AnimatePresence8, { children: !hideSeconds && /* @__PURE__ */ jsx61(Fragment6, { children: /* @__PURE__ */ jsx61(
|
|
8102
8301
|
motion12.div,
|
|
8103
8302
|
{
|
|
8104
8303
|
variants: itemVariants2,
|
|
@@ -8132,11 +8331,11 @@ import {
|
|
|
8132
8331
|
endOfMonth,
|
|
8133
8332
|
eachDayOfInterval
|
|
8134
8333
|
} from "date-fns";
|
|
8135
|
-
import { ptBR as
|
|
8334
|
+
import { ptBR as ptBR4 } from "date-fns/locale";
|
|
8136
8335
|
import { useMemo as useMemo6 } from "react";
|
|
8137
8336
|
import { CalendarIcon as CalendarIcon2 } from "@phosphor-icons/react";
|
|
8138
8337
|
import { twMerge as twMerge2 } from "tailwind-merge";
|
|
8139
|
-
import { Fragment as
|
|
8338
|
+
import { Fragment as Fragment7, jsx as jsx62, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
8140
8339
|
function Agenda({
|
|
8141
8340
|
currentDate,
|
|
8142
8341
|
events,
|
|
@@ -8175,7 +8374,7 @@ function Agenda({
|
|
|
8175
8374
|
/* @__PURE__ */ jsx62(CalendarIcon2, { className: "mb-2 text-muted-foreground/50", size: 32 }),
|
|
8176
8375
|
/* @__PURE__ */ jsx62("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" }),
|
|
8177
8376
|
/* @__PURE__ */ jsx62("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." })
|
|
8178
|
-
] }) : /* @__PURE__ */ jsxs43(
|
|
8377
|
+
] }) : /* @__PURE__ */ jsxs43(Fragment7, { children: [
|
|
8179
8378
|
days.map((day) => {
|
|
8180
8379
|
const dayEvents = getAgendaEventsForDayAgenda(datedEvents, day);
|
|
8181
8380
|
if (dayEvents.length === 0) return null;
|
|
@@ -8191,13 +8390,13 @@ function Agenda({
|
|
|
8191
8390
|
"span",
|
|
8192
8391
|
{
|
|
8193
8392
|
className: twMerge2(
|
|
8194
|
-
"-top-3 absolute left-0 flex h-6 items-center bg-background pe-4
|
|
8393
|
+
"-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",
|
|
8195
8394
|
isToday(day) ? "text-blue-500" : ""
|
|
8196
8395
|
),
|
|
8197
8396
|
"data-today": isToday(day) || void 0,
|
|
8198
8397
|
children: [
|
|
8199
8398
|
(() => {
|
|
8200
|
-
const s = format3(day, "d MMM, EEEE", { locale:
|
|
8399
|
+
const s = format3(day, "d MMM, EEEE", { locale: ptBR4 });
|
|
8201
8400
|
return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
|
|
8202
8401
|
})(),
|
|
8203
8402
|
isToday(day) ? " - Hoje" : ""
|
|
@@ -8242,7 +8441,7 @@ import {
|
|
|
8242
8441
|
useSensors
|
|
8243
8442
|
} from "@dnd-kit/core";
|
|
8244
8443
|
import { addMinutes, differenceInMinutes } from "date-fns";
|
|
8245
|
-
import { useId, useRef as
|
|
8444
|
+
import { useId, useRef as useRef11, useState as useState20 } from "react";
|
|
8246
8445
|
|
|
8247
8446
|
// src/components/ui/event-calendar-view/hooks.ts
|
|
8248
8447
|
import { createContext as createContext5, useContext as useContext6 } from "react";
|
|
@@ -8264,19 +8463,19 @@ function CalendarDndProviderAgenda({
|
|
|
8264
8463
|
children,
|
|
8265
8464
|
onEventUpdate
|
|
8266
8465
|
}) {
|
|
8267
|
-
const [activeEvent, setActiveEvent] =
|
|
8466
|
+
const [activeEvent, setActiveEvent] = useState20(
|
|
8268
8467
|
null
|
|
8269
8468
|
);
|
|
8270
|
-
const [activeId, setActiveId] =
|
|
8271
|
-
const [activeView, setActiveView] =
|
|
8469
|
+
const [activeId, setActiveId] = useState20(null);
|
|
8470
|
+
const [activeView, setActiveView] = useState20(
|
|
8272
8471
|
null
|
|
8273
8472
|
);
|
|
8274
|
-
const [currentTime, setCurrentTime] =
|
|
8275
|
-
const [eventHeight, setEventHeight] =
|
|
8276
|
-
const [isMultiDay, setIsMultiDay] =
|
|
8277
|
-
const [multiDayWidth, setMultiDayWidth] =
|
|
8278
|
-
const [dragHandlePosition, setDragHandlePosition] =
|
|
8279
|
-
const eventDimensions =
|
|
8473
|
+
const [currentTime, setCurrentTime] = useState20(null);
|
|
8474
|
+
const [eventHeight, setEventHeight] = useState20(null);
|
|
8475
|
+
const [isMultiDay, setIsMultiDay] = useState20(false);
|
|
8476
|
+
const [multiDayWidth, setMultiDayWidth] = useState20(null);
|
|
8477
|
+
const [dragHandlePosition, setDragHandlePosition] = useState20(null);
|
|
8478
|
+
const eventDimensions = useRef11({ height: 0 });
|
|
8280
8479
|
const sensors = useSensors(
|
|
8281
8480
|
useSensor(MouseSensor, {
|
|
8282
8481
|
// Require the mouse to move by 5px before activating
|
|
@@ -8636,12 +8835,12 @@ function addHoursToDateAgenda(date, hours) {
|
|
|
8636
8835
|
|
|
8637
8836
|
// src/components/ui/event-calendar-view/hooks/use-current-time-indicator.ts
|
|
8638
8837
|
import { endOfWeek, isSameDay as isSameDay2, isWithinInterval, startOfWeek } from "date-fns";
|
|
8639
|
-
import { ptBR as
|
|
8640
|
-
import { useEffect as
|
|
8838
|
+
import { ptBR as ptBR5 } from "date-fns/locale";
|
|
8839
|
+
import { useEffect as useEffect19, useState as useState21 } from "react";
|
|
8641
8840
|
function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
8642
|
-
const [currentTimePosition, setCurrentTimePosition] =
|
|
8643
|
-
const [currentTimeVisible, setCurrentTimeVisible] =
|
|
8644
|
-
|
|
8841
|
+
const [currentTimePosition, setCurrentTimePosition] = useState21(0);
|
|
8842
|
+
const [currentTimeVisible, setCurrentTimeVisible] = useState21(false);
|
|
8843
|
+
useEffect19(() => {
|
|
8645
8844
|
const calculateTimePosition = () => {
|
|
8646
8845
|
const now = /* @__PURE__ */ new Date();
|
|
8647
8846
|
const hours = now.getHours();
|
|
@@ -8654,8 +8853,8 @@ function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
|
8654
8853
|
if (view === "day") {
|
|
8655
8854
|
isCurrentTimeVisible = isSameDay2(now, currentDate);
|
|
8656
8855
|
} else if (view === "week") {
|
|
8657
|
-
const startOfWeekDate = startOfWeek(currentDate, { locale:
|
|
8658
|
-
const endOfWeekDate = endOfWeek(currentDate, { locale:
|
|
8856
|
+
const startOfWeekDate = startOfWeek(currentDate, { locale: ptBR5 });
|
|
8857
|
+
const endOfWeekDate = endOfWeek(currentDate, { locale: ptBR5 });
|
|
8659
8858
|
isCurrentTimeVisible = isWithinInterval(now, {
|
|
8660
8859
|
end: endOfWeekDate,
|
|
8661
8860
|
start: startOfWeekDate
|
|
@@ -8674,7 +8873,7 @@ function useCurrentTimeIndicatorAgenda(currentDate, view) {
|
|
|
8674
8873
|
// src/components/ui/event-calendar-view/EventItemAgenda.tsx
|
|
8675
8874
|
import { differenceInMinutes as differenceInMinutes2, format as format4, isPast } from "date-fns";
|
|
8676
8875
|
import { useMemo as useMemo7 } from "react";
|
|
8677
|
-
import { Fragment as
|
|
8876
|
+
import { Fragment as Fragment8, jsx as jsx64, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
8678
8877
|
var formatTimeWithOptionalMinutes = (date) => {
|
|
8679
8878
|
return format4(date, "HH:mm");
|
|
8680
8879
|
};
|
|
@@ -8860,7 +9059,7 @@ function EventItemAgenda({
|
|
|
8860
9059
|
}
|
|
8861
9060
|
),
|
|
8862
9061
|
showTime && hasValidTime && displayStart && /* @__PURE__ */ jsx64("span", { className: "ml-2 flex items-center gap-3 bg-white/10 py-0.5 rounded-full opacity-90 text-sm sm:text-base md:text-lg min-w-0", children: formatTimeWithOptionalMinutes(displayStart) })
|
|
8863
|
-
] }) : /* @__PURE__ */ jsxs45(
|
|
9062
|
+
] }) : /* @__PURE__ */ jsxs45(Fragment8, { children: [
|
|
8864
9063
|
/* @__PURE__ */ jsx64(
|
|
8865
9064
|
"div",
|
|
8866
9065
|
{
|
|
@@ -9255,15 +9454,15 @@ import {
|
|
|
9255
9454
|
subMonths,
|
|
9256
9455
|
subWeeks
|
|
9257
9456
|
} from "date-fns";
|
|
9258
|
-
import { ptBR as
|
|
9259
|
-
import React42, { useMemo as useMemo10, useState as
|
|
9457
|
+
import { ptBR as ptBR6 } from "date-fns/locale";
|
|
9458
|
+
import React42, { useMemo as useMemo10, useState as useState23 } from "react";
|
|
9260
9459
|
import { toast as toast2 } from "sonner";
|
|
9261
9460
|
import { CaretLeftIcon as CaretLeftIcon5, CaretRightIcon as CaretRightIcon8 } from "@phosphor-icons/react";
|
|
9262
9461
|
|
|
9263
9462
|
// src/components/ui/selects/Select.tsx
|
|
9264
|
-
import { useEffect as
|
|
9463
|
+
import { useEffect as useEffect20, useMemo as useMemo9, useState as useState22 } from "react";
|
|
9265
9464
|
import { CaretLeftIcon as CaretLeftIcon4, CaretRightIcon as CaretRightIcon7 } from "@phosphor-icons/react";
|
|
9266
|
-
import { Fragment as
|
|
9465
|
+
import { Fragment as Fragment9, jsx as jsx67, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
9267
9466
|
function Select({
|
|
9268
9467
|
items,
|
|
9269
9468
|
groupItems,
|
|
@@ -9278,10 +9477,10 @@ function Select({
|
|
|
9278
9477
|
className,
|
|
9279
9478
|
pagination
|
|
9280
9479
|
}) {
|
|
9281
|
-
const [page, setPage] =
|
|
9282
|
-
const [animating, setAnimating] =
|
|
9480
|
+
const [page, setPage] = useState22(1);
|
|
9481
|
+
const [animating, setAnimating] = useState22(false);
|
|
9283
9482
|
const groupCount = groupItems ? Object.keys(groupItems).length : 0;
|
|
9284
|
-
|
|
9483
|
+
useEffect20(() => {
|
|
9285
9484
|
setPage(1);
|
|
9286
9485
|
}, [items?.length, groupCount, pagination]);
|
|
9287
9486
|
const paged = useMemo9(() => {
|
|
@@ -9311,7 +9510,7 @@ function Select({
|
|
|
9311
9510
|
}, [items, groupItems, page, pagination]);
|
|
9312
9511
|
const goPrev = () => setPage((p) => Math.max(1, p - 1));
|
|
9313
9512
|
const goNext = () => setPage((p) => paged ? Math.min(paged.totalPages, p + 1) : p + 1);
|
|
9314
|
-
|
|
9513
|
+
useEffect20(() => {
|
|
9315
9514
|
if (!pagination) return;
|
|
9316
9515
|
setAnimating(true);
|
|
9317
9516
|
const id = setTimeout(() => setAnimating(false), 220);
|
|
@@ -9345,7 +9544,7 @@ function Select({
|
|
|
9345
9544
|
)
|
|
9346
9545
|
}
|
|
9347
9546
|
),
|
|
9348
|
-
/* @__PURE__ */ jsx67(ScrollAreaBase, { "data-testid": testIds.scrollarea ?? "select-scrollarea", children: /* @__PURE__ */ jsx67(SelectContentBase, { "data-testid": testIds.content ?? "select-content", children: pagination && pagination > 0 ? /* @__PURE__ */ jsxs47(
|
|
9547
|
+
/* @__PURE__ */ jsx67(ScrollAreaBase, { "data-testid": testIds.scrollarea ?? "select-scrollarea", children: /* @__PURE__ */ jsx67(SelectContentBase, { "data-testid": testIds.content ?? "select-content", children: pagination && pagination > 0 ? /* @__PURE__ */ jsxs47(Fragment9, { children: [
|
|
9349
9548
|
/* @__PURE__ */ jsx67(
|
|
9350
9549
|
"div",
|
|
9351
9550
|
{
|
|
@@ -9418,7 +9617,7 @@ function Select({
|
|
|
9418
9617
|
}
|
|
9419
9618
|
)
|
|
9420
9619
|
] })
|
|
9421
|
-
] }) : /* @__PURE__ */ jsx67(
|
|
9620
|
+
] }) : /* @__PURE__ */ jsx67(Fragment9, { children: groupItems ? /* @__PURE__ */ jsx67(Fragment9, { children: Object.keys(groupItems).map((key) => /* @__PURE__ */ jsxs47(
|
|
9422
9621
|
SelectGroupBase,
|
|
9423
9622
|
{
|
|
9424
9623
|
"data-testid": testIds.group ?? "select-group",
|
|
@@ -9474,11 +9673,11 @@ function EventAgenda({
|
|
|
9474
9673
|
initialDate,
|
|
9475
9674
|
onClick
|
|
9476
9675
|
}) {
|
|
9477
|
-
const [currentDate, setCurrentDate] =
|
|
9676
|
+
const [currentDate, setCurrentDate] = useState23(
|
|
9478
9677
|
initialDate && new Date(initialDate) || /* @__PURE__ */ new Date()
|
|
9479
9678
|
);
|
|
9480
|
-
const [view, setView] =
|
|
9481
|
-
const [selectedEvent, setSelectedEvent] =
|
|
9679
|
+
const [view, setView] = useState23(initialView);
|
|
9680
|
+
const [selectedEvent, setSelectedEvent] = useState23(null);
|
|
9482
9681
|
const goPrevious = () => {
|
|
9483
9682
|
if (view === "month") setCurrentDate((d) => subMonths(d, 1));
|
|
9484
9683
|
else if (view === "week") setCurrentDate((d) => subWeeks(d, 1));
|
|
@@ -9520,7 +9719,7 @@ function EventAgenda({
|
|
|
9520
9719
|
onEventUpdate?.(updatedEvent);
|
|
9521
9720
|
const startDate = new Date(updatedEvent.start);
|
|
9522
9721
|
toast2(`Evento "${updatedEvent.title}" movido`, {
|
|
9523
|
-
description: format6(startDate, "d 'de' MMMM 'de' yyyy", { locale:
|
|
9722
|
+
description: format6(startDate, "d 'de' MMMM 'de' yyyy", { locale: ptBR6 }),
|
|
9524
9723
|
position: "bottom-left"
|
|
9525
9724
|
});
|
|
9526
9725
|
};
|
|
@@ -9537,23 +9736,23 @@ function EventAgenda({
|
|
|
9537
9736
|
const viewTitle = useMemo10(() => {
|
|
9538
9737
|
const capitalize = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
9539
9738
|
if (view === "month")
|
|
9540
|
-
return capitalize(format6(currentDate, "MMMM yyyy", { locale:
|
|
9739
|
+
return capitalize(format6(currentDate, "MMMM yyyy", { locale: ptBR6 }));
|
|
9541
9740
|
if (view === "week") {
|
|
9542
9741
|
const start = startOfWeek2(currentDate, { weekStartsOn: 1 });
|
|
9543
9742
|
const end = endOfWeek2(currentDate, { weekStartsOn: 1 });
|
|
9544
9743
|
if (isSameMonth(start, end))
|
|
9545
|
-
return capitalize(format6(start, "MMMM yyyy", { locale:
|
|
9546
|
-
const s1 = capitalize(format6(start, "MMM", { locale:
|
|
9547
|
-
const s2 = capitalize(format6(end, "MMM yyyy", { locale:
|
|
9744
|
+
return capitalize(format6(start, "MMMM yyyy", { locale: ptBR6 }));
|
|
9745
|
+
const s1 = capitalize(format6(start, "MMM", { locale: ptBR6 }));
|
|
9746
|
+
const s2 = capitalize(format6(end, "MMM yyyy", { locale: ptBR6 }));
|
|
9548
9747
|
return `${s1} - ${s2}`;
|
|
9549
9748
|
}
|
|
9550
9749
|
if (view === "day")
|
|
9551
|
-
return format6(currentDate, "d 'de' MMMM 'de' yyyy", { locale:
|
|
9750
|
+
return format6(currentDate, "d 'de' MMMM 'de' yyyy", { locale: ptBR6 });
|
|
9552
9751
|
if (view === "agenda") {
|
|
9553
9752
|
const start = currentDate;
|
|
9554
|
-
return capitalize(format6(start, "MMMM yyyy", { locale:
|
|
9753
|
+
return capitalize(format6(start, "MMMM yyyy", { locale: ptBR6 }));
|
|
9555
9754
|
}
|
|
9556
|
-
return capitalize(format6(currentDate, "MMMM yyyy", { locale:
|
|
9755
|
+
return capitalize(format6(currentDate, "MMMM yyyy", { locale: ptBR6 }));
|
|
9557
9756
|
}, [currentDate, view]);
|
|
9558
9757
|
const selectItems = ["month", "week", "day", "agenda"].map((v) => ({
|
|
9559
9758
|
label: viewLabel(v),
|
|
@@ -9703,14 +9902,14 @@ function UndatedEvents({
|
|
|
9703
9902
|
}
|
|
9704
9903
|
|
|
9705
9904
|
// src/components/ui/event-calendar-view/hooks/use-event-visibility.ts
|
|
9706
|
-
import { useLayoutEffect, useMemo as useMemo12, useRef as
|
|
9905
|
+
import { useLayoutEffect, useMemo as useMemo12, useRef as useRef12, useState as useState24 } from "react";
|
|
9707
9906
|
function useEventVisibilityAgenda({
|
|
9708
9907
|
eventHeight,
|
|
9709
9908
|
eventGap
|
|
9710
9909
|
}) {
|
|
9711
|
-
const contentRef =
|
|
9712
|
-
const observerRef =
|
|
9713
|
-
const [contentHeight, setContentHeight] =
|
|
9910
|
+
const contentRef = useRef12(null);
|
|
9911
|
+
const observerRef = useRef12(null);
|
|
9912
|
+
const [contentHeight, setContentHeight] = useState24(null);
|
|
9714
9913
|
useLayoutEffect(() => {
|
|
9715
9914
|
if (!contentRef.current) return;
|
|
9716
9915
|
const updateHeight = () => {
|
|
@@ -9761,8 +9960,8 @@ import {
|
|
|
9761
9960
|
startOfMonth as startOfMonth2,
|
|
9762
9961
|
startOfWeek as startOfWeek3
|
|
9763
9962
|
} from "date-fns";
|
|
9764
|
-
import { ptBR as
|
|
9765
|
-
import { useEffect as
|
|
9963
|
+
import { ptBR as ptBR7 } from "date-fns/locale";
|
|
9964
|
+
import { useEffect as useEffect21, useMemo as useMemo13, useState as useState25 } from "react";
|
|
9766
9965
|
import { twMerge as twMerge3 } from "tailwind-merge";
|
|
9767
9966
|
import { jsx as jsx70, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
9768
9967
|
function MonthViewAgenda({
|
|
@@ -9781,7 +9980,7 @@ function MonthViewAgenda({
|
|
|
9781
9980
|
const weekdays = useMemo13(() => {
|
|
9782
9981
|
return Array.from({ length: 7 }).map((_, i) => {
|
|
9783
9982
|
const date = addDays2(startOfWeek3(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
|
|
9784
|
-
const short = format7(date, "EEE", { locale:
|
|
9983
|
+
const short = format7(date, "EEE", { locale: ptBR7 });
|
|
9785
9984
|
return short.charAt(0).toUpperCase() + short.slice(1);
|
|
9786
9985
|
});
|
|
9787
9986
|
}, []);
|
|
@@ -9801,12 +10000,12 @@ function MonthViewAgenda({
|
|
|
9801
10000
|
e.stopPropagation();
|
|
9802
10001
|
onEventSelect(event, e);
|
|
9803
10002
|
};
|
|
9804
|
-
const [isMounted, setIsMounted] =
|
|
10003
|
+
const [isMounted, setIsMounted] = useState25(false);
|
|
9805
10004
|
const { contentRef, getVisibleEventCount } = useEventVisibilityAgenda({
|
|
9806
10005
|
eventGap: EventGapAgenda,
|
|
9807
10006
|
eventHeight: EventHeightAgenda
|
|
9808
10007
|
});
|
|
9809
|
-
|
|
10008
|
+
useEffect21(() => {
|
|
9810
10009
|
setIsMounted(true);
|
|
9811
10010
|
}, []);
|
|
9812
10011
|
return /* @__PURE__ */ jsxs50("div", { className: "contents", "data-slot": "month-view", children: [
|
|
@@ -9945,7 +10144,7 @@ function MonthViewAgenda({
|
|
|
9945
10144
|
"aria-label": `Show ${remainingCount} more events on ${format7(
|
|
9946
10145
|
day,
|
|
9947
10146
|
"PPP",
|
|
9948
|
-
{ locale:
|
|
10147
|
+
{ locale: ptBR7 }
|
|
9949
10148
|
)}`,
|
|
9950
10149
|
children: [
|
|
9951
10150
|
/* @__PURE__ */ jsxs50("span", { className: "font-medium", children: [
|
|
@@ -9965,7 +10164,7 @@ function MonthViewAgenda({
|
|
|
9965
10164
|
"--event-height": `${EventHeightAgenda}px`
|
|
9966
10165
|
},
|
|
9967
10166
|
children: /* @__PURE__ */ jsxs50("div", { className: "space-y-2", children: [
|
|
9968
|
-
/* @__PURE__ */ jsx70("div", { className: "font-medium text-sm", children: format7(day, "EEE d", { locale:
|
|
10167
|
+
/* @__PURE__ */ jsx70("div", { className: "font-medium text-sm", children: format7(day, "EEE d", { locale: ptBR7 }) }),
|
|
9969
10168
|
/* @__PURE__ */ jsx70("div", { className: "space-y-1", children: sortEventsAgenda(allEvents).map((event) => {
|
|
9970
10169
|
const eventStart = getEventStartDate(event) ?? getEventEndDate(event) ?? /* @__PURE__ */ new Date();
|
|
9971
10170
|
const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
@@ -10029,7 +10228,7 @@ import {
|
|
|
10029
10228
|
startOfDay as startOfDay2,
|
|
10030
10229
|
startOfWeek as startOfWeek4
|
|
10031
10230
|
} from "date-fns";
|
|
10032
|
-
import { ptBR as
|
|
10231
|
+
import { ptBR as ptBR8 } from "date-fns/locale";
|
|
10033
10232
|
import { useMemo as useMemo14 } from "react";
|
|
10034
10233
|
|
|
10035
10234
|
// src/components/ui/event-calendar/constants.ts
|
|
@@ -10046,7 +10245,7 @@ var DefaultEndHour = 10;
|
|
|
10046
10245
|
import { useDraggable } from "@dnd-kit/core";
|
|
10047
10246
|
import { CSS } from "@dnd-kit/utilities";
|
|
10048
10247
|
import { differenceInDays } from "date-fns";
|
|
10049
|
-
import { useRef as
|
|
10248
|
+
import { useRef as useRef13, useState as useState26 } from "react";
|
|
10050
10249
|
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
10051
10250
|
function DraggableEvent({
|
|
10052
10251
|
event,
|
|
@@ -10062,8 +10261,8 @@ function DraggableEvent({
|
|
|
10062
10261
|
draggable = true
|
|
10063
10262
|
}) {
|
|
10064
10263
|
const { activeId } = useCalendarDndAgenda();
|
|
10065
|
-
const elementRef =
|
|
10066
|
-
const [dragHandlePosition, setDragHandlePosition] =
|
|
10264
|
+
const elementRef = useRef13(null);
|
|
10265
|
+
const [dragHandlePosition, setDragHandlePosition] = useState26(null);
|
|
10067
10266
|
const eventStart = getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
10068
10267
|
const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
|
|
10069
10268
|
const isMultiDayEvent2 = isMultiDay || event.allDay || differenceInDays(eventEnd, eventStart) >= 1;
|
|
@@ -10290,11 +10489,11 @@ function WeekViewAgenda({
|
|
|
10290
10489
|
"data-today": isToday3(day) || void 0,
|
|
10291
10490
|
children: [
|
|
10292
10491
|
/* @__PURE__ */ jsxs51("span", { "aria-hidden": "true", className: "sm:hidden", children: [
|
|
10293
|
-
format8(day, "EEE", { locale:
|
|
10492
|
+
format8(day, "EEE", { locale: ptBR8 })[0],
|
|
10294
10493
|
" ",
|
|
10295
|
-
format8(day, "d", { locale:
|
|
10494
|
+
format8(day, "d", { locale: ptBR8 })
|
|
10296
10495
|
] }),
|
|
10297
|
-
/* @__PURE__ */ jsx72("span", { className: "max-sm:hidden", children: format8(day, "EEE dd", { locale:
|
|
10496
|
+
/* @__PURE__ */ jsx72("span", { className: "max-sm:hidden", children: format8(day, "EEE dd", { locale: ptBR8 }) })
|
|
10298
10497
|
]
|
|
10299
10498
|
},
|
|
10300
10499
|
day.toString()
|
|
@@ -10455,10 +10654,10 @@ function WeekViewAgenda({
|
|
|
10455
10654
|
|
|
10456
10655
|
// src/components/ui/event-calendar/AgendaView.tsx
|
|
10457
10656
|
import { addDays as addDays3, format as format9, isToday as isToday4 } from "date-fns";
|
|
10458
|
-
import { ptBR as
|
|
10657
|
+
import { ptBR as ptBR9 } from "date-fns/locale";
|
|
10459
10658
|
import { useMemo as useMemo15 } from "react";
|
|
10460
10659
|
import { CalendarIcon as CalendarIcon3 } from "@phosphor-icons/react";
|
|
10461
|
-
import { Fragment as
|
|
10660
|
+
import { Fragment as Fragment10, jsx as jsx73, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
10462
10661
|
function AgendaView({
|
|
10463
10662
|
currentDate,
|
|
10464
10663
|
events,
|
|
@@ -10498,7 +10697,7 @@ function AgendaView({
|
|
|
10498
10697
|
/* @__PURE__ */ jsx73(CalendarIcon3, { className: "mb-2 text-muted-foreground/50", size: 32 }),
|
|
10499
10698
|
/* @__PURE__ */ jsx73("h3", { className: "font-medium text-lg", children: "Nenhum evento encontrado" }),
|
|
10500
10699
|
/* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
|
|
10501
|
-
] }) : /* @__PURE__ */ jsxs52(
|
|
10700
|
+
] }) : /* @__PURE__ */ jsxs52(Fragment10, { children: [
|
|
10502
10701
|
days.map((day) => {
|
|
10503
10702
|
const dayEvents = getAgendaEventsForDay(datedEvents, day);
|
|
10504
10703
|
if (dayEvents.length === 0) return null;
|
|
@@ -10513,7 +10712,7 @@ function AgendaView({
|
|
|
10513
10712
|
className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 text-[10px] uppercase data-today:font-medium sm:pe-4 sm:text-xs",
|
|
10514
10713
|
"data-today": isToday4(day) || void 0,
|
|
10515
10714
|
children: (() => {
|
|
10516
|
-
const s = format9(day, "d MMM, EEEE", { locale:
|
|
10715
|
+
const s = format9(day, "d MMM, EEEE", { locale: ptBR9 });
|
|
10517
10716
|
return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
|
|
10518
10717
|
})()
|
|
10519
10718
|
}
|
|
@@ -10562,7 +10761,7 @@ import {
|
|
|
10562
10761
|
useSensors as useSensors2
|
|
10563
10762
|
} from "@dnd-kit/core";
|
|
10564
10763
|
import { addMinutes as addMinutes2, differenceInMinutes as differenceInMinutes5 } from "date-fns";
|
|
10565
|
-
import { useId as useId2, useRef as
|
|
10764
|
+
import { useId as useId2, useRef as useRef14, useState as useState27 } from "react";
|
|
10566
10765
|
|
|
10567
10766
|
// src/components/ui/event-calendar/hooks.ts
|
|
10568
10767
|
import { createContext as createContext6, useContext as useContext7 } from "react";
|
|
@@ -10584,17 +10783,17 @@ function CalendarDndProvider({
|
|
|
10584
10783
|
children,
|
|
10585
10784
|
onEventUpdate
|
|
10586
10785
|
}) {
|
|
10587
|
-
const [activeEvent, setActiveEvent] =
|
|
10588
|
-
const [activeId, setActiveId] =
|
|
10589
|
-
const [activeView, setActiveView] =
|
|
10786
|
+
const [activeEvent, setActiveEvent] = useState27(null);
|
|
10787
|
+
const [activeId, setActiveId] = useState27(null);
|
|
10788
|
+
const [activeView, setActiveView] = useState27(
|
|
10590
10789
|
null
|
|
10591
10790
|
);
|
|
10592
|
-
const [currentTime, setCurrentTime] =
|
|
10593
|
-
const [eventHeight, setEventHeight] =
|
|
10594
|
-
const [isMultiDay, setIsMultiDay] =
|
|
10595
|
-
const [multiDayWidth, setMultiDayWidth] =
|
|
10596
|
-
const [dragHandlePosition, setDragHandlePosition] =
|
|
10597
|
-
const eventDimensions =
|
|
10791
|
+
const [currentTime, setCurrentTime] = useState27(null);
|
|
10792
|
+
const [eventHeight, setEventHeight] = useState27(null);
|
|
10793
|
+
const [isMultiDay, setIsMultiDay] = useState27(false);
|
|
10794
|
+
const [multiDayWidth, setMultiDayWidth] = useState27(null);
|
|
10795
|
+
const [dragHandlePosition, setDragHandlePosition] = useState27(null);
|
|
10796
|
+
const eventDimensions = useRef14({ height: 0 });
|
|
10598
10797
|
const sensors = useSensors2(
|
|
10599
10798
|
useSensor2(MouseSensor2, {
|
|
10600
10799
|
// Require the mouse to move by 5px before activating
|
|
@@ -11023,7 +11222,7 @@ function DayView({
|
|
|
11023
11222
|
import { useDraggable as useDraggable2 } from "@dnd-kit/core";
|
|
11024
11223
|
import { CSS as CSS2 } from "@dnd-kit/utilities";
|
|
11025
11224
|
import { differenceInDays as differenceInDays2 } from "date-fns";
|
|
11026
|
-
import { useRef as
|
|
11225
|
+
import { useRef as useRef15, useState as useState28 } from "react";
|
|
11027
11226
|
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
11028
11227
|
function DraggableEvent2({
|
|
11029
11228
|
event,
|
|
@@ -11038,8 +11237,8 @@ function DraggableEvent2({
|
|
|
11038
11237
|
"aria-hidden": ariaHidden
|
|
11039
11238
|
}) {
|
|
11040
11239
|
const { activeId } = useCalendarDnd();
|
|
11041
|
-
const elementRef =
|
|
11042
|
-
const [dragHandlePosition, setDragHandlePosition] =
|
|
11240
|
+
const elementRef = useRef15(null);
|
|
11241
|
+
const [dragHandlePosition, setDragHandlePosition] = useState28(null);
|
|
11043
11242
|
const eventStart = new Date(event.start);
|
|
11044
11243
|
const eventEnd = new Date(event.end);
|
|
11045
11244
|
const isMultiDayEvent2 = isMultiDay || event.allDay || differenceInDays2(eventEnd, eventStart) >= 1;
|
|
@@ -11173,8 +11372,8 @@ import {
|
|
|
11173
11372
|
subMonths as subMonths2,
|
|
11174
11373
|
subWeeks as subWeeks2
|
|
11175
11374
|
} from "date-fns";
|
|
11176
|
-
import { ptBR as
|
|
11177
|
-
import { useEffect as
|
|
11375
|
+
import { ptBR as ptBR10 } from "date-fns/locale";
|
|
11376
|
+
import { useEffect as useEffect22, useMemo as useMemo17, useState as useState29, useCallback as useCallback10 } from "react";
|
|
11178
11377
|
import { toast as toast3 } from "sonner";
|
|
11179
11378
|
import {
|
|
11180
11379
|
ArrowDownIcon,
|
|
@@ -11183,7 +11382,7 @@ import {
|
|
|
11183
11382
|
CalendarIcon as CalendarIcon4,
|
|
11184
11383
|
PlusIcon as PlusIcon3
|
|
11185
11384
|
} from "@phosphor-icons/react";
|
|
11186
|
-
import { Fragment as
|
|
11385
|
+
import { Fragment as Fragment11, jsx as jsx78, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
11187
11386
|
function EventCalendar({
|
|
11188
11387
|
events = [],
|
|
11189
11388
|
onEventAdd,
|
|
@@ -11192,11 +11391,11 @@ function EventCalendar({
|
|
|
11192
11391
|
className,
|
|
11193
11392
|
initialView = "month"
|
|
11194
11393
|
}) {
|
|
11195
|
-
const [currentDate, setCurrentDate] =
|
|
11196
|
-
const [view, setView] =
|
|
11197
|
-
const [isFading, setIsFading] =
|
|
11394
|
+
const [currentDate, setCurrentDate] = useState29(/* @__PURE__ */ new Date());
|
|
11395
|
+
const [view, setView] = useState29(initialView);
|
|
11396
|
+
const [isFading, setIsFading] = useState29(false);
|
|
11198
11397
|
const FADE_DURATION = 220;
|
|
11199
|
-
const changeView =
|
|
11398
|
+
const changeView = useCallback10(
|
|
11200
11399
|
(next) => {
|
|
11201
11400
|
if (next === view) return;
|
|
11202
11401
|
setIsFading(true);
|
|
@@ -11207,12 +11406,12 @@ function EventCalendar({
|
|
|
11207
11406
|
},
|
|
11208
11407
|
[view]
|
|
11209
11408
|
);
|
|
11210
|
-
const [isPaging, setIsPaging] =
|
|
11211
|
-
const [pageDirection, setPageDirection] =
|
|
11409
|
+
const [isPaging, setIsPaging] = useState29(false);
|
|
11410
|
+
const [pageDirection, setPageDirection] = useState29(
|
|
11212
11411
|
null
|
|
11213
11412
|
);
|
|
11214
11413
|
const PAGE_DURATION = 200;
|
|
11215
|
-
const pageTransition =
|
|
11414
|
+
const pageTransition = useCallback10(
|
|
11216
11415
|
(applyDateChange, direction) => {
|
|
11217
11416
|
setIsPaging(true);
|
|
11218
11417
|
setPageDirection(direction);
|
|
@@ -11226,11 +11425,11 @@ function EventCalendar({
|
|
|
11226
11425
|
},
|
|
11227
11426
|
[]
|
|
11228
11427
|
);
|
|
11229
|
-
const [isEventDialogOpen, setIsEventDialogOpen] =
|
|
11230
|
-
const [selectedEvent, setSelectedEvent] =
|
|
11428
|
+
const [isEventDialogOpen, setIsEventDialogOpen] = useState29(false);
|
|
11429
|
+
const [selectedEvent, setSelectedEvent] = useState29(
|
|
11231
11430
|
null
|
|
11232
11431
|
);
|
|
11233
|
-
|
|
11432
|
+
useEffect22(() => {
|
|
11234
11433
|
const handleKeyDown = (e) => {
|
|
11235
11434
|
if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
|
|
11236
11435
|
return;
|
|
@@ -11319,7 +11518,7 @@ function EventCalendar({
|
|
|
11319
11518
|
new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
|
|
11320
11519
|
"d 'de' MMMM 'de' yyyy",
|
|
11321
11520
|
{
|
|
11322
|
-
locale:
|
|
11521
|
+
locale: ptBR10
|
|
11323
11522
|
}
|
|
11324
11523
|
),
|
|
11325
11524
|
position: "bottom-left"
|
|
@@ -11333,7 +11532,7 @@ function EventCalendar({
|
|
|
11333
11532
|
description: format11(
|
|
11334
11533
|
new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
|
|
11335
11534
|
"d 'de' MMMM 'de' yyyy",
|
|
11336
|
-
{ locale:
|
|
11535
|
+
{ locale: ptBR10 }
|
|
11337
11536
|
),
|
|
11338
11537
|
position: "bottom-left"
|
|
11339
11538
|
});
|
|
@@ -11353,7 +11552,7 @@ function EventCalendar({
|
|
|
11353
11552
|
deletedEvent.start ?? deletedEvent.attend_date ?? deletedEvent.end ?? Date.now()
|
|
11354
11553
|
),
|
|
11355
11554
|
"d 'de' MMMM 'de' yyyy",
|
|
11356
|
-
{ locale:
|
|
11555
|
+
{ locale: ptBR10 }
|
|
11357
11556
|
),
|
|
11358
11557
|
position: "bottom-left"
|
|
11359
11558
|
});
|
|
@@ -11367,7 +11566,7 @@ function EventCalendar({
|
|
|
11367
11566
|
updatedEvent.start ?? updatedEvent.attend_date ?? updatedEvent.end ?? Date.now()
|
|
11368
11567
|
),
|
|
11369
11568
|
"d 'de' MMMM 'de' yyyy",
|
|
11370
|
-
{ locale:
|
|
11569
|
+
{ locale: ptBR10 }
|
|
11371
11570
|
),
|
|
11372
11571
|
position: "bottom-left"
|
|
11373
11572
|
});
|
|
@@ -11375,27 +11574,27 @@ function EventCalendar({
|
|
|
11375
11574
|
const viewTitle = useMemo17(() => {
|
|
11376
11575
|
const capitalize = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
11377
11576
|
if (view === "month") {
|
|
11378
|
-
return capitalize(format11(currentDate, "MMMM yyyy", { locale:
|
|
11577
|
+
return capitalize(format11(currentDate, "MMMM yyyy", { locale: ptBR10 }));
|
|
11379
11578
|
}
|
|
11380
11579
|
if (view === "week") {
|
|
11381
11580
|
const start = startOfWeek5(currentDate, { weekStartsOn: 1 });
|
|
11382
11581
|
const end = endOfWeek5(currentDate, { weekStartsOn: 1 });
|
|
11383
11582
|
if (isSameMonth3(start, end)) {
|
|
11384
|
-
return capitalize(format11(start, "MMMM yyyy", { locale:
|
|
11583
|
+
return capitalize(format11(start, "MMMM yyyy", { locale: ptBR10 }));
|
|
11385
11584
|
}
|
|
11386
|
-
const s1 = capitalize(format11(start, "MMM", { locale:
|
|
11387
|
-
const s2 = capitalize(format11(end, "MMM yyyy", { locale:
|
|
11585
|
+
const s1 = capitalize(format11(start, "MMM", { locale: ptBR10 }));
|
|
11586
|
+
const s2 = capitalize(format11(end, "MMM yyyy", { locale: ptBR10 }));
|
|
11388
11587
|
return `${s1} - ${s2}`;
|
|
11389
11588
|
}
|
|
11390
11589
|
if (view === "day") {
|
|
11391
|
-
const dayNum = format11(currentDate, "d", { locale:
|
|
11392
|
-
const month = capitalize(format11(currentDate, "MMMM", { locale:
|
|
11393
|
-
const year = format11(currentDate, "yyyy", { locale:
|
|
11590
|
+
const dayNum = format11(currentDate, "d", { locale: ptBR10 });
|
|
11591
|
+
const month = capitalize(format11(currentDate, "MMMM", { locale: ptBR10 }));
|
|
11592
|
+
const year = format11(currentDate, "yyyy", { locale: ptBR10 });
|
|
11394
11593
|
const short = `${dayNum} de ${month} de ${year}`;
|
|
11395
11594
|
const long = `${format11(currentDate, "EEE", {
|
|
11396
|
-
locale:
|
|
11595
|
+
locale: ptBR10
|
|
11397
11596
|
})}, ${dayNum} de ${month} de ${year}`;
|
|
11398
|
-
return /* @__PURE__ */ jsxs55(
|
|
11597
|
+
return /* @__PURE__ */ jsxs55(Fragment11, { children: [
|
|
11399
11598
|
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
|
|
11400
11599
|
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
|
|
11401
11600
|
/* @__PURE__ */ jsx78("span", { className: "max-md:hidden", children: long })
|
|
@@ -11405,15 +11604,15 @@ function EventCalendar({
|
|
|
11405
11604
|
const start = currentDate;
|
|
11406
11605
|
const end = addDays4(currentDate, AgendaDaysToShow - 1);
|
|
11407
11606
|
if (isSameMonth3(start, end)) {
|
|
11408
|
-
return capitalize(format11(start, "MMMM yyyy", { locale:
|
|
11607
|
+
return capitalize(format11(start, "MMMM yyyy", { locale: ptBR10 }));
|
|
11409
11608
|
}
|
|
11410
|
-
const s1 = capitalize(format11(start, "MMM", { locale:
|
|
11411
|
-
const s2 = capitalize(format11(end, "MMM yyyy", { locale:
|
|
11609
|
+
const s1 = capitalize(format11(start, "MMM", { locale: ptBR10 }));
|
|
11610
|
+
const s2 = capitalize(format11(end, "MMM yyyy", { locale: ptBR10 }));
|
|
11412
11611
|
return `${s1} - ${s2}`;
|
|
11413
11612
|
}
|
|
11414
|
-
return capitalize(format11(currentDate, "MMMM yyyy", { locale:
|
|
11613
|
+
return capitalize(format11(currentDate, "MMMM yyyy", { locale: ptBR10 }));
|
|
11415
11614
|
}, [currentDate, view]);
|
|
11416
|
-
const calendarContent = /* @__PURE__ */ jsxs55(
|
|
11615
|
+
const calendarContent = /* @__PURE__ */ jsxs55(Fragment11, { children: [
|
|
11417
11616
|
/* @__PURE__ */ jsxs55(
|
|
11418
11617
|
"div",
|
|
11419
11618
|
{
|
|
@@ -11466,7 +11665,7 @@ function EventCalendar({
|
|
|
11466
11665
|
] }),
|
|
11467
11666
|
/* @__PURE__ */ jsx78("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
|
|
11468
11667
|
] }),
|
|
11469
|
-
/* @__PURE__ */ jsx78("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs55(
|
|
11668
|
+
/* @__PURE__ */ jsx78("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs55(Fragment11, { children: [
|
|
11470
11669
|
/* @__PURE__ */ jsxs55(DropDownMenuBase, { children: [
|
|
11471
11670
|
/* @__PURE__ */ jsx78(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs55(
|
|
11472
11671
|
ButtonBase,
|
|
@@ -11627,10 +11826,10 @@ function EventCalendar({
|
|
|
11627
11826
|
|
|
11628
11827
|
// src/components/ui/event-calendar/EventDialog.tsx
|
|
11629
11828
|
import { format as format12, isBefore as isBefore2 } from "date-fns";
|
|
11630
|
-
import { useCallback as
|
|
11829
|
+
import { useCallback as useCallback11, useEffect as useEffect23, useMemo as useMemo18, useState as useState30 } from "react";
|
|
11631
11830
|
import { RadioGroup as RadioGroup3, RadioGroupItem } from "@radix-ui/react-radio-group";
|
|
11632
11831
|
import { motion as motion13 } from "framer-motion";
|
|
11633
|
-
import { ptBR as
|
|
11832
|
+
import { ptBR as ptBR11 } from "date-fns/locale";
|
|
11634
11833
|
import { CalendarIcon as CalendarIcon5, TrashIcon as TrashIcon3 } from "@phosphor-icons/react";
|
|
11635
11834
|
import { jsx as jsx79, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
11636
11835
|
function EventDialog({
|
|
@@ -11640,21 +11839,21 @@ function EventDialog({
|
|
|
11640
11839
|
onSave,
|
|
11641
11840
|
onDelete
|
|
11642
11841
|
}) {
|
|
11643
|
-
const [title, setTitle] =
|
|
11644
|
-
const [description, setDescription] =
|
|
11645
|
-
const [startDate, setStartDate] =
|
|
11646
|
-
const [endDate, setEndDate] =
|
|
11647
|
-
const [startTime, setStartTime] =
|
|
11648
|
-
const [endTime, setEndTime] =
|
|
11649
|
-
const [allDay, setAllDay] =
|
|
11650
|
-
const [location, setLocation] =
|
|
11651
|
-
const [color, setColor] =
|
|
11652
|
-
const [error, setError] =
|
|
11653
|
-
const [startDateOpen, setStartDateOpen] =
|
|
11654
|
-
const [endDateOpen, setEndDateOpen] =
|
|
11655
|
-
|
|
11842
|
+
const [title, setTitle] = useState30("");
|
|
11843
|
+
const [description, setDescription] = useState30("");
|
|
11844
|
+
const [startDate, setStartDate] = useState30(/* @__PURE__ */ new Date());
|
|
11845
|
+
const [endDate, setEndDate] = useState30(/* @__PURE__ */ new Date());
|
|
11846
|
+
const [startTime, setStartTime] = useState30(`${DefaultStartHour}:00`);
|
|
11847
|
+
const [endTime, setEndTime] = useState30(`${DefaultEndHour}:00`);
|
|
11848
|
+
const [allDay, setAllDay] = useState30(false);
|
|
11849
|
+
const [location, setLocation] = useState30("");
|
|
11850
|
+
const [color, setColor] = useState30("sky");
|
|
11851
|
+
const [error, setError] = useState30(null);
|
|
11852
|
+
const [startDateOpen, setStartDateOpen] = useState30(false);
|
|
11853
|
+
const [endDateOpen, setEndDateOpen] = useState30(false);
|
|
11854
|
+
useEffect23(() => {
|
|
11656
11855
|
}, [event]);
|
|
11657
|
-
const resetForm =
|
|
11856
|
+
const resetForm = useCallback11(() => {
|
|
11658
11857
|
setTitle("");
|
|
11659
11858
|
setDescription("");
|
|
11660
11859
|
setStartDate(/* @__PURE__ */ new Date());
|
|
@@ -11666,12 +11865,12 @@ function EventDialog({
|
|
|
11666
11865
|
setColor("sky");
|
|
11667
11866
|
setError(null);
|
|
11668
11867
|
}, []);
|
|
11669
|
-
const formatTimeForInput =
|
|
11868
|
+
const formatTimeForInput = useCallback11((date) => {
|
|
11670
11869
|
const hours = date.getHours().toString().padStart(2, "0");
|
|
11671
11870
|
const minutes = Math.floor(date.getMinutes() / 15) * 15;
|
|
11672
11871
|
return `${hours}:${minutes.toString().padStart(2, "0")}`;
|
|
11673
11872
|
}, []);
|
|
11674
|
-
|
|
11873
|
+
useEffect23(() => {
|
|
11675
11874
|
if (event) {
|
|
11676
11875
|
setTitle(event.title || "");
|
|
11677
11876
|
setDescription(event.description || "");
|
|
@@ -11697,7 +11896,7 @@ function EventDialog({
|
|
|
11697
11896
|
const formattedMinute = minute.toString().padStart(2, "0");
|
|
11698
11897
|
const value = `${formattedHour}:${formattedMinute}`;
|
|
11699
11898
|
const date = new Date(2e3, 0, 1, hour, minute);
|
|
11700
|
-
const label = format12(date, "HH:mm", { locale:
|
|
11899
|
+
const label = format12(date, "HH:mm", { locale: ptBR11 });
|
|
11701
11900
|
options.push({ label, value });
|
|
11702
11901
|
}
|
|
11703
11902
|
}
|
|
@@ -11874,7 +12073,7 @@ function EventDialog({
|
|
|
11874
12073
|
"truncate",
|
|
11875
12074
|
!startDate && "text-muted-foreground"
|
|
11876
12075
|
),
|
|
11877
|
-
children: startDate ? format12(startDate, "PPP", { locale:
|
|
12076
|
+
children: startDate ? format12(startDate, "PPP", { locale: ptBR11 }) : "Escolher data"
|
|
11878
12077
|
}
|
|
11879
12078
|
),
|
|
11880
12079
|
/* @__PURE__ */ jsx79(
|
|
@@ -11953,7 +12152,7 @@ function EventDialog({
|
|
|
11953
12152
|
"truncate",
|
|
11954
12153
|
!endDate && "text-muted-foreground"
|
|
11955
12154
|
),
|
|
11956
|
-
children: endDate ? format12(endDate, "PPP", { locale:
|
|
12155
|
+
children: endDate ? format12(endDate, "PPP", { locale: ptBR11 }) : "Escolher data"
|
|
11957
12156
|
}
|
|
11958
12157
|
),
|
|
11959
12158
|
/* @__PURE__ */ jsx79(
|
|
@@ -12093,7 +12292,7 @@ import { useMemo as useMemo19 } from "react";
|
|
|
12093
12292
|
import {
|
|
12094
12293
|
ClockUserIcon
|
|
12095
12294
|
} from "@phosphor-icons/react";
|
|
12096
|
-
import { Fragment as
|
|
12295
|
+
import { Fragment as Fragment12, jsx as jsx80, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
12097
12296
|
var formatTimeWithOptionalMinutes2 = (date) => {
|
|
12098
12297
|
return format13(date, "HH:mm");
|
|
12099
12298
|
};
|
|
@@ -12277,7 +12476,7 @@ function EventItem({
|
|
|
12277
12476
|
children: durationMinutes < 45 ? /* @__PURE__ */ jsxs57("div", { className: "flex items-center justify-between w-full", children: [
|
|
12278
12477
|
/* @__PURE__ */ jsx80("div", { className: cn("truncate text-lg"), children: event.title }),
|
|
12279
12478
|
showTime && hasValidTime && displayStart && /* @__PURE__ */ jsx80("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes2(displayStart) })
|
|
12280
|
-
] }) : /* @__PURE__ */ jsxs57(
|
|
12479
|
+
] }) : /* @__PURE__ */ jsxs57(Fragment12, { children: [
|
|
12281
12480
|
/* @__PURE__ */ jsx80(
|
|
12282
12481
|
"div",
|
|
12283
12482
|
{
|
|
@@ -12399,8 +12598,8 @@ function EventItem({
|
|
|
12399
12598
|
|
|
12400
12599
|
// src/components/ui/event-calendar/EventsPopUp.tsx
|
|
12401
12600
|
import { format as format14, isSameDay as isSameDay7 } from "date-fns";
|
|
12402
|
-
import { ptBR as
|
|
12403
|
-
import { useEffect as
|
|
12601
|
+
import { ptBR as ptBR12 } from "date-fns/locale";
|
|
12602
|
+
import { useEffect as useEffect24, useMemo as useMemo20, useRef as useRef16 } from "react";
|
|
12404
12603
|
import { motion as motion14 } from "framer-motion";
|
|
12405
12604
|
import { XIcon as XIcon11 } from "@phosphor-icons/react";
|
|
12406
12605
|
import { jsx as jsx81, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
@@ -12411,8 +12610,8 @@ function EventsPopup({
|
|
|
12411
12610
|
onClose,
|
|
12412
12611
|
onEventSelect
|
|
12413
12612
|
}) {
|
|
12414
|
-
const popupRef =
|
|
12415
|
-
|
|
12613
|
+
const popupRef = useRef16(null);
|
|
12614
|
+
useEffect24(() => {
|
|
12416
12615
|
const handleClickOutside = (event) => {
|
|
12417
12616
|
if (popupRef.current && !popupRef.current.contains(event.target)) {
|
|
12418
12617
|
onClose();
|
|
@@ -12423,7 +12622,7 @@ function EventsPopup({
|
|
|
12423
12622
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
12424
12623
|
};
|
|
12425
12624
|
}, [onClose]);
|
|
12426
|
-
|
|
12625
|
+
useEffect24(() => {
|
|
12427
12626
|
const handleEscKey = (event) => {
|
|
12428
12627
|
if (event.key === "Escape") {
|
|
12429
12628
|
onClose();
|
|
@@ -12469,9 +12668,9 @@ function EventsPopup({
|
|
|
12469
12668
|
children: [
|
|
12470
12669
|
/* @__PURE__ */ jsxs58("div", { className: "sticky top-0 flex items-center justify-between border-b bg-background p-3", children: [
|
|
12471
12670
|
/* @__PURE__ */ jsx81("h3", { className: "font-medium", children: (() => {
|
|
12472
|
-
const dayNum = format14(date, "d", { locale:
|
|
12473
|
-
const month = format14(date, "MMMM", { locale:
|
|
12474
|
-
const year = format14(date, "yyyy", { locale:
|
|
12671
|
+
const dayNum = format14(date, "d", { locale: ptBR12 });
|
|
12672
|
+
const month = format14(date, "MMMM", { locale: ptBR12 });
|
|
12673
|
+
const year = format14(date, "yyyy", { locale: ptBR12 });
|
|
12475
12674
|
const monthCap = month.charAt(0).toUpperCase() + month.slice(1);
|
|
12476
12675
|
return `${dayNum} de ${monthCap} de ${year}`;
|
|
12477
12676
|
})() }),
|
|
@@ -12518,12 +12717,12 @@ function EventsPopup({
|
|
|
12518
12717
|
|
|
12519
12718
|
// src/components/ui/event-calendar/hooks/use-current-time-indicator.ts
|
|
12520
12719
|
import { endOfWeek as endOfWeek6, isSameDay as isSameDay8, isWithinInterval as isWithinInterval2, startOfWeek as startOfWeek6 } from "date-fns";
|
|
12521
|
-
import { ptBR as
|
|
12522
|
-
import { useEffect as
|
|
12720
|
+
import { ptBR as ptBR13 } from "date-fns/locale";
|
|
12721
|
+
import { useEffect as useEffect25, useState as useState31 } from "react";
|
|
12523
12722
|
function useCurrentTimeIndicator(currentDate, view) {
|
|
12524
|
-
const [currentTimePosition, setCurrentTimePosition] =
|
|
12525
|
-
const [currentTimeVisible, setCurrentTimeVisible] =
|
|
12526
|
-
|
|
12723
|
+
const [currentTimePosition, setCurrentTimePosition] = useState31(0);
|
|
12724
|
+
const [currentTimeVisible, setCurrentTimeVisible] = useState31(false);
|
|
12725
|
+
useEffect25(() => {
|
|
12527
12726
|
const calculateTimePosition = () => {
|
|
12528
12727
|
const now = /* @__PURE__ */ new Date();
|
|
12529
12728
|
const hours = now.getHours();
|
|
@@ -12536,8 +12735,8 @@ function useCurrentTimeIndicator(currentDate, view) {
|
|
|
12536
12735
|
if (view === "day") {
|
|
12537
12736
|
isCurrentTimeVisible = isSameDay8(now, currentDate);
|
|
12538
12737
|
} else if (view === "week") {
|
|
12539
|
-
const startOfWeekDate = startOfWeek6(currentDate, { locale:
|
|
12540
|
-
const endOfWeekDate = endOfWeek6(currentDate, { locale:
|
|
12738
|
+
const startOfWeekDate = startOfWeek6(currentDate, { locale: ptBR13 });
|
|
12739
|
+
const endOfWeekDate = endOfWeek6(currentDate, { locale: ptBR13 });
|
|
12541
12740
|
isCurrentTimeVisible = isWithinInterval2(now, {
|
|
12542
12741
|
end: endOfWeekDate,
|
|
12543
12742
|
start: startOfWeekDate
|
|
@@ -12554,14 +12753,14 @@ function useCurrentTimeIndicator(currentDate, view) {
|
|
|
12554
12753
|
}
|
|
12555
12754
|
|
|
12556
12755
|
// src/components/ui/event-calendar/hooks/use-event-visibility.ts
|
|
12557
|
-
import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo21, useRef as
|
|
12756
|
+
import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo21, useRef as useRef17, useState as useState32 } from "react";
|
|
12558
12757
|
function useEventVisibility({
|
|
12559
12758
|
eventHeight,
|
|
12560
12759
|
eventGap
|
|
12561
12760
|
}) {
|
|
12562
|
-
const contentRef =
|
|
12563
|
-
const observerRef =
|
|
12564
|
-
const [contentHeight, setContentHeight] =
|
|
12761
|
+
const contentRef = useRef17(null);
|
|
12762
|
+
const observerRef = useRef17(null);
|
|
12763
|
+
const [contentHeight, setContentHeight] = useState32(null);
|
|
12565
12764
|
useLayoutEffect2(() => {
|
|
12566
12765
|
if (!contentRef.current) return;
|
|
12567
12766
|
const updateHeight = () => {
|
|
@@ -12612,8 +12811,8 @@ import {
|
|
|
12612
12811
|
startOfMonth as startOfMonth3,
|
|
12613
12812
|
startOfWeek as startOfWeek7
|
|
12614
12813
|
} from "date-fns";
|
|
12615
|
-
import { ptBR as
|
|
12616
|
-
import { useEffect as
|
|
12814
|
+
import { ptBR as ptBR14 } from "date-fns/locale";
|
|
12815
|
+
import { useEffect as useEffect26, useMemo as useMemo22, useState as useState33 } from "react";
|
|
12617
12816
|
import { jsx as jsx82, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
12618
12817
|
function MonthView({
|
|
12619
12818
|
currentDate,
|
|
@@ -12631,7 +12830,7 @@ function MonthView({
|
|
|
12631
12830
|
const weekdays = useMemo22(() => {
|
|
12632
12831
|
return Array.from({ length: 7 }).map((_, i) => {
|
|
12633
12832
|
const date = addDays5(startOfWeek7(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
|
|
12634
|
-
const short = format15(date, "EEE", { locale:
|
|
12833
|
+
const short = format15(date, "EEE", { locale: ptBR14 });
|
|
12635
12834
|
return short.charAt(0).toUpperCase() + short.slice(1);
|
|
12636
12835
|
});
|
|
12637
12836
|
}, []);
|
|
@@ -12651,12 +12850,12 @@ function MonthView({
|
|
|
12651
12850
|
e.stopPropagation();
|
|
12652
12851
|
onEventSelect(event);
|
|
12653
12852
|
};
|
|
12654
|
-
const [isMounted, setIsMounted] =
|
|
12853
|
+
const [isMounted, setIsMounted] = useState33(false);
|
|
12655
12854
|
const { contentRef, getVisibleEventCount } = useEventVisibility({
|
|
12656
12855
|
eventGap: EventGap,
|
|
12657
12856
|
eventHeight: EventHeight
|
|
12658
12857
|
});
|
|
12659
|
-
|
|
12858
|
+
useEffect26(() => {
|
|
12660
12859
|
setIsMounted(true);
|
|
12661
12860
|
}, []);
|
|
12662
12861
|
return /* @__PURE__ */ jsxs59("div", { className: "contents", "data-slot": "month-view", children: [
|
|
@@ -12771,7 +12970,7 @@ function MonthView({
|
|
|
12771
12970
|
"aria-label": `Show ${remainingCount} more events on ${format15(
|
|
12772
12971
|
day,
|
|
12773
12972
|
"PPP",
|
|
12774
|
-
{ locale:
|
|
12973
|
+
{ locale: ptBR14 }
|
|
12775
12974
|
)}`,
|
|
12776
12975
|
children: [
|
|
12777
12976
|
/* @__PURE__ */ jsxs59("span", { className: "font-medium", children: [
|
|
@@ -12791,7 +12990,7 @@ function MonthView({
|
|
|
12791
12990
|
"--event-height": `${EventHeight}px`
|
|
12792
12991
|
},
|
|
12793
12992
|
children: /* @__PURE__ */ jsxs59("div", { className: "space-y-2", children: [
|
|
12794
|
-
/* @__PURE__ */ jsx82("div", { className: "font-medium text-sm", children: format15(day, "EEE d", { locale:
|
|
12993
|
+
/* @__PURE__ */ jsx82("div", { className: "font-medium text-sm", children: format15(day, "EEE d", { locale: ptBR14 }) }),
|
|
12795
12994
|
/* @__PURE__ */ jsx82("div", { className: "space-y-1", children: sortEvents(allEvents).map((event) => {
|
|
12796
12995
|
const eventStart = new Date(event.start);
|
|
12797
12996
|
const eventEnd = new Date(event.end);
|
|
@@ -12946,7 +13145,7 @@ import {
|
|
|
12946
13145
|
startOfDay as startOfDay4,
|
|
12947
13146
|
startOfWeek as startOfWeek8
|
|
12948
13147
|
} from "date-fns";
|
|
12949
|
-
import { ptBR as
|
|
13148
|
+
import { ptBR as ptBR15 } from "date-fns/locale";
|
|
12950
13149
|
import { useMemo as useMemo23 } from "react";
|
|
12951
13150
|
import { jsx as jsx83, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
12952
13151
|
function WeekView({
|
|
@@ -13075,11 +13274,11 @@ function WeekView({
|
|
|
13075
13274
|
"data-today": isToday6(day) || void 0,
|
|
13076
13275
|
children: [
|
|
13077
13276
|
/* @__PURE__ */ jsxs60("span", { "aria-hidden": "true", className: "sm:hidden", children: [
|
|
13078
|
-
format16(day, "EEE", { locale:
|
|
13277
|
+
format16(day, "EEE", { locale: ptBR15 })[0],
|
|
13079
13278
|
" ",
|
|
13080
|
-
format16(day, "d", { locale:
|
|
13279
|
+
format16(day, "d", { locale: ptBR15 })
|
|
13081
13280
|
] }),
|
|
13082
|
-
/* @__PURE__ */ jsx83("span", { className: "max-sm:hidden", children: format16(day, "EEE dd", { locale:
|
|
13281
|
+
/* @__PURE__ */ jsx83("span", { className: "max-sm:hidden", children: format16(day, "EEE dd", { locale: ptBR15 }) })
|
|
13083
13282
|
]
|
|
13084
13283
|
},
|
|
13085
13284
|
day.toString()
|
|
@@ -13228,9 +13427,9 @@ function WeekView({
|
|
|
13228
13427
|
}
|
|
13229
13428
|
|
|
13230
13429
|
// src/components/ui/selects/AvatarCombobox.tsx
|
|
13231
|
-
import { useId as useId3, useState as
|
|
13430
|
+
import { useId as useId3, useState as useState34 } from "react";
|
|
13232
13431
|
import { CaretDownIcon as CaretDownIcon5, CheckIcon as CheckIcon10 } from "@phosphor-icons/react";
|
|
13233
|
-
import { Fragment as
|
|
13432
|
+
import { Fragment as Fragment13, jsx as jsx84, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
13234
13433
|
var DEFAULT_COLORS = [
|
|
13235
13434
|
"bg-purple-100 text-purple-700",
|
|
13236
13435
|
"bg-green-100 text-green-700",
|
|
@@ -13273,14 +13472,14 @@ function AvatarCombobox({
|
|
|
13273
13472
|
className,
|
|
13274
13473
|
colors: colors2
|
|
13275
13474
|
}) {
|
|
13276
|
-
const [open, setOpen] =
|
|
13475
|
+
const [open, setOpen] = useState34(false);
|
|
13277
13476
|
const id = useId3();
|
|
13278
13477
|
const allItems = items || (groupItems ? Object.values(groupItems).flat() : []);
|
|
13279
13478
|
const selectedItem = allItems.find((item) => item.value === selected);
|
|
13280
13479
|
const renderItem = (item) => {
|
|
13281
13480
|
const avatarContent = item.avatar ?? item.label.charAt(0).toUpperCase();
|
|
13282
13481
|
const colorClass = item.avatarClassName ?? getColor(item.value, colors2);
|
|
13283
|
-
return /* @__PURE__ */ jsxs61(
|
|
13482
|
+
return /* @__PURE__ */ jsxs61(Fragment13, { children: [
|
|
13284
13483
|
/* @__PURE__ */ jsx84(Square, { className: colorClass, children: avatarContent }),
|
|
13285
13484
|
/* @__PURE__ */ jsx84("span", { className: "truncate", children: item.label })
|
|
13286
13485
|
] });
|
|
@@ -13385,14 +13584,14 @@ function AvatarCombobox({
|
|
|
13385
13584
|
import { CaretUpDownIcon as CaretUpDownIcon2, CheckIcon as CheckIcon11, XIcon as XIcon12 } from "@phosphor-icons/react";
|
|
13386
13585
|
import {
|
|
13387
13586
|
createContext as createContext7,
|
|
13388
|
-
useCallback as
|
|
13587
|
+
useCallback as useCallback12,
|
|
13389
13588
|
useContext as useContext8,
|
|
13390
|
-
useEffect as
|
|
13391
|
-
useRef as
|
|
13392
|
-
useState as
|
|
13589
|
+
useEffect as useEffect27,
|
|
13590
|
+
useRef as useRef18,
|
|
13591
|
+
useState as useState35
|
|
13393
13592
|
} from "react";
|
|
13394
13593
|
import { motion as motion15 } from "framer-motion";
|
|
13395
|
-
import { Fragment as
|
|
13594
|
+
import { Fragment as Fragment14, jsx as jsx85, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
13396
13595
|
var MultiSelectContext = createContext7(null);
|
|
13397
13596
|
function MultiSelectBase({
|
|
13398
13597
|
children,
|
|
@@ -13403,12 +13602,12 @@ function MultiSelectBase({
|
|
|
13403
13602
|
empty,
|
|
13404
13603
|
error
|
|
13405
13604
|
}) {
|
|
13406
|
-
const [open, setOpen] =
|
|
13407
|
-
const [internalValues, setInternalValues] =
|
|
13605
|
+
const [open, setOpen] = useState35(false);
|
|
13606
|
+
const [internalValues, setInternalValues] = useState35(
|
|
13408
13607
|
new Set(values ?? defaultValues)
|
|
13409
13608
|
);
|
|
13410
13609
|
const selectedValues = values ? new Set(values) : internalValues;
|
|
13411
|
-
const [items, setItems] =
|
|
13610
|
+
const [items, setItems] = useState35(/* @__PURE__ */ new Map());
|
|
13412
13611
|
function toggleValue(value) {
|
|
13413
13612
|
if (disabled) return;
|
|
13414
13613
|
const getNewSet = (prev) => {
|
|
@@ -13423,7 +13622,7 @@ function MultiSelectBase({
|
|
|
13423
13622
|
setInternalValues(getNewSet);
|
|
13424
13623
|
onValuesChange?.([...getNewSet(selectedValues)]);
|
|
13425
13624
|
}
|
|
13426
|
-
const onItemAdded =
|
|
13625
|
+
const onItemAdded = useCallback12((value, label) => {
|
|
13427
13626
|
setItems((prev) => {
|
|
13428
13627
|
if (prev.get(value) === label) return prev;
|
|
13429
13628
|
return new Map(prev).set(value, label);
|
|
@@ -13495,13 +13694,13 @@ function MultiSelectValueBase({
|
|
|
13495
13694
|
...props
|
|
13496
13695
|
}) {
|
|
13497
13696
|
const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
|
|
13498
|
-
const [overflowAmount, setOverflowAmount] =
|
|
13499
|
-
const valueRef =
|
|
13500
|
-
const overflowRef =
|
|
13501
|
-
const mutationObserverRef =
|
|
13502
|
-
const resizeObserverRef =
|
|
13697
|
+
const [overflowAmount, setOverflowAmount] = useState35(0);
|
|
13698
|
+
const valueRef = useRef18(null);
|
|
13699
|
+
const overflowRef = useRef18(null);
|
|
13700
|
+
const mutationObserverRef = useRef18(null);
|
|
13701
|
+
const resizeObserverRef = useRef18(null);
|
|
13503
13702
|
const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
|
|
13504
|
-
const checkOverflow =
|
|
13703
|
+
const checkOverflow = useCallback12(() => {
|
|
13505
13704
|
if (valueRef.current == null) return;
|
|
13506
13705
|
const containerElement = valueRef.current;
|
|
13507
13706
|
const overflowElement = overflowRef.current;
|
|
@@ -13522,7 +13721,7 @@ function MultiSelectValueBase({
|
|
|
13522
13721
|
}
|
|
13523
13722
|
setOverflowAmount(amount);
|
|
13524
13723
|
}, []);
|
|
13525
|
-
const handleResize =
|
|
13724
|
+
const handleResize = useCallback12(
|
|
13526
13725
|
(node) => {
|
|
13527
13726
|
if (node == null) {
|
|
13528
13727
|
valueRef.current = null;
|
|
@@ -13617,7 +13816,7 @@ function MultiSelectContentBase({
|
|
|
13617
13816
|
}) {
|
|
13618
13817
|
const canSearch = typeof search === "object" ? true : search;
|
|
13619
13818
|
const { emptyMessage } = useMultiSelectContext();
|
|
13620
|
-
return /* @__PURE__ */ jsx85(
|
|
13819
|
+
return /* @__PURE__ */ jsx85(Fragment14, { children: /* @__PURE__ */ jsx85(PopoverContentBase, { className: "w-[--radix-popover-trigger-width] relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md p-0", children: /* @__PURE__ */ jsx85(
|
|
13621
13820
|
motion15.div,
|
|
13622
13821
|
{
|
|
13623
13822
|
initial: { opacity: 0, scale: 0.95 },
|
|
@@ -13648,7 +13847,7 @@ function MultiSelectItemBase({
|
|
|
13648
13847
|
}) {
|
|
13649
13848
|
const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
|
|
13650
13849
|
const isSelected = selectedValues.has(value);
|
|
13651
|
-
|
|
13850
|
+
useEffect27(() => {
|
|
13652
13851
|
onItemAdded(value, badgeLabel ?? children);
|
|
13653
13852
|
}, [value, children, onItemAdded, badgeLabel]);
|
|
13654
13853
|
return /* @__PURE__ */ jsx85(
|
|
@@ -13705,11 +13904,11 @@ function debounce(func, wait) {
|
|
|
13705
13904
|
|
|
13706
13905
|
// src/components/ui/charts/Chart.tsx
|
|
13707
13906
|
import {
|
|
13708
|
-
useState as
|
|
13709
|
-
useEffect as
|
|
13710
|
-
useCallback as
|
|
13907
|
+
useState as useState38,
|
|
13908
|
+
useEffect as useEffect30,
|
|
13909
|
+
useCallback as useCallback14,
|
|
13711
13910
|
useMemo as useMemo25,
|
|
13712
|
-
useRef as
|
|
13911
|
+
useRef as useRef21,
|
|
13713
13912
|
useLayoutEffect as useLayoutEffect3
|
|
13714
13913
|
} from "react";
|
|
13715
13914
|
import {
|
|
@@ -13872,8 +14071,8 @@ var resolveChartMargins = (margins, chartMargins, showLabels) => {
|
|
|
13872
14071
|
import { toast as toast4 } from "sonner";
|
|
13873
14072
|
|
|
13874
14073
|
// src/components/ui/charts/components/controls/PeriodsDropdown.tsx
|
|
13875
|
-
import { useState as
|
|
13876
|
-
import { motion as motion16, AnimatePresence as
|
|
14074
|
+
import { useState as useState36, useRef as useRef19, useEffect as useEffect28 } from "react";
|
|
14075
|
+
import { motion as motion16, AnimatePresence as AnimatePresence9 } from "framer-motion";
|
|
13877
14076
|
import { DotsThreeIcon as DotsThreeIcon3 } from "@phosphor-icons/react/dist/ssr";
|
|
13878
14077
|
import { Check } from "@phosphor-icons/react/dist/ssr";
|
|
13879
14078
|
import { jsx as jsx86, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
@@ -13895,11 +14094,11 @@ function PeriodsDropdown({
|
|
|
13895
14094
|
activePeriods
|
|
13896
14095
|
}) {
|
|
13897
14096
|
const periods = processedData.map((d) => String(d.name));
|
|
13898
|
-
const [open, setOpen] =
|
|
13899
|
-
const wrapperRef =
|
|
13900
|
-
const firstItemRef =
|
|
13901
|
-
const listRef =
|
|
13902
|
-
|
|
14097
|
+
const [open, setOpen] = useState36(false);
|
|
14098
|
+
const wrapperRef = useRef19(null);
|
|
14099
|
+
const firstItemRef = useRef19(null);
|
|
14100
|
+
const listRef = useRef19(null);
|
|
14101
|
+
useEffect28(() => {
|
|
13903
14102
|
const handleClickOutside = (e) => {
|
|
13904
14103
|
if (!wrapperRef.current) return;
|
|
13905
14104
|
if (!wrapperRef.current.contains(e.target)) setOpen(false);
|
|
@@ -13914,7 +14113,7 @@ function PeriodsDropdown({
|
|
|
13914
14113
|
document.removeEventListener("keydown", handleEscape);
|
|
13915
14114
|
};
|
|
13916
14115
|
}, []);
|
|
13917
|
-
|
|
14116
|
+
useEffect28(() => {
|
|
13918
14117
|
if (open && firstItemRef.current) {
|
|
13919
14118
|
firstItemRef.current.focus();
|
|
13920
14119
|
}
|
|
@@ -13948,7 +14147,7 @@ function PeriodsDropdown({
|
|
|
13948
14147
|
]
|
|
13949
14148
|
}
|
|
13950
14149
|
),
|
|
13951
|
-
/* @__PURE__ */ jsx86(
|
|
14150
|
+
/* @__PURE__ */ jsx86(AnimatePresence9, { children: open && /* @__PURE__ */ jsxs63(
|
|
13952
14151
|
motion16.div,
|
|
13953
14152
|
{
|
|
13954
14153
|
initial: "hidden",
|
|
@@ -14008,7 +14207,7 @@ var PeriodsDropdown_default = PeriodsDropdown;
|
|
|
14008
14207
|
// src/components/ui/charts/components/controls/ShowOnly.tsx
|
|
14009
14208
|
import { motion as motion17 } from "framer-motion";
|
|
14010
14209
|
import { Eye, EyeSlash } from "@phosphor-icons/react";
|
|
14011
|
-
import { Fragment as
|
|
14210
|
+
import { Fragment as Fragment15, jsx as jsx87, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
14012
14211
|
var ShowOnly = ({
|
|
14013
14212
|
showOnlyHighlighted,
|
|
14014
14213
|
setShowOnlyHighlighted,
|
|
@@ -14035,10 +14234,10 @@ var ShowOnly = ({
|
|
|
14035
14234
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary/60",
|
|
14036
14235
|
!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"
|
|
14037
14236
|
),
|
|
14038
|
-
children: showOnlyHighlighted ? /* @__PURE__ */ jsxs64(
|
|
14237
|
+
children: showOnlyHighlighted ? /* @__PURE__ */ jsxs64(Fragment15, { children: [
|
|
14039
14238
|
/* @__PURE__ */ jsx87(EyeSlash, { size: 16, weight: "regular" }),
|
|
14040
14239
|
/* @__PURE__ */ jsx87("span", { className: "sr-only", children: "Exibir todos" })
|
|
14041
|
-
] }) : /* @__PURE__ */ jsxs64(
|
|
14240
|
+
] }) : /* @__PURE__ */ jsxs64(Fragment15, { children: [
|
|
14042
14241
|
/* @__PURE__ */ jsx87(Eye, { size: 16, weight: "bold" }),
|
|
14043
14242
|
/* @__PURE__ */ jsx87("span", { className: "sr-only", children: "Mostrar somente destacados" })
|
|
14044
14243
|
] })
|
|
@@ -14050,7 +14249,7 @@ var ShowOnly = ({
|
|
|
14050
14249
|
var ShowOnly_default = ShowOnly;
|
|
14051
14250
|
|
|
14052
14251
|
// src/components/ui/charts/components/controls/Highlights.tsx
|
|
14053
|
-
import { motion as motion18, AnimatePresence as
|
|
14252
|
+
import { motion as motion18, AnimatePresence as AnimatePresence10 } from "framer-motion";
|
|
14054
14253
|
import { CheckIcon as CheckIcon12 } from "@phosphor-icons/react/dist/ssr";
|
|
14055
14254
|
import { jsx as jsx88, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
14056
14255
|
var Highlights = ({
|
|
@@ -14077,7 +14276,7 @@ var Highlights = ({
|
|
|
14077
14276
|
initial: "hidden",
|
|
14078
14277
|
animate: "visible",
|
|
14079
14278
|
variants: containerVariants,
|
|
14080
|
-
children: /* @__PURE__ */ jsx88(
|
|
14279
|
+
children: /* @__PURE__ */ jsx88(AnimatePresence10, { initial: false, mode: "popLayout", children: allKeys.map((k) => {
|
|
14081
14280
|
const isHighlighted = highlightedSeries.has(k);
|
|
14082
14281
|
const label = mapperConfig[k]?.label ?? k;
|
|
14083
14282
|
const color = finalColors[k];
|
|
@@ -14258,16 +14457,16 @@ var CloseAllButton_default = CloseAllButton;
|
|
|
14258
14457
|
|
|
14259
14458
|
// src/components/ui/charts/components/tooltips/DraggableTooltip.tsx
|
|
14260
14459
|
import React44, {
|
|
14261
|
-
useEffect as
|
|
14262
|
-
useRef as
|
|
14263
|
-
useState as
|
|
14264
|
-
useCallback as
|
|
14460
|
+
useEffect as useEffect29,
|
|
14461
|
+
useRef as useRef20,
|
|
14462
|
+
useState as useState37,
|
|
14463
|
+
useCallback as useCallback13,
|
|
14265
14464
|
useMemo as useMemo24
|
|
14266
14465
|
} from "react";
|
|
14267
|
-
import { motion as motion19, AnimatePresence as
|
|
14466
|
+
import { motion as motion19, AnimatePresence as AnimatePresence11 } from "framer-motion";
|
|
14268
14467
|
import { DotsSixVerticalIcon } from "@phosphor-icons/react";
|
|
14269
14468
|
import { XIcon as XIcon14 } from "@phosphor-icons/react/dist/ssr";
|
|
14270
|
-
import { Fragment as
|
|
14469
|
+
import { Fragment as Fragment16, jsx as jsx90, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
14271
14470
|
var ALIGNMENT_THRESHOLD = 25;
|
|
14272
14471
|
var GUIDE_THRESHOLD = 60;
|
|
14273
14472
|
var STRONG_SNAP_THRESHOLD = 35;
|
|
@@ -14371,14 +14570,14 @@ var DraggableTooltipComponent = ({
|
|
|
14371
14570
|
)
|
|
14372
14571
|
] });
|
|
14373
14572
|
});
|
|
14374
|
-
const [localPos, setLocalPos] =
|
|
14375
|
-
const [dragging, setDragging] =
|
|
14376
|
-
const offsetRef =
|
|
14377
|
-
const lastMouse =
|
|
14378
|
-
const [alignmentGuides, setAlignmentGuides] =
|
|
14379
|
-
const [globalTooltipCountLocal, setGlobalTooltipCountLocal] =
|
|
14380
|
-
|
|
14381
|
-
const getAllTooltips =
|
|
14573
|
+
const [localPos, setLocalPos] = useState37(position);
|
|
14574
|
+
const [dragging, setDragging] = useState37(false);
|
|
14575
|
+
const offsetRef = useRef20({ x: 0, y: 0 });
|
|
14576
|
+
const lastMouse = useRef20({ x: 0, y: 0 });
|
|
14577
|
+
const [alignmentGuides, setAlignmentGuides] = useState37([]);
|
|
14578
|
+
const [globalTooltipCountLocal, setGlobalTooltipCountLocal] = useState37(0);
|
|
14579
|
+
useEffect29(() => setLocalPos(position), [position]);
|
|
14580
|
+
const getAllTooltips = useCallback13(() => {
|
|
14382
14581
|
const response = [];
|
|
14383
14582
|
const ev = new CustomEvent("requestGlobalTooltips", {
|
|
14384
14583
|
detail: { requesterId: id, response }
|
|
@@ -14386,7 +14585,7 @@ var DraggableTooltipComponent = ({
|
|
|
14386
14585
|
window.dispatchEvent(ev);
|
|
14387
14586
|
return response;
|
|
14388
14587
|
}, [id]);
|
|
14389
|
-
const updateAlignmentGuides =
|
|
14588
|
+
const updateAlignmentGuides = useCallback13(
|
|
14390
14589
|
(currentPosition) => {
|
|
14391
14590
|
const allTooltips = getAllTooltips();
|
|
14392
14591
|
const otherTooltips = allTooltips.filter((t) => t.id !== id);
|
|
@@ -14435,7 +14634,7 @@ var DraggableTooltipComponent = ({
|
|
|
14435
14634
|
},
|
|
14436
14635
|
[getAllTooltips, id]
|
|
14437
14636
|
);
|
|
14438
|
-
const snapToGuides =
|
|
14637
|
+
const snapToGuides = useCallback13(
|
|
14439
14638
|
(position2) => {
|
|
14440
14639
|
const snappedPosition = { ...position2 };
|
|
14441
14640
|
let hasSnapped = false;
|
|
@@ -14482,7 +14681,7 @@ var DraggableTooltipComponent = ({
|
|
|
14482
14681
|
},
|
|
14483
14682
|
[alignmentGuides]
|
|
14484
14683
|
);
|
|
14485
|
-
|
|
14684
|
+
useEffect29(() => {
|
|
14486
14685
|
let rafId = null;
|
|
14487
14686
|
const handleMouseMove = (e) => {
|
|
14488
14687
|
if (!dragging) return;
|
|
@@ -14524,7 +14723,7 @@ var DraggableTooltipComponent = ({
|
|
|
14524
14723
|
document.body.style.userSelect = "";
|
|
14525
14724
|
};
|
|
14526
14725
|
}, [dragging, snapToGuides, updateAlignmentGuides, id, onPositionChange]);
|
|
14527
|
-
|
|
14726
|
+
useEffect29(() => {
|
|
14528
14727
|
const handleCloseAll = () => onClose(id);
|
|
14529
14728
|
const handleRequestTooltipCount = () => {
|
|
14530
14729
|
window.dispatchEvent(
|
|
@@ -14555,7 +14754,7 @@ var DraggableTooltipComponent = ({
|
|
|
14555
14754
|
});
|
|
14556
14755
|
};
|
|
14557
14756
|
}, [id, localPos, onClose]);
|
|
14558
|
-
|
|
14757
|
+
useEffect29(() => {
|
|
14559
14758
|
if (dragging) return;
|
|
14560
14759
|
let total = 0;
|
|
14561
14760
|
const timeoutId = setTimeout(() => {
|
|
@@ -14573,7 +14772,7 @@ var DraggableTooltipComponent = ({
|
|
|
14573
14772
|
}, 0);
|
|
14574
14773
|
return () => clearTimeout(timeoutId);
|
|
14575
14774
|
}, [localPos, dragging]);
|
|
14576
|
-
|
|
14775
|
+
useEffect29(() => {
|
|
14577
14776
|
const recount = () => {
|
|
14578
14777
|
if (dragging) return;
|
|
14579
14778
|
let total = 0;
|
|
@@ -14591,7 +14790,7 @@ var DraggableTooltipComponent = ({
|
|
|
14591
14790
|
window.addEventListener("recountTooltips", recount);
|
|
14592
14791
|
return () => window.removeEventListener("recountTooltips", recount);
|
|
14593
14792
|
}, [dragging]);
|
|
14594
|
-
const handleMouseDownLocal =
|
|
14793
|
+
const handleMouseDownLocal = useCallback13(
|
|
14595
14794
|
(e) => {
|
|
14596
14795
|
e.preventDefault();
|
|
14597
14796
|
e.stopPropagation();
|
|
@@ -14602,7 +14801,7 @@ var DraggableTooltipComponent = ({
|
|
|
14602
14801
|
},
|
|
14603
14802
|
[id, onMouseDown]
|
|
14604
14803
|
);
|
|
14605
|
-
const handleTouchStartLocal =
|
|
14804
|
+
const handleTouchStartLocal = useCallback13(
|
|
14606
14805
|
(e) => {
|
|
14607
14806
|
e.stopPropagation();
|
|
14608
14807
|
const touch = e.touches[0];
|
|
@@ -14617,14 +14816,14 @@ var DraggableTooltipComponent = ({
|
|
|
14617
14816
|
},
|
|
14618
14817
|
[id, onMouseDown]
|
|
14619
14818
|
);
|
|
14620
|
-
const handleCloseClick =
|
|
14819
|
+
const handleCloseClick = useCallback13(
|
|
14621
14820
|
(e) => {
|
|
14622
14821
|
e.stopPropagation();
|
|
14623
14822
|
onClose(id);
|
|
14624
14823
|
},
|
|
14625
14824
|
[id, onClose]
|
|
14626
14825
|
);
|
|
14627
|
-
return /* @__PURE__ */ jsxs67(
|
|
14826
|
+
return /* @__PURE__ */ jsxs67(Fragment16, { children: [
|
|
14628
14827
|
dragging && alignmentGuides.map((guide, index) => {
|
|
14629
14828
|
const isHorizontal = guide.type === "horizontal";
|
|
14630
14829
|
const color = isHorizontal ? "#3b82f6" : "#ef4444";
|
|
@@ -14707,7 +14906,7 @@ var DraggableTooltipComponent = ({
|
|
|
14707
14906
|
)
|
|
14708
14907
|
] }, index);
|
|
14709
14908
|
}),
|
|
14710
|
-
/* @__PURE__ */ jsx90(
|
|
14909
|
+
/* @__PURE__ */ jsx90(AnimatePresence11, { children: /* @__PURE__ */ jsxs67(
|
|
14711
14910
|
motion19.div,
|
|
14712
14911
|
{
|
|
14713
14912
|
className: "fixed bg-card border border-border rounded-lg shadow-lg z-50 min-w-80 select-none",
|
|
@@ -15338,17 +15537,19 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
|
|
|
15338
15537
|
import { jsx as jsx94, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
15339
15538
|
var NoData = ({
|
|
15340
15539
|
paddingLeft = 0,
|
|
15341
|
-
height =
|
|
15540
|
+
height = 400,
|
|
15342
15541
|
message = "Sem dados para exibir",
|
|
15343
|
-
className
|
|
15542
|
+
className,
|
|
15543
|
+
title
|
|
15344
15544
|
}) => {
|
|
15345
|
-
const svgHeight = typeof height === "number" ? height :
|
|
15545
|
+
const svgHeight = typeof height === "number" ? height : 400;
|
|
15346
15546
|
const bars = [
|
|
15347
|
-
{ x:
|
|
15348
|
-
{ x:
|
|
15349
|
-
{ x:
|
|
15350
|
-
{ x:
|
|
15351
|
-
{ x:
|
|
15547
|
+
{ x: 100, w: 100, h: svgHeight * 0.35 },
|
|
15548
|
+
{ x: 220, w: 100, h: svgHeight * 0.65 },
|
|
15549
|
+
{ x: 340, w: 100, h: svgHeight * 0.5 },
|
|
15550
|
+
{ x: 460, w: 100, h: svgHeight * 0.75 },
|
|
15551
|
+
{ x: 580, w: 100, h: svgHeight * 0.45 },
|
|
15552
|
+
{ x: 700, w: 100, h: svgHeight * 0.3 }
|
|
15352
15553
|
];
|
|
15353
15554
|
const styleVars = {
|
|
15354
15555
|
["--pl"]: `${paddingLeft}px`,
|
|
@@ -15358,27 +15559,59 @@ var NoData = ({
|
|
|
15358
15559
|
"div",
|
|
15359
15560
|
{
|
|
15360
15561
|
className: cn(
|
|
15361
|
-
"rounded-
|
|
15562
|
+
"rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm",
|
|
15362
15563
|
className
|
|
15363
15564
|
),
|
|
15364
15565
|
style: styleVars,
|
|
15365
15566
|
role: "img",
|
|
15366
15567
|
"aria-label": message,
|
|
15367
|
-
children: /* @__PURE__ */ jsx94("div", { className: "w-full flex items-center justify-center pl-[var(--pl)]
|
|
15568
|
+
children: /* @__PURE__ */ jsx94("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-[var(--svg-h)]", children: /* @__PURE__ */ jsxs71("div", { className: "w-full max-w-[900px] relative", children: [
|
|
15368
15569
|
/* @__PURE__ */ jsxs71(
|
|
15369
15570
|
"svg",
|
|
15370
15571
|
{
|
|
15371
|
-
className: "w-full h-[var(--svg-h)]",
|
|
15572
|
+
className: "w-full h-[var(--svg-h)] opacity-40",
|
|
15372
15573
|
width: "100%",
|
|
15373
15574
|
viewBox: `0 0 900 ${svgHeight}`,
|
|
15374
15575
|
preserveAspectRatio: "none",
|
|
15375
15576
|
children: [
|
|
15376
15577
|
/* @__PURE__ */ jsxs71("defs", { children: [
|
|
15377
15578
|
/* @__PURE__ */ jsxs71("linearGradient", { id: "barGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
15378
|
-
/* @__PURE__ */ jsx94(
|
|
15379
|
-
|
|
15579
|
+
/* @__PURE__ */ jsx94(
|
|
15580
|
+
"stop",
|
|
15581
|
+
{
|
|
15582
|
+
offset: "0%",
|
|
15583
|
+
stopColor: "hsl(var(--primary))",
|
|
15584
|
+
stopOpacity: "0.15"
|
|
15585
|
+
}
|
|
15586
|
+
),
|
|
15587
|
+
/* @__PURE__ */ jsx94(
|
|
15588
|
+
"stop",
|
|
15589
|
+
{
|
|
15590
|
+
offset: "100%",
|
|
15591
|
+
stopColor: "hsl(var(--primary))",
|
|
15592
|
+
stopOpacity: "0.05"
|
|
15593
|
+
}
|
|
15594
|
+
)
|
|
15380
15595
|
] }),
|
|
15381
|
-
/* @__PURE__ */
|
|
15596
|
+
/* @__PURE__ */ jsxs71("linearGradient", { id: "gridGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
15597
|
+
/* @__PURE__ */ jsx94(
|
|
15598
|
+
"stop",
|
|
15599
|
+
{
|
|
15600
|
+
offset: "0%",
|
|
15601
|
+
stopColor: "hsl(var(--border))",
|
|
15602
|
+
stopOpacity: "0.4"
|
|
15603
|
+
}
|
|
15604
|
+
),
|
|
15605
|
+
/* @__PURE__ */ jsx94(
|
|
15606
|
+
"stop",
|
|
15607
|
+
{
|
|
15608
|
+
offset: "100%",
|
|
15609
|
+
stopColor: "hsl(var(--border))",
|
|
15610
|
+
stopOpacity: "0.1"
|
|
15611
|
+
}
|
|
15612
|
+
)
|
|
15613
|
+
] }),
|
|
15614
|
+
/* @__PURE__ */ jsxs71(
|
|
15382
15615
|
"filter",
|
|
15383
15616
|
{
|
|
15384
15617
|
id: "softShadow",
|
|
@@ -15386,16 +15619,15 @@ var NoData = ({
|
|
|
15386
15619
|
y: "-20%",
|
|
15387
15620
|
width: "140%",
|
|
15388
15621
|
height: "140%",
|
|
15389
|
-
children:
|
|
15390
|
-
"
|
|
15391
|
-
{
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
)
|
|
15622
|
+
children: [
|
|
15623
|
+
/* @__PURE__ */ jsx94("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3" }),
|
|
15624
|
+
/* @__PURE__ */ jsx94("feOffset", { dx: "0", dy: "2", result: "offsetblur" }),
|
|
15625
|
+
/* @__PURE__ */ jsx94("feComponentTransfer", { children: /* @__PURE__ */ jsx94("feFuncA", { type: "linear", slope: "0.2" }) }),
|
|
15626
|
+
/* @__PURE__ */ jsxs71("feMerge", { children: [
|
|
15627
|
+
/* @__PURE__ */ jsx94("feMergeNode", {}),
|
|
15628
|
+
/* @__PURE__ */ jsx94("feMergeNode", { in: "SourceGraphic" })
|
|
15629
|
+
] })
|
|
15630
|
+
]
|
|
15399
15631
|
}
|
|
15400
15632
|
)
|
|
15401
15633
|
] }),
|
|
@@ -15406,66 +15638,97 @@ var NoData = ({
|
|
|
15406
15638
|
y: 0,
|
|
15407
15639
|
width: 900,
|
|
15408
15640
|
height: svgHeight,
|
|
15409
|
-
fill: "
|
|
15641
|
+
fill: "hsl(var(--muted)/0.2)",
|
|
15642
|
+
rx: 8
|
|
15410
15643
|
}
|
|
15411
15644
|
),
|
|
15412
|
-
Array.from({ length:
|
|
15413
|
-
const y = 40 + (svgHeight - 80) /
|
|
15645
|
+
Array.from({ length: 6 }).map((_, i) => {
|
|
15646
|
+
const y = 40 + (svgHeight - 80) / 5 * i;
|
|
15414
15647
|
return /* @__PURE__ */ jsx94(
|
|
15415
15648
|
"line",
|
|
15416
15649
|
{
|
|
15417
|
-
x1:
|
|
15418
|
-
x2:
|
|
15650
|
+
x1: 50,
|
|
15651
|
+
x2: 850,
|
|
15419
15652
|
y1: y,
|
|
15420
15653
|
y2: y,
|
|
15421
|
-
stroke: "
|
|
15422
|
-
strokeWidth: 1
|
|
15654
|
+
stroke: "url(#gridGradient)",
|
|
15655
|
+
strokeWidth: 1.5,
|
|
15656
|
+
strokeDasharray: "4 4"
|
|
15423
15657
|
},
|
|
15424
15658
|
`g-${i}`
|
|
15425
15659
|
);
|
|
15426
15660
|
}),
|
|
15661
|
+
/* @__PURE__ */ jsx94(
|
|
15662
|
+
"line",
|
|
15663
|
+
{
|
|
15664
|
+
x1: 50,
|
|
15665
|
+
y1: 30,
|
|
15666
|
+
x2: 50,
|
|
15667
|
+
y2: svgHeight - 40,
|
|
15668
|
+
stroke: "hsl(var(--foreground))",
|
|
15669
|
+
strokeWidth: 2,
|
|
15670
|
+
opacity: 0.5
|
|
15671
|
+
}
|
|
15672
|
+
),
|
|
15673
|
+
/* @__PURE__ */ jsx94(
|
|
15674
|
+
"line",
|
|
15675
|
+
{
|
|
15676
|
+
x1: 50,
|
|
15677
|
+
y1: svgHeight - 40,
|
|
15678
|
+
x2: 850,
|
|
15679
|
+
y2: svgHeight - 40,
|
|
15680
|
+
stroke: "hsl(var(--foreground))",
|
|
15681
|
+
strokeWidth: 2,
|
|
15682
|
+
opacity: 0.5
|
|
15683
|
+
}
|
|
15684
|
+
),
|
|
15427
15685
|
bars.map((b, i) => /* @__PURE__ */ jsxs71("g", { children: [
|
|
15428
15686
|
/* @__PURE__ */ jsx94(
|
|
15429
15687
|
"rect",
|
|
15430
15688
|
{
|
|
15431
15689
|
x: b.x,
|
|
15432
|
-
y: svgHeight -
|
|
15690
|
+
y: svgHeight - 40 - b.h,
|
|
15433
15691
|
width: b.w,
|
|
15434
15692
|
height: b.h,
|
|
15435
|
-
rx:
|
|
15693
|
+
rx: 4,
|
|
15436
15694
|
fill: "url(#barGradient)",
|
|
15437
|
-
filter: "url(#softShadow)"
|
|
15438
|
-
opacity: 0.95
|
|
15695
|
+
filter: "url(#softShadow)"
|
|
15439
15696
|
}
|
|
15440
15697
|
),
|
|
15441
15698
|
/* @__PURE__ */ jsx94(
|
|
15442
15699
|
"rect",
|
|
15443
15700
|
{
|
|
15444
15701
|
x: b.x,
|
|
15445
|
-
y: svgHeight -
|
|
15702
|
+
y: svgHeight - 40 - b.h,
|
|
15446
15703
|
width: b.w,
|
|
15447
15704
|
height: b.h,
|
|
15448
|
-
rx:
|
|
15705
|
+
rx: 4,
|
|
15449
15706
|
fill: "none",
|
|
15450
|
-
stroke: "
|
|
15707
|
+
stroke: "hsl(var(--foreground))",
|
|
15708
|
+
strokeWidth: 1,
|
|
15709
|
+
opacity: 0.3
|
|
15451
15710
|
}
|
|
15452
15711
|
),
|
|
15453
15712
|
/* @__PURE__ */ jsx94(
|
|
15454
|
-
"
|
|
15713
|
+
"line",
|
|
15455
15714
|
{
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
|
|
15715
|
+
x1: b.x + b.w / 2,
|
|
15716
|
+
y1: svgHeight - 40,
|
|
15717
|
+
x2: b.x + b.w / 2,
|
|
15718
|
+
y2: svgHeight - 35,
|
|
15719
|
+
stroke: "hsl(var(--foreground))",
|
|
15720
|
+
strokeWidth: 1.5,
|
|
15721
|
+
opacity: 0.4
|
|
15462
15722
|
}
|
|
15463
15723
|
)
|
|
15464
15724
|
] }, `barg-${i}`))
|
|
15465
15725
|
]
|
|
15466
15726
|
}
|
|
15467
15727
|
),
|
|
15468
|
-
/* @__PURE__ */ jsx94("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */
|
|
15728
|
+
/* @__PURE__ */ jsx94("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ jsxs71("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: [
|
|
15729
|
+
title && /* @__PURE__ */ jsx94("h3", { className: "text-xl font-semibold text-foreground mb-2", children: title }),
|
|
15730
|
+
/* @__PURE__ */ jsx94("p", { className: "text-lg font-medium text-foreground/90 mb-2", children: message })
|
|
15731
|
+
] }) })
|
|
15469
15732
|
] }) })
|
|
15470
15733
|
}
|
|
15471
15734
|
);
|
|
@@ -15530,12 +15793,12 @@ var Chart = ({
|
|
|
15530
15793
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
15531
15794
|
}, [data, xAxis, labelMap]);
|
|
15532
15795
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
15533
|
-
const [activeTooltips, setActiveTooltips] =
|
|
15534
|
-
const [highlightedSeries, setHighlightedSeries] =
|
|
15796
|
+
const [activeTooltips, setActiveTooltips] = useState38([]);
|
|
15797
|
+
const [highlightedSeries, setHighlightedSeries] = useState38(
|
|
15535
15798
|
/* @__PURE__ */ new Set()
|
|
15536
15799
|
);
|
|
15537
|
-
const [showOnlyHighlighted, setShowOnlyHighlighted] =
|
|
15538
|
-
|
|
15800
|
+
const [showOnlyHighlighted, setShowOnlyHighlighted] = useState38(false);
|
|
15801
|
+
useEffect30(() => {
|
|
15539
15802
|
if (highlightedSeries.size === 0 && showOnlyHighlighted) {
|
|
15540
15803
|
setShowOnlyHighlighted(false);
|
|
15541
15804
|
}
|
|
@@ -15544,8 +15807,8 @@ var Chart = ({
|
|
|
15544
15807
|
...item,
|
|
15545
15808
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
15546
15809
|
}));
|
|
15547
|
-
const wrapperRef =
|
|
15548
|
-
const [measuredWidth, setMeasuredWidth] =
|
|
15810
|
+
const wrapperRef = useRef21(null);
|
|
15811
|
+
const [measuredWidth, setMeasuredWidth] = useState38(null);
|
|
15549
15812
|
useLayoutEffect3(() => {
|
|
15550
15813
|
const el = wrapperRef.current;
|
|
15551
15814
|
if (!el) return;
|
|
@@ -15573,7 +15836,7 @@ var Chart = ({
|
|
|
15573
15836
|
);
|
|
15574
15837
|
}
|
|
15575
15838
|
const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
|
|
15576
|
-
const generateColors =
|
|
15839
|
+
const generateColors = useCallback14(
|
|
15577
15840
|
(dataKeys) => {
|
|
15578
15841
|
const colorMap = {};
|
|
15579
15842
|
const allColors = generateAdditionalColors(colors2, dataKeys.length);
|
|
@@ -15612,7 +15875,7 @@ var Chart = ({
|
|
|
15612
15875
|
() => allKeys.filter((k) => !rightKeys.includes(k)),
|
|
15613
15876
|
[allKeys, rightKeys]
|
|
15614
15877
|
);
|
|
15615
|
-
const adaptDataForTooltip =
|
|
15878
|
+
const adaptDataForTooltip = useCallback14(
|
|
15616
15879
|
(universalData) => ({
|
|
15617
15880
|
...universalData,
|
|
15618
15881
|
name: String(universalData[xAxisConfig.dataKey] || "N/A")
|
|
@@ -15623,10 +15886,10 @@ var Chart = ({
|
|
|
15623
15886
|
() => activeTooltips.map((t) => adaptDataForTooltip(t.data).name),
|
|
15624
15887
|
[activeTooltips, adaptDataForTooltip]
|
|
15625
15888
|
);
|
|
15626
|
-
|
|
15889
|
+
useEffect30(() => {
|
|
15627
15890
|
window.dispatchEvent(new Event("recountTooltips"));
|
|
15628
15891
|
}, [activeTooltips.length]);
|
|
15629
|
-
const toggleHighlight =
|
|
15892
|
+
const toggleHighlight = useCallback14((key) => {
|
|
15630
15893
|
setHighlightedSeries((prev) => {
|
|
15631
15894
|
const next = new Set(prev);
|
|
15632
15895
|
if (next.has(key)) next.delete(key);
|
|
@@ -15684,7 +15947,7 @@ var Chart = ({
|
|
|
15684
15947
|
}
|
|
15685
15948
|
return min;
|
|
15686
15949
|
}, [processedData, rightKeys]);
|
|
15687
|
-
const computeNiceMax =
|
|
15950
|
+
const computeNiceMax = useCallback14((maxValue) => {
|
|
15688
15951
|
let padding = 0.08;
|
|
15689
15952
|
if (maxValue > 1e6) padding = 0.05;
|
|
15690
15953
|
if (maxValue > 1e7) padding = 0.03;
|
|
@@ -15731,7 +15994,7 @@ var Chart = ({
|
|
|
15731
15994
|
niceMaxLeft,
|
|
15732
15995
|
niceMaxRight
|
|
15733
15996
|
]);
|
|
15734
|
-
const toggleTooltip =
|
|
15997
|
+
const toggleTooltip = useCallback14(
|
|
15735
15998
|
(tooltipId, data2, basePosition) => {
|
|
15736
15999
|
const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
|
|
15737
16000
|
if (existingIndex !== -1) {
|
|
@@ -15760,7 +16023,7 @@ var Chart = ({
|
|
|
15760
16023
|
},
|
|
15761
16024
|
[activeTooltips, maxTooltips]
|
|
15762
16025
|
);
|
|
15763
|
-
const handleChartClick =
|
|
16026
|
+
const handleChartClick = useCallback14(
|
|
15764
16027
|
(e) => {
|
|
15765
16028
|
if (!enableDraggableTooltips) return;
|
|
15766
16029
|
const ev = e;
|
|
@@ -15778,7 +16041,7 @@ var Chart = ({
|
|
|
15778
16041
|
},
|
|
15779
16042
|
[enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
|
|
15780
16043
|
);
|
|
15781
|
-
const handleBarClick =
|
|
16044
|
+
const handleBarClick = useCallback14(
|
|
15782
16045
|
(data2, index, event) => {
|
|
15783
16046
|
if (!enableDraggableTooltips) return;
|
|
15784
16047
|
event.stopPropagation();
|
|
@@ -15792,7 +16055,7 @@ var Chart = ({
|
|
|
15792
16055
|
},
|
|
15793
16056
|
[enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
|
|
15794
16057
|
);
|
|
15795
|
-
const handleSeriesClick =
|
|
16058
|
+
const handleSeriesClick = useCallback14(
|
|
15796
16059
|
(...args) => {
|
|
15797
16060
|
if (args.length >= 3) {
|
|
15798
16061
|
const [data2, index, event] = args;
|
|
@@ -15803,7 +16066,7 @@ var Chart = ({
|
|
|
15803
16066
|
},
|
|
15804
16067
|
[handleBarClick, handleChartClick]
|
|
15805
16068
|
);
|
|
15806
|
-
const onTooltipPositionChange =
|
|
16069
|
+
const onTooltipPositionChange = useCallback14(
|
|
15807
16070
|
(id, position) => {
|
|
15808
16071
|
setActiveTooltips(
|
|
15809
16072
|
(prev) => prev.map((t) => t.id === id ? { ...t, position } : t)
|
|
@@ -15889,12 +16152,23 @@ var Chart = ({
|
|
|
15889
16152
|
const yAxisTickWidth = useMemo25(() => {
|
|
15890
16153
|
if (typeof chartMargin?.left === "number") return chartMargin.left;
|
|
15891
16154
|
if (yAxisLabel) return axisLabelMargin;
|
|
15892
|
-
const samples = [
|
|
16155
|
+
const samples = [
|
|
16156
|
+
minLeftDataValue,
|
|
16157
|
+
niceMaxLeft,
|
|
16158
|
+
Math.round((minLeftDataValue + niceMaxLeft) / 2),
|
|
16159
|
+
0
|
|
16160
|
+
];
|
|
15893
16161
|
const formatted = samples.map((v) => String(yTickFormatter(v)));
|
|
15894
16162
|
const maxLen = formatted.reduce((m, s) => Math.max(m, s.length), 0);
|
|
15895
16163
|
const estimated = Math.max(48, Math.min(220, maxLen * 8 + 24));
|
|
15896
16164
|
return estimated;
|
|
15897
|
-
}, [
|
|
16165
|
+
}, [
|
|
16166
|
+
chartMargin?.left,
|
|
16167
|
+
yAxisLabel,
|
|
16168
|
+
yTickFormatter,
|
|
16169
|
+
minLeftDataValue,
|
|
16170
|
+
niceMaxLeft
|
|
16171
|
+
]);
|
|
15898
16172
|
const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
|
|
15899
16173
|
const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
|
|
15900
16174
|
const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
|
|
@@ -15907,7 +16181,7 @@ var Chart = ({
|
|
|
15907
16181
|
const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
|
|
15908
16182
|
const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
|
|
15909
16183
|
const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
|
|
15910
|
-
const openTooltipForPeriod =
|
|
16184
|
+
const openTooltipForPeriod = useCallback14(
|
|
15911
16185
|
(periodName) => {
|
|
15912
16186
|
if (!enableDraggableTooltips) return;
|
|
15913
16187
|
const row = processedData.find((r) => String(r.name) === periodName);
|
|
@@ -15964,7 +16238,7 @@ var Chart = ({
|
|
|
15964
16238
|
style: {
|
|
15965
16239
|
paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`
|
|
15966
16240
|
},
|
|
15967
|
-
children: /* @__PURE__ */ jsx95(NoData_default, {})
|
|
16241
|
+
children: /* @__PURE__ */ jsx95(NoData_default, { title })
|
|
15968
16242
|
}
|
|
15969
16243
|
)
|
|
15970
16244
|
}
|
|
@@ -16413,7 +16687,7 @@ var Chart = ({
|
|
|
16413
16687
|
var Chart_default = Chart;
|
|
16414
16688
|
|
|
16415
16689
|
// src/components/ui/charts/BarChart.tsx
|
|
16416
|
-
import { useState as
|
|
16690
|
+
import { useState as useState39, useEffect as useEffect31, useCallback as useCallback15, useMemo as useMemo26 } from "react";
|
|
16417
16691
|
import {
|
|
16418
16692
|
BarChart as RechartsBarChart,
|
|
16419
16693
|
Bar as Bar2,
|
|
@@ -16505,14 +16779,14 @@ var BarChart = ({
|
|
|
16505
16779
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
16506
16780
|
}, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
|
|
16507
16781
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
16508
|
-
const [activeTooltips, setActiveTooltips] =
|
|
16509
|
-
const [isDragging, setIsDragging] =
|
|
16510
|
-
const [dragOffset, setDragOffset] =
|
|
16782
|
+
const [activeTooltips, setActiveTooltips] = useState39([]);
|
|
16783
|
+
const [isDragging, setIsDragging] = useState39(null);
|
|
16784
|
+
const [dragOffset, setDragOffset] = useState39({
|
|
16511
16785
|
x: 0,
|
|
16512
16786
|
y: 0
|
|
16513
16787
|
});
|
|
16514
|
-
const [globalTooltipCount, setGlobalTooltipCount] =
|
|
16515
|
-
const [alignmentGuides, setAlignmentGuides] =
|
|
16788
|
+
const [globalTooltipCount, setGlobalTooltipCount] = useState39(0);
|
|
16789
|
+
const [alignmentGuides, setAlignmentGuides] = useState39([]);
|
|
16516
16790
|
const processedData = data.map((item) => ({
|
|
16517
16791
|
...item,
|
|
16518
16792
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
@@ -16589,7 +16863,7 @@ var BarChart = ({
|
|
|
16589
16863
|
const GUIDE_THRESHOLD2 = 60;
|
|
16590
16864
|
const STRONG_SNAP_THRESHOLD2 = 35;
|
|
16591
16865
|
const PRECISION_SNAP_THRESHOLD2 = 8;
|
|
16592
|
-
const updateAlignmentGuides =
|
|
16866
|
+
const updateAlignmentGuides = useCallback15(
|
|
16593
16867
|
(draggedTooltipId, currentPosition) => {
|
|
16594
16868
|
if (!isDragging) return;
|
|
16595
16869
|
const getAllTooltips = () => {
|
|
@@ -16653,7 +16927,7 @@ var BarChart = ({
|
|
|
16653
16927
|
},
|
|
16654
16928
|
[isDragging, activeTooltips]
|
|
16655
16929
|
);
|
|
16656
|
-
const snapToGuides =
|
|
16930
|
+
const snapToGuides = useCallback15(
|
|
16657
16931
|
(position) => {
|
|
16658
16932
|
const snappedPosition = { ...position };
|
|
16659
16933
|
let hasSnapped = false;
|
|
@@ -16715,7 +16989,7 @@ var BarChart = ({
|
|
|
16715
16989
|
setIsDragging(tooltipId);
|
|
16716
16990
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
16717
16991
|
};
|
|
16718
|
-
|
|
16992
|
+
useEffect31(() => {
|
|
16719
16993
|
let rafId;
|
|
16720
16994
|
let lastMousePosition = { x: 0, y: 0 };
|
|
16721
16995
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -16773,7 +17047,7 @@ var BarChart = ({
|
|
|
16773
17047
|
updateAlignmentGuides,
|
|
16774
17048
|
snapToGuides
|
|
16775
17049
|
]);
|
|
16776
|
-
|
|
17050
|
+
useEffect31(() => {
|
|
16777
17051
|
const handleCloseAllTooltips = () => {
|
|
16778
17052
|
setActiveTooltips([]);
|
|
16779
17053
|
setGlobalTooltipCount(0);
|
|
@@ -16783,7 +17057,7 @@ var BarChart = ({
|
|
|
16783
17057
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
|
|
16784
17058
|
};
|
|
16785
17059
|
}, []);
|
|
16786
|
-
|
|
17060
|
+
useEffect31(() => {
|
|
16787
17061
|
const handleTooltipCountRequest = () => {
|
|
16788
17062
|
window.dispatchEvent(
|
|
16789
17063
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -16822,7 +17096,7 @@ var BarChart = ({
|
|
|
16822
17096
|
);
|
|
16823
17097
|
};
|
|
16824
17098
|
}, [activeTooltips]);
|
|
16825
|
-
|
|
17099
|
+
useEffect31(() => {
|
|
16826
17100
|
if (isDragging) return;
|
|
16827
17101
|
let totalCount = 0;
|
|
16828
17102
|
const handleCountResponse = (event) => {
|
|
@@ -17088,7 +17362,7 @@ var BarChart = ({
|
|
|
17088
17362
|
var BarChart_default = BarChart;
|
|
17089
17363
|
|
|
17090
17364
|
// src/components/ui/charts/LineChart.tsx
|
|
17091
|
-
import { useState as
|
|
17365
|
+
import { useState as useState40, useEffect as useEffect32, useCallback as useCallback16, useMemo as useMemo27 } from "react";
|
|
17092
17366
|
import {
|
|
17093
17367
|
LineChart as RechartsLineChart,
|
|
17094
17368
|
Line as Line2,
|
|
@@ -17131,14 +17405,14 @@ var CustomLineChart = ({
|
|
|
17131
17405
|
containerPaddingLeft,
|
|
17132
17406
|
16
|
|
17133
17407
|
);
|
|
17134
|
-
const [activeTooltips, setActiveTooltips] =
|
|
17135
|
-
const [isDragging, setIsDragging] =
|
|
17136
|
-
const [dragOffset, setDragOffset] =
|
|
17408
|
+
const [activeTooltips, setActiveTooltips] = useState40([]);
|
|
17409
|
+
const [isDragging, setIsDragging] = useState40(null);
|
|
17410
|
+
const [dragOffset, setDragOffset] = useState40({
|
|
17137
17411
|
x: 0,
|
|
17138
17412
|
y: 0
|
|
17139
17413
|
});
|
|
17140
|
-
const [globalTooltipCount, setGlobalTooltipCount] =
|
|
17141
|
-
const [alignmentGuides, setAlignmentGuides] =
|
|
17414
|
+
const [globalTooltipCount, setGlobalTooltipCount] = useState40(0);
|
|
17415
|
+
const [alignmentGuides, setAlignmentGuides] = useState40([]);
|
|
17142
17416
|
const generateColors = (dataKeys2) => {
|
|
17143
17417
|
const colorMap = {};
|
|
17144
17418
|
const allColors = generateAdditionalColors(colors2, dataKeys2.length);
|
|
@@ -17240,10 +17514,10 @@ var CustomLineChart = ({
|
|
|
17240
17514
|
const handleChartBackgroundClick = () => {
|
|
17241
17515
|
setActiveTooltips([]);
|
|
17242
17516
|
};
|
|
17243
|
-
const handleCloseAllTooltips =
|
|
17517
|
+
const handleCloseAllTooltips = useCallback16(() => {
|
|
17244
17518
|
window.dispatchEvent(new CustomEvent("closeAllTooltips"));
|
|
17245
17519
|
}, []);
|
|
17246
|
-
const updateAlignmentGuides =
|
|
17520
|
+
const updateAlignmentGuides = useCallback16(
|
|
17247
17521
|
(draggedTooltipId, draggedPosition) => {
|
|
17248
17522
|
const SNAP_THRESHOLD = 15;
|
|
17249
17523
|
const draggedTooltip = activeTooltips.find(
|
|
@@ -17324,7 +17598,7 @@ var CustomLineChart = ({
|
|
|
17324
17598
|
},
|
|
17325
17599
|
[activeTooltips]
|
|
17326
17600
|
);
|
|
17327
|
-
const snapToGuides =
|
|
17601
|
+
const snapToGuides = useCallback16(
|
|
17328
17602
|
(position) => {
|
|
17329
17603
|
const SNAP_DISTANCE = 10;
|
|
17330
17604
|
const snappedPosition = { ...position };
|
|
@@ -17352,7 +17626,7 @@ var CustomLineChart = ({
|
|
|
17352
17626
|
setIsDragging(tooltipId);
|
|
17353
17627
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
17354
17628
|
};
|
|
17355
|
-
|
|
17629
|
+
useEffect32(() => {
|
|
17356
17630
|
let rafId;
|
|
17357
17631
|
let lastMousePosition = { x: 0, y: 0 };
|
|
17358
17632
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -17399,7 +17673,7 @@ var CustomLineChart = ({
|
|
|
17399
17673
|
updateAlignmentGuides,
|
|
17400
17674
|
snapToGuides
|
|
17401
17675
|
]);
|
|
17402
|
-
|
|
17676
|
+
useEffect32(() => {
|
|
17403
17677
|
const handleCloseAllTooltips2 = () => {
|
|
17404
17678
|
setActiveTooltips([]);
|
|
17405
17679
|
setGlobalTooltipCount(0);
|
|
@@ -17409,7 +17683,7 @@ var CustomLineChart = ({
|
|
|
17409
17683
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
|
|
17410
17684
|
};
|
|
17411
17685
|
}, []);
|
|
17412
|
-
|
|
17686
|
+
useEffect32(() => {
|
|
17413
17687
|
const handleTooltipCountRequest = () => {
|
|
17414
17688
|
window.dispatchEvent(
|
|
17415
17689
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -17453,7 +17727,7 @@ var CustomLineChart = ({
|
|
|
17453
17727
|
);
|
|
17454
17728
|
};
|
|
17455
17729
|
}, [activeTooltips]);
|
|
17456
|
-
|
|
17730
|
+
useEffect32(() => {
|
|
17457
17731
|
if (isDragging) return;
|
|
17458
17732
|
let totalCount = 0;
|
|
17459
17733
|
const handleCountResponse = (event) => {
|
|
@@ -17782,13 +18056,13 @@ var CustomPieChart = ({
|
|
|
17782
18056
|
var PieChart_default = CustomPieChart;
|
|
17783
18057
|
|
|
17784
18058
|
// src/components/ui/charts/hooks/useChartHighlights.tsx
|
|
17785
|
-
import { useState as
|
|
18059
|
+
import { useState as useState41, useCallback as useCallback17 } from "react";
|
|
17786
18060
|
var useChartHighlights = () => {
|
|
17787
|
-
const [highlightedSeries, setHighlightedSeries] =
|
|
18061
|
+
const [highlightedSeries, setHighlightedSeries] = useState41(
|
|
17788
18062
|
/* @__PURE__ */ new Set()
|
|
17789
18063
|
);
|
|
17790
|
-
const [showOnlyHighlighted, setShowOnlyHighlighted] =
|
|
17791
|
-
const toggleHighlight =
|
|
18064
|
+
const [showOnlyHighlighted, setShowOnlyHighlighted] = useState41(false);
|
|
18065
|
+
const toggleHighlight = useCallback17((key) => {
|
|
17792
18066
|
setHighlightedSeries((prev) => {
|
|
17793
18067
|
const next = new Set(prev);
|
|
17794
18068
|
if (next.has(key)) {
|
|
@@ -17799,17 +18073,17 @@ var useChartHighlights = () => {
|
|
|
17799
18073
|
return next;
|
|
17800
18074
|
});
|
|
17801
18075
|
}, []);
|
|
17802
|
-
const clearHighlights =
|
|
18076
|
+
const clearHighlights = useCallback17(() => {
|
|
17803
18077
|
setHighlightedSeries(/* @__PURE__ */ new Set());
|
|
17804
18078
|
setShowOnlyHighlighted(false);
|
|
17805
18079
|
}, []);
|
|
17806
|
-
const isHighlighted =
|
|
18080
|
+
const isHighlighted = useCallback17(
|
|
17807
18081
|
(key) => {
|
|
17808
18082
|
return highlightedSeries.has(key);
|
|
17809
18083
|
},
|
|
17810
18084
|
[highlightedSeries]
|
|
17811
18085
|
);
|
|
17812
|
-
const getSeriesStyle =
|
|
18086
|
+
const getSeriesStyle = useCallback17(
|
|
17813
18087
|
(key) => {
|
|
17814
18088
|
const hasHighlights = highlightedSeries.size > 0;
|
|
17815
18089
|
const isSeriesHighlighted = highlightedSeries.has(key);
|
|
@@ -17853,83 +18127,6 @@ var useChartHighlights = () => {
|
|
|
17853
18127
|
isHighlighted
|
|
17854
18128
|
};
|
|
17855
18129
|
};
|
|
17856
|
-
|
|
17857
|
-
// src/hooks/use-drag.tsx
|
|
17858
|
-
import { useState as useState40, useCallback as useCallback16, useRef as useRef19, useEffect as useEffect30 } from "react";
|
|
17859
|
-
var useDrag = (options = {}) => {
|
|
17860
|
-
const [isDragging, setIsDragging] = useState40(null);
|
|
17861
|
-
const [positions, setPositions] = useState40({});
|
|
17862
|
-
const dragStartPos = useRef19(null);
|
|
17863
|
-
const dragId = useRef19(null);
|
|
17864
|
-
const handleMouseDown = useCallback16((id, e) => {
|
|
17865
|
-
e.preventDefault();
|
|
17866
|
-
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
17867
|
-
dragStartPos.current = {
|
|
17868
|
-
x: e.clientX,
|
|
17869
|
-
y: e.clientY,
|
|
17870
|
-
elementX: currentPosition.left,
|
|
17871
|
-
elementY: currentPosition.top
|
|
17872
|
-
};
|
|
17873
|
-
dragId.current = id;
|
|
17874
|
-
setIsDragging(id);
|
|
17875
|
-
options.onDragStart?.(id);
|
|
17876
|
-
}, [positions, options]);
|
|
17877
|
-
const handleMouseMove = useCallback16((e) => {
|
|
17878
|
-
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
17879
|
-
const deltaX = e.clientX - dragStartPos.current.x;
|
|
17880
|
-
const deltaY = e.clientY - dragStartPos.current.y;
|
|
17881
|
-
const newPosition = {
|
|
17882
|
-
left: dragStartPos.current.elementX + deltaX,
|
|
17883
|
-
top: dragStartPos.current.elementY + deltaY
|
|
17884
|
-
};
|
|
17885
|
-
newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
|
|
17886
|
-
newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
|
|
17887
|
-
setPositions((prev) => ({
|
|
17888
|
-
...prev,
|
|
17889
|
-
[dragId.current]: newPosition
|
|
17890
|
-
}));
|
|
17891
|
-
options.onDrag?.(dragId.current, newPosition);
|
|
17892
|
-
}, [isDragging, options]);
|
|
17893
|
-
const handleMouseUp = useCallback16(() => {
|
|
17894
|
-
if (dragId.current) {
|
|
17895
|
-
options.onDragEnd?.(dragId.current);
|
|
17896
|
-
}
|
|
17897
|
-
setIsDragging(null);
|
|
17898
|
-
dragStartPos.current = null;
|
|
17899
|
-
dragId.current = null;
|
|
17900
|
-
}, [options]);
|
|
17901
|
-
useEffect30(() => {
|
|
17902
|
-
if (isDragging) {
|
|
17903
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
17904
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
17905
|
-
document.body.style.userSelect = "none";
|
|
17906
|
-
return () => {
|
|
17907
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
17908
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
17909
|
-
document.body.style.userSelect = "";
|
|
17910
|
-
};
|
|
17911
|
-
}
|
|
17912
|
-
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
17913
|
-
const setPosition = useCallback16((id, position) => {
|
|
17914
|
-
setPositions((prev) => ({
|
|
17915
|
-
...prev,
|
|
17916
|
-
[id]: position
|
|
17917
|
-
}));
|
|
17918
|
-
}, []);
|
|
17919
|
-
const getPosition = useCallback16((id) => {
|
|
17920
|
-
return positions[id] || { top: 0, left: 0 };
|
|
17921
|
-
}, [positions]);
|
|
17922
|
-
const isElementDragging = useCallback16((id) => {
|
|
17923
|
-
return isDragging === id;
|
|
17924
|
-
}, [isDragging]);
|
|
17925
|
-
return {
|
|
17926
|
-
handleMouseDown,
|
|
17927
|
-
getPosition,
|
|
17928
|
-
setPosition,
|
|
17929
|
-
isElementDragging,
|
|
17930
|
-
isDragging: isDragging !== null
|
|
17931
|
-
};
|
|
17932
|
-
};
|
|
17933
18130
|
export {
|
|
17934
18131
|
AddButton,
|
|
17935
18132
|
Agenda,
|