@mlw-packages/react-components 1.9.6 → 1.9.8

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.js CHANGED
@@ -1891,9 +1891,9 @@ var InputBase = React33__namespace.forwardRef(
1891
1891
  "div",
1892
1892
  {
1893
1893
  className: cn(
1894
- "flex items-center rounded-md transition h-9 focus-within:ring-1 focus-within:ring-ring focus-within:border-ring bg-background overflow-hidden",
1894
+ "flex items-center rounded-md transition h-9 bg-background overflow-hidden",
1895
1895
  type !== "file" && "border border-input",
1896
- error ? "border-destructive focus:ring-1 focus:ring-destructive" : "border-input focus:ring-1 focus:ring-ring"
1896
+ error ? "border-destructive focus:ring-1 focus:ring-destructive" : "border-input"
1897
1897
  ),
1898
1898
  children: [
1899
1899
  leftIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center px-2", children: leftIcon }),
@@ -1977,87 +1977,130 @@ var CommandInputBase = React33__namespace.forwardRef(({ className, testid: dataT
1977
1977
  }
1978
1978
  ));
1979
1979
  CommandInputBase.displayName = cmdk.Command.Input.displayName;
1980
- var CommandListBase = React33__namespace.forwardRef(({ className, testid: dataTestId = "command-list", ...props }, ref) => {
1981
- const listRef = React33__namespace.useRef(null);
1982
- React33__namespace.useEffect(() => {
1983
- const element = listRef.current;
1984
- if (!element) return;
1985
- const handleWheel = (e) => {
1986
- const target = e.currentTarget;
1987
- const { scrollTop, scrollHeight, clientHeight } = target;
1988
- const isScrollingDown = e.deltaY > 0;
1989
- const isScrollingUp = e.deltaY < 0;
1990
- const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
1991
- const isAtTop = scrollTop <= 1;
1992
- if (isScrollingDown && !isAtBottom || isScrollingUp && !isAtTop) {
1993
- e.stopPropagation();
1994
- }
1995
- };
1996
- let touchStartY = 0;
1997
- const handleTouchStart = (e) => {
1998
- touchStartY = e.touches[0].clientY;
1999
- e.stopPropagation();
2000
- };
2001
- const handleTouchMove = (e) => {
2002
- const target = e.currentTarget;
2003
- const { scrollTop, scrollHeight, clientHeight } = target;
2004
- const touchCurrentY = e.touches[0].clientY;
2005
- const touchDeltaY = touchStartY - touchCurrentY;
2006
- const isScrollingDown = touchDeltaY > 0;
2007
- const isScrollingUp = touchDeltaY < 0;
2008
- const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
2009
- const isAtTop = scrollTop <= 1;
2010
- if (isScrollingDown && !isAtBottom || isScrollingUp && !isAtTop) {
1980
+ var CommandDebouncedInputBase = React33__namespace.forwardRef(({ className, testid: dataTestId = "command-input", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1981
+ "div",
1982
+ {
1983
+ className: "flex items-center border-b px-3 border-border",
1984
+ "cmdk-input-wrapper": "",
1985
+ children: [
1986
+ /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 text-primary" }),
1987
+ /* @__PURE__ */ jsxRuntime.jsx(
1988
+ cmdk.Command.Input,
1989
+ {
1990
+ ref,
1991
+ className: cn(
1992
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none text-primary placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
1993
+ className
1994
+ ),
1995
+ "data-testid": dataTestId,
1996
+ ...props
1997
+ }
1998
+ )
1999
+ ]
2000
+ }
2001
+ ));
2002
+ CommandDebouncedInputBase.displayName = cmdk.Command.Input.displayName;
2003
+ var CommandListBase = React33__namespace.forwardRef(
2004
+ ({ className, testid: dataTestId = "command-list", onEndReached, ...props }, ref) => {
2005
+ const listRef = React33__namespace.useRef(null);
2006
+ React33__namespace.useEffect(() => {
2007
+ const element = listRef.current;
2008
+ if (!element) return;
2009
+ const handleWheel = (e) => {
2010
+ const target = e.currentTarget;
2011
+ const { scrollTop, scrollHeight, clientHeight } = target;
2012
+ const isScrollingDown = e.deltaY > 0;
2013
+ const isScrollingUp = e.deltaY < 0;
2014
+ const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
2015
+ const isAtTop = scrollTop <= 1;
2016
+ if (isScrollingDown && isAtBottom && onEndReached) {
2017
+ onEndReached();
2018
+ }
2019
+ if (isScrollingDown && !isAtBottom || isScrollingUp && !isAtTop) {
2020
+ e.stopPropagation();
2021
+ }
2022
+ };
2023
+ const handleScroll = (e) => {
2024
+ const target = e.currentTarget;
2025
+ const { scrollTop, scrollHeight, clientHeight } = target;
2026
+ const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
2027
+ if (isAtBottom && onEndReached) {
2028
+ onEndReached();
2029
+ }
2030
+ };
2031
+ let touchStartY = 0;
2032
+ const handleTouchStart = (e) => {
2033
+ touchStartY = e.touches[0].clientY;
2011
2034
  e.stopPropagation();
2012
- } else if (isScrollingDown && isAtBottom || isScrollingUp && isAtTop) {
2013
- e.preventDefault();
2014
- }
2015
- };
2016
- element.addEventListener("wheel", handleWheel, { passive: false });
2017
- element.addEventListener("touchstart", handleTouchStart, {
2018
- passive: false
2019
- });
2020
- element.addEventListener("touchmove", handleTouchMove, { passive: false });
2021
- return () => {
2022
- element.removeEventListener("wheel", handleWheel);
2023
- element.removeEventListener("touchmove", handleTouchMove);
2024
- element.removeEventListener("touchstart", handleTouchStart);
2025
- };
2026
- }, []);
2027
- const combinedRef = React33__namespace.useCallback(
2028
- (node) => {
2029
- listRef.current = node;
2030
- if (typeof ref === "function") {
2031
- ref(node);
2032
- } else if (ref) {
2033
- ref.current = node;
2034
- }
2035
- },
2036
- [ref]
2037
- );
2038
- return /* @__PURE__ */ jsxRuntime.jsx(
2039
- cmdk.Command.List,
2040
- {
2041
- ref: combinedRef,
2042
- className: cn(
2043
- "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",
2044
- className
2045
- ),
2046
- "data-testid": dataTestId,
2047
- style: {
2048
- overscrollBehavior: "contain",
2049
- WebkitOverflowScrolling: "touch",
2050
- touchAction: "pan-y",
2051
- scrollbarWidth: "thin",
2052
- scrollbarColor: "hsl(var(--muted)) transparent",
2053
- overflowY: "auto",
2054
- willChange: "scroll-position",
2055
- transform: "translateZ(0)"
2035
+ };
2036
+ const handleTouchMove = (e) => {
2037
+ const target = e.currentTarget;
2038
+ const { scrollTop, scrollHeight, clientHeight } = target;
2039
+ const touchCurrentY = e.touches[0].clientY;
2040
+ const touchDeltaY = touchStartY - touchCurrentY;
2041
+ const isScrollingDown = touchDeltaY > 0;
2042
+ const isScrollingUp = touchDeltaY < 0;
2043
+ const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
2044
+ const isAtTop = scrollTop <= 1;
2045
+ if (isScrollingDown && isAtBottom && onEndReached) {
2046
+ onEndReached();
2047
+ }
2048
+ if (isScrollingDown && !isAtBottom || isScrollingUp && !isAtTop) {
2049
+ e.stopPropagation();
2050
+ } else if (isScrollingDown && isAtBottom || isScrollingUp && isAtTop) {
2051
+ e.preventDefault();
2052
+ }
2053
+ };
2054
+ element.addEventListener("wheel", handleWheel, { passive: false });
2055
+ element.addEventListener("scroll", handleScroll);
2056
+ element.addEventListener("touchstart", handleTouchStart, {
2057
+ passive: false
2058
+ });
2059
+ element.addEventListener("touchmove", handleTouchMove, {
2060
+ passive: false
2061
+ });
2062
+ return () => {
2063
+ element.removeEventListener("wheel", handleWheel);
2064
+ element.removeEventListener("scroll", handleScroll);
2065
+ element.removeEventListener("touchmove", handleTouchMove);
2066
+ element.removeEventListener("touchstart", handleTouchStart);
2067
+ };
2068
+ }, [onEndReached]);
2069
+ const combinedRef = React33__namespace.useCallback(
2070
+ (node) => {
2071
+ listRef.current = node;
2072
+ if (typeof ref === "function") {
2073
+ ref(node);
2074
+ } else if (ref) {
2075
+ ref.current = node;
2076
+ }
2056
2077
  },
2057
- ...props
2058
- }
2059
- );
2060
- });
2078
+ [ref]
2079
+ );
2080
+ return /* @__PURE__ */ jsxRuntime.jsx(
2081
+ cmdk.Command.List,
2082
+ {
2083
+ ref: combinedRef,
2084
+ className: cn(
2085
+ "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",
2086
+ className
2087
+ ),
2088
+ "data-testid": dataTestId,
2089
+ style: {
2090
+ overscrollBehavior: "contain",
2091
+ WebkitOverflowScrolling: "touch",
2092
+ touchAction: "pan-y",
2093
+ scrollbarWidth: "thin",
2094
+ scrollbarColor: "hsl(var(--muted)) transparent",
2095
+ overflowY: "auto",
2096
+ willChange: "scroll-position",
2097
+ transform: "translateZ(0)"
2098
+ },
2099
+ ...props
2100
+ }
2101
+ );
2102
+ }
2103
+ );
2061
2104
  CommandListBase.displayName = cmdk.Command.List.displayName;
2062
2105
  var CommandEmptyBase = React33__namespace.forwardRef(({ testid: dataTestId = "command-empty", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2063
2106
  cmdk.Command.Empty,
@@ -2558,8 +2601,8 @@ function MultiSelectTriggerBase({
2558
2601
  "aria-disabled": disabled || void 0,
2559
2602
  disabled,
2560
2603
  className: cn(
2561
- "flex h-auto max-h-9 min-h-9 w-full items-center justify-between gap-2 overflow-hidden rounded-md border border-input bg-background px-3 py-1.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
2562
- error ? "border-destructive focus:ring-1 focus:ring-destructive" : "border-input focus:ring-1 focus:ring-ring",
2604
+ "flex h-auto max-h-9 min-h-9 w-full items-center justify-between gap-2 overflow-hidden rounded-md border border-input bg-background px-3 py-1.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground hover:text-primary",
2605
+ error ? "border-destructive focus:ring-1 focus:ring-destructive dark:border-red-500" : "border-border focus:ring-1 focus:ring-ring",
2563
2606
  className
2564
2607
  ),
2565
2608
  children: [
@@ -7323,58 +7366,62 @@ function StatusIndicator({
7323
7366
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0", children })
7324
7367
  ] });
7325
7368
  }
7326
- function DebouncedInput({
7327
- value: initialValue,
7328
- onChange,
7329
- debounce: debounce2 = 500,
7330
- label,
7331
- labelClassname,
7332
- leftIcon,
7333
- rightIcon,
7334
- showLoadingIndicator = false,
7335
- className,
7336
- error,
7337
- ...props
7338
- }) {
7339
- const [value, setValue] = React33.useState(initialValue);
7340
- const [isDebouncing, setIsDebouncing] = React33.useState(false);
7341
- React33.useEffect(() => {
7342
- setValue(initialValue);
7343
- }, [initialValue]);
7344
- React33.useEffect(() => {
7345
- if (value !== initialValue) {
7346
- setIsDebouncing(true);
7347
- }
7348
- const timeout = setTimeout(() => {
7349
- onChange(value);
7350
- setIsDebouncing(false);
7351
- }, debounce2);
7352
- return () => {
7353
- clearTimeout(timeout);
7354
- setIsDebouncing(false);
7369
+ var DebouncedInput = React33.forwardRef(
7370
+ ({
7371
+ value: initialValue,
7372
+ onChange,
7373
+ debounce: debounce2 = 500,
7374
+ label,
7375
+ labelClassname,
7376
+ leftIcon,
7377
+ rightIcon,
7378
+ showLoadingIndicator = false,
7379
+ className,
7380
+ error,
7381
+ ...props
7382
+ }, ref) => {
7383
+ const [value, setValue] = React33.useState(initialValue);
7384
+ const [isDebouncing, setIsDebouncing] = React33.useState(false);
7385
+ React33.useEffect(() => {
7386
+ setValue(initialValue);
7387
+ }, [initialValue]);
7388
+ React33.useEffect(() => {
7389
+ if (value !== initialValue) {
7390
+ setIsDebouncing(true);
7391
+ }
7392
+ const timeout = setTimeout(() => {
7393
+ onChange(value);
7394
+ setIsDebouncing(false);
7395
+ }, debounce2);
7396
+ return () => {
7397
+ clearTimeout(timeout);
7398
+ setIsDebouncing(false);
7399
+ };
7400
+ }, [debounce2, initialValue, onChange, value]);
7401
+ const renderRightIcon = () => {
7402
+ if (showLoadingIndicator && isDebouncing) {
7403
+ return /* @__PURE__ */ jsxRuntime.jsx(react.CircleNotchIcon, { className: "h-4 w-4 animate-spin text-muted-foreground" });
7404
+ }
7405
+ return rightIcon;
7355
7406
  };
7356
- }, [debounce2, initialValue, onChange, value]);
7357
- const renderRightIcon = () => {
7358
- if (showLoadingIndicator && isDebouncing) {
7359
- return /* @__PURE__ */ jsxRuntime.jsx(react.CircleNotchIcon, { className: "h-4 w-4 animate-spin text-muted-foreground" });
7360
- }
7361
- return rightIcon;
7362
- };
7363
- return /* @__PURE__ */ jsxRuntime.jsx(
7364
- InputBase,
7365
- {
7366
- ...props,
7367
- label,
7368
- labelClassname,
7369
- leftIcon,
7370
- rightIcon: renderRightIcon(),
7371
- className: cn("transition-all duration-200", className),
7372
- value,
7373
- onChange: (e) => setValue(e.target.value),
7374
- error
7375
- }
7376
- );
7377
- }
7407
+ return /* @__PURE__ */ jsxRuntime.jsx(
7408
+ InputBase,
7409
+ {
7410
+ ...props,
7411
+ ref,
7412
+ label,
7413
+ labelClassname,
7414
+ leftIcon,
7415
+ rightIcon: renderRightIcon(),
7416
+ className: cn("transition-all duration-200", className),
7417
+ value,
7418
+ onChange: (e) => setValue(e.target.value),
7419
+ error
7420
+ }
7421
+ );
7422
+ }
7423
+ );
7424
+ DebouncedInput.displayName = "DebouncedInput";
7378
7425
  function useCheckboxTree(initialTree) {
7379
7426
  const initialCheckedNodes = React33.useMemo(() => {
7380
7427
  const checkedSet = /* @__PURE__ */ new Set();
@@ -7886,7 +7933,7 @@ function ScrollColumn({
7886
7933
  {
7887
7934
  className: cn(
7888
7935
  "snap-center flex items-center justify-center select-none font-bold tabular-nums transition-all duration-200",
7889
- isCentered ? "text-2xl sm:text-xl text-foreground scale-110" : "text-base sm:text-sm text-muted-foreground/60"
7936
+ isCentered ? "text-foreground scale-110" : "text-base sm:text-sm text-muted-foreground/60"
7890
7937
  ),
7891
7938
  style: { height: `${itemHeight}px` },
7892
7939
  children: item.toString().padStart(2, "0")
@@ -9144,19 +9191,19 @@ function getEventColorClassesAgenda(color) {
9144
9191
  const eventColor = color || "sky";
9145
9192
  switch (eventColor) {
9146
9193
  case "sky":
9147
- return "bg-sky-200/50 hover:bg-sky-200/40 text-sky-950/80 dark:bg-sky-400/25 dark:hover:bg-sky-400/20 dark:text-sky-200 shadow-sky-700/8";
9194
+ return "bg-sky-100 hover:bg-sky-200 text-sky-900 border dark:bg-sky-500/30 dark:hover:bg-sky-500/40 dark:text-sky-50 dark:border-sky-400/40 shadow-sky-500/15 hover:shadow-sky-500/25 transition-all duration-200";
9148
9195
  case "amber":
9149
- return "bg-amber-200/50 hover:bg-amber-200/40 text-amber-950/80 dark:bg-amber-400/25 dark:hover:bg-amber-400/20 dark:text-amber-200 shadow-amber-700/8";
9196
+ return "bg-amber-100 hover:bg-amber-200 text-amber-900 border dark:bg-amber-500/30 dark:hover:bg-amber-500/40 dark:text-amber-50 dark:border-amber-400/40 shadow-amber-500/15 hover:shadow-amber-500/25 transition-all duration-200";
9150
9197
  case "violet":
9151
- return "bg-violet-200/50 hover:bg-violet-200/40 text-violet-950/80 dark:bg-violet-400/25 dark:hover:bg-violet-400/20 dark:text-violet-200 shadow-violet-700/8";
9198
+ return "bg-violet-100 hover:bg-violet-200 text-violet-900 border dark:bg-violet-500/30 dark:hover:bg-violet-500/40 dark:text-violet-50 dark:border-violet-400/40 shadow-violet-500/15 hover:shadow-violet-500/25 transition-all duration-200";
9152
9199
  case "rose":
9153
- return "bg-rose-200/50 hover:bg-rose-200/40 text-rose-950/80 dark:bg-rose-400/25 dark:hover:bg-rose-400/20 dark:text-rose-200 shadow-rose-700/8";
9200
+ return "bg-rose-100 hover:bg-rose-200 text-rose-900 border dark:bg-rose-500/30 dark:hover:bg-rose-500/40 dark:text-rose-50 dark:border-rose-400/40 shadow-rose-500/15 hover:shadow-rose-500/25 transition-all duration-200";
9154
9201
  case "emerald":
9155
- return "bg-emerald-200/50 hover:bg-emerald-200/40 text-emerald-950/80 dark:bg-emerald-400/25 dark:hover:bg-emerald-400/20 dark:text-emerald-200 shadow-emerald-700/8";
9202
+ return "bg-emerald-100 hover:bg-emerald-200 text-emerald-900 border dark:bg-emerald-500/30 dark:hover:bg-emerald-500/40 dark:text-emerald-50 dark:border-emerald-400/40 shadow-emerald-500/15 hover:shadow-emerald-500/25 transition-all duration-200";
9156
9203
  case "orange":
9157
- return "bg-orange-200/50 hover:bg-orange-200/40 text-orange-950/80 dark:bg-orange-400/25 dark:hover:bg-orange-400/20 dark:text-orange-200 shadow-orange-700/8";
9204
+ return "bg-orange-100 hover:bg-orange-200 text-orange-900 border dark:bg-orange-500/30 dark:hover:bg-orange-500/40 dark:text-orange-50 dark:border-orange-400/40 shadow-orange-500/15 hover:shadow-orange-500/25 transition-all duration-200";
9158
9205
  default:
9159
- return "bg-sky-200/50 hover:bg-sky-200/40 text-sky-950/80 dark:bg-sky-400/25 dark:hover:bg-sky-400/20 dark:text-sky-200 shadow-sky-700/8";
9206
+ return "bg-sky-100 hover:bg-sky-200 text-sky-900 border dark:bg-sky-500/30 dark:hover:bg-sky-500/40 dark:text-sky-50 dark:border-sky-400/40 shadow-sky-500/15 hover:shadow-sky-500/25 transition-all duration-200";
9160
9207
  }
9161
9208
  }
9162
9209
  function getBorderRadiusClassesAgenda(isFirstDay, isLastDay) {
@@ -9175,7 +9222,7 @@ function isMultiDayEventAgenda(event) {
9175
9222
  const eventStart = getEventStartDate(event);
9176
9223
  const eventEnd = getEventEndDate(event);
9177
9224
  if (!eventStart || !eventEnd) return !!event.allDay;
9178
- return event.allDay || eventStart.getDate() !== eventEnd.getDate();
9225
+ return event.allDay || !dateFns.isSameDay(eventStart, eventEnd);
9179
9226
  }
9180
9227
  function getEventsForDayAgenda(events, day) {
9181
9228
  return events.filter((event) => {
@@ -9331,12 +9378,13 @@ function EventWrapper({
9331
9378
  return void 0;
9332
9379
  })();
9333
9380
  const isEventInPast = displayEnd ? dateFns.isPast(displayEnd) : false;
9334
- const colorClasses = hasValidTimeForWrapper ? getEventColorClassesAgenda(event.color) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
9381
+ const colorClasses = hasValidTimeForWrapper ? getEventColorClassesAgenda(event.color) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none ";
9335
9382
  return /* @__PURE__ */ jsxRuntime.jsx(
9336
9383
  "button",
9337
9384
  {
9338
9385
  className: cn(
9339
- "flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md border",
9386
+ "flex w-full select-none px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md border ",
9387
+ className?.includes("overflow-visible") ? "" : "overflow-hidden",
9340
9388
  colorClasses,
9341
9389
  getBorderRadiusClassesAgenda(isFirstDay, isLastDay),
9342
9390
  className
@@ -9961,7 +10009,7 @@ function Select({
9961
10009
  ]
9962
10010
  }
9963
10011
  ),
9964
- /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaBase, { "data-testid": testIds.scrollarea ?? "select-scrollarea", children: /* @__PURE__ */ jsxRuntime.jsx(SelectContentBase, { "data-testid": testIds.content ?? "select-content", children: pagination && pagination > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10012
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaBase, { "data-testid": testIds.scrollarea ?? "select-scrollarea", children: /* @__PURE__ */ jsxRuntime.jsx(SelectContentBase, { "data-testid": testIds.content ?? "select-content", className: "border-border", children: pagination && pagination > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9965
10013
  /* @__PURE__ */ jsxRuntime.jsx(
9966
10014
  "div",
9967
10015
  {
@@ -10459,7 +10507,7 @@ function MonthViewAgenda({
10459
10507
  "div",
10460
10508
  {
10461
10509
  className: tailwindMerge.twMerge(
10462
- `mt-1 inline-flex w-6 h-6 sm:w-7 sm:h-7 items-center justify-center rounded-full text-xs sm:text-sm font-semibold text-muted-foreground`,
10510
+ `mt-1 inline-flex w-6 h-6 sm:w-7 sm:h-7 items-center justify-center border rounded-md text-xs sm:text-sm font-semibold text-muted-foreground`,
10463
10511
  dateFns.isToday(day) ? "bg-blue-500 text-white" : ""
10464
10512
  ),
10465
10513
  children: dateFns.format(day, "d")
@@ -10492,21 +10540,19 @@ function MonthViewAgenda({
10492
10540
  isLastDay,
10493
10541
  onClick: (e) => handleEventClick(event, e),
10494
10542
  view: "month",
10495
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 truncate text-[12px] text-foreground", children: [
10496
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] opacity-80", children: "\u2192" }),
10497
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium", children: event.title })
10498
- ] })
10543
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 truncate text-[12px] text-foreground" })
10499
10544
  }
10500
10545
  )
10501
10546
  },
10502
10547
  `spanning-${event.id}-${day.toISOString().slice(0, 10)}`
10503
10548
  );
10504
10549
  }
10550
+ const isMultiDay = !isLastDay;
10505
10551
  return /* @__PURE__ */ jsxRuntime.jsx(
10506
10552
  "div",
10507
10553
  {
10508
10554
  "aria-hidden": isHidden ? "true" : void 0,
10509
- className: "aria-hidden:hidden",
10555
+ className: "aria-hidden:hidden relative",
10510
10556
  children: /* @__PURE__ */ jsxRuntime.jsx(
10511
10557
  EventItemAgenda,
10512
10558
  {
@@ -10515,9 +10561,16 @@ function MonthViewAgenda({
10515
10561
  isLastDay,
10516
10562
  onClick: (e) => handleEventClick(event, e),
10517
10563
  view: "month",
10518
- children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 sm:gap-2 truncate text-[12px] text-foreground", children: [
10564
+ className: isMultiDay ? "overflow-visible" : "",
10565
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 sm:gap-2 truncate text-[12px] text-foreground relative z-10", children: [
10519
10566
  !event.allDay && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-normal opacity-80 text-[10px] sm:text-[11px] bg-white/10 px-1 py-0.5 rounded-full", children: dateFns.format(eventStart, "HH:mm") }),
10520
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium text-xs sm:text-sm", children: event.title })
10567
+ /* @__PURE__ */ jsxRuntime.jsx(
10568
+ "span",
10569
+ {
10570
+ className: `font-medium text-xs sm:text-sm ${isMultiDay ? "whitespace-nowrap" : "truncate"}`,
10571
+ children: event.title
10572
+ }
10573
+ )
10521
10574
  ] })
10522
10575
  }
10523
10576
  )
@@ -13283,13 +13336,13 @@ function getEventColorClasses(color) {
13283
13336
  }
13284
13337
  function getBorderRadiusClasses(isFirstDay, isLastDay) {
13285
13338
  if (isFirstDay && isLastDay) {
13286
- return "rounded";
13339
+ return "rounded-lg";
13287
13340
  }
13288
13341
  if (isFirstDay) {
13289
- return "rounded-l rounded-r-none";
13342
+ return "rounded-l-lg rounded-r-none";
13290
13343
  }
13291
13344
  if (isLastDay) {
13292
- return "rounded-r rounded-l-none";
13345
+ return "rounded-r-lg rounded-l-none";
13293
13346
  }
13294
13347
  return "rounded-none";
13295
13348
  }
@@ -14017,8 +14070,7 @@ function MultiSelect({
14017
14070
  )
14018
14071
  ]
14019
14072
  }
14020
- ),
14021
- /* @__PURE__ */ jsxRuntime.jsx(ErrorMessage_default, { error })
14073
+ )
14022
14074
  ] });
14023
14075
  }
14024
14076
 
@@ -15124,7 +15176,7 @@ var DraggableTooltipComponent = ({
15124
15176
  /* @__PURE__ */ jsxRuntime.jsx(
15125
15177
  framerMotion.motion.div,
15126
15178
  {
15127
- className: "fixed pointer-events-none z-30",
15179
+ className: "fixed pointer-events-none z-[9998]",
15128
15180
  variants: guideVariants,
15129
15181
  initial: "hidden",
15130
15182
  animate: "visible",
@@ -15146,7 +15198,7 @@ var DraggableTooltipComponent = ({
15146
15198
  /* @__PURE__ */ jsxRuntime.jsx(
15147
15199
  framerMotion.motion.div,
15148
15200
  {
15149
- className: "fixed pointer-events-none z-31",
15201
+ className: "fixed pointer-events-none z-[9999]",
15150
15202
  variants: guideDotVariants,
15151
15203
  initial: "hidden",
15152
15204
  animate: "visible",
@@ -15186,7 +15238,7 @@ var DraggableTooltipComponent = ({
15186
15238
  /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsxs(
15187
15239
  framerMotion.motion.div,
15188
15240
  {
15189
- className: "fixed bg-card border border-border rounded-lg shadow-lg z-50 min-w-80 select-none",
15241
+ className: "fixed bg-card border border-border rounded-lg shadow-lg z-[10000] min-w-80 select-none",
15190
15242
  variants: tooltipVariants,
15191
15243
  initial: "hidden",
15192
15244
  animate: "visible",
@@ -15418,7 +15470,7 @@ var RechartTooltipWithTotal = ({
15418
15470
  {
15419
15471
  role: "dialog",
15420
15472
  "aria-label": `Tooltip ${label ?? ""}`,
15421
- className: "bg-card border border-border rounded-lg p-3 shadow-2xl max-w-xs",
15473
+ className: "bg-card border border-border rounded-lg p-3 shadow-2xl max-w-xs z-[10000]",
15422
15474
  style: { minWidth: 220 },
15423
15475
  children: [
15424
15476
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between mb-2", children: [
@@ -15531,7 +15583,7 @@ var TooltipSimple = ({
15531
15583
  {
15532
15584
  role: "dialog",
15533
15585
  "aria-label": `Tooltip ${label ?? ""}`,
15534
- className: "bg-card border border-border rounded-lg p-3 shadow-2xl max-w-[280px]",
15586
+ className: "bg-card border border-border rounded-lg p-3 shadow-2xl max-w-[280px] z-[10000]",
15535
15587
  style: { minWidth: 220 },
15536
15588
  children: [
15537
15589
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
@@ -15720,7 +15772,7 @@ var SystemTooltip = ({
15720
15772
  return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsxs(
15721
15773
  framerMotion.motion.div,
15722
15774
  {
15723
- className: "fixed bg-card/95 backdrop-blur-md border border-border/50 rounded-xl shadow-2xl z-50 w-80 overflow-hidden",
15775
+ className: "fixed bg-card/95 backdrop-blur-md border border-border/50 rounded-xl shadow-2xl z-[10000] w-80 overflow-hidden",
15724
15776
  variants: tooltipVariants2,
15725
15777
  initial: "hidden",
15726
15778
  animate: "visible",
@@ -15795,7 +15847,9 @@ var SystemTooltip = ({
15795
15847
  "div",
15796
15848
  {
15797
15849
  className: "group flex items-center justify-between p-2 rounded-lg bg-emerald-500/5 border border-emerald-500/10 hover:border-emerald-500/30 transition-all cursor-pointer",
15798
- onClick: () => setExpandedId(expandedId === conn.id ? null : conn.id),
15850
+ onClick: () => setExpandedId(
15851
+ expandedId === conn.id ? null : conn.id
15852
+ ),
15799
15853
  children: [
15800
15854
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15801
15855
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -15857,7 +15911,9 @@ var SystemTooltip = ({
15857
15911
  "div",
15858
15912
  {
15859
15913
  className: "group flex items-center justify-between p-2 rounded-lg bg-blue-500/5 border border-blue-500/10 hover:border-blue-500/30 transition-all cursor-pointer",
15860
- onClick: () => setExpandedId(expandedId === conn.id ? null : conn.id),
15914
+ onClick: () => setExpandedId(
15915
+ expandedId === conn.id ? null : conn.id
15916
+ ),
15861
15917
  children: [
15862
15918
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15863
15919
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -15918,6 +15974,35 @@ var SystemTooltip = ({
15918
15974
  ) });
15919
15975
  };
15920
15976
  var SystemTooltip_default = SystemTooltip;
15977
+
15978
+ // src/components/ui/charts/components/tooltips/systemTooltipUtils.ts
15979
+ function processNeo4jData(integrations, targetSystemName) {
15980
+ const connections = [];
15981
+ integrations.forEach((integration) => {
15982
+ const origemNome = integration.origem.properties.nome;
15983
+ const destinoNome = integration.destino.properties.nome;
15984
+ if (origemNome === targetSystemName) {
15985
+ connections.push({
15986
+ id: integration.r.elementId,
15987
+ name: destinoNome,
15988
+ type: "saida",
15989
+ integration: integration.r.properties
15990
+ });
15991
+ }
15992
+ if (destinoNome === targetSystemName) {
15993
+ connections.push({
15994
+ id: integration.r.elementId,
15995
+ name: origemNome,
15996
+ type: "entrada",
15997
+ integration: integration.r.properties
15998
+ });
15999
+ }
16000
+ });
16001
+ return {
16002
+ name: targetSystemName,
16003
+ connections
16004
+ };
16005
+ }
15921
16006
  var Brush = ({
15922
16007
  data,
15923
16008
  legend,
@@ -16209,6 +16294,119 @@ var HorizontalLegend = ({
16209
16294
  ] }) });
16210
16295
  };
16211
16296
  var HorizontalLegend_default = HorizontalLegend;
16297
+ function ChartControls({
16298
+ allKeys,
16299
+ mapperConfig,
16300
+ finalColors,
16301
+ highlightedSeries,
16302
+ toggleHighlight,
16303
+ showOnlyHighlighted,
16304
+ setShowOnlyHighlighted,
16305
+ highlightedSeriesSize,
16306
+ clearHighlights,
16307
+ enableHighlights,
16308
+ enableShowOnly,
16309
+ enablePeriodsDropdown,
16310
+ enableDraggableTooltips,
16311
+ processedData,
16312
+ onOpenPeriod,
16313
+ rightOffset,
16314
+ activePeriods,
16315
+ containerClass,
16316
+ containerWidth
16317
+ }) {
16318
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerClass, children: [
16319
+ enableHighlights && /* @__PURE__ */ jsxRuntime.jsx(
16320
+ Highlights_default,
16321
+ {
16322
+ allKeys,
16323
+ mapperConfig,
16324
+ finalColors,
16325
+ highlightedSeries,
16326
+ toggleHighlight,
16327
+ containerWidth
16328
+ }
16329
+ ),
16330
+ enableShowOnly && /* @__PURE__ */ jsxRuntime.jsx(
16331
+ ShowOnly_default,
16332
+ {
16333
+ showOnlyHighlighted,
16334
+ setShowOnlyHighlighted,
16335
+ highlightedSeriesSize,
16336
+ clearHighlights
16337
+ }
16338
+ ),
16339
+ enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
16340
+ PeriodsDropdown_default,
16341
+ {
16342
+ processedData: processedData ?? [],
16343
+ onOpenPeriod: onOpenPeriod ?? (() => {
16344
+ }),
16345
+ rightOffset,
16346
+ activePeriods
16347
+ }
16348
+ ) })
16349
+ ] });
16350
+ }
16351
+ function ChartHeader({
16352
+ title,
16353
+ titlePosition = "left",
16354
+ HORIZONTAL_PADDING_CLASS = "px-24",
16355
+ customLegend,
16356
+ data,
16357
+ allKeys,
16358
+ processedData,
16359
+ finalColors,
16360
+ mapperConfig,
16361
+ finalValueFormatter,
16362
+ formatBR
16363
+ }) {
16364
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16365
+ title && /* @__PURE__ */ jsxRuntime.jsx(
16366
+ "div",
16367
+ {
16368
+ className: cn(
16369
+ "w-full flex items-center mt-3 mb-2",
16370
+ HORIZONTAL_PADDING_CLASS,
16371
+ titlePosition === "center" && "justify-center",
16372
+ titlePosition === "right" && "justify-end",
16373
+ titlePosition === "left" && "justify-start"
16374
+ ),
16375
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[1.4rem] font-semibold text-foreground", children: title })
16376
+ }
16377
+ ),
16378
+ customLegend && !!data.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-6 mb-2", HORIZONTAL_PADDING_CLASS), children: /* @__PURE__ */ jsxRuntime.jsx(
16379
+ ChartTotalLegend_default,
16380
+ {
16381
+ items: allKeys.map((key) => {
16382
+ const values = processedData.map(
16383
+ (d) => Number(d[key] || 0)
16384
+ );
16385
+ const total = values.reduce((a, b) => a + b, 0);
16386
+ const first = values[0] || 0;
16387
+ const last = values[values.length - 1] || 0;
16388
+ const trendValue = first !== 0 ? Math.round((last - first) / first * 100) : 0;
16389
+ const formattedTotal = finalValueFormatter ? finalValueFormatter({
16390
+ value: total,
16391
+ formattedValue: String(total)
16392
+ }) : new Intl.NumberFormat(formatBR ? "pt-BR" : "en-US").format(
16393
+ total
16394
+ );
16395
+ return {
16396
+ label: mapperConfig[key]?.label || key,
16397
+ value: formattedTotal,
16398
+ color: finalColors[key],
16399
+ trend: {
16400
+ value: Math.abs(trendValue),
16401
+ positive: trendValue >= 0,
16402
+ neutral: trendValue === 0
16403
+ }
16404
+ };
16405
+ })
16406
+ }
16407
+ ) })
16408
+ ] });
16409
+ }
16212
16410
  var formatCompactNumber = (value) => {
16213
16411
  const isNegative = value < 0;
16214
16412
  const absValue = Math.abs(value);
@@ -16403,6 +16601,19 @@ var renderInsideBarLabel = (color, valueFormatter) => {
16403
16601
  );
16404
16602
  };
16405
16603
  };
16604
+
16605
+ // src/utils/calcDivision.ts
16606
+ var calcDivision = (dividend, divisor) => {
16607
+ return dividend / divisor;
16608
+ };
16609
+
16610
+ // src/components/ui/charts/utils/formatters.ts
16611
+ function formatLinePercentage(value) {
16612
+ const numValue = typeof value === "number" ? value : typeof value === "string" ? parseFloat(value) : 0;
16613
+ const percentage = calcDivision(numValue, 100);
16614
+ const formattedPercentage = typeof percentage === "number" ? percentage.toFixed(1).replace(".", ",") : String(percentage).replace(".", ",");
16615
+ return `${formattedPercentage}%`;
16616
+ }
16406
16617
  var ChartBar = ({ x, y, w, h, i, loading }) => {
16407
16618
  const baseY = y - h;
16408
16619
  const d = i * 0.08;
@@ -16496,7 +16707,7 @@ var NoData = ({
16496
16707
  /* @__PURE__ */ jsxRuntime.jsxs(
16497
16708
  "svg",
16498
16709
  {
16499
- className: "w-full h-[var(--svg-h)] opacity-40",
16710
+ className: "w-full h-full opacity-40",
16500
16711
  viewBox: `0 0 900 ${h}`,
16501
16712
  preserveAspectRatio: "none",
16502
16713
  children: [
@@ -16984,45 +17195,133 @@ var useChartMinMax = ({
16984
17195
  };
16985
17196
  }, [processedData, orderBy, xAxisDataKey, categoryFormatter]);
16986
17197
  };
16987
- var filtersOrder = (mapperConfig, series) => {
16988
- const seriesOrder = [];
16989
- if (series) {
16990
- if (series.bar)
16991
- series.bar.forEach((k) => seriesOrder.push({ type: "bar", key: k }));
16992
- if (series.line)
16993
- series.line.forEach((k) => seriesOrder.push({ type: "line", key: k }));
16994
- if (series.area)
16995
- series.area.forEach((k) => seriesOrder.push({ type: "area", key: k }));
16996
- } else {
16997
- Object.keys(mapperConfig).forEach(
16998
- (k) => seriesOrder.push({ type: "bar", key: k })
16999
- );
17000
- }
17001
- return seriesOrder;
17002
- };
17003
- var fnOpenTooltipForPeriod = (enableDraggableTooltips, processedData, periodName, activeTooltips, setActiveTooltips, maxTooltips, effectiveChartWidth) => {
17004
- if (!enableDraggableTooltips) return;
17005
- const row = processedData.find((r) => String(r.name) === periodName);
17006
- if (!row) return;
17007
- const tooltipId = String(periodName);
17008
- const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
17009
- if (existingIndex !== -1) {
17010
- setActiveTooltips((prev) => prev.filter((t) => t.id !== tooltipId));
17011
- return;
17012
- }
17013
- if (activeTooltips.length >= maxTooltips) {
17014
- sonner.toast.warning(
17015
- `Limite de ${maxTooltips} janelas de informa\xE7\xE3o atingido. A mais antiga ser\xE1 substitu\xEDda.`
17016
- );
17017
- }
17018
- const offsetIndex = activeTooltips.length;
17019
- const availableWidth = effectiveChartWidth;
17020
- const gap = 28;
17021
- const leftGap = 28;
17022
- const newTooltip = {
17023
- id: tooltipId,
17024
- data: row,
17025
- position: {
17198
+ function useProcessedData({
17199
+ data,
17200
+ xAxisKey,
17201
+ timeSeriesConfig,
17202
+ startIndex,
17203
+ endIndex
17204
+ }) {
17205
+ return React33.useMemo(() => {
17206
+ const mapped = data.map((item) => ({
17207
+ ...item,
17208
+ name: String(item[xAxisKey] || "N/A")
17209
+ }));
17210
+ if (timeSeriesConfig) {
17211
+ return mapped.slice(startIndex, endIndex + 1);
17212
+ }
17213
+ return mapped;
17214
+ }, [data, xAxisKey, timeSeriesConfig, startIndex, endIndex]);
17215
+ }
17216
+ function useBiaxial(biaxial, yAxisLabel) {
17217
+ return React33.useMemo(() => {
17218
+ if (!biaxial) return null;
17219
+ if (typeof biaxial === "string") return { key: [biaxial] };
17220
+ if (Array.isArray(biaxial)) return { key: biaxial };
17221
+ const normalized = biaxial;
17222
+ const leftLabelMissing = !yAxisLabel || String(yAxisLabel).trim() === "";
17223
+ const rightLabelMissing = !normalized.label || String(normalized.label).trim() === "";
17224
+ if (leftLabelMissing || rightLabelMissing) {
17225
+ throw new Error(
17226
+ "When using `biaxial`, you must provide both `yAxisLabel` (left axis) and `biaxial.label` (right axis)."
17227
+ );
17228
+ }
17229
+ return normalized;
17230
+ }, [biaxial, yAxisLabel]);
17231
+ }
17232
+ function useChartLayout({
17233
+ chartMargin,
17234
+ yAxisLabel,
17235
+ AXIS_LABEL_MARGIN,
17236
+ yTickFormatter,
17237
+ minLeftDataValue,
17238
+ niceMaxLeft,
17239
+ rightKeysLength,
17240
+ measuredWidth,
17241
+ width,
17242
+ computedWidth
17243
+ }) {
17244
+ const finalChartRightMargin = chartMargin?.right ?? (rightKeysLength > 0 ? AXIS_LABEL_MARGIN : 30);
17245
+ const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
17246
+ const yAxisTickWidth = React33.useMemo(() => {
17247
+ const yAxisLabelStr = yAxisLabel === null || yAxisLabel === void 0 ? void 0 : String(yAxisLabel);
17248
+ return computeYAxisTickWidth(
17249
+ chartMargin?.left,
17250
+ yAxisLabelStr,
17251
+ AXIS_LABEL_MARGIN,
17252
+ yTickFormatter,
17253
+ minLeftDataValue,
17254
+ niceMaxLeft
17255
+ );
17256
+ }, [
17257
+ chartMargin?.left,
17258
+ yAxisLabel,
17259
+ AXIS_LABEL_MARGIN,
17260
+ yTickFormatter,
17261
+ minLeftDataValue,
17262
+ niceMaxLeft
17263
+ ]);
17264
+ const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
17265
+ const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
17266
+ const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
17267
+ const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
17268
+ return {
17269
+ finalChartRightMargin,
17270
+ finalChartLeftMargin,
17271
+ yAxisTickWidth,
17272
+ effectiveChartWidth,
17273
+ chartInnerWidth,
17274
+ leftYAxisLabelDx,
17275
+ rightYAxisLabelDx
17276
+ };
17277
+ }
17278
+ function useSeriesOpacity(highlightedSeries) {
17279
+ return React33.useCallback(
17280
+ (key) => {
17281
+ return highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1;
17282
+ },
17283
+ [highlightedSeries]
17284
+ );
17285
+ }
17286
+ var filtersOrder = (mapperConfig, series) => {
17287
+ const seriesOrder = [];
17288
+ if (series) {
17289
+ if (series.bar)
17290
+ series.bar.forEach((k) => seriesOrder.push({ type: "bar", key: k }));
17291
+ if (series.line)
17292
+ series.line.forEach((k) => seriesOrder.push({ type: "line", key: k }));
17293
+ if (series.area)
17294
+ series.area.forEach((k) => seriesOrder.push({ type: "area", key: k }));
17295
+ } else {
17296
+ Object.keys(mapperConfig).forEach(
17297
+ (k) => seriesOrder.push({ type: "bar", key: k })
17298
+ );
17299
+ }
17300
+ return seriesOrder;
17301
+ };
17302
+ var fnOpenTooltipForPeriod = (enableDraggableTooltips, processedData, periodName, activeTooltips, setActiveTooltips, maxTooltips, effectiveChartWidth) => {
17303
+ if (!enableDraggableTooltips) return;
17304
+ const row = processedData.find((r) => String(r.name) === periodName);
17305
+ if (!row) return;
17306
+ const tooltipId = String(periodName);
17307
+ const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
17308
+ if (existingIndex !== -1) {
17309
+ setActiveTooltips((prev) => prev.filter((t) => t.id !== tooltipId));
17310
+ return;
17311
+ }
17312
+ if (activeTooltips.length >= maxTooltips) {
17313
+ sonner.toast.warning(
17314
+ `Limite de ${maxTooltips} janelas de informa\xE7\xE3o atingido. A mais antiga ser\xE1 substitu\xEDda.`
17315
+ );
17316
+ }
17317
+ const offsetIndex = activeTooltips.length;
17318
+ const availableWidth = effectiveChartWidth;
17319
+ const gap = 28;
17320
+ const leftGap = 28;
17321
+ const newTooltip = {
17322
+ id: tooltipId,
17323
+ data: row,
17324
+ position: {
17026
17325
  top: 48 + offsetIndex * gap,
17027
17326
  left: Math.max(120, availableWidth - 280 - offsetIndex * leftGap)
17028
17327
  }
@@ -17107,10 +17406,37 @@ var fnContentLabelList = (p) => {
17107
17406
  return needsOutside ? null : true;
17108
17407
  };
17109
17408
 
17110
- // src/utils/calcDivision.ts
17111
- var calcDivision = (dividend, divisor) => {
17112
- return dividend / divisor;
17113
- };
17409
+ // src/components/ui/charts/hooks/useOpenTooltipForPeriod.ts
17410
+ function useOpenTooltipForPeriod({
17411
+ enableDraggableTooltips,
17412
+ processedData,
17413
+ activeTooltips,
17414
+ setActiveTooltips,
17415
+ maxTooltips,
17416
+ effectiveChartWidth
17417
+ }) {
17418
+ return React33.useCallback(
17419
+ (periodName) => {
17420
+ fnOpenTooltipForPeriod(
17421
+ enableDraggableTooltips,
17422
+ processedData,
17423
+ periodName,
17424
+ activeTooltips,
17425
+ setActiveTooltips,
17426
+ maxTooltips,
17427
+ effectiveChartWidth
17428
+ );
17429
+ },
17430
+ [
17431
+ enableDraggableTooltips,
17432
+ processedData,
17433
+ activeTooltips,
17434
+ effectiveChartWidth,
17435
+ maxTooltips,
17436
+ setActiveTooltips
17437
+ ]
17438
+ );
17439
+ }
17114
17440
  var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
17115
17441
  var Chart = ({
17116
17442
  data,
@@ -17151,6 +17477,16 @@ var Chart = ({
17151
17477
  // horizontal removido
17152
17478
  // orderBy removido
17153
17479
  }) => {
17480
+ const usesFullHeight = typeof height === "string" && (height === "100%" || height === "100vh") || typeof className === "string" && /\bh-full\b/.test(className || "");
17481
+ const responsiveHeight = usesFullHeight ? "100%" : height;
17482
+ const wrapperClass = cn(
17483
+ "w-full min-w-0 rounded-lg border-border",
17484
+ className,
17485
+ "overflow-hidden"
17486
+ );
17487
+ const wrapperStyle = usesFullHeight ? void 0 : {
17488
+ height: typeof responsiveHeight === "number" ? `${responsiveHeight}px` : responsiveHeight
17489
+ };
17154
17490
  const { xAxisConfig, mapperConfig } = React33.useMemo(() => {
17155
17491
  return fnSmartConfig({ xAxis, data, labelMap });
17156
17492
  }, [data, xAxis, labelMap]);
@@ -17185,39 +17521,20 @@ var Chart = ({
17185
17521
  defaultEndIndex: timeSeriesConfig?.end,
17186
17522
  onRangeChange: timeSeriesConfig?.onRangeChange
17187
17523
  });
17188
- const processedData = React33.useMemo(() => {
17189
- const mapped = data.map((item) => ({
17190
- ...item,
17191
- name: String(item[xAxisConfig.dataKey] || "N/A")
17192
- }));
17193
- let result = mapped;
17194
- if (timeSeriesConfig) {
17195
- result = mapped.slice(startIndex, endIndex + 1);
17196
- }
17197
- return result;
17198
- }, [data, xAxisConfig.dataKey, timeSeriesConfig, startIndex, endIndex]);
17524
+ const processedData = useProcessedData({
17525
+ data,
17526
+ xAxisKey: xAxisConfig.dataKey,
17527
+ timeSeriesConfig,
17528
+ startIndex,
17529
+ endIndex
17530
+ });
17199
17531
  const seriesOrder = filtersOrder(mapperConfig, series);
17200
17532
  const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
17201
17533
  const finalColors = React33.useMemo(
17202
17534
  () => generateColorMap(allKeys, colors2, mapperConfig),
17203
17535
  [allKeys, colors2, mapperConfig]
17204
17536
  );
17205
- const biaxialConfigNormalized = React33.useMemo(() => {
17206
- if (!biaxial) return null;
17207
- if (typeof biaxial === "string") return { key: [biaxial] };
17208
- if (Array.isArray(biaxial)) return { key: biaxial };
17209
- return biaxial;
17210
- }, [biaxial]);
17211
- React33.useMemo(() => {
17212
- if (!biaxialConfigNormalized) return;
17213
- const leftLabelMissing = !yAxisLabel || String(yAxisLabel).trim() === "";
17214
- const rightLabelMissing = !biaxialConfigNormalized.label || String(biaxialConfigNormalized.label).trim() === "";
17215
- if (leftLabelMissing || rightLabelMissing) {
17216
- throw new Error(
17217
- "When using `biaxial`, you must provide both `yAxisLabel` (left axis) and `biaxial.label` (right axis)."
17218
- );
17219
- }
17220
- }, [biaxialConfigNormalized, yAxisLabel]);
17537
+ const biaxialConfigNormalized = useBiaxial(biaxial, yAxisLabel);
17221
17538
  const rightKeys = React33.useMemo(
17222
17539
  () => biaxialConfigNormalized?.key ?? [],
17223
17540
  [biaxialConfigNormalized]
@@ -17272,12 +17589,7 @@ var Chart = ({
17272
17589
  setActiveTooltips
17273
17590
  }
17274
17591
  );
17275
- const getSeriesOpacity = React33.useCallback(
17276
- (key) => {
17277
- return highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1;
17278
- },
17279
- [highlightedSeries]
17280
- );
17592
+ const getSeriesOpacity = useSeriesOpacity(highlightedSeries);
17281
17593
  const finalValueFormatter = React33.useMemo(
17282
17594
  () => createValueFormatter(valueFormatter, formatBR),
17283
17595
  [valueFormatter, formatBR]
@@ -17288,51 +17600,40 @@ var Chart = ({
17288
17600
  );
17289
17601
  const AXIS_LABEL_MARGIN = 56;
17290
17602
  const CONTAINER_PADDING_LEFT = -6;
17291
- const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
17292
- const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
17293
- const yAxisTickWidth = React33.useMemo(() => {
17294
- return computeYAxisTickWidth(
17295
- chartMargin?.left,
17296
- yAxisLabel,
17297
- AXIS_LABEL_MARGIN,
17298
- yTickFormatter,
17299
- minLeftDataValue,
17300
- niceMaxLeft
17301
- );
17302
- }, [
17303
- chartMargin?.left,
17603
+ const HORIZONTAL_PADDING_CLASS = "px-24";
17604
+ const teste = "pl-24 pr-4";
17605
+ const {
17606
+ finalChartRightMargin,
17607
+ finalChartLeftMargin,
17608
+ yAxisTickWidth,
17609
+ effectiveChartWidth,
17610
+ chartInnerWidth,
17611
+ leftYAxisLabelDx,
17612
+ rightYAxisLabelDx
17613
+ } = useChartLayout({
17614
+ chartMargin,
17304
17615
  yAxisLabel,
17616
+ AXIS_LABEL_MARGIN,
17305
17617
  yTickFormatter,
17306
17618
  minLeftDataValue,
17307
- niceMaxLeft
17308
- ]);
17309
- const HORIZONTAL_PADDING_CLASS = "px-24";
17310
- const teste = "pl-24 pr-4";
17311
- const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
17312
- const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
17313
- const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
17314
- const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
17315
- const openTooltipForPeriod = React33.useCallback(
17316
- (periodName) => {
17317
- fnOpenTooltipForPeriod(
17318
- enableDraggableTooltips,
17319
- processedData,
17320
- periodName,
17321
- activeTooltips,
17322
- setActiveTooltips,
17323
- maxTooltips,
17324
- effectiveChartWidth
17325
- );
17326
- },
17327
- [
17328
- enableDraggableTooltips,
17329
- processedData,
17330
- activeTooltips,
17331
- effectiveChartWidth,
17332
- maxTooltips,
17333
- setActiveTooltips
17334
- ]
17335
- );
17619
+ niceMaxLeft,
17620
+ rightKeysLength: rightKeys.length,
17621
+ measuredWidth,
17622
+ width,
17623
+ computedWidth
17624
+ });
17625
+ const openTooltipForPeriod = useOpenTooltipForPeriod({
17626
+ enableDraggableTooltips,
17627
+ processedData,
17628
+ activeTooltips,
17629
+ setActiveTooltips,
17630
+ maxTooltips,
17631
+ effectiveChartWidth
17632
+ });
17633
+ const legendSpace = showLegend ? 44 : 0;
17634
+ const xAxisLabelSpace = xAxisLabel ? 18 : 0;
17635
+ const brushSpace = timeSeriesConfig?.height ? 200 : 0;
17636
+ const bottomMargin = 10 + legendSpace + xAxisLabelSpace + brushSpace;
17336
17637
  if (!data && !isLoading) return null;
17337
17638
  if (isLoading) {
17338
17639
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -17347,128 +17648,62 @@ var Chart = ({
17347
17648
  );
17348
17649
  }
17349
17650
  if (Array.isArray(data) && data.length === 0) {
17350
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
17351
- /* @__PURE__ */ jsxRuntime.jsx(
17352
- NoData_default,
17353
- {
17354
- title,
17355
- paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17356
- height
17357
- }
17358
- ),
17359
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: 0 }, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: effectiveChartWidth, height, children: [
17360
- xAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
17361
- "text",
17362
- {
17363
- x: effectiveChartWidth - 40,
17364
- y: height - 10,
17365
- fontSize: 12,
17366
- fill: "hsl(var(--muted-foreground))",
17367
- fontWeight: 500,
17368
- textAnchor: "end",
17369
- children: xAxisLabel
17370
- }
17371
- ),
17372
- yAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
17373
- "text",
17374
- {
17375
- x: 20,
17376
- y: 40,
17377
- fontSize: 12,
17378
- fill: "hsl(var(--muted-foreground))",
17379
- fontWeight: 500,
17380
- textAnchor: "start",
17381
- transform: `rotate(-90 20 40)`,
17382
- children: yAxisLabel
17383
- }
17384
- )
17385
- ] }) })
17386
- ] });
17651
+ return /* @__PURE__ */ jsxRuntime.jsx(
17652
+ NoData_default,
17653
+ {
17654
+ title,
17655
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17656
+ height
17657
+ }
17658
+ );
17387
17659
  }
17388
- return /* @__PURE__ */ jsxRuntime.jsxs(
17389
- "div",
17390
- {
17391
- ref: wrapperRef,
17392
- className: cn(
17393
- "w-full overflow-hidden min-w-0 rounded-lg border-border",
17394
- className
17395
- ),
17396
- children: [
17397
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-card relative w-full max-w-full min-w-0 py-1", children: [
17398
- title && /* @__PURE__ */ jsxRuntime.jsx(
17399
- "div",
17660
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: wrapperRef, className: wrapperClass, style: wrapperStyle, children: [
17661
+ /* @__PURE__ */ jsxRuntime.jsxs(
17662
+ "div",
17663
+ {
17664
+ className: "rounded-lg bg-card relative w-full max-w-full min-w-0 py-1",
17665
+ style: usesFullHeight ? { height: "100%" } : void 0,
17666
+ children: [
17667
+ /* @__PURE__ */ jsxRuntime.jsx(
17668
+ ChartHeader,
17400
17669
  {
17401
- className: cn(
17402
- "w-full flex items-center mt-3 mb-2",
17403
- HORIZONTAL_PADDING_CLASS,
17404
- titlePosition === "center" && "justify-center",
17405
- titlePosition === "right" && "justify-end",
17406
- titlePosition === "left" && "justify-start"
17407
- ),
17408
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[1.4rem] font-semibold text-foreground", children: title })
17670
+ title,
17671
+ titlePosition,
17672
+ HORIZONTAL_PADDING_CLASS,
17673
+ customLegend,
17674
+ data,
17675
+ allKeys,
17676
+ processedData,
17677
+ finalColors,
17678
+ mapperConfig,
17679
+ finalValueFormatter,
17680
+ formatBR
17409
17681
  }
17410
17682
  ),
17411
- customLegend && !!data.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-6 mb-2", HORIZONTAL_PADDING_CLASS), children: /* @__PURE__ */ jsxRuntime.jsx(
17412
- ChartTotalLegend_default,
17683
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxRuntime.jsx(
17684
+ ChartControls,
17413
17685
  {
17414
- items: allKeys.map((key) => {
17415
- const values = processedData.map(
17416
- (d) => Number(d[key] || 0)
17417
- );
17418
- const total = values.reduce((a, b) => a + b, 0);
17419
- const first = values[0] || 0;
17420
- const last = values[values.length - 1] || 0;
17421
- const trendValue = first !== 0 ? Math.round((last - first) / first * 100) : 0;
17422
- const formattedTotal = finalValueFormatter ? finalValueFormatter({
17423
- value: total,
17424
- formattedValue: String(total)
17425
- }) : new Intl.NumberFormat(formatBR ? "pt-BR" : "en-US").format(
17426
- total
17427
- );
17428
- return {
17429
- label: mapperConfig[key]?.label || key,
17430
- value: formattedTotal,
17431
- color: finalColors[key],
17432
- trend: {
17433
- value: Math.abs(trendValue),
17434
- positive: trendValue >= 0,
17435
- neutral: trendValue === 0
17436
- }
17437
- };
17438
- })
17686
+ allKeys,
17687
+ mapperConfig,
17688
+ finalColors,
17689
+ highlightedSeries,
17690
+ toggleHighlight,
17691
+ showOnlyHighlighted,
17692
+ setShowOnlyHighlighted,
17693
+ highlightedSeriesSize: highlightedSeries.size,
17694
+ clearHighlights,
17695
+ enableHighlights,
17696
+ enableShowOnly,
17697
+ enablePeriodsDropdown,
17698
+ enableDraggableTooltips,
17699
+ processedData,
17700
+ onOpenPeriod: openTooltipForPeriod,
17701
+ rightOffset: finalChartRightMargin,
17702
+ activePeriods,
17703
+ containerClass: cn("flex items-center gap-2", teste),
17704
+ containerWidth: chartInnerWidth
17439
17705
  }
17440
- ) }),
17441
- allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2", teste), children: [
17442
- enableHighlights && /* @__PURE__ */ jsxRuntime.jsx(
17443
- Highlights_default,
17444
- {
17445
- allKeys,
17446
- mapperConfig,
17447
- finalColors,
17448
- highlightedSeries,
17449
- toggleHighlight,
17450
- containerWidth: chartInnerWidth
17451
- }
17452
- ),
17453
- enableShowOnly && /* @__PURE__ */ jsxRuntime.jsx(
17454
- ShowOnly_default,
17455
- {
17456
- showOnlyHighlighted,
17457
- setShowOnlyHighlighted,
17458
- highlightedSeriesSize: highlightedSeries.size,
17459
- clearHighlights
17460
- }
17461
- ),
17462
- enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
17463
- PeriodsDropdown_default,
17464
- {
17465
- processedData,
17466
- onOpenPeriod: openTooltipForPeriod,
17467
- rightOffset: finalChartRightMargin,
17468
- activePeriods
17469
- }
17470
- ) })
17471
- ] }),
17706
+ ),
17472
17707
  !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx(
17473
17708
  "div",
17474
17709
  {
@@ -17490,16 +17725,15 @@ var Chart = ({
17490
17725
  )
17491
17726
  }
17492
17727
  ),
17493
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(
17728
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: responsiveHeight, children: /* @__PURE__ */ jsxRuntime.jsxs(
17494
17729
  recharts.ComposedChart,
17495
17730
  {
17496
17731
  data: processedData,
17497
- height,
17498
17732
  margin: {
17499
17733
  top: 10,
17500
17734
  right: finalChartRightMargin,
17501
17735
  left: finalChartLeftMargin,
17502
- bottom: 10
17736
+ bottom: bottomMargin
17503
17737
  },
17504
17738
  onClick: handleChartClick,
17505
17739
  children: [
@@ -17707,12 +17941,6 @@ var Chart = ({
17707
17941
  );
17708
17942
  }
17709
17943
  if (s.type === "line") {
17710
- const lineFormatter = (props) => {
17711
- const numValue = typeof props.value === "number" ? props.value : typeof props.value === "string" ? parseFloat(props.value) : 0;
17712
- const percentage = calcDivision(numValue, 100);
17713
- const formattedPercentage = typeof percentage === "number" ? percentage.toFixed(1).replace(".", ",") : String(percentage).replace(".", ",");
17714
- return `${formattedPercentage}%`;
17715
- };
17716
17944
  return /* @__PURE__ */ jsxRuntime.jsx(
17717
17945
  recharts.Line,
17718
17946
  {
@@ -17734,7 +17962,7 @@ var Chart = ({
17734
17962
  content: pillLabelRenderer_default(
17735
17963
  color,
17736
17964
  "filled",
17737
- lineFormatter
17965
+ (props) => formatLinePercentage(props.value)
17738
17966
  ),
17739
17967
  offset: 14
17740
17968
  }
@@ -17786,67 +18014,67 @@ var Chart = ({
17786
18014
  ]
17787
18015
  }
17788
18016
  ) })
17789
- ] }),
17790
- enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsxRuntime.jsx(
17791
- DraggableTooltip_default,
17792
- {
17793
- id: tooltip.id,
17794
- data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17795
- position: tooltip.position,
17796
- title,
17797
- dataKeys: allKeys,
17798
- finalColors,
17799
- highlightedSeries,
17800
- toggleHighlight,
17801
- showOnlyHighlighted,
17802
- onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17803
- onPositionChange: onTooltipPositionChange,
17804
- periodLabel,
17805
- dataLabel: "Dados do Per\xEDodo",
17806
- valueFormatter: finalValueFormatter,
17807
- categoryFormatter,
17808
- globalTooltipCount: activeTooltips.length,
17809
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17810
- closeAllButtonPosition: "top-center",
17811
- closeAllButtonVariant: "floating"
17812
- },
17813
- tooltip.id
17814
- )),
17815
- enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
17816
- CloseAllButton_default,
17817
- {
17818
- count: activeTooltips.length,
17819
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17820
- position: "top-center",
17821
- variant: "floating"
17822
- }
17823
- ),
17824
- timeSeriesConfig && /* @__PURE__ */ jsxRuntime.jsx(
17825
- Brush_default,
17826
- {
17827
- legend: timeSeriesLegend,
17828
- data,
17829
- startIndex,
17830
- endIndex,
17831
- onMouseDown: handleMouseDown,
17832
- brushRef,
17833
- xAxisKey: xAxisConfig.dataKey,
17834
- seriesOrder,
17835
- finalColors,
17836
- brushHeight: timeSeriesConfig.height,
17837
- brushColor: timeSeriesConfig.brushColor,
17838
- miniChartOpacity: timeSeriesConfig.miniChartOpacity,
17839
- showGrid,
17840
- gridColor,
17841
- margin: {
17842
- left: finalChartLeftMargin,
17843
- right: finalChartRightMargin
17844
- }
17845
- }
17846
- )
17847
- ]
17848
- }
17849
- );
18017
+ ]
18018
+ }
18019
+ ),
18020
+ enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsxRuntime.jsx(
18021
+ DraggableTooltip_default,
18022
+ {
18023
+ id: tooltip.id,
18024
+ data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
18025
+ position: tooltip.position,
18026
+ title,
18027
+ dataKeys: allKeys,
18028
+ finalColors,
18029
+ highlightedSeries,
18030
+ toggleHighlight,
18031
+ showOnlyHighlighted,
18032
+ onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
18033
+ onPositionChange: onTooltipPositionChange,
18034
+ periodLabel,
18035
+ dataLabel: "Dados do Per\xEDodo",
18036
+ valueFormatter: finalValueFormatter,
18037
+ categoryFormatter,
18038
+ globalTooltipCount: activeTooltips.length,
18039
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
18040
+ closeAllButtonPosition: "top-center",
18041
+ closeAllButtonVariant: "floating"
18042
+ },
18043
+ tooltip.id
18044
+ )),
18045
+ enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
18046
+ CloseAllButton_default,
18047
+ {
18048
+ count: activeTooltips.length,
18049
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
18050
+ position: "top-center",
18051
+ variant: "floating"
18052
+ }
18053
+ ),
18054
+ timeSeriesConfig && /* @__PURE__ */ jsxRuntime.jsx(
18055
+ Brush_default,
18056
+ {
18057
+ legend: timeSeriesLegend,
18058
+ data,
18059
+ startIndex,
18060
+ endIndex,
18061
+ onMouseDown: handleMouseDown,
18062
+ brushRef,
18063
+ xAxisKey: xAxisConfig.dataKey,
18064
+ seriesOrder,
18065
+ finalColors,
18066
+ brushHeight: timeSeriesConfig.height,
18067
+ brushColor: timeSeriesConfig.brushColor,
18068
+ miniChartOpacity: timeSeriesConfig.miniChartOpacity,
18069
+ showGrid,
18070
+ gridColor,
18071
+ margin: {
18072
+ left: finalChartLeftMargin,
18073
+ right: finalChartRightMargin
18074
+ }
18075
+ }
18076
+ )
18077
+ ] });
17850
18078
  };
17851
18079
  var Chart_default = Chart;
17852
18080
  var DEFAULT_COLORS3 = ["#0d1136", "#666655", "#1a1a1a"];
@@ -18149,7 +18377,7 @@ var HorizontalChart = ({
18149
18377
  margin: {
18150
18378
  top: 10,
18151
18379
  right: finalChartRightMargin,
18152
- left: finalChartLeftMargin,
18380
+ left: 55 + finalChartLeftMargin,
18153
18381
  bottom: 10
18154
18382
  },
18155
18383
  onClick: handleChartClick,
@@ -18192,9 +18420,9 @@ var HorizontalChart = ({
18192
18420
  dataKey: xAxisConfig.dataKey,
18193
18421
  stroke: "hsl(var(--muted-foreground))",
18194
18422
  fontSize: 12,
18195
- tickLine: false,
18196
- axisLine: false,
18197
- width: 125,
18423
+ tickLine: true,
18424
+ minTickGap: 24,
18425
+ axisLine: true,
18198
18426
  tickFormatter: (value) => {
18199
18427
  if (categoryFormatter)
18200
18428
  return categoryFormatter(value);
@@ -18336,109 +18564,6 @@ var HorizontalChart = ({
18336
18564
  );
18337
18565
  };
18338
18566
  var HorizontalChart_default = HorizontalChart;
18339
- var defaultData = [
18340
- { name: "Vendas", value: 4e3 },
18341
- { name: "Marketing", value: 3e3 },
18342
- { name: "Desenvolvimento", value: 2e3 },
18343
- { name: "Suporte", value: 1e3 },
18344
- { name: "Outros", value: 800 }
18345
- ];
18346
- var DEFAULT_COLORS4 = [
18347
- "#55af7d",
18348
- // verde do projeto
18349
- "#8e68ff",
18350
- // roxo do projeto
18351
- "#2273e1",
18352
- // azul do projeto
18353
- "#f59e0b",
18354
- // amarelo complementar
18355
- "#ef4444",
18356
- // vermelho complementar
18357
- "#8b5cf6",
18358
- // roxo claro
18359
- "#06b6d4",
18360
- // ciano
18361
- "#84cc16"
18362
- // verde lima
18363
- ];
18364
- var RADIAN = Math.PI / 180;
18365
- var renderCustomizedLabel = ({
18366
- cx = 0,
18367
- cy = 0,
18368
- midAngle = 0,
18369
- innerRadius = 0,
18370
- outerRadius = 0,
18371
- percent = 0
18372
- }) => {
18373
- const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
18374
- const x = cx + radius * Math.cos(-midAngle * RADIAN);
18375
- const y = cy + radius * Math.sin(-midAngle * RADIAN);
18376
- return /* @__PURE__ */ jsxRuntime.jsx(
18377
- "text",
18378
- {
18379
- x,
18380
- y,
18381
- fill: "white",
18382
- textAnchor: x > cx ? "start" : "end",
18383
- dominantBaseline: "central",
18384
- fontSize: 12,
18385
- fontWeight: "600",
18386
- children: `${(percent * 100).toFixed(0)}%`
18387
- }
18388
- );
18389
- };
18390
- var CustomPieChart = ({
18391
- data = defaultData,
18392
- className,
18393
- height = 400,
18394
- width = "100%",
18395
- colors: colors2,
18396
- showTooltip = true,
18397
- showLegend = true,
18398
- showLabels = true,
18399
- innerRadius = 0,
18400
- outerRadius = 120,
18401
- centerX = "50%",
18402
- centerY = "50%"
18403
- }) => {
18404
- const finalColors = colors2 || DEFAULT_COLORS4;
18405
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width, height, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.PieChart, { children: [
18406
- /* @__PURE__ */ jsxRuntime.jsx(
18407
- recharts.Pie,
18408
- {
18409
- data,
18410
- cx: centerX,
18411
- cy: centerY,
18412
- labelLine: false,
18413
- label: showLabels ? renderCustomizedLabel : false,
18414
- outerRadius,
18415
- innerRadius,
18416
- fill: "#8884d8",
18417
- dataKey: "value",
18418
- children: data.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx(
18419
- recharts.Cell,
18420
- {
18421
- fill: finalColors[index % finalColors.length]
18422
- },
18423
- `cell-${entry.name}-${index}`
18424
- ))
18425
- }
18426
- ),
18427
- showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
18428
- recharts.Tooltip,
18429
- {
18430
- contentStyle: {
18431
- backgroundColor: "hsl(var(--popover))",
18432
- border: "1px solid hsl(var(--border))",
18433
- borderRadius: "6px",
18434
- color: "hsl(var(--popover-foreground))"
18435
- }
18436
- }
18437
- ),
18438
- showLegend && /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {})
18439
- ] }) }) });
18440
- };
18441
- var PieChart_default = CustomPieChart;
18442
18567
  var TimeSeries = ({
18443
18568
  data,
18444
18569
  xAxis,
@@ -18747,6 +18872,8 @@ exports.CarouselNextBase = CarouselNextBase;
18747
18872
  exports.CarouselPreviousBase = CarouselPreviousBase;
18748
18873
  exports.ChangeButton = ChangeButton;
18749
18874
  exports.Chart = Chart_default;
18875
+ exports.ChartControls = ChartControls;
18876
+ exports.ChartHeader = ChartHeader;
18750
18877
  exports.ChartTotalLegend = ChartTotalLegend_default;
18751
18878
  exports.CheckButton = CheckButton;
18752
18879
  exports.CheckboxBase = CheckboxBase;
@@ -18902,7 +19029,6 @@ exports.NoData = NoData_default;
18902
19029
  exports.NotificationButton = NotificationButton;
18903
19030
  exports.NumericInput = NumericInput;
18904
19031
  exports.PeriodsDropdown = PeriodsDropdown_default;
18905
- exports.PieChart = PieChart_default;
18906
19032
  exports.PopoverAnchorBase = PopoverAnchorBase;
18907
19033
  exports.PopoverBase = PopoverBase;
18908
19034
  exports.PopoverContentBase = PopoverContentBase;
@@ -19025,6 +19151,7 @@ exports.detectDataFields = detectDataFields;
19025
19151
  exports.detectXAxis = detectXAxis;
19026
19152
  exports.display12HourValue = display12HourValue;
19027
19153
  exports.formatFieldName = formatFieldName;
19154
+ exports.formatLinePercentage = formatLinePercentage;
19028
19155
  exports.generateAdditionalColors = generateAdditionalColors;
19029
19156
  exports.generateColorMap = generateColorMap;
19030
19157
  exports.getAgendaEventsForDay = getAgendaEventsForDay;
@@ -19061,6 +19188,7 @@ exports.isValidHour = isValidHour;
19061
19188
  exports.isValidMinuteOrSecond = isValidMinuteOrSecond;
19062
19189
  exports.niceCeil = niceCeil;
19063
19190
  exports.normalizeAttendDate = normalizeAttendDate;
19191
+ exports.processNeo4jData = processNeo4jData;
19064
19192
  exports.renderInsideBarLabel = renderInsideBarLabel;
19065
19193
  exports.renderPillLabel = pillLabelRenderer_default;
19066
19194
  exports.resolveChartMargins = resolveChartMargins;
@@ -19073,11 +19201,13 @@ exports.setSeconds = setSeconds;
19073
19201
  exports.sortEvents = sortEvents;
19074
19202
  exports.sortEventsAgenda = sortEventsAgenda;
19075
19203
  exports.toast = toast;
19204
+ exports.useBiaxial = useBiaxial;
19076
19205
  exports.useCalendarDnd = useCalendarDnd;
19077
19206
  exports.useCalendarDndAgenda = useCalendarDndAgenda;
19078
19207
  exports.useChartClick = useChartClick;
19079
19208
  exports.useChartDimensions = useChartDimensions;
19080
19209
  exports.useChartHighlights = useChartHighlights;
19210
+ exports.useChartLayout = useChartLayout;
19081
19211
  exports.useChartMinMax = useChartMinMax;
19082
19212
  exports.useChartTooltips = useChartTooltips;
19083
19213
  exports.useCurrentTimeIndicator = useCurrentTimeIndicator;
@@ -19086,6 +19216,9 @@ exports.useDrag = useDrag;
19086
19216
  exports.useEventVisibility = useEventVisibility;
19087
19217
  exports.useEventVisibilityAgenda = useEventVisibilityAgenda;
19088
19218
  exports.useIsMobile = useIsMobile;
19219
+ exports.useOpenTooltipForPeriod = useOpenTooltipForPeriod;
19220
+ exports.useProcessedData = useProcessedData;
19221
+ exports.useSeriesOpacity = useSeriesOpacity;
19089
19222
  exports.useTheme = useTheme;
19090
19223
  exports.useTimeSeriesRange = useTimeSeriesRange;
19091
19224
  exports.visualForItem = visualForItem;