@mlw-packages/react-components 1.7.12 → 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.css +90 -15
- package/dist/index.d.mts +47 -9
- package/dist/index.d.ts +47 -9
- package/dist/index.js +589 -197
- package/dist/index.mjs +656 -264
- package/package.json +3 -2
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(
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
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
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
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: "
|
|
1016
|
-
"data-testid": testIds.
|
|
1017
|
-
children:
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
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
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
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
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
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
|
-
|
|
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(
|
|
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:
|
|
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/
|
|
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
|
|
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
|
|
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:
|
|
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__ */
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
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 +
|
|
3485
|
-
const maxX = vb.x + vb.width -
|
|
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 /
|
|
3555
|
+
const rectX = centerX - pillWidth / 2;
|
|
3493
3556
|
const rectY = centerY - pillHeight - 6;
|
|
3494
|
-
const textX = centerX
|
|
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 (
|
|
3502
|
-
textColor = "#
|
|
3562
|
+
if (variant === "filled") {
|
|
3563
|
+
textColor = "#ffffff";
|
|
3503
3564
|
} else {
|
|
3504
|
-
|
|
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
|
|
3894
|
-
|
|
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
|
-
|
|
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: "
|
|
4111
|
-
offset:
|
|
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__ */
|
|
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: "
|
|
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
|
|
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
|
|
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(
|
|
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
|
] })
|
|
@@ -7268,44 +7503,50 @@ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
|
7268
7503
|
import { CheckIcon as CheckIcon8, MinusIcon } from "@phosphor-icons/react";
|
|
7269
7504
|
import { motion as motion11 } from "framer-motion";
|
|
7270
7505
|
import { jsx as jsx44, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7271
|
-
var CheckboxBase = React24.forwardRef(({ className, testid: dataTestId = "checkbox-base", ...props }, ref) =>
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
)
|
|
7506
|
+
var CheckboxBase = React24.forwardRef(({ className, testid: dataTestId = "checkbox-base", checked: checkedProp, defaultChecked, onCheckedChange, ...props }, ref) => {
|
|
7507
|
+
const isControlled = checkedProp !== void 0;
|
|
7508
|
+
const [checkedState, setCheckedState] = React24.useState(
|
|
7509
|
+
isControlled ? checkedProp : defaultChecked ?? false
|
|
7510
|
+
);
|
|
7511
|
+
React24.useEffect(() => {
|
|
7512
|
+
if (isControlled) setCheckedState(checkedProp);
|
|
7513
|
+
}, [checkedProp, isControlled]);
|
|
7514
|
+
const handleCheckedChange = (next) => {
|
|
7515
|
+
if (!isControlled) setCheckedState(next);
|
|
7516
|
+
onCheckedChange?.(next);
|
|
7517
|
+
};
|
|
7518
|
+
const stateClass = checkedState === true || checkedState === "indeterminate" ? "bg-primary text-primary-foreground" : "";
|
|
7519
|
+
return /* @__PURE__ */ jsx44(
|
|
7520
|
+
CheckboxPrimitive.Root,
|
|
7521
|
+
{
|
|
7522
|
+
ref,
|
|
7523
|
+
checked: checkedProp,
|
|
7524
|
+
defaultChecked,
|
|
7525
|
+
onCheckedChange: handleCheckedChange,
|
|
7526
|
+
className: cn(
|
|
7527
|
+
"group h-4 w-4 shrink-0 rounded-md border border-primary shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 transition-colors",
|
|
7528
|
+
stateClass,
|
|
7529
|
+
className
|
|
7530
|
+
),
|
|
7531
|
+
"data-testid": dataTestId,
|
|
7532
|
+
...props,
|
|
7533
|
+
children: /* @__PURE__ */ jsx44(CheckboxPrimitive.Indicator, { asChild: true, children: /* @__PURE__ */ jsxs33(
|
|
7534
|
+
motion11.div,
|
|
7535
|
+
{
|
|
7536
|
+
initial: { scale: 0, opacity: 0, rotate: -90 },
|
|
7537
|
+
animate: { scale: 1, opacity: 1, rotate: 0 },
|
|
7538
|
+
exit: { scale: 0, opacity: 0, rotate: 90 },
|
|
7539
|
+
transition: { type: "spring", stiffness: 500, damping: 30 },
|
|
7540
|
+
className: "flex items-center justify-center text-current",
|
|
7541
|
+
children: [
|
|
7542
|
+
checkedState === true && /* @__PURE__ */ jsx44(CheckIcon8, { className: "h-4 w-4", weight: "bold" }),
|
|
7543
|
+
checkedState === "indeterminate" && /* @__PURE__ */ jsx44(MinusIcon, { className: "h-4 w-4", weight: "bold" })
|
|
7544
|
+
]
|
|
7545
|
+
}
|
|
7546
|
+
) })
|
|
7547
|
+
}
|
|
7548
|
+
);
|
|
7549
|
+
});
|
|
7309
7550
|
CheckboxBase.displayName = CheckboxPrimitive.Root.displayName;
|
|
7310
7551
|
|
|
7311
7552
|
// src/components/ui/form/CollapsibleBase.tsx
|
|
@@ -9920,7 +10161,7 @@ function DrawerDescriptionBase({
|
|
|
9920
10161
|
}
|
|
9921
10162
|
|
|
9922
10163
|
// src/hooks/use-universal-tooltip.tsx
|
|
9923
|
-
import { createContext as createContext4, useContext as useContext5, useState as
|
|
10164
|
+
import { createContext as createContext4, useContext as useContext5, useState as useState17, useCallback as useCallback11, useEffect as useEffect15, useRef as useRef7 } from "react";
|
|
9924
10165
|
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
9925
10166
|
var UniversalTooltipContext = createContext4(null);
|
|
9926
10167
|
var useUniversalTooltip = () => {
|
|
@@ -10220,7 +10461,7 @@ CalendarBase2.displayName = "CalendarBase";
|
|
|
10220
10461
|
|
|
10221
10462
|
// src/components/picker/DateTimePicker.tsx
|
|
10222
10463
|
import { ptBR } from "date-fns/locale";
|
|
10223
|
-
import { useEffect as
|
|
10464
|
+
import { useEffect as useEffect16, useState as useState19 } from "react";
|
|
10224
10465
|
|
|
10225
10466
|
// src/components/picker/TimePicker.tsx
|
|
10226
10467
|
import { motion as motion14, AnimatePresence as AnimatePresence10 } from "framer-motion";
|
|
@@ -10569,7 +10810,7 @@ var TimePickerInput = React41.forwardRef(
|
|
|
10569
10810
|
TimePickerInput.displayName = "TimePickerInput";
|
|
10570
10811
|
|
|
10571
10812
|
// src/components/picker/TimePicker.tsx
|
|
10572
|
-
import { Fragment as
|
|
10813
|
+
import { Fragment as Fragment10, jsx as jsx65, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
10573
10814
|
function TimePicker({
|
|
10574
10815
|
date,
|
|
10575
10816
|
setDate,
|
|
@@ -10639,7 +10880,7 @@ function TimePicker({
|
|
|
10639
10880
|
)
|
|
10640
10881
|
}
|
|
10641
10882
|
),
|
|
10642
|
-
/* @__PURE__ */ jsx65(AnimatePresence10, { children: !hideSeconds && /* @__PURE__ */ jsx65(
|
|
10883
|
+
/* @__PURE__ */ jsx65(AnimatePresence10, { children: !hideSeconds && /* @__PURE__ */ jsx65(Fragment10, { children: /* @__PURE__ */ jsx65(
|
|
10643
10884
|
motion14.div,
|
|
10644
10885
|
{
|
|
10645
10886
|
variants: itemVariants2,
|
|
@@ -10681,9 +10922,9 @@ function DateTimePicker({
|
|
|
10681
10922
|
className,
|
|
10682
10923
|
error
|
|
10683
10924
|
}) {
|
|
10684
|
-
const [internalDate, setInternalDate] =
|
|
10685
|
-
const [open, setOpen] =
|
|
10686
|
-
const [timePickerOpen, setTimePickerOpen] =
|
|
10925
|
+
const [internalDate, setInternalDate] = useState19(date);
|
|
10926
|
+
const [open, setOpen] = useState19(false);
|
|
10927
|
+
const [timePickerOpen, setTimePickerOpen] = useState19(false);
|
|
10687
10928
|
const handleSelect = (newDay) => {
|
|
10688
10929
|
if (!newDay) return;
|
|
10689
10930
|
if (!internalDate) {
|
|
@@ -10714,7 +10955,7 @@ function DateTimePicker({
|
|
|
10714
10955
|
if (!timeFormat) return "dd MMMM yyyy";
|
|
10715
10956
|
return `dd MMMM yyyy - ${timeFormat}`;
|
|
10716
10957
|
};
|
|
10717
|
-
|
|
10958
|
+
useEffect16(() => {
|
|
10718
10959
|
setInternalDate(date);
|
|
10719
10960
|
}, [date, open]);
|
|
10720
10961
|
return /* @__PURE__ */ jsxs49("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
@@ -11668,7 +11909,7 @@ function StatusIndicator({
|
|
|
11668
11909
|
}
|
|
11669
11910
|
|
|
11670
11911
|
// src/components/ui/form/DebouncedInput.tsx
|
|
11671
|
-
import { useEffect as
|
|
11912
|
+
import { useEffect as useEffect18, useState as useState21 } from "react";
|
|
11672
11913
|
import { CircleNotchIcon as CircleNotchIcon2 } from "@phosphor-icons/react";
|
|
11673
11914
|
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
11674
11915
|
function DebouncedInput({
|
|
@@ -11684,12 +11925,12 @@ function DebouncedInput({
|
|
|
11684
11925
|
error,
|
|
11685
11926
|
...props
|
|
11686
11927
|
}) {
|
|
11687
|
-
const [value, setValue] =
|
|
11688
|
-
const [isDebouncing, setIsDebouncing] =
|
|
11689
|
-
|
|
11928
|
+
const [value, setValue] = useState21(initialValue);
|
|
11929
|
+
const [isDebouncing, setIsDebouncing] = useState21(false);
|
|
11930
|
+
useEffect18(() => {
|
|
11690
11931
|
setValue(initialValue);
|
|
11691
11932
|
}, [initialValue]);
|
|
11692
|
-
|
|
11933
|
+
useEffect18(() => {
|
|
11693
11934
|
if (value !== initialValue) {
|
|
11694
11935
|
setIsDebouncing(true);
|
|
11695
11936
|
}
|
|
@@ -11800,7 +12041,7 @@ import {
|
|
|
11800
12041
|
useSensors
|
|
11801
12042
|
} from "@dnd-kit/core";
|
|
11802
12043
|
import { addMinutes, differenceInMinutes } from "date-fns";
|
|
11803
|
-
import { useId as useId2, useRef as useRef9, useState as
|
|
12044
|
+
import { useId as useId2, useRef as useRef9, useState as useState22 } from "react";
|
|
11804
12045
|
|
|
11805
12046
|
// src/components/event-calendar/hooks.ts
|
|
11806
12047
|
import { createContext as createContext5, useContext as useContext6 } from "react";
|
|
@@ -11822,16 +12063,16 @@ function CalendarDndProvider({
|
|
|
11822
12063
|
children,
|
|
11823
12064
|
onEventUpdate
|
|
11824
12065
|
}) {
|
|
11825
|
-
const [activeEvent, setActiveEvent] =
|
|
11826
|
-
const [activeId, setActiveId] =
|
|
11827
|
-
const [activeView, setActiveView] =
|
|
12066
|
+
const [activeEvent, setActiveEvent] = useState22(null);
|
|
12067
|
+
const [activeId, setActiveId] = useState22(null);
|
|
12068
|
+
const [activeView, setActiveView] = useState22(
|
|
11828
12069
|
null
|
|
11829
12070
|
);
|
|
11830
|
-
const [currentTime, setCurrentTime] =
|
|
11831
|
-
const [eventHeight, setEventHeight] =
|
|
11832
|
-
const [isMultiDay, setIsMultiDay] =
|
|
11833
|
-
const [multiDayWidth, setMultiDayWidth] =
|
|
11834
|
-
const [dragHandlePosition, setDragHandlePosition] =
|
|
12071
|
+
const [currentTime, setCurrentTime] = useState22(null);
|
|
12072
|
+
const [eventHeight, setEventHeight] = useState22(null);
|
|
12073
|
+
const [isMultiDay, setIsMultiDay] = useState22(false);
|
|
12074
|
+
const [multiDayWidth, setMultiDayWidth] = useState22(null);
|
|
12075
|
+
const [dragHandlePosition, setDragHandlePosition] = useState22(null);
|
|
11835
12076
|
const eventDimensions = useRef9({ height: 0 });
|
|
11836
12077
|
const sensors = useSensors(
|
|
11837
12078
|
useSensor(MouseSensor, {
|
|
@@ -12271,7 +12512,7 @@ function DayView({
|
|
|
12271
12512
|
import { useDraggable } from "@dnd-kit/core";
|
|
12272
12513
|
import { CSS } from "@dnd-kit/utilities";
|
|
12273
12514
|
import { differenceInDays } from "date-fns";
|
|
12274
|
-
import { useRef as useRef10, useState as
|
|
12515
|
+
import { useRef as useRef10, useState as useState23 } from "react";
|
|
12275
12516
|
import { jsx as jsx75 } from "react/jsx-runtime";
|
|
12276
12517
|
function DraggableEvent({
|
|
12277
12518
|
event,
|
|
@@ -12287,7 +12528,7 @@ function DraggableEvent({
|
|
|
12287
12528
|
}) {
|
|
12288
12529
|
const { activeId } = useCalendarDnd();
|
|
12289
12530
|
const elementRef = useRef10(null);
|
|
12290
|
-
const [dragHandlePosition, setDragHandlePosition] =
|
|
12531
|
+
const [dragHandlePosition, setDragHandlePosition] = useState23(null);
|
|
12291
12532
|
const eventStart = new Date(event.start);
|
|
12292
12533
|
const eventEnd = new Date(event.end);
|
|
12293
12534
|
const isMultiDayEvent2 = isMultiDay || event.allDay || differenceInDays(eventEnd, eventStart) >= 1;
|
|
@@ -12422,7 +12663,7 @@ import {
|
|
|
12422
12663
|
subWeeks
|
|
12423
12664
|
} from "date-fns";
|
|
12424
12665
|
import { ptBR as ptBR4 } from "date-fns/locale";
|
|
12425
|
-
import { useEffect as
|
|
12666
|
+
import { useEffect as useEffect19, useMemo as useMemo11, useState as useState24, useCallback as useCallback12 } from "react";
|
|
12426
12667
|
import { toast as toast3 } from "sonner";
|
|
12427
12668
|
import {
|
|
12428
12669
|
ArrowDownIcon,
|
|
@@ -12431,7 +12672,7 @@ import {
|
|
|
12431
12672
|
CalendarIcon as CalendarIcon3,
|
|
12432
12673
|
PlusIcon as PlusIcon3
|
|
12433
12674
|
} from "@phosphor-icons/react";
|
|
12434
|
-
import { Fragment as
|
|
12675
|
+
import { Fragment as Fragment11, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
12435
12676
|
function EventCalendar({
|
|
12436
12677
|
events = [],
|
|
12437
12678
|
onEventAdd,
|
|
@@ -12440,9 +12681,9 @@ function EventCalendar({
|
|
|
12440
12681
|
className,
|
|
12441
12682
|
initialView = "month"
|
|
12442
12683
|
}) {
|
|
12443
|
-
const [currentDate, setCurrentDate] =
|
|
12444
|
-
const [view, setView] =
|
|
12445
|
-
const [isFading, setIsFading] =
|
|
12684
|
+
const [currentDate, setCurrentDate] = useState24(/* @__PURE__ */ new Date());
|
|
12685
|
+
const [view, setView] = useState24(initialView);
|
|
12686
|
+
const [isFading, setIsFading] = useState24(false);
|
|
12446
12687
|
const FADE_DURATION = 220;
|
|
12447
12688
|
const changeView = useCallback12(
|
|
12448
12689
|
(next) => {
|
|
@@ -12455,8 +12696,8 @@ function EventCalendar({
|
|
|
12455
12696
|
},
|
|
12456
12697
|
[view]
|
|
12457
12698
|
);
|
|
12458
|
-
const [isPaging, setIsPaging] =
|
|
12459
|
-
const [pageDirection, setPageDirection] =
|
|
12699
|
+
const [isPaging, setIsPaging] = useState24(false);
|
|
12700
|
+
const [pageDirection, setPageDirection] = useState24(
|
|
12460
12701
|
null
|
|
12461
12702
|
);
|
|
12462
12703
|
const PAGE_DURATION = 200;
|
|
@@ -12474,11 +12715,11 @@ function EventCalendar({
|
|
|
12474
12715
|
},
|
|
12475
12716
|
[]
|
|
12476
12717
|
);
|
|
12477
|
-
const [isEventDialogOpen, setIsEventDialogOpen] =
|
|
12478
|
-
const [selectedEvent, setSelectedEvent] =
|
|
12718
|
+
const [isEventDialogOpen, setIsEventDialogOpen] = useState24(false);
|
|
12719
|
+
const [selectedEvent, setSelectedEvent] = useState24(
|
|
12479
12720
|
null
|
|
12480
12721
|
);
|
|
12481
|
-
|
|
12722
|
+
useEffect19(() => {
|
|
12482
12723
|
const handleKeyDown = (e) => {
|
|
12483
12724
|
if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
|
|
12484
12725
|
return;
|
|
@@ -12634,7 +12875,7 @@ function EventCalendar({
|
|
|
12634
12875
|
const year = format5(currentDate, "yyyy", { locale: ptBR4 });
|
|
12635
12876
|
const short = `${dayNum} de ${month} de ${year}`;
|
|
12636
12877
|
const long = `${format5(currentDate, "EEE", { locale: ptBR4 })}, ${dayNum} de ${month} de ${year}`;
|
|
12637
|
-
return /* @__PURE__ */ jsxs57(
|
|
12878
|
+
return /* @__PURE__ */ jsxs57(Fragment11, { children: [
|
|
12638
12879
|
/* @__PURE__ */ jsx77("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
|
|
12639
12880
|
/* @__PURE__ */ jsx77("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
|
|
12640
12881
|
/* @__PURE__ */ jsx77("span", { className: "max-md:hidden", children: long })
|
|
@@ -12865,7 +13106,7 @@ function EventCalendar({
|
|
|
12865
13106
|
|
|
12866
13107
|
// src/components/event-calendar/EventDialog.tsx
|
|
12867
13108
|
import { format as format6, isBefore } from "date-fns";
|
|
12868
|
-
import { useCallback as useCallback13, useEffect as
|
|
13109
|
+
import { useCallback as useCallback13, useEffect as useEffect20, useMemo as useMemo12, useState as useState25 } from "react";
|
|
12869
13110
|
import { RadioGroup as RadioGroup3, RadioGroupItem } from "@radix-ui/react-radio-group";
|
|
12870
13111
|
import { motion as motion16 } from "framer-motion";
|
|
12871
13112
|
import { ptBR as ptBR5 } from "date-fns/locale";
|
|
@@ -12878,19 +13119,19 @@ function EventDialog({
|
|
|
12878
13119
|
onSave,
|
|
12879
13120
|
onDelete
|
|
12880
13121
|
}) {
|
|
12881
|
-
const [title, setTitle] =
|
|
12882
|
-
const [description, setDescription] =
|
|
12883
|
-
const [startDate, setStartDate] =
|
|
12884
|
-
const [endDate, setEndDate] =
|
|
12885
|
-
const [startTime, setStartTime] =
|
|
12886
|
-
const [endTime, setEndTime] =
|
|
12887
|
-
const [allDay, setAllDay] =
|
|
12888
|
-
const [location, setLocation] =
|
|
12889
|
-
const [color, setColor] =
|
|
12890
|
-
const [error, setError] =
|
|
12891
|
-
const [startDateOpen, setStartDateOpen] =
|
|
12892
|
-
const [endDateOpen, setEndDateOpen] =
|
|
12893
|
-
|
|
13122
|
+
const [title, setTitle] = useState25("");
|
|
13123
|
+
const [description, setDescription] = useState25("");
|
|
13124
|
+
const [startDate, setStartDate] = useState25(/* @__PURE__ */ new Date());
|
|
13125
|
+
const [endDate, setEndDate] = useState25(/* @__PURE__ */ new Date());
|
|
13126
|
+
const [startTime, setStartTime] = useState25(`${DefaultStartHour}:00`);
|
|
13127
|
+
const [endTime, setEndTime] = useState25(`${DefaultEndHour}:00`);
|
|
13128
|
+
const [allDay, setAllDay] = useState25(false);
|
|
13129
|
+
const [location, setLocation] = useState25("");
|
|
13130
|
+
const [color, setColor] = useState25("sky");
|
|
13131
|
+
const [error, setError] = useState25(null);
|
|
13132
|
+
const [startDateOpen, setStartDateOpen] = useState25(false);
|
|
13133
|
+
const [endDateOpen, setEndDateOpen] = useState25(false);
|
|
13134
|
+
useEffect20(() => {
|
|
12894
13135
|
}, [event]);
|
|
12895
13136
|
const resetForm = useCallback13(() => {
|
|
12896
13137
|
setTitle("");
|
|
@@ -12909,7 +13150,7 @@ function EventDialog({
|
|
|
12909
13150
|
const minutes = Math.floor(date.getMinutes() / 15) * 15;
|
|
12910
13151
|
return `${hours}:${minutes.toString().padStart(2, "0")}`;
|
|
12911
13152
|
}, []);
|
|
12912
|
-
|
|
13153
|
+
useEffect20(() => {
|
|
12913
13154
|
if (event) {
|
|
12914
13155
|
setTitle(event.title || "");
|
|
12915
13156
|
setDescription(event.description || "");
|
|
@@ -13328,7 +13569,7 @@ function EventDialog({
|
|
|
13328
13569
|
// src/components/event-calendar/EventItem.tsx
|
|
13329
13570
|
import { differenceInMinutes as differenceInMinutes3, format as format7, isPast } from "date-fns";
|
|
13330
13571
|
import { useMemo as useMemo13 } from "react";
|
|
13331
|
-
import { Fragment as
|
|
13572
|
+
import { Fragment as Fragment12, jsx as jsx79, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
13332
13573
|
var formatTimeWithOptionalMinutes = (date) => {
|
|
13333
13574
|
return format7(date, "HH:mm");
|
|
13334
13575
|
};
|
|
@@ -13463,7 +13704,7 @@ function EventItem({
|
|
|
13463
13704
|
children: durationMinutes < 45 ? /* @__PURE__ */ jsxs59("div", { className: "flex items-center justify-between w-full", children: [
|
|
13464
13705
|
/* @__PURE__ */ jsx79("div", { className: "truncate", children: event.title }),
|
|
13465
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) })
|
|
13466
|
-
] }) : /* @__PURE__ */ jsxs59(
|
|
13707
|
+
] }) : /* @__PURE__ */ jsxs59(Fragment12, { children: [
|
|
13467
13708
|
/* @__PURE__ */ jsx79("div", { className: "truncate font-medium", children: event.title }),
|
|
13468
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() }) })
|
|
13469
13710
|
] })
|
|
@@ -13521,7 +13762,7 @@ function EventItem({
|
|
|
13521
13762
|
// src/components/event-calendar/EventsPopUp.tsx
|
|
13522
13763
|
import { format as format8, isSameDay as isSameDay2 } from "date-fns";
|
|
13523
13764
|
import { ptBR as ptBR6 } from "date-fns/locale";
|
|
13524
|
-
import { useEffect as
|
|
13765
|
+
import { useEffect as useEffect21, useMemo as useMemo14, useRef as useRef11 } from "react";
|
|
13525
13766
|
import { motion as motion17 } from "framer-motion";
|
|
13526
13767
|
import { XIcon as XIcon11 } from "@phosphor-icons/react";
|
|
13527
13768
|
import { jsx as jsx80, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
@@ -13533,7 +13774,7 @@ function EventsPopup({
|
|
|
13533
13774
|
onEventSelect
|
|
13534
13775
|
}) {
|
|
13535
13776
|
const popupRef = useRef11(null);
|
|
13536
|
-
|
|
13777
|
+
useEffect21(() => {
|
|
13537
13778
|
const handleClickOutside = (event) => {
|
|
13538
13779
|
if (popupRef.current && !popupRef.current.contains(event.target)) {
|
|
13539
13780
|
onClose();
|
|
@@ -13544,7 +13785,7 @@ function EventsPopup({
|
|
|
13544
13785
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
13545
13786
|
};
|
|
13546
13787
|
}, [onClose]);
|
|
13547
|
-
|
|
13788
|
+
useEffect21(() => {
|
|
13548
13789
|
const handleEscKey = (event) => {
|
|
13549
13790
|
if (event.key === "Escape") {
|
|
13550
13791
|
onClose();
|
|
@@ -13638,11 +13879,11 @@ function EventsPopup({
|
|
|
13638
13879
|
// src/components/event-calendar/hooks/use-current-time-indicator.ts
|
|
13639
13880
|
import { endOfWeek as endOfWeek2, isSameDay as isSameDay3, isWithinInterval, startOfWeek as startOfWeek2 } from "date-fns";
|
|
13640
13881
|
import { ptBR as ptBR7 } from "date-fns/locale";
|
|
13641
|
-
import { useEffect as
|
|
13882
|
+
import { useEffect as useEffect22, useState as useState26 } from "react";
|
|
13642
13883
|
function useCurrentTimeIndicator(currentDate, view) {
|
|
13643
|
-
const [currentTimePosition, setCurrentTimePosition] =
|
|
13644
|
-
const [currentTimeVisible, setCurrentTimeVisible] =
|
|
13645
|
-
|
|
13884
|
+
const [currentTimePosition, setCurrentTimePosition] = useState26(0);
|
|
13885
|
+
const [currentTimeVisible, setCurrentTimeVisible] = useState26(false);
|
|
13886
|
+
useEffect22(() => {
|
|
13646
13887
|
const calculateTimePosition = () => {
|
|
13647
13888
|
const now = /* @__PURE__ */ new Date();
|
|
13648
13889
|
const hours = now.getHours();
|
|
@@ -13673,14 +13914,14 @@ function useCurrentTimeIndicator(currentDate, view) {
|
|
|
13673
13914
|
}
|
|
13674
13915
|
|
|
13675
13916
|
// src/components/event-calendar/hooks/use-event-visibility.ts
|
|
13676
|
-
import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo15, useRef as useRef12, useState as
|
|
13917
|
+
import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo15, useRef as useRef12, useState as useState27 } from "react";
|
|
13677
13918
|
function useEventVisibility({
|
|
13678
13919
|
eventHeight,
|
|
13679
13920
|
eventGap
|
|
13680
13921
|
}) {
|
|
13681
13922
|
const contentRef = useRef12(null);
|
|
13682
13923
|
const observerRef = useRef12(null);
|
|
13683
|
-
const [contentHeight, setContentHeight] =
|
|
13924
|
+
const [contentHeight, setContentHeight] = useState27(null);
|
|
13684
13925
|
useLayoutEffect2(() => {
|
|
13685
13926
|
if (!contentRef.current) return;
|
|
13686
13927
|
const updateHeight = () => {
|
|
@@ -13732,7 +13973,7 @@ import {
|
|
|
13732
13973
|
startOfWeek as startOfWeek3
|
|
13733
13974
|
} from "date-fns";
|
|
13734
13975
|
import { ptBR as ptBR8 } from "date-fns/locale";
|
|
13735
|
-
import { useEffect as
|
|
13976
|
+
import { useEffect as useEffect23, useMemo as useMemo16, useState as useState28 } from "react";
|
|
13736
13977
|
import { jsx as jsx81, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
13737
13978
|
function MonthView({
|
|
13738
13979
|
currentDate,
|
|
@@ -13770,12 +14011,12 @@ function MonthView({
|
|
|
13770
14011
|
e.stopPropagation();
|
|
13771
14012
|
onEventSelect(event);
|
|
13772
14013
|
};
|
|
13773
|
-
const [isMounted, setIsMounted] =
|
|
14014
|
+
const [isMounted, setIsMounted] = useState28(false);
|
|
13774
14015
|
const { contentRef, getVisibleEventCount } = useEventVisibility({
|
|
13775
14016
|
eventGap: EventGap,
|
|
13776
14017
|
eventHeight: EventHeight
|
|
13777
14018
|
});
|
|
13778
|
-
|
|
14019
|
+
useEffect23(() => {
|
|
13779
14020
|
setIsMounted(true);
|
|
13780
14021
|
}, []);
|
|
13781
14022
|
return /* @__PURE__ */ jsxs61("div", { className: "contents", "data-slot": "month-view", children: [
|
|
@@ -14327,14 +14568,164 @@ function WeekView({
|
|
|
14327
14568
|
] });
|
|
14328
14569
|
}
|
|
14329
14570
|
|
|
14571
|
+
// src/components/ui/form/CheckBoxThree.tsx
|
|
14572
|
+
import { useCallback as useCallback14, useMemo as useMemo18, useState as useState29, useEffect as useEffect24, useRef as useRef13 } from "react";
|
|
14573
|
+
import { motion as motion18, AnimatePresence as AnimatePresence12 } from "framer-motion";
|
|
14574
|
+
import { jsx as jsx83, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
14575
|
+
function useCheckboxTree(initialTree) {
|
|
14576
|
+
const initialCheckedNodes = useMemo18(() => {
|
|
14577
|
+
const checkedSet = /* @__PURE__ */ new Set();
|
|
14578
|
+
const initializeCheckedNodes = (node) => {
|
|
14579
|
+
if (node.defaultChecked) {
|
|
14580
|
+
checkedSet.add(node.id);
|
|
14581
|
+
}
|
|
14582
|
+
node.children?.forEach(initializeCheckedNodes);
|
|
14583
|
+
};
|
|
14584
|
+
initializeCheckedNodes(initialTree);
|
|
14585
|
+
return checkedSet;
|
|
14586
|
+
}, [initialTree]);
|
|
14587
|
+
const [checkedNodes, setCheckedNodes] = useState29(initialCheckedNodes);
|
|
14588
|
+
const isChecked = useCallback14(
|
|
14589
|
+
(node) => {
|
|
14590
|
+
if (!node.children) {
|
|
14591
|
+
return checkedNodes.has(node.id);
|
|
14592
|
+
}
|
|
14593
|
+
const childrenChecked = node.children.map((child) => isChecked(child));
|
|
14594
|
+
if (childrenChecked.every((status) => status === true)) {
|
|
14595
|
+
return true;
|
|
14596
|
+
}
|
|
14597
|
+
if (childrenChecked.some(
|
|
14598
|
+
(status) => status === true || status === "indeterminate"
|
|
14599
|
+
)) {
|
|
14600
|
+
return "indeterminate";
|
|
14601
|
+
}
|
|
14602
|
+
return false;
|
|
14603
|
+
},
|
|
14604
|
+
[checkedNodes]
|
|
14605
|
+
);
|
|
14606
|
+
const handleCheck = useCallback14(
|
|
14607
|
+
(node) => {
|
|
14608
|
+
const newCheckedNodes = new Set(checkedNodes);
|
|
14609
|
+
const toggleNode = (n, check) => {
|
|
14610
|
+
if (check) {
|
|
14611
|
+
newCheckedNodes.add(n.id);
|
|
14612
|
+
} else {
|
|
14613
|
+
newCheckedNodes.delete(n.id);
|
|
14614
|
+
}
|
|
14615
|
+
for (const child of n.children ?? []) {
|
|
14616
|
+
toggleNode(child, check);
|
|
14617
|
+
}
|
|
14618
|
+
};
|
|
14619
|
+
const currentStatus = isChecked(node);
|
|
14620
|
+
const newCheck = currentStatus !== true;
|
|
14621
|
+
toggleNode(node, newCheck);
|
|
14622
|
+
setCheckedNodes(newCheckedNodes);
|
|
14623
|
+
},
|
|
14624
|
+
[checkedNodes, isChecked]
|
|
14625
|
+
);
|
|
14626
|
+
return { handleCheck, isChecked };
|
|
14627
|
+
}
|
|
14628
|
+
function CheckboxTree({ tree, renderNode }) {
|
|
14629
|
+
const { isChecked, handleCheck } = useCheckboxTree(tree);
|
|
14630
|
+
const DefaultNode = ({
|
|
14631
|
+
node,
|
|
14632
|
+
isChecked: status,
|
|
14633
|
+
onCheckedChange,
|
|
14634
|
+
children
|
|
14635
|
+
}) => {
|
|
14636
|
+
const [open, setOpen] = useState29(() => !!node.children && status !== false);
|
|
14637
|
+
const checkboxRef = useRef13(null);
|
|
14638
|
+
useEffect24(() => {
|
|
14639
|
+
if (checkboxRef.current) {
|
|
14640
|
+
checkboxRef.current.indeterminate = status === "indeterminate";
|
|
14641
|
+
}
|
|
14642
|
+
if (node.children) {
|
|
14643
|
+
setOpen(status !== false);
|
|
14644
|
+
}
|
|
14645
|
+
}, [status, node.children]);
|
|
14646
|
+
return /* @__PURE__ */ jsxs63("div", { className: "pl-1", children: [
|
|
14647
|
+
/* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-2", children: [
|
|
14648
|
+
node.children ? /* @__PURE__ */ jsx83(
|
|
14649
|
+
"button",
|
|
14650
|
+
{
|
|
14651
|
+
"aria-label": open ? "Fechar" : "Abrir",
|
|
14652
|
+
onClick: () => setOpen((v) => !v),
|
|
14653
|
+
className: "w-6 h-6 flex items-center justify-center rounded hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
14654
|
+
children: /* @__PURE__ */ jsx83(
|
|
14655
|
+
motion18.span,
|
|
14656
|
+
{
|
|
14657
|
+
animate: { rotate: open ? 90 : 0 },
|
|
14658
|
+
transition: { duration: 0.18 },
|
|
14659
|
+
className: "inline-block text-slate-500",
|
|
14660
|
+
children: "\u25B6"
|
|
14661
|
+
}
|
|
14662
|
+
)
|
|
14663
|
+
}
|
|
14664
|
+
) : /* @__PURE__ */ jsx83("div", { className: "w-6 h-6" }),
|
|
14665
|
+
/* @__PURE__ */ jsxs63("label", { className: "flex items-center gap-2 cursor-pointer select-none", children: [
|
|
14666
|
+
/* @__PURE__ */ jsxs63("span", { className: "relative", children: [
|
|
14667
|
+
/* @__PURE__ */ jsx83(
|
|
14668
|
+
"input",
|
|
14669
|
+
{
|
|
14670
|
+
ref: checkboxRef,
|
|
14671
|
+
type: "checkbox",
|
|
14672
|
+
checked: status === true,
|
|
14673
|
+
onChange: onCheckedChange,
|
|
14674
|
+
className: "appearance-none w-5 h-5 rounded border border-slate-300 dark:border-slate-700 flex items-center justify-center bg-white dark:bg-slate-900 checked:bg-blue-600 checked:border-blue-600 focus:outline-none"
|
|
14675
|
+
}
|
|
14676
|
+
),
|
|
14677
|
+
/* @__PURE__ */ jsx83(
|
|
14678
|
+
motion18.span,
|
|
14679
|
+
{
|
|
14680
|
+
initial: false,
|
|
14681
|
+
animate: { scale: status === true ? 1 : 0.8, opacity: status === true ? 1 : 0 },
|
|
14682
|
+
transition: { duration: 0.14 },
|
|
14683
|
+
className: "pointer-events-none absolute left-0 top-0 w-5 h-5 flex items-center justify-center text-white",
|
|
14684
|
+
children: status === true ? /* @__PURE__ */ jsx83("svg", { width: "12", height: "10", viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx83("path", { d: "M1 5L4 8L11 1", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : null
|
|
14685
|
+
}
|
|
14686
|
+
)
|
|
14687
|
+
] }),
|
|
14688
|
+
/* @__PURE__ */ jsx83("span", { className: "text-sm text-slate-700 dark:text-slate-200", children: node.label })
|
|
14689
|
+
] })
|
|
14690
|
+
] }),
|
|
14691
|
+
/* @__PURE__ */ jsx83(AnimatePresence12, { initial: false, children: open && node.children && /* @__PURE__ */ jsx83(
|
|
14692
|
+
motion18.div,
|
|
14693
|
+
{
|
|
14694
|
+
initial: { height: 0, opacity: 0 },
|
|
14695
|
+
animate: { height: "auto", opacity: 1 },
|
|
14696
|
+
exit: { height: 0, opacity: 0 },
|
|
14697
|
+
transition: { duration: 0.18 },
|
|
14698
|
+
className: "ml-6 mt-2 overflow-hidden",
|
|
14699
|
+
children: /* @__PURE__ */ jsx83("div", { className: "flex flex-col gap-1", children })
|
|
14700
|
+
},
|
|
14701
|
+
"children"
|
|
14702
|
+
) })
|
|
14703
|
+
] });
|
|
14704
|
+
};
|
|
14705
|
+
const renderTreeNode = (node) => {
|
|
14706
|
+
const children = node.children?.map(renderTreeNode);
|
|
14707
|
+
const nodePayload = {
|
|
14708
|
+
children,
|
|
14709
|
+
isChecked: isChecked(node),
|
|
14710
|
+
node,
|
|
14711
|
+
onCheckedChange: () => handleCheck(node)
|
|
14712
|
+
};
|
|
14713
|
+
if (renderNode) {
|
|
14714
|
+
return renderNode(nodePayload);
|
|
14715
|
+
}
|
|
14716
|
+
return /* @__PURE__ */ jsx83(DefaultNode, { ...nodePayload });
|
|
14717
|
+
};
|
|
14718
|
+
return renderTreeNode(tree);
|
|
14719
|
+
}
|
|
14720
|
+
|
|
14330
14721
|
// src/hooks/use-drag.tsx
|
|
14331
|
-
import { useState as
|
|
14722
|
+
import { useState as useState30, useCallback as useCallback15, useRef as useRef14, useEffect as useEffect25 } from "react";
|
|
14332
14723
|
var useDrag = (options = {}) => {
|
|
14333
|
-
const [isDragging, setIsDragging] =
|
|
14334
|
-
const [positions, setPositions] =
|
|
14335
|
-
const dragStartPos =
|
|
14336
|
-
const dragId =
|
|
14337
|
-
const handleMouseDown =
|
|
14724
|
+
const [isDragging, setIsDragging] = useState30(null);
|
|
14725
|
+
const [positions, setPositions] = useState30({});
|
|
14726
|
+
const dragStartPos = useRef14(null);
|
|
14727
|
+
const dragId = useRef14(null);
|
|
14728
|
+
const handleMouseDown = useCallback15((id, e) => {
|
|
14338
14729
|
e.preventDefault();
|
|
14339
14730
|
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
14340
14731
|
dragStartPos.current = {
|
|
@@ -14347,7 +14738,7 @@ var useDrag = (options = {}) => {
|
|
|
14347
14738
|
setIsDragging(id);
|
|
14348
14739
|
options.onDragStart?.(id);
|
|
14349
14740
|
}, [positions, options]);
|
|
14350
|
-
const handleMouseMove =
|
|
14741
|
+
const handleMouseMove = useCallback15((e) => {
|
|
14351
14742
|
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
14352
14743
|
const deltaX = e.clientX - dragStartPos.current.x;
|
|
14353
14744
|
const deltaY = e.clientY - dragStartPos.current.y;
|
|
@@ -14363,7 +14754,7 @@ var useDrag = (options = {}) => {
|
|
|
14363
14754
|
}));
|
|
14364
14755
|
options.onDrag?.(dragId.current, newPosition);
|
|
14365
14756
|
}, [isDragging, options]);
|
|
14366
|
-
const handleMouseUp =
|
|
14757
|
+
const handleMouseUp = useCallback15(() => {
|
|
14367
14758
|
if (dragId.current) {
|
|
14368
14759
|
options.onDragEnd?.(dragId.current);
|
|
14369
14760
|
}
|
|
@@ -14371,7 +14762,7 @@ var useDrag = (options = {}) => {
|
|
|
14371
14762
|
dragStartPos.current = null;
|
|
14372
14763
|
dragId.current = null;
|
|
14373
14764
|
}, [options]);
|
|
14374
|
-
|
|
14765
|
+
useEffect25(() => {
|
|
14375
14766
|
if (isDragging) {
|
|
14376
14767
|
document.addEventListener("mousemove", handleMouseMove);
|
|
14377
14768
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -14383,16 +14774,16 @@ var useDrag = (options = {}) => {
|
|
|
14383
14774
|
};
|
|
14384
14775
|
}
|
|
14385
14776
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
14386
|
-
const setPosition =
|
|
14777
|
+
const setPosition = useCallback15((id, position) => {
|
|
14387
14778
|
setPositions((prev) => ({
|
|
14388
14779
|
...prev,
|
|
14389
14780
|
[id]: position
|
|
14390
14781
|
}));
|
|
14391
14782
|
}, []);
|
|
14392
|
-
const getPosition =
|
|
14783
|
+
const getPosition = useCallback15((id) => {
|
|
14393
14784
|
return positions[id] || { top: 0, left: 0 };
|
|
14394
14785
|
}, [positions]);
|
|
14395
|
-
const isElementDragging =
|
|
14786
|
+
const isElementDragging = useCallback15((id) => {
|
|
14396
14787
|
return isDragging === id;
|
|
14397
14788
|
}, [isDragging]);
|
|
14398
14789
|
return {
|
|
@@ -14419,9 +14810,9 @@ export {
|
|
|
14419
14810
|
AlertDialogTitleBase,
|
|
14420
14811
|
AlertDialogTriggerBase,
|
|
14421
14812
|
AvatarBase,
|
|
14813
|
+
AvatarCombobox,
|
|
14422
14814
|
AvatarFallbackBase,
|
|
14423
14815
|
AvatarImageBase,
|
|
14424
|
-
AvatarSelect,
|
|
14425
14816
|
BackButton,
|
|
14426
14817
|
Badge,
|
|
14427
14818
|
BarChart_default as BarChart,
|
|
@@ -14451,6 +14842,7 @@ export {
|
|
|
14451
14842
|
Chart_default as Chart,
|
|
14452
14843
|
CheckButton,
|
|
14453
14844
|
CheckboxBase,
|
|
14845
|
+
CheckboxTree,
|
|
14454
14846
|
CloseAllButton_default as CloseAllButton,
|
|
14455
14847
|
CloseButton,
|
|
14456
14848
|
CodeBlock,
|