@mlw-packages/react-components 1.8.4 → 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.js CHANGED
@@ -1021,18 +1021,12 @@ var DialogContentBase = React2.forwardRef(
1021
1021
  {
1022
1022
  ref,
1023
1023
  className: cn(
1024
- "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",
1024
+ "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",
1025
1025
  className
1026
1026
  ),
1027
1027
  "data-testid": dataTestId,
1028
1028
  ...props,
1029
- onWheel: (e) => {
1030
- try {
1031
- userOnWheel?.(e);
1032
- } finally {
1033
- e.stopPropagation();
1034
- }
1035
- },
1029
+ onWheel: userOnWheel,
1036
1030
  children: [
1037
1031
  children,
1038
1032
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(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: [
@@ -1349,7 +1343,7 @@ var ProgressBase = React5.forwardRef(
1349
1343
  default:
1350
1344
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col gap-1 w-full min-w-[150px]", children: [
1351
1345
  label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LabelBase_default, { className: "py-2", children: label }),
1352
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
1346
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1353
1347
  showValue && valuePosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-12 text-sm text-right font-extrabold", children: [
1354
1348
  Math.round(value || 0),
1355
1349
  "%"
@@ -1944,7 +1938,7 @@ var ModalContentBase = React9.forwardRef(
1944
1938
  ref,
1945
1939
  className: cn(
1946
1940
  "fixed z-50 grid w-full gap-4 border bg-background p-6 shadow-lg sm:rounded-lg max-h-[90dvh] overflow-auto",
1947
- "data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out",
1941
+ "data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out border-border",
1948
1942
  positionClass,
1949
1943
  sizeClass,
1950
1944
  className
@@ -2024,7 +2018,7 @@ var buttonVariantsBase = (0, import_class_variance_authority2.cva)(
2024
2018
  variant: {
2025
2019
  default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
2026
2020
  destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
2027
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:border-input dark:hover:bg-background/95",
2021
+ 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",
2028
2022
  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",
2029
2023
  secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
2030
2024
  ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
@@ -2380,6 +2374,11 @@ var PopoverContentBase = React13.forwardRef(
2380
2374
  className
2381
2375
  ),
2382
2376
  "data-testid": dataTestId,
2377
+ onInteractOutside: (event) => {
2378
+ props.onInteractOutside?.(event);
2379
+ if (event.defaultPrevented) return;
2380
+ event.stopPropagation();
2381
+ },
2383
2382
  ...props
2384
2383
  }
2385
2384
  ) })
@@ -2441,7 +2440,7 @@ function ComboboxBase({
2441
2440
  testIds = {},
2442
2441
  onClear,
2443
2442
  hasSelected = false,
2444
- hiddenClean = (node) => node
2443
+ hideClear = false
2445
2444
  }) {
2446
2445
  const [open, setOpen] = (0, import_react9.useState)(false);
2447
2446
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
@@ -2455,13 +2454,13 @@ function ComboboxBase({
2455
2454
  {
2456
2455
  open,
2457
2456
  onOpenChange: (v) => !disabled && setOpen(v),
2458
- modal: true,
2457
+ modal: false,
2459
2458
  children: [
2460
2459
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2461
2460
  PopoverTriggerBase,
2462
2461
  {
2463
2462
  asChild: true,
2464
- className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)]",
2463
+ className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)] p-3",
2465
2464
  children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2466
2465
  ButtonBase,
2467
2466
  {
@@ -2479,19 +2478,17 @@ function ComboboxBase({
2479
2478
  children: [
2480
2479
  renderSelected,
2481
2480
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_framer_motion2.motion.span, { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-row gap-0 items-center ", children: [
2482
- hasSelected && onClear && !disabled && hiddenClean(
2483
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2484
- ClearButton,
2485
- {
2486
- onClick: (e) => {
2487
- if (e) e.stopPropagation();
2488
- if (onClear && !disabled) {
2489
- onClear();
2490
- if (!keepOpen) setOpen(false);
2491
- }
2481
+ hasSelected && onClear && !disabled && !hideClear && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2482
+ ClearButton,
2483
+ {
2484
+ onClick: (e) => {
2485
+ if (e) e.stopPropagation();
2486
+ if (onClear && !disabled) {
2487
+ onClear();
2488
+ if (!keepOpen) setOpen(false);
2492
2489
  }
2493
2490
  }
2494
- )
2491
+ }
2495
2492
  ),
2496
2493
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2497
2494
  import_framer_motion2.motion.div,
@@ -2607,7 +2604,8 @@ function Combobox({
2607
2604
  label,
2608
2605
  labelClassname,
2609
2606
  testIds,
2610
- error
2607
+ error,
2608
+ hideClear = false
2611
2609
  }) {
2612
2610
  const selectedItem = items.find((item) => item.value === selected);
2613
2611
  const renderSelected = (0, import_react11.useMemo)(() => {
@@ -2653,7 +2651,8 @@ function Combobox({
2653
2651
  testIds,
2654
2652
  onClear: handleClear,
2655
2653
  isMulti: false,
2656
- hasSelected: !!selectedItem
2654
+ hasSelected: !!selectedItem,
2655
+ hideClear
2657
2656
  }
2658
2657
  )
2659
2658
  ] });
@@ -2728,14 +2727,19 @@ function MultiSelectBase({
2728
2727
  onValuesChange,
2729
2728
  disabled,
2730
2729
  empty,
2731
- error
2730
+ error,
2731
+ initialItems
2732
2732
  }) {
2733
2733
  const [open, setOpen] = (0, import_react13.useState)(false);
2734
2734
  const [internalValues, setInternalValues] = (0, import_react13.useState)(
2735
2735
  new Set(values ?? defaultValues)
2736
2736
  );
2737
2737
  const selectedValues = values ? new Set(values) : internalValues;
2738
- const [items, setItems] = (0, import_react13.useState)(/* @__PURE__ */ new Map());
2738
+ const [items, setItems] = (0, import_react13.useState)(() => {
2739
+ if (!initialItems) return /* @__PURE__ */ new Map();
2740
+ if (initialItems instanceof Map) return new Map(initialItems);
2741
+ return new Map(initialItems.map((it) => [it.value, it.label]));
2742
+ });
2739
2743
  function toggleValue(value) {
2740
2744
  if (disabled) return;
2741
2745
  const getNewSet = (prev) => {
@@ -2951,41 +2955,48 @@ function MultiSelectContentBase({
2951
2955
  ...props
2952
2956
  }) {
2953
2957
  const canSearch = typeof search === "object" ? true : search;
2954
- const { emptyMessage, items } = useMultiSelectContext();
2955
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(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__ */ (0, import_jsx_runtime20.jsx)(
2956
- import_framer_motion3.motion.div,
2958
+ const { emptyMessage, items, open } = useMultiSelectContext();
2959
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2960
+ PopoverContentBase,
2957
2961
  {
2958
- initial: { opacity: 0, scale: 0.95 },
2959
- animate: { opacity: 1, scale: 1 },
2960
- exit: { opacity: 0, scale: 0.95 },
2961
- transition: { duration: 0.2 },
2962
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn(" "), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2963
- CommandBase,
2962
+ forceMount: true,
2963
+ 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",
2964
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2965
+ import_framer_motion3.motion.div,
2964
2966
  {
2965
- ...props,
2966
- filter: (value, search2) => {
2967
- const labelNode = items.get(value);
2968
- const label = typeof labelNode === "string" ? labelNode : value;
2969
- if (label.toLowerCase().includes(search2.toLowerCase()))
2970
- return 1;
2971
- return 0;
2972
- },
2973
- children: [
2974
- canSearch ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2975
- CommandInputBase,
2976
- {
2977
- placeholder: typeof search === "object" ? search.placeholder : void 0
2978
- }
2979
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { autoFocus: true, className: "sr-only" }),
2980
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(CommandListBase, { children: [
2981
- canSearch && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
2982
- children
2983
- ] })
2984
- ]
2967
+ initial: { opacity: 0, scale: 0.95 },
2968
+ animate: { opacity: open ? 1 : 0, scale: open ? 1 : 0.95 },
2969
+ transition: { duration: 0.2 },
2970
+ style: { pointerEvents: open ? "auto" : "none" },
2971
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn(" "), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2972
+ CommandBase,
2973
+ {
2974
+ ...props,
2975
+ filter: (value, search2) => {
2976
+ const labelNode = items.get(value);
2977
+ const label = typeof labelNode === "string" ? labelNode : value;
2978
+ if (label.toLowerCase().includes(search2.toLowerCase()))
2979
+ return 1;
2980
+ return 0;
2981
+ },
2982
+ children: [
2983
+ canSearch ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2984
+ CommandInputBase,
2985
+ {
2986
+ placeholder: typeof search === "object" ? search.placeholder : void 0
2987
+ }
2988
+ ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { autoFocus: true, className: "sr-only" }),
2989
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(CommandListBase, { children: [
2990
+ canSearch && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
2991
+ children
2992
+ ] })
2993
+ ]
2994
+ }
2995
+ ) })
2985
2996
  }
2986
- ) })
2997
+ )
2987
2998
  }
2988
- ) }) });
2999
+ ) });
2989
3000
  }
2990
3001
  function MultiSelectItemBase({
2991
3002
  value,
@@ -3087,6 +3098,7 @@ function MultiCombobox({
3087
3098
  disabled,
3088
3099
  empty,
3089
3100
  error,
3101
+ initialItems: items,
3090
3102
  children: [
3091
3103
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3092
3104
  MultiSelectTriggerBase,
@@ -3208,6 +3220,11 @@ var SelectContentBase = React14.forwardRef(
3208
3220
  ),
3209
3221
  position,
3210
3222
  "data-testid": dataTestId,
3223
+ onPointerDownOutside: (event) => {
3224
+ props.onPointerDownOutside?.(event);
3225
+ if (event.defaultPrevented) return;
3226
+ event.stopPropagation();
3227
+ },
3211
3228
  ...props,
3212
3229
  asChild: true,
3213
3230
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -3356,7 +3373,7 @@ var DropDownMenuContentBase = React15.forwardRef(
3356
3373
  exit: { opacity: 0, scale: 0.95, y: 5 },
3357
3374
  transition: { duration: 0.2, ease: "easeOut" },
3358
3375
  className: cn(
3359
- "min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
3376
+ "min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border",
3360
3377
  className
3361
3378
  ),
3362
3379
  children: props.children
@@ -3540,35 +3557,13 @@ function ModeToggleBase({
3540
3557
  setTheme(newTheme);
3541
3558
  return;
3542
3559
  }
3543
- const button = buttonRef.current;
3544
- const rect = button.getBoundingClientRect();
3560
+ const rect = buttonRef.current.getBoundingClientRect();
3545
3561
  const x = rect.left + rect.width / 2;
3546
3562
  const y = rect.top + rect.height / 2;
3547
3563
  const endRadius = Math.hypot(
3548
3564
  Math.max(x, window.innerWidth - x),
3549
3565
  Math.max(y, window.innerHeight - y)
3550
3566
  );
3551
- const styleId = "theme-transition-styles";
3552
- if (!document.getElementById(styleId)) {
3553
- const style = document.createElement("style");
3554
- style.id = styleId;
3555
- style.textContent = `
3556
- ::view-transition-old(root),
3557
- ::view-transition-new(root) {
3558
- animation: none;
3559
- mix-blend-mode: normal;
3560
- }
3561
-
3562
- ::view-transition-old(root) {
3563
- z-index: 1;
3564
- }
3565
-
3566
- ::view-transition-new(root) {
3567
- z-index: 2;
3568
- }
3569
- `;
3570
- document.head.appendChild(style);
3571
- }
3572
3567
  const transition = document.startViewTransition(async () => {
3573
3568
  setTheme(newTheme);
3574
3569
  });
@@ -3576,14 +3571,14 @@ function ModeToggleBase({
3576
3571
  document.documentElement.animate(
3577
3572
  [
3578
3573
  {
3579
- clipPath: `circle(0% at ${x}px ${y}px)`
3574
+ clipPath: `circle(0px at ${x}px ${y}px)`
3580
3575
  },
3581
3576
  {
3582
3577
  clipPath: `circle(${Math.ceil(endRadius)}px at ${x}px ${y}px)`
3583
3578
  }
3584
3579
  ],
3585
3580
  {
3586
- duration: 600,
3581
+ duration: 400,
3587
3582
  easing: "cubic-bezier(0.4, 0, 0.2, 1)",
3588
3583
  pseudoElement: "::view-transition-new(root)"
3589
3584
  }
@@ -3743,7 +3738,7 @@ var CardBase = React17.forwardRef(({ className, testid: dataTestId = "card-base"
3743
3738
  {
3744
3739
  ref,
3745
3740
  className: cn(
3746
- "rounded-xl border bg-card text-card-foreground shadow",
3741
+ "rounded-xl border border-border bg-card text-card-foreground shadow",
3747
3742
  className
3748
3743
  ),
3749
3744
  "data-testid": dataTestId,
@@ -7911,7 +7906,7 @@ function CalendarBase2({
7911
7906
  "div",
7912
7907
  {
7913
7908
  className: cn(
7914
- "rounded-md border bg-background p-3 overflow-hidden flex flex-col",
7909
+ "rounded-md border p-3 overflow-hidden flex flex-col",
7915
7910
  className
7916
7911
  ),
7917
7912
  children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
@@ -7932,12 +7927,12 @@ function CalendarBase2({
7932
7927
  button_previous: cn(
7933
7928
  buttonVariantsBase({ variant: "outline" }),
7934
7929
  "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",
7935
- isMobile ? "mr-8" : ""
7930
+ isMobile ? "" : ""
7936
7931
  ),
7937
7932
  button_next: cn(
7938
7933
  buttonVariantsBase({ variant: "outline" }),
7939
7934
  "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",
7940
- isMobile ? "mr-8" : ""
7935
+ isMobile ? "" : ""
7941
7936
  ),
7942
7937
  month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
7943
7938
  weekdays: "grid grid-cols-7 gap-1 mb-1",
@@ -7957,8 +7952,8 @@ function CalendarBase2({
7957
7952
  ),
7958
7953
  selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white rounded-md",
7959
7954
  today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
7960
- outside: "text-muted-foreground/40 opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
7961
- disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
7955
+ outside: "text-muted-foreground opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
7956
+ disabled: "text-muted-foreground cursor-not-allowed line-through decoration-2",
7962
7957
  range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
7963
7958
  hidden: "invisible",
7964
7959
  ...classNames
@@ -7988,29 +7983,19 @@ var import_react46 = require("@phosphor-icons/react");
7988
7983
  // src/components/ui/picker/TimeScrollPicker.tsx
7989
7984
  var import_react43 = require("react");
7990
7985
  var import_jsx_runtime58 = require("react/jsx-runtime");
7991
- var ITEM_HEIGHT = 39;
7992
- var ITEM_HEIGHT_MOBILE = 32;
7986
+ var ITEM_HEIGHT = 38.5;
7993
7987
  var VISIBLE_ITEMS = 5;
7994
- var VISIBLE_ITEMS_MOBILE = 3;
7995
7988
  var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
7996
- var CENTER_INDEX_MOBILE = Math.floor(VISIBLE_ITEMS_MOBILE / 2);
7997
- function ScrollColumn({
7998
- value,
7999
- onChange,
8000
- max,
8001
- label,
8002
- hideSeconds
8003
- }) {
8004
- const isMobile = useIsMobile();
7989
+ function ScrollColumn({ value, onChange, max, label }) {
8005
7990
  const containerRef = (0, import_react43.useRef)(null);
8006
7991
  const items = Array.from({ length: max }, (_, i) => i);
8007
7992
  const [isDragging, setIsDragging] = (0, import_react43.useState)(false);
8008
7993
  const [startY, setStartY] = (0, import_react43.useState)(0);
8009
7994
  const [scrollTop, setScrollTop] = (0, import_react43.useState)(0);
8010
7995
  const scrollTimeoutRef = (0, import_react43.useRef)(null);
8011
- const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
8012
- const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
8013
- const visibleItems = isMobile ? VISIBLE_ITEMS_MOBILE : VISIBLE_ITEMS;
7996
+ const itemHeight = ITEM_HEIGHT;
7997
+ const centerIndex = CENTER_INDEX;
7998
+ const visibleItems = VISIBLE_ITEMS;
8014
7999
  const containerHeight = visibleItems * itemHeight;
8015
8000
  (0, import_react43.useEffect)(() => {
8016
8001
  if (containerRef.current && !isDragging) {
@@ -8029,7 +8014,9 @@ function ScrollColumn({
8029
8014
  }
8030
8015
  };
8031
8016
  }, []);
8032
- const handleScroll = () => {
8017
+ const handleScroll = (e) => {
8018
+ e.stopPropagation();
8019
+ e.preventDefault();
8033
8020
  if (!containerRef.current || isDragging) return;
8034
8021
  if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
8035
8022
  scrollTimeoutRef.current = setTimeout(() => {
@@ -8067,15 +8054,18 @@ function ScrollColumn({
8067
8054
  const handleMouseLeave = () => {
8068
8055
  if (isDragging) handleMouseUp();
8069
8056
  };
8070
- const containerWidth = isMobile ? hideSeconds ? "w-16" : "w-8" : "w-16";
8071
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-col items-center gap-1", children: [
8072
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-muted-foreground rounded-md font-semibold text-[clamp(0.575rem,1.2vw,0.75rem)] sm:text-[clamp(0.65rem,1.1vw,0.825rem)] text-center pb-1 uppercase tracking-wider", children: label }),
8073
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: cn("relative", containerWidth), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
8057
+ const handleWheel = (e) => {
8058
+ e.stopPropagation();
8059
+ };
8060
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-col items-center", children: [
8061
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-muted-foreground rounded-md font-semibold text-sm sm:text-sm text-center pb-2 uppercase tracking-wider", children: label }),
8062
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: cn("relative w-20 sm:w-16"), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
8074
8063
  "div",
8075
8064
  {
8076
8065
  ref: containerRef,
8077
- className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
8066
+ className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] touch-action-pan-y",
8078
8067
  onScroll: handleScroll,
8068
+ onWheel: handleWheel,
8079
8069
  onMouseDown: handleMouseDown,
8080
8070
  onMouseMove: handleMouseMove,
8081
8071
  onMouseUp: handleMouseUp,
@@ -8092,9 +8082,9 @@ function ScrollColumn({
8092
8082
  "div",
8093
8083
  {
8094
8084
  className: cn(
8095
- "flex items-center justify-center select-none font-semibold tabular-nums",
8085
+ "flex items-center justify-center select-none font-semibold tabular-nums transition-all duration-150",
8096
8086
  isDragging ? "cursor-grabbing" : "",
8097
- isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
8087
+ isSelected ? "text-lg sm:text-xl text-foreground scale-110" : "text-sm sm:text-base text-muted-foreground opacity-60"
8098
8088
  ),
8099
8089
  style: { height: `${itemHeight}px` },
8100
8090
  onClick: () => !isDragging && onChange(item),
@@ -8112,10 +8102,9 @@ function TimeScrollPicker({
8112
8102
  setDate,
8113
8103
  hideSeconds = false
8114
8104
  }) {
8115
- const isMobile = useIsMobile();
8116
8105
  const currentDate = date || /* @__PURE__ */ new Date();
8117
- const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
8118
- const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
8106
+ const itemHeight = ITEM_HEIGHT;
8107
+ const centerIndex = CENTER_INDEX;
8119
8108
  const handleTimeChange = (type, value) => {
8120
8109
  const newDate = new Date(currentDate);
8121
8110
  if (type === "hours") newDate.setHours(value);
@@ -8123,13 +8112,13 @@ function TimeScrollPicker({
8123
8112
  else newDate.setSeconds(value);
8124
8113
  setDate(newDate);
8125
8114
  };
8126
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: cn("relative flex gap-2"), children: [
8115
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center justify-center gap-2 p-3 sm:p-4", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: cn("relative flex gap-4 sm:gap-3"), children: [
8127
8116
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
8128
8117
  "div",
8129
8118
  {
8130
- className: "absolute left-0 right-0 pointer-events-none z-10 rounded-md bg-primary/5",
8119
+ className: "absolute left-0 right-0 pointer-events-none z-10 rounded-lg bg-primary/10 border border-primary/20",
8131
8120
  style: {
8132
- top: `calc(1.75rem + ${centerIndex * itemHeight}px)`,
8121
+ top: `calc(1.85rem + ${centerIndex * itemHeight}px)`,
8133
8122
  height: `${itemHeight}px`
8134
8123
  }
8135
8124
  }
@@ -8217,12 +8206,17 @@ function DateTimePicker({
8217
8206
  }) {
8218
8207
  const [internalDate, setInternalDate] = (0, import_react45.useState)(date);
8219
8208
  const [open, setOpen] = (0, import_react45.useState)(false);
8209
+ const [activeTab, setActiveTab] = (0, import_react45.useState)("calendar");
8220
8210
  const isMobile = useIsMobile();
8221
8211
  const handleSelect = (newDay) => {
8222
8212
  if (!newDay) return;
8223
8213
  if (!internalDate) {
8224
8214
  const now = /* @__PURE__ */ new Date();
8225
- newDay.setHours(now.getHours(), now.getMinutes(), now.getSeconds());
8215
+ newDay.setUTCHours(
8216
+ now.getUTCHours(),
8217
+ now.getUTCMinutes(),
8218
+ now.getUTCSeconds()
8219
+ );
8226
8220
  setInternalDate(newDay);
8227
8221
  onChange?.(newDay);
8228
8222
  return;
@@ -8235,7 +8229,6 @@ function DateTimePicker({
8235
8229
  };
8236
8230
  const handleTimeChange = (newDate) => {
8237
8231
  setInternalDate(newDate);
8238
- onChange?.(newDate);
8239
8232
  };
8240
8233
  const getTimeFormat = () => {
8241
8234
  if (hideTime) return "";
@@ -8252,6 +8245,9 @@ function DateTimePicker({
8252
8245
  };
8253
8246
  (0, import_react45.useEffect)(() => {
8254
8247
  setInternalDate(date);
8248
+ if (open) {
8249
+ setActiveTab("calendar");
8250
+ }
8255
8251
  }, [date, open]);
8256
8252
  const { ref: contentRef, center } = use_auto_center_default(open);
8257
8253
  const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none";
@@ -8291,12 +8287,55 @@ function DateTimePicker({
8291
8287
  ]
8292
8288
  }
8293
8289
  );
8294
- const renderPickerContent = () => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "p-3 border rounded-md", children: [
8295
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
8290
+ const renderPickerContent = () => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "p-2 sm:p-3 border border-border rounded-md", children: [
8291
+ isMobile && !hideTime ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "min-h-[380px] max-h-[calc(400px)]", children: [
8292
+ internalDate && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex items-center gap-3 px-4 py-3 rounded-lg ", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "text-md font-semibold", children: [
8293
+ (0, import_date_fns.format)(internalDate, "dd 'de' MMMM 'de' yyyy", {
8294
+ locale: import_locale2.ptBR
8295
+ }),
8296
+ " ",
8297
+ "- ",
8298
+ (0, import_date_fns.format)(internalDate, hideSeconds ? "HH:mm" : "HH:mm:ss")
8299
+ ] }) }),
8300
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(TabsBase, { value: activeTab, onValueChange: setActiveTab, children: [
8301
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(TabsListBase, { className: "", children: [
8302
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TabsTriggerBase, { value: "calendar", className: "flex-1", children: "Data" }),
8303
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TabsTriggerBase, { value: "time", className: "flex-1", children: "Hor\xE1rio" })
8304
+ ] }),
8305
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TabsContentBase, { value: "calendar", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8306
+ CalendarBase2,
8307
+ {
8308
+ mode: "single",
8309
+ locale: import_locale2.ptBR,
8310
+ selected: internalDate ?? void 0,
8311
+ onSelect: (d) => handleSelect(d ?? null),
8312
+ autoFocus: true,
8313
+ defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
8314
+ ...fromDate && { startMonth: fromDate },
8315
+ ...toDate && { endMonth: toDate },
8316
+ ...fromDate || toDate ? {
8317
+ disabled: [
8318
+ ...fromDate ? [{ before: fromDate }] : [],
8319
+ ...toDate ? [{ after: toDate }] : []
8320
+ ]
8321
+ } : {},
8322
+ className: cn("w-full rounded-none border-none")
8323
+ }
8324
+ ) }),
8325
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex flex-col items-center justify-center gap-4 py-2 min-h-[330px]", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8326
+ TimeScrollPicker,
8327
+ {
8328
+ setDate: (d) => handleTimeChange(d ?? null),
8329
+ date: internalDate,
8330
+ hideSeconds
8331
+ }
8332
+ ) }) })
8333
+ ] })
8334
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
8296
8335
  "div",
8297
8336
  {
8298
8337
  ref: contentRef,
8299
- className: "flex sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
8338
+ className: "flex flex-col sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
8300
8339
  children: [
8301
8340
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8302
8341
  CalendarBase2,
@@ -8310,15 +8349,14 @@ function DateTimePicker({
8310
8349
  ...fromDate && { startMonth: fromDate },
8311
8350
  ...toDate && { endMonth: toDate },
8312
8351
  ...fromDate || toDate ? {
8313
- hidden: [
8352
+ disabled: [
8314
8353
  ...fromDate ? [{ before: fromDate }] : [],
8315
8354
  ...toDate ? [{ after: toDate }] : []
8316
8355
  ]
8317
8356
  } : {},
8318
8357
  className: cn(
8319
8358
  "w-max rounded-none border-none",
8320
- !hideTime && "sm:rounded-r-none rounded-b-none",
8321
- isMobile ? "border-b-transparent w-full" : ""
8359
+ !hideTime && "sm:rounded-r-none"
8322
8360
  )
8323
8361
  }
8324
8362
  ),
@@ -8327,7 +8365,7 @@ function DateTimePicker({
8327
8365
  {
8328
8366
  className: cn(
8329
8367
  "flex flex-col items-center justify-center",
8330
- isMobile ? "border-none" : "border-l"
8368
+ "border-l"
8331
8369
  ),
8332
8370
  children: [
8333
8371
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize text-left", children: "Hor\xE1rio" }),
@@ -8345,60 +8383,61 @@ function DateTimePicker({
8345
8383
  ]
8346
8384
  }
8347
8385
  ),
8348
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex rounded-md p-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "grid grid-cols-2 w-full gap-12", children: [
8349
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center gap-2", children: [
8350
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8351
- ButtonBase,
8352
- {
8353
- variant: "outline",
8354
- size: "icon",
8355
- className: "no-active-animation",
8356
- tooltip: "Hoje",
8357
- onClick: () => {
8358
- const now = /* @__PURE__ */ new Date();
8359
- const selected = hideTime ? new Date(
8360
- now.getFullYear(),
8361
- now.getMonth(),
8362
- now.getDate(),
8386
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex rounded-md p-1.5 gap-2", children: [
8387
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8388
+ ButtonBase,
8389
+ {
8390
+ variant: "outline",
8391
+ className: "no-active-animation",
8392
+ tooltip: "Hoje",
8393
+ size: "icon",
8394
+ onClick: () => {
8395
+ const now = /* @__PURE__ */ new Date();
8396
+ const selected = hideTime ? new Date(
8397
+ Date.UTC(
8398
+ now.getUTCFullYear(),
8399
+ now.getUTCMonth(),
8400
+ now.getUTCDate(),
8363
8401
  0,
8364
8402
  0,
8365
8403
  0,
8366
8404
  0
8367
- ) : now;
8368
- setInternalDate(selected);
8369
- onChange?.(selected);
8370
- onConfirm?.(selected);
8371
- },
8372
- children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react46.CalendarDotIcon, { className: "h-4 w-4" })
8373
- }
8374
- ),
8405
+ )
8406
+ ) : now;
8407
+ setInternalDate(selected);
8408
+ onChange?.(selected);
8409
+ onConfirm?.(selected);
8410
+ },
8411
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react46.CalendarDotIcon, { className: "h-4 w-4" })
8412
+ }
8413
+ ),
8414
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "grid grid-cols-2 sm:flex-row w-full gap-2", children: [
8375
8415
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8376
8416
  ButtonBase,
8377
8417
  {
8378
- className: "no-active-animation rounded-md bg-background text-gray-800 border hover:bg-muted/50 overflow-y-hidden w-full",
8418
+ className: "no-active-animation rounded-md bg-background text-primary border hover:bg-muted/50 overflow-hidden flex-1 min-w-0 border-border",
8379
8419
  onClick: () => setOpen(false),
8380
8420
  children: "Cancelar"
8381
8421
  }
8422
+ ),
8423
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8424
+ ButtonBase,
8425
+ {
8426
+ className: cn(
8427
+ "no-active-animation rounded-md bg-emerald-600",
8428
+ internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed"
8429
+ ),
8430
+ disabled: !internalDate,
8431
+ onClick: () => {
8432
+ if (!internalDate) return;
8433
+ setOpen(false);
8434
+ onConfirm?.(internalDate);
8435
+ },
8436
+ children: "Confirmar"
8437
+ }
8382
8438
  )
8383
- ] }),
8384
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8385
- ButtonBase,
8386
- {
8387
- className: cn(
8388
- "no-active-animation rounded-none bg-emerald-600",
8389
- internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed",
8390
- isMobile ? "" : "rounded-md"
8391
- ),
8392
- disabled: !internalDate,
8393
- onClick: () => {
8394
- if (!internalDate) return;
8395
- setOpen(false);
8396
- onConfirm?.(internalDate);
8397
- },
8398
- children: "Confirmar"
8399
- }
8400
- )
8401
- ] }) })
8439
+ ] })
8440
+ ] })
8402
8441
  ] });
8403
8442
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: cn("w-full sm:w-auto", className), children: [
8404
8443
  label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(LabelBase_default, { children: label }),
@@ -8413,7 +8452,7 @@ function DateTimePicker({
8413
8452
  }
8414
8453
  ),
8415
8454
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ErrorMessage_default, { error }),
8416
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[90vh] overflow-hidden", children: renderPickerContent() })
8455
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[95vh] overflow-y-auto", children: renderPickerContent() })
8417
8456
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
8418
8457
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8419
8458
  PopoverTriggerBase,
@@ -8473,7 +8512,7 @@ function RangePicker({
8473
8512
  const { ref: contentRef, center } = use_auto_center_default(open);
8474
8513
  const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border shadow-none";
8475
8514
  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";
8476
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: cn("w-full sm:w-auto", className), children: [
8515
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: cn("w-full sm:w-auto ", className), children: [
8477
8516
  label && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(LabelBase_default, { children: label }),
8478
8517
  /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
8479
8518
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
@@ -8481,7 +8520,7 @@ function RangePicker({
8481
8520
  {
8482
8521
  disabled,
8483
8522
  asChild: true,
8484
- className: cn(error && "border-red-500"),
8523
+ className: cn(error && "border-red-500 "),
8485
8524
  children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
8486
8525
  ButtonBase,
8487
8526
  {
@@ -8504,17 +8543,25 @@ function RangePicker({
8504
8543
  })} - ${(0, import_date_fns2.format)(range.to, "P", { locale: dateFnsLocale })}` : "Selecione um intervalo"
8505
8544
  }
8506
8545
  ),
8507
- range && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
8508
- ClearButton,
8509
- {
8510
- className: "-mr-3",
8511
- onClick: (e) => {
8512
- e?.stopPropagation();
8513
- handleClear();
8546
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_framer_motion12.motion.span, { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-row gap-0 items-center ", children: [
8547
+ range && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
8548
+ ClearButton,
8549
+ {
8550
+ onClick: (e) => {
8551
+ e?.stopPropagation();
8552
+ handleClear();
8553
+ }
8514
8554
  }
8515
- }
8516
- ),
8517
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react47.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
8555
+ ),
8556
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
8557
+ import_framer_motion12.motion.div,
8558
+ {
8559
+ animate: { rotate: open ? 15 : 0 },
8560
+ transition: { duration: 0.03 },
8561
+ children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react47.CalendarBlankIcon, { className: "h-4 w-4" })
8562
+ }
8563
+ )
8564
+ ] }) })
8518
8565
  ]
8519
8566
  }
8520
8567
  )
@@ -8537,7 +8584,7 @@ function RangePicker({
8537
8584
  animate: { opacity: 1, y: 0 },
8538
8585
  exit: { opacity: 0, y: -4 },
8539
8586
  transition: { duration: 0.18, ease: "easeOut" },
8540
- className: "border rounded-md shadow-xl ",
8587
+ className: "border border-border rounded-md shadow-xl ",
8541
8588
  children: [
8542
8589
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
8543
8590
  import_framer_motion12.motion.div,
@@ -10266,7 +10313,7 @@ function Select({
10266
10313
  labelClassname,
10267
10314
  className,
10268
10315
  pagination,
10269
- hideClear = true
10316
+ hideClear = false
10270
10317
  }) {
10271
10318
  const [page, setPage] = (0, import_react57.useState)(1);
10272
10319
  const [animating, setAnimating] = (0, import_react57.useState)(false);
@@ -10338,7 +10385,7 @@ function Select({
10338
10385
  }
10339
10386
  ),
10340
10387
  /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_framer_motion14.motion.span, { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex flex-row gap-0 items-center ", children: [
10341
- hideClear && selected && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
10388
+ !hideClear && selected && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
10342
10389
  ClearButton,
10343
10390
  {
10344
10391
  onClick: () => {
@@ -10578,7 +10625,7 @@ function EventAgenda({
10578
10625
  "div",
10579
10626
  {
10580
10627
  className: cn(
10581
- "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2",
10628
+ "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2 border-border",
10582
10629
  className
10583
10630
  ),
10584
10631
  style: {
@@ -10623,7 +10670,8 @@ function EventAgenda({
10623
10670
  },
10624
10671
  items: selectItems,
10625
10672
  className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
10626
- placeholder: viewLabel(view)
10673
+ placeholder: viewLabel(view),
10674
+ hideClear: true
10627
10675
  }
10628
10676
  ) })
10629
10677
  ] }),
@@ -14383,6 +14431,12 @@ function MultiSelect({
14383
14431
  const id = setTimeout(() => setAnimating(false), 220);
14384
14432
  return () => clearTimeout(id);
14385
14433
  }, [page, pagination]);
14434
+ const initialItems = (0, import_react86.useMemo)(() => {
14435
+ if (groupItems) {
14436
+ return Object.values(groupItems).flat();
14437
+ }
14438
+ return items ?? [];
14439
+ }, [items, groupItems]);
14386
14440
  return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { "data-testid": testIds.root ?? "multiselect-root", children: [
14387
14441
  label && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(LabelBase_default, { className: labelClassname, children: label }),
14388
14442
  /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
@@ -14394,6 +14448,7 @@ function MultiSelect({
14394
14448
  disabled,
14395
14449
  empty,
14396
14450
  error,
14451
+ initialItems,
14397
14452
  children: [
14398
14453
  /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
14399
14454
  MultiSelectTriggerBase,
@@ -16902,9 +16957,11 @@ var Chart = ({
16902
16957
  setActiveTooltips
16903
16958
  }
16904
16959
  );
16905
- const titleClassName = (0, import_react96.useMemo)(
16906
- () => "text-[1.4rem] font-semibold text-foreground mb-3",
16907
- []
16960
+ const getSeriesOpacity = (0, import_react96.useCallback)(
16961
+ (key) => {
16962
+ return highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1;
16963
+ },
16964
+ [highlightedSeries]
16908
16965
  );
16909
16966
  const finalValueFormatter = (0, import_react96.useMemo)(
16910
16967
  () => createValueFormatter(valueFormatter2, formatBR),
@@ -16914,20 +16971,15 @@ var Chart = ({
16914
16971
  () => createYTickFormatter(finalValueFormatter),
16915
16972
  [finalValueFormatter]
16916
16973
  );
16917
- const finalEnableHighlights = enableHighlights;
16918
- const finalEnableShowOnly = enableShowOnly;
16919
- const finalEnablePeriodsDropdown = enablePeriodsDropdown && enableDraggableTooltips;
16920
- const defaultChartRightMargin = 30;
16921
- const defaultChartLeftMargin = 0;
16922
- const axisLabelMargin = 56;
16923
- const containerPaddingLeft = -6;
16924
- const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
16925
- const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
16974
+ const AXIS_LABEL_MARGIN = 56;
16975
+ const CONTAINER_PADDING_LEFT = -6;
16976
+ const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
16977
+ const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
16926
16978
  const yAxisTickWidth = (0, import_react96.useMemo)(
16927
16979
  () => computeYAxisTickWidth(
16928
16980
  chartMargin?.left,
16929
16981
  yAxisLabel,
16930
- axisLabelMargin,
16982
+ AXIS_LABEL_MARGIN,
16931
16983
  yTickFormatter,
16932
16984
  minLeftDataValue,
16933
16985
  niceMaxLeft
@@ -16940,16 +16992,10 @@ var Chart = ({
16940
16992
  niceMaxLeft
16941
16993
  ]
16942
16994
  );
16943
- const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
16944
- const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
16945
16995
  const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
16946
- const baseBottom = chartMargin?.bottom ?? 5;
16947
- const extraForXAxisLabel = xAxisLabel ? 22 : 0;
16948
- const extraForLegend = showLegend ? 36 : 0;
16949
- const finalChartBottomMargin = baseBottom + extraForXAxisLabel + extraForLegend;
16950
- const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
16951
- const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
16952
- const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
16996
+ const finalChartBottomMargin = (chartMargin?.bottom ?? 5) + (xAxisLabel ? 22 : 0) + (showLegend ? 36 : 0);
16997
+ const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
16998
+ const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
16953
16999
  const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
16954
17000
  const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
16955
17001
  const openTooltipForPeriod = (0, import_react96.useCallback)(
@@ -16969,7 +17015,7 @@ var Chart = ({
16969
17015
  );
16970
17016
  }
16971
17017
  const offsetIndex = activeTooltips.length;
16972
- const availableWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
17018
+ const availableWidth = effectiveChartWidth;
16973
17019
  const gap = 28;
16974
17020
  const leftGap = 28;
16975
17021
  const newTooltip = {
@@ -16989,9 +17035,7 @@ var Chart = ({
16989
17035
  enableDraggableTooltips,
16990
17036
  processedData,
16991
17037
  activeTooltips,
16992
- width,
16993
- measuredInner,
16994
- computedWidth,
17038
+ effectiveChartWidth,
16995
17039
  maxTooltips,
16996
17040
  setActiveTooltips
16997
17041
  ]
@@ -17004,7 +17048,7 @@ var Chart = ({
17004
17048
  title,
17005
17049
  isLoading: true,
17006
17050
  loadingMessage: typeof title === "string" ? `${title} \u2014 Carregando` : "Carregando",
17007
- paddingLeft: containerPaddingLeft + finalChartLeftMargin,
17051
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17008
17052
  height
17009
17053
  }
17010
17054
  );
@@ -17014,493 +17058,448 @@ var Chart = ({
17014
17058
  NoData_default,
17015
17059
  {
17016
17060
  title,
17017
- paddingLeft: containerPaddingLeft + finalChartLeftMargin,
17061
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17018
17062
  height
17019
17063
  }
17020
17064
  );
17021
17065
  }
17022
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17066
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { ref: wrapperRef, className: "w-full overflow-hidden min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17023
17067
  "div",
17024
17068
  {
17025
- ref: wrapperRef,
17026
- style: {
17027
- width: "100%",
17028
- overflowX: "hidden",
17029
- overflowY: "hidden",
17030
- minWidth: 0
17031
- },
17032
- children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17033
- "div",
17034
- {
17035
- className: cn("rounded-lg bg-card relative", className),
17036
- style: { width: "100%", maxWidth: "100%", minWidth: 0 },
17037
- children: [
17038
- title && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17039
- "div",
17040
- {
17041
- style: {
17042
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
17043
- width: "100%",
17044
- display: "flex",
17045
- justifyContent: titlePosition === "center" ? "center" : titlePosition === "right" ? "flex-end" : "flex-start",
17046
- alignItems: "center",
17047
- marginTop: "19px"
17048
- },
17049
- children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: titleClassName, children: title })
17050
- }
17069
+ className: cn(
17070
+ "rounded-lg bg-card relative w-full max-w-full min-w-0",
17071
+ className
17072
+ ),
17073
+ children: [
17074
+ title && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17075
+ "div",
17076
+ {
17077
+ className: cn(
17078
+ "w-full flex items-center mt-[19px] ml-[90px]",
17079
+ titlePosition === "center" && "justify-center",
17080
+ titlePosition === "right" && "justify-end",
17081
+ titlePosition === "left" && "justify-start"
17051
17082
  ),
17052
- allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly) && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17053
- "div",
17083
+ children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "text-[1.4rem] font-semibold text-foreground mb-3", children: title })
17084
+ }
17085
+ ),
17086
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "flex items-center w-[98%] ml-[90px] gap-2", children: [
17087
+ enableHighlights && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17088
+ Highlights_default,
17089
+ {
17090
+ allKeys,
17091
+ mapperConfig,
17092
+ finalColors,
17093
+ highlightedSeries,
17094
+ toggleHighlight,
17095
+ containerWidth: chartInnerWidth
17096
+ }
17097
+ ),
17098
+ enableShowOnly && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17099
+ ShowOnly_default,
17100
+ {
17101
+ showOnlyHighlighted,
17102
+ setShowOnlyHighlighted,
17103
+ highlightedSeriesSize: highlightedSeries.size,
17104
+ clearHighlights
17105
+ }
17106
+ ),
17107
+ enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17108
+ PeriodsDropdown_default,
17109
+ {
17110
+ processedData,
17111
+ onOpenPeriod: openTooltipForPeriod,
17112
+ rightOffset: finalChartRightMargin,
17113
+ activePeriods
17114
+ }
17115
+ ) })
17116
+ ] }),
17117
+ !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17118
+ "div",
17119
+ {
17120
+ className: "w-full flex justify-end",
17121
+ style: {
17122
+ paddingLeft: `${CONTAINER_PADDING_LEFT + finalChartLeftMargin}px`,
17123
+ paddingRight: `${finalChartRightMargin}px`,
17124
+ maxWidth: `${chartInnerWidth}px`
17125
+ },
17126
+ children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17127
+ PeriodsDropdown_default,
17054
17128
  {
17055
- className: "flex items-center w-full",
17056
- style: {
17057
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
17058
- width: "98%",
17059
- display: "flex",
17060
- alignItems: "center",
17061
- gap: "0.5rem"
17062
- },
17063
- children: [
17064
- finalEnableHighlights && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17065
- Highlights_default,
17066
- {
17067
- allKeys,
17068
- mapperConfig,
17069
- finalColors,
17070
- highlightedSeries,
17071
- toggleHighlight,
17072
- containerWidth: chartInnerWidth
17073
- }
17074
- ),
17075
- finalEnableShowOnly && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17076
- ShowOnly_default,
17077
- {
17078
- showOnlyHighlighted,
17079
- setShowOnlyHighlighted,
17080
- highlightedSeriesSize: highlightedSeries.size,
17081
- clearHighlights
17082
- }
17083
- ),
17084
- finalEnablePeriodsDropdown && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17085
- "div",
17086
- {
17087
- style: {
17088
- marginLeft: "auto",
17089
- display: "flex",
17090
- alignItems: "center"
17091
- },
17092
- children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17093
- PeriodsDropdown_default,
17094
- {
17095
- processedData,
17096
- onOpenPeriod: openTooltipForPeriod,
17097
- rightOffset: finalChartRightMargin,
17098
- activePeriods
17099
- }
17100
- )
17101
- }
17102
- )
17103
- ]
17129
+ processedData,
17130
+ onOpenPeriod: openTooltipForPeriod,
17131
+ rightOffset: finalChartRightMargin
17104
17132
  }
17105
- ),
17106
- !(allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly)) && finalEnablePeriodsDropdown && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17107
- "div",
17108
- {
17109
- style: {
17110
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
17111
- paddingRight: `${finalChartRightMargin}px`,
17112
- width: "100%",
17113
- maxWidth: `${chartInnerWidth}px`,
17114
- display: "flex",
17115
- justifyContent: "flex-end"
17116
- },
17117
- children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17118
- PeriodsDropdown_default,
17133
+ )
17134
+ }
17135
+ ),
17136
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17137
+ import_recharts.ComposedChart,
17138
+ {
17139
+ data: processedData,
17140
+ height,
17141
+ margin: {
17142
+ top: finalChartTopMargin,
17143
+ right: finalChartRightMargin,
17144
+ left: finalChartLeftMargin,
17145
+ bottom: finalChartBottomMargin
17146
+ },
17147
+ onClick: handleChartClick,
17148
+ children: [
17149
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17150
+ const key = s.key;
17151
+ const color = finalColors[key];
17152
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17153
+ "linearGradient",
17119
17154
  {
17120
- processedData,
17121
- onOpenPeriod: openTooltipForPeriod,
17122
- rightOffset: finalChartRightMargin
17123
- }
17124
- )
17125
- }
17126
- ),
17127
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17128
- import_recharts.ComposedChart,
17129
- {
17130
- data: processedData,
17131
- height,
17132
- margin: {
17133
- top: finalChartTopMargin,
17134
- right: finalChartRightMargin,
17135
- left: finalChartLeftMargin,
17136
- bottom: finalChartBottomMargin
17137
- },
17138
- onClick: handleChartClick,
17139
- children: [
17140
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17141
- const key = s.key;
17142
- const color = finalColors[key];
17143
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17144
- "linearGradient",
17145
- {
17146
- id: `gradient-${key}`,
17147
- x1: "0",
17148
- y1: "0",
17149
- x2: "0",
17150
- y2: "0.8",
17151
- children: [
17152
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17153
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17154
- ]
17155
- },
17156
- `gradient-${key}`
17157
- );
17158
- }) }),
17159
- showGrid && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17160
- import_recharts.CartesianGrid,
17161
- {
17162
- strokeDasharray: "3 3",
17163
- stroke: gridColor || "hsl(var(--muted-foreground))",
17164
- opacity: 0.5
17165
- }
17166
- ),
17167
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17168
- import_recharts.XAxis,
17169
- {
17170
- dataKey: xAxisConfig.dataKey,
17171
- stroke: "hsl(var(--muted-foreground))",
17155
+ id: `gradient-${key}`,
17156
+ x1: "0",
17157
+ y1: "0",
17158
+ x2: "0",
17159
+ y2: "0.8",
17160
+ children: [
17161
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17162
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17163
+ ]
17164
+ },
17165
+ `gradient-${key}`
17166
+ );
17167
+ }) }),
17168
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17169
+ import_recharts.CartesianGrid,
17170
+ {
17171
+ strokeDasharray: "3 3",
17172
+ stroke: gridColor || "hsl(var(--muted-foreground))",
17173
+ opacity: 0.5
17174
+ }
17175
+ ),
17176
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17177
+ import_recharts.XAxis,
17178
+ {
17179
+ dataKey: xAxisConfig.dataKey,
17180
+ stroke: "hsl(var(--muted-foreground))",
17181
+ fontSize: 12,
17182
+ tickLine: false,
17183
+ axisLine: false,
17184
+ tickFormatter: (value) => {
17185
+ if (categoryFormatter)
17186
+ return categoryFormatter(value);
17187
+ if (xAxisConfig.valueFormatter)
17188
+ return xAxisConfig.valueFormatter(value);
17189
+ return String(value ?? "");
17190
+ },
17191
+ label: xAxisLabel ? {
17192
+ value: xAxisLabel,
17193
+ position: "insideBottomRight",
17194
+ offset: -5,
17195
+ style: {
17172
17196
  fontSize: 12,
17173
- tickLine: false,
17174
- axisLine: false,
17175
- tickFormatter: (value) => {
17176
- if (categoryFormatter)
17177
- return categoryFormatter(value);
17178
- if (xAxisConfig.valueFormatter)
17179
- return xAxisConfig.valueFormatter(value);
17180
- return String(value ?? "");
17181
- },
17182
- label: xAxisLabel ? {
17183
- value: xAxisLabel,
17184
- position: "insideBottomRight",
17185
- offset: -5,
17186
- style: {
17187
- fontSize: 12,
17188
- fill: "hsl(var(--muted-foreground))",
17189
- fontWeight: 500
17190
- }
17191
- } : void 0
17197
+ fill: "hsl(var(--muted-foreground))",
17198
+ fontWeight: 500
17192
17199
  }
17193
- ),
17194
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17195
- import_recharts.YAxis,
17196
- {
17197
- yAxisId: "left",
17198
- width: yAxisTickWidth,
17199
- stroke: "hsl(var(--muted-foreground))",
17200
+ } : void 0
17201
+ }
17202
+ ),
17203
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17204
+ import_recharts.YAxis,
17205
+ {
17206
+ yAxisId: "left",
17207
+ width: yAxisTickWidth,
17208
+ stroke: "hsl(var(--muted-foreground))",
17209
+ fontSize: 12,
17210
+ tickLine: false,
17211
+ axisLine: false,
17212
+ tickFormatter: yTickFormatter,
17213
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17214
+ tickCount: 6,
17215
+ label: yAxisLabel ? {
17216
+ value: yAxisLabel,
17217
+ angle: -90,
17218
+ position: "left",
17219
+ dx: leftYAxisLabelDx,
17220
+ style: {
17200
17221
  fontSize: 12,
17201
- tickLine: false,
17202
- axisLine: false,
17203
- tickFormatter: yTickFormatter,
17204
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17205
- tickCount: 6,
17206
- label: yAxisLabel ? {
17207
- value: yAxisLabel,
17208
- angle: -90,
17209
- position: "left",
17210
- dx: leftYAxisLabelDx,
17211
- style: {
17212
- fontSize: 12,
17213
- fill: "hsl(var(--muted-foreground))",
17214
- fontWeight: 500,
17215
- textAnchor: "middle"
17216
- }
17217
- } : void 0
17218
- }
17219
- ),
17220
- minLeftDataValue < 0 && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17221
- import_recharts.ReferenceLine,
17222
- {
17223
- y: 0,
17224
- yAxisId: "left",
17225
- stroke: "hsl(var(--muted-foreground))",
17226
- strokeWidth: 1,
17227
- strokeDasharray: "4 4"
17222
+ fill: "hsl(var(--muted-foreground))",
17223
+ fontWeight: 500,
17224
+ textAnchor: "middle"
17228
17225
  }
17229
- ),
17230
- rightKeys.length > 0 && (() => {
17231
- const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
17232
- const rightTickFormatter = (v) => {
17233
- if (biaxialConfigNormalized?.percentage) {
17234
- const num = Number(String(v));
17235
- const nf = new Intl.NumberFormat("pt-BR", {
17236
- minimumFractionDigits: decimals,
17237
- maximumFractionDigits: decimals
17238
- });
17239
- const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
17240
- return `${out}%`;
17241
- }
17242
- return yTickFormatter(v);
17243
- };
17244
- const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
17245
- const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
17246
- const rightAxisColor = (() => {
17247
- if (!biaxialConfigNormalized) return defaultRightColor;
17248
- if (typeof biaxialConfigNormalized.stroke === "string")
17249
- return biaxialConfigNormalized.stroke;
17250
- if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
17251
- return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
17252
- return defaultRightColor;
17253
- })();
17254
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17255
- import_recharts.YAxis,
17256
- {
17257
- yAxisId: "right",
17258
- width: finalChartRightMargin,
17259
- orientation: "right",
17260
- stroke: "hsl(var(--muted-foreground))",
17226
+ } : void 0
17227
+ }
17228
+ ),
17229
+ minLeftDataValue < 0 && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17230
+ import_recharts.ReferenceLine,
17231
+ {
17232
+ y: 0,
17233
+ yAxisId: "left",
17234
+ stroke: "hsl(var(--muted-foreground))",
17235
+ strokeWidth: 1,
17236
+ strokeDasharray: "4 4"
17237
+ }
17238
+ ),
17239
+ rightKeys.length > 0 && (() => {
17240
+ const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
17241
+ const rightTickFormatter = (v) => {
17242
+ if (biaxialConfigNormalized?.percentage) {
17243
+ const num = Number(String(v));
17244
+ const nf = new Intl.NumberFormat("pt-BR", {
17245
+ minimumFractionDigits: decimals,
17246
+ maximumFractionDigits: decimals
17247
+ });
17248
+ const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
17249
+ return `${out}%`;
17250
+ }
17251
+ return yTickFormatter(v);
17252
+ };
17253
+ const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
17254
+ const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
17255
+ const rightAxisColor = (() => {
17256
+ if (!biaxialConfigNormalized) return defaultRightColor;
17257
+ if (typeof biaxialConfigNormalized.stroke === "string")
17258
+ return biaxialConfigNormalized.stroke;
17259
+ if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
17260
+ return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
17261
+ return defaultRightColor;
17262
+ })();
17263
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17264
+ import_recharts.YAxis,
17265
+ {
17266
+ yAxisId: "right",
17267
+ width: finalChartRightMargin,
17268
+ orientation: "right",
17269
+ stroke: "hsl(var(--muted-foreground))",
17270
+ fontSize: 12,
17271
+ tickLine: false,
17272
+ axisLine: false,
17273
+ tick: { fill: rightAxisColor },
17274
+ tickFormatter: rightTickFormatter,
17275
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17276
+ tickCount: 6,
17277
+ label: biaxialConfigNormalized?.label ? {
17278
+ value: biaxialConfigNormalized.label,
17279
+ angle: -90,
17280
+ position: "right",
17281
+ dx: rightYAxisLabelDx,
17282
+ style: {
17261
17283
  fontSize: 12,
17262
- tickLine: false,
17263
- axisLine: false,
17264
- tick: { fill: rightAxisColor },
17265
- tickFormatter: rightTickFormatter,
17266
- domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17267
- tickCount: 6,
17268
- label: biaxialConfigNormalized?.label ? {
17269
- value: biaxialConfigNormalized.label,
17270
- angle: -90,
17271
- position: "right",
17272
- dx: rightYAxisLabelDx,
17273
- style: {
17274
- fontSize: 12,
17275
- fill: "hsl(var(--muted-foreground))",
17276
- fontWeight: 500,
17277
- textAnchor: "middle"
17278
- }
17279
- } : void 0
17284
+ fill: "hsl(var(--muted-foreground))",
17285
+ fontWeight: 500,
17286
+ textAnchor: "middle"
17280
17287
  }
17281
- );
17282
- })(),
17283
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17284
- import_recharts.Tooltip,
17288
+ } : void 0
17289
+ }
17290
+ );
17291
+ })(),
17292
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17293
+ import_recharts.Tooltip,
17294
+ {
17295
+ content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17296
+ TooltipWithTotal_default,
17285
17297
  {
17286
- content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17287
- TooltipWithTotal_default,
17288
- {
17289
- finalColors,
17290
- valueFormatter: finalValueFormatter,
17291
- categoryFormatter,
17292
- periodLabel
17293
- }
17294
- ) : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17295
- TooltipSimple_default,
17296
- {
17297
- finalColors,
17298
- valueFormatter: finalValueFormatter,
17299
- categoryFormatter,
17300
- periodLabel
17301
- }
17302
- ),
17303
- cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17298
+ finalColors,
17299
+ valueFormatter: finalValueFormatter,
17300
+ categoryFormatter,
17301
+ periodLabel
17304
17302
  }
17305
- ),
17306
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17307
- import_recharts.Legend,
17303
+ ) : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17304
+ TooltipSimple_default,
17308
17305
  {
17309
- wrapperStyle: {
17310
- color: "hsl(var(--foreground))",
17311
- fontSize: "14px",
17312
- paddingTop: "8px",
17313
- letterSpacing: 0
17314
- },
17315
- formatter: (value) => {
17316
- const key = String(value);
17317
- const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17318
- const displayLabel = legendUppercase ? label.toUpperCase() : label;
17319
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { style: { letterSpacing: 0 }, children: displayLabel });
17320
- }
17306
+ finalColors,
17307
+ valueFormatter: finalValueFormatter,
17308
+ categoryFormatter,
17309
+ periodLabel
17321
17310
  }
17322
17311
  ),
17323
- seriesOrder.map((s) => {
17324
- const key = s.key;
17325
- if (showOnlyHighlighted && !highlightedSeries.has(key))
17326
- return null;
17312
+ cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17313
+ }
17314
+ ),
17315
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17316
+ import_recharts.Legend,
17317
+ {
17318
+ wrapperStyle: {
17319
+ color: "hsl(var(--foreground))",
17320
+ fontSize: "14px",
17321
+ paddingTop: "8px",
17322
+ letterSpacing: 0
17323
+ },
17324
+ formatter: (value) => {
17325
+ const key = String(value);
17327
17326
  const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17328
- let color = finalColors[key];
17329
- if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
17330
- if (typeof biaxialConfigNormalized.stroke === "string") {
17331
- color = biaxialConfigNormalized.stroke;
17332
- } else {
17333
- color = biaxialConfigNormalized.stroke[key] ?? color;
17334
- }
17335
- }
17336
- if (s.type === "bar") {
17337
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17338
- import_recharts.Bar,
17327
+ const displayLabel = legendUppercase ? label.toUpperCase() : label;
17328
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "tracking-[0]", children: displayLabel });
17329
+ }
17330
+ }
17331
+ ),
17332
+ seriesOrder.map((s) => {
17333
+ const key = s.key;
17334
+ if (showOnlyHighlighted && !highlightedSeries.has(key))
17335
+ return null;
17336
+ const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17337
+ let color = finalColors[key];
17338
+ if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
17339
+ if (typeof biaxialConfigNormalized.stroke === "string") {
17340
+ color = biaxialConfigNormalized.stroke;
17341
+ } else {
17342
+ color = biaxialConfigNormalized.stroke[key] ?? color;
17343
+ }
17344
+ }
17345
+ if (s.type === "bar") {
17346
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17347
+ import_recharts.Bar,
17348
+ {
17349
+ dataKey: key,
17350
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17351
+ name: label,
17352
+ fill: color,
17353
+ radius: [4, 4, 0, 0],
17354
+ onClick: handleBarClick,
17355
+ className: "cursor-pointer",
17356
+ style: { opacity: getSeriesOpacity(key) },
17357
+ activeBar: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17358
+ import_recharts.Rectangle,
17339
17359
  {
17340
- dataKey: key,
17341
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17342
- name: label,
17343
17360
  fill: color,
17344
- radius: [4, 4, 0, 0],
17345
- onClick: handleBarClick,
17346
- style: {
17347
- cursor: "pointer",
17348
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17349
- },
17350
- activeBar: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17351
- import_recharts.Rectangle,
17352
- {
17353
- fill: color,
17354
- stroke: color,
17355
- strokeWidth: 2,
17356
- opacity: 0.8
17357
- }
17358
- ),
17359
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17360
- import_recharts.LabelList,
17361
- {
17362
- dataKey: key,
17363
- content: (props) => {
17364
- const p = props;
17365
- const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
17366
- const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
17367
- const smallThreshold = 14;
17368
- const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
17369
- if (needsOutside) {
17370
- return null;
17371
- }
17372
- const inside = renderInsideBarLabel(
17373
- color,
17374
- finalValueFormatter
17375
- );
17376
- return inside(props);
17377
- },
17378
- offset: 0
17379
- }
17380
- ) : null
17381
- },
17382
- `bar-${key}`
17383
- );
17384
- }
17385
- if (s.type === "line") {
17386
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17387
- import_recharts.Line,
17388
- {
17389
- dataKey: key,
17390
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17391
- name: label,
17392
17361
  stroke: color,
17393
17362
  strokeWidth: 2,
17394
- dot: { r: 3 },
17395
- activeDot: { r: 6 },
17396
- onClick: handleSeriesClick,
17397
- style: {
17398
- cursor: "pointer",
17399
- pointerEvents: "all",
17400
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17401
- },
17402
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17403
- import_recharts.LabelList,
17404
- {
17405
- dataKey: key,
17406
- position: "top",
17407
- content: pillLabelRenderer_default(
17408
- color,
17409
- "filled",
17410
- finalValueFormatter
17411
- ),
17412
- offset: 14
17413
- }
17414
- ) : null
17415
- },
17416
- `line-${key}`
17417
- );
17418
- }
17419
- if (s.type === "area") {
17420
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17421
- import_recharts.Area,
17363
+ opacity: 0.8
17364
+ }
17365
+ ),
17366
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17367
+ import_recharts.LabelList,
17422
17368
  {
17423
- type: "monotone",
17424
17369
  dataKey: key,
17425
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17426
- name: label,
17427
- stroke: color,
17428
- fill: `url(#gradient-${key})`,
17429
- fillOpacity: 1,
17430
- strokeWidth: 2,
17431
- onClick: handleSeriesClick,
17432
- style: {
17433
- cursor: "pointer",
17434
- pointerEvents: "all",
17435
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17436
- },
17437
- activeDot: {
17438
- r: 6,
17439
- fill: color,
17440
- stroke: "hsl(var(--background))",
17441
- strokeWidth: 2
17442
- },
17443
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17444
- import_recharts.LabelList,
17445
- {
17446
- dataKey: key,
17447
- position: "top",
17448
- content: pillLabelRenderer_default(
17449
- color,
17450
- "soft",
17451
- finalValueFormatter
17452
- ),
17453
- offset: 12
17370
+ content: (props) => {
17371
+ const p = props;
17372
+ const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
17373
+ const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
17374
+ const smallThreshold = 14;
17375
+ const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
17376
+ if (needsOutside) {
17377
+ return null;
17454
17378
  }
17455
- ) : null
17456
- },
17457
- `area-${key}`
17458
- );
17459
- }
17460
- return null;
17461
- })
17462
- ]
17463
- }
17464
- ) }),
17465
- enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17466
- DraggableTooltip_default,
17467
- {
17468
- id: tooltip.id,
17469
- data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17470
- position: tooltip.position,
17471
- title,
17472
- dataKeys: allKeys,
17473
- finalColors,
17474
- highlightedSeries,
17475
- toggleHighlight,
17476
- showOnlyHighlighted,
17477
- onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17478
- onPositionChange: onTooltipPositionChange,
17479
- periodLabel,
17480
- dataLabel: "Dados do Per\xEDodo",
17481
- valueFormatter: finalValueFormatter,
17482
- categoryFormatter,
17483
- globalTooltipCount: activeTooltips.length,
17484
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17485
- closeAllButtonPosition: "top-center",
17486
- closeAllButtonVariant: "floating"
17487
- },
17488
- tooltip.id
17489
- )),
17490
- enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17491
- CloseAllButton_default,
17492
- {
17493
- count: activeTooltips.length,
17494
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17495
- position: "top-center",
17496
- variant: "floating"
17497
- }
17498
- )
17499
- ]
17500
- }
17501
- )
17379
+ const inside = renderInsideBarLabel(
17380
+ color,
17381
+ finalValueFormatter
17382
+ );
17383
+ return inside(props);
17384
+ },
17385
+ offset: 0
17386
+ }
17387
+ ) : null
17388
+ },
17389
+ `bar-${key}`
17390
+ );
17391
+ }
17392
+ if (s.type === "line") {
17393
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17394
+ import_recharts.Line,
17395
+ {
17396
+ dataKey: key,
17397
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17398
+ name: label,
17399
+ stroke: color,
17400
+ strokeWidth: 2,
17401
+ dot: { r: 3 },
17402
+ activeDot: { r: 6 },
17403
+ onClick: handleSeriesClick,
17404
+ className: "cursor-pointer pointer-events-auto",
17405
+ style: { opacity: getSeriesOpacity(key) },
17406
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17407
+ import_recharts.LabelList,
17408
+ {
17409
+ dataKey: key,
17410
+ position: "top",
17411
+ content: pillLabelRenderer_default(
17412
+ color,
17413
+ "filled",
17414
+ finalValueFormatter
17415
+ ),
17416
+ offset: 14
17417
+ }
17418
+ ) : null
17419
+ },
17420
+ `line-${key}`
17421
+ );
17422
+ }
17423
+ if (s.type === "area") {
17424
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17425
+ import_recharts.Area,
17426
+ {
17427
+ type: "monotone",
17428
+ dataKey: key,
17429
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17430
+ name: label,
17431
+ stroke: color,
17432
+ fill: `url(#gradient-${key})`,
17433
+ fillOpacity: 1,
17434
+ strokeWidth: 2,
17435
+ onClick: handleSeriesClick,
17436
+ className: "cursor-pointer pointer-events-auto",
17437
+ style: { opacity: getSeriesOpacity(key) },
17438
+ activeDot: {
17439
+ r: 6,
17440
+ fill: color,
17441
+ stroke: "hsl(var(--background))",
17442
+ strokeWidth: 2
17443
+ },
17444
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17445
+ import_recharts.LabelList,
17446
+ {
17447
+ dataKey: key,
17448
+ position: "top",
17449
+ content: pillLabelRenderer_default(
17450
+ color,
17451
+ "soft",
17452
+ finalValueFormatter
17453
+ ),
17454
+ offset: 12
17455
+ }
17456
+ ) : null
17457
+ },
17458
+ `area-${key}`
17459
+ );
17460
+ }
17461
+ return null;
17462
+ })
17463
+ ]
17464
+ }
17465
+ ) }),
17466
+ enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17467
+ DraggableTooltip_default,
17468
+ {
17469
+ id: tooltip.id,
17470
+ data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17471
+ position: tooltip.position,
17472
+ title,
17473
+ dataKeys: allKeys,
17474
+ finalColors,
17475
+ highlightedSeries,
17476
+ toggleHighlight,
17477
+ showOnlyHighlighted,
17478
+ onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17479
+ onPositionChange: onTooltipPositionChange,
17480
+ periodLabel,
17481
+ dataLabel: "Dados do Per\xEDodo",
17482
+ valueFormatter: finalValueFormatter,
17483
+ categoryFormatter,
17484
+ globalTooltipCount: activeTooltips.length,
17485
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17486
+ closeAllButtonPosition: "top-center",
17487
+ closeAllButtonVariant: "floating"
17488
+ },
17489
+ tooltip.id
17490
+ )),
17491
+ enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17492
+ CloseAllButton_default,
17493
+ {
17494
+ count: activeTooltips.length,
17495
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17496
+ position: "top-center",
17497
+ variant: "floating"
17498
+ }
17499
+ )
17500
+ ]
17502
17501
  }
17503
- );
17502
+ ) });
17504
17503
  };
17505
17504
  var Chart_default = Chart;
17506
17505
 
@@ -18857,28 +18856,40 @@ function Leaderboard({
18857
18856
  order: initialOrder = "desc",
18858
18857
  title = "LeaderBoard",
18859
18858
  className,
18860
- isLoading = false
18859
+ isLoading = false,
18860
+ legend
18861
18861
  }) {
18862
18862
  const [order, setOrder] = (0, import_react100.useState)(initialOrder);
18863
18863
  const mockData = [
18864
- { name: "Ana", percentage: 92 },
18865
- { name: "Bruno", percentage: 81 },
18866
- { name: "Carla", percentage: 74 },
18867
- { name: "Daniel", percentage: 68 },
18868
- { name: "Eduardo", percentage: 55 },
18869
- { name: "Fernanda", percentage: 44 },
18870
- { name: "Gabriela", percentage: 33 },
18871
- { name: "Heitor", percentage: 28 },
18872
- { name: "Isabela", percentage: 22 },
18873
- { name: "Jo\xE3o", percentage: 18 }
18864
+ { name: "Ana", value: 92 },
18865
+ { name: "Bruno", value: 81 },
18866
+ { name: "Carla", value: 74 },
18867
+ { name: "Daniel", value: 68 },
18868
+ { name: "Eduardo", value: 55 },
18869
+ { name: "Fernanda", value: 44 },
18870
+ { name: "Gabriela", value: 33 },
18871
+ { name: "Heitor", value: 28 },
18872
+ { name: "Isabela", value: 22 },
18873
+ { name: "Jo\xE3o", value: 18 }
18874
18874
  ];
18875
18875
  const data = items ?? mockData;
18876
- const sortedData = [...data].sort(
18877
- (a, b) => order === "desc" ? b.percentage - a.percentage : a.percentage - b.percentage
18878
- );
18879
- const getBadgeColor = (pct) => {
18880
- if (pct >= 75) return "red";
18881
- if (pct >= 25) return "yellow";
18876
+ const sortedData = [...data].sort((a, b) => {
18877
+ const aValue = typeof a.value === "string" ? parseFloat(a.value) || a.value : a.value;
18878
+ const bValue = typeof b.value === "string" ? parseFloat(b.value) || b.value : b.value;
18879
+ if (typeof aValue === "number" && typeof bValue === "number") {
18880
+ return order === "desc" ? bValue - aValue : aValue - bValue;
18881
+ }
18882
+ if (typeof aValue === "string" && typeof bValue === "string") {
18883
+ return order === "desc" ? bValue.localeCompare(aValue) : aValue.localeCompare(bValue);
18884
+ }
18885
+ if (typeof aValue === "number") return order === "desc" ? -1 : 1;
18886
+ return order === "desc" ? 1 : -1;
18887
+ });
18888
+ const getBadgeColor = (value) => {
18889
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
18890
+ if (isNaN(numValue)) return "green";
18891
+ if (numValue >= 75) return "red";
18892
+ if (numValue >= 25) return "yellow";
18882
18893
  return "green";
18883
18894
  };
18884
18895
  return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
@@ -18886,7 +18897,7 @@ function Leaderboard({
18886
18897
  {
18887
18898
  className: `border rounded-xl flex flex-col max-h-80 w-96 ${className}`,
18888
18899
  children: [
18889
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center justify-between p-4 border-b flex-shrink-0 gap-3", children: [
18900
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3", children: [
18890
18901
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("h2", { className: "text-lg font-semibold px-1", children: title }),
18891
18902
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
18892
18903
  ButtonBase,
@@ -18905,33 +18916,36 @@ function Leaderboard({
18905
18916
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SkeletonBase, { className: "h-4 w-36" })
18906
18917
  ] }),
18907
18918
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SkeletonBase, { className: "h-6 w-12 rounded-full" })
18908
- ] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
18909
- import_framer_motion22.motion.span,
18910
- {
18911
- initial: { opacity: 0, y: 10 },
18912
- animate: { opacity: 1, y: 0 },
18913
- transition: { delay: idx * 5e-3 },
18914
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
18915
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-3", children: [
18916
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
18917
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "font-medium", children: item.name })
18918
- ] }),
18919
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
18920
- Badge,
18921
- {
18922
- color: getBadgeColor(item.percentage),
18923
- size: "md",
18924
- className: "font-bold",
18925
- children: [
18926
- item.percentage,
18927
- "%"
18928
- ]
18929
- }
18930
- )
18931
- ] })
18932
- },
18933
- idx
18934
- )) }) })
18919
+ ] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { children: [
18920
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("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: [
18921
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider pl-1", children: legend?.[0]?.[0] ?? "Participante" }),
18922
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider", children: legend?.[0]?.[1] ?? "Pontua\xE7\xE3o" })
18923
+ ] }),
18924
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
18925
+ import_framer_motion22.motion.span,
18926
+ {
18927
+ initial: { opacity: 0, y: 10 },
18928
+ animate: { opacity: 1, y: 0 },
18929
+ transition: { delay: idx * 5e-3 },
18930
+ children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
18931
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-3", children: [
18932
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
18933
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "font-medium", children: item.name })
18934
+ ] }),
18935
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
18936
+ Badge,
18937
+ {
18938
+ color: getBadgeColor(item.value),
18939
+ size: "md",
18940
+ className: "font-bold",
18941
+ children: item.value
18942
+ }
18943
+ )
18944
+ ] })
18945
+ },
18946
+ idx
18947
+ )) })
18948
+ ] }) })
18935
18949
  ]
18936
18950
  }
18937
18951
  );