@mlw-packages/react-components 1.7.13 → 1.7.14

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
@@ -955,6 +955,7 @@ function ComboboxBase({
955
955
  renderSelected,
956
956
  handleSelection,
957
957
  checkIsSelected,
958
+ disabled = false,
958
959
  keepOpen = false,
959
960
  closeAll,
960
961
  searchPlaceholder,
@@ -969,111 +970,124 @@ function ComboboxBase({
969
970
  className: "col-span-1 w-full",
970
971
  "data-testid": testIds.root ?? "combobox-base-root",
971
972
  children: [
972
- /* @__PURE__ */ jsxs5(PopoverBase, { open, onOpenChange: setOpen, modal: true, children: [
973
- /* @__PURE__ */ jsx8(
974
- PopoverTriggerBase,
975
- {
976
- asChild: true,
977
- className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)]",
978
- children: /* @__PURE__ */ jsxs5(
979
- ButtonBase,
973
+ /* @__PURE__ */ jsxs5(
974
+ PopoverBase,
975
+ {
976
+ open,
977
+ onOpenChange: (v) => !disabled && setOpen(v),
978
+ modal: true,
979
+ children: [
980
+ /* @__PURE__ */ jsx8(
981
+ PopoverTriggerBase,
980
982
  {
981
- variant: "select",
982
- size: "select",
983
- role: "combobox",
984
- "aria-expanded": open,
985
- className: cn(
986
- "flex items-center gap-2 justify-between h-auto [&>div]:line-clamp-1 [&>span]:line-clamp-1",
987
- error && "border-red-500"
988
- ),
989
- "data-testid": testIds.trigger ?? "combobox-trigger",
990
- children: [
991
- renderSelected,
992
- closeAll,
993
- /* @__PURE__ */ jsx8(
994
- motion2.div,
995
- {
996
- animate: { rotate: open ? 180 : 0 },
997
- transition: { duration: 0.3 },
998
- className: "flex",
999
- children: /* @__PURE__ */ jsx8(CaretDownIcon, { className: " flex-shrink-0" })
1000
- }
1001
- )
1002
- ]
983
+ asChild: true,
984
+ className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)]",
985
+ children: /* @__PURE__ */ jsxs5(
986
+ ButtonBase,
987
+ {
988
+ variant: "select",
989
+ size: "select",
990
+ role: "combobox",
991
+ "aria-expanded": open,
992
+ "aria-disabled": disabled || void 0,
993
+ disabled,
994
+ className: cn(
995
+ "flex items-center gap-2 justify-between h-auto [&>div]:line-clamp-1 [&>span]:line-clamp-1",
996
+ error && "border-red-500"
997
+ ),
998
+ "data-testid": testIds.trigger ?? "combobox-trigger",
999
+ children: [
1000
+ renderSelected,
1001
+ closeAll,
1002
+ /* @__PURE__ */ jsx8(
1003
+ motion2.div,
1004
+ {
1005
+ animate: { rotate: open ? 180 : 0 },
1006
+ transition: { duration: 0.3 },
1007
+ className: "flex",
1008
+ children: /* @__PURE__ */ jsx8(CaretDownIcon, { className: " flex-shrink-0" })
1009
+ }
1010
+ )
1011
+ ]
1012
+ }
1013
+ )
1003
1014
  }
1004
- )
1005
- }
1006
- ),
1007
- /* @__PURE__ */ jsx8(
1008
- PopoverContentBase,
1009
- {
1010
- className: "max-h-[--radix-popover-content-available-height] w-[--radix-popover-trigger-width] p-0 border-none",
1011
- "data-testid": testIds.popover ?? "combobox-popover",
1012
- children: /* @__PURE__ */ jsxs5(
1013
- CommandBase,
1015
+ ),
1016
+ /* @__PURE__ */ jsx8(
1017
+ PopoverContentBase,
1014
1018
  {
1015
- className: "dark:text-white hover:bg-rsecondary",
1016
- "data-testid": testIds.command ?? "combobox-command",
1017
- children: [
1018
- /* @__PURE__ */ jsx8(
1019
- CommandInputBase,
1020
- {
1021
- tabIndex: -1,
1022
- placeholder: searchPlaceholder ?? "Busque uma op\xE7\xE3o...",
1023
- "data-testid": testIds.search ?? "combobox-search"
1024
- }
1025
- ),
1026
- /* @__PURE__ */ jsxs5(CommandListBase, { "data-testid": testIds.list ?? "combobox-list", children: [
1027
- /* @__PURE__ */ jsx8(CommandEmptyBase, { "data-testid": testIds.empty ?? "combobox-empty", children: empty }),
1028
- /* @__PURE__ */ jsx8(CommandGroupBase, { "data-testid": testIds.group ?? "combobox-group", children: items.map((item) => {
1029
- const isSelected = checkIsSelected(item.value);
1030
- return /* @__PURE__ */ jsxs5(
1031
- CommandItemBase,
1019
+ className: "max-h-[--radix-popover-content-available-height] w-[--radix-popover-trigger-width] p-0 border-none",
1020
+ "data-testid": testIds.popover ?? "combobox-popover",
1021
+ children: /* @__PURE__ */ jsxs5(
1022
+ CommandBase,
1023
+ {
1024
+ className: "dark:text-white hover:bg-rsecondary",
1025
+ "data-testid": testIds.command ?? "combobox-command",
1026
+ children: [
1027
+ /* @__PURE__ */ jsx8(
1028
+ CommandInputBase,
1032
1029
  {
1033
- keywords: [item.label],
1034
- value: item.value,
1035
- onSelect: (value) => {
1036
- handleSelection(value);
1037
- if (!keepOpen) setOpen(false);
1038
- },
1039
- "data-testid": testIds.option ?? "combobox-option",
1040
- children: [
1041
- item.label,
1042
- /* @__PURE__ */ jsx8(
1043
- motion2.div,
1044
- {
1045
- initial: { scale: 0 },
1046
- animate: { scale: isSelected ? 1 : 0 },
1047
- transition: {
1048
- type: "spring",
1049
- stiffness: 500,
1050
- damping: 30
1051
- },
1052
- className: "ml-auto ",
1053
- children: /* @__PURE__ */ jsx8(
1054
- CheckIcon,
1030
+ tabIndex: -1,
1031
+ disabled,
1032
+ placeholder: searchPlaceholder ?? "Busque uma op\xE7\xE3o...",
1033
+ "data-testid": testIds.search ?? "combobox-search"
1034
+ }
1035
+ ),
1036
+ /* @__PURE__ */ jsxs5(CommandListBase, { "data-testid": testIds.list ?? "combobox-list", children: [
1037
+ /* @__PURE__ */ jsx8(CommandEmptyBase, { "data-testid": testIds.empty ?? "combobox-empty", children: empty }),
1038
+ /* @__PURE__ */ jsx8(CommandGroupBase, { "data-testid": testIds.group ?? "combobox-group", children: items.map((item) => {
1039
+ const isSelected = checkIsSelected(item.value);
1040
+ return /* @__PURE__ */ jsxs5(
1041
+ CommandItemBase,
1042
+ {
1043
+ keywords: [item.label],
1044
+ value: item.value,
1045
+ onSelect: (value) => {
1046
+ if (disabled) return;
1047
+ handleSelection(value);
1048
+ if (!keepOpen) setOpen(false);
1049
+ },
1050
+ disabled,
1051
+ "data-testid": testIds.option ?? "combobox-option",
1052
+ children: [
1053
+ item.label,
1054
+ /* @__PURE__ */ jsx8(
1055
+ motion2.div,
1055
1056
  {
1056
- className: cn(
1057
- "ml-auto",
1058
- isSelected ? "opacity-100" : "opacity-0"
1059
- ),
1060
- "data-testid": isSelected ? testIds.check ?? "combobox-option-check" : void 0
1057
+ initial: { scale: 0 },
1058
+ animate: { scale: isSelected ? 1 : 0 },
1059
+ transition: {
1060
+ type: "spring",
1061
+ stiffness: 500,
1062
+ damping: 30
1063
+ },
1064
+ className: "ml-auto ",
1065
+ children: /* @__PURE__ */ jsx8(
1066
+ CheckIcon,
1067
+ {
1068
+ className: cn(
1069
+ "ml-auto",
1070
+ isSelected ? "opacity-100" : "opacity-0"
1071
+ ),
1072
+ "data-testid": isSelected ? testIds.check ?? "combobox-option-check" : void 0
1073
+ }
1074
+ )
1061
1075
  }
1062
1076
  )
1063
- }
1064
- )
1065
- ]
1066
- },
1067
- item.value
1068
- );
1069
- }) })
1070
- ] })
1071
- ]
1077
+ ]
1078
+ },
1079
+ item.value
1080
+ );
1081
+ }) })
1082
+ ] })
1083
+ ]
1084
+ }
1085
+ )
1072
1086
  }
1073
1087
  )
1074
- }
1075
- )
1076
- ] }),
1088
+ ]
1089
+ }
1090
+ ),
1077
1091
  /* @__PURE__ */ jsx8(ErrorMessage_default, { error })
1078
1092
  ]
1079
1093
  }
@@ -1090,6 +1104,7 @@ function Combobox({
1090
1104
  placeholder,
1091
1105
  searchPlaceholder,
1092
1106
  empty,
1107
+ disabled = false,
1093
1108
  label,
1094
1109
  labelClassname,
1095
1110
  testIds,
@@ -1101,11 +1116,15 @@ function Combobox({
1101
1116
  "span",
1102
1117
  {
1103
1118
  "data-testid": testIds?.selected ?? "combobox-selected",
1104
- className: cn("truncate", !selectedItem && "text-gray-500"),
1119
+ className: cn(
1120
+ "truncate",
1121
+ disabled && "opacity-60 cursor-not-allowed",
1122
+ !selectedItem && "text-gray-500"
1123
+ ),
1105
1124
  children: selectedItem?.label ?? placeholder ?? "Selecione uma op\xE7\xE3o..."
1106
1125
  }
1107
1126
  );
1108
- }, [placeholder, selectedItem, testIds?.selected]);
1127
+ }, [placeholder, selectedItem, testIds?.selected, disabled]);
1109
1128
  const checkIsSelected = useCallback(
1110
1129
  (value) => selected == null ? false : selected == value,
1111
1130
  [selected]
@@ -1125,6 +1144,7 @@ function Combobox({
1125
1144
  renderSelected,
1126
1145
  handleSelection,
1127
1146
  checkIsSelected,
1147
+ disabled,
1128
1148
  searchPlaceholder,
1129
1149
  empty,
1130
1150
  error,
@@ -1150,8 +1170,10 @@ function MultiCombobox({
1150
1170
  labelClassname,
1151
1171
  testIds = {},
1152
1172
  error,
1173
+ disabled = false,
1153
1174
  keepOpen = true,
1154
- showClearAll = false
1175
+ showClearAll = false,
1176
+ empty
1155
1177
  }) {
1156
1178
  const selectedItems = items.filter((item) => selected.includes(item.value));
1157
1179
  const checkIsSelected = useCallback2(
@@ -1175,7 +1197,9 @@ function MultiCombobox({
1175
1197
  variant: "ghost",
1176
1198
  "data-testid": testIds.clearAll ?? "combobox-clear-all",
1177
1199
  size: "icon",
1200
+ disabled,
1178
1201
  onClick: (e) => {
1202
+ if (disabled) return;
1179
1203
  e.stopPropagation();
1180
1204
  onChange([]);
1181
1205
  },
@@ -1218,15 +1242,19 @@ function MultiCombobox({
1218
1242
  /* @__PURE__ */ jsx10(
1219
1243
  motion3.span,
1220
1244
  {
1221
- role: "button",
1222
- tabIndex: 0,
1245
+ role: disabled ? void 0 : "button",
1246
+ tabIndex: disabled ? -1 : 0,
1223
1247
  onClick: (e) => {
1248
+ if (disabled) return;
1224
1249
  e.stopPropagation();
1225
1250
  handleSelection(item.value);
1226
1251
  },
1227
1252
  whileHover: { scale: 1.1 },
1228
1253
  whileTap: { scale: 0.95 },
1229
- className: "cursor-pointer text-xs flex items-center justify-center hover:text-red-500 transition-colors flex-shrink-0 rounded hover:bg-red-50 ",
1254
+ className: cn(
1255
+ "text-xs flex items-center justify-center transition-colors flex-shrink-0 rounded",
1256
+ !disabled ? "cursor-pointer hover:text-red-500 hover:bg-red-50" : "opacity-50 pointer-events-none"
1257
+ ),
1230
1258
  children: /* @__PURE__ */ jsx10(XIcon2, { size: 14 })
1231
1259
  }
1232
1260
  )
@@ -1236,7 +1264,7 @@ function MultiCombobox({
1236
1264
  )) })
1237
1265
  }
1238
1266
  );
1239
- }, [handleSelection, placeholder, selectedItems, testIds]);
1267
+ }, [handleSelection, placeholder, selectedItems, testIds, disabled]);
1240
1268
  return /* @__PURE__ */ jsxs7(
1241
1269
  "div",
1242
1270
  {
@@ -1261,7 +1289,9 @@ function MultiCombobox({
1261
1289
  keepOpen,
1262
1290
  closeAll,
1263
1291
  searchPlaceholder,
1264
- error
1292
+ error,
1293
+ empty,
1294
+ disabled
1265
1295
  }
1266
1296
  )
1267
1297
  ]
@@ -1866,7 +1896,7 @@ function Select({
1866
1896
  ] });
1867
1897
  }
1868
1898
 
1869
- // src/components/selects/AvatarSelect.tsx
1899
+ // src/components/selects/AvatarCombobox.tsx
1870
1900
  import { useId, useState as useState4 } from "react";
1871
1901
  import { CaretDownIcon as CaretDownIcon3, CheckIcon as CheckIcon5 } from "@phosphor-icons/react";
1872
1902
  import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
@@ -1891,14 +1921,14 @@ var Square = ({
1891
1921
  {
1892
1922
  "aria-hidden": "true",
1893
1923
  className: cn(
1894
- "flex size-5 items-center justify-center rounded bg-muted font-medium text-muted-foreground text-xs",
1924
+ "flex h-6 w-6 flex-shrink-0 items-center justify-center rounded bg-muted font-medium text-muted-foreground leading-none overflow-hidden",
1895
1925
  className
1896
1926
  ),
1897
1927
  "data-square": true,
1898
1928
  children
1899
1929
  }
1900
1930
  );
1901
- function AvatarSelect({
1931
+ function AvatarCombobox({
1902
1932
  items,
1903
1933
  groupItems,
1904
1934
  placeholder,
@@ -3212,7 +3242,9 @@ var RechartTooltipWithTotal = ({
3212
3242
  periodLabel = "Per\xEDodo",
3213
3243
  totalLabel = "Total",
3214
3244
  valueFormatter: valueFormatter2,
3215
- categoryFormatter
3245
+ categoryFormatter,
3246
+ yAxisMap,
3247
+ isBiaxial = false
3216
3248
  }) => {
3217
3249
  if (!active || !payload || payload.length === 0) return null;
3218
3250
  const displayLabel = categoryFormatter ? categoryFormatter(String(label ?? "")) : label;
@@ -3243,6 +3275,13 @@ var RechartTooltipWithTotal = ({
3243
3275
  (sum, p) => sum + Math.abs(typeof p.value === "number" ? p.value : 0),
3244
3276
  0
3245
3277
  );
3278
+ const axisDenominators = {};
3279
+ if (isBiaxial && yAxisMap) {
3280
+ for (const p of numeric) {
3281
+ const axis = yAxisMap[p.dataKey] || "left";
3282
+ axisDenominators[axis] = (axisDenominators[axis] || 0) + Math.abs(p.value || 0);
3283
+ }
3284
+ }
3246
3285
  return /* @__PURE__ */ jsxs20(
3247
3286
  "div",
3248
3287
  {
@@ -3311,7 +3350,12 @@ var RechartTooltipWithTotal = ({
3311
3350
  children: displayValue
3312
3351
  }
3313
3352
  ),
3314
- /* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
3353
+ /* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: isBiaxial && yAxisMap ? (() => {
3354
+ const axis = yAxisMap[entry.dataKey] || "left";
3355
+ const denom = axisDenominators[axis] || 0;
3356
+ const p = denom > 0 ? Math.abs(value) / denom * 100 : 0;
3357
+ return denom > 0 ? `${p.toFixed(1)}%` : "-";
3358
+ })() : absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
3315
3359
  ] })
3316
3360
  ] }),
3317
3361
  /* @__PURE__ */ jsx25("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsx25(
@@ -3341,7 +3385,9 @@ var TooltipSimple = ({
3341
3385
  finalColors = {},
3342
3386
  periodLabel = "Per\xEDodo",
3343
3387
  valueFormatter: valueFormatter2,
3344
- categoryFormatter
3388
+ categoryFormatter,
3389
+ yAxisMap,
3390
+ isBiaxial = false
3345
3391
  }) => {
3346
3392
  if (!active || !payload || payload.length === 0) return null;
3347
3393
  const displayLabel = categoryFormatter ? categoryFormatter(String(label ?? "")) : label;
@@ -3360,6 +3406,17 @@ var TooltipSimple = ({
3360
3406
  /* @__PURE__ */ jsx26("div", { className: "divide-y divide-border rounded-md overflow-hidden", children: payload.map((entry, index) => {
3361
3407
  const value = typeof entry.value === "number" ? entry.value : 0;
3362
3408
  const color = finalColors[entry.dataKey] || entry.color || "#999";
3409
+ let pct = 0;
3410
+ if (isBiaxial && yAxisMap) {
3411
+ const axis = yAxisMap[entry.dataKey] || "left";
3412
+ const axisSum = payload.filter(
3413
+ (p) => (yAxisMap[p.dataKey] || "left") === axis
3414
+ ).reduce(
3415
+ (s, p) => s + Math.abs(typeof p.value === "number" ? p.value : 0),
3416
+ 0
3417
+ );
3418
+ pct = axisSum > 0 ? Math.abs(value) / axisSum * 100 : 0;
3419
+ }
3363
3420
  const defaultFormatted = (() => {
3364
3421
  try {
3365
3422
  if (Math.abs(value) < 1e3) {
@@ -3394,13 +3451,16 @@ var TooltipSimple = ({
3394
3451
  ),
3395
3452
  /* @__PURE__ */ jsx26("span", { className: "text-muted-foreground truncate", children: entry.name })
3396
3453
  ] }),
3397
- /* @__PURE__ */ jsx26("div", { className: "ml-3", children: /* @__PURE__ */ jsx26(
3398
- "span",
3399
- {
3400
- className: `font-medium tabular-nums ${value < 0 ? "text-destructive" : "text-foreground"}`,
3401
- children: displayValue
3402
- }
3403
- ) })
3454
+ /* @__PURE__ */ jsx26("div", { className: "ml-3", children: /* @__PURE__ */ jsxs21("div", { className: "flex items-baseline gap-2", children: [
3455
+ /* @__PURE__ */ jsx26(
3456
+ "span",
3457
+ {
3458
+ className: `font-medium tabular-nums ${value < 0 ? "text-destructive" : "text-foreground"}`,
3459
+ children: displayValue
3460
+ }
3461
+ ),
3462
+ isBiaxial ? /* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: pct > 0 ? `${pct.toFixed(1)}%` : "-" }) : null
3463
+ ] }) })
3404
3464
  ]
3405
3465
  },
3406
3466
  index
@@ -3465,10 +3525,13 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
3465
3525
  const vb = props.viewBox;
3466
3526
  const cxNum = parseNumber(props.cx);
3467
3527
  let centerX;
3528
+ let usedBarCenter = false;
3468
3529
  if (typeof px === "number" && typeof pWidth === "number") {
3469
3530
  centerX = px + pWidth / 2;
3531
+ usedBarCenter = true;
3470
3532
  } else if (typeof xNum === "number" && typeof pWidth === "number") {
3471
3533
  centerX = xNum + pWidth / 2;
3534
+ usedBarCenter = true;
3472
3535
  } else if (typeof cxNum === "number") {
3473
3536
  centerX = cxNum;
3474
3537
  } else if (vb && typeof vb.x === "number" && typeof vb.width === "number" && typeof props.index === "number") {
@@ -3480,32 +3543,26 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
3480
3543
  } else {
3481
3544
  centerX = typeof props.index === "number" ? props.index * 40 + 24 : 0;
3482
3545
  }
3483
- if (vb && typeof vb.x === "number" && typeof vb.width === "number") {
3484
- const minX = vb.x + 0 + pillWidth / 22;
3485
- const maxX = vb.x + vb.width - 2 - pillWidth / 2;
3546
+ if (!usedBarCenter && vb && typeof vb.x === "number" && typeof vb.width === "number") {
3547
+ const minX = vb.x + pillWidth / 2;
3548
+ const maxX = vb.x + vb.width - pillWidth / 2;
3486
3549
  centerX = Math.max(minX, Math.min(maxX, centerX));
3487
3550
  }
3488
3551
  const yNum = parseNumber(y);
3489
3552
  const py = parseNumber(props.y);
3490
3553
  const cyNum = parseNumber(props.cy);
3491
3554
  const centerY = yNum ?? (typeof py === "number" ? py : vb && typeof vb.y === "number" && typeof vb.height === "number" ? vb.y + vb.height / 2 : typeof cyNum === "number" ? cyNum : 0);
3492
- const rectX = centerX - pillWidth / 3.5;
3555
+ const rectX = centerX - pillWidth / 2;
3493
3556
  const rectY = centerY - pillHeight - 6;
3494
- const textX = centerX - pillWidth / 3.5 + pillWidth / 2;
3557
+ const textX = centerX;
3495
3558
  const textY = rectY + pillHeight / 2 + 3;
3496
3559
  const rectFill = variant === "filled" ? color : variant === "soft" ? `${color}20` : "#ffffff";
3497
3560
  const rectStroke = variant === "outline" ? `${color}CC` : void 0;
3498
- const numValue = parseNumber(value);
3499
- const isNegative = typeof numValue === "number" && numValue < 0;
3500
3561
  let textColor;
3501
- if (isNegative) {
3502
- textColor = "#dc2626";
3562
+ if (variant === "filled") {
3563
+ textColor = "#ffffff";
3503
3564
  } else {
3504
- if (variant === "filled") {
3505
- textColor = "#ffffff";
3506
- } else {
3507
- textColor = "#374151";
3508
- }
3565
+ textColor = "#374151";
3509
3566
  }
3510
3567
  return /* @__PURE__ */ jsxs22("g", { children: [
3511
3568
  /* @__PURE__ */ jsx27(
@@ -3541,7 +3598,7 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
3541
3598
  var pillLabelRenderer_default = renderPillLabel;
3542
3599
 
3543
3600
  // src/components/charts/Chart.tsx
3544
- import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
3601
+ import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
3545
3602
  var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
3546
3603
  var Chart = ({
3547
3604
  data,
@@ -3570,7 +3627,10 @@ var Chart = ({
3570
3627
  showTooltipTotal = false,
3571
3628
  maxTooltips = 5,
3572
3629
  formatBR = false,
3573
- chartMargin
3630
+ chartMargin,
3631
+ yAxisMap,
3632
+ yAxes,
3633
+ periodLabel = "Per\xEDodo"
3574
3634
  }) => {
3575
3635
  const smartConfig = useMemo5(() => {
3576
3636
  const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
@@ -3701,6 +3761,70 @@ var Chart = ({
3701
3761
  }
3702
3762
  return min;
3703
3763
  }, [processedData, allKeys]);
3764
+ const leftKeys = useMemo5(
3765
+ () => !yAxisMap ? allKeys : allKeys.filter((k) => (yAxisMap?.[k] ?? "left") === "left"),
3766
+ [allKeys, yAxisMap]
3767
+ );
3768
+ const rightKeys = useMemo5(
3769
+ () => !yAxisMap ? [] : allKeys.filter((k) => (yAxisMap?.[k] ?? "left") === "right"),
3770
+ [allKeys, yAxisMap]
3771
+ );
3772
+ const maxForKeys = useCallback5(
3773
+ (keys) => {
3774
+ let max = 0;
3775
+ for (const row of processedData) {
3776
+ const r = row;
3777
+ for (const key of keys) {
3778
+ const v = r[key];
3779
+ if (typeof v === "number" && Number.isFinite(v) && v > max)
3780
+ max = v;
3781
+ }
3782
+ }
3783
+ return max;
3784
+ },
3785
+ [processedData]
3786
+ );
3787
+ const minForKeys = useCallback5(
3788
+ (keys) => {
3789
+ let min = 0;
3790
+ for (const row of processedData) {
3791
+ const r = row;
3792
+ for (const key of keys) {
3793
+ const v = r[key];
3794
+ if (typeof v === "number" && Number.isFinite(v) && v < min)
3795
+ min = v;
3796
+ }
3797
+ }
3798
+ return min;
3799
+ },
3800
+ [processedData]
3801
+ );
3802
+ const maxLeft = useMemo5(() => maxForKeys(leftKeys), [leftKeys, maxForKeys]);
3803
+ const minLeft = useMemo5(() => minForKeys(leftKeys), [leftKeys, minForKeys]);
3804
+ const maxRight = useMemo5(
3805
+ () => rightKeys.length > 0 ? maxForKeys(rightKeys) : 0,
3806
+ [rightKeys, maxForKeys]
3807
+ );
3808
+ const minRight = useMemo5(
3809
+ () => rightKeys.length > 0 ? minForKeys(rightKeys) : 0,
3810
+ [rightKeys, minForKeys]
3811
+ );
3812
+ const niceMaxLeft = useMemo5(() => {
3813
+ let padding = 0.08;
3814
+ if (maxLeft > 1e6) padding = 0.05;
3815
+ if (maxLeft > 1e7) padding = 0.03;
3816
+ if (maxLeft === 0) padding = 0.12;
3817
+ const padded = maxLeft * (1 + padding);
3818
+ return niceCeil(padded);
3819
+ }, [maxLeft]);
3820
+ const niceMaxRight = useMemo5(() => {
3821
+ let padding = 0.08;
3822
+ if (maxRight > 1e6) padding = 0.05;
3823
+ if (maxRight > 1e7) padding = 0.03;
3824
+ if (maxRight === 0) padding = 0.12;
3825
+ const padded = maxRight * (1 + padding);
3826
+ return niceCeil(padded);
3827
+ }, [maxRight]);
3704
3828
  const niceMax = useMemo5(() => {
3705
3829
  let padding = 0.08;
3706
3830
  if (maxDataValue > 1e6) padding = 0.05;
@@ -3890,8 +4014,57 @@ var Chart = ({
3890
4014
  const defaultChartRightMargin = 30;
3891
4015
  const defaultChartLeftMargin = 0;
3892
4016
  const containerPaddingLeft = 16;
3893
- const finalChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
3894
- const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? 40 : defaultChartLeftMargin);
4017
+ const estimateTextWidth = useCallback5((text) => {
4018
+ const s = String(text ?? "");
4019
+ if (typeof document === "undefined")
4020
+ return Math.min(200, s.length * 8 + 12);
4021
+ const canvas = document.createElement("canvas");
4022
+ const ctx = canvas.getContext("2d");
4023
+ if (!ctx) return Math.min(200, s.length * 8 + 12);
4024
+ ctx.font = "12px system-ui, -apple-system, 'Segoe UI', Roboto";
4025
+ const w = Math.ceil(ctx.measureText(s).width) + 12;
4026
+ return Math.min(300, w);
4027
+ }, []);
4028
+ const leftLabelSample = useMemo5(() => {
4029
+ if (!leftKeys || leftKeys.length === 0) return "";
4030
+ const candidates = [maxLeft, minLeft, niceMaxLeft];
4031
+ return String(
4032
+ candidates.map((v) => yTickFormatter(v)).sort((a, b) => String(b).length - String(a).length)[0] ?? ""
4033
+ );
4034
+ }, [leftKeys, maxLeft, minLeft, niceMaxLeft, yTickFormatter]);
4035
+ const rightLabelSample = useMemo5(() => {
4036
+ if (!rightKeys || rightKeys.length === 0) return "";
4037
+ const candidates = [maxRight, minRight, niceMaxRight];
4038
+ return String(
4039
+ candidates.map((v) => yTickFormatter(v)).sort((a, b) => String(b).length - String(a).length)[0] ?? ""
4040
+ );
4041
+ }, [rightKeys, maxRight, minRight, niceMaxRight, yTickFormatter]);
4042
+ const estimatedLeftNeeded = useMemo5(() => {
4043
+ const tickW = leftLabelSample ? estimateTextWidth(leftLabelSample) : 0;
4044
+ const axisW = yAxisLabel ? estimateTextWidth(yAxisLabel) + 8 : 0;
4045
+ return Math.max(
4046
+ defaultChartLeftMargin,
4047
+ Math.ceil(tickW + axisW + containerPaddingLeft / 2)
4048
+ );
4049
+ }, [leftLabelSample, yAxisLabel, estimateTextWidth]);
4050
+ const estimatedRightNeeded = useMemo5(() => {
4051
+ const tickW = rightLabelSample ? estimateTextWidth(rightLabelSample) : 0;
4052
+ const axisW = yAxes?.right?.label ? estimateTextWidth(yAxes.right.label) + 8 : 0;
4053
+ return Math.max(defaultChartRightMargin, Math.ceil(tickW + axisW / 2));
4054
+ }, [rightLabelSample, yAxes, estimateTextWidth]);
4055
+ const leftAxisLabelWidth = useMemo5(() => {
4056
+ const label = yAxes?.left?.label ?? yAxisLabel;
4057
+ return label ? estimateTextWidth(label) : 0;
4058
+ }, [yAxes, yAxisLabel, estimateTextWidth]);
4059
+ const rightAxisLabelWidth = useMemo5(() => {
4060
+ const label = yAxes?.right?.label;
4061
+ return label ? estimateTextWidth(label) : 0;
4062
+ }, [yAxes, estimateTextWidth]);
4063
+ const leftYAxisLabelDx = Math.ceil(leftAxisLabelWidth / 2) + 8;
4064
+ const rightYAxisLabelDx = Math.ceil(rightAxisLabelWidth / 2) + 8;
4065
+ const finalChartLeftMargin = chartMargin?.left ?? Math.max(estimatedLeftNeeded, yAxisLabel ? 40 : defaultChartLeftMargin);
4066
+ const finalChartRightMarginFinal = chartMargin?.right ?? estimatedRightNeeded;
4067
+ const finalChartRightMargin = finalChartRightMarginFinal;
3895
4068
  const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
3896
4069
  const baseBottom = chartMargin?.bottom ?? 5;
3897
4070
  const extraForXAxisLabel = xAxisLabel ? 22 : 0;
@@ -3969,8 +4142,7 @@ var Chart = ({
3969
4142
  ref: wrapperRef,
3970
4143
  style: {
3971
4144
  width: "100%",
3972
- overflowX: "hidden",
3973
- overflowY: "hidden",
4145
+ overflow: "visible",
3974
4146
  minWidth: 0
3975
4147
  },
3976
4148
  children: /* @__PURE__ */ jsxs23(
@@ -3985,7 +4157,6 @@ var Chart = ({
3985
4157
  style: {
3986
4158
  paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
3987
4159
  width: "100%",
3988
- maxWidth: `${chartInnerWidth}px`,
3989
4160
  display: "flex",
3990
4161
  justifyContent: titlePosition === "center" ? "center" : titlePosition === "right" ? "flex-end" : "flex-start",
3991
4162
  alignItems: "center",
@@ -4107,8 +4278,8 @@ var Chart = ({
4107
4278
  },
4108
4279
  label: xAxisLabel ? {
4109
4280
  value: xAxisLabel,
4110
- position: "insideBottomRight",
4111
- offset: -5,
4281
+ position: "bottom",
4282
+ offset: 12,
4112
4283
  style: {
4113
4284
  fontSize: 12,
4114
4285
  fill: "hsl(var(--muted-foreground))",
@@ -4117,7 +4288,61 @@ var Chart = ({
4117
4288
  } : void 0
4118
4289
  }
4119
4290
  ),
4120
- /* @__PURE__ */ jsx28(
4291
+ rightKeys.length > 0 ? /* @__PURE__ */ jsxs23(Fragment7, { children: [
4292
+ /* @__PURE__ */ jsx28(
4293
+ YAxis,
4294
+ {
4295
+ yAxisId: "left",
4296
+ stroke: yAxes?.left?.stroke || "hsl(var(--muted-foreground))",
4297
+ width: yAxes?.left?.width,
4298
+ fontSize: 12,
4299
+ tickLine: false,
4300
+ axisLine: false,
4301
+ tickFormatter: yTickFormatter,
4302
+ domain: [Math.min(minLeft, 0), niceMaxLeft],
4303
+ tickCount: 6,
4304
+ label: yAxes?.left?.label ?? yAxisLabel ? {
4305
+ value: yAxes?.left?.label ?? yAxisLabel,
4306
+ angle: -90,
4307
+ position: "left",
4308
+ dx: -leftYAxisLabelDx,
4309
+ style: {
4310
+ fontSize: 12,
4311
+ fill: "hsl(var(--muted-foreground))",
4312
+ fontWeight: 500,
4313
+ textAnchor: "middle"
4314
+ }
4315
+ } : void 0
4316
+ }
4317
+ ),
4318
+ /* @__PURE__ */ jsx28(
4319
+ YAxis,
4320
+ {
4321
+ yAxisId: "right",
4322
+ orientation: "right",
4323
+ stroke: yAxes?.right?.stroke || "hsl(var(--muted-foreground))",
4324
+ width: yAxes?.right?.width,
4325
+ fontSize: 12,
4326
+ tickLine: false,
4327
+ axisLine: false,
4328
+ tickFormatter: yTickFormatter,
4329
+ domain: [Math.min(minRight, 0), niceMaxRight],
4330
+ tickCount: 6,
4331
+ label: yAxes?.right?.label ? {
4332
+ value: yAxes?.right?.label,
4333
+ angle: -90,
4334
+ position: "right",
4335
+ dx: rightYAxisLabelDx,
4336
+ style: {
4337
+ fontSize: 12,
4338
+ fill: "hsl(var(--muted-foreground))",
4339
+ fontWeight: 500,
4340
+ textAnchor: "middle"
4341
+ }
4342
+ } : void 0
4343
+ }
4344
+ )
4345
+ ] }) : /* @__PURE__ */ jsx28(Fragment7, { children: /* @__PURE__ */ jsx28(
4121
4346
  YAxis,
4122
4347
  {
4123
4348
  stroke: "hsl(var(--muted-foreground))",
@@ -4130,7 +4355,8 @@ var Chart = ({
4130
4355
  label: yAxisLabel ? {
4131
4356
  value: yAxisLabel,
4132
4357
  angle: -90,
4133
- position: "leftTop",
4358
+ position: "left",
4359
+ dx: -leftYAxisLabelDx,
4134
4360
  style: {
4135
4361
  fontSize: 12,
4136
4362
  fill: "hsl(var(--muted-foreground))",
@@ -4139,8 +4365,8 @@ var Chart = ({
4139
4365
  }
4140
4366
  } : void 0
4141
4367
  }
4142
- ),
4143
- minDataValue < 0 && /* @__PURE__ */ jsx28(
4368
+ ) }),
4369
+ (minDataValue < 0 || minLeft < 0 || minRight < 0) && /* @__PURE__ */ jsx28(
4144
4370
  ReferenceLine,
4145
4371
  {
4146
4372
  y: 0,
@@ -4155,16 +4381,22 @@ var Chart = ({
4155
4381
  content: showTooltipTotal ? /* @__PURE__ */ jsx28(
4156
4382
  TooltipWithTotal_default,
4157
4383
  {
4384
+ periodLabel,
4158
4385
  finalColors,
4159
4386
  valueFormatter: finalValueFormatter,
4160
- categoryFormatter
4387
+ categoryFormatter,
4388
+ yAxisMap,
4389
+ isBiaxial: rightKeys.length > 0
4161
4390
  }
4162
4391
  ) : /* @__PURE__ */ jsx28(
4163
4392
  TooltipSimple_default,
4164
4393
  {
4394
+ periodLabel,
4165
4395
  finalColors,
4166
4396
  valueFormatter: finalValueFormatter,
4167
- categoryFormatter
4397
+ categoryFormatter,
4398
+ yAxisMap,
4399
+ isBiaxial: rightKeys.length > 0
4168
4400
  }
4169
4401
  ),
4170
4402
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
@@ -4190,6 +4422,7 @@ var Chart = ({
4190
4422
  return /* @__PURE__ */ jsx28(
4191
4423
  Bar,
4192
4424
  {
4425
+ yAxisId: yAxisMap?.[key],
4193
4426
  dataKey: key,
4194
4427
  name: label,
4195
4428
  fill: color,
@@ -4229,6 +4462,7 @@ var Chart = ({
4229
4462
  return /* @__PURE__ */ jsx28(
4230
4463
  Line,
4231
4464
  {
4465
+ yAxisId: yAxisMap?.[key],
4232
4466
  dataKey: key,
4233
4467
  name: label,
4234
4468
  stroke: color,
@@ -4262,6 +4496,7 @@ var Chart = ({
4262
4496
  return /* @__PURE__ */ jsx28(
4263
4497
  Area,
4264
4498
  {
4499
+ yAxisId: yAxisMap?.[key],
4265
4500
  dataKey: key,
4266
4501
  name: label,
4267
4502
  stroke: color,
@@ -4310,7 +4545,7 @@ var Chart = ({
4310
4545
  showOnlyHighlighted,
4311
4546
  onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
4312
4547
  onPositionChange: onTooltipPositionChange,
4313
- periodLabel: "Per\xEDodo Selecionado",
4548
+ periodLabel,
4314
4549
  dataLabel: "Dados do Per\xEDodo",
4315
4550
  valueFormatter: finalValueFormatter,
4316
4551
  categoryFormatter,
@@ -6013,7 +6248,7 @@ import {
6013
6248
  FilePptIcon,
6014
6249
  FileDocIcon
6015
6250
  } from "@phosphor-icons/react";
6016
- import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
6251
+ import { Fragment as Fragment8, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
6017
6252
  var formatFileSize = (bytes) => {
6018
6253
  if (bytes === 0) return "0 Bytes";
6019
6254
  const k = 1024;
@@ -6408,7 +6643,7 @@ var FileUploader = React18.forwardRef(
6408
6643
  ),
6409
6644
  /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
6410
6645
  /* @__PURE__ */ jsx36("span", { children: formatFileSize(file.size) }),
6411
- file.type && /* @__PURE__ */ jsxs27(Fragment7, { children: [
6646
+ file.type && /* @__PURE__ */ jsxs27(Fragment8, { children: [
6412
6647
  /* @__PURE__ */ jsx36("span", { children: "\u2022" }),
6413
6648
  /* @__PURE__ */ jsx36("span", { className: "uppercase", children: getFileExtension(file.name) })
6414
6649
  ] })
@@ -10575,7 +10810,7 @@ var TimePickerInput = React41.forwardRef(
10575
10810
  TimePickerInput.displayName = "TimePickerInput";
10576
10811
 
10577
10812
  // src/components/picker/TimePicker.tsx
10578
- import { Fragment as Fragment9, jsx as jsx65, jsxs as jsxs48 } from "react/jsx-runtime";
10813
+ import { Fragment as Fragment10, jsx as jsx65, jsxs as jsxs48 } from "react/jsx-runtime";
10579
10814
  function TimePicker({
10580
10815
  date,
10581
10816
  setDate,
@@ -10645,7 +10880,7 @@ function TimePicker({
10645
10880
  )
10646
10881
  }
10647
10882
  ),
10648
- /* @__PURE__ */ jsx65(AnimatePresence10, { children: !hideSeconds && /* @__PURE__ */ jsx65(Fragment9, { children: /* @__PURE__ */ jsx65(
10883
+ /* @__PURE__ */ jsx65(AnimatePresence10, { children: !hideSeconds && /* @__PURE__ */ jsx65(Fragment10, { children: /* @__PURE__ */ jsx65(
10649
10884
  motion14.div,
10650
10885
  {
10651
10886
  variants: itemVariants2,
@@ -12437,7 +12672,7 @@ import {
12437
12672
  CalendarIcon as CalendarIcon3,
12438
12673
  PlusIcon as PlusIcon3
12439
12674
  } from "@phosphor-icons/react";
12440
- import { Fragment as Fragment10, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
12675
+ import { Fragment as Fragment11, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
12441
12676
  function EventCalendar({
12442
12677
  events = [],
12443
12678
  onEventAdd,
@@ -12640,7 +12875,7 @@ function EventCalendar({
12640
12875
  const year = format5(currentDate, "yyyy", { locale: ptBR4 });
12641
12876
  const short = `${dayNum} de ${month} de ${year}`;
12642
12877
  const long = `${format5(currentDate, "EEE", { locale: ptBR4 })}, ${dayNum} de ${month} de ${year}`;
12643
- return /* @__PURE__ */ jsxs57(Fragment10, { children: [
12878
+ return /* @__PURE__ */ jsxs57(Fragment11, { children: [
12644
12879
  /* @__PURE__ */ jsx77("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
12645
12880
  /* @__PURE__ */ jsx77("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
12646
12881
  /* @__PURE__ */ jsx77("span", { className: "max-md:hidden", children: long })
@@ -13334,7 +13569,7 @@ function EventDialog({
13334
13569
  // src/components/event-calendar/EventItem.tsx
13335
13570
  import { differenceInMinutes as differenceInMinutes3, format as format7, isPast } from "date-fns";
13336
13571
  import { useMemo as useMemo13 } from "react";
13337
- import { Fragment as Fragment11, jsx as jsx79, jsxs as jsxs59 } from "react/jsx-runtime";
13572
+ import { Fragment as Fragment12, jsx as jsx79, jsxs as jsxs59 } from "react/jsx-runtime";
13338
13573
  var formatTimeWithOptionalMinutes = (date) => {
13339
13574
  return format7(date, "HH:mm");
13340
13575
  };
@@ -13469,7 +13704,7 @@ function EventItem({
13469
13704
  children: durationMinutes < 45 ? /* @__PURE__ */ jsxs59("div", { className: "flex items-center justify-between w-full", children: [
13470
13705
  /* @__PURE__ */ jsx79("div", { className: "truncate", children: event.title }),
13471
13706
  showTime && /* @__PURE__ */ jsx79("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes(displayStart) })
13472
- ] }) : /* @__PURE__ */ jsxs59(Fragment11, { children: [
13707
+ ] }) : /* @__PURE__ */ jsxs59(Fragment12, { children: [
13473
13708
  /* @__PURE__ */ jsx79("div", { className: "truncate font-medium", children: event.title }),
13474
13709
  showTime && /* @__PURE__ */ jsx79("div", { className: "truncate font-normal opacity-70 sm:text-[11px]", children: /* @__PURE__ */ jsx79("span", { className: "inline-block bg-white/5 px-2 py-0.5 rounded-full", children: getEventTime() }) })
13475
13710
  ] })
@@ -14575,9 +14810,9 @@ export {
14575
14810
  AlertDialogTitleBase,
14576
14811
  AlertDialogTriggerBase,
14577
14812
  AvatarBase,
14813
+ AvatarCombobox,
14578
14814
  AvatarFallbackBase,
14579
14815
  AvatarImageBase,
14580
- AvatarSelect,
14581
14816
  BackButton,
14582
14817
  Badge,
14583
14818
  BarChart_default as BarChart,