@mlw-packages/react-components 1.7.27 → 1.7.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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 useCallback3, useMemo as useMemo3, useEffect } from "react";
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) => /* @__PURE__ */ jsx6(
845
- CommandPrimitive.List,
846
- {
847
- ref,
848
- className: cn(
849
- "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",
850
- className
851
- ),
852
- "data-testid": dataTestId,
853
- style: {
854
- overscrollBehavior: "contain",
855
- WebkitOverflowScrolling: "touch"
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
- ...props
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 = useCallback(
1160
+ const checkIsSelected = useCallback2(
1136
1161
  (value) => selected == null ? false : selected == value,
1137
1162
  [selected]
1138
1163
  );
1139
- const handleSelection = useCallback(
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 useCallback2, useMemo as useMemo2 } from "react";
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 = useCallback2(
1211
+ const checkIsSelected = useCallback3(
1187
1212
  (value) => selected.includes(value),
1188
1213
  [selected]
1189
1214
  );
1190
- const handleSelection = useCallback2(
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 useEffect2, useState as useState3 } from "react";
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
- useEffect2(() => {
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
- useEffect2(() => {
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 useCallback6, useEffect as useEffect10, useRef as useRef4 } from "react";
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 = useCallback6((element, content, options) => {
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 = useCallback6((tooltipId, event) => {
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 useEffect11, useState as useState11 } from "react";
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
- useEffect11(() => {
6805
+ useEffect12(() => {
6781
6806
  setValue(initialValue);
6782
6807
  }, [initialValue]);
6783
- useEffect11(() => {
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 useCallback7, useMemo as useMemo5, useState as useState12, useEffect as useEffect12, useRef as useRef5 } from "react";
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 = useCallback7(
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 = useCallback7(
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 = useRef5(null);
6885
- useEffect12(() => {
6909
+ const checkboxRef = useRef6(null);
6910
+ useEffect13(() => {
6886
6911
  if (checkboxRef.current) {
6887
6912
  checkboxRef.current.indeterminate = status === "indeterminate";
6888
6913
  }
@@ -6983,6 +7008,85 @@ import {
6983
7008
  XIcon as XIcon9,
6984
7009
  CalendarIcon
6985
7010
  } from "@phosphor-icons/react";
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,6 +7094,7 @@ function CalendarBase2({
6990
7094
  showOutsideDays = true,
6991
7095
  ...props
6992
7096
  }) {
7097
+ const isMobile = useIsMobile();
6993
7098
  return /* @__PURE__ */ jsx55(
6994
7099
  "div",
6995
7100
  {
@@ -7011,14 +7116,16 @@ function CalendarBase2({
7011
7116
  month: "relative flex-1 min-w-0",
7012
7117
  month_caption: "flex items-center gap-2 min-h-[2.25rem] mb-4",
7013
7118
  caption_label: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize",
7014
- nav: "hidden",
7119
+ nav: "hidden ",
7015
7120
  button_previous: cn(
7016
7121
  buttonVariantsBase({ variant: "outline" }),
7017
- "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"
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" : ""
7018
7124
  ),
7019
7125
  button_next: cn(
7020
7126
  buttonVariantsBase({ variant: "outline" }),
7021
- "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"
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" : ""
7022
7129
  ),
7023
7130
  month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
7024
7131
  weekdays: "grid grid-cols-7 gap-1 mb-1",
@@ -7062,7 +7169,7 @@ CalendarBase2.displayName = "CalendarBase";
7062
7169
 
7063
7170
  // src/components/ui/picker/DateTimePicker.tsx
7064
7171
  import { ptBR as ptBR2 } from "date-fns/locale";
7065
- import { useEffect as useEffect14, useState as useState16 } from "react";
7172
+ import { useEffect as useEffect17, useState as useState18 } from "react";
7066
7173
  import { CalendarBlankIcon } from "@phosphor-icons/react";
7067
7174
 
7068
7175
  // src/components/ui/shared/ClearButton.tsx
@@ -7096,27 +7203,33 @@ function ClearButton({
7096
7203
  }
7097
7204
 
7098
7205
  // src/components/ui/picker/TimeScrollPicker.tsx
7099
- import { useEffect as useEffect13, useRef as useRef6, useState as useState15 } from "react";
7206
+ import { useEffect as useEffect15, useRef as useRef8, useState as useState16 } from "react";
7100
7207
  import { jsx as jsx57, jsxs as jsxs38 } from "react/jsx-runtime";
7101
- var ITEM_HEIGHT = 36;
7208
+ var ITEM_HEIGHT = 39;
7102
7209
  var ITEM_HEIGHT_MOBILE = 32;
7103
7210
  var VISIBLE_ITEMS = 5;
7104
7211
  var VISIBLE_ITEMS_MOBILE = 3;
7105
7212
  var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
7106
7213
  var CENTER_INDEX_MOBILE = Math.floor(VISIBLE_ITEMS_MOBILE / 2);
7107
- function ScrollColumn({ value, onChange, max, label }) {
7214
+ function ScrollColumn({
7215
+ value,
7216
+ onChange,
7217
+ max,
7218
+ label,
7219
+ hideSeconds
7220
+ }) {
7108
7221
  const isMobile = useIsMobile();
7109
- const containerRef = useRef6(null);
7222
+ const containerRef = useRef8(null);
7110
7223
  const items = Array.from({ length: max }, (_, i) => i);
7111
- const [isDragging, setIsDragging] = useState15(false);
7112
- const [startY, setStartY] = useState15(0);
7113
- const [scrollTop, setScrollTop] = useState15(0);
7114
- const scrollTimeoutRef = useRef6(null);
7224
+ const [isDragging, setIsDragging] = useState16(false);
7225
+ const [startY, setStartY] = useState16(0);
7226
+ const [scrollTop, setScrollTop] = useState16(0);
7227
+ const scrollTimeoutRef = useRef8(null);
7115
7228
  const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
7116
7229
  const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
7117
7230
  const visibleItems = isMobile ? VISIBLE_ITEMS_MOBILE : VISIBLE_ITEMS;
7118
7231
  const containerHeight = visibleItems * itemHeight;
7119
- useEffect13(() => {
7232
+ useEffect15(() => {
7120
7233
  if (containerRef.current && !isDragging) {
7121
7234
  requestAnimationFrame(() => {
7122
7235
  if (containerRef.current) {
@@ -7126,7 +7239,7 @@ function ScrollColumn({ value, onChange, max, label }) {
7126
7239
  });
7127
7240
  }
7128
7241
  }, [value, isDragging, itemHeight]);
7129
- useEffect13(() => {
7242
+ useEffect15(() => {
7130
7243
  return () => {
7131
7244
  if (scrollTimeoutRef.current) {
7132
7245
  clearTimeout(scrollTimeoutRef.current);
@@ -7171,55 +7284,44 @@ function ScrollColumn({ value, onChange, max, label }) {
7171
7284
  const handleMouseLeave = () => {
7172
7285
  if (isDragging) handleMouseUp();
7173
7286
  };
7287
+ const containerWidth = isMobile ? hideSeconds ? "w-16" : "w-8" : "w-16";
7174
7288
  return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col items-center gap-1", children: [
7175
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 }),
7176
- /* @__PURE__ */ jsxs38("div", { className: "relative w-16", children: [
7177
- /* @__PURE__ */ jsx57(
7178
- "div",
7179
- {
7180
- className: "absolute left-0 right-0 border-y-2 border-primary/20 pointer-events-none z-10",
7181
- style: {
7182
- top: `${centerIndex * itemHeight}px`,
7183
- height: `${itemHeight}px`
7184
- }
7185
- }
7186
- ),
7187
- /* @__PURE__ */ jsx57(
7188
- "div",
7189
- {
7190
- ref: containerRef,
7191
- className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
7192
- onScroll: handleScroll,
7193
- onMouseDown: handleMouseDown,
7194
- onMouseMove: handleMouseMove,
7195
- onMouseUp: handleMouseUp,
7196
- onMouseLeave: handleMouseLeave,
7197
- style: {
7198
- height: `${containerHeight}px`,
7199
- paddingTop: `${centerIndex * itemHeight}px`,
7200
- paddingBottom: `${centerIndex * itemHeight}px`,
7201
- cursor: isDragging ? "grabbing" : ""
7202
- },
7203
- children: items.map((item) => {
7204
- const isSelected = item === value;
7205
- return /* @__PURE__ */ jsx57(
7206
- "div",
7207
- {
7208
- className: cn(
7209
- "flex items-center justify-center select-none font-semibold tabular-nums",
7210
- isDragging ? "cursor-grabbing" : "",
7211
- isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
7212
- ),
7213
- style: { height: `${itemHeight}px` },
7214
- onClick: () => !isDragging && onChange(item),
7215
- children: item.toString().padStart(2, "0")
7216
- },
7217
- item
7218
- );
7219
- })
7220
- }
7221
- )
7222
- ] })
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
+ ) })
7223
7325
  ] });
7224
7326
  }
7225
7327
  function TimeScrollPicker({
@@ -7227,7 +7329,10 @@ function TimeScrollPicker({
7227
7329
  setDate,
7228
7330
  hideSeconds = false
7229
7331
  }) {
7332
+ const isMobile = useIsMobile();
7230
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;
7231
7336
  const handleTimeChange = (type, value) => {
7232
7337
  const newDate = new Date(currentDate);
7233
7338
  if (type === "hours") newDate.setHours(value);
@@ -7235,14 +7340,25 @@ function TimeScrollPicker({
7235
7340
  else newDate.setSeconds(value);
7236
7341
  setDate(newDate);
7237
7342
  };
7238
- return /* @__PURE__ */ jsx57("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ jsxs38("div", { className: "flex gap-2 ", children: [
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
+ ),
7239
7354
  /* @__PURE__ */ jsx57(
7240
7355
  ScrollColumn,
7241
7356
  {
7242
7357
  value: currentDate.getHours(),
7243
7358
  onChange: (v) => handleTimeChange("hours", v),
7244
7359
  max: 24,
7245
- label: "Hora"
7360
+ label: "Hora",
7361
+ hideSeconds
7246
7362
  }
7247
7363
  ),
7248
7364
  /* @__PURE__ */ jsx57(
@@ -7251,7 +7367,8 @@ function TimeScrollPicker({
7251
7367
  value: currentDate.getMinutes(),
7252
7368
  onChange: (v) => handleTimeChange("minutes", v),
7253
7369
  max: 60,
7254
- label: "Min"
7370
+ label: "Min",
7371
+ hideSeconds
7255
7372
  }
7256
7373
  ),
7257
7374
  !hideSeconds && /* @__PURE__ */ jsx57(
@@ -7260,14 +7377,46 @@ function TimeScrollPicker({
7260
7377
  value: currentDate.getSeconds(),
7261
7378
  onChange: (v) => handleTimeChange("seconds", v),
7262
7379
  max: 60,
7263
- label: "Seg"
7380
+ label: "Seg",
7381
+ hideSeconds
7264
7382
  }
7265
7383
  )
7266
7384
  ] }) });
7267
7385
  }
7268
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
+
7269
7418
  // src/components/ui/picker/DateTimePicker.tsx
7270
- 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";
7271
7420
  function DateTimePicker({
7272
7421
  label,
7273
7422
  date,
@@ -7282,11 +7431,14 @@ function DateTimePicker({
7282
7431
  className,
7283
7432
  error
7284
7433
  }) {
7285
- const [internalDate, setInternalDate] = useState16(date);
7286
- const [open, setOpen] = useState16(false);
7434
+ const [internalDate, setInternalDate] = useState18(date);
7435
+ const [open, setOpen] = useState18(false);
7436
+ const isMobile = useIsMobile();
7287
7437
  const handleSelect = (newDay) => {
7288
7438
  if (!newDay) return;
7289
7439
  if (!internalDate) {
7440
+ const now = /* @__PURE__ */ new Date();
7441
+ newDay.setHours(now.getHours(), now.getMinutes(), now.getSeconds());
7290
7442
  setInternalDate(newDay);
7291
7443
  onChange?.(newDay);
7292
7444
  return;
@@ -7314,59 +7466,46 @@ function DateTimePicker({
7314
7466
  if (!timeFormat) return "dd MMMM yyyy";
7315
7467
  return `dd MMMM yyyy - ${timeFormat}`;
7316
7468
  };
7317
- useEffect14(() => {
7469
+ useEffect17(() => {
7318
7470
  setInternalDate(date);
7319
7471
  }, [date, open]);
7320
- return /* @__PURE__ */ jsxs39("div", { className: cn("w-full sm:w-auto", className), children: [
7321
- label && /* @__PURE__ */ jsx58(LabelBase_default, { children: label }),
7322
- /* @__PURE__ */ jsxs39(PopoverBase, { open, onOpenChange: setOpen, children: [
7323
- /* @__PURE__ */ jsx58(
7324
- PopoverTriggerBase,
7325
- {
7326
- disabled,
7327
- asChild: true,
7328
- className: cn(error && "border-red-500"),
7329
- children: /* @__PURE__ */ jsxs39(
7330
- ButtonBase,
7331
- {
7332
- variant: "outline",
7333
- disabled,
7334
- className: cn(
7335
- "w-full justify-start text-left min-w-0 overflow-hidden",
7336
- !date && "text-muted-foreground"
7337
- ),
7338
- children: [
7339
- /* @__PURE__ */ jsx58(
7340
- "span",
7341
- {
7342
- className: cn(
7343
- "truncate flex-1",
7344
- !date && "text-muted-foreground"
7345
- ),
7346
- children: date ? format(date, getDisplayFormat(), { locale: ptBR2 }) : "Selecione uma data"
7347
- }
7348
- ),
7349
- date && /* @__PURE__ */ jsx58(
7350
- ClearButton,
7351
- {
7352
- className: "-mr-3",
7353
- onClick: (e) => {
7354
- e?.stopPropagation();
7355
- setInternalDate(null);
7356
- onChange?.(null);
7357
- onConfirm?.(null);
7358
- }
7359
- }
7360
- ),
7361
- /* @__PURE__ */ jsx58(CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
7362
- ]
7363
- }
7364
- )
7365
- }
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"
7366
7483
  ),
7367
- /* @__PURE__ */ jsx58(ErrorMessage_default, { error }),
7368
- /* @__PURE__ */ jsxs39(PopoverContentBase, { className: "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", children: [
7369
- /* @__PURE__ */ jsxs39("div", { className: "flex flex-col sm:flex-row max-h-auto overflow-y-auto border-none rounded-md", children: [
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: [
7370
7509
  /* @__PURE__ */ jsx58(
7371
7510
  CalendarBase2,
7372
7511
  {
@@ -7374,50 +7513,106 @@ function DateTimePicker({
7374
7513
  locale: ptBR2,
7375
7514
  selected: internalDate ?? void 0,
7376
7515
  onSelect: (d) => handleSelect(d ?? null),
7377
- initialFocus: true,
7516
+ autoFocus: true,
7378
7517
  defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
7379
- fromDate,
7380
- toDate,
7518
+ ...fromDate && { startMonth: fromDate },
7519
+ ...toDate && { endMonth: toDate },
7520
+ ...fromDate || toDate ? {
7521
+ hidden: [
7522
+ ...fromDate ? [{ before: fromDate }] : [],
7523
+ ...toDate ? [{ after: toDate }] : []
7524
+ ]
7525
+ } : {},
7381
7526
  className: cn(
7382
7527
  "w-max rounded-none",
7383
- !hideTime && "sm:rounded-r-none rounded-b-none"
7528
+ !hideTime && "sm:rounded-r-none rounded-b-none",
7529
+ isMobile ? "border-b-transparent w-full" : ""
7384
7530
  )
7385
7531
  }
7386
7532
  ),
7387
- !hideTime && /* @__PURE__ */ jsxs39("div", { className: "flex flex-col items-center justify-center border border-t-0 sm:border-t sm:border-b sm:border-r rounded-b-md sm:rounded-b-none sm:rounded-r-md", children: [
7388
- /* @__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" }),
7389
- /* @__PURE__ */ jsx58(
7390
- TimeScrollPicker,
7391
- {
7392
- setDate: (d) => handleTimeChange(d ?? null),
7393
- date: internalDate,
7394
- hideSeconds
7395
- }
7396
- )
7397
- ] })
7398
- ] }),
7399
- /* @__PURE__ */ jsx58("div", { className: "flex border-none rounded-md", children: /* @__PURE__ */ jsxs39("div", { className: "grid grid-cols-2 w-full", children: [
7400
- /* @__PURE__ */ jsx58(
7401
- ButtonBase,
7402
- {
7403
- 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",
7404
- onClick: () => setOpen(false),
7405
- children: "Cancelar"
7406
- }
7407
- ),
7408
- /* @__PURE__ */ jsx58(
7409
- ButtonBase,
7533
+ !hideTime && /* @__PURE__ */ jsxs39(
7534
+ "div",
7410
7535
  {
7411
- className: "no-active-animation rounded-none bg-emerald-600 hover:bg-emerald-700",
7412
- onClick: () => {
7413
- setOpen(false);
7414
- onConfirm?.(internalDate);
7415
- },
7416
- children: "Confirmar"
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
+ ]
7417
7551
  }
7418
7552
  )
7419
- ] }) })
7420
- ] })
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
+ )
7421
7616
  ] })
7422
7617
  ] });
7423
7618
  }
@@ -7462,6 +7657,9 @@ function RangePicker({
7462
7657
  setRange(void 0);
7463
7658
  onChange?.(void 0);
7464
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";
7465
7663
  return /* @__PURE__ */ jsxs40("div", { className: cn("w-full sm:w-auto", className), children: [
7466
7664
  label && /* @__PURE__ */ jsx59(LabelBase_default, { children: label }),
7467
7665
  /* @__PURE__ */ jsxs40(PopoverBase, { open, onOpenChange: setOpen, children: [
@@ -7514,14 +7712,19 @@ function RangePicker({
7514
7712
  PopoverContentBase,
7515
7713
  {
7516
7714
  asChild: true,
7517
- className: "w-auto min-w-[250px] p-0 shadow-xl overflow-y-hidden",
7715
+ className: center ? centeredPopoverClass : basePopoverClass,
7716
+ side: "top",
7717
+ align: "center",
7718
+ sideOffset: -240,
7518
7719
  children: /* @__PURE__ */ jsxs40(
7519
7720
  motion11.div,
7520
7721
  {
7521
- initial: { opacity: 0, y: 16 },
7722
+ ref: contentRef,
7723
+ initial: { opacity: 0, y: -4 },
7522
7724
  animate: { opacity: 1, y: 0 },
7523
- exit: { opacity: 0, y: 16 },
7725
+ exit: { opacity: 0, y: -4 },
7524
7726
  transition: { duration: 0.18, ease: "easeOut" },
7727
+ className: "border rounded-md shadow-xl ",
7525
7728
  children: [
7526
7729
  /* @__PURE__ */ jsx59("div", { className: "p-4", children: /* @__PURE__ */ jsx59(
7527
7730
  motion11.div,
@@ -7542,8 +7745,10 @@ function RangePicker({
7542
7745
  fixedWeeks: true,
7543
7746
  weekStartsOn: 1,
7544
7747
  navLayout: "around",
7545
- fromDate: minDate,
7546
- toDate: maxDate,
7748
+ hidden: minDate || maxDate ? {
7749
+ before: minDate,
7750
+ after: maxDate
7751
+ } : void 0,
7547
7752
  className: "min-w-0 flex flex-col",
7548
7753
  classNames: {
7549
7754
  months: "flex flex-col sm:flex-row gap-3 sm:gap-4 w-full",
@@ -7573,7 +7778,7 @@ function RangePicker({
7573
7778
  day_button: cn(
7574
7779
  buttonVariantsBase({ variant: "ghost" }),
7575
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",
7576
- "aria-selected:opacity-100 transition-all duration-150 ease-out active:scale-95 hover:bg-background/50 hover:text-primary rounded-none "
7781
+ "aria-selected:opacity-100 transition-all duration-150 ease-out active:scale-95 hover:bg-background/20 hover:text-primary/90 rounded-none "
7577
7782
  ),
7578
7783
  selected: "bg-primary text-primary-foreground font-semibold hover:text-white",
7579
7784
  today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
@@ -7642,12 +7847,16 @@ function RangePicker({
7642
7847
  children: /* @__PURE__ */ jsx59(
7643
7848
  ButtonBase,
7644
7849
  {
7645
- className: "font-semibold w-full text-center",
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,
7646
7855
  onClick: () => {
7856
+ if (!range?.from || !range?.to) return;
7647
7857
  onConfirm?.(range);
7648
7858
  setOpen(false);
7649
7859
  },
7650
- disabled: !range?.from || !range?.to,
7651
7860
  children: "Selecionar"
7652
7861
  }
7653
7862
  )
@@ -8018,7 +8227,7 @@ var TimePickerInput = React39.forwardRef(
8018
8227
  TimePickerInput.displayName = "TimePickerInput";
8019
8228
 
8020
8229
  // src/components/ui/picker/TimePicker.tsx
8021
- import { Fragment as Fragment5, jsx as jsx61, jsxs as jsxs42 } from "react/jsx-runtime";
8230
+ import { Fragment as Fragment6, jsx as jsx61, jsxs as jsxs42 } from "react/jsx-runtime";
8022
8231
  function TimePicker({
8023
8232
  date,
8024
8233
  setDate,
@@ -8088,7 +8297,7 @@ function TimePicker({
8088
8297
  )
8089
8298
  }
8090
8299
  ),
8091
- /* @__PURE__ */ jsx61(AnimatePresence8, { children: !hideSeconds && /* @__PURE__ */ jsx61(Fragment5, { children: /* @__PURE__ */ jsx61(
8300
+ /* @__PURE__ */ jsx61(AnimatePresence8, { children: !hideSeconds && /* @__PURE__ */ jsx61(Fragment6, { children: /* @__PURE__ */ jsx61(
8092
8301
  motion12.div,
8093
8302
  {
8094
8303
  variants: itemVariants2,
@@ -8126,7 +8335,7 @@ import { ptBR as ptBR4 } from "date-fns/locale";
8126
8335
  import { useMemo as useMemo6 } from "react";
8127
8336
  import { CalendarIcon as CalendarIcon2 } from "@phosphor-icons/react";
8128
8337
  import { twMerge as twMerge2 } from "tailwind-merge";
8129
- import { Fragment as Fragment6, jsx as jsx62, jsxs as jsxs43 } from "react/jsx-runtime";
8338
+ import { Fragment as Fragment7, jsx as jsx62, jsxs as jsxs43 } from "react/jsx-runtime";
8130
8339
  function Agenda({
8131
8340
  currentDate,
8132
8341
  events,
@@ -8165,7 +8374,7 @@ function Agenda({
8165
8374
  /* @__PURE__ */ jsx62(CalendarIcon2, { className: "mb-2 text-muted-foreground/50", size: 32 }),
8166
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" }),
8167
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." })
8168
- ] }) : /* @__PURE__ */ jsxs43(Fragment6, { children: [
8377
+ ] }) : /* @__PURE__ */ jsxs43(Fragment7, { children: [
8169
8378
  days.map((day) => {
8170
8379
  const dayEvents = getAgendaEventsForDayAgenda(datedEvents, day);
8171
8380
  if (dayEvents.length === 0) return null;
@@ -8181,7 +8390,7 @@ function Agenda({
8181
8390
  "span",
8182
8391
  {
8183
8392
  className: twMerge2(
8184
- "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 uppercase data-today:font-extrabold sm:pe-4 text-sm sm:text-base md:text-lg font-bold min-w-0",
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",
8185
8394
  isToday(day) ? "text-blue-500" : ""
8186
8395
  ),
8187
8396
  "data-today": isToday(day) || void 0,
@@ -8232,7 +8441,7 @@ import {
8232
8441
  useSensors
8233
8442
  } from "@dnd-kit/core";
8234
8443
  import { addMinutes, differenceInMinutes } from "date-fns";
8235
- import { useId, useRef as useRef8, useState as useState18 } from "react";
8444
+ import { useId, useRef as useRef11, useState as useState20 } from "react";
8236
8445
 
8237
8446
  // src/components/ui/event-calendar-view/hooks.ts
8238
8447
  import { createContext as createContext5, useContext as useContext6 } from "react";
@@ -8254,19 +8463,19 @@ function CalendarDndProviderAgenda({
8254
8463
  children,
8255
8464
  onEventUpdate
8256
8465
  }) {
8257
- const [activeEvent, setActiveEvent] = useState18(
8466
+ const [activeEvent, setActiveEvent] = useState20(
8258
8467
  null
8259
8468
  );
8260
- const [activeId, setActiveId] = useState18(null);
8261
- const [activeView, setActiveView] = useState18(
8469
+ const [activeId, setActiveId] = useState20(null);
8470
+ const [activeView, setActiveView] = useState20(
8262
8471
  null
8263
8472
  );
8264
- const [currentTime, setCurrentTime] = useState18(null);
8265
- const [eventHeight, setEventHeight] = useState18(null);
8266
- const [isMultiDay, setIsMultiDay] = useState18(false);
8267
- const [multiDayWidth, setMultiDayWidth] = useState18(null);
8268
- const [dragHandlePosition, setDragHandlePosition] = useState18(null);
8269
- const eventDimensions = useRef8({ height: 0 });
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 });
8270
8479
  const sensors = useSensors(
8271
8480
  useSensor(MouseSensor, {
8272
8481
  // Require the mouse to move by 5px before activating
@@ -8627,11 +8836,11 @@ function addHoursToDateAgenda(date, hours) {
8627
8836
  // src/components/ui/event-calendar-view/hooks/use-current-time-indicator.ts
8628
8837
  import { endOfWeek, isSameDay as isSameDay2, isWithinInterval, startOfWeek } from "date-fns";
8629
8838
  import { ptBR as ptBR5 } from "date-fns/locale";
8630
- import { useEffect as useEffect16, useState as useState19 } from "react";
8839
+ import { useEffect as useEffect19, useState as useState21 } from "react";
8631
8840
  function useCurrentTimeIndicatorAgenda(currentDate, view) {
8632
- const [currentTimePosition, setCurrentTimePosition] = useState19(0);
8633
- const [currentTimeVisible, setCurrentTimeVisible] = useState19(false);
8634
- useEffect16(() => {
8841
+ const [currentTimePosition, setCurrentTimePosition] = useState21(0);
8842
+ const [currentTimeVisible, setCurrentTimeVisible] = useState21(false);
8843
+ useEffect19(() => {
8635
8844
  const calculateTimePosition = () => {
8636
8845
  const now = /* @__PURE__ */ new Date();
8637
8846
  const hours = now.getHours();
@@ -8664,7 +8873,7 @@ function useCurrentTimeIndicatorAgenda(currentDate, view) {
8664
8873
  // src/components/ui/event-calendar-view/EventItemAgenda.tsx
8665
8874
  import { differenceInMinutes as differenceInMinutes2, format as format4, isPast } from "date-fns";
8666
8875
  import { useMemo as useMemo7 } from "react";
8667
- import { Fragment as Fragment7, jsx as jsx64, jsxs as jsxs45 } from "react/jsx-runtime";
8876
+ import { Fragment as Fragment8, jsx as jsx64, jsxs as jsxs45 } from "react/jsx-runtime";
8668
8877
  var formatTimeWithOptionalMinutes = (date) => {
8669
8878
  return format4(date, "HH:mm");
8670
8879
  };
@@ -8850,7 +9059,7 @@ function EventItemAgenda({
8850
9059
  }
8851
9060
  ),
8852
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) })
8853
- ] }) : /* @__PURE__ */ jsxs45(Fragment7, { children: [
9062
+ ] }) : /* @__PURE__ */ jsxs45(Fragment8, { children: [
8854
9063
  /* @__PURE__ */ jsx64(
8855
9064
  "div",
8856
9065
  {
@@ -9246,14 +9455,14 @@ import {
9246
9455
  subWeeks
9247
9456
  } from "date-fns";
9248
9457
  import { ptBR as ptBR6 } from "date-fns/locale";
9249
- import React42, { useMemo as useMemo10, useState as useState21 } from "react";
9458
+ import React42, { useMemo as useMemo10, useState as useState23 } from "react";
9250
9459
  import { toast as toast2 } from "sonner";
9251
9460
  import { CaretLeftIcon as CaretLeftIcon5, CaretRightIcon as CaretRightIcon8 } from "@phosphor-icons/react";
9252
9461
 
9253
9462
  // src/components/ui/selects/Select.tsx
9254
- import { useEffect as useEffect17, useMemo as useMemo9, useState as useState20 } from "react";
9463
+ import { useEffect as useEffect20, useMemo as useMemo9, useState as useState22 } from "react";
9255
9464
  import { CaretLeftIcon as CaretLeftIcon4, CaretRightIcon as CaretRightIcon7 } from "@phosphor-icons/react";
9256
- import { Fragment as Fragment8, jsx as jsx67, jsxs as jsxs47 } from "react/jsx-runtime";
9465
+ import { Fragment as Fragment9, jsx as jsx67, jsxs as jsxs47 } from "react/jsx-runtime";
9257
9466
  function Select({
9258
9467
  items,
9259
9468
  groupItems,
@@ -9268,10 +9477,10 @@ function Select({
9268
9477
  className,
9269
9478
  pagination
9270
9479
  }) {
9271
- const [page, setPage] = useState20(1);
9272
- const [animating, setAnimating] = useState20(false);
9480
+ const [page, setPage] = useState22(1);
9481
+ const [animating, setAnimating] = useState22(false);
9273
9482
  const groupCount = groupItems ? Object.keys(groupItems).length : 0;
9274
- useEffect17(() => {
9483
+ useEffect20(() => {
9275
9484
  setPage(1);
9276
9485
  }, [items?.length, groupCount, pagination]);
9277
9486
  const paged = useMemo9(() => {
@@ -9301,7 +9510,7 @@ function Select({
9301
9510
  }, [items, groupItems, page, pagination]);
9302
9511
  const goPrev = () => setPage((p) => Math.max(1, p - 1));
9303
9512
  const goNext = () => setPage((p) => paged ? Math.min(paged.totalPages, p + 1) : p + 1);
9304
- useEffect17(() => {
9513
+ useEffect20(() => {
9305
9514
  if (!pagination) return;
9306
9515
  setAnimating(true);
9307
9516
  const id = setTimeout(() => setAnimating(false), 220);
@@ -9335,7 +9544,7 @@ function Select({
9335
9544
  )
9336
9545
  }
9337
9546
  ),
9338
- /* @__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(Fragment8, { children: [
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: [
9339
9548
  /* @__PURE__ */ jsx67(
9340
9549
  "div",
9341
9550
  {
@@ -9408,7 +9617,7 @@ function Select({
9408
9617
  }
9409
9618
  )
9410
9619
  ] })
9411
- ] }) : /* @__PURE__ */ jsx67(Fragment8, { children: groupItems ? /* @__PURE__ */ jsx67(Fragment8, { children: Object.keys(groupItems).map((key) => /* @__PURE__ */ jsxs47(
9620
+ ] }) : /* @__PURE__ */ jsx67(Fragment9, { children: groupItems ? /* @__PURE__ */ jsx67(Fragment9, { children: Object.keys(groupItems).map((key) => /* @__PURE__ */ jsxs47(
9412
9621
  SelectGroupBase,
9413
9622
  {
9414
9623
  "data-testid": testIds.group ?? "select-group",
@@ -9464,11 +9673,11 @@ function EventAgenda({
9464
9673
  initialDate,
9465
9674
  onClick
9466
9675
  }) {
9467
- const [currentDate, setCurrentDate] = useState21(
9676
+ const [currentDate, setCurrentDate] = useState23(
9468
9677
  initialDate && new Date(initialDate) || /* @__PURE__ */ new Date()
9469
9678
  );
9470
- const [view, setView] = useState21(initialView);
9471
- const [selectedEvent, setSelectedEvent] = useState21(null);
9679
+ const [view, setView] = useState23(initialView);
9680
+ const [selectedEvent, setSelectedEvent] = useState23(null);
9472
9681
  const goPrevious = () => {
9473
9682
  if (view === "month") setCurrentDate((d) => subMonths(d, 1));
9474
9683
  else if (view === "week") setCurrentDate((d) => subWeeks(d, 1));
@@ -9693,14 +9902,14 @@ function UndatedEvents({
9693
9902
  }
9694
9903
 
9695
9904
  // src/components/ui/event-calendar-view/hooks/use-event-visibility.ts
9696
- import { useLayoutEffect, useMemo as useMemo12, useRef as useRef9, useState as useState22 } from "react";
9905
+ import { useLayoutEffect, useMemo as useMemo12, useRef as useRef12, useState as useState24 } from "react";
9697
9906
  function useEventVisibilityAgenda({
9698
9907
  eventHeight,
9699
9908
  eventGap
9700
9909
  }) {
9701
- const contentRef = useRef9(null);
9702
- const observerRef = useRef9(null);
9703
- const [contentHeight, setContentHeight] = useState22(null);
9910
+ const contentRef = useRef12(null);
9911
+ const observerRef = useRef12(null);
9912
+ const [contentHeight, setContentHeight] = useState24(null);
9704
9913
  useLayoutEffect(() => {
9705
9914
  if (!contentRef.current) return;
9706
9915
  const updateHeight = () => {
@@ -9752,7 +9961,7 @@ import {
9752
9961
  startOfWeek as startOfWeek3
9753
9962
  } from "date-fns";
9754
9963
  import { ptBR as ptBR7 } from "date-fns/locale";
9755
- import { useEffect as useEffect18, useMemo as useMemo13, useState as useState23 } from "react";
9964
+ import { useEffect as useEffect21, useMemo as useMemo13, useState as useState25 } from "react";
9756
9965
  import { twMerge as twMerge3 } from "tailwind-merge";
9757
9966
  import { jsx as jsx70, jsxs as jsxs50 } from "react/jsx-runtime";
9758
9967
  function MonthViewAgenda({
@@ -9791,12 +10000,12 @@ function MonthViewAgenda({
9791
10000
  e.stopPropagation();
9792
10001
  onEventSelect(event, e);
9793
10002
  };
9794
- const [isMounted, setIsMounted] = useState23(false);
10003
+ const [isMounted, setIsMounted] = useState25(false);
9795
10004
  const { contentRef, getVisibleEventCount } = useEventVisibilityAgenda({
9796
10005
  eventGap: EventGapAgenda,
9797
10006
  eventHeight: EventHeightAgenda
9798
10007
  });
9799
- useEffect18(() => {
10008
+ useEffect21(() => {
9800
10009
  setIsMounted(true);
9801
10010
  }, []);
9802
10011
  return /* @__PURE__ */ jsxs50("div", { className: "contents", "data-slot": "month-view", children: [
@@ -10036,7 +10245,7 @@ var DefaultEndHour = 10;
10036
10245
  import { useDraggable } from "@dnd-kit/core";
10037
10246
  import { CSS } from "@dnd-kit/utilities";
10038
10247
  import { differenceInDays } from "date-fns";
10039
- import { useRef as useRef10, useState as useState24 } from "react";
10248
+ import { useRef as useRef13, useState as useState26 } from "react";
10040
10249
  import { jsx as jsx71 } from "react/jsx-runtime";
10041
10250
  function DraggableEvent({
10042
10251
  event,
@@ -10052,8 +10261,8 @@ function DraggableEvent({
10052
10261
  draggable = true
10053
10262
  }) {
10054
10263
  const { activeId } = useCalendarDndAgenda();
10055
- const elementRef = useRef10(null);
10056
- const [dragHandlePosition, setDragHandlePosition] = useState24(null);
10264
+ const elementRef = useRef13(null);
10265
+ const [dragHandlePosition, setDragHandlePosition] = useState26(null);
10057
10266
  const eventStart = getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10058
10267
  const eventEnd = getEventEndDate(event) ?? getEventStartDate(event) ?? /* @__PURE__ */ new Date();
10059
10268
  const isMultiDayEvent2 = isMultiDay || event.allDay || differenceInDays(eventEnd, eventStart) >= 1;
@@ -10448,7 +10657,7 @@ import { addDays as addDays3, format as format9, isToday as isToday4 } from "dat
10448
10657
  import { ptBR as ptBR9 } from "date-fns/locale";
10449
10658
  import { useMemo as useMemo15 } from "react";
10450
10659
  import { CalendarIcon as CalendarIcon3 } from "@phosphor-icons/react";
10451
- import { Fragment as Fragment9, jsx as jsx73, jsxs as jsxs52 } from "react/jsx-runtime";
10660
+ import { Fragment as Fragment10, jsx as jsx73, jsxs as jsxs52 } from "react/jsx-runtime";
10452
10661
  function AgendaView({
10453
10662
  currentDate,
10454
10663
  events,
@@ -10488,7 +10697,7 @@ function AgendaView({
10488
10697
  /* @__PURE__ */ jsx73(CalendarIcon3, { className: "mb-2 text-muted-foreground/50", size: 32 }),
10489
10698
  /* @__PURE__ */ jsx73("h3", { className: "font-medium text-lg", children: "Nenhum evento encontrado" }),
10490
10699
  /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
10491
- ] }) : /* @__PURE__ */ jsxs52(Fragment9, { children: [
10700
+ ] }) : /* @__PURE__ */ jsxs52(Fragment10, { children: [
10492
10701
  days.map((day) => {
10493
10702
  const dayEvents = getAgendaEventsForDay(datedEvents, day);
10494
10703
  if (dayEvents.length === 0) return null;
@@ -10552,7 +10761,7 @@ import {
10552
10761
  useSensors as useSensors2
10553
10762
  } from "@dnd-kit/core";
10554
10763
  import { addMinutes as addMinutes2, differenceInMinutes as differenceInMinutes5 } from "date-fns";
10555
- import { useId as useId2, useRef as useRef11, useState as useState25 } from "react";
10764
+ import { useId as useId2, useRef as useRef14, useState as useState27 } from "react";
10556
10765
 
10557
10766
  // src/components/ui/event-calendar/hooks.ts
10558
10767
  import { createContext as createContext6, useContext as useContext7 } from "react";
@@ -10574,17 +10783,17 @@ function CalendarDndProvider({
10574
10783
  children,
10575
10784
  onEventUpdate
10576
10785
  }) {
10577
- const [activeEvent, setActiveEvent] = useState25(null);
10578
- const [activeId, setActiveId] = useState25(null);
10579
- const [activeView, setActiveView] = useState25(
10786
+ const [activeEvent, setActiveEvent] = useState27(null);
10787
+ const [activeId, setActiveId] = useState27(null);
10788
+ const [activeView, setActiveView] = useState27(
10580
10789
  null
10581
10790
  );
10582
- const [currentTime, setCurrentTime] = useState25(null);
10583
- const [eventHeight, setEventHeight] = useState25(null);
10584
- const [isMultiDay, setIsMultiDay] = useState25(false);
10585
- const [multiDayWidth, setMultiDayWidth] = useState25(null);
10586
- const [dragHandlePosition, setDragHandlePosition] = useState25(null);
10587
- const eventDimensions = useRef11({ height: 0 });
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 });
10588
10797
  const sensors = useSensors2(
10589
10798
  useSensor2(MouseSensor2, {
10590
10799
  // Require the mouse to move by 5px before activating
@@ -11013,7 +11222,7 @@ function DayView({
11013
11222
  import { useDraggable as useDraggable2 } from "@dnd-kit/core";
11014
11223
  import { CSS as CSS2 } from "@dnd-kit/utilities";
11015
11224
  import { differenceInDays as differenceInDays2 } from "date-fns";
11016
- import { useRef as useRef12, useState as useState26 } from "react";
11225
+ import { useRef as useRef15, useState as useState28 } from "react";
11017
11226
  import { jsx as jsx76 } from "react/jsx-runtime";
11018
11227
  function DraggableEvent2({
11019
11228
  event,
@@ -11028,8 +11237,8 @@ function DraggableEvent2({
11028
11237
  "aria-hidden": ariaHidden
11029
11238
  }) {
11030
11239
  const { activeId } = useCalendarDnd();
11031
- const elementRef = useRef12(null);
11032
- const [dragHandlePosition, setDragHandlePosition] = useState26(null);
11240
+ const elementRef = useRef15(null);
11241
+ const [dragHandlePosition, setDragHandlePosition] = useState28(null);
11033
11242
  const eventStart = new Date(event.start);
11034
11243
  const eventEnd = new Date(event.end);
11035
11244
  const isMultiDayEvent2 = isMultiDay || event.allDay || differenceInDays2(eventEnd, eventStart) >= 1;
@@ -11164,7 +11373,7 @@ import {
11164
11373
  subWeeks as subWeeks2
11165
11374
  } from "date-fns";
11166
11375
  import { ptBR as ptBR10 } from "date-fns/locale";
11167
- import { useEffect as useEffect19, useMemo as useMemo17, useState as useState27, useCallback as useCallback8 } from "react";
11376
+ import { useEffect as useEffect22, useMemo as useMemo17, useState as useState29, useCallback as useCallback10 } from "react";
11168
11377
  import { toast as toast3 } from "sonner";
11169
11378
  import {
11170
11379
  ArrowDownIcon,
@@ -11173,7 +11382,7 @@ import {
11173
11382
  CalendarIcon as CalendarIcon4,
11174
11383
  PlusIcon as PlusIcon3
11175
11384
  } from "@phosphor-icons/react";
11176
- import { Fragment as Fragment10, jsx as jsx78, jsxs as jsxs55 } from "react/jsx-runtime";
11385
+ import { Fragment as Fragment11, jsx as jsx78, jsxs as jsxs55 } from "react/jsx-runtime";
11177
11386
  function EventCalendar({
11178
11387
  events = [],
11179
11388
  onEventAdd,
@@ -11182,11 +11391,11 @@ function EventCalendar({
11182
11391
  className,
11183
11392
  initialView = "month"
11184
11393
  }) {
11185
- const [currentDate, setCurrentDate] = useState27(/* @__PURE__ */ new Date());
11186
- const [view, setView] = useState27(initialView);
11187
- const [isFading, setIsFading] = useState27(false);
11394
+ const [currentDate, setCurrentDate] = useState29(/* @__PURE__ */ new Date());
11395
+ const [view, setView] = useState29(initialView);
11396
+ const [isFading, setIsFading] = useState29(false);
11188
11397
  const FADE_DURATION = 220;
11189
- const changeView = useCallback8(
11398
+ const changeView = useCallback10(
11190
11399
  (next) => {
11191
11400
  if (next === view) return;
11192
11401
  setIsFading(true);
@@ -11197,12 +11406,12 @@ function EventCalendar({
11197
11406
  },
11198
11407
  [view]
11199
11408
  );
11200
- const [isPaging, setIsPaging] = useState27(false);
11201
- const [pageDirection, setPageDirection] = useState27(
11409
+ const [isPaging, setIsPaging] = useState29(false);
11410
+ const [pageDirection, setPageDirection] = useState29(
11202
11411
  null
11203
11412
  );
11204
11413
  const PAGE_DURATION = 200;
11205
- const pageTransition = useCallback8(
11414
+ const pageTransition = useCallback10(
11206
11415
  (applyDateChange, direction) => {
11207
11416
  setIsPaging(true);
11208
11417
  setPageDirection(direction);
@@ -11216,11 +11425,11 @@ function EventCalendar({
11216
11425
  },
11217
11426
  []
11218
11427
  );
11219
- const [isEventDialogOpen, setIsEventDialogOpen] = useState27(false);
11220
- const [selectedEvent, setSelectedEvent] = useState27(
11428
+ const [isEventDialogOpen, setIsEventDialogOpen] = useState29(false);
11429
+ const [selectedEvent, setSelectedEvent] = useState29(
11221
11430
  null
11222
11431
  );
11223
- useEffect19(() => {
11432
+ useEffect22(() => {
11224
11433
  const handleKeyDown = (e) => {
11225
11434
  if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
11226
11435
  return;
@@ -11385,7 +11594,7 @@ function EventCalendar({
11385
11594
  const long = `${format11(currentDate, "EEE", {
11386
11595
  locale: ptBR10
11387
11596
  })}, ${dayNum} de ${month} de ${year}`;
11388
- return /* @__PURE__ */ jsxs55(Fragment10, { children: [
11597
+ return /* @__PURE__ */ jsxs55(Fragment11, { children: [
11389
11598
  /* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
11390
11599
  /* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
11391
11600
  /* @__PURE__ */ jsx78("span", { className: "max-md:hidden", children: long })
@@ -11403,7 +11612,7 @@ function EventCalendar({
11403
11612
  }
11404
11613
  return capitalize(format11(currentDate, "MMMM yyyy", { locale: ptBR10 }));
11405
11614
  }, [currentDate, view]);
11406
- const calendarContent = /* @__PURE__ */ jsxs55(Fragment10, { children: [
11615
+ const calendarContent = /* @__PURE__ */ jsxs55(Fragment11, { children: [
11407
11616
  /* @__PURE__ */ jsxs55(
11408
11617
  "div",
11409
11618
  {
@@ -11456,7 +11665,7 @@ function EventCalendar({
11456
11665
  ] }),
11457
11666
  /* @__PURE__ */ jsx78("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
11458
11667
  ] }),
11459
- /* @__PURE__ */ jsx78("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs55(Fragment10, { children: [
11668
+ /* @__PURE__ */ jsx78("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs55(Fragment11, { children: [
11460
11669
  /* @__PURE__ */ jsxs55(DropDownMenuBase, { children: [
11461
11670
  /* @__PURE__ */ jsx78(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs55(
11462
11671
  ButtonBase,
@@ -11617,7 +11826,7 @@ function EventCalendar({
11617
11826
 
11618
11827
  // src/components/ui/event-calendar/EventDialog.tsx
11619
11828
  import { format as format12, isBefore as isBefore2 } from "date-fns";
11620
- import { useCallback as useCallback9, useEffect as useEffect20, useMemo as useMemo18, useState as useState28 } from "react";
11829
+ import { useCallback as useCallback11, useEffect as useEffect23, useMemo as useMemo18, useState as useState30 } from "react";
11621
11830
  import { RadioGroup as RadioGroup3, RadioGroupItem } from "@radix-ui/react-radio-group";
11622
11831
  import { motion as motion13 } from "framer-motion";
11623
11832
  import { ptBR as ptBR11 } from "date-fns/locale";
@@ -11630,21 +11839,21 @@ function EventDialog({
11630
11839
  onSave,
11631
11840
  onDelete
11632
11841
  }) {
11633
- const [title, setTitle] = useState28("");
11634
- const [description, setDescription] = useState28("");
11635
- const [startDate, setStartDate] = useState28(/* @__PURE__ */ new Date());
11636
- const [endDate, setEndDate] = useState28(/* @__PURE__ */ new Date());
11637
- const [startTime, setStartTime] = useState28(`${DefaultStartHour}:00`);
11638
- const [endTime, setEndTime] = useState28(`${DefaultEndHour}:00`);
11639
- const [allDay, setAllDay] = useState28(false);
11640
- const [location, setLocation] = useState28("");
11641
- const [color, setColor] = useState28("sky");
11642
- const [error, setError] = useState28(null);
11643
- const [startDateOpen, setStartDateOpen] = useState28(false);
11644
- const [endDateOpen, setEndDateOpen] = useState28(false);
11645
- useEffect20(() => {
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(() => {
11646
11855
  }, [event]);
11647
- const resetForm = useCallback9(() => {
11856
+ const resetForm = useCallback11(() => {
11648
11857
  setTitle("");
11649
11858
  setDescription("");
11650
11859
  setStartDate(/* @__PURE__ */ new Date());
@@ -11656,12 +11865,12 @@ function EventDialog({
11656
11865
  setColor("sky");
11657
11866
  setError(null);
11658
11867
  }, []);
11659
- const formatTimeForInput = useCallback9((date) => {
11868
+ const formatTimeForInput = useCallback11((date) => {
11660
11869
  const hours = date.getHours().toString().padStart(2, "0");
11661
11870
  const minutes = Math.floor(date.getMinutes() / 15) * 15;
11662
11871
  return `${hours}:${minutes.toString().padStart(2, "0")}`;
11663
11872
  }, []);
11664
- useEffect20(() => {
11873
+ useEffect23(() => {
11665
11874
  if (event) {
11666
11875
  setTitle(event.title || "");
11667
11876
  setDescription(event.description || "");
@@ -12083,7 +12292,7 @@ import { useMemo as useMemo19 } from "react";
12083
12292
  import {
12084
12293
  ClockUserIcon
12085
12294
  } from "@phosphor-icons/react";
12086
- import { Fragment as Fragment11, jsx as jsx80, jsxs as jsxs57 } from "react/jsx-runtime";
12295
+ import { Fragment as Fragment12, jsx as jsx80, jsxs as jsxs57 } from "react/jsx-runtime";
12087
12296
  var formatTimeWithOptionalMinutes2 = (date) => {
12088
12297
  return format13(date, "HH:mm");
12089
12298
  };
@@ -12267,7 +12476,7 @@ function EventItem({
12267
12476
  children: durationMinutes < 45 ? /* @__PURE__ */ jsxs57("div", { className: "flex items-center justify-between w-full", children: [
12268
12477
  /* @__PURE__ */ jsx80("div", { className: cn("truncate text-lg"), children: event.title }),
12269
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) })
12270
- ] }) : /* @__PURE__ */ jsxs57(Fragment11, { children: [
12479
+ ] }) : /* @__PURE__ */ jsxs57(Fragment12, { children: [
12271
12480
  /* @__PURE__ */ jsx80(
12272
12481
  "div",
12273
12482
  {
@@ -12390,7 +12599,7 @@ function EventItem({
12390
12599
  // src/components/ui/event-calendar/EventsPopUp.tsx
12391
12600
  import { format as format14, isSameDay as isSameDay7 } from "date-fns";
12392
12601
  import { ptBR as ptBR12 } from "date-fns/locale";
12393
- import { useEffect as useEffect21, useMemo as useMemo20, useRef as useRef13 } from "react";
12602
+ import { useEffect as useEffect24, useMemo as useMemo20, useRef as useRef16 } from "react";
12394
12603
  import { motion as motion14 } from "framer-motion";
12395
12604
  import { XIcon as XIcon11 } from "@phosphor-icons/react";
12396
12605
  import { jsx as jsx81, jsxs as jsxs58 } from "react/jsx-runtime";
@@ -12401,8 +12610,8 @@ function EventsPopup({
12401
12610
  onClose,
12402
12611
  onEventSelect
12403
12612
  }) {
12404
- const popupRef = useRef13(null);
12405
- useEffect21(() => {
12613
+ const popupRef = useRef16(null);
12614
+ useEffect24(() => {
12406
12615
  const handleClickOutside = (event) => {
12407
12616
  if (popupRef.current && !popupRef.current.contains(event.target)) {
12408
12617
  onClose();
@@ -12413,7 +12622,7 @@ function EventsPopup({
12413
12622
  document.removeEventListener("mousedown", handleClickOutside);
12414
12623
  };
12415
12624
  }, [onClose]);
12416
- useEffect21(() => {
12625
+ useEffect24(() => {
12417
12626
  const handleEscKey = (event) => {
12418
12627
  if (event.key === "Escape") {
12419
12628
  onClose();
@@ -12509,11 +12718,11 @@ function EventsPopup({
12509
12718
  // src/components/ui/event-calendar/hooks/use-current-time-indicator.ts
12510
12719
  import { endOfWeek as endOfWeek6, isSameDay as isSameDay8, isWithinInterval as isWithinInterval2, startOfWeek as startOfWeek6 } from "date-fns";
12511
12720
  import { ptBR as ptBR13 } from "date-fns/locale";
12512
- import { useEffect as useEffect22, useState as useState29 } from "react";
12721
+ import { useEffect as useEffect25, useState as useState31 } from "react";
12513
12722
  function useCurrentTimeIndicator(currentDate, view) {
12514
- const [currentTimePosition, setCurrentTimePosition] = useState29(0);
12515
- const [currentTimeVisible, setCurrentTimeVisible] = useState29(false);
12516
- useEffect22(() => {
12723
+ const [currentTimePosition, setCurrentTimePosition] = useState31(0);
12724
+ const [currentTimeVisible, setCurrentTimeVisible] = useState31(false);
12725
+ useEffect25(() => {
12517
12726
  const calculateTimePosition = () => {
12518
12727
  const now = /* @__PURE__ */ new Date();
12519
12728
  const hours = now.getHours();
@@ -12544,14 +12753,14 @@ function useCurrentTimeIndicator(currentDate, view) {
12544
12753
  }
12545
12754
 
12546
12755
  // src/components/ui/event-calendar/hooks/use-event-visibility.ts
12547
- import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo21, useRef as useRef14, useState as useState30 } from "react";
12756
+ import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo21, useRef as useRef17, useState as useState32 } from "react";
12548
12757
  function useEventVisibility({
12549
12758
  eventHeight,
12550
12759
  eventGap
12551
12760
  }) {
12552
- const contentRef = useRef14(null);
12553
- const observerRef = useRef14(null);
12554
- const [contentHeight, setContentHeight] = useState30(null);
12761
+ const contentRef = useRef17(null);
12762
+ const observerRef = useRef17(null);
12763
+ const [contentHeight, setContentHeight] = useState32(null);
12555
12764
  useLayoutEffect2(() => {
12556
12765
  if (!contentRef.current) return;
12557
12766
  const updateHeight = () => {
@@ -12603,7 +12812,7 @@ import {
12603
12812
  startOfWeek as startOfWeek7
12604
12813
  } from "date-fns";
12605
12814
  import { ptBR as ptBR14 } from "date-fns/locale";
12606
- import { useEffect as useEffect23, useMemo as useMemo22, useState as useState31 } from "react";
12815
+ import { useEffect as useEffect26, useMemo as useMemo22, useState as useState33 } from "react";
12607
12816
  import { jsx as jsx82, jsxs as jsxs59 } from "react/jsx-runtime";
12608
12817
  function MonthView({
12609
12818
  currentDate,
@@ -12641,12 +12850,12 @@ function MonthView({
12641
12850
  e.stopPropagation();
12642
12851
  onEventSelect(event);
12643
12852
  };
12644
- const [isMounted, setIsMounted] = useState31(false);
12853
+ const [isMounted, setIsMounted] = useState33(false);
12645
12854
  const { contentRef, getVisibleEventCount } = useEventVisibility({
12646
12855
  eventGap: EventGap,
12647
12856
  eventHeight: EventHeight
12648
12857
  });
12649
- useEffect23(() => {
12858
+ useEffect26(() => {
12650
12859
  setIsMounted(true);
12651
12860
  }, []);
12652
12861
  return /* @__PURE__ */ jsxs59("div", { className: "contents", "data-slot": "month-view", children: [
@@ -13218,9 +13427,9 @@ function WeekView({
13218
13427
  }
13219
13428
 
13220
13429
  // src/components/ui/selects/AvatarCombobox.tsx
13221
- import { useId as useId3, useState as useState32 } from "react";
13430
+ import { useId as useId3, useState as useState34 } from "react";
13222
13431
  import { CaretDownIcon as CaretDownIcon5, CheckIcon as CheckIcon10 } from "@phosphor-icons/react";
13223
- import { Fragment as Fragment12, jsx as jsx84, jsxs as jsxs61 } from "react/jsx-runtime";
13432
+ import { Fragment as Fragment13, jsx as jsx84, jsxs as jsxs61 } from "react/jsx-runtime";
13224
13433
  var DEFAULT_COLORS = [
13225
13434
  "bg-purple-100 text-purple-700",
13226
13435
  "bg-green-100 text-green-700",
@@ -13263,14 +13472,14 @@ function AvatarCombobox({
13263
13472
  className,
13264
13473
  colors: colors2
13265
13474
  }) {
13266
- const [open, setOpen] = useState32(false);
13475
+ const [open, setOpen] = useState34(false);
13267
13476
  const id = useId3();
13268
13477
  const allItems = items || (groupItems ? Object.values(groupItems).flat() : []);
13269
13478
  const selectedItem = allItems.find((item) => item.value === selected);
13270
13479
  const renderItem = (item) => {
13271
13480
  const avatarContent = item.avatar ?? item.label.charAt(0).toUpperCase();
13272
13481
  const colorClass = item.avatarClassName ?? getColor(item.value, colors2);
13273
- return /* @__PURE__ */ jsxs61(Fragment12, { children: [
13482
+ return /* @__PURE__ */ jsxs61(Fragment13, { children: [
13274
13483
  /* @__PURE__ */ jsx84(Square, { className: colorClass, children: avatarContent }),
13275
13484
  /* @__PURE__ */ jsx84("span", { className: "truncate", children: item.label })
13276
13485
  ] });
@@ -13375,14 +13584,14 @@ function AvatarCombobox({
13375
13584
  import { CaretUpDownIcon as CaretUpDownIcon2, CheckIcon as CheckIcon11, XIcon as XIcon12 } from "@phosphor-icons/react";
13376
13585
  import {
13377
13586
  createContext as createContext7,
13378
- useCallback as useCallback10,
13587
+ useCallback as useCallback12,
13379
13588
  useContext as useContext8,
13380
- useEffect as useEffect24,
13381
- useRef as useRef15,
13382
- useState as useState33
13589
+ useEffect as useEffect27,
13590
+ useRef as useRef18,
13591
+ useState as useState35
13383
13592
  } from "react";
13384
13593
  import { motion as motion15 } from "framer-motion";
13385
- import { Fragment as Fragment13, jsx as jsx85, jsxs as jsxs62 } from "react/jsx-runtime";
13594
+ import { Fragment as Fragment14, jsx as jsx85, jsxs as jsxs62 } from "react/jsx-runtime";
13386
13595
  var MultiSelectContext = createContext7(null);
13387
13596
  function MultiSelectBase({
13388
13597
  children,
@@ -13393,12 +13602,12 @@ function MultiSelectBase({
13393
13602
  empty,
13394
13603
  error
13395
13604
  }) {
13396
- const [open, setOpen] = useState33(false);
13397
- const [internalValues, setInternalValues] = useState33(
13605
+ const [open, setOpen] = useState35(false);
13606
+ const [internalValues, setInternalValues] = useState35(
13398
13607
  new Set(values ?? defaultValues)
13399
13608
  );
13400
13609
  const selectedValues = values ? new Set(values) : internalValues;
13401
- const [items, setItems] = useState33(/* @__PURE__ */ new Map());
13610
+ const [items, setItems] = useState35(/* @__PURE__ */ new Map());
13402
13611
  function toggleValue(value) {
13403
13612
  if (disabled) return;
13404
13613
  const getNewSet = (prev) => {
@@ -13413,7 +13622,7 @@ function MultiSelectBase({
13413
13622
  setInternalValues(getNewSet);
13414
13623
  onValuesChange?.([...getNewSet(selectedValues)]);
13415
13624
  }
13416
- const onItemAdded = useCallback10((value, label) => {
13625
+ const onItemAdded = useCallback12((value, label) => {
13417
13626
  setItems((prev) => {
13418
13627
  if (prev.get(value) === label) return prev;
13419
13628
  return new Map(prev).set(value, label);
@@ -13485,13 +13694,13 @@ function MultiSelectValueBase({
13485
13694
  ...props
13486
13695
  }) {
13487
13696
  const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
13488
- const [overflowAmount, setOverflowAmount] = useState33(0);
13489
- const valueRef = useRef15(null);
13490
- const overflowRef = useRef15(null);
13491
- const mutationObserverRef = useRef15(null);
13492
- const resizeObserverRef = useRef15(null);
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);
13493
13702
  const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
13494
- const checkOverflow = useCallback10(() => {
13703
+ const checkOverflow = useCallback12(() => {
13495
13704
  if (valueRef.current == null) return;
13496
13705
  const containerElement = valueRef.current;
13497
13706
  const overflowElement = overflowRef.current;
@@ -13512,7 +13721,7 @@ function MultiSelectValueBase({
13512
13721
  }
13513
13722
  setOverflowAmount(amount);
13514
13723
  }, []);
13515
- const handleResize = useCallback10(
13724
+ const handleResize = useCallback12(
13516
13725
  (node) => {
13517
13726
  if (node == null) {
13518
13727
  valueRef.current = null;
@@ -13607,7 +13816,7 @@ function MultiSelectContentBase({
13607
13816
  }) {
13608
13817
  const canSearch = typeof search === "object" ? true : search;
13609
13818
  const { emptyMessage } = useMultiSelectContext();
13610
- return /* @__PURE__ */ jsx85(Fragment13, { 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(
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(
13611
13820
  motion15.div,
13612
13821
  {
13613
13822
  initial: { opacity: 0, scale: 0.95 },
@@ -13638,7 +13847,7 @@ function MultiSelectItemBase({
13638
13847
  }) {
13639
13848
  const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
13640
13849
  const isSelected = selectedValues.has(value);
13641
- useEffect24(() => {
13850
+ useEffect27(() => {
13642
13851
  onItemAdded(value, badgeLabel ?? children);
13643
13852
  }, [value, children, onItemAdded, badgeLabel]);
13644
13853
  return /* @__PURE__ */ jsx85(
@@ -13695,11 +13904,11 @@ function debounce(func, wait) {
13695
13904
 
13696
13905
  // src/components/ui/charts/Chart.tsx
13697
13906
  import {
13698
- useState as useState36,
13699
- useEffect as useEffect27,
13700
- useCallback as useCallback12,
13907
+ useState as useState38,
13908
+ useEffect as useEffect30,
13909
+ useCallback as useCallback14,
13701
13910
  useMemo as useMemo25,
13702
- useRef as useRef18,
13911
+ useRef as useRef21,
13703
13912
  useLayoutEffect as useLayoutEffect3
13704
13913
  } from "react";
13705
13914
  import {
@@ -13862,7 +14071,7 @@ var resolveChartMargins = (margins, chartMargins, showLabels) => {
13862
14071
  import { toast as toast4 } from "sonner";
13863
14072
 
13864
14073
  // src/components/ui/charts/components/controls/PeriodsDropdown.tsx
13865
- import { useState as useState34, useRef as useRef16, useEffect as useEffect25 } from "react";
14074
+ import { useState as useState36, useRef as useRef19, useEffect as useEffect28 } from "react";
13866
14075
  import { motion as motion16, AnimatePresence as AnimatePresence9 } from "framer-motion";
13867
14076
  import { DotsThreeIcon as DotsThreeIcon3 } from "@phosphor-icons/react/dist/ssr";
13868
14077
  import { Check } from "@phosphor-icons/react/dist/ssr";
@@ -13885,11 +14094,11 @@ function PeriodsDropdown({
13885
14094
  activePeriods
13886
14095
  }) {
13887
14096
  const periods = processedData.map((d) => String(d.name));
13888
- const [open, setOpen] = useState34(false);
13889
- const wrapperRef = useRef16(null);
13890
- const firstItemRef = useRef16(null);
13891
- const listRef = useRef16(null);
13892
- useEffect25(() => {
14097
+ const [open, setOpen] = useState36(false);
14098
+ const wrapperRef = useRef19(null);
14099
+ const firstItemRef = useRef19(null);
14100
+ const listRef = useRef19(null);
14101
+ useEffect28(() => {
13893
14102
  const handleClickOutside = (e) => {
13894
14103
  if (!wrapperRef.current) return;
13895
14104
  if (!wrapperRef.current.contains(e.target)) setOpen(false);
@@ -13904,7 +14113,7 @@ function PeriodsDropdown({
13904
14113
  document.removeEventListener("keydown", handleEscape);
13905
14114
  };
13906
14115
  }, []);
13907
- useEffect25(() => {
14116
+ useEffect28(() => {
13908
14117
  if (open && firstItemRef.current) {
13909
14118
  firstItemRef.current.focus();
13910
14119
  }
@@ -13998,7 +14207,7 @@ var PeriodsDropdown_default = PeriodsDropdown;
13998
14207
  // src/components/ui/charts/components/controls/ShowOnly.tsx
13999
14208
  import { motion as motion17 } from "framer-motion";
14000
14209
  import { Eye, EyeSlash } from "@phosphor-icons/react";
14001
- import { Fragment as Fragment14, jsx as jsx87, jsxs as jsxs64 } from "react/jsx-runtime";
14210
+ import { Fragment as Fragment15, jsx as jsx87, jsxs as jsxs64 } from "react/jsx-runtime";
14002
14211
  var ShowOnly = ({
14003
14212
  showOnlyHighlighted,
14004
14213
  setShowOnlyHighlighted,
@@ -14025,10 +14234,10 @@ var ShowOnly = ({
14025
14234
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary/60",
14026
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"
14027
14236
  ),
14028
- children: showOnlyHighlighted ? /* @__PURE__ */ jsxs64(Fragment14, { children: [
14237
+ children: showOnlyHighlighted ? /* @__PURE__ */ jsxs64(Fragment15, { children: [
14029
14238
  /* @__PURE__ */ jsx87(EyeSlash, { size: 16, weight: "regular" }),
14030
14239
  /* @__PURE__ */ jsx87("span", { className: "sr-only", children: "Exibir todos" })
14031
- ] }) : /* @__PURE__ */ jsxs64(Fragment14, { children: [
14240
+ ] }) : /* @__PURE__ */ jsxs64(Fragment15, { children: [
14032
14241
  /* @__PURE__ */ jsx87(Eye, { size: 16, weight: "bold" }),
14033
14242
  /* @__PURE__ */ jsx87("span", { className: "sr-only", children: "Mostrar somente destacados" })
14034
14243
  ] })
@@ -14248,16 +14457,16 @@ var CloseAllButton_default = CloseAllButton;
14248
14457
 
14249
14458
  // src/components/ui/charts/components/tooltips/DraggableTooltip.tsx
14250
14459
  import React44, {
14251
- useEffect as useEffect26,
14252
- useRef as useRef17,
14253
- useState as useState35,
14254
- useCallback as useCallback11,
14460
+ useEffect as useEffect29,
14461
+ useRef as useRef20,
14462
+ useState as useState37,
14463
+ useCallback as useCallback13,
14255
14464
  useMemo as useMemo24
14256
14465
  } from "react";
14257
14466
  import { motion as motion19, AnimatePresence as AnimatePresence11 } from "framer-motion";
14258
14467
  import { DotsSixVerticalIcon } from "@phosphor-icons/react";
14259
14468
  import { XIcon as XIcon14 } from "@phosphor-icons/react/dist/ssr";
14260
- import { Fragment as Fragment15, jsx as jsx90, jsxs as jsxs67 } from "react/jsx-runtime";
14469
+ import { Fragment as Fragment16, jsx as jsx90, jsxs as jsxs67 } from "react/jsx-runtime";
14261
14470
  var ALIGNMENT_THRESHOLD = 25;
14262
14471
  var GUIDE_THRESHOLD = 60;
14263
14472
  var STRONG_SNAP_THRESHOLD = 35;
@@ -14361,14 +14570,14 @@ var DraggableTooltipComponent = ({
14361
14570
  )
14362
14571
  ] });
14363
14572
  });
14364
- const [localPos, setLocalPos] = useState35(position);
14365
- const [dragging, setDragging] = useState35(false);
14366
- const offsetRef = useRef17({ x: 0, y: 0 });
14367
- const lastMouse = useRef17({ x: 0, y: 0 });
14368
- const [alignmentGuides, setAlignmentGuides] = useState35([]);
14369
- const [globalTooltipCountLocal, setGlobalTooltipCountLocal] = useState35(0);
14370
- useEffect26(() => setLocalPos(position), [position]);
14371
- const getAllTooltips = useCallback11(() => {
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(() => {
14372
14581
  const response = [];
14373
14582
  const ev = new CustomEvent("requestGlobalTooltips", {
14374
14583
  detail: { requesterId: id, response }
@@ -14376,7 +14585,7 @@ var DraggableTooltipComponent = ({
14376
14585
  window.dispatchEvent(ev);
14377
14586
  return response;
14378
14587
  }, [id]);
14379
- const updateAlignmentGuides = useCallback11(
14588
+ const updateAlignmentGuides = useCallback13(
14380
14589
  (currentPosition) => {
14381
14590
  const allTooltips = getAllTooltips();
14382
14591
  const otherTooltips = allTooltips.filter((t) => t.id !== id);
@@ -14425,7 +14634,7 @@ var DraggableTooltipComponent = ({
14425
14634
  },
14426
14635
  [getAllTooltips, id]
14427
14636
  );
14428
- const snapToGuides = useCallback11(
14637
+ const snapToGuides = useCallback13(
14429
14638
  (position2) => {
14430
14639
  const snappedPosition = { ...position2 };
14431
14640
  let hasSnapped = false;
@@ -14472,7 +14681,7 @@ var DraggableTooltipComponent = ({
14472
14681
  },
14473
14682
  [alignmentGuides]
14474
14683
  );
14475
- useEffect26(() => {
14684
+ useEffect29(() => {
14476
14685
  let rafId = null;
14477
14686
  const handleMouseMove = (e) => {
14478
14687
  if (!dragging) return;
@@ -14514,7 +14723,7 @@ var DraggableTooltipComponent = ({
14514
14723
  document.body.style.userSelect = "";
14515
14724
  };
14516
14725
  }, [dragging, snapToGuides, updateAlignmentGuides, id, onPositionChange]);
14517
- useEffect26(() => {
14726
+ useEffect29(() => {
14518
14727
  const handleCloseAll = () => onClose(id);
14519
14728
  const handleRequestTooltipCount = () => {
14520
14729
  window.dispatchEvent(
@@ -14545,7 +14754,7 @@ var DraggableTooltipComponent = ({
14545
14754
  });
14546
14755
  };
14547
14756
  }, [id, localPos, onClose]);
14548
- useEffect26(() => {
14757
+ useEffect29(() => {
14549
14758
  if (dragging) return;
14550
14759
  let total = 0;
14551
14760
  const timeoutId = setTimeout(() => {
@@ -14563,7 +14772,7 @@ var DraggableTooltipComponent = ({
14563
14772
  }, 0);
14564
14773
  return () => clearTimeout(timeoutId);
14565
14774
  }, [localPos, dragging]);
14566
- useEffect26(() => {
14775
+ useEffect29(() => {
14567
14776
  const recount = () => {
14568
14777
  if (dragging) return;
14569
14778
  let total = 0;
@@ -14581,7 +14790,7 @@ var DraggableTooltipComponent = ({
14581
14790
  window.addEventListener("recountTooltips", recount);
14582
14791
  return () => window.removeEventListener("recountTooltips", recount);
14583
14792
  }, [dragging]);
14584
- const handleMouseDownLocal = useCallback11(
14793
+ const handleMouseDownLocal = useCallback13(
14585
14794
  (e) => {
14586
14795
  e.preventDefault();
14587
14796
  e.stopPropagation();
@@ -14592,7 +14801,7 @@ var DraggableTooltipComponent = ({
14592
14801
  },
14593
14802
  [id, onMouseDown]
14594
14803
  );
14595
- const handleTouchStartLocal = useCallback11(
14804
+ const handleTouchStartLocal = useCallback13(
14596
14805
  (e) => {
14597
14806
  e.stopPropagation();
14598
14807
  const touch = e.touches[0];
@@ -14607,14 +14816,14 @@ var DraggableTooltipComponent = ({
14607
14816
  },
14608
14817
  [id, onMouseDown]
14609
14818
  );
14610
- const handleCloseClick = useCallback11(
14819
+ const handleCloseClick = useCallback13(
14611
14820
  (e) => {
14612
14821
  e.stopPropagation();
14613
14822
  onClose(id);
14614
14823
  },
14615
14824
  [id, onClose]
14616
14825
  );
14617
- return /* @__PURE__ */ jsxs67(Fragment15, { children: [
14826
+ return /* @__PURE__ */ jsxs67(Fragment16, { children: [
14618
14827
  dragging && alignmentGuides.map((guide, index) => {
14619
14828
  const isHorizontal = guide.type === "horizontal";
14620
14829
  const color = isHorizontal ? "#3b82f6" : "#ef4444";
@@ -15328,17 +15537,19 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
15328
15537
  import { jsx as jsx94, jsxs as jsxs71 } from "react/jsx-runtime";
15329
15538
  var NoData = ({
15330
15539
  paddingLeft = 0,
15331
- height = 360,
15540
+ height = 400,
15332
15541
  message = "Sem dados para exibir",
15333
- className
15542
+ className,
15543
+ title
15334
15544
  }) => {
15335
- const svgHeight = typeof height === "number" ? height : 360;
15545
+ const svgHeight = typeof height === "number" ? height : 400;
15336
15546
  const bars = [
15337
- { x: 120, w: 120, h: svgHeight * 0.45, label: "Label 0" },
15338
- { x: 260, w: 120, h: svgHeight * 0.75, label: "Label 1" },
15339
- { x: 400, w: 120, h: svgHeight * 0.65, label: "Label 2" },
15340
- { x: 540, w: 120, h: svgHeight * 0.55, label: "Label 3" },
15341
- { x: 680, w: 120, h: svgHeight * 0.25, label: "Label 4" }
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 }
15342
15553
  ];
15343
15554
  const styleVars = {
15344
15555
  ["--pl"]: `${paddingLeft}px`,
@@ -15348,27 +15559,59 @@ var NoData = ({
15348
15559
  "div",
15349
15560
  {
15350
15561
  className: cn(
15351
- "rounded-lg bg-card p-3 relative overflow-visible w-full",
15562
+ "rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm",
15352
15563
  className
15353
15564
  ),
15354
15565
  style: styleVars,
15355
15566
  role: "img",
15356
15567
  "aria-label": message,
15357
- children: /* @__PURE__ */ jsx94("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] pr-3 h-[var(--svg-h)]", children: /* @__PURE__ */ jsxs71("div", { className: "w-full max-w-[900px] relative", children: [
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: [
15358
15569
  /* @__PURE__ */ jsxs71(
15359
15570
  "svg",
15360
15571
  {
15361
- className: "w-full h-[var(--svg-h)]",
15572
+ className: "w-full h-[var(--svg-h)] opacity-40",
15362
15573
  width: "100%",
15363
15574
  viewBox: `0 0 900 ${svgHeight}`,
15364
15575
  preserveAspectRatio: "none",
15365
15576
  children: [
15366
15577
  /* @__PURE__ */ jsxs71("defs", { children: [
15367
15578
  /* @__PURE__ */ jsxs71("linearGradient", { id: "barGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
15368
- /* @__PURE__ */ jsx94("stop", { offset: "0%", stopColor: "#60a5fa", stopOpacity: "0.95" }),
15369
- "= "
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
+ )
15370
15595
  ] }),
15371
- /* @__PURE__ */ jsx94(
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(
15372
15615
  "filter",
15373
15616
  {
15374
15617
  id: "softShadow",
@@ -15376,16 +15619,15 @@ var NoData = ({
15376
15619
  y: "-20%",
15377
15620
  width: "140%",
15378
15621
  height: "140%",
15379
- children: /* @__PURE__ */ jsx94(
15380
- "feDropShadow",
15381
- {
15382
- dx: "0",
15383
- dy: "6",
15384
- stdDeviation: "8",
15385
- floodColor: "#0f172a",
15386
- floodOpacity: "0.06"
15387
- }
15388
- )
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
+ ]
15389
15631
  }
15390
15632
  )
15391
15633
  ] }),
@@ -15396,66 +15638,97 @@ var NoData = ({
15396
15638
  y: 0,
15397
15639
  width: 900,
15398
15640
  height: svgHeight,
15399
- fill: "transparent"
15641
+ fill: "hsl(var(--muted)/0.2)",
15642
+ rx: 8
15400
15643
  }
15401
15644
  ),
15402
- Array.from({ length: 5 }).map((_, i) => {
15403
- const y = 40 + (svgHeight - 80) / 4 * i;
15645
+ Array.from({ length: 6 }).map((_, i) => {
15646
+ const y = 40 + (svgHeight - 80) / 5 * i;
15404
15647
  return /* @__PURE__ */ jsx94(
15405
15648
  "line",
15406
15649
  {
15407
- x1: 60,
15408
- x2: 840,
15650
+ x1: 50,
15651
+ x2: 850,
15409
15652
  y1: y,
15410
15653
  y2: y,
15411
- stroke: "rgba(15,23,42,0.06)",
15412
- strokeWidth: 1
15654
+ stroke: "url(#gridGradient)",
15655
+ strokeWidth: 1.5,
15656
+ strokeDasharray: "4 4"
15413
15657
  },
15414
15658
  `g-${i}`
15415
15659
  );
15416
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
+ ),
15417
15685
  bars.map((b, i) => /* @__PURE__ */ jsxs71("g", { children: [
15418
15686
  /* @__PURE__ */ jsx94(
15419
15687
  "rect",
15420
15688
  {
15421
15689
  x: b.x,
15422
- y: svgHeight - 60 - b.h,
15690
+ y: svgHeight - 40 - b.h,
15423
15691
  width: b.w,
15424
15692
  height: b.h,
15425
- rx: 8,
15693
+ rx: 4,
15426
15694
  fill: "url(#barGradient)",
15427
- filter: "url(#softShadow)",
15428
- opacity: 0.95
15695
+ filter: "url(#softShadow)"
15429
15696
  }
15430
15697
  ),
15431
15698
  /* @__PURE__ */ jsx94(
15432
15699
  "rect",
15433
15700
  {
15434
15701
  x: b.x,
15435
- y: svgHeight - 60 - b.h,
15702
+ y: svgHeight - 40 - b.h,
15436
15703
  width: b.w,
15437
15704
  height: b.h,
15438
- rx: 8,
15705
+ rx: 4,
15439
15706
  fill: "none",
15440
- stroke: "rgba(15,23,42,0.06)"
15707
+ stroke: "hsl(var(--foreground))",
15708
+ strokeWidth: 1,
15709
+ opacity: 0.3
15441
15710
  }
15442
15711
  ),
15443
15712
  /* @__PURE__ */ jsx94(
15444
- "text",
15713
+ "line",
15445
15714
  {
15446
- x: b.x + b.w / 2,
15447
- y: svgHeight - 20,
15448
- fill: "rgba(15,23,42,0.45)",
15449
- fontSize: 12,
15450
- textAnchor: "middle",
15451
- children: b.label
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
15452
15722
  }
15453
15723
  )
15454
15724
  ] }, `barg-${i}`))
15455
15725
  ]
15456
15726
  }
15457
15727
  ),
15458
- /* @__PURE__ */ jsx94("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ jsx94("div", { className: "pointer-events-auto bg-transparent px-3 text-center", children: /* @__PURE__ */ jsx94("div", { className: "text-2xl sm:text-3xl font-semibold text-black", children: message }) }) })
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
+ ] }) })
15459
15732
  ] }) })
15460
15733
  }
15461
15734
  );
@@ -15520,12 +15793,12 @@ var Chart = ({
15520
15793
  return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
15521
15794
  }, [data, xAxis, labelMap]);
15522
15795
  const { xAxisConfig, mapperConfig } = smartConfig;
15523
- const [activeTooltips, setActiveTooltips] = useState36([]);
15524
- const [highlightedSeries, setHighlightedSeries] = useState36(
15796
+ const [activeTooltips, setActiveTooltips] = useState38([]);
15797
+ const [highlightedSeries, setHighlightedSeries] = useState38(
15525
15798
  /* @__PURE__ */ new Set()
15526
15799
  );
15527
- const [showOnlyHighlighted, setShowOnlyHighlighted] = useState36(false);
15528
- useEffect27(() => {
15800
+ const [showOnlyHighlighted, setShowOnlyHighlighted] = useState38(false);
15801
+ useEffect30(() => {
15529
15802
  if (highlightedSeries.size === 0 && showOnlyHighlighted) {
15530
15803
  setShowOnlyHighlighted(false);
15531
15804
  }
@@ -15534,8 +15807,8 @@ var Chart = ({
15534
15807
  ...item,
15535
15808
  name: String(item[xAxisConfig.dataKey] || "N/A")
15536
15809
  }));
15537
- const wrapperRef = useRef18(null);
15538
- const [measuredWidth, setMeasuredWidth] = useState36(null);
15810
+ const wrapperRef = useRef21(null);
15811
+ const [measuredWidth, setMeasuredWidth] = useState38(null);
15539
15812
  useLayoutEffect3(() => {
15540
15813
  const el = wrapperRef.current;
15541
15814
  if (!el) return;
@@ -15563,7 +15836,7 @@ var Chart = ({
15563
15836
  );
15564
15837
  }
15565
15838
  const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
15566
- const generateColors = useCallback12(
15839
+ const generateColors = useCallback14(
15567
15840
  (dataKeys) => {
15568
15841
  const colorMap = {};
15569
15842
  const allColors = generateAdditionalColors(colors2, dataKeys.length);
@@ -15602,7 +15875,7 @@ var Chart = ({
15602
15875
  () => allKeys.filter((k) => !rightKeys.includes(k)),
15603
15876
  [allKeys, rightKeys]
15604
15877
  );
15605
- const adaptDataForTooltip = useCallback12(
15878
+ const adaptDataForTooltip = useCallback14(
15606
15879
  (universalData) => ({
15607
15880
  ...universalData,
15608
15881
  name: String(universalData[xAxisConfig.dataKey] || "N/A")
@@ -15613,10 +15886,10 @@ var Chart = ({
15613
15886
  () => activeTooltips.map((t) => adaptDataForTooltip(t.data).name),
15614
15887
  [activeTooltips, adaptDataForTooltip]
15615
15888
  );
15616
- useEffect27(() => {
15889
+ useEffect30(() => {
15617
15890
  window.dispatchEvent(new Event("recountTooltips"));
15618
15891
  }, [activeTooltips.length]);
15619
- const toggleHighlight = useCallback12((key) => {
15892
+ const toggleHighlight = useCallback14((key) => {
15620
15893
  setHighlightedSeries((prev) => {
15621
15894
  const next = new Set(prev);
15622
15895
  if (next.has(key)) next.delete(key);
@@ -15674,7 +15947,7 @@ var Chart = ({
15674
15947
  }
15675
15948
  return min;
15676
15949
  }, [processedData, rightKeys]);
15677
- const computeNiceMax = useCallback12((maxValue) => {
15950
+ const computeNiceMax = useCallback14((maxValue) => {
15678
15951
  let padding = 0.08;
15679
15952
  if (maxValue > 1e6) padding = 0.05;
15680
15953
  if (maxValue > 1e7) padding = 0.03;
@@ -15721,7 +15994,7 @@ var Chart = ({
15721
15994
  niceMaxLeft,
15722
15995
  niceMaxRight
15723
15996
  ]);
15724
- const toggleTooltip = useCallback12(
15997
+ const toggleTooltip = useCallback14(
15725
15998
  (tooltipId, data2, basePosition) => {
15726
15999
  const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
15727
16000
  if (existingIndex !== -1) {
@@ -15750,7 +16023,7 @@ var Chart = ({
15750
16023
  },
15751
16024
  [activeTooltips, maxTooltips]
15752
16025
  );
15753
- const handleChartClick = useCallback12(
16026
+ const handleChartClick = useCallback14(
15754
16027
  (e) => {
15755
16028
  if (!enableDraggableTooltips) return;
15756
16029
  const ev = e;
@@ -15768,7 +16041,7 @@ var Chart = ({
15768
16041
  },
15769
16042
  [enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
15770
16043
  );
15771
- const handleBarClick = useCallback12(
16044
+ const handleBarClick = useCallback14(
15772
16045
  (data2, index, event) => {
15773
16046
  if (!enableDraggableTooltips) return;
15774
16047
  event.stopPropagation();
@@ -15782,7 +16055,7 @@ var Chart = ({
15782
16055
  },
15783
16056
  [enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
15784
16057
  );
15785
- const handleSeriesClick = useCallback12(
16058
+ const handleSeriesClick = useCallback14(
15786
16059
  (...args) => {
15787
16060
  if (args.length >= 3) {
15788
16061
  const [data2, index, event] = args;
@@ -15793,7 +16066,7 @@ var Chart = ({
15793
16066
  },
15794
16067
  [handleBarClick, handleChartClick]
15795
16068
  );
15796
- const onTooltipPositionChange = useCallback12(
16069
+ const onTooltipPositionChange = useCallback14(
15797
16070
  (id, position) => {
15798
16071
  setActiveTooltips(
15799
16072
  (prev) => prev.map((t) => t.id === id ? { ...t, position } : t)
@@ -15879,12 +16152,23 @@ var Chart = ({
15879
16152
  const yAxisTickWidth = useMemo25(() => {
15880
16153
  if (typeof chartMargin?.left === "number") return chartMargin.left;
15881
16154
  if (yAxisLabel) return axisLabelMargin;
15882
- const samples = [minLeftDataValue, niceMaxLeft, Math.round((minLeftDataValue + niceMaxLeft) / 2), 0];
16155
+ const samples = [
16156
+ minLeftDataValue,
16157
+ niceMaxLeft,
16158
+ Math.round((minLeftDataValue + niceMaxLeft) / 2),
16159
+ 0
16160
+ ];
15883
16161
  const formatted = samples.map((v) => String(yTickFormatter(v)));
15884
16162
  const maxLen = formatted.reduce((m, s) => Math.max(m, s.length), 0);
15885
16163
  const estimated = Math.max(48, Math.min(220, maxLen * 8 + 24));
15886
16164
  return estimated;
15887
- }, [chartMargin?.left, yAxisLabel, yTickFormatter, minLeftDataValue, niceMaxLeft]);
16165
+ }, [
16166
+ chartMargin?.left,
16167
+ yAxisLabel,
16168
+ yTickFormatter,
16169
+ minLeftDataValue,
16170
+ niceMaxLeft
16171
+ ]);
15888
16172
  const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
15889
16173
  const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
15890
16174
  const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
@@ -15897,7 +16181,7 @@ var Chart = ({
15897
16181
  const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
15898
16182
  const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
15899
16183
  const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
15900
- const openTooltipForPeriod = useCallback12(
16184
+ const openTooltipForPeriod = useCallback14(
15901
16185
  (periodName) => {
15902
16186
  if (!enableDraggableTooltips) return;
15903
16187
  const row = processedData.find((r) => String(r.name) === periodName);
@@ -15954,7 +16238,7 @@ var Chart = ({
15954
16238
  style: {
15955
16239
  paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`
15956
16240
  },
15957
- children: /* @__PURE__ */ jsx95(NoData_default, {})
16241
+ children: /* @__PURE__ */ jsx95(NoData_default, { title })
15958
16242
  }
15959
16243
  )
15960
16244
  }
@@ -16403,7 +16687,7 @@ var Chart = ({
16403
16687
  var Chart_default = Chart;
16404
16688
 
16405
16689
  // src/components/ui/charts/BarChart.tsx
16406
- import { useState as useState37, useEffect as useEffect28, useCallback as useCallback13, useMemo as useMemo26 } from "react";
16690
+ import { useState as useState39, useEffect as useEffect31, useCallback as useCallback15, useMemo as useMemo26 } from "react";
16407
16691
  import {
16408
16692
  BarChart as RechartsBarChart,
16409
16693
  Bar as Bar2,
@@ -16495,14 +16779,14 @@ var BarChart = ({
16495
16779
  return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
16496
16780
  }, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
16497
16781
  const { xAxisConfig, mapperConfig } = smartConfig;
16498
- const [activeTooltips, setActiveTooltips] = useState37([]);
16499
- const [isDragging, setIsDragging] = useState37(null);
16500
- const [dragOffset, setDragOffset] = useState37({
16782
+ const [activeTooltips, setActiveTooltips] = useState39([]);
16783
+ const [isDragging, setIsDragging] = useState39(null);
16784
+ const [dragOffset, setDragOffset] = useState39({
16501
16785
  x: 0,
16502
16786
  y: 0
16503
16787
  });
16504
- const [globalTooltipCount, setGlobalTooltipCount] = useState37(0);
16505
- const [alignmentGuides, setAlignmentGuides] = useState37([]);
16788
+ const [globalTooltipCount, setGlobalTooltipCount] = useState39(0);
16789
+ const [alignmentGuides, setAlignmentGuides] = useState39([]);
16506
16790
  const processedData = data.map((item) => ({
16507
16791
  ...item,
16508
16792
  name: String(item[xAxisConfig.dataKey] || "N/A")
@@ -16579,7 +16863,7 @@ var BarChart = ({
16579
16863
  const GUIDE_THRESHOLD2 = 60;
16580
16864
  const STRONG_SNAP_THRESHOLD2 = 35;
16581
16865
  const PRECISION_SNAP_THRESHOLD2 = 8;
16582
- const updateAlignmentGuides = useCallback13(
16866
+ const updateAlignmentGuides = useCallback15(
16583
16867
  (draggedTooltipId, currentPosition) => {
16584
16868
  if (!isDragging) return;
16585
16869
  const getAllTooltips = () => {
@@ -16643,7 +16927,7 @@ var BarChart = ({
16643
16927
  },
16644
16928
  [isDragging, activeTooltips]
16645
16929
  );
16646
- const snapToGuides = useCallback13(
16930
+ const snapToGuides = useCallback15(
16647
16931
  (position) => {
16648
16932
  const snappedPosition = { ...position };
16649
16933
  let hasSnapped = false;
@@ -16705,7 +16989,7 @@ var BarChart = ({
16705
16989
  setIsDragging(tooltipId);
16706
16990
  setDragOffset({ x: offsetX, y: offsetY });
16707
16991
  };
16708
- useEffect28(() => {
16992
+ useEffect31(() => {
16709
16993
  let rafId;
16710
16994
  let lastMousePosition = { x: 0, y: 0 };
16711
16995
  const handleGlobalMouseMove = (e) => {
@@ -16763,7 +17047,7 @@ var BarChart = ({
16763
17047
  updateAlignmentGuides,
16764
17048
  snapToGuides
16765
17049
  ]);
16766
- useEffect28(() => {
17050
+ useEffect31(() => {
16767
17051
  const handleCloseAllTooltips = () => {
16768
17052
  setActiveTooltips([]);
16769
17053
  setGlobalTooltipCount(0);
@@ -16773,7 +17057,7 @@ var BarChart = ({
16773
17057
  window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
16774
17058
  };
16775
17059
  }, []);
16776
- useEffect28(() => {
17060
+ useEffect31(() => {
16777
17061
  const handleTooltipCountRequest = () => {
16778
17062
  window.dispatchEvent(
16779
17063
  new CustomEvent("tooltipCountResponse", {
@@ -16812,7 +17096,7 @@ var BarChart = ({
16812
17096
  );
16813
17097
  };
16814
17098
  }, [activeTooltips]);
16815
- useEffect28(() => {
17099
+ useEffect31(() => {
16816
17100
  if (isDragging) return;
16817
17101
  let totalCount = 0;
16818
17102
  const handleCountResponse = (event) => {
@@ -17078,7 +17362,7 @@ var BarChart = ({
17078
17362
  var BarChart_default = BarChart;
17079
17363
 
17080
17364
  // src/components/ui/charts/LineChart.tsx
17081
- import { useState as useState38, useEffect as useEffect29, useCallback as useCallback14, useMemo as useMemo27 } from "react";
17365
+ import { useState as useState40, useEffect as useEffect32, useCallback as useCallback16, useMemo as useMemo27 } from "react";
17082
17366
  import {
17083
17367
  LineChart as RechartsLineChart,
17084
17368
  Line as Line2,
@@ -17121,14 +17405,14 @@ var CustomLineChart = ({
17121
17405
  containerPaddingLeft,
17122
17406
  16
17123
17407
  );
17124
- const [activeTooltips, setActiveTooltips] = useState38([]);
17125
- const [isDragging, setIsDragging] = useState38(null);
17126
- const [dragOffset, setDragOffset] = useState38({
17408
+ const [activeTooltips, setActiveTooltips] = useState40([]);
17409
+ const [isDragging, setIsDragging] = useState40(null);
17410
+ const [dragOffset, setDragOffset] = useState40({
17127
17411
  x: 0,
17128
17412
  y: 0
17129
17413
  });
17130
- const [globalTooltipCount, setGlobalTooltipCount] = useState38(0);
17131
- const [alignmentGuides, setAlignmentGuides] = useState38([]);
17414
+ const [globalTooltipCount, setGlobalTooltipCount] = useState40(0);
17415
+ const [alignmentGuides, setAlignmentGuides] = useState40([]);
17132
17416
  const generateColors = (dataKeys2) => {
17133
17417
  const colorMap = {};
17134
17418
  const allColors = generateAdditionalColors(colors2, dataKeys2.length);
@@ -17230,10 +17514,10 @@ var CustomLineChart = ({
17230
17514
  const handleChartBackgroundClick = () => {
17231
17515
  setActiveTooltips([]);
17232
17516
  };
17233
- const handleCloseAllTooltips = useCallback14(() => {
17517
+ const handleCloseAllTooltips = useCallback16(() => {
17234
17518
  window.dispatchEvent(new CustomEvent("closeAllTooltips"));
17235
17519
  }, []);
17236
- const updateAlignmentGuides = useCallback14(
17520
+ const updateAlignmentGuides = useCallback16(
17237
17521
  (draggedTooltipId, draggedPosition) => {
17238
17522
  const SNAP_THRESHOLD = 15;
17239
17523
  const draggedTooltip = activeTooltips.find(
@@ -17314,7 +17598,7 @@ var CustomLineChart = ({
17314
17598
  },
17315
17599
  [activeTooltips]
17316
17600
  );
17317
- const snapToGuides = useCallback14(
17601
+ const snapToGuides = useCallback16(
17318
17602
  (position) => {
17319
17603
  const SNAP_DISTANCE = 10;
17320
17604
  const snappedPosition = { ...position };
@@ -17342,7 +17626,7 @@ var CustomLineChart = ({
17342
17626
  setIsDragging(tooltipId);
17343
17627
  setDragOffset({ x: offsetX, y: offsetY });
17344
17628
  };
17345
- useEffect29(() => {
17629
+ useEffect32(() => {
17346
17630
  let rafId;
17347
17631
  let lastMousePosition = { x: 0, y: 0 };
17348
17632
  const handleGlobalMouseMove = (e) => {
@@ -17389,7 +17673,7 @@ var CustomLineChart = ({
17389
17673
  updateAlignmentGuides,
17390
17674
  snapToGuides
17391
17675
  ]);
17392
- useEffect29(() => {
17676
+ useEffect32(() => {
17393
17677
  const handleCloseAllTooltips2 = () => {
17394
17678
  setActiveTooltips([]);
17395
17679
  setGlobalTooltipCount(0);
@@ -17399,7 +17683,7 @@ var CustomLineChart = ({
17399
17683
  window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
17400
17684
  };
17401
17685
  }, []);
17402
- useEffect29(() => {
17686
+ useEffect32(() => {
17403
17687
  const handleTooltipCountRequest = () => {
17404
17688
  window.dispatchEvent(
17405
17689
  new CustomEvent("tooltipCountResponse", {
@@ -17443,7 +17727,7 @@ var CustomLineChart = ({
17443
17727
  );
17444
17728
  };
17445
17729
  }, [activeTooltips]);
17446
- useEffect29(() => {
17730
+ useEffect32(() => {
17447
17731
  if (isDragging) return;
17448
17732
  let totalCount = 0;
17449
17733
  const handleCountResponse = (event) => {
@@ -17772,13 +18056,13 @@ var CustomPieChart = ({
17772
18056
  var PieChart_default = CustomPieChart;
17773
18057
 
17774
18058
  // src/components/ui/charts/hooks/useChartHighlights.tsx
17775
- import { useState as useState39, useCallback as useCallback15 } from "react";
18059
+ import { useState as useState41, useCallback as useCallback17 } from "react";
17776
18060
  var useChartHighlights = () => {
17777
- const [highlightedSeries, setHighlightedSeries] = useState39(
18061
+ const [highlightedSeries, setHighlightedSeries] = useState41(
17778
18062
  /* @__PURE__ */ new Set()
17779
18063
  );
17780
- const [showOnlyHighlighted, setShowOnlyHighlighted] = useState39(false);
17781
- const toggleHighlight = useCallback15((key) => {
18064
+ const [showOnlyHighlighted, setShowOnlyHighlighted] = useState41(false);
18065
+ const toggleHighlight = useCallback17((key) => {
17782
18066
  setHighlightedSeries((prev) => {
17783
18067
  const next = new Set(prev);
17784
18068
  if (next.has(key)) {
@@ -17789,17 +18073,17 @@ var useChartHighlights = () => {
17789
18073
  return next;
17790
18074
  });
17791
18075
  }, []);
17792
- const clearHighlights = useCallback15(() => {
18076
+ const clearHighlights = useCallback17(() => {
17793
18077
  setHighlightedSeries(/* @__PURE__ */ new Set());
17794
18078
  setShowOnlyHighlighted(false);
17795
18079
  }, []);
17796
- const isHighlighted = useCallback15(
18080
+ const isHighlighted = useCallback17(
17797
18081
  (key) => {
17798
18082
  return highlightedSeries.has(key);
17799
18083
  },
17800
18084
  [highlightedSeries]
17801
18085
  );
17802
- const getSeriesStyle = useCallback15(
18086
+ const getSeriesStyle = useCallback17(
17803
18087
  (key) => {
17804
18088
  const hasHighlights = highlightedSeries.size > 0;
17805
18089
  const isSeriesHighlighted = highlightedSeries.has(key);
@@ -17843,83 +18127,6 @@ var useChartHighlights = () => {
17843
18127
  isHighlighted
17844
18128
  };
17845
18129
  };
17846
-
17847
- // src/hooks/use-drag.tsx
17848
- import { useState as useState40, useCallback as useCallback16, useRef as useRef19, useEffect as useEffect30 } from "react";
17849
- var useDrag = (options = {}) => {
17850
- const [isDragging, setIsDragging] = useState40(null);
17851
- const [positions, setPositions] = useState40({});
17852
- const dragStartPos = useRef19(null);
17853
- const dragId = useRef19(null);
17854
- const handleMouseDown = useCallback16((id, e) => {
17855
- e.preventDefault();
17856
- const currentPosition = positions[id] || { top: 0, left: 0 };
17857
- dragStartPos.current = {
17858
- x: e.clientX,
17859
- y: e.clientY,
17860
- elementX: currentPosition.left,
17861
- elementY: currentPosition.top
17862
- };
17863
- dragId.current = id;
17864
- setIsDragging(id);
17865
- options.onDragStart?.(id);
17866
- }, [positions, options]);
17867
- const handleMouseMove = useCallback16((e) => {
17868
- if (!isDragging || !dragStartPos.current || !dragId.current) return;
17869
- const deltaX = e.clientX - dragStartPos.current.x;
17870
- const deltaY = e.clientY - dragStartPos.current.y;
17871
- const newPosition = {
17872
- left: dragStartPos.current.elementX + deltaX,
17873
- top: dragStartPos.current.elementY + deltaY
17874
- };
17875
- newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
17876
- newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
17877
- setPositions((prev) => ({
17878
- ...prev,
17879
- [dragId.current]: newPosition
17880
- }));
17881
- options.onDrag?.(dragId.current, newPosition);
17882
- }, [isDragging, options]);
17883
- const handleMouseUp = useCallback16(() => {
17884
- if (dragId.current) {
17885
- options.onDragEnd?.(dragId.current);
17886
- }
17887
- setIsDragging(null);
17888
- dragStartPos.current = null;
17889
- dragId.current = null;
17890
- }, [options]);
17891
- useEffect30(() => {
17892
- if (isDragging) {
17893
- document.addEventListener("mousemove", handleMouseMove);
17894
- document.addEventListener("mouseup", handleMouseUp);
17895
- document.body.style.userSelect = "none";
17896
- return () => {
17897
- document.removeEventListener("mousemove", handleMouseMove);
17898
- document.removeEventListener("mouseup", handleMouseUp);
17899
- document.body.style.userSelect = "";
17900
- };
17901
- }
17902
- }, [isDragging, handleMouseMove, handleMouseUp]);
17903
- const setPosition = useCallback16((id, position) => {
17904
- setPositions((prev) => ({
17905
- ...prev,
17906
- [id]: position
17907
- }));
17908
- }, []);
17909
- const getPosition = useCallback16((id) => {
17910
- return positions[id] || { top: 0, left: 0 };
17911
- }, [positions]);
17912
- const isElementDragging = useCallback16((id) => {
17913
- return isDragging === id;
17914
- }, [isDragging]);
17915
- return {
17916
- handleMouseDown,
17917
- getPosition,
17918
- setPosition,
17919
- isElementDragging,
17920
- isDragging: isDragging !== null
17921
- };
17922
- };
17923
18130
  export {
17924
18131
  AddButton,
17925
18132
  Agenda,