@mlw-packages/react-components 1.7.2 → 1.7.3
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.d.mts +83 -50
- package/dist/index.d.ts +83 -50
- package/dist/index.js +350 -48
- package/dist/index.mjs +338 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -543,6 +543,21 @@ __export(index_exports, {
|
|
|
543
543
|
CommandListBase: () => CommandListBase,
|
|
544
544
|
CommandSeparatorBase: () => CommandSeparatorBase,
|
|
545
545
|
CommandShortcutBase: () => CommandShortcutBase,
|
|
546
|
+
ContextMenuBase: () => ContextMenuBase,
|
|
547
|
+
ContextMenuCheckboxItemBase: () => ContextMenuCheckboxItemBase,
|
|
548
|
+
ContextMenuContentBase: () => ContextMenuContentBase,
|
|
549
|
+
ContextMenuGroupBase: () => ContextMenuGroupBase,
|
|
550
|
+
ContextMenuItemBase: () => ContextMenuItemBase,
|
|
551
|
+
ContextMenuLabelBase: () => ContextMenuLabelBase,
|
|
552
|
+
ContextMenuPortalBase: () => ContextMenuPortalBase,
|
|
553
|
+
ContextMenuRadioGroupBase: () => ContextMenuRadioGroupBase,
|
|
554
|
+
ContextMenuRadioItemBase: () => ContextMenuRadioItemBase,
|
|
555
|
+
ContextMenuSeparatorBase: () => ContextMenuSeparatorBase,
|
|
556
|
+
ContextMenuShortcutBase: () => ContextMenuShortcutBase,
|
|
557
|
+
ContextMenuSubBase: () => ContextMenuSubBase,
|
|
558
|
+
ContextMenuSubContentBase: () => ContextMenuSubContentBase,
|
|
559
|
+
ContextMenuSubTriggerBase: () => ContextMenuSubTriggerBase,
|
|
560
|
+
ContextMenuTriggerBase: () => ContextMenuTriggerBase,
|
|
546
561
|
CopyButton: () => CopyButton,
|
|
547
562
|
DateTimePicker: () => DateTimePicker,
|
|
548
563
|
DeleteButton: () => DeleteButton,
|
|
@@ -2712,30 +2727,36 @@ var DraggableTooltipComponent = ({
|
|
|
2712
2727
|
onPositionChange,
|
|
2713
2728
|
highlightedSeries,
|
|
2714
2729
|
toggleHighlight,
|
|
2715
|
-
showOnlyHighlighted
|
|
2730
|
+
showOnlyHighlighted,
|
|
2731
|
+
valueFormatter: valueFormatter2
|
|
2716
2732
|
}) => {
|
|
2717
2733
|
const visibleKeys = (0, import_react16.useMemo)(
|
|
2718
2734
|
() => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
|
|
2719
2735
|
[showOnlyHighlighted, highlightedSeries, dataKeys]
|
|
2720
2736
|
);
|
|
2721
|
-
const TotalDisplay = import_react16.default.memo(
|
|
2722
|
-
|
|
2723
|
-
const
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2737
|
+
const TotalDisplay = import_react16.default.memo(({ data: data2, visibleKeys: visibleKeys2, valueFormatter: localformatter }) => {
|
|
2738
|
+
const total = (0, import_react16.useMemo)(() => {
|
|
2739
|
+
const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
|
|
2740
|
+
return numeric.reduce((s, v) => s + (v || 0), 0);
|
|
2741
|
+
}, [data2, visibleKeys2]);
|
|
2742
|
+
const defaultTotalFormatted = total.toLocaleString("pt-BR");
|
|
2743
|
+
const displayTotal = localformatter ? localformatter({
|
|
2744
|
+
value: total,
|
|
2745
|
+
formattedValue: defaultTotalFormatted,
|
|
2746
|
+
dataKey: "total",
|
|
2747
|
+
name: "Total"
|
|
2748
|
+
}) : defaultTotalFormatted;
|
|
2749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "text-sm", children: [
|
|
2750
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-sm text-muted-foreground", children: "Total" }),
|
|
2751
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2752
|
+
"div",
|
|
2753
|
+
{
|
|
2754
|
+
className: `text-base font-semibold ${total < 0 ? "text-destructive" : "text-foreground"}`,
|
|
2755
|
+
children: displayTotal
|
|
2756
|
+
}
|
|
2757
|
+
)
|
|
2758
|
+
] });
|
|
2759
|
+
});
|
|
2739
2760
|
const [localPos, setLocalPos] = (0, import_react16.useState)(position);
|
|
2740
2761
|
const [dragging, setDragging] = (0, import_react16.useState)(false);
|
|
2741
2762
|
const offsetRef = (0, import_react16.useRef)({ x: 0, y: 0 });
|
|
@@ -3117,7 +3138,14 @@ var DraggableTooltipComponent = ({
|
|
|
3117
3138
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: periodLabel }),
|
|
3118
3139
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "font-bold text-lg text-foreground mt-1 truncate", children: data.name })
|
|
3119
3140
|
] }),
|
|
3120
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-right", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3141
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-right", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3142
|
+
TotalDisplay,
|
|
3143
|
+
{
|
|
3144
|
+
data,
|
|
3145
|
+
visibleKeys,
|
|
3146
|
+
valueFormatter: valueFormatter2
|
|
3147
|
+
}
|
|
3148
|
+
) })
|
|
3121
3149
|
] }) }),
|
|
3122
3150
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-3 pt-2 space-y-2", children: [
|
|
3123
3151
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2", children: dataLabel }),
|
|
@@ -3133,6 +3161,13 @@ var DraggableTooltipComponent = ({
|
|
|
3133
3161
|
0
|
|
3134
3162
|
);
|
|
3135
3163
|
const val = typeof value === "number" ? value : Number(value) || 0;
|
|
3164
|
+
const defaultFormatted = val.toLocaleString("pt-BR");
|
|
3165
|
+
const displayValue = valueFormatter2 ? valueFormatter2({
|
|
3166
|
+
value,
|
|
3167
|
+
formattedValue: defaultFormatted,
|
|
3168
|
+
dataKey: key,
|
|
3169
|
+
name: key.charAt(0).toUpperCase() + key.slice(1)
|
|
3170
|
+
}) : defaultFormatted;
|
|
3136
3171
|
const pct = absDenominator > 0 ? Math.abs(val) / absDenominator * 100 : 0;
|
|
3137
3172
|
const isDimmed = highlightedSeries && highlightedSeries.size > 0 && !highlightedSeries.has(key);
|
|
3138
3173
|
const isHighlighted = highlightedSeries && highlightedSeries.has(key);
|
|
@@ -3178,7 +3213,7 @@ var DraggableTooltipComponent = ({
|
|
|
3178
3213
|
"span",
|
|
3179
3214
|
{
|
|
3180
3215
|
className: `font-semibold tabular-nums ${val < 0 ? "text-destructive" : "text-foreground"}`,
|
|
3181
|
-
children:
|
|
3216
|
+
children: displayValue
|
|
3182
3217
|
}
|
|
3183
3218
|
),
|
|
3184
3219
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
|
|
@@ -3207,7 +3242,8 @@ var DraggableTooltipComponent = ({
|
|
|
3207
3242
|
dataKeys,
|
|
3208
3243
|
highlightedSeries,
|
|
3209
3244
|
toggleHighlight,
|
|
3210
|
-
finalColors
|
|
3245
|
+
finalColors,
|
|
3246
|
+
valueFormatter2
|
|
3211
3247
|
]
|
|
3212
3248
|
),
|
|
3213
3249
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-3 pt-2 border-t", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
|
|
@@ -3243,7 +3279,8 @@ var RechartTooltipWithTotal = ({
|
|
|
3243
3279
|
label,
|
|
3244
3280
|
finalColors = {},
|
|
3245
3281
|
periodLabel = "Per\xEDodo",
|
|
3246
|
-
totalLabel = "Total"
|
|
3282
|
+
totalLabel = "Total",
|
|
3283
|
+
valueFormatter: valueFormatter2
|
|
3247
3284
|
}) => {
|
|
3248
3285
|
if (!active || !payload || payload.length === 0) return null;
|
|
3249
3286
|
const numeric = payload.filter(
|
|
@@ -3251,6 +3288,13 @@ var RechartTooltipWithTotal = ({
|
|
|
3251
3288
|
);
|
|
3252
3289
|
const total = numeric.reduce((sum, p) => sum + (p.value || 0), 0);
|
|
3253
3290
|
const isTotalNegative = total < 0;
|
|
3291
|
+
const defaultTotalFormatted = total.toLocaleString("pt-BR");
|
|
3292
|
+
const displayTotal = valueFormatter2 ? valueFormatter2({
|
|
3293
|
+
value: total,
|
|
3294
|
+
formattedValue: defaultTotalFormatted,
|
|
3295
|
+
dataKey: "total",
|
|
3296
|
+
name: "Total"
|
|
3297
|
+
}) : defaultTotalFormatted;
|
|
3254
3298
|
const absDenominator = numeric.reduce(
|
|
3255
3299
|
(sum, p) => sum + Math.abs(typeof p.value === "number" ? p.value : 0),
|
|
3256
3300
|
0
|
|
@@ -3274,7 +3318,7 @@ var RechartTooltipWithTotal = ({
|
|
|
3274
3318
|
"p",
|
|
3275
3319
|
{
|
|
3276
3320
|
className: `text-sm font-semibold ${isTotalNegative ? "text-rose-500" : "text-foreground"}`,
|
|
3277
|
-
children:
|
|
3321
|
+
children: displayTotal
|
|
3278
3322
|
}
|
|
3279
3323
|
)
|
|
3280
3324
|
] })
|
|
@@ -3284,6 +3328,13 @@ var RechartTooltipWithTotal = ({
|
|
|
3284
3328
|
const pct = absDenominator > 0 ? Math.abs(value) / absDenominator * 100 : 0;
|
|
3285
3329
|
const baseColor = finalColors[entry.dataKey] || entry.color || "#999";
|
|
3286
3330
|
const isNeg = value < 0;
|
|
3331
|
+
const defaultFormatted = value.toLocaleString("pt-BR");
|
|
3332
|
+
const displayValue = valueFormatter2 ? valueFormatter2({
|
|
3333
|
+
value: entry.value,
|
|
3334
|
+
formattedValue: defaultFormatted,
|
|
3335
|
+
dataKey: entry.dataKey,
|
|
3336
|
+
name: entry.name
|
|
3337
|
+
}) : defaultFormatted;
|
|
3287
3338
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
3288
3339
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
|
|
3289
3340
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2 truncate", children: [
|
|
@@ -3302,7 +3353,7 @@ var RechartTooltipWithTotal = ({
|
|
|
3302
3353
|
"span",
|
|
3303
3354
|
{
|
|
3304
3355
|
className: `${isNeg ? "text-rose-500" : "text-foreground"} font-medium`,
|
|
3305
|
-
children:
|
|
3356
|
+
children: displayValue
|
|
3306
3357
|
}
|
|
3307
3358
|
),
|
|
3308
3359
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
|
|
@@ -3333,7 +3384,8 @@ var TooltipSimple = ({
|
|
|
3333
3384
|
payload,
|
|
3334
3385
|
label,
|
|
3335
3386
|
finalColors = {},
|
|
3336
|
-
periodLabel = "Per\xEDodo"
|
|
3387
|
+
periodLabel = "Per\xEDodo",
|
|
3388
|
+
valueFormatter: valueFormatter2
|
|
3337
3389
|
}) => {
|
|
3338
3390
|
if (!active || !payload || payload.length === 0) return null;
|
|
3339
3391
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
@@ -3351,6 +3403,13 @@ var TooltipSimple = ({
|
|
|
3351
3403
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "divide-y divide-border rounded-md overflow-hidden", children: payload.map((entry, index) => {
|
|
3352
3404
|
const value = typeof entry.value === "number" ? entry.value : 0;
|
|
3353
3405
|
const color = finalColors[entry.dataKey] || entry.color || "#999";
|
|
3406
|
+
const defaultFormatted = value.toLocaleString("pt-BR");
|
|
3407
|
+
const displayValue = valueFormatter2 ? valueFormatter2({
|
|
3408
|
+
value: entry.value,
|
|
3409
|
+
formattedValue: defaultFormatted,
|
|
3410
|
+
dataKey: entry.dataKey,
|
|
3411
|
+
name: entry.name
|
|
3412
|
+
}) : defaultFormatted;
|
|
3354
3413
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3355
3414
|
"div",
|
|
3356
3415
|
{
|
|
@@ -3371,7 +3430,7 @@ var TooltipSimple = ({
|
|
|
3371
3430
|
"span",
|
|
3372
3431
|
{
|
|
3373
3432
|
className: `font-medium tabular-nums ${value < 0 ? "text-destructive" : "text-foreground"}`,
|
|
3374
|
-
children:
|
|
3433
|
+
children: displayValue
|
|
3375
3434
|
}
|
|
3376
3435
|
) })
|
|
3377
3436
|
]
|
|
@@ -3408,10 +3467,15 @@ var parseNumber = (v) => {
|
|
|
3408
3467
|
return Number(v);
|
|
3409
3468
|
return void 0;
|
|
3410
3469
|
};
|
|
3411
|
-
var renderPillLabel = (color, variant) => {
|
|
3470
|
+
var renderPillLabel = (color, variant, valueFormatter2) => {
|
|
3412
3471
|
return (props) => {
|
|
3413
3472
|
const { x, y, value } = props;
|
|
3414
|
-
const
|
|
3473
|
+
const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
|
|
3474
|
+
const text = valueFormatter2 ? valueFormatter2({
|
|
3475
|
+
value,
|
|
3476
|
+
formattedValue: defaultFormatted,
|
|
3477
|
+
...props
|
|
3478
|
+
}) : defaultFormatted;
|
|
3415
3479
|
const paddingX = 8;
|
|
3416
3480
|
const approxCharWidth = 7;
|
|
3417
3481
|
const pillWidth = Math.max(
|
|
@@ -3519,6 +3583,7 @@ var Chart = ({
|
|
|
3519
3583
|
showLabels = false,
|
|
3520
3584
|
xAxis,
|
|
3521
3585
|
labelMap,
|
|
3586
|
+
valueFormatter: valueFormatter2,
|
|
3522
3587
|
enableHighlights = false,
|
|
3523
3588
|
enableShowOnly = false,
|
|
3524
3589
|
enablePeriodsDropdown = false,
|
|
@@ -3536,7 +3601,7 @@ var Chart = ({
|
|
|
3536
3601
|
} : {
|
|
3537
3602
|
dataKey: resolvedXAxisKey,
|
|
3538
3603
|
label: xAxis?.label ?? formatFieldName(resolvedXAxisKey),
|
|
3539
|
-
|
|
3604
|
+
valueFormatter: xAxis?.valueFormatter,
|
|
3540
3605
|
autoLabel: xAxis?.autoLabel ?? true
|
|
3541
3606
|
};
|
|
3542
3607
|
const detectedFields = detectDataFields(data, xAxisConfig2.dataKey);
|
|
@@ -3988,7 +4053,7 @@ var Chart = ({
|
|
|
3988
4053
|
fontSize: 12,
|
|
3989
4054
|
tickLine: false,
|
|
3990
4055
|
axisLine: false,
|
|
3991
|
-
tickFormatter: xAxisConfig.
|
|
4056
|
+
tickFormatter: xAxisConfig.valueFormatter
|
|
3992
4057
|
}
|
|
3993
4058
|
),
|
|
3994
4059
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -4015,7 +4080,19 @@ var Chart = ({
|
|
|
4015
4080
|
showTooltip && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4016
4081
|
import_recharts.Tooltip,
|
|
4017
4082
|
{
|
|
4018
|
-
content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4083
|
+
content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4084
|
+
TooltipWithTotal_default,
|
|
4085
|
+
{
|
|
4086
|
+
finalColors,
|
|
4087
|
+
valueFormatter: valueFormatter2
|
|
4088
|
+
}
|
|
4089
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4090
|
+
TooltipSimple_default,
|
|
4091
|
+
{
|
|
4092
|
+
finalColors,
|
|
4093
|
+
valueFormatter: valueFormatter2
|
|
4094
|
+
}
|
|
4095
|
+
),
|
|
4019
4096
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
4020
4097
|
}
|
|
4021
4098
|
),
|
|
@@ -4061,7 +4138,11 @@ var Chart = ({
|
|
|
4061
4138
|
{
|
|
4062
4139
|
dataKey: key,
|
|
4063
4140
|
position: "top",
|
|
4064
|
-
content: pillLabelRenderer_default(
|
|
4141
|
+
content: pillLabelRenderer_default(
|
|
4142
|
+
color,
|
|
4143
|
+
"filled",
|
|
4144
|
+
valueFormatter2
|
|
4145
|
+
),
|
|
4065
4146
|
offset: 8
|
|
4066
4147
|
}
|
|
4067
4148
|
) : null
|
|
@@ -4090,7 +4171,11 @@ var Chart = ({
|
|
|
4090
4171
|
{
|
|
4091
4172
|
dataKey: key,
|
|
4092
4173
|
position: "top",
|
|
4093
|
-
content: pillLabelRenderer_default(
|
|
4174
|
+
content: pillLabelRenderer_default(
|
|
4175
|
+
color,
|
|
4176
|
+
"filled",
|
|
4177
|
+
valueFormatter2
|
|
4178
|
+
),
|
|
4094
4179
|
offset: 14
|
|
4095
4180
|
}
|
|
4096
4181
|
) : null
|
|
@@ -4119,7 +4204,11 @@ var Chart = ({
|
|
|
4119
4204
|
{
|
|
4120
4205
|
dataKey: key,
|
|
4121
4206
|
position: "top",
|
|
4122
|
-
content: pillLabelRenderer_default(
|
|
4207
|
+
content: pillLabelRenderer_default(
|
|
4208
|
+
color,
|
|
4209
|
+
"soft",
|
|
4210
|
+
valueFormatter2
|
|
4211
|
+
),
|
|
4123
4212
|
offset: 12
|
|
4124
4213
|
}
|
|
4125
4214
|
) : null
|
|
@@ -4148,6 +4237,7 @@ var Chart = ({
|
|
|
4148
4237
|
onPositionChange: onTooltipPositionChange,
|
|
4149
4238
|
periodLabel: "Per\xEDodo Selecionado",
|
|
4150
4239
|
dataLabel: "Dados do Per\xEDodo",
|
|
4240
|
+
valueFormatter: valueFormatter2,
|
|
4151
4241
|
globalTooltipCount: activeTooltips.length,
|
|
4152
4242
|
onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
|
|
4153
4243
|
closeAllButtonPosition: "top-center",
|
|
@@ -4663,7 +4753,7 @@ var BarChart = ({
|
|
|
4663
4753
|
fontSize: 12,
|
|
4664
4754
|
tickLine: false,
|
|
4665
4755
|
axisLine: false,
|
|
4666
|
-
tickFormatter: xAxisConfig.
|
|
4756
|
+
tickFormatter: xAxisConfig.valueFormatter
|
|
4667
4757
|
}
|
|
4668
4758
|
),
|
|
4669
4759
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -10984,14 +11074,226 @@ function RangePicker({
|
|
|
10984
11074
|
}
|
|
10985
11075
|
RangePicker.displayName = "RangePicker";
|
|
10986
11076
|
|
|
11077
|
+
// src/components/ui/navigation/ContextMenuBase.tsx
|
|
11078
|
+
var ContextMenuPrimitive = __toESM(require("@radix-ui/react-context-menu"));
|
|
11079
|
+
var import_react46 = require("@phosphor-icons/react");
|
|
11080
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
11081
|
+
function ContextMenuBase(props) {
|
|
11082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.Root, { "data-slot": "context-menu", ...props });
|
|
11083
|
+
}
|
|
11084
|
+
function ContextMenuTriggerBase(props) {
|
|
11085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.Trigger, { "data-slot": "context-menu-trigger", ...props });
|
|
11086
|
+
}
|
|
11087
|
+
function ContextMenuGroupBase(props) {
|
|
11088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.Group, { "data-slot": "context-menu-group", ...props });
|
|
11089
|
+
}
|
|
11090
|
+
function ContextMenuPortalBase(props) {
|
|
11091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.Portal, { "data-slot": "context-menu-portal", ...props });
|
|
11092
|
+
}
|
|
11093
|
+
function ContextMenuSubBase(props) {
|
|
11094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.Sub, { "data-slot": "context-menu-sub", ...props });
|
|
11095
|
+
}
|
|
11096
|
+
function ContextMenuRadioGroupBase(props) {
|
|
11097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.RadioGroup, { "data-slot": "context-menu-radio-group", ...props });
|
|
11098
|
+
}
|
|
11099
|
+
function ContextMenuSubTriggerBase({
|
|
11100
|
+
className,
|
|
11101
|
+
inset,
|
|
11102
|
+
children,
|
|
11103
|
+
...props
|
|
11104
|
+
}) {
|
|
11105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
11106
|
+
ContextMenuPrimitive.SubTrigger,
|
|
11107
|
+
{
|
|
11108
|
+
"data-slot": "context-menu-sub-trigger",
|
|
11109
|
+
"data-inset": inset,
|
|
11110
|
+
className: cn(
|
|
11111
|
+
"focus:outline-none",
|
|
11112
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
11113
|
+
"flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm select-none",
|
|
11114
|
+
"data-[inset]:pl-8",
|
|
11115
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
11116
|
+
className
|
|
11117
|
+
),
|
|
11118
|
+
...props,
|
|
11119
|
+
children: [
|
|
11120
|
+
children,
|
|
11121
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react46.CaretRightIcon, { className: "ml-auto" })
|
|
11122
|
+
]
|
|
11123
|
+
}
|
|
11124
|
+
);
|
|
11125
|
+
}
|
|
11126
|
+
function ContextMenuSubContentBase({
|
|
11127
|
+
className,
|
|
11128
|
+
...props
|
|
11129
|
+
}) {
|
|
11130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11131
|
+
ContextMenuPrimitive.SubContent,
|
|
11132
|
+
{
|
|
11133
|
+
"data-slot": "context-menu-sub-content",
|
|
11134
|
+
className: cn(
|
|
11135
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
11136
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
11137
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
11138
|
+
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
11139
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-border p-1 shadow-lg",
|
|
11140
|
+
className
|
|
11141
|
+
),
|
|
11142
|
+
...props
|
|
11143
|
+
}
|
|
11144
|
+
);
|
|
11145
|
+
}
|
|
11146
|
+
function ContextMenuContentBase({
|
|
11147
|
+
className,
|
|
11148
|
+
...props
|
|
11149
|
+
}) {
|
|
11150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11151
|
+
ContextMenuPrimitive.Content,
|
|
11152
|
+
{
|
|
11153
|
+
"data-slot": "context-menu-content",
|
|
11154
|
+
className: cn(
|
|
11155
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
11156
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
11157
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
11158
|
+
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
11159
|
+
"z-50 max-h-[var(--radix-context-menu-content-available-height)] min-w-[8rem]",
|
|
11160
|
+
"overflow-x-hidden overflow-y-auto rounded-md border border-border p-1 shadow-md",
|
|
11161
|
+
className
|
|
11162
|
+
),
|
|
11163
|
+
...props
|
|
11164
|
+
}
|
|
11165
|
+
) });
|
|
11166
|
+
}
|
|
11167
|
+
function ContextMenuItemBase({
|
|
11168
|
+
className,
|
|
11169
|
+
inset,
|
|
11170
|
+
variant = "default",
|
|
11171
|
+
...props
|
|
11172
|
+
}) {
|
|
11173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11174
|
+
ContextMenuPrimitive.Item,
|
|
11175
|
+
{
|
|
11176
|
+
"data-slot": "context-menu-item",
|
|
11177
|
+
"data-inset": inset,
|
|
11178
|
+
"data-variant": variant,
|
|
11179
|
+
className: cn(
|
|
11180
|
+
"focus:outline-none",
|
|
11181
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
11182
|
+
"data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20",
|
|
11183
|
+
"data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive",
|
|
11184
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
11185
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm select-none",
|
|
11186
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
11187
|
+
"data-[inset]:pl-8",
|
|
11188
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
11189
|
+
className
|
|
11190
|
+
),
|
|
11191
|
+
...props
|
|
11192
|
+
}
|
|
11193
|
+
);
|
|
11194
|
+
}
|
|
11195
|
+
function ContextMenuCheckboxItemBase({
|
|
11196
|
+
className,
|
|
11197
|
+
children,
|
|
11198
|
+
checked,
|
|
11199
|
+
...props
|
|
11200
|
+
}) {
|
|
11201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
11202
|
+
ContextMenuPrimitive.CheckboxItem,
|
|
11203
|
+
{
|
|
11204
|
+
"data-slot": "context-menu-checkbox-item",
|
|
11205
|
+
className: cn(
|
|
11206
|
+
"focus:outline-none",
|
|
11207
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
11208
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm select-none",
|
|
11209
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
11210
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
11211
|
+
className
|
|
11212
|
+
),
|
|
11213
|
+
checked,
|
|
11214
|
+
...props,
|
|
11215
|
+
children: [
|
|
11216
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react46.CheckIcon, { className: "size-4" }) }) }),
|
|
11217
|
+
children
|
|
11218
|
+
]
|
|
11219
|
+
}
|
|
11220
|
+
);
|
|
11221
|
+
}
|
|
11222
|
+
function ContextMenuRadioItemBase({
|
|
11223
|
+
className,
|
|
11224
|
+
children,
|
|
11225
|
+
...props
|
|
11226
|
+
}) {
|
|
11227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
11228
|
+
ContextMenuPrimitive.RadioItem,
|
|
11229
|
+
{
|
|
11230
|
+
"data-slot": "context-menu-radio-item",
|
|
11231
|
+
className: cn(
|
|
11232
|
+
"focus:outline-none",
|
|
11233
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
11234
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm select-none",
|
|
11235
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
11236
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
11237
|
+
className
|
|
11238
|
+
),
|
|
11239
|
+
...props,
|
|
11240
|
+
children: [
|
|
11241
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react46.CircleIcon, { className: "size-2 fill-current" }) }) }),
|
|
11242
|
+
children
|
|
11243
|
+
]
|
|
11244
|
+
}
|
|
11245
|
+
);
|
|
11246
|
+
}
|
|
11247
|
+
function ContextMenuLabelBase({
|
|
11248
|
+
className,
|
|
11249
|
+
inset,
|
|
11250
|
+
...props
|
|
11251
|
+
}) {
|
|
11252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11253
|
+
ContextMenuPrimitive.Label,
|
|
11254
|
+
{
|
|
11255
|
+
"data-slot": "context-menu-label",
|
|
11256
|
+
"data-inset": inset,
|
|
11257
|
+
className: cn("text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
|
|
11258
|
+
...props
|
|
11259
|
+
}
|
|
11260
|
+
);
|
|
11261
|
+
}
|
|
11262
|
+
function ContextMenuSeparatorBase({
|
|
11263
|
+
className,
|
|
11264
|
+
...props
|
|
11265
|
+
}) {
|
|
11266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11267
|
+
ContextMenuPrimitive.Separator,
|
|
11268
|
+
{
|
|
11269
|
+
"data-slot": "context-menu-separator",
|
|
11270
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
11271
|
+
...props
|
|
11272
|
+
}
|
|
11273
|
+
);
|
|
11274
|
+
}
|
|
11275
|
+
function ContextMenuShortcutBase({
|
|
11276
|
+
className,
|
|
11277
|
+
...props
|
|
11278
|
+
}) {
|
|
11279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11280
|
+
"span",
|
|
11281
|
+
{
|
|
11282
|
+
"data-slot": "context-menu-shortcut",
|
|
11283
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
11284
|
+
...props
|
|
11285
|
+
}
|
|
11286
|
+
);
|
|
11287
|
+
}
|
|
11288
|
+
|
|
10987
11289
|
// src/hooks/use-drag.tsx
|
|
10988
|
-
var
|
|
11290
|
+
var import_react47 = require("react");
|
|
10989
11291
|
var useDrag = (options = {}) => {
|
|
10990
|
-
const [isDragging, setIsDragging] = (0,
|
|
10991
|
-
const [positions, setPositions] = (0,
|
|
10992
|
-
const dragStartPos = (0,
|
|
10993
|
-
const dragId = (0,
|
|
10994
|
-
const handleMouseDown = (0,
|
|
11292
|
+
const [isDragging, setIsDragging] = (0, import_react47.useState)(null);
|
|
11293
|
+
const [positions, setPositions] = (0, import_react47.useState)({});
|
|
11294
|
+
const dragStartPos = (0, import_react47.useRef)(null);
|
|
11295
|
+
const dragId = (0, import_react47.useRef)(null);
|
|
11296
|
+
const handleMouseDown = (0, import_react47.useCallback)((id, e) => {
|
|
10995
11297
|
e.preventDefault();
|
|
10996
11298
|
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
10997
11299
|
dragStartPos.current = {
|
|
@@ -11004,7 +11306,7 @@ var useDrag = (options = {}) => {
|
|
|
11004
11306
|
setIsDragging(id);
|
|
11005
11307
|
options.onDragStart?.(id);
|
|
11006
11308
|
}, [positions, options]);
|
|
11007
|
-
const handleMouseMove = (0,
|
|
11309
|
+
const handleMouseMove = (0, import_react47.useCallback)((e) => {
|
|
11008
11310
|
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
11009
11311
|
const deltaX = e.clientX - dragStartPos.current.x;
|
|
11010
11312
|
const deltaY = e.clientY - dragStartPos.current.y;
|
|
@@ -11020,7 +11322,7 @@ var useDrag = (options = {}) => {
|
|
|
11020
11322
|
}));
|
|
11021
11323
|
options.onDrag?.(dragId.current, newPosition);
|
|
11022
11324
|
}, [isDragging, options]);
|
|
11023
|
-
const handleMouseUp = (0,
|
|
11325
|
+
const handleMouseUp = (0, import_react47.useCallback)(() => {
|
|
11024
11326
|
if (dragId.current) {
|
|
11025
11327
|
options.onDragEnd?.(dragId.current);
|
|
11026
11328
|
}
|
|
@@ -11028,7 +11330,7 @@ var useDrag = (options = {}) => {
|
|
|
11028
11330
|
dragStartPos.current = null;
|
|
11029
11331
|
dragId.current = null;
|
|
11030
11332
|
}, [options]);
|
|
11031
|
-
(0,
|
|
11333
|
+
(0, import_react47.useEffect)(() => {
|
|
11032
11334
|
if (isDragging) {
|
|
11033
11335
|
document.addEventListener("mousemove", handleMouseMove);
|
|
11034
11336
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -11040,16 +11342,16 @@ var useDrag = (options = {}) => {
|
|
|
11040
11342
|
};
|
|
11041
11343
|
}
|
|
11042
11344
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
11043
|
-
const setPosition = (0,
|
|
11345
|
+
const setPosition = (0, import_react47.useCallback)((id, position) => {
|
|
11044
11346
|
setPositions((prev) => ({
|
|
11045
11347
|
...prev,
|
|
11046
11348
|
[id]: position
|
|
11047
11349
|
}));
|
|
11048
11350
|
}, []);
|
|
11049
|
-
const getPosition = (0,
|
|
11351
|
+
const getPosition = (0, import_react47.useCallback)((id) => {
|
|
11050
11352
|
return positions[id] || { top: 0, left: 0 };
|
|
11051
11353
|
}, [positions]);
|
|
11052
|
-
const isElementDragging = (0,
|
|
11354
|
+
const isElementDragging = (0, import_react47.useCallback)((id) => {
|
|
11053
11355
|
return isDragging === id;
|
|
11054
11356
|
}, [isDragging]);
|
|
11055
11357
|
return {
|