@mlw-packages/react-components 1.7.1 → 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.js CHANGED
@@ -543,7 +543,23 @@ __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,
562
+ DateTimePicker: () => DateTimePicker,
547
563
  DeleteButton: () => DeleteButton,
548
564
  DestructiveDialog: () => DestructiveDialog,
549
565
  DialogBase: () => DialogBase,
@@ -635,6 +651,7 @@ __export(index_exports, {
635
651
  ProgressCirclesBase: () => ProgressCirclesBase,
636
652
  ProgressPanelsBase: () => ProgressPanelsBase,
637
653
  ProgressSegmentsBase: () => ProgressSegmentsBase,
654
+ RangePicker: () => RangePicker,
638
655
  RefreshButton: () => RefreshButton,
639
656
  SaveButton: () => SaveButton,
640
657
  ScrollAreaBase: () => ScrollAreaBase,
@@ -704,6 +721,8 @@ __export(index_exports, {
704
721
  TabsTriggerBase: () => TabsTriggerBase,
705
722
  TextAreaBase: () => TextAreaBase,
706
723
  ThemeProviderBase: () => ThemeProviderBase,
724
+ TimePicker: () => TimePicker,
725
+ TimePickerInput: () => TimePickerInput,
707
726
  Toaster: () => Toaster,
708
727
  TooltipBase: () => TooltipBase,
709
728
  TooltipContentBase: () => TooltipContentBase,
@@ -720,14 +739,34 @@ __export(index_exports, {
720
739
  badgeVariants: () => badgeVariants,
721
740
  buttonVariantsBase: () => buttonVariantsBase,
722
741
  compactTick: () => compactTick,
742
+ convert12HourTo24Hour: () => convert12HourTo24Hour,
723
743
  detectDataFields: () => detectDataFields,
724
744
  detectXAxis: () => detectXAxis,
745
+ display12HourValue: () => display12HourValue,
725
746
  formatFieldName: () => formatFieldName,
726
747
  generateAdditionalColors: () => generateAdditionalColors,
748
+ getArrowByType: () => getArrowByType,
749
+ getDateByType: () => getDateByType,
750
+ getValid12Hour: () => getValid12Hour,
751
+ getValidArrow12Hour: () => getValidArrow12Hour,
752
+ getValidArrowHour: () => getValidArrowHour,
753
+ getValidArrowMinuteOrSecond: () => getValidArrowMinuteOrSecond,
754
+ getValidArrowNumber: () => getValidArrowNumber,
755
+ getValidHour: () => getValidHour,
756
+ getValidMinuteOrSecond: () => getValidMinuteOrSecond,
757
+ getValidNumber: () => getValidNumber,
758
+ isValid12Hour: () => isValid12Hour,
759
+ isValidHour: () => isValidHour,
760
+ isValidMinuteOrSecond: () => isValidMinuteOrSecond,
727
761
  niceCeil: () => niceCeil,
728
762
  renderPillLabel: () => pillLabelRenderer_default,
729
763
  resolveChartMargins: () => resolveChartMargins,
730
764
  resolveContainerPaddingLeft: () => resolveContainerPaddingLeft,
765
+ set12Hours: () => set12Hours,
766
+ setDateByType: () => setDateByType,
767
+ setHours: () => setHours,
768
+ setMinutes: () => setMinutes,
769
+ setSeconds: () => setSeconds,
731
770
  toast: () => toast2,
732
771
  useChartHighlights: () => useChartHighlights,
733
772
  useDrag: () => useDrag,
@@ -2688,30 +2727,36 @@ var DraggableTooltipComponent = ({
2688
2727
  onPositionChange,
2689
2728
  highlightedSeries,
2690
2729
  toggleHighlight,
2691
- showOnlyHighlighted
2730
+ showOnlyHighlighted,
2731
+ valueFormatter: valueFormatter2
2692
2732
  }) => {
2693
2733
  const visibleKeys = (0, import_react16.useMemo)(
2694
2734
  () => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
2695
2735
  [showOnlyHighlighted, highlightedSeries, dataKeys]
2696
2736
  );
2697
- const TotalDisplay = import_react16.default.memo(
2698
- ({ data: data2, visibleKeys: visibleKeys2 }) => {
2699
- const total = (0, import_react16.useMemo)(() => {
2700
- const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
2701
- return numeric.reduce((s, v) => s + (v || 0), 0);
2702
- }, [data2, visibleKeys2]);
2703
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "text-sm", children: [
2704
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-sm text-muted-foreground", children: "Total" }),
2705
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2706
- "div",
2707
- {
2708
- className: `text-base font-semibold ${total < 0 ? "text-destructive" : "text-foreground"}`,
2709
- children: total.toLocaleString("pt-BR")
2710
- }
2711
- )
2712
- ] });
2713
- }
2714
- );
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
+ });
2715
2760
  const [localPos, setLocalPos] = (0, import_react16.useState)(position);
2716
2761
  const [dragging, setDragging] = (0, import_react16.useState)(false);
2717
2762
  const offsetRef = (0, import_react16.useRef)({ x: 0, y: 0 });
@@ -3093,7 +3138,14 @@ var DraggableTooltipComponent = ({
3093
3138
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: periodLabel }),
3094
3139
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "font-bold text-lg text-foreground mt-1 truncate", children: data.name })
3095
3140
  ] }),
3096
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-right", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TotalDisplay, { data, visibleKeys }) })
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
+ ) })
3097
3149
  ] }) }),
3098
3150
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-3 pt-2 space-y-2", children: [
3099
3151
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2", children: dataLabel }),
@@ -3109,6 +3161,13 @@ var DraggableTooltipComponent = ({
3109
3161
  0
3110
3162
  );
3111
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;
3112
3171
  const pct = absDenominator > 0 ? Math.abs(val) / absDenominator * 100 : 0;
3113
3172
  const isDimmed = highlightedSeries && highlightedSeries.size > 0 && !highlightedSeries.has(key);
3114
3173
  const isHighlighted = highlightedSeries && highlightedSeries.has(key);
@@ -3154,7 +3213,7 @@ var DraggableTooltipComponent = ({
3154
3213
  "span",
3155
3214
  {
3156
3215
  className: `font-semibold tabular-nums ${val < 0 ? "text-destructive" : "text-foreground"}`,
3157
- children: val.toLocaleString("pt-BR")
3216
+ children: displayValue
3158
3217
  }
3159
3218
  ),
3160
3219
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
@@ -3183,7 +3242,8 @@ var DraggableTooltipComponent = ({
3183
3242
  dataKeys,
3184
3243
  highlightedSeries,
3185
3244
  toggleHighlight,
3186
- finalColors
3245
+ finalColors,
3246
+ valueFormatter2
3187
3247
  ]
3188
3248
  ),
3189
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: [
@@ -3219,7 +3279,8 @@ var RechartTooltipWithTotal = ({
3219
3279
  label,
3220
3280
  finalColors = {},
3221
3281
  periodLabel = "Per\xEDodo",
3222
- totalLabel = "Total"
3282
+ totalLabel = "Total",
3283
+ valueFormatter: valueFormatter2
3223
3284
  }) => {
3224
3285
  if (!active || !payload || payload.length === 0) return null;
3225
3286
  const numeric = payload.filter(
@@ -3227,6 +3288,13 @@ var RechartTooltipWithTotal = ({
3227
3288
  );
3228
3289
  const total = numeric.reduce((sum, p) => sum + (p.value || 0), 0);
3229
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;
3230
3298
  const absDenominator = numeric.reduce(
3231
3299
  (sum, p) => sum + Math.abs(typeof p.value === "number" ? p.value : 0),
3232
3300
  0
@@ -3250,7 +3318,7 @@ var RechartTooltipWithTotal = ({
3250
3318
  "p",
3251
3319
  {
3252
3320
  className: `text-sm font-semibold ${isTotalNegative ? "text-rose-500" : "text-foreground"}`,
3253
- children: total.toLocaleString("pt-BR")
3321
+ children: displayTotal
3254
3322
  }
3255
3323
  )
3256
3324
  ] })
@@ -3260,6 +3328,13 @@ var RechartTooltipWithTotal = ({
3260
3328
  const pct = absDenominator > 0 ? Math.abs(value) / absDenominator * 100 : 0;
3261
3329
  const baseColor = finalColors[entry.dataKey] || entry.color || "#999";
3262
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;
3263
3338
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-1", children: [
3264
3339
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
3265
3340
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2 truncate", children: [
@@ -3278,7 +3353,7 @@ var RechartTooltipWithTotal = ({
3278
3353
  "span",
3279
3354
  {
3280
3355
  className: `${isNeg ? "text-rose-500" : "text-foreground"} font-medium`,
3281
- children: value.toLocaleString("pt-BR")
3356
+ children: displayValue
3282
3357
  }
3283
3358
  ),
3284
3359
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
@@ -3309,7 +3384,8 @@ var TooltipSimple = ({
3309
3384
  payload,
3310
3385
  label,
3311
3386
  finalColors = {},
3312
- periodLabel = "Per\xEDodo"
3387
+ periodLabel = "Per\xEDodo",
3388
+ valueFormatter: valueFormatter2
3313
3389
  }) => {
3314
3390
  if (!active || !payload || payload.length === 0) return null;
3315
3391
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
@@ -3327,6 +3403,13 @@ var TooltipSimple = ({
3327
3403
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "divide-y divide-border rounded-md overflow-hidden", children: payload.map((entry, index) => {
3328
3404
  const value = typeof entry.value === "number" ? entry.value : 0;
3329
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;
3330
3413
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3331
3414
  "div",
3332
3415
  {
@@ -3347,7 +3430,7 @@ var TooltipSimple = ({
3347
3430
  "span",
3348
3431
  {
3349
3432
  className: `font-medium tabular-nums ${value < 0 ? "text-destructive" : "text-foreground"}`,
3350
- children: value.toLocaleString("pt-BR")
3433
+ children: displayValue
3351
3434
  }
3352
3435
  ) })
3353
3436
  ]
@@ -3384,10 +3467,15 @@ var parseNumber = (v) => {
3384
3467
  return Number(v);
3385
3468
  return void 0;
3386
3469
  };
3387
- var renderPillLabel = (color, variant) => {
3470
+ var renderPillLabel = (color, variant, valueFormatter2) => {
3388
3471
  return (props) => {
3389
3472
  const { x, y, value } = props;
3390
- const text = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
3473
+ const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
3474
+ const text = valueFormatter2 ? valueFormatter2({
3475
+ value,
3476
+ formattedValue: defaultFormatted,
3477
+ ...props
3478
+ }) : defaultFormatted;
3391
3479
  const paddingX = 8;
3392
3480
  const approxCharWidth = 7;
3393
3481
  const pillWidth = Math.max(
@@ -3495,6 +3583,7 @@ var Chart = ({
3495
3583
  showLabels = false,
3496
3584
  xAxis,
3497
3585
  labelMap,
3586
+ valueFormatter: valueFormatter2,
3498
3587
  enableHighlights = false,
3499
3588
  enableShowOnly = false,
3500
3589
  enablePeriodsDropdown = false,
@@ -3512,7 +3601,7 @@ var Chart = ({
3512
3601
  } : {
3513
3602
  dataKey: resolvedXAxisKey,
3514
3603
  label: xAxis?.label ?? formatFieldName(resolvedXAxisKey),
3515
- formatter: xAxis?.formatter,
3604
+ valueFormatter: xAxis?.valueFormatter,
3516
3605
  autoLabel: xAxis?.autoLabel ?? true
3517
3606
  };
3518
3607
  const detectedFields = detectDataFields(data, xAxisConfig2.dataKey);
@@ -3964,7 +4053,7 @@ var Chart = ({
3964
4053
  fontSize: 12,
3965
4054
  tickLine: false,
3966
4055
  axisLine: false,
3967
- tickFormatter: xAxisConfig.formatter
4056
+ tickFormatter: xAxisConfig.valueFormatter
3968
4057
  }
3969
4058
  ),
3970
4059
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
@@ -3991,7 +4080,19 @@ var Chart = ({
3991
4080
  showTooltip && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3992
4081
  import_recharts.Tooltip,
3993
4082
  {
3994
- content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipWithTotal_default, { finalColors }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipSimple_default, { finalColors }),
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
+ ),
3995
4096
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
3996
4097
  }
3997
4098
  ),
@@ -4037,7 +4138,11 @@ var Chart = ({
4037
4138
  {
4038
4139
  dataKey: key,
4039
4140
  position: "top",
4040
- content: pillLabelRenderer_default(color, "filled"),
4141
+ content: pillLabelRenderer_default(
4142
+ color,
4143
+ "filled",
4144
+ valueFormatter2
4145
+ ),
4041
4146
  offset: 8
4042
4147
  }
4043
4148
  ) : null
@@ -4066,7 +4171,11 @@ var Chart = ({
4066
4171
  {
4067
4172
  dataKey: key,
4068
4173
  position: "top",
4069
- content: pillLabelRenderer_default(color, "filled"),
4174
+ content: pillLabelRenderer_default(
4175
+ color,
4176
+ "filled",
4177
+ valueFormatter2
4178
+ ),
4070
4179
  offset: 14
4071
4180
  }
4072
4181
  ) : null
@@ -4095,7 +4204,11 @@ var Chart = ({
4095
4204
  {
4096
4205
  dataKey: key,
4097
4206
  position: "top",
4098
- content: pillLabelRenderer_default(color, "soft"),
4207
+ content: pillLabelRenderer_default(
4208
+ color,
4209
+ "soft",
4210
+ valueFormatter2
4211
+ ),
4099
4212
  offset: 12
4100
4213
  }
4101
4214
  ) : null
@@ -4124,6 +4237,7 @@ var Chart = ({
4124
4237
  onPositionChange: onTooltipPositionChange,
4125
4238
  periodLabel: "Per\xEDodo Selecionado",
4126
4239
  dataLabel: "Dados do Per\xEDodo",
4240
+ valueFormatter: valueFormatter2,
4127
4241
  globalTooltipCount: activeTooltips.length,
4128
4242
  onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
4129
4243
  closeAllButtonPosition: "top-center",
@@ -4639,7 +4753,7 @@ var BarChart = ({
4639
4753
  fontSize: 12,
4640
4754
  tickLine: false,
4641
4755
  axisLine: false,
4642
- tickFormatter: xAxisConfig.formatter
4756
+ tickFormatter: xAxisConfig.valueFormatter
4643
4757
  }
4644
4758
  ),
4645
4759
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -10041,14 +10155,1145 @@ var UniversalTooltipRenderer = ({
10041
10155
  ] });
10042
10156
  };
10043
10157
 
10158
+ // src/components/picker/DateTimePicker.tsx
10159
+ var import_date_fns = require("date-fns");
10160
+
10161
+ // src/components/picker/calendar.tsx
10162
+ var React39 = __toESM(require("react"));
10163
+ var import_react_day_picker2 = require("react-day-picker");
10164
+ var import_react40 = require("@phosphor-icons/react");
10165
+ var import_framer_motion14 = require("framer-motion");
10166
+ var import_jsx_runtime63 = require("react/jsx-runtime");
10167
+ function CalendarBase2({
10168
+ className,
10169
+ classNames,
10170
+ showOutsideDays = true,
10171
+ ...props
10172
+ }) {
10173
+ const [month, setMonth] = React39.useState(
10174
+ props.month || props.defaultMonth || /* @__PURE__ */ new Date()
10175
+ );
10176
+ const [direction, setDirection] = React39.useState(1);
10177
+ const handleMonthChange = (newMonth) => {
10178
+ const isNext = newMonth > month ? 1 : -1;
10179
+ setDirection(isNext);
10180
+ setMonth(newMonth);
10181
+ props.onMonthChange?.(newMonth);
10182
+ };
10183
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
10184
+ "div",
10185
+ {
10186
+ className: cn(
10187
+ "rounded-md border bg-background p-2 overflow-hidden flex flex-col",
10188
+ className
10189
+ ),
10190
+ children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_framer_motion14.AnimatePresence, { initial: false, mode: "wait", custom: direction, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
10191
+ "div",
10192
+ {
10193
+ className: "w-full h-full flex flex-col",
10194
+ children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
10195
+ import_react_day_picker2.DayPicker,
10196
+ {
10197
+ showOutsideDays,
10198
+ month,
10199
+ onMonthChange: handleMonthChange,
10200
+ className: "w-full h-full min-w-0 flex flex-col",
10201
+ classNames: {
10202
+ months: "flex items-center flex-col sm:flex-row space-y-2 sm:space-x-2 sm:space-y-0 flex-1",
10203
+ month: "space-y-2 min-w-0 flex-1 flex flex-col",
10204
+ caption: "flex justify-center pt-1 relative items-center h-[10%] min-h-[2rem] mb-2",
10205
+ caption_label: "text-[clamp(0.875rem,2.5vw,1.25rem)] font-semibold truncate px-10 tracking-tight",
10206
+ nav: "space-x-1 flex items-center",
10207
+ nav_button: cn(
10208
+ buttonVariantsBase({ variant: "outline" }),
10209
+ "h-8 w-8 bg-background p-0 opacity-60 hover:opacity-100 hover:bg-muted flex-shrink-0 touch-manipulation transition-all duration-200 ease-out hover:scale-105 active:scale-95",
10210
+ "[@media(min-width:400px)]:h-9 [@media(min-width:400px)]:w-9"
10211
+ ),
10212
+ nav_button_previous: "absolute left-0",
10213
+ nav_button_next: "absolute right-0",
10214
+ table: "w-full border-collapse min-w-0 flex-1 flex flex-col",
10215
+ head_row: "flex w-full gap-1 mb-1",
10216
+ head_cell: "text-muted-foreground rounded-md flex-1 min-w-0 font-semibold text-[clamp(0.625rem,1.5vw,0.75rem)] text-center pb-1 uppercase tracking-wider",
10217
+ row: "flex w-full flex-1 gap-1",
10218
+ cell: cn(
10219
+ "flex-1 min-w-0 aspect-square text-center p-0 relative",
10220
+ "[&:has([aria-selected].day-range-end)]:rounded-r-lg",
10221
+ "[&:has([aria-selected].day-range-start)]:rounded-l-lg",
10222
+ "[&:has([aria-selected].day-outside)]:bg-muted/50",
10223
+ "[&:has([aria-selected])]:bg-muted",
10224
+ "first:[&:has([aria-selected])]:rounded-l-lg",
10225
+ "last:[&:has([aria-selected])]:rounded-r-lg",
10226
+ "focus-within:relative focus-within:z-20"
10227
+ ),
10228
+ day: cn(
10229
+ buttonVariantsBase({ variant: "ghost" }),
10230
+ "w-full h-full p-0",
10231
+ "aria-selected:opacity-100 hover:bg-muted flex items-center justify-center",
10232
+ " transition-all duration-200 ease-out hover:scale-105 active:scale-95"
10233
+ ),
10234
+ day_selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white",
10235
+ day_today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset",
10236
+ day_outside: "day-outside text-muted-foreground/40 opacity-40 aria-selected:bg-muted/50 aria-selected:text-foreground",
10237
+ day_disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
10238
+ day_range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
10239
+ day_hidden: "invisible",
10240
+ ...classNames
10241
+ },
10242
+ components: {
10243
+ IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react40.CaretLeftIcon, { className: "h-4 w-4" }),
10244
+ IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react40.CaretRightIcon, { className: "h-4 w-4" })
10245
+ },
10246
+ ...props
10247
+ }
10248
+ )
10249
+ },
10250
+ month.toISOString()
10251
+ ) }) })
10252
+ }
10253
+ );
10254
+ }
10255
+ CalendarBase2.displayName = "CalendarBase";
10256
+
10257
+ // src/components/picker/DateTimePicker.tsx
10258
+ var import_locale = require("date-fns/locale");
10259
+ var import_react43 = require("react");
10260
+
10261
+ // src/components/picker/TimePicker.tsx
10262
+ var import_framer_motion15 = require("framer-motion");
10263
+ var React41 = __toESM(require("react"));
10264
+
10265
+ // src/components/picker/TimePickerInput.tsx
10266
+ var import_react41 = require("@phosphor-icons/react");
10267
+ var import_react42 = __toESM(require("react"));
10268
+
10269
+ // src/components/picker/utils/time-picker-utils.ts
10270
+ function isValidHour(value) {
10271
+ return /^(0[0-9]|1[0-9]|2[0-3])$/.test(value);
10272
+ }
10273
+ function isValid12Hour(value) {
10274
+ return /^(0[1-9]|1[0-2])$/.test(value);
10275
+ }
10276
+ function isValidMinuteOrSecond(value) {
10277
+ return /^[0-5][0-9]$/.test(value);
10278
+ }
10279
+ function getValidNumber(value, { max, min = 0, loop = false }) {
10280
+ let numericValue = parseInt(value, 10);
10281
+ if (!isNaN(numericValue)) {
10282
+ if (!loop) {
10283
+ if (numericValue > max) numericValue = max;
10284
+ if (numericValue < min) numericValue = min;
10285
+ } else {
10286
+ if (numericValue > max) numericValue = min;
10287
+ if (numericValue < min) numericValue = max;
10288
+ }
10289
+ return numericValue.toString().padStart(2, "0");
10290
+ }
10291
+ return "00";
10292
+ }
10293
+ function getValidHour(value) {
10294
+ if (isValidHour(value)) return value;
10295
+ return getValidNumber(value, { max: 23 });
10296
+ }
10297
+ function getValid12Hour(value) {
10298
+ if (isValid12Hour(value)) return value;
10299
+ return getValidNumber(value, { min: 1, max: 12 });
10300
+ }
10301
+ function getValidMinuteOrSecond(value) {
10302
+ if (isValidMinuteOrSecond(value)) return value;
10303
+ return getValidNumber(value, { max: 59 });
10304
+ }
10305
+ function getValidArrowNumber(value, { min, max, step }) {
10306
+ let numericValue = parseInt(value, 10);
10307
+ if (!isNaN(numericValue)) {
10308
+ numericValue += step;
10309
+ return getValidNumber(String(numericValue), { min, max, loop: true });
10310
+ }
10311
+ return "00";
10312
+ }
10313
+ function getValidArrowHour(value, step) {
10314
+ return getValidArrowNumber(value, { min: 0, max: 23, step });
10315
+ }
10316
+ function getValidArrow12Hour(value, step) {
10317
+ return getValidArrowNumber(value, { min: 1, max: 12, step });
10318
+ }
10319
+ function getValidArrowMinuteOrSecond(value, step) {
10320
+ return getValidArrowNumber(value, { min: 0, max: 59, step });
10321
+ }
10322
+ function setMinutes(date, value) {
10323
+ const minutes = getValidMinuteOrSecond(value);
10324
+ date.setMinutes(parseInt(minutes, 10));
10325
+ return date;
10326
+ }
10327
+ function setSeconds(date, value) {
10328
+ const seconds = getValidMinuteOrSecond(value);
10329
+ date.setSeconds(parseInt(seconds, 10));
10330
+ return date;
10331
+ }
10332
+ function setHours(date, value) {
10333
+ const hours = getValidHour(value);
10334
+ date.setHours(parseInt(hours, 10));
10335
+ return date;
10336
+ }
10337
+ function set12Hours(date, value, period) {
10338
+ const hours = parseInt(getValid12Hour(value), 10);
10339
+ const convertedHours = convert12HourTo24Hour(hours, period);
10340
+ date.setHours(convertedHours);
10341
+ return date;
10342
+ }
10343
+ function setDateByType(date, value, type, period) {
10344
+ switch (type) {
10345
+ case "minutes":
10346
+ return setMinutes(date, value);
10347
+ case "seconds":
10348
+ return setSeconds(date, value);
10349
+ case "hours":
10350
+ return setHours(date, value);
10351
+ case "12hours": {
10352
+ if (!period) return date;
10353
+ return set12Hours(date, value, period);
10354
+ }
10355
+ default:
10356
+ return date;
10357
+ }
10358
+ }
10359
+ function getDateByType(date, type) {
10360
+ switch (type) {
10361
+ case "minutes":
10362
+ return getValidMinuteOrSecond(String(date.getMinutes()));
10363
+ case "seconds":
10364
+ return getValidMinuteOrSecond(String(date.getSeconds()));
10365
+ case "hours":
10366
+ return getValidHour(String(date.getHours()));
10367
+ case "12hours":
10368
+ const hours = display12HourValue(date.getHours());
10369
+ return getValid12Hour(String(hours));
10370
+ default:
10371
+ return "00";
10372
+ }
10373
+ }
10374
+ function getArrowByType(value, step, type) {
10375
+ switch (type) {
10376
+ case "minutes":
10377
+ return getValidArrowMinuteOrSecond(value, step);
10378
+ case "seconds":
10379
+ return getValidArrowMinuteOrSecond(value, step);
10380
+ case "hours":
10381
+ return getValidArrowHour(value, step);
10382
+ case "12hours":
10383
+ return getValidArrow12Hour(value, step);
10384
+ default:
10385
+ return "00";
10386
+ }
10387
+ }
10388
+ function convert12HourTo24Hour(hour, period) {
10389
+ if (period === "PM") {
10390
+ if (hour <= 11) {
10391
+ return hour + 12;
10392
+ } else {
10393
+ return hour;
10394
+ }
10395
+ } else if (period === "AM") {
10396
+ if (hour === 12) return 0;
10397
+ return hour;
10398
+ }
10399
+ return hour;
10400
+ }
10401
+ function display12HourValue(hours) {
10402
+ if (hours === 0 || hours === 12) return "12";
10403
+ if (hours >= 22) return `${hours - 12}`;
10404
+ if (hours % 12 > 9) return `${hours}`;
10405
+ return `0${hours % 12}`;
10406
+ }
10407
+
10408
+ // src/components/picker/TimePickerInput.tsx
10409
+ var import_jsx_runtime64 = require("react/jsx-runtime");
10410
+ var TimePickerInput = import_react42.default.forwardRef(
10411
+ ({
10412
+ className,
10413
+ type = "tel",
10414
+ value,
10415
+ id,
10416
+ name,
10417
+ date = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)),
10418
+ setDate,
10419
+ onChange,
10420
+ onKeyDown,
10421
+ picker,
10422
+ period,
10423
+ onLeftFocus,
10424
+ onRightFocus,
10425
+ showArrows = true,
10426
+ label,
10427
+ ...props
10428
+ }, ref) => {
10429
+ const [flag, setFlag] = import_react42.default.useState(false);
10430
+ const [prevIntKey, setPrevIntKey] = import_react42.default.useState("0");
10431
+ const [isFocused, setIsFocused] = import_react42.default.useState(false);
10432
+ import_react42.default.useEffect(() => {
10433
+ if (flag) {
10434
+ const timer = setTimeout(() => {
10435
+ setFlag(false);
10436
+ }, 2e3);
10437
+ return () => clearTimeout(timer);
10438
+ }
10439
+ }, [flag]);
10440
+ const calculatedValue = import_react42.default.useMemo(() => {
10441
+ return getDateByType(date, picker);
10442
+ }, [date, picker]);
10443
+ const calculateNewValue = (key) => {
10444
+ if (picker === "12hours") {
10445
+ if (flag && calculatedValue.slice(1, 2) === "1" && prevIntKey === "0")
10446
+ return "0" + key;
10447
+ }
10448
+ return !flag ? "0" + key : calculatedValue.slice(1, 2) + key;
10449
+ };
10450
+ const handleArrowClick = (direction) => {
10451
+ const step = direction === "up" ? 1 : -1;
10452
+ const newValue = getArrowByType(calculatedValue, step, picker);
10453
+ if (flag) setFlag(false);
10454
+ const tempDate = new Date(date);
10455
+ setDate(setDateByType(tempDate, newValue, picker, period));
10456
+ };
10457
+ const handleKeyDown = (e) => {
10458
+ if (e.key === "Tab") return;
10459
+ e.preventDefault();
10460
+ if (e.key === "ArrowRight") onRightFocus?.();
10461
+ if (e.key === "ArrowLeft") onLeftFocus?.();
10462
+ if (["ArrowUp", "ArrowDown"].includes(e.key)) {
10463
+ const step = e.key === "ArrowUp" ? 1 : -1;
10464
+ const newValue = getArrowByType(calculatedValue, step, picker);
10465
+ if (flag) setFlag(false);
10466
+ const tempDate = new Date(date);
10467
+ setDate(setDateByType(tempDate, newValue, picker, period));
10468
+ }
10469
+ if (e.key >= "0" && e.key <= "9") {
10470
+ if (picker === "12hours") setPrevIntKey(e.key);
10471
+ const newValue = calculateNewValue(e.key);
10472
+ if (flag) onRightFocus?.();
10473
+ setFlag((prev) => !prev);
10474
+ const tempDate = new Date(date);
10475
+ setDate(setDateByType(tempDate, newValue, picker, period));
10476
+ }
10477
+ };
10478
+ const getPickerLabel = () => {
10479
+ if (label) return label;
10480
+ switch (picker) {
10481
+ case "hours":
10482
+ case "12hours":
10483
+ return "Horas";
10484
+ case "minutes":
10485
+ return "Minutos";
10486
+ case "seconds":
10487
+ return "Segundos";
10488
+ default:
10489
+ return "";
10490
+ }
10491
+ };
10492
+ const getAriaLabel = () => {
10493
+ const baseLabel = getPickerLabel();
10494
+ return `${baseLabel}, valor atual: ${calculatedValue}.`;
10495
+ };
10496
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "relative group flex flex-col items-center", children: [
10497
+ getPickerLabel() && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10498
+ "label",
10499
+ {
10500
+ htmlFor: id || picker,
10501
+ className: "text-xs sm:text-sm font-medium text-muted-foreground mb-1 sm:mb-2 select-none",
10502
+ children: getPickerLabel()
10503
+ }
10504
+ ),
10505
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
10506
+ "div",
10507
+ {
10508
+ className: cn(
10509
+ "relative flex flex-col items-center",
10510
+ "transition-all duration-200"
10511
+ ),
10512
+ children: [
10513
+ showArrows && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10514
+ "button",
10515
+ {
10516
+ type: "button",
10517
+ onClick: () => handleArrowClick("up"),
10518
+ className: cn(
10519
+ "flex items-center justify-center w-10 sm:w-12 h-5 sm:h-6 mb-1",
10520
+ "rounded-t",
10521
+ "bg-background hover:bg-accent active:bg-accent/80 transition-colors",
10522
+ "text-muted-foreground hover:text-foreground",
10523
+ "focus:outline-none focus:ring-1 focus:ring-ring",
10524
+ "touch-manipulation",
10525
+ isFocused && "border-ring"
10526
+ ),
10527
+ tabIndex: -1,
10528
+ "aria-label": `Incrementar ${getPickerLabel().toLowerCase()}`,
10529
+ children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react41.CaretUpIcon, { size: 14, className: "sm:w-4 sm:h-4" })
10530
+ }
10531
+ ),
10532
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "relative", children: [
10533
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10534
+ "input",
10535
+ {
10536
+ ref,
10537
+ id: id || picker,
10538
+ name: name || picker,
10539
+ className: cn(
10540
+ "w-16 sm:w-20 h-10 sm:h-12 text-center font-mono text-lg sm:text-xl font-semibold",
10541
+ "border-2 rounded-lg",
10542
+ "bg-background text-foreground",
10543
+ "transition-all duration-200",
10544
+ "focus:outline-none focus:ring-2 focus:ring-ring focus:border-ring",
10545
+ "selection:bg-primary selection:text-primary-foreground",
10546
+ "touch-manipulation",
10547
+ showArrows && "rounded-lg",
10548
+ isFocused && "ring-2 ring-ring border-ring shadow-md",
10549
+ className
10550
+ ),
10551
+ value: value || calculatedValue,
10552
+ onChange: (e) => {
10553
+ e.preventDefault();
10554
+ onChange?.(e);
10555
+ },
10556
+ onFocus: (e) => {
10557
+ setIsFocused(true);
10558
+ props.onFocus?.(e);
10559
+ e.target.select();
10560
+ },
10561
+ onBlur: (e) => {
10562
+ setIsFocused(false);
10563
+ props.onBlur?.(e);
10564
+ },
10565
+ type,
10566
+ inputMode: "decimal",
10567
+ onKeyDown: (e) => {
10568
+ onKeyDown?.(e);
10569
+ handleKeyDown(e);
10570
+ },
10571
+ "aria-label": getAriaLabel(),
10572
+ "aria-describedby": `${id || picker}-help`,
10573
+ autoComplete: "off",
10574
+ spellCheck: false,
10575
+ ...props
10576
+ }
10577
+ ),
10578
+ isFocused && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "absolute inset-0 rounded-lg ring-2 ring-primary/20 pointer-events-none animate-pulse" })
10579
+ ] }),
10580
+ showArrows && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10581
+ "button",
10582
+ {
10583
+ type: "button",
10584
+ onClick: () => handleArrowClick("down"),
10585
+ className: cn(
10586
+ "flex items-center justify-center w-10 sm:w-12 h-5 sm:h-6 mt-1",
10587
+ "rounded-b",
10588
+ "bg-background hover:bg-accent active:bg-accent/80 transition-colors",
10589
+ "text-muted-foreground hover:text-foreground",
10590
+ "focus:outline-none focus:ring-1 focus:ring-ring",
10591
+ "touch-manipulation",
10592
+ isFocused && "border-ring"
10593
+ ),
10594
+ tabIndex: -1,
10595
+ "aria-label": `Decrementar ${getPickerLabel().toLowerCase()}`,
10596
+ children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react41.CaretDownIcon, { size: 14, className: "sm:w-4 sm:h-4" })
10597
+ }
10598
+ )
10599
+ ]
10600
+ }
10601
+ )
10602
+ ] });
10603
+ }
10604
+ );
10605
+ TimePickerInput.displayName = "TimePickerInput";
10606
+
10607
+ // src/components/picker/TimePicker.tsx
10608
+ var import_jsx_runtime65 = require("react/jsx-runtime");
10609
+ function TimePicker({
10610
+ date,
10611
+ setDate,
10612
+ hideSeconds,
10613
+ enableButton
10614
+ }) {
10615
+ const minuteRef = React41.useRef(null);
10616
+ const hourRef = React41.useRef(null);
10617
+ const secondRef = React41.useRef(null);
10618
+ const containerVariants = {
10619
+ hidden: { opacity: 0, y: 10 },
10620
+ visible: {
10621
+ opacity: 1,
10622
+ y: 0,
10623
+ transition: {
10624
+ duration: 0.3,
10625
+ staggerChildren: 0.1
10626
+ }
10627
+ }
10628
+ };
10629
+ const itemVariants2 = {
10630
+ hidden: { opacity: 0, y: 10 },
10631
+ visible: { opacity: 1, y: 0 }
10632
+ };
10633
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
10634
+ import_framer_motion15.motion.div,
10635
+ {
10636
+ variants: containerVariants,
10637
+ initial: "hidden",
10638
+ animate: "visible",
10639
+ className: "flex items-end justify-center gap-2 sm:gap-3 p-2 sm:p-3 md:p-4 rounded-lg bg-muted/20 border border-border/50 w-full max-w-full overflow-hidden",
10640
+ children: [
10641
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
10642
+ import_framer_motion15.motion.div,
10643
+ {
10644
+ variants: itemVariants2,
10645
+ className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
10646
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
10647
+ TimePickerInput,
10648
+ {
10649
+ picker: "hours",
10650
+ date,
10651
+ setDate,
10652
+ ref: hourRef,
10653
+ onRightFocus: () => minuteRef.current?.focus(),
10654
+ enableButton
10655
+ }
10656
+ )
10657
+ }
10658
+ ),
10659
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
10660
+ import_framer_motion15.motion.div,
10661
+ {
10662
+ variants: itemVariants2,
10663
+ className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
10664
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
10665
+ TimePickerInput,
10666
+ {
10667
+ picker: "minutes",
10668
+ date,
10669
+ setDate,
10670
+ ref: minuteRef,
10671
+ onLeftFocus: () => hourRef.current?.focus(),
10672
+ onRightFocus: () => secondRef.current?.focus(),
10673
+ enableButton
10674
+ }
10675
+ )
10676
+ }
10677
+ ),
10678
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_framer_motion15.AnimatePresence, { children: !hideSeconds && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
10679
+ import_framer_motion15.motion.div,
10680
+ {
10681
+ variants: itemVariants2,
10682
+ initial: "hidden",
10683
+ animate: "visible",
10684
+ exit: "hidden",
10685
+ className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
10686
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
10687
+ TimePickerInput,
10688
+ {
10689
+ picker: "seconds",
10690
+ date,
10691
+ setDate,
10692
+ ref: secondRef,
10693
+ onLeftFocus: () => minuteRef.current?.focus(),
10694
+ enableButton
10695
+ }
10696
+ )
10697
+ }
10698
+ ) }) })
10699
+ ]
10700
+ }
10701
+ );
10702
+ }
10703
+
10704
+ // src/components/picker/DateTimePicker.tsx
10705
+ var import_react44 = require("@phosphor-icons/react");
10706
+ var import_jsx_runtime66 = require("react/jsx-runtime");
10707
+ function DateTimePicker({
10708
+ label,
10709
+ date,
10710
+ onChange,
10711
+ display,
10712
+ hideSeconds,
10713
+ hideHour,
10714
+ hideMinute,
10715
+ fromDate,
10716
+ toDate,
10717
+ disabled,
10718
+ className,
10719
+ error
10720
+ }) {
10721
+ const [internalDate, setInternalDate] = (0, import_react43.useState)(date);
10722
+ const [open, setOpen] = (0, import_react43.useState)(false);
10723
+ const [timePickerOpen, setTimePickerOpen] = (0, import_react43.useState)(false);
10724
+ const handleSelect = (newDay) => {
10725
+ if (!newDay) return;
10726
+ if (!internalDate) {
10727
+ setInternalDate(newDay);
10728
+ onChange(newDay);
10729
+ return;
10730
+ }
10731
+ const diff = newDay.getTime() - internalDate.getTime();
10732
+ const diffInDays = diff / (1e3 * 60 * 60 * 24);
10733
+ const newDateFull = (0, import_date_fns.add)(internalDate, { days: Math.ceil(diffInDays) });
10734
+ setInternalDate(newDateFull);
10735
+ onChange(newDateFull);
10736
+ };
10737
+ const handleTimeChange = (newDate) => {
10738
+ setInternalDate(newDate);
10739
+ onChange(newDate);
10740
+ };
10741
+ const getTimeFormat = () => {
10742
+ if (hideHour && hideMinute) return "";
10743
+ if (hideHour) return hideSeconds ? "mm" : "mm:ss";
10744
+ if (hideMinute) return hideSeconds ? "HH" : "HH':00'";
10745
+ return hideSeconds ? "HH:mm" : "HH:mm:ss";
10746
+ };
10747
+ const getDisplayFormat = () => {
10748
+ const timeFormat = getTimeFormat();
10749
+ if (!timeFormat) return "PPP";
10750
+ return `PPP - ${timeFormat}`;
10751
+ };
10752
+ (0, import_react43.useEffect)(() => {
10753
+ if (date) {
10754
+ setInternalDate(date);
10755
+ }
10756
+ }, [date, open]);
10757
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: cn("space-y-2 w-full sm:w-auto", className), children: [
10758
+ label && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LabelBase_default, { children: label }),
10759
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
10760
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(PopoverTriggerBase, { disabled, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
10761
+ ButtonBase,
10762
+ {
10763
+ variant: "outline",
10764
+ className: cn(
10765
+ "w-full justify-start text-left min-w-0 overflow-hidden",
10766
+ !date && "text-muted-foreground/"
10767
+ ),
10768
+ children: [
10769
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "truncate flex-1", children: date ? display ? (0, import_date_fns.format)(date, "dd/MM/yyyy") : (0, import_date_fns.format)(date, getDisplayFormat(), { locale: import_locale.ptBR }) : "Selecione uma Data" }),
10770
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react44.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
10771
+ ]
10772
+ }
10773
+ ) }),
10774
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ErrorMessage_default, { error }),
10775
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
10776
+ PopoverContentBase,
10777
+ {
10778
+ className: "w-full p-0",
10779
+ align: "center",
10780
+ sideOffset: 4,
10781
+ side: "bottom",
10782
+ avoidCollisions: true,
10783
+ collisionPadding: 8,
10784
+ children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-col space-y-2 sm:space-y-3 p-2 sm:p-3 md:p-4 max-h-[calc(100vh-4rem)] overflow-y-auto", children: [
10785
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
10786
+ CalendarBase2,
10787
+ {
10788
+ mode: "single",
10789
+ locale: import_locale.ptBR,
10790
+ selected: internalDate,
10791
+ onSelect: (d) => handleSelect(d),
10792
+ initialFocus: true,
10793
+ fromDate,
10794
+ toDate,
10795
+ className: cn("w-full", hideHour && hideMinute && "border-0")
10796
+ }
10797
+ ),
10798
+ !(hideHour && hideMinute) && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex justify-center w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
10799
+ PopoverBase,
10800
+ {
10801
+ open: timePickerOpen,
10802
+ onOpenChange: setTimePickerOpen,
10803
+ children: [
10804
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
10805
+ ButtonBase,
10806
+ {
10807
+ variant: "outline",
10808
+ size: "default",
10809
+ className: cn(
10810
+ "flex items-center justify-center gap-1.5 sm:gap-2",
10811
+ "px-2 sm:px-3 py-1.5 sm:py-2",
10812
+ "text-sm sm:text-base font-semibold w-full max-w-xs",
10813
+ "border-2 border-primary/20 rounded-lg",
10814
+ "bg-background hover:bg-primary/10 hover:border-primary/30",
10815
+ "transition-all duration-200",
10816
+ "shadow-sm hover:shadow-md active:scale-[0.98]",
10817
+ "min-h-[36px] sm:min-h-[40px]"
10818
+ ),
10819
+ children: [
10820
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react44.ClockIcon, { className: "text-primary flex-shrink-0 w-4 h-4 sm:w-5 sm:h-5" }),
10821
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "text-black truncate", children: internalDate ? (0, import_date_fns.format)(internalDate, getTimeFormat() || "HH:mm", {
10822
+ locale: import_locale.ptBR
10823
+ }) : "00:00" })
10824
+ ]
10825
+ }
10826
+ ) }),
10827
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
10828
+ PopoverContentBase,
10829
+ {
10830
+ className: "w-[calc(100vw-2rem)] max-w-sm p-3 sm:p-3 rounded-md",
10831
+ align: "center",
10832
+ side: "top",
10833
+ sideOffset: 8,
10834
+ avoidCollisions: true,
10835
+ collisionPadding: 8,
10836
+ children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex flex-col items-center space-y-2 sm:space-y-3", children: [
10837
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h4", { className: "text-sm sm:text-base font-medium text-center", children: "Alterar Hor\xE1rio" }),
10838
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
10839
+ TimePicker,
10840
+ {
10841
+ setDate: handleTimeChange,
10842
+ date: internalDate,
10843
+ hideSeconds
10844
+ }
10845
+ ),
10846
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
10847
+ ButtonBase,
10848
+ {
10849
+ size: "sm",
10850
+ variant: "destructive",
10851
+ onClick: () => setTimePickerOpen(false),
10852
+ className: "w-full text-xs sm:text-sm min-h-[36px] sm:min-h-[40px]",
10853
+ children: "Fechar"
10854
+ }
10855
+ )
10856
+ ] })
10857
+ }
10858
+ )
10859
+ ]
10860
+ }
10861
+ ) })
10862
+ ] })
10863
+ }
10864
+ )
10865
+ ] })
10866
+ ] });
10867
+ }
10868
+
10869
+ // src/components/picker/RangePicker.tsx
10870
+ var React42 = __toESM(require("react"));
10871
+ var import_react_day_picker3 = require("react-day-picker");
10872
+ var import_react45 = require("@phosphor-icons/react");
10873
+ var import_framer_motion16 = require("framer-motion");
10874
+ var import_ssr7 = require("@phosphor-icons/react/dist/ssr");
10875
+ var import_jsx_runtime67 = require("react/jsx-runtime");
10876
+ function RangePicker({
10877
+ value,
10878
+ onChange,
10879
+ label = "Selecionar intervalo",
10880
+ minDate,
10881
+ maxDate,
10882
+ error
10883
+ }) {
10884
+ const [open, setOpen] = React42.useState(false);
10885
+ const [range, setRange] = React42.useState(value);
10886
+ const controls = (0, import_framer_motion16.useAnimation)();
10887
+ React42.useEffect(() => {
10888
+ setRange(value);
10889
+ }, [value]);
10890
+ const handleSelect = (selected) => {
10891
+ setRange(selected);
10892
+ onChange?.(selected);
10893
+ };
10894
+ const handleClear = () => {
10895
+ setRange(void 0);
10896
+ onChange?.(void 0);
10897
+ };
10898
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
10899
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10900
+ import_framer_motion16.motion.div,
10901
+ {
10902
+ whileTap: { scale: 0.97 },
10903
+ whileHover: { scale: open ? 1.03 : 1.01 },
10904
+ transition: { type: "spring", stiffness: 300, damping: 20 },
10905
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
10906
+ ButtonBase,
10907
+ {
10908
+ variant: "outline",
10909
+ className: "flex gap-2 transition-all duration-200 min-w-[250px] text-left justify-between items-center",
10910
+ children: [
10911
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10912
+ import_framer_motion16.motion.span,
10913
+ {
10914
+ className: "text-sm font-medium",
10915
+ transition: { duration: 0.2 },
10916
+ animate: controls,
10917
+ children: range?.from && range?.to ? `${range.from.toLocaleDateString()} - ${range.to.toLocaleDateString()}` : label
10918
+ }
10919
+ ),
10920
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10921
+ import_framer_motion16.motion.span,
10922
+ {
10923
+ animate: open ? { rotate: 8, scale: 1.15 } : { rotate: 0, scale: 1 },
10924
+ transition: { type: "spring", stiffness: 300, damping: 18 },
10925
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react45.CalendarBlankIcon, { className: "w-4 h-4 transition-transform group-hover:scale-110" })
10926
+ }
10927
+ )
10928
+ ]
10929
+ }
10930
+ )
10931
+ }
10932
+ ) }),
10933
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ErrorMessage_default, { error }),
10934
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_framer_motion16.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10935
+ PopoverContentBase,
10936
+ {
10937
+ asChild: true,
10938
+ className: "w-auto min-w-[250px] p-0 shadow-xl overflow-y-hidden",
10939
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
10940
+ import_framer_motion16.motion.div,
10941
+ {
10942
+ initial: { opacity: 0, y: 16 },
10943
+ animate: { opacity: 1, y: 0 },
10944
+ exit: { opacity: 0, y: 16 },
10945
+ transition: { duration: 0.18, ease: "easeOut" },
10946
+ children: [
10947
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10948
+ import_framer_motion16.motion.div,
10949
+ {
10950
+ initial: { opacity: 0, y: 8 },
10951
+ animate: { opacity: 1, y: 0 },
10952
+ exit: { opacity: 0, y: 8 },
10953
+ transition: { duration: 0.18 },
10954
+ className: "w-full",
10955
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10956
+ import_react_day_picker3.DayPicker,
10957
+ {
10958
+ mode: "range",
10959
+ selected: range,
10960
+ onSelect: handleSelect,
10961
+ showOutsideDays: true,
10962
+ fromDate: minDate,
10963
+ toDate: maxDate,
10964
+ className: "min-w-0 flex flex-col",
10965
+ classNames: {
10966
+ months: "flex items-center flex-col sm:flex-row space-y-2 sm:space-x-2 sm:space-y-0 flex-1",
10967
+ month: "space-y-2 min-w-0 flex-1 flex flex-col",
10968
+ caption: "flex justify-center pt-1 relative items-center h-[10%] min-h-[2rem] mb-2",
10969
+ caption_label: "text-[clamp(0.875rem,2.5vw,1.25rem)] font-semibold truncate px-10 tracking-tight",
10970
+ nav: "space-x-1 flex items-center",
10971
+ nav_button: cn(
10972
+ buttonVariantsBase({ variant: "outline" }),
10973
+ "h-8 w-8 bg-background p-0 opacity-60 hover:opacity-100 hover:bg-muted flex-shrink-0 touch-manipulation transition-all duration-200 ease-out hover:scale-105 active:scale-95",
10974
+ "[@media(min-width:400px)]:h-9 [@media(min-width:400px)]:w-9"
10975
+ ),
10976
+ nav_button_previous: "absolute left-0",
10977
+ nav_button_next: "absolute right-0",
10978
+ table: "w-full border-collapse min-w-0 flex-1 flex flex-col",
10979
+ head_row: "flex w-full gap-1 mb-1",
10980
+ head_cell: "text-muted-foreground rounded-md flex-1 min-w-0 font-semibold text-[clamp(0.625rem,1.5vw,0.75rem)] text-center pb-1 uppercase tracking-wider",
10981
+ row: "flex w-full flex-1 gap-1",
10982
+ cell: cn(
10983
+ "flex-1 min-w-0 aspect-square text-center relative",
10984
+ "[&:has([aria-selected].day-range-end)]:rounded-r-lg",
10985
+ "[&:has([aria-selected].day-range-start)]:rounded-l-lg",
10986
+ "[&:has([aria-selected].day-outside)]:bg-muted/50",
10987
+ "[&:has([aria-selected])]:bg-muted",
10988
+ "first:[&:has([aria-selected])]:rounded-l-lg",
10989
+ "last:[&:has([aria-selected])]:rounded-r-lg",
10990
+ "focus-within:relative focus-within:z-20"
10991
+ ),
10992
+ day: cn(
10993
+ buttonVariantsBase({ variant: "ghost" }),
10994
+ "w-full h-full min-w-9",
10995
+ "aria-selected:opacity-100 hover:bg-muted flex items-center justify-center p-1",
10996
+ "transition-all duration-200 ease-out !scale-100 aria-selected:!scale-100 hover:!scale-100 active:!scale-100"
10997
+ ),
10998
+ day_selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white !scale-100 p-1 !border-0 !outline-none",
10999
+ day_today: "bg-muted text-foreground font-bold ring-2 ring-primary/50 ring-inset p-1 !border-0 !outline-none",
11000
+ day_outside: "day-outside text-muted-foreground/40 opacity-40 aria-selected:bg-muted/50 aria-selected:text-foreground",
11001
+ day_disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
11002
+ day_range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
11003
+ day_hidden: "invisible"
11004
+ },
11005
+ components: {
11006
+ IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react45.CaretLeftIcon, { className: "h-4 w-4" }),
11007
+ IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react45.CaretRightIcon, { className: "h-4 w-4" })
11008
+ }
11009
+ }
11010
+ )
11011
+ }
11012
+ ) }),
11013
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex justify-end gap-2 px-4 pb-4", children: [
11014
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { style: { display: "inline-block" }, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11015
+ import_framer_motion16.motion.div,
11016
+ {
11017
+ whileHover: { scale: 1.03 },
11018
+ whileTap: { scale: 0.95 },
11019
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11020
+ ButtonBase,
11021
+ {
11022
+ variant: "outline",
11023
+ onClick: () => {
11024
+ setRange({
11025
+ from: /* @__PURE__ */ new Date(),
11026
+ to: /* @__PURE__ */ new Date()
11027
+ });
11028
+ },
11029
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_ssr7.CalendarDotIcon, {})
11030
+ }
11031
+ )
11032
+ }
11033
+ ) }),
11034
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { style: { display: "inline-block" }, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11035
+ import_framer_motion16.motion.div,
11036
+ {
11037
+ whileHover: { scale: 1.03 },
11038
+ whileTap: { scale: 0.95 },
11039
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11040
+ DeleteButton,
11041
+ {
11042
+ variant: "outline",
11043
+ onClick: handleClear,
11044
+ disabled: !range?.from && !range?.to,
11045
+ className: "hover:bg-destructive hover:text-white",
11046
+ children: "Limpar"
11047
+ }
11048
+ )
11049
+ }
11050
+ ) }),
11051
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { style: { display: "inline-block", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11052
+ import_framer_motion16.motion.div,
11053
+ {
11054
+ whileHover: { scale: 1.02 },
11055
+ whileTap: { scale: 0.98 },
11056
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
11057
+ ButtonBase,
11058
+ {
11059
+ className: "font-semibold w-full text-center",
11060
+ onClick: () => setOpen(false),
11061
+ disabled: !range?.from || !range?.to,
11062
+ children: "Selecionar"
11063
+ }
11064
+ )
11065
+ }
11066
+ ) })
11067
+ ] })
11068
+ ]
11069
+ }
11070
+ )
11071
+ }
11072
+ ) })
11073
+ ] });
11074
+ }
11075
+ RangePicker.displayName = "RangePicker";
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
+
10044
11289
  // src/hooks/use-drag.tsx
10045
- var import_react40 = require("react");
11290
+ var import_react47 = require("react");
10046
11291
  var useDrag = (options = {}) => {
10047
- const [isDragging, setIsDragging] = (0, import_react40.useState)(null);
10048
- const [positions, setPositions] = (0, import_react40.useState)({});
10049
- const dragStartPos = (0, import_react40.useRef)(null);
10050
- const dragId = (0, import_react40.useRef)(null);
10051
- const handleMouseDown = (0, import_react40.useCallback)((id, e) => {
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) => {
10052
11297
  e.preventDefault();
10053
11298
  const currentPosition = positions[id] || { top: 0, left: 0 };
10054
11299
  dragStartPos.current = {
@@ -10061,7 +11306,7 @@ var useDrag = (options = {}) => {
10061
11306
  setIsDragging(id);
10062
11307
  options.onDragStart?.(id);
10063
11308
  }, [positions, options]);
10064
- const handleMouseMove = (0, import_react40.useCallback)((e) => {
11309
+ const handleMouseMove = (0, import_react47.useCallback)((e) => {
10065
11310
  if (!isDragging || !dragStartPos.current || !dragId.current) return;
10066
11311
  const deltaX = e.clientX - dragStartPos.current.x;
10067
11312
  const deltaY = e.clientY - dragStartPos.current.y;
@@ -10077,7 +11322,7 @@ var useDrag = (options = {}) => {
10077
11322
  }));
10078
11323
  options.onDrag?.(dragId.current, newPosition);
10079
11324
  }, [isDragging, options]);
10080
- const handleMouseUp = (0, import_react40.useCallback)(() => {
11325
+ const handleMouseUp = (0, import_react47.useCallback)(() => {
10081
11326
  if (dragId.current) {
10082
11327
  options.onDragEnd?.(dragId.current);
10083
11328
  }
@@ -10085,7 +11330,7 @@ var useDrag = (options = {}) => {
10085
11330
  dragStartPos.current = null;
10086
11331
  dragId.current = null;
10087
11332
  }, [options]);
10088
- (0, import_react40.useEffect)(() => {
11333
+ (0, import_react47.useEffect)(() => {
10089
11334
  if (isDragging) {
10090
11335
  document.addEventListener("mousemove", handleMouseMove);
10091
11336
  document.addEventListener("mouseup", handleMouseUp);
@@ -10097,16 +11342,16 @@ var useDrag = (options = {}) => {
10097
11342
  };
10098
11343
  }
10099
11344
  }, [isDragging, handleMouseMove, handleMouseUp]);
10100
- const setPosition = (0, import_react40.useCallback)((id, position) => {
11345
+ const setPosition = (0, import_react47.useCallback)((id, position) => {
10101
11346
  setPositions((prev) => ({
10102
11347
  ...prev,
10103
11348
  [id]: position
10104
11349
  }));
10105
11350
  }, []);
10106
- const getPosition = (0, import_react40.useCallback)((id) => {
11351
+ const getPosition = (0, import_react47.useCallback)((id) => {
10107
11352
  return positions[id] || { top: 0, left: 0 };
10108
11353
  }, [positions]);
10109
- const isElementDragging = (0, import_react40.useCallback)((id) => {
11354
+ const isElementDragging = (0, import_react47.useCallback)((id) => {
10110
11355
  return isDragging === id;
10111
11356
  }, [isDragging]);
10112
11357
  return {