@mlw-packages/react-components 1.8.3 → 1.8.5

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
@@ -480,7 +480,6 @@ var require_colors2 = __commonJS({
480
480
  import { useState as useState6, useCallback as useCallback6, useMemo as useMemo3, useEffect as useEffect7 } from "react";
481
481
 
482
482
  // src/components/ui/form/ButtonBase.tsx
483
- import * as React10 from "react";
484
483
  import { Slot as Slot2 } from "@radix-ui/react-slot";
485
484
  import { cva as cva2 } from "class-variance-authority";
486
485
 
@@ -631,18 +630,12 @@ var DialogContentBase = React2.forwardRef(
631
630
  {
632
631
  ref,
633
632
  className: cn(
634
- "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",
633
+ "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-auto rounded-md border-border",
635
634
  className
636
635
  ),
637
636
  "data-testid": dataTestId,
638
637
  ...props,
639
- onWheel: (e) => {
640
- try {
641
- userOnWheel?.(e);
642
- } finally {
643
- e.stopPropagation();
644
- }
645
- },
638
+ onWheel: userOnWheel,
646
639
  children: [
647
640
  children,
648
641
  /* @__PURE__ */ jsxs2(DialogPrimitive.Close, { className: "absolute right-3 top-3 sm:right-4 sm:top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10 touch-manipulation", children: [
@@ -959,7 +952,7 @@ var ProgressBase = React5.forwardRef(
959
952
  default:
960
953
  return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1 w-full min-w-[150px]", children: [
961
954
  label && /* @__PURE__ */ jsx5(LabelBase_default, { className: "py-2", children: label }),
962
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
955
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
963
956
  showValue && valuePosition === "left" && /* @__PURE__ */ jsxs4("div", { className: "w-12 text-sm text-right font-extrabold", children: [
964
957
  Math.round(value || 0),
965
958
  "%"
@@ -1560,7 +1553,7 @@ var ModalContentBase = React9.forwardRef(
1560
1553
  ref,
1561
1554
  className: cn(
1562
1555
  "fixed z-50 grid w-full gap-4 border bg-background p-6 shadow-lg sm:rounded-lg max-h-[90dvh] overflow-auto",
1563
- "data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out",
1556
+ "data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out border-border",
1564
1557
  positionClass,
1565
1558
  sizeClass,
1566
1559
  className
@@ -1631,6 +1624,7 @@ var ModalDescriptionBase = React9.forwardRef(({ className, testid: dataTestId =
1631
1624
  ModalDescriptionBase.displayName = DialogPrimitive2.Description.displayName;
1632
1625
 
1633
1626
  // src/components/ui/form/ButtonBase.tsx
1627
+ import React10 from "react";
1634
1628
  import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1635
1629
  var buttonVariantsBase = cva2(
1636
1630
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive [&:not(.no-active-animation)]:active:scale-95",
@@ -1639,7 +1633,7 @@ var buttonVariantsBase = cva2(
1639
1633
  variant: {
1640
1634
  default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
1641
1635
  destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
1642
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:border-input dark:hover:bg-background/95",
1636
+ outline: "border border-border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:border-input dark:hover:bg-background/95",
1643
1637
  select: "box-border border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:hover:bg-background/95",
1644
1638
  secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
1645
1639
  ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
@@ -1995,6 +1989,11 @@ var PopoverContentBase = React13.forwardRef(
1995
1989
  className
1996
1990
  ),
1997
1991
  "data-testid": dataTestId,
1992
+ onInteractOutside: (event) => {
1993
+ props.onInteractOutside?.(event);
1994
+ if (event.defaultPrevented) return;
1995
+ event.stopPropagation();
1996
+ },
1998
1997
  ...props
1999
1998
  }
2000
1999
  ) })
@@ -2056,7 +2055,7 @@ function ComboboxBase({
2056
2055
  testIds = {},
2057
2056
  onClear,
2058
2057
  hasSelected = false,
2059
- hiddenClean = (node) => node
2058
+ hideClear = false
2060
2059
  }) {
2061
2060
  const [open, setOpen] = useState4(false);
2062
2061
  return /* @__PURE__ */ jsxs11(
@@ -2070,13 +2069,13 @@ function ComboboxBase({
2070
2069
  {
2071
2070
  open,
2072
2071
  onOpenChange: (v) => !disabled && setOpen(v),
2073
- modal: true,
2072
+ modal: false,
2074
2073
  children: [
2075
2074
  /* @__PURE__ */ jsx17(
2076
2075
  PopoverTriggerBase,
2077
2076
  {
2078
2077
  asChild: true,
2079
- className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)]",
2078
+ className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)] p-3",
2080
2079
  children: /* @__PURE__ */ jsxs11(
2081
2080
  ButtonBase,
2082
2081
  {
@@ -2094,19 +2093,17 @@ function ComboboxBase({
2094
2093
  children: [
2095
2094
  renderSelected,
2096
2095
  /* @__PURE__ */ jsx17(motion2.span, { className: "flex items-center", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-row gap-0 items-center ", children: [
2097
- hasSelected && onClear && !disabled && hiddenClean(
2098
- /* @__PURE__ */ jsx17(
2099
- ClearButton,
2100
- {
2101
- onClick: (e) => {
2102
- if (e) e.stopPropagation();
2103
- if (onClear && !disabled) {
2104
- onClear();
2105
- if (!keepOpen) setOpen(false);
2106
- }
2096
+ hasSelected && onClear && !disabled && !hideClear && /* @__PURE__ */ jsx17(
2097
+ ClearButton,
2098
+ {
2099
+ onClick: (e) => {
2100
+ if (e) e.stopPropagation();
2101
+ if (onClear && !disabled) {
2102
+ onClear();
2103
+ if (!keepOpen) setOpen(false);
2107
2104
  }
2108
2105
  }
2109
- )
2106
+ }
2110
2107
  ),
2111
2108
  /* @__PURE__ */ jsx17(
2112
2109
  motion2.div,
@@ -2222,7 +2219,8 @@ function Combobox({
2222
2219
  label,
2223
2220
  labelClassname,
2224
2221
  testIds,
2225
- error
2222
+ error,
2223
+ hideClear = false
2226
2224
  }) {
2227
2225
  const selectedItem = items.find((item) => item.value === selected);
2228
2226
  const renderSelected = useMemo2(() => {
@@ -2268,7 +2266,8 @@ function Combobox({
2268
2266
  testIds,
2269
2267
  onClear: handleClear,
2270
2268
  isMulti: false,
2271
- hasSelected: !!selectedItem
2269
+ hasSelected: !!selectedItem,
2270
+ hideClear
2272
2271
  }
2273
2272
  )
2274
2273
  ] });
@@ -2350,14 +2349,19 @@ function MultiSelectBase({
2350
2349
  onValuesChange,
2351
2350
  disabled,
2352
2351
  empty,
2353
- error
2352
+ error,
2353
+ initialItems
2354
2354
  }) {
2355
2355
  const [open, setOpen] = useState5(false);
2356
2356
  const [internalValues, setInternalValues] = useState5(
2357
2357
  new Set(values ?? defaultValues)
2358
2358
  );
2359
2359
  const selectedValues = values ? new Set(values) : internalValues;
2360
- const [items, setItems] = useState5(/* @__PURE__ */ new Map());
2360
+ const [items, setItems] = useState5(() => {
2361
+ if (!initialItems) return /* @__PURE__ */ new Map();
2362
+ if (initialItems instanceof Map) return new Map(initialItems);
2363
+ return new Map(initialItems.map((it) => [it.value, it.label]));
2364
+ });
2361
2365
  function toggleValue(value) {
2362
2366
  if (disabled) return;
2363
2367
  const getNewSet = (prev) => {
@@ -2573,41 +2577,48 @@ function MultiSelectContentBase({
2573
2577
  ...props
2574
2578
  }) {
2575
2579
  const canSearch = typeof search === "object" ? true : search;
2576
- const { emptyMessage, items } = useMultiSelectContext();
2577
- return /* @__PURE__ */ jsx20(Fragment2, { children: /* @__PURE__ */ jsx20(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__ */ jsx20(
2578
- motion3.div,
2580
+ const { emptyMessage, items, open } = useMultiSelectContext();
2581
+ return /* @__PURE__ */ jsx20(Fragment2, { children: /* @__PURE__ */ jsx20(
2582
+ PopoverContentBase,
2579
2583
  {
2580
- initial: { opacity: 0, scale: 0.95 },
2581
- animate: { opacity: 1, scale: 1 },
2582
- exit: { opacity: 0, scale: 0.95 },
2583
- transition: { duration: 0.2 },
2584
- children: /* @__PURE__ */ jsx20("div", { className: cn(" "), children: /* @__PURE__ */ jsxs13(
2585
- CommandBase,
2584
+ forceMount: true,
2585
+ 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",
2586
+ children: /* @__PURE__ */ jsx20(
2587
+ motion3.div,
2586
2588
  {
2587
- ...props,
2588
- filter: (value, search2) => {
2589
- const labelNode = items.get(value);
2590
- const label = typeof labelNode === "string" ? labelNode : value;
2591
- if (label.toLowerCase().includes(search2.toLowerCase()))
2592
- return 1;
2593
- return 0;
2594
- },
2595
- children: [
2596
- canSearch ? /* @__PURE__ */ jsx20(
2597
- CommandInputBase,
2598
- {
2599
- placeholder: typeof search === "object" ? search.placeholder : void 0
2600
- }
2601
- ) : /* @__PURE__ */ jsx20("button", { autoFocus: true, className: "sr-only" }),
2602
- /* @__PURE__ */ jsxs13(CommandListBase, { children: [
2603
- canSearch && /* @__PURE__ */ jsx20(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
2604
- children
2605
- ] })
2606
- ]
2589
+ initial: { opacity: 0, scale: 0.95 },
2590
+ animate: { opacity: open ? 1 : 0, scale: open ? 1 : 0.95 },
2591
+ transition: { duration: 0.2 },
2592
+ style: { pointerEvents: open ? "auto" : "none" },
2593
+ children: /* @__PURE__ */ jsx20("div", { className: cn(" "), children: /* @__PURE__ */ jsxs13(
2594
+ CommandBase,
2595
+ {
2596
+ ...props,
2597
+ filter: (value, search2) => {
2598
+ const labelNode = items.get(value);
2599
+ const label = typeof labelNode === "string" ? labelNode : value;
2600
+ if (label.toLowerCase().includes(search2.toLowerCase()))
2601
+ return 1;
2602
+ return 0;
2603
+ },
2604
+ children: [
2605
+ canSearch ? /* @__PURE__ */ jsx20(
2606
+ CommandInputBase,
2607
+ {
2608
+ placeholder: typeof search === "object" ? search.placeholder : void 0
2609
+ }
2610
+ ) : /* @__PURE__ */ jsx20("button", { autoFocus: true, className: "sr-only" }),
2611
+ /* @__PURE__ */ jsxs13(CommandListBase, { children: [
2612
+ canSearch && /* @__PURE__ */ jsx20(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
2613
+ children
2614
+ ] })
2615
+ ]
2616
+ }
2617
+ ) })
2607
2618
  }
2608
- ) })
2619
+ )
2609
2620
  }
2610
- ) }) });
2621
+ ) });
2611
2622
  }
2612
2623
  function MultiSelectItemBase({
2613
2624
  value,
@@ -2709,6 +2720,7 @@ function MultiCombobox({
2709
2720
  disabled,
2710
2721
  empty,
2711
2722
  error,
2723
+ initialItems: items,
2712
2724
  children: [
2713
2725
  /* @__PURE__ */ jsx21(
2714
2726
  MultiSelectTriggerBase,
@@ -2830,6 +2842,11 @@ var SelectContentBase = React14.forwardRef(
2830
2842
  ),
2831
2843
  position,
2832
2844
  "data-testid": dataTestId,
2845
+ onPointerDownOutside: (event) => {
2846
+ props.onPointerDownOutside?.(event);
2847
+ if (event.defaultPrevented) return;
2848
+ event.stopPropagation();
2849
+ },
2833
2850
  ...props,
2834
2851
  asChild: true,
2835
2852
  children: /* @__PURE__ */ jsx23(
@@ -2978,7 +2995,7 @@ var DropDownMenuContentBase = React15.forwardRef(
2978
2995
  exit: { opacity: 0, scale: 0.95, y: 5 },
2979
2996
  transition: { duration: 0.2, ease: "easeOut" },
2980
2997
  className: cn(
2981
- "min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
2998
+ "min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border",
2982
2999
  className
2983
3000
  ),
2984
3001
  children: props.children
@@ -3162,35 +3179,13 @@ function ModeToggleBase({
3162
3179
  setTheme(newTheme);
3163
3180
  return;
3164
3181
  }
3165
- const button = buttonRef.current;
3166
- const rect = button.getBoundingClientRect();
3182
+ const rect = buttonRef.current.getBoundingClientRect();
3167
3183
  const x = rect.left + rect.width / 2;
3168
3184
  const y = rect.top + rect.height / 2;
3169
3185
  const endRadius = Math.hypot(
3170
3186
  Math.max(x, window.innerWidth - x),
3171
3187
  Math.max(y, window.innerHeight - y)
3172
3188
  );
3173
- const styleId = "theme-transition-styles";
3174
- if (!document.getElementById(styleId)) {
3175
- const style = document.createElement("style");
3176
- style.id = styleId;
3177
- style.textContent = `
3178
- ::view-transition-old(root),
3179
- ::view-transition-new(root) {
3180
- animation: none;
3181
- mix-blend-mode: normal;
3182
- }
3183
-
3184
- ::view-transition-old(root) {
3185
- z-index: 1;
3186
- }
3187
-
3188
- ::view-transition-new(root) {
3189
- z-index: 2;
3190
- }
3191
- `;
3192
- document.head.appendChild(style);
3193
- }
3194
3189
  const transition = document.startViewTransition(async () => {
3195
3190
  setTheme(newTheme);
3196
3191
  });
@@ -3198,14 +3193,14 @@ function ModeToggleBase({
3198
3193
  document.documentElement.animate(
3199
3194
  [
3200
3195
  {
3201
- clipPath: `circle(0% at ${x}px ${y}px)`
3196
+ clipPath: `circle(0px at ${x}px ${y}px)`
3202
3197
  },
3203
3198
  {
3204
3199
  clipPath: `circle(${Math.ceil(endRadius)}px at ${x}px ${y}px)`
3205
3200
  }
3206
3201
  ],
3207
3202
  {
3208
- duration: 600,
3203
+ duration: 400,
3209
3204
  easing: "cubic-bezier(0.4, 0, 0.2, 1)",
3210
3205
  pseudoElement: "::view-transition-new(root)"
3211
3206
  }
@@ -3365,7 +3360,7 @@ var CardBase = React17.forwardRef(({ className, testid: dataTestId = "card-base"
3365
3360
  {
3366
3361
  ref,
3367
3362
  className: cn(
3368
- "rounded-xl border bg-card text-card-foreground shadow",
3363
+ "rounded-xl border border-border bg-card text-card-foreground shadow",
3369
3364
  className
3370
3365
  ),
3371
3366
  "data-testid": dataTestId,
@@ -7587,7 +7582,7 @@ function CalendarBase2({
7587
7582
  "div",
7588
7583
  {
7589
7584
  className: cn(
7590
- "rounded-md border bg-background p-3 overflow-hidden flex flex-col",
7585
+ "rounded-md border p-3 overflow-hidden flex flex-col",
7591
7586
  className
7592
7587
  ),
7593
7588
  children: /* @__PURE__ */ jsx57("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsx57(
@@ -7608,12 +7603,12 @@ function CalendarBase2({
7608
7603
  button_previous: cn(
7609
7604
  buttonVariantsBase({ variant: "outline" }),
7610
7605
  "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",
7611
- isMobile ? "mr-8" : ""
7606
+ isMobile ? "" : ""
7612
7607
  ),
7613
7608
  button_next: cn(
7614
7609
  buttonVariantsBase({ variant: "outline" }),
7615
7610
  "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",
7616
- isMobile ? "mr-8" : ""
7611
+ isMobile ? "" : ""
7617
7612
  ),
7618
7613
  month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
7619
7614
  weekdays: "grid grid-cols-7 gap-1 mb-1",
@@ -7633,8 +7628,8 @@ function CalendarBase2({
7633
7628
  ),
7634
7629
  selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white rounded-md",
7635
7630
  today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
7636
- outside: "text-muted-foreground/40 opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
7637
- disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
7631
+ outside: "text-muted-foreground opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
7632
+ disabled: "text-muted-foreground cursor-not-allowed line-through decoration-2",
7638
7633
  range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
7639
7634
  hidden: "invisible",
7640
7635
  ...classNames
@@ -7664,29 +7659,19 @@ import { CalendarBlankIcon, CalendarDotIcon } from "@phosphor-icons/react";
7664
7659
  // src/components/ui/picker/TimeScrollPicker.tsx
7665
7660
  import { useEffect as useEffect17, useRef as useRef10, useState as useState18 } from "react";
7666
7661
  import { jsx as jsx58, jsxs as jsxs40 } from "react/jsx-runtime";
7667
- var ITEM_HEIGHT = 39;
7668
- var ITEM_HEIGHT_MOBILE = 32;
7662
+ var ITEM_HEIGHT = 38.5;
7669
7663
  var VISIBLE_ITEMS = 5;
7670
- var VISIBLE_ITEMS_MOBILE = 3;
7671
7664
  var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
7672
- var CENTER_INDEX_MOBILE = Math.floor(VISIBLE_ITEMS_MOBILE / 2);
7673
- function ScrollColumn({
7674
- value,
7675
- onChange,
7676
- max,
7677
- label,
7678
- hideSeconds
7679
- }) {
7680
- const isMobile = useIsMobile();
7665
+ function ScrollColumn({ value, onChange, max, label }) {
7681
7666
  const containerRef = useRef10(null);
7682
7667
  const items = Array.from({ length: max }, (_, i) => i);
7683
7668
  const [isDragging, setIsDragging] = useState18(false);
7684
7669
  const [startY, setStartY] = useState18(0);
7685
7670
  const [scrollTop, setScrollTop] = useState18(0);
7686
7671
  const scrollTimeoutRef = useRef10(null);
7687
- const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
7688
- const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
7689
- const visibleItems = isMobile ? VISIBLE_ITEMS_MOBILE : VISIBLE_ITEMS;
7672
+ const itemHeight = ITEM_HEIGHT;
7673
+ const centerIndex = CENTER_INDEX;
7674
+ const visibleItems = VISIBLE_ITEMS;
7690
7675
  const containerHeight = visibleItems * itemHeight;
7691
7676
  useEffect17(() => {
7692
7677
  if (containerRef.current && !isDragging) {
@@ -7705,7 +7690,9 @@ function ScrollColumn({
7705
7690
  }
7706
7691
  };
7707
7692
  }, []);
7708
- const handleScroll = () => {
7693
+ const handleScroll = (e) => {
7694
+ e.stopPropagation();
7695
+ e.preventDefault();
7709
7696
  if (!containerRef.current || isDragging) return;
7710
7697
  if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
7711
7698
  scrollTimeoutRef.current = setTimeout(() => {
@@ -7743,15 +7730,18 @@ function ScrollColumn({
7743
7730
  const handleMouseLeave = () => {
7744
7731
  if (isDragging) handleMouseUp();
7745
7732
  };
7746
- const containerWidth = isMobile ? hideSeconds ? "w-16" : "w-8" : "w-16";
7747
- return /* @__PURE__ */ jsxs40("div", { className: "flex flex-col items-center gap-1", children: [
7748
- /* @__PURE__ */ jsx58("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 }),
7749
- /* @__PURE__ */ jsx58("div", { className: cn("relative", containerWidth), children: /* @__PURE__ */ jsx58(
7733
+ const handleWheel = (e) => {
7734
+ e.stopPropagation();
7735
+ };
7736
+ return /* @__PURE__ */ jsxs40("div", { className: "flex flex-col items-center", children: [
7737
+ /* @__PURE__ */ jsx58("span", { className: "text-muted-foreground rounded-md font-semibold text-sm sm:text-sm text-center pb-2 uppercase tracking-wider", children: label }),
7738
+ /* @__PURE__ */ jsx58("div", { className: cn("relative w-20 sm:w-16"), children: /* @__PURE__ */ jsx58(
7750
7739
  "div",
7751
7740
  {
7752
7741
  ref: containerRef,
7753
- className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
7742
+ className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] touch-action-pan-y",
7754
7743
  onScroll: handleScroll,
7744
+ onWheel: handleWheel,
7755
7745
  onMouseDown: handleMouseDown,
7756
7746
  onMouseMove: handleMouseMove,
7757
7747
  onMouseUp: handleMouseUp,
@@ -7768,9 +7758,9 @@ function ScrollColumn({
7768
7758
  "div",
7769
7759
  {
7770
7760
  className: cn(
7771
- "flex items-center justify-center select-none font-semibold tabular-nums",
7761
+ "flex items-center justify-center select-none font-semibold tabular-nums transition-all duration-150",
7772
7762
  isDragging ? "cursor-grabbing" : "",
7773
- isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
7763
+ isSelected ? "text-lg sm:text-xl text-foreground scale-110" : "text-sm sm:text-base text-muted-foreground opacity-60"
7774
7764
  ),
7775
7765
  style: { height: `${itemHeight}px` },
7776
7766
  onClick: () => !isDragging && onChange(item),
@@ -7788,10 +7778,9 @@ function TimeScrollPicker({
7788
7778
  setDate,
7789
7779
  hideSeconds = false
7790
7780
  }) {
7791
- const isMobile = useIsMobile();
7792
7781
  const currentDate = date || /* @__PURE__ */ new Date();
7793
- const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
7794
- const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
7782
+ const itemHeight = ITEM_HEIGHT;
7783
+ const centerIndex = CENTER_INDEX;
7795
7784
  const handleTimeChange = (type, value) => {
7796
7785
  const newDate = new Date(currentDate);
7797
7786
  if (type === "hours") newDate.setHours(value);
@@ -7799,13 +7788,13 @@ function TimeScrollPicker({
7799
7788
  else newDate.setSeconds(value);
7800
7789
  setDate(newDate);
7801
7790
  };
7802
- return /* @__PURE__ */ jsx58("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ jsxs40("div", { className: cn("relative flex gap-2"), children: [
7791
+ return /* @__PURE__ */ jsx58("div", { className: "flex items-center justify-center gap-2 p-3 sm:p-4", children: /* @__PURE__ */ jsxs40("div", { className: cn("relative flex gap-4 sm:gap-3"), children: [
7803
7792
  /* @__PURE__ */ jsx58(
7804
7793
  "div",
7805
7794
  {
7806
- className: "absolute left-0 right-0 pointer-events-none z-10 rounded-md bg-primary/5",
7795
+ className: "absolute left-0 right-0 pointer-events-none z-10 rounded-lg bg-primary/10 border border-primary/20",
7807
7796
  style: {
7808
- top: `calc(1.75rem + ${centerIndex * itemHeight}px)`,
7797
+ top: `calc(1.85rem + ${centerIndex * itemHeight}px)`,
7809
7798
  height: `${itemHeight}px`
7810
7799
  }
7811
7800
  }
@@ -7893,12 +7882,17 @@ function DateTimePicker({
7893
7882
  }) {
7894
7883
  const [internalDate, setInternalDate] = useState20(date);
7895
7884
  const [open, setOpen] = useState20(false);
7885
+ const [activeTab, setActiveTab] = useState20("calendar");
7896
7886
  const isMobile = useIsMobile();
7897
7887
  const handleSelect = (newDay) => {
7898
7888
  if (!newDay) return;
7899
7889
  if (!internalDate) {
7900
7890
  const now = /* @__PURE__ */ new Date();
7901
- newDay.setHours(now.getHours(), now.getMinutes(), now.getSeconds());
7891
+ newDay.setUTCHours(
7892
+ now.getUTCHours(),
7893
+ now.getUTCMinutes(),
7894
+ now.getUTCSeconds()
7895
+ );
7902
7896
  setInternalDate(newDay);
7903
7897
  onChange?.(newDay);
7904
7898
  return;
@@ -7911,7 +7905,6 @@ function DateTimePicker({
7911
7905
  };
7912
7906
  const handleTimeChange = (newDate) => {
7913
7907
  setInternalDate(newDate);
7914
- onChange?.(newDate);
7915
7908
  };
7916
7909
  const getTimeFormat = () => {
7917
7910
  if (hideTime) return "";
@@ -7928,6 +7921,9 @@ function DateTimePicker({
7928
7921
  };
7929
7922
  useEffect19(() => {
7930
7923
  setInternalDate(date);
7924
+ if (open) {
7925
+ setActiveTab("calendar");
7926
+ }
7931
7927
  }, [date, open]);
7932
7928
  const { ref: contentRef, center } = use_auto_center_default(open);
7933
7929
  const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none";
@@ -7967,12 +7963,55 @@ function DateTimePicker({
7967
7963
  ]
7968
7964
  }
7969
7965
  );
7970
- const renderPickerContent = () => /* @__PURE__ */ jsxs41("div", { className: "p-3 border rounded-md", children: [
7971
- /* @__PURE__ */ jsxs41(
7966
+ const renderPickerContent = () => /* @__PURE__ */ jsxs41("div", { className: "p-2 sm:p-3 border border-border rounded-md", children: [
7967
+ isMobile && !hideTime ? /* @__PURE__ */ jsxs41("div", { className: "min-h-[380px] max-h-[calc(400px)]", children: [
7968
+ internalDate && /* @__PURE__ */ jsx59("div", { className: "flex items-center gap-3 px-4 py-3 rounded-lg ", children: /* @__PURE__ */ jsxs41("span", { className: "text-md font-semibold", children: [
7969
+ format(internalDate, "dd 'de' MMMM 'de' yyyy", {
7970
+ locale: ptBR2
7971
+ }),
7972
+ " ",
7973
+ "- ",
7974
+ format(internalDate, hideSeconds ? "HH:mm" : "HH:mm:ss")
7975
+ ] }) }),
7976
+ /* @__PURE__ */ jsxs41(TabsBase, { value: activeTab, onValueChange: setActiveTab, children: [
7977
+ /* @__PURE__ */ jsxs41(TabsListBase, { className: "", children: [
7978
+ /* @__PURE__ */ jsx59(TabsTriggerBase, { value: "calendar", className: "flex-1", children: "Data" }),
7979
+ /* @__PURE__ */ jsx59(TabsTriggerBase, { value: "time", className: "flex-1", children: "Hor\xE1rio" })
7980
+ ] }),
7981
+ /* @__PURE__ */ jsx59(TabsContentBase, { value: "calendar", className: "mt-0", children: /* @__PURE__ */ jsx59(
7982
+ CalendarBase2,
7983
+ {
7984
+ mode: "single",
7985
+ locale: ptBR2,
7986
+ selected: internalDate ?? void 0,
7987
+ onSelect: (d) => handleSelect(d ?? null),
7988
+ autoFocus: true,
7989
+ defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
7990
+ ...fromDate && { startMonth: fromDate },
7991
+ ...toDate && { endMonth: toDate },
7992
+ ...fromDate || toDate ? {
7993
+ disabled: [
7994
+ ...fromDate ? [{ before: fromDate }] : [],
7995
+ ...toDate ? [{ after: toDate }] : []
7996
+ ]
7997
+ } : {},
7998
+ className: cn("w-full rounded-none border-none")
7999
+ }
8000
+ ) }),
8001
+ /* @__PURE__ */ jsx59(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ jsx59("div", { className: "flex flex-col items-center justify-center gap-4 py-2 min-h-[330px]", children: /* @__PURE__ */ jsx59(
8002
+ TimeScrollPicker,
8003
+ {
8004
+ setDate: (d) => handleTimeChange(d ?? null),
8005
+ date: internalDate,
8006
+ hideSeconds
8007
+ }
8008
+ ) }) })
8009
+ ] })
8010
+ ] }) : /* @__PURE__ */ jsxs41(
7972
8011
  "div",
7973
8012
  {
7974
8013
  ref: contentRef,
7975
- className: "flex sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
8014
+ className: "flex flex-col sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
7976
8015
  children: [
7977
8016
  /* @__PURE__ */ jsx59(
7978
8017
  CalendarBase2,
@@ -7986,15 +8025,14 @@ function DateTimePicker({
7986
8025
  ...fromDate && { startMonth: fromDate },
7987
8026
  ...toDate && { endMonth: toDate },
7988
8027
  ...fromDate || toDate ? {
7989
- hidden: [
8028
+ disabled: [
7990
8029
  ...fromDate ? [{ before: fromDate }] : [],
7991
8030
  ...toDate ? [{ after: toDate }] : []
7992
8031
  ]
7993
8032
  } : {},
7994
8033
  className: cn(
7995
8034
  "w-max rounded-none border-none",
7996
- !hideTime && "sm:rounded-r-none rounded-b-none",
7997
- isMobile ? "border-b-transparent w-full" : ""
8035
+ !hideTime && "sm:rounded-r-none"
7998
8036
  )
7999
8037
  }
8000
8038
  ),
@@ -8003,7 +8041,7 @@ function DateTimePicker({
8003
8041
  {
8004
8042
  className: cn(
8005
8043
  "flex flex-col items-center justify-center",
8006
- isMobile ? "border-none" : "border-l"
8044
+ "border-l"
8007
8045
  ),
8008
8046
  children: [
8009
8047
  /* @__PURE__ */ jsx59("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" }),
@@ -8021,60 +8059,61 @@ function DateTimePicker({
8021
8059
  ]
8022
8060
  }
8023
8061
  ),
8024
- /* @__PURE__ */ jsx59("div", { className: "flex rounded-md p-1.5", children: /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-2 w-full gap-12", children: [
8025
- /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2", children: [
8026
- /* @__PURE__ */ jsx59(
8027
- ButtonBase,
8028
- {
8029
- variant: "outline",
8030
- size: "icon",
8031
- className: "no-active-animation",
8032
- tooltip: "Hoje",
8033
- onClick: () => {
8034
- const now = /* @__PURE__ */ new Date();
8035
- const selected = hideTime ? new Date(
8036
- now.getFullYear(),
8037
- now.getMonth(),
8038
- now.getDate(),
8062
+ /* @__PURE__ */ jsxs41("div", { className: "flex rounded-md p-1.5 gap-2", children: [
8063
+ /* @__PURE__ */ jsx59(
8064
+ ButtonBase,
8065
+ {
8066
+ variant: "outline",
8067
+ className: "no-active-animation",
8068
+ tooltip: "Hoje",
8069
+ size: "icon",
8070
+ onClick: () => {
8071
+ const now = /* @__PURE__ */ new Date();
8072
+ const selected = hideTime ? new Date(
8073
+ Date.UTC(
8074
+ now.getUTCFullYear(),
8075
+ now.getUTCMonth(),
8076
+ now.getUTCDate(),
8039
8077
  0,
8040
8078
  0,
8041
8079
  0,
8042
8080
  0
8043
- ) : now;
8044
- setInternalDate(selected);
8045
- onChange?.(selected);
8046
- onConfirm?.(selected);
8047
- },
8048
- children: /* @__PURE__ */ jsx59(CalendarDotIcon, { className: "h-4 w-4" })
8049
- }
8050
- ),
8081
+ )
8082
+ ) : now;
8083
+ setInternalDate(selected);
8084
+ onChange?.(selected);
8085
+ onConfirm?.(selected);
8086
+ },
8087
+ children: /* @__PURE__ */ jsx59(CalendarDotIcon, { className: "h-4 w-4" })
8088
+ }
8089
+ ),
8090
+ /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-2 sm:flex-row w-full gap-2", children: [
8051
8091
  /* @__PURE__ */ jsx59(
8052
8092
  ButtonBase,
8053
8093
  {
8054
- className: "no-active-animation rounded-md bg-background text-gray-800 border hover:bg-muted/50 overflow-y-hidden w-full",
8094
+ className: "no-active-animation rounded-md bg-background text-primary border hover:bg-muted/50 overflow-hidden flex-1 min-w-0 border-border",
8055
8095
  onClick: () => setOpen(false),
8056
8096
  children: "Cancelar"
8057
8097
  }
8098
+ ),
8099
+ /* @__PURE__ */ jsx59(
8100
+ ButtonBase,
8101
+ {
8102
+ className: cn(
8103
+ "no-active-animation rounded-md bg-emerald-600",
8104
+ internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed"
8105
+ ),
8106
+ disabled: !internalDate,
8107
+ onClick: () => {
8108
+ if (!internalDate) return;
8109
+ setOpen(false);
8110
+ onConfirm?.(internalDate);
8111
+ },
8112
+ children: "Confirmar"
8113
+ }
8058
8114
  )
8059
- ] }),
8060
- /* @__PURE__ */ jsx59(
8061
- ButtonBase,
8062
- {
8063
- className: cn(
8064
- "no-active-animation rounded-none bg-emerald-600",
8065
- internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed",
8066
- isMobile ? "" : "rounded-md"
8067
- ),
8068
- disabled: !internalDate,
8069
- onClick: () => {
8070
- if (!internalDate) return;
8071
- setOpen(false);
8072
- onConfirm?.(internalDate);
8073
- },
8074
- children: "Confirmar"
8075
- }
8076
- )
8077
- ] }) })
8115
+ ] })
8116
+ ] })
8078
8117
  ] });
8079
8118
  return /* @__PURE__ */ jsxs41("div", { className: cn("w-full sm:w-auto", className), children: [
8080
8119
  label && /* @__PURE__ */ jsx59(LabelBase_default, { children: label }),
@@ -8089,7 +8128,7 @@ function DateTimePicker({
8089
8128
  }
8090
8129
  ),
8091
8130
  /* @__PURE__ */ jsx59(ErrorMessage_default, { error }),
8092
- /* @__PURE__ */ jsx59(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[90vh] overflow-hidden", children: renderPickerContent() })
8131
+ /* @__PURE__ */ jsx59(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[95vh] overflow-y-auto", children: renderPickerContent() })
8093
8132
  ] }) : /* @__PURE__ */ jsxs41(PopoverBase, { open, onOpenChange: setOpen, children: [
8094
8133
  /* @__PURE__ */ jsx59(
8095
8134
  PopoverTriggerBase,
@@ -8155,7 +8194,7 @@ function RangePicker({
8155
8194
  const { ref: contentRef, center } = use_auto_center_default(open);
8156
8195
  const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border shadow-none";
8157
8196
  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";
8158
- return /* @__PURE__ */ jsxs42("div", { className: cn("w-full sm:w-auto", className), children: [
8197
+ return /* @__PURE__ */ jsxs42("div", { className: cn("w-full sm:w-auto ", className), children: [
8159
8198
  label && /* @__PURE__ */ jsx60(LabelBase_default, { children: label }),
8160
8199
  /* @__PURE__ */ jsxs42(PopoverBase, { open, onOpenChange: setOpen, children: [
8161
8200
  /* @__PURE__ */ jsx60(
@@ -8163,7 +8202,7 @@ function RangePicker({
8163
8202
  {
8164
8203
  disabled,
8165
8204
  asChild: true,
8166
- className: cn(error && "border-red-500"),
8205
+ className: cn(error && "border-red-500 "),
8167
8206
  children: /* @__PURE__ */ jsxs42(
8168
8207
  ButtonBase,
8169
8208
  {
@@ -8186,17 +8225,25 @@ function RangePicker({
8186
8225
  })} - ${format2(range.to, "P", { locale: dateFnsLocale })}` : "Selecione um intervalo"
8187
8226
  }
8188
8227
  ),
8189
- range && /* @__PURE__ */ jsx60(
8190
- ClearButton,
8191
- {
8192
- className: "-mr-3",
8193
- onClick: (e) => {
8194
- e?.stopPropagation();
8195
- handleClear();
8228
+ /* @__PURE__ */ jsx60(motion12.span, { className: "flex items-center", children: /* @__PURE__ */ jsxs42("div", { className: "flex flex-row gap-0 items-center ", children: [
8229
+ range && /* @__PURE__ */ jsx60(
8230
+ ClearButton,
8231
+ {
8232
+ onClick: (e) => {
8233
+ e?.stopPropagation();
8234
+ handleClear();
8235
+ }
8196
8236
  }
8197
- }
8198
- ),
8199
- /* @__PURE__ */ jsx60(CalendarBlankIcon2, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
8237
+ ),
8238
+ /* @__PURE__ */ jsx60(
8239
+ motion12.div,
8240
+ {
8241
+ animate: { rotate: open ? 15 : 0 },
8242
+ transition: { duration: 0.03 },
8243
+ children: /* @__PURE__ */ jsx60(CalendarBlankIcon2, { className: "h-4 w-4" })
8244
+ }
8245
+ )
8246
+ ] }) })
8200
8247
  ]
8201
8248
  }
8202
8249
  )
@@ -8219,7 +8266,7 @@ function RangePicker({
8219
8266
  animate: { opacity: 1, y: 0 },
8220
8267
  exit: { opacity: 0, y: -4 },
8221
8268
  transition: { duration: 0.18, ease: "easeOut" },
8222
- className: "border rounded-md shadow-xl ",
8269
+ className: "border border-border rounded-md shadow-xl ",
8223
8270
  children: [
8224
8271
  /* @__PURE__ */ jsx60("div", { className: "p-4", children: /* @__PURE__ */ jsx60(
8225
8272
  motion12.div,
@@ -9986,7 +10033,7 @@ function Select({
9986
10033
  labelClassname,
9987
10034
  className,
9988
10035
  pagination,
9989
- hideClear = true
10036
+ hideClear = false
9990
10037
  }) {
9991
10038
  const [page, setPage] = useState24(1);
9992
10039
  const [animating, setAnimating] = useState24(false);
@@ -10058,7 +10105,7 @@ function Select({
10058
10105
  }
10059
10106
  ),
10060
10107
  /* @__PURE__ */ jsx68(motion14.span, { className: "flex items-center", children: /* @__PURE__ */ jsxs49("div", { className: "flex flex-row gap-0 items-center ", children: [
10061
- hideClear && selected && /* @__PURE__ */ jsx68(
10108
+ !hideClear && selected && /* @__PURE__ */ jsx68(
10062
10109
  ClearButton,
10063
10110
  {
10064
10111
  onClick: () => {
@@ -10298,7 +10345,7 @@ function EventAgenda({
10298
10345
  "div",
10299
10346
  {
10300
10347
  className: cn(
10301
- "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2",
10348
+ "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2 border-border",
10302
10349
  className
10303
10350
  ),
10304
10351
  style: {
@@ -10343,7 +10390,8 @@ function EventAgenda({
10343
10390
  },
10344
10391
  items: selectItems,
10345
10392
  className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
10346
- placeholder: viewLabel(view)
10393
+ placeholder: viewLabel(view),
10394
+ hideClear: true
10347
10395
  }
10348
10396
  ) })
10349
10397
  ] }),
@@ -14191,6 +14239,12 @@ function MultiSelect({
14191
14239
  const id = setTimeout(() => setAnimating(false), 220);
14192
14240
  return () => clearTimeout(id);
14193
14241
  }, [page, pagination]);
14242
+ const initialItems = useMemo24(() => {
14243
+ if (groupItems) {
14244
+ return Object.values(groupItems).flat();
14245
+ }
14246
+ return items ?? [];
14247
+ }, [items, groupItems]);
14194
14248
  return /* @__PURE__ */ jsxs64("div", { "data-testid": testIds.root ?? "multiselect-root", children: [
14195
14249
  label && /* @__PURE__ */ jsx86(LabelBase_default, { className: labelClassname, children: label }),
14196
14250
  /* @__PURE__ */ jsxs64(
@@ -14202,6 +14256,7 @@ function MultiSelect({
14202
14256
  disabled,
14203
14257
  empty,
14204
14258
  error,
14259
+ initialItems,
14205
14260
  children: [
14206
14261
  /* @__PURE__ */ jsx86(
14207
14262
  MultiSelectTriggerBase,
@@ -16730,9 +16785,11 @@ var Chart = ({
16730
16785
  setActiveTooltips
16731
16786
  }
16732
16787
  );
16733
- const titleClassName = useMemo26(
16734
- () => "text-[1.4rem] font-semibold text-foreground mb-3",
16735
- []
16788
+ const getSeriesOpacity = useCallback17(
16789
+ (key) => {
16790
+ return highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1;
16791
+ },
16792
+ [highlightedSeries]
16736
16793
  );
16737
16794
  const finalValueFormatter = useMemo26(
16738
16795
  () => createValueFormatter(valueFormatter2, formatBR),
@@ -16742,20 +16799,15 @@ var Chart = ({
16742
16799
  () => createYTickFormatter(finalValueFormatter),
16743
16800
  [finalValueFormatter]
16744
16801
  );
16745
- const finalEnableHighlights = enableHighlights;
16746
- const finalEnableShowOnly = enableShowOnly;
16747
- const finalEnablePeriodsDropdown = enablePeriodsDropdown && enableDraggableTooltips;
16748
- const defaultChartRightMargin = 30;
16749
- const defaultChartLeftMargin = 0;
16750
- const axisLabelMargin = 56;
16751
- const containerPaddingLeft = -6;
16752
- const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
16753
- const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
16802
+ const AXIS_LABEL_MARGIN = 56;
16803
+ const CONTAINER_PADDING_LEFT = -6;
16804
+ const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
16805
+ const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
16754
16806
  const yAxisTickWidth = useMemo26(
16755
16807
  () => computeYAxisTickWidth(
16756
16808
  chartMargin?.left,
16757
16809
  yAxisLabel,
16758
- axisLabelMargin,
16810
+ AXIS_LABEL_MARGIN,
16759
16811
  yTickFormatter,
16760
16812
  minLeftDataValue,
16761
16813
  niceMaxLeft
@@ -16768,16 +16820,10 @@ var Chart = ({
16768
16820
  niceMaxLeft
16769
16821
  ]
16770
16822
  );
16771
- const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
16772
- const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
16773
16823
  const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
16774
- const baseBottom = chartMargin?.bottom ?? 5;
16775
- const extraForXAxisLabel = xAxisLabel ? 22 : 0;
16776
- const extraForLegend = showLegend ? 36 : 0;
16777
- const finalChartBottomMargin = baseBottom + extraForXAxisLabel + extraForLegend;
16778
- const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
16779
- const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
16780
- const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
16824
+ const finalChartBottomMargin = (chartMargin?.bottom ?? 5) + (xAxisLabel ? 22 : 0) + (showLegend ? 36 : 0);
16825
+ const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
16826
+ const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
16781
16827
  const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
16782
16828
  const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
16783
16829
  const openTooltipForPeriod = useCallback17(
@@ -16797,7 +16843,7 @@ var Chart = ({
16797
16843
  );
16798
16844
  }
16799
16845
  const offsetIndex = activeTooltips.length;
16800
- const availableWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
16846
+ const availableWidth = effectiveChartWidth;
16801
16847
  const gap = 28;
16802
16848
  const leftGap = 28;
16803
16849
  const newTooltip = {
@@ -16817,9 +16863,7 @@ var Chart = ({
16817
16863
  enableDraggableTooltips,
16818
16864
  processedData,
16819
16865
  activeTooltips,
16820
- width,
16821
- measuredInner,
16822
- computedWidth,
16866
+ effectiveChartWidth,
16823
16867
  maxTooltips,
16824
16868
  setActiveTooltips
16825
16869
  ]
@@ -16832,7 +16876,7 @@ var Chart = ({
16832
16876
  title,
16833
16877
  isLoading: true,
16834
16878
  loadingMessage: typeof title === "string" ? `${title} \u2014 Carregando` : "Carregando",
16835
- paddingLeft: containerPaddingLeft + finalChartLeftMargin,
16879
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
16836
16880
  height
16837
16881
  }
16838
16882
  );
@@ -16842,493 +16886,448 @@ var Chart = ({
16842
16886
  NoData_default,
16843
16887
  {
16844
16888
  title,
16845
- paddingLeft: containerPaddingLeft + finalChartLeftMargin,
16889
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
16846
16890
  height
16847
16891
  }
16848
16892
  );
16849
16893
  }
16850
- return /* @__PURE__ */ jsx96(
16894
+ return /* @__PURE__ */ jsx96("div", { ref: wrapperRef, className: "w-full overflow-hidden min-w-0", children: /* @__PURE__ */ jsxs74(
16851
16895
  "div",
16852
16896
  {
16853
- ref: wrapperRef,
16854
- style: {
16855
- width: "100%",
16856
- overflowX: "hidden",
16857
- overflowY: "hidden",
16858
- minWidth: 0
16859
- },
16860
- children: /* @__PURE__ */ jsxs74(
16861
- "div",
16862
- {
16863
- className: cn("rounded-lg bg-card relative", className),
16864
- style: { width: "100%", maxWidth: "100%", minWidth: 0 },
16865
- children: [
16866
- title && /* @__PURE__ */ jsx96(
16867
- "div",
16868
- {
16869
- style: {
16870
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
16871
- width: "100%",
16872
- display: "flex",
16873
- justifyContent: titlePosition === "center" ? "center" : titlePosition === "right" ? "flex-end" : "flex-start",
16874
- alignItems: "center",
16875
- marginTop: "19px"
16876
- },
16877
- children: /* @__PURE__ */ jsx96("div", { className: titleClassName, children: title })
16878
- }
16897
+ className: cn(
16898
+ "rounded-lg bg-card relative w-full max-w-full min-w-0",
16899
+ className
16900
+ ),
16901
+ children: [
16902
+ title && /* @__PURE__ */ jsx96(
16903
+ "div",
16904
+ {
16905
+ className: cn(
16906
+ "w-full flex items-center mt-[19px] ml-[90px]",
16907
+ titlePosition === "center" && "justify-center",
16908
+ titlePosition === "right" && "justify-end",
16909
+ titlePosition === "left" && "justify-start"
16879
16910
  ),
16880
- allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly) && /* @__PURE__ */ jsxs74(
16881
- "div",
16911
+ children: /* @__PURE__ */ jsx96("div", { className: "text-[1.4rem] font-semibold text-foreground mb-3", children: title })
16912
+ }
16913
+ ),
16914
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxs74("div", { className: "flex items-center w-[98%] ml-[90px] gap-2", children: [
16915
+ enableHighlights && /* @__PURE__ */ jsx96(
16916
+ Highlights_default,
16917
+ {
16918
+ allKeys,
16919
+ mapperConfig,
16920
+ finalColors,
16921
+ highlightedSeries,
16922
+ toggleHighlight,
16923
+ containerWidth: chartInnerWidth
16924
+ }
16925
+ ),
16926
+ enableShowOnly && /* @__PURE__ */ jsx96(
16927
+ ShowOnly_default,
16928
+ {
16929
+ showOnlyHighlighted,
16930
+ setShowOnlyHighlighted,
16931
+ highlightedSeriesSize: highlightedSeries.size,
16932
+ clearHighlights
16933
+ }
16934
+ ),
16935
+ enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsx96("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx96(
16936
+ PeriodsDropdown_default,
16937
+ {
16938
+ processedData,
16939
+ onOpenPeriod: openTooltipForPeriod,
16940
+ rightOffset: finalChartRightMargin,
16941
+ activePeriods
16942
+ }
16943
+ ) })
16944
+ ] }),
16945
+ !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsx96(
16946
+ "div",
16947
+ {
16948
+ className: "w-full flex justify-end",
16949
+ style: {
16950
+ paddingLeft: `${CONTAINER_PADDING_LEFT + finalChartLeftMargin}px`,
16951
+ paddingRight: `${finalChartRightMargin}px`,
16952
+ maxWidth: `${chartInnerWidth}px`
16953
+ },
16954
+ children: /* @__PURE__ */ jsx96(
16955
+ PeriodsDropdown_default,
16882
16956
  {
16883
- className: "flex items-center w-full",
16884
- style: {
16885
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
16886
- width: "98%",
16887
- display: "flex",
16888
- alignItems: "center",
16889
- gap: "0.5rem"
16890
- },
16891
- children: [
16892
- finalEnableHighlights && /* @__PURE__ */ jsx96(
16893
- Highlights_default,
16894
- {
16895
- allKeys,
16896
- mapperConfig,
16897
- finalColors,
16898
- highlightedSeries,
16899
- toggleHighlight,
16900
- containerWidth: chartInnerWidth
16901
- }
16902
- ),
16903
- finalEnableShowOnly && /* @__PURE__ */ jsx96(
16904
- ShowOnly_default,
16905
- {
16906
- showOnlyHighlighted,
16907
- setShowOnlyHighlighted,
16908
- highlightedSeriesSize: highlightedSeries.size,
16909
- clearHighlights
16910
- }
16911
- ),
16912
- finalEnablePeriodsDropdown && /* @__PURE__ */ jsx96(
16913
- "div",
16914
- {
16915
- style: {
16916
- marginLeft: "auto",
16917
- display: "flex",
16918
- alignItems: "center"
16919
- },
16920
- children: /* @__PURE__ */ jsx96(
16921
- PeriodsDropdown_default,
16922
- {
16923
- processedData,
16924
- onOpenPeriod: openTooltipForPeriod,
16925
- rightOffset: finalChartRightMargin,
16926
- activePeriods
16927
- }
16928
- )
16929
- }
16930
- )
16931
- ]
16957
+ processedData,
16958
+ onOpenPeriod: openTooltipForPeriod,
16959
+ rightOffset: finalChartRightMargin
16932
16960
  }
16933
- ),
16934
- !(allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly)) && finalEnablePeriodsDropdown && /* @__PURE__ */ jsx96(
16935
- "div",
16936
- {
16937
- style: {
16938
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
16939
- paddingRight: `${finalChartRightMargin}px`,
16940
- width: "100%",
16941
- maxWidth: `${chartInnerWidth}px`,
16942
- display: "flex",
16943
- justifyContent: "flex-end"
16944
- },
16945
- children: /* @__PURE__ */ jsx96(
16946
- PeriodsDropdown_default,
16961
+ )
16962
+ }
16963
+ ),
16964
+ /* @__PURE__ */ jsx96(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs74(
16965
+ ComposedChart,
16966
+ {
16967
+ data: processedData,
16968
+ height,
16969
+ margin: {
16970
+ top: finalChartTopMargin,
16971
+ right: finalChartRightMargin,
16972
+ left: finalChartLeftMargin,
16973
+ bottom: finalChartBottomMargin
16974
+ },
16975
+ onClick: handleChartClick,
16976
+ children: [
16977
+ /* @__PURE__ */ jsx96("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
16978
+ const key = s.key;
16979
+ const color = finalColors[key];
16980
+ return /* @__PURE__ */ jsxs74(
16981
+ "linearGradient",
16947
16982
  {
16948
- processedData,
16949
- onOpenPeriod: openTooltipForPeriod,
16950
- rightOffset: finalChartRightMargin
16951
- }
16952
- )
16953
- }
16954
- ),
16955
- /* @__PURE__ */ jsx96(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs74(
16956
- ComposedChart,
16957
- {
16958
- data: processedData,
16959
- height,
16960
- margin: {
16961
- top: finalChartTopMargin,
16962
- right: finalChartRightMargin,
16963
- left: finalChartLeftMargin,
16964
- bottom: finalChartBottomMargin
16965
- },
16966
- onClick: handleChartClick,
16967
- children: [
16968
- /* @__PURE__ */ jsx96("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
16969
- const key = s.key;
16970
- const color = finalColors[key];
16971
- return /* @__PURE__ */ jsxs74(
16972
- "linearGradient",
16973
- {
16974
- id: `gradient-${key}`,
16975
- x1: "0",
16976
- y1: "0",
16977
- x2: "0",
16978
- y2: "0.8",
16979
- children: [
16980
- /* @__PURE__ */ jsx96("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
16981
- /* @__PURE__ */ jsx96("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
16982
- ]
16983
- },
16984
- `gradient-${key}`
16985
- );
16986
- }) }),
16987
- showGrid && /* @__PURE__ */ jsx96(
16988
- CartesianGrid,
16989
- {
16990
- strokeDasharray: "3 3",
16991
- stroke: gridColor || "hsl(var(--muted-foreground))",
16992
- opacity: 0.5
16993
- }
16994
- ),
16995
- /* @__PURE__ */ jsx96(
16996
- XAxis,
16997
- {
16998
- dataKey: xAxisConfig.dataKey,
16999
- stroke: "hsl(var(--muted-foreground))",
16983
+ id: `gradient-${key}`,
16984
+ x1: "0",
16985
+ y1: "0",
16986
+ x2: "0",
16987
+ y2: "0.8",
16988
+ children: [
16989
+ /* @__PURE__ */ jsx96("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
16990
+ /* @__PURE__ */ jsx96("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
16991
+ ]
16992
+ },
16993
+ `gradient-${key}`
16994
+ );
16995
+ }) }),
16996
+ showGrid && /* @__PURE__ */ jsx96(
16997
+ CartesianGrid,
16998
+ {
16999
+ strokeDasharray: "3 3",
17000
+ stroke: gridColor || "hsl(var(--muted-foreground))",
17001
+ opacity: 0.5
17002
+ }
17003
+ ),
17004
+ /* @__PURE__ */ jsx96(
17005
+ XAxis,
17006
+ {
17007
+ dataKey: xAxisConfig.dataKey,
17008
+ stroke: "hsl(var(--muted-foreground))",
17009
+ fontSize: 12,
17010
+ tickLine: false,
17011
+ axisLine: false,
17012
+ tickFormatter: (value) => {
17013
+ if (categoryFormatter)
17014
+ return categoryFormatter(value);
17015
+ if (xAxisConfig.valueFormatter)
17016
+ return xAxisConfig.valueFormatter(value);
17017
+ return String(value ?? "");
17018
+ },
17019
+ label: xAxisLabel ? {
17020
+ value: xAxisLabel,
17021
+ position: "insideBottomRight",
17022
+ offset: -5,
17023
+ style: {
17000
17024
  fontSize: 12,
17001
- tickLine: false,
17002
- axisLine: false,
17003
- tickFormatter: (value) => {
17004
- if (categoryFormatter)
17005
- return categoryFormatter(value);
17006
- if (xAxisConfig.valueFormatter)
17007
- return xAxisConfig.valueFormatter(value);
17008
- return String(value ?? "");
17009
- },
17010
- label: xAxisLabel ? {
17011
- value: xAxisLabel,
17012
- position: "insideBottomRight",
17013
- offset: -5,
17014
- style: {
17015
- fontSize: 12,
17016
- fill: "hsl(var(--muted-foreground))",
17017
- fontWeight: 500
17018
- }
17019
- } : void 0
17025
+ fill: "hsl(var(--muted-foreground))",
17026
+ fontWeight: 500
17020
17027
  }
17021
- ),
17022
- /* @__PURE__ */ jsx96(
17023
- YAxis,
17024
- {
17025
- yAxisId: "left",
17026
- width: yAxisTickWidth,
17027
- stroke: "hsl(var(--muted-foreground))",
17028
+ } : void 0
17029
+ }
17030
+ ),
17031
+ /* @__PURE__ */ jsx96(
17032
+ YAxis,
17033
+ {
17034
+ yAxisId: "left",
17035
+ width: yAxisTickWidth,
17036
+ stroke: "hsl(var(--muted-foreground))",
17037
+ fontSize: 12,
17038
+ tickLine: false,
17039
+ axisLine: false,
17040
+ tickFormatter: yTickFormatter,
17041
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17042
+ tickCount: 6,
17043
+ label: yAxisLabel ? {
17044
+ value: yAxisLabel,
17045
+ angle: -90,
17046
+ position: "left",
17047
+ dx: leftYAxisLabelDx,
17048
+ style: {
17028
17049
  fontSize: 12,
17029
- tickLine: false,
17030
- axisLine: false,
17031
- tickFormatter: yTickFormatter,
17032
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17033
- tickCount: 6,
17034
- label: yAxisLabel ? {
17035
- value: yAxisLabel,
17036
- angle: -90,
17037
- position: "left",
17038
- dx: leftYAxisLabelDx,
17039
- style: {
17040
- fontSize: 12,
17041
- fill: "hsl(var(--muted-foreground))",
17042
- fontWeight: 500,
17043
- textAnchor: "middle"
17044
- }
17045
- } : void 0
17046
- }
17047
- ),
17048
- minLeftDataValue < 0 && /* @__PURE__ */ jsx96(
17049
- ReferenceLine,
17050
- {
17051
- y: 0,
17052
- yAxisId: "left",
17053
- stroke: "hsl(var(--muted-foreground))",
17054
- strokeWidth: 1,
17055
- strokeDasharray: "4 4"
17050
+ fill: "hsl(var(--muted-foreground))",
17051
+ fontWeight: 500,
17052
+ textAnchor: "middle"
17056
17053
  }
17057
- ),
17058
- rightKeys.length > 0 && (() => {
17059
- const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
17060
- const rightTickFormatter = (v) => {
17061
- if (biaxialConfigNormalized?.percentage) {
17062
- const num = Number(String(v));
17063
- const nf = new Intl.NumberFormat("pt-BR", {
17064
- minimumFractionDigits: decimals,
17065
- maximumFractionDigits: decimals
17066
- });
17067
- const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
17068
- return `${out}%`;
17069
- }
17070
- return yTickFormatter(v);
17071
- };
17072
- const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
17073
- const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
17074
- const rightAxisColor = (() => {
17075
- if (!biaxialConfigNormalized) return defaultRightColor;
17076
- if (typeof biaxialConfigNormalized.stroke === "string")
17077
- return biaxialConfigNormalized.stroke;
17078
- if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
17079
- return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
17080
- return defaultRightColor;
17081
- })();
17082
- return /* @__PURE__ */ jsx96(
17083
- YAxis,
17084
- {
17085
- yAxisId: "right",
17086
- width: finalChartRightMargin,
17087
- orientation: "right",
17088
- stroke: "hsl(var(--muted-foreground))",
17054
+ } : void 0
17055
+ }
17056
+ ),
17057
+ minLeftDataValue < 0 && /* @__PURE__ */ jsx96(
17058
+ ReferenceLine,
17059
+ {
17060
+ y: 0,
17061
+ yAxisId: "left",
17062
+ stroke: "hsl(var(--muted-foreground))",
17063
+ strokeWidth: 1,
17064
+ strokeDasharray: "4 4"
17065
+ }
17066
+ ),
17067
+ rightKeys.length > 0 && (() => {
17068
+ const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
17069
+ const rightTickFormatter = (v) => {
17070
+ if (biaxialConfigNormalized?.percentage) {
17071
+ const num = Number(String(v));
17072
+ const nf = new Intl.NumberFormat("pt-BR", {
17073
+ minimumFractionDigits: decimals,
17074
+ maximumFractionDigits: decimals
17075
+ });
17076
+ const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
17077
+ return `${out}%`;
17078
+ }
17079
+ return yTickFormatter(v);
17080
+ };
17081
+ const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
17082
+ const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
17083
+ const rightAxisColor = (() => {
17084
+ if (!biaxialConfigNormalized) return defaultRightColor;
17085
+ if (typeof biaxialConfigNormalized.stroke === "string")
17086
+ return biaxialConfigNormalized.stroke;
17087
+ if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
17088
+ return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
17089
+ return defaultRightColor;
17090
+ })();
17091
+ return /* @__PURE__ */ jsx96(
17092
+ YAxis,
17093
+ {
17094
+ yAxisId: "right",
17095
+ width: finalChartRightMargin,
17096
+ orientation: "right",
17097
+ stroke: "hsl(var(--muted-foreground))",
17098
+ fontSize: 12,
17099
+ tickLine: false,
17100
+ axisLine: false,
17101
+ tick: { fill: rightAxisColor },
17102
+ tickFormatter: rightTickFormatter,
17103
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17104
+ tickCount: 6,
17105
+ label: biaxialConfigNormalized?.label ? {
17106
+ value: biaxialConfigNormalized.label,
17107
+ angle: -90,
17108
+ position: "right",
17109
+ dx: rightYAxisLabelDx,
17110
+ style: {
17089
17111
  fontSize: 12,
17090
- tickLine: false,
17091
- axisLine: false,
17092
- tick: { fill: rightAxisColor },
17093
- tickFormatter: rightTickFormatter,
17094
- domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17095
- tickCount: 6,
17096
- label: biaxialConfigNormalized?.label ? {
17097
- value: biaxialConfigNormalized.label,
17098
- angle: -90,
17099
- position: "right",
17100
- dx: rightYAxisLabelDx,
17101
- style: {
17102
- fontSize: 12,
17103
- fill: "hsl(var(--muted-foreground))",
17104
- fontWeight: 500,
17105
- textAnchor: "middle"
17106
- }
17107
- } : void 0
17112
+ fill: "hsl(var(--muted-foreground))",
17113
+ fontWeight: 500,
17114
+ textAnchor: "middle"
17108
17115
  }
17109
- );
17110
- })(),
17111
- showTooltip && /* @__PURE__ */ jsx96(
17112
- Tooltip,
17116
+ } : void 0
17117
+ }
17118
+ );
17119
+ })(),
17120
+ showTooltip && /* @__PURE__ */ jsx96(
17121
+ Tooltip,
17122
+ {
17123
+ content: showTooltipTotal ? /* @__PURE__ */ jsx96(
17124
+ TooltipWithTotal_default,
17113
17125
  {
17114
- content: showTooltipTotal ? /* @__PURE__ */ jsx96(
17115
- TooltipWithTotal_default,
17116
- {
17117
- finalColors,
17118
- valueFormatter: finalValueFormatter,
17119
- categoryFormatter,
17120
- periodLabel
17121
- }
17122
- ) : /* @__PURE__ */ jsx96(
17123
- TooltipSimple_default,
17124
- {
17125
- finalColors,
17126
- valueFormatter: finalValueFormatter,
17127
- categoryFormatter,
17128
- periodLabel
17129
- }
17130
- ),
17131
- cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17126
+ finalColors,
17127
+ valueFormatter: finalValueFormatter,
17128
+ categoryFormatter,
17129
+ periodLabel
17132
17130
  }
17133
- ),
17134
- showLegend && /* @__PURE__ */ jsx96(
17135
- Legend,
17131
+ ) : /* @__PURE__ */ jsx96(
17132
+ TooltipSimple_default,
17136
17133
  {
17137
- wrapperStyle: {
17138
- color: "hsl(var(--foreground))",
17139
- fontSize: "14px",
17140
- paddingTop: "8px",
17141
- letterSpacing: 0
17142
- },
17143
- formatter: (value) => {
17144
- const key = String(value);
17145
- const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17146
- const displayLabel = legendUppercase ? label.toUpperCase() : label;
17147
- return /* @__PURE__ */ jsx96("span", { style: { letterSpacing: 0 }, children: displayLabel });
17148
- }
17134
+ finalColors,
17135
+ valueFormatter: finalValueFormatter,
17136
+ categoryFormatter,
17137
+ periodLabel
17149
17138
  }
17150
17139
  ),
17151
- seriesOrder.map((s) => {
17152
- const key = s.key;
17153
- if (showOnlyHighlighted && !highlightedSeries.has(key))
17154
- return null;
17140
+ cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17141
+ }
17142
+ ),
17143
+ showLegend && /* @__PURE__ */ jsx96(
17144
+ Legend,
17145
+ {
17146
+ wrapperStyle: {
17147
+ color: "hsl(var(--foreground))",
17148
+ fontSize: "14px",
17149
+ paddingTop: "8px",
17150
+ letterSpacing: 0
17151
+ },
17152
+ formatter: (value) => {
17153
+ const key = String(value);
17155
17154
  const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17156
- let color = finalColors[key];
17157
- if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
17158
- if (typeof biaxialConfigNormalized.stroke === "string") {
17159
- color = biaxialConfigNormalized.stroke;
17160
- } else {
17161
- color = biaxialConfigNormalized.stroke[key] ?? color;
17162
- }
17163
- }
17164
- if (s.type === "bar") {
17165
- return /* @__PURE__ */ jsx96(
17166
- Bar,
17155
+ const displayLabel = legendUppercase ? label.toUpperCase() : label;
17156
+ return /* @__PURE__ */ jsx96("span", { className: "tracking-[0]", children: displayLabel });
17157
+ }
17158
+ }
17159
+ ),
17160
+ seriesOrder.map((s) => {
17161
+ const key = s.key;
17162
+ if (showOnlyHighlighted && !highlightedSeries.has(key))
17163
+ return null;
17164
+ const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17165
+ let color = finalColors[key];
17166
+ if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
17167
+ if (typeof biaxialConfigNormalized.stroke === "string") {
17168
+ color = biaxialConfigNormalized.stroke;
17169
+ } else {
17170
+ color = biaxialConfigNormalized.stroke[key] ?? color;
17171
+ }
17172
+ }
17173
+ if (s.type === "bar") {
17174
+ return /* @__PURE__ */ jsx96(
17175
+ Bar,
17176
+ {
17177
+ dataKey: key,
17178
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17179
+ name: label,
17180
+ fill: color,
17181
+ radius: [4, 4, 0, 0],
17182
+ onClick: handleBarClick,
17183
+ className: "cursor-pointer",
17184
+ style: { opacity: getSeriesOpacity(key) },
17185
+ activeBar: /* @__PURE__ */ jsx96(
17186
+ Rectangle,
17167
17187
  {
17168
- dataKey: key,
17169
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17170
- name: label,
17171
17188
  fill: color,
17172
- radius: [4, 4, 0, 0],
17173
- onClick: handleBarClick,
17174
- style: {
17175
- cursor: "pointer",
17176
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17177
- },
17178
- activeBar: /* @__PURE__ */ jsx96(
17179
- Rectangle,
17180
- {
17181
- fill: color,
17182
- stroke: color,
17183
- strokeWidth: 2,
17184
- opacity: 0.8
17185
- }
17186
- ),
17187
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17188
- LabelList,
17189
- {
17190
- dataKey: key,
17191
- content: (props) => {
17192
- const p = props;
17193
- const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
17194
- const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
17195
- const smallThreshold = 14;
17196
- const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
17197
- if (needsOutside) {
17198
- return null;
17199
- }
17200
- const inside = renderInsideBarLabel(
17201
- color,
17202
- finalValueFormatter
17203
- );
17204
- return inside(props);
17205
- },
17206
- offset: 0
17207
- }
17208
- ) : null
17209
- },
17210
- `bar-${key}`
17211
- );
17212
- }
17213
- if (s.type === "line") {
17214
- return /* @__PURE__ */ jsx96(
17215
- Line,
17216
- {
17217
- dataKey: key,
17218
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17219
- name: label,
17220
17189
  stroke: color,
17221
17190
  strokeWidth: 2,
17222
- dot: { r: 3 },
17223
- activeDot: { r: 6 },
17224
- onClick: handleSeriesClick,
17225
- style: {
17226
- cursor: "pointer",
17227
- pointerEvents: "all",
17228
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17229
- },
17230
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17231
- LabelList,
17232
- {
17233
- dataKey: key,
17234
- position: "top",
17235
- content: pillLabelRenderer_default(
17236
- color,
17237
- "filled",
17238
- finalValueFormatter
17239
- ),
17240
- offset: 14
17241
- }
17242
- ) : null
17243
- },
17244
- `line-${key}`
17245
- );
17246
- }
17247
- if (s.type === "area") {
17248
- return /* @__PURE__ */ jsx96(
17249
- Area,
17191
+ opacity: 0.8
17192
+ }
17193
+ ),
17194
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17195
+ LabelList,
17250
17196
  {
17251
- type: "monotone",
17252
17197
  dataKey: key,
17253
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17254
- name: label,
17255
- stroke: color,
17256
- fill: `url(#gradient-${key})`,
17257
- fillOpacity: 1,
17258
- strokeWidth: 2,
17259
- onClick: handleSeriesClick,
17260
- style: {
17261
- cursor: "pointer",
17262
- pointerEvents: "all",
17263
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17264
- },
17265
- activeDot: {
17266
- r: 6,
17267
- fill: color,
17268
- stroke: "hsl(var(--background))",
17269
- strokeWidth: 2
17270
- },
17271
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17272
- LabelList,
17273
- {
17274
- dataKey: key,
17275
- position: "top",
17276
- content: pillLabelRenderer_default(
17277
- color,
17278
- "soft",
17279
- finalValueFormatter
17280
- ),
17281
- offset: 12
17198
+ content: (props) => {
17199
+ const p = props;
17200
+ const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
17201
+ const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
17202
+ const smallThreshold = 14;
17203
+ const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
17204
+ if (needsOutside) {
17205
+ return null;
17282
17206
  }
17283
- ) : null
17284
- },
17285
- `area-${key}`
17286
- );
17287
- }
17288
- return null;
17289
- })
17290
- ]
17291
- }
17292
- ) }),
17293
- enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsx96(
17294
- DraggableTooltip_default,
17295
- {
17296
- id: tooltip.id,
17297
- data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17298
- position: tooltip.position,
17299
- title,
17300
- dataKeys: allKeys,
17301
- finalColors,
17302
- highlightedSeries,
17303
- toggleHighlight,
17304
- showOnlyHighlighted,
17305
- onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17306
- onPositionChange: onTooltipPositionChange,
17307
- periodLabel,
17308
- dataLabel: "Dados do Per\xEDodo",
17309
- valueFormatter: finalValueFormatter,
17310
- categoryFormatter,
17311
- globalTooltipCount: activeTooltips.length,
17312
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17313
- closeAllButtonPosition: "top-center",
17314
- closeAllButtonVariant: "floating"
17315
- },
17316
- tooltip.id
17317
- )),
17318
- enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ jsx96(
17319
- CloseAllButton_default,
17320
- {
17321
- count: activeTooltips.length,
17322
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17323
- position: "top-center",
17324
- variant: "floating"
17325
- }
17326
- )
17327
- ]
17328
- }
17329
- )
17207
+ const inside = renderInsideBarLabel(
17208
+ color,
17209
+ finalValueFormatter
17210
+ );
17211
+ return inside(props);
17212
+ },
17213
+ offset: 0
17214
+ }
17215
+ ) : null
17216
+ },
17217
+ `bar-${key}`
17218
+ );
17219
+ }
17220
+ if (s.type === "line") {
17221
+ return /* @__PURE__ */ jsx96(
17222
+ Line,
17223
+ {
17224
+ dataKey: key,
17225
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17226
+ name: label,
17227
+ stroke: color,
17228
+ strokeWidth: 2,
17229
+ dot: { r: 3 },
17230
+ activeDot: { r: 6 },
17231
+ onClick: handleSeriesClick,
17232
+ className: "cursor-pointer pointer-events-auto",
17233
+ style: { opacity: getSeriesOpacity(key) },
17234
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17235
+ LabelList,
17236
+ {
17237
+ dataKey: key,
17238
+ position: "top",
17239
+ content: pillLabelRenderer_default(
17240
+ color,
17241
+ "filled",
17242
+ finalValueFormatter
17243
+ ),
17244
+ offset: 14
17245
+ }
17246
+ ) : null
17247
+ },
17248
+ `line-${key}`
17249
+ );
17250
+ }
17251
+ if (s.type === "area") {
17252
+ return /* @__PURE__ */ jsx96(
17253
+ Area,
17254
+ {
17255
+ type: "monotone",
17256
+ dataKey: key,
17257
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17258
+ name: label,
17259
+ stroke: color,
17260
+ fill: `url(#gradient-${key})`,
17261
+ fillOpacity: 1,
17262
+ strokeWidth: 2,
17263
+ onClick: handleSeriesClick,
17264
+ className: "cursor-pointer pointer-events-auto",
17265
+ style: { opacity: getSeriesOpacity(key) },
17266
+ activeDot: {
17267
+ r: 6,
17268
+ fill: color,
17269
+ stroke: "hsl(var(--background))",
17270
+ strokeWidth: 2
17271
+ },
17272
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17273
+ LabelList,
17274
+ {
17275
+ dataKey: key,
17276
+ position: "top",
17277
+ content: pillLabelRenderer_default(
17278
+ color,
17279
+ "soft",
17280
+ finalValueFormatter
17281
+ ),
17282
+ offset: 12
17283
+ }
17284
+ ) : null
17285
+ },
17286
+ `area-${key}`
17287
+ );
17288
+ }
17289
+ return null;
17290
+ })
17291
+ ]
17292
+ }
17293
+ ) }),
17294
+ enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsx96(
17295
+ DraggableTooltip_default,
17296
+ {
17297
+ id: tooltip.id,
17298
+ data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17299
+ position: tooltip.position,
17300
+ title,
17301
+ dataKeys: allKeys,
17302
+ finalColors,
17303
+ highlightedSeries,
17304
+ toggleHighlight,
17305
+ showOnlyHighlighted,
17306
+ onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17307
+ onPositionChange: onTooltipPositionChange,
17308
+ periodLabel,
17309
+ dataLabel: "Dados do Per\xEDodo",
17310
+ valueFormatter: finalValueFormatter,
17311
+ categoryFormatter,
17312
+ globalTooltipCount: activeTooltips.length,
17313
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17314
+ closeAllButtonPosition: "top-center",
17315
+ closeAllButtonVariant: "floating"
17316
+ },
17317
+ tooltip.id
17318
+ )),
17319
+ enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ jsx96(
17320
+ CloseAllButton_default,
17321
+ {
17322
+ count: activeTooltips.length,
17323
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17324
+ position: "top-center",
17325
+ variant: "floating"
17326
+ }
17327
+ )
17328
+ ]
17330
17329
  }
17331
- );
17330
+ ) });
17332
17331
  };
17333
17332
  var Chart_default = Chart;
17334
17333
 
@@ -18711,28 +18710,40 @@ function Leaderboard({
18711
18710
  order: initialOrder = "desc",
18712
18711
  title = "LeaderBoard",
18713
18712
  className,
18714
- isLoading = false
18713
+ isLoading = false,
18714
+ legend
18715
18715
  }) {
18716
18716
  const [order, setOrder] = useState45(initialOrder);
18717
18717
  const mockData = [
18718
- { name: "Ana", percentage: 92 },
18719
- { name: "Bruno", percentage: 81 },
18720
- { name: "Carla", percentage: 74 },
18721
- { name: "Daniel", percentage: 68 },
18722
- { name: "Eduardo", percentage: 55 },
18723
- { name: "Fernanda", percentage: 44 },
18724
- { name: "Gabriela", percentage: 33 },
18725
- { name: "Heitor", percentage: 28 },
18726
- { name: "Isabela", percentage: 22 },
18727
- { name: "Jo\xE3o", percentage: 18 }
18718
+ { name: "Ana", value: 92 },
18719
+ { name: "Bruno", value: 81 },
18720
+ { name: "Carla", value: 74 },
18721
+ { name: "Daniel", value: 68 },
18722
+ { name: "Eduardo", value: 55 },
18723
+ { name: "Fernanda", value: 44 },
18724
+ { name: "Gabriela", value: 33 },
18725
+ { name: "Heitor", value: 28 },
18726
+ { name: "Isabela", value: 22 },
18727
+ { name: "Jo\xE3o", value: 18 }
18728
18728
  ];
18729
18729
  const data = items ?? mockData;
18730
- const sortedData = [...data].sort(
18731
- (a, b) => order === "desc" ? b.percentage - a.percentage : a.percentage - b.percentage
18732
- );
18733
- const getBadgeColor = (pct) => {
18734
- if (pct >= 75) return "red";
18735
- if (pct >= 25) return "yellow";
18730
+ const sortedData = [...data].sort((a, b) => {
18731
+ const aValue = typeof a.value === "string" ? parseFloat(a.value) || a.value : a.value;
18732
+ const bValue = typeof b.value === "string" ? parseFloat(b.value) || b.value : b.value;
18733
+ if (typeof aValue === "number" && typeof bValue === "number") {
18734
+ return order === "desc" ? bValue - aValue : aValue - bValue;
18735
+ }
18736
+ if (typeof aValue === "string" && typeof bValue === "string") {
18737
+ return order === "desc" ? bValue.localeCompare(aValue) : aValue.localeCompare(bValue);
18738
+ }
18739
+ if (typeof aValue === "number") return order === "desc" ? -1 : 1;
18740
+ return order === "desc" ? 1 : -1;
18741
+ });
18742
+ const getBadgeColor = (value) => {
18743
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
18744
+ if (isNaN(numValue)) return "green";
18745
+ if (numValue >= 75) return "red";
18746
+ if (numValue >= 25) return "yellow";
18736
18747
  return "green";
18737
18748
  };
18738
18749
  return /* @__PURE__ */ jsxs78(
@@ -18740,7 +18751,7 @@ function Leaderboard({
18740
18751
  {
18741
18752
  className: `border rounded-xl flex flex-col max-h-80 w-96 ${className}`,
18742
18753
  children: [
18743
- /* @__PURE__ */ jsxs78("div", { className: "flex items-center justify-between p-4 border-b flex-shrink-0 gap-3", children: [
18754
+ /* @__PURE__ */ jsxs78("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3", children: [
18744
18755
  /* @__PURE__ */ jsx100("h2", { className: "text-lg font-semibold px-1", children: title }),
18745
18756
  /* @__PURE__ */ jsx100(
18746
18757
  ButtonBase,
@@ -18759,33 +18770,36 @@ function Leaderboard({
18759
18770
  /* @__PURE__ */ jsx100(SkeletonBase, { className: "h-4 w-36" })
18760
18771
  ] }),
18761
18772
  /* @__PURE__ */ jsx100(SkeletonBase, { className: "h-6 w-12 rounded-full" })
18762
- ] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ jsx100("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ jsx100("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ jsx100("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ jsx100(
18763
- motion22.span,
18764
- {
18765
- initial: { opacity: 0, y: 10 },
18766
- animate: { opacity: 1, y: 0 },
18767
- transition: { delay: idx * 5e-3 },
18768
- children: /* @__PURE__ */ jsxs78("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
18769
- /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-3", children: [
18770
- /* @__PURE__ */ jsx100("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
18771
- /* @__PURE__ */ jsx100("span", { className: "font-medium", children: item.name })
18772
- ] }),
18773
- /* @__PURE__ */ jsxs78(
18774
- Badge,
18775
- {
18776
- color: getBadgeColor(item.percentage),
18777
- size: "md",
18778
- className: "font-bold",
18779
- children: [
18780
- item.percentage,
18781
- "%"
18782
- ]
18783
- }
18784
- )
18785
- ] })
18786
- },
18787
- idx
18788
- )) }) })
18773
+ ] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ jsx100("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ jsx100("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ jsxs78("div", { children: [
18774
+ /* @__PURE__ */ jsxs78("div", { className: "flex items-center justify-between py-2.5 px-4 border-b flex-shrink-0 gap-3 sticky top-0 bg-background", children: [
18775
+ /* @__PURE__ */ jsx100("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider pl-1", children: legend?.[0]?.[0] ?? "Participante" }),
18776
+ /* @__PURE__ */ jsx100("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider", children: legend?.[0]?.[1] ?? "Pontua\xE7\xE3o" })
18777
+ ] }),
18778
+ /* @__PURE__ */ jsx100("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ jsx100(
18779
+ motion22.span,
18780
+ {
18781
+ initial: { opacity: 0, y: 10 },
18782
+ animate: { opacity: 1, y: 0 },
18783
+ transition: { delay: idx * 5e-3 },
18784
+ children: /* @__PURE__ */ jsxs78("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
18785
+ /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-3", children: [
18786
+ /* @__PURE__ */ jsx100("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
18787
+ /* @__PURE__ */ jsx100("span", { className: "font-medium", children: item.name })
18788
+ ] }),
18789
+ /* @__PURE__ */ jsx100(
18790
+ Badge,
18791
+ {
18792
+ color: getBadgeColor(item.value),
18793
+ size: "md",
18794
+ className: "font-bold",
18795
+ children: item.value
18796
+ }
18797
+ )
18798
+ ] })
18799
+ },
18800
+ idx
18801
+ )) })
18802
+ ] }) })
18789
18803
  ]
18790
18804
  }
18791
18805
  );