@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.d.mts +190 -51
- package/dist/index.d.ts +190 -51
- package/dist/index.js +1293 -48
- package/dist/index.mjs +1298 -42
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2455,30 +2455,36 @@ var DraggableTooltipComponent = ({
|
|
|
2455
2455
|
onPositionChange,
|
|
2456
2456
|
highlightedSeries,
|
|
2457
2457
|
toggleHighlight,
|
|
2458
|
-
showOnlyHighlighted
|
|
2458
|
+
showOnlyHighlighted,
|
|
2459
|
+
valueFormatter: valueFormatter2
|
|
2459
2460
|
}) => {
|
|
2460
2461
|
const visibleKeys = useMemo4(
|
|
2461
2462
|
() => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
|
|
2462
2463
|
[showOnlyHighlighted, highlightedSeries, dataKeys]
|
|
2463
2464
|
);
|
|
2464
|
-
const TotalDisplay = React12.memo(
|
|
2465
|
-
|
|
2466
|
-
const
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2465
|
+
const TotalDisplay = React12.memo(({ data: data2, visibleKeys: visibleKeys2, valueFormatter: localformatter }) => {
|
|
2466
|
+
const total = useMemo4(() => {
|
|
2467
|
+
const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
|
|
2468
|
+
return numeric.reduce((s, v) => s + (v || 0), 0);
|
|
2469
|
+
}, [data2, visibleKeys2]);
|
|
2470
|
+
const defaultTotalFormatted = total.toLocaleString("pt-BR");
|
|
2471
|
+
const displayTotal = localformatter ? localformatter({
|
|
2472
|
+
value: total,
|
|
2473
|
+
formattedValue: defaultTotalFormatted,
|
|
2474
|
+
dataKey: "total",
|
|
2475
|
+
name: "Total"
|
|
2476
|
+
}) : defaultTotalFormatted;
|
|
2477
|
+
return /* @__PURE__ */ jsxs17("div", { className: "text-sm", children: [
|
|
2478
|
+
/* @__PURE__ */ jsx23("div", { className: "text-sm text-muted-foreground", children: "Total" }),
|
|
2479
|
+
/* @__PURE__ */ jsx23(
|
|
2480
|
+
"div",
|
|
2481
|
+
{
|
|
2482
|
+
className: `text-base font-semibold ${total < 0 ? "text-destructive" : "text-foreground"}`,
|
|
2483
|
+
children: displayTotal
|
|
2484
|
+
}
|
|
2485
|
+
)
|
|
2486
|
+
] });
|
|
2487
|
+
});
|
|
2482
2488
|
const [localPos, setLocalPos] = useState5(position);
|
|
2483
2489
|
const [dragging, setDragging] = useState5(false);
|
|
2484
2490
|
const offsetRef = useRef2({ x: 0, y: 0 });
|
|
@@ -2860,7 +2866,14 @@ var DraggableTooltipComponent = ({
|
|
|
2860
2866
|
/* @__PURE__ */ jsx23("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: periodLabel }),
|
|
2861
2867
|
/* @__PURE__ */ jsx23("p", { className: "font-bold text-lg text-foreground mt-1 truncate", children: data.name })
|
|
2862
2868
|
] }),
|
|
2863
|
-
/* @__PURE__ */ jsx23("div", { className: "text-right", children: /* @__PURE__ */ jsx23(
|
|
2869
|
+
/* @__PURE__ */ jsx23("div", { className: "text-right", children: /* @__PURE__ */ jsx23(
|
|
2870
|
+
TotalDisplay,
|
|
2871
|
+
{
|
|
2872
|
+
data,
|
|
2873
|
+
visibleKeys,
|
|
2874
|
+
valueFormatter: valueFormatter2
|
|
2875
|
+
}
|
|
2876
|
+
) })
|
|
2864
2877
|
] }) }),
|
|
2865
2878
|
/* @__PURE__ */ jsxs17("div", { className: "p-3 pt-2 space-y-2", children: [
|
|
2866
2879
|
/* @__PURE__ */ jsx23("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2", children: dataLabel }),
|
|
@@ -2876,6 +2889,13 @@ var DraggableTooltipComponent = ({
|
|
|
2876
2889
|
0
|
|
2877
2890
|
);
|
|
2878
2891
|
const val = typeof value === "number" ? value : Number(value) || 0;
|
|
2892
|
+
const defaultFormatted = val.toLocaleString("pt-BR");
|
|
2893
|
+
const displayValue = valueFormatter2 ? valueFormatter2({
|
|
2894
|
+
value,
|
|
2895
|
+
formattedValue: defaultFormatted,
|
|
2896
|
+
dataKey: key,
|
|
2897
|
+
name: key.charAt(0).toUpperCase() + key.slice(1)
|
|
2898
|
+
}) : defaultFormatted;
|
|
2879
2899
|
const pct = absDenominator > 0 ? Math.abs(val) / absDenominator * 100 : 0;
|
|
2880
2900
|
const isDimmed = highlightedSeries && highlightedSeries.size > 0 && !highlightedSeries.has(key);
|
|
2881
2901
|
const isHighlighted = highlightedSeries && highlightedSeries.has(key);
|
|
@@ -2921,7 +2941,7 @@ var DraggableTooltipComponent = ({
|
|
|
2921
2941
|
"span",
|
|
2922
2942
|
{
|
|
2923
2943
|
className: `font-semibold tabular-nums ${val < 0 ? "text-destructive" : "text-foreground"}`,
|
|
2924
|
-
children:
|
|
2944
|
+
children: displayValue
|
|
2925
2945
|
}
|
|
2926
2946
|
),
|
|
2927
2947
|
/* @__PURE__ */ jsx23("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
|
|
@@ -2950,7 +2970,8 @@ var DraggableTooltipComponent = ({
|
|
|
2950
2970
|
dataKeys,
|
|
2951
2971
|
highlightedSeries,
|
|
2952
2972
|
toggleHighlight,
|
|
2953
|
-
finalColors
|
|
2973
|
+
finalColors,
|
|
2974
|
+
valueFormatter2
|
|
2954
2975
|
]
|
|
2955
2976
|
),
|
|
2956
2977
|
/* @__PURE__ */ jsx23("div", { className: "mt-3 pt-2 border-t", children: /* @__PURE__ */ jsxs17("p", { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
|
|
@@ -2986,7 +3007,8 @@ var RechartTooltipWithTotal = ({
|
|
|
2986
3007
|
label,
|
|
2987
3008
|
finalColors = {},
|
|
2988
3009
|
periodLabel = "Per\xEDodo",
|
|
2989
|
-
totalLabel = "Total"
|
|
3010
|
+
totalLabel = "Total",
|
|
3011
|
+
valueFormatter: valueFormatter2
|
|
2990
3012
|
}) => {
|
|
2991
3013
|
if (!active || !payload || payload.length === 0) return null;
|
|
2992
3014
|
const numeric = payload.filter(
|
|
@@ -2994,6 +3016,13 @@ var RechartTooltipWithTotal = ({
|
|
|
2994
3016
|
);
|
|
2995
3017
|
const total = numeric.reduce((sum, p) => sum + (p.value || 0), 0);
|
|
2996
3018
|
const isTotalNegative = total < 0;
|
|
3019
|
+
const defaultTotalFormatted = total.toLocaleString("pt-BR");
|
|
3020
|
+
const displayTotal = valueFormatter2 ? valueFormatter2({
|
|
3021
|
+
value: total,
|
|
3022
|
+
formattedValue: defaultTotalFormatted,
|
|
3023
|
+
dataKey: "total",
|
|
3024
|
+
name: "Total"
|
|
3025
|
+
}) : defaultTotalFormatted;
|
|
2997
3026
|
const absDenominator = numeric.reduce(
|
|
2998
3027
|
(sum, p) => sum + Math.abs(typeof p.value === "number" ? p.value : 0),
|
|
2999
3028
|
0
|
|
@@ -3017,7 +3046,7 @@ var RechartTooltipWithTotal = ({
|
|
|
3017
3046
|
"p",
|
|
3018
3047
|
{
|
|
3019
3048
|
className: `text-sm font-semibold ${isTotalNegative ? "text-rose-500" : "text-foreground"}`,
|
|
3020
|
-
children:
|
|
3049
|
+
children: displayTotal
|
|
3021
3050
|
}
|
|
3022
3051
|
)
|
|
3023
3052
|
] })
|
|
@@ -3027,6 +3056,13 @@ var RechartTooltipWithTotal = ({
|
|
|
3027
3056
|
const pct = absDenominator > 0 ? Math.abs(value) / absDenominator * 100 : 0;
|
|
3028
3057
|
const baseColor = finalColors[entry.dataKey] || entry.color || "#999";
|
|
3029
3058
|
const isNeg = value < 0;
|
|
3059
|
+
const defaultFormatted = value.toLocaleString("pt-BR");
|
|
3060
|
+
const displayValue = valueFormatter2 ? valueFormatter2({
|
|
3061
|
+
value: entry.value,
|
|
3062
|
+
formattedValue: defaultFormatted,
|
|
3063
|
+
dataKey: entry.dataKey,
|
|
3064
|
+
name: entry.name
|
|
3065
|
+
}) : defaultFormatted;
|
|
3030
3066
|
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
|
|
3031
3067
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between text-sm", children: [
|
|
3032
3068
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 truncate", children: [
|
|
@@ -3045,7 +3081,7 @@ var RechartTooltipWithTotal = ({
|
|
|
3045
3081
|
"span",
|
|
3046
3082
|
{
|
|
3047
3083
|
className: `${isNeg ? "text-rose-500" : "text-foreground"} font-medium`,
|
|
3048
|
-
children:
|
|
3084
|
+
children: displayValue
|
|
3049
3085
|
}
|
|
3050
3086
|
),
|
|
3051
3087
|
/* @__PURE__ */ jsx24("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
|
|
@@ -3076,7 +3112,8 @@ var TooltipSimple = ({
|
|
|
3076
3112
|
payload,
|
|
3077
3113
|
label,
|
|
3078
3114
|
finalColors = {},
|
|
3079
|
-
periodLabel = "Per\xEDodo"
|
|
3115
|
+
periodLabel = "Per\xEDodo",
|
|
3116
|
+
valueFormatter: valueFormatter2
|
|
3080
3117
|
}) => {
|
|
3081
3118
|
if (!active || !payload || payload.length === 0) return null;
|
|
3082
3119
|
return /* @__PURE__ */ jsxs19(
|
|
@@ -3094,6 +3131,13 @@ var TooltipSimple = ({
|
|
|
3094
3131
|
/* @__PURE__ */ jsx25("div", { className: "divide-y divide-border rounded-md overflow-hidden", children: payload.map((entry, index) => {
|
|
3095
3132
|
const value = typeof entry.value === "number" ? entry.value : 0;
|
|
3096
3133
|
const color = finalColors[entry.dataKey] || entry.color || "#999";
|
|
3134
|
+
const defaultFormatted = value.toLocaleString("pt-BR");
|
|
3135
|
+
const displayValue = valueFormatter2 ? valueFormatter2({
|
|
3136
|
+
value: entry.value,
|
|
3137
|
+
formattedValue: defaultFormatted,
|
|
3138
|
+
dataKey: entry.dataKey,
|
|
3139
|
+
name: entry.name
|
|
3140
|
+
}) : defaultFormatted;
|
|
3097
3141
|
return /* @__PURE__ */ jsxs19(
|
|
3098
3142
|
"div",
|
|
3099
3143
|
{
|
|
@@ -3114,7 +3158,7 @@ var TooltipSimple = ({
|
|
|
3114
3158
|
"span",
|
|
3115
3159
|
{
|
|
3116
3160
|
className: `font-medium tabular-nums ${value < 0 ? "text-destructive" : "text-foreground"}`,
|
|
3117
|
-
children:
|
|
3161
|
+
children: displayValue
|
|
3118
3162
|
}
|
|
3119
3163
|
) })
|
|
3120
3164
|
]
|
|
@@ -3151,10 +3195,15 @@ var parseNumber = (v) => {
|
|
|
3151
3195
|
return Number(v);
|
|
3152
3196
|
return void 0;
|
|
3153
3197
|
};
|
|
3154
|
-
var renderPillLabel = (color, variant) => {
|
|
3198
|
+
var renderPillLabel = (color, variant, valueFormatter2) => {
|
|
3155
3199
|
return (props) => {
|
|
3156
3200
|
const { x, y, value } = props;
|
|
3157
|
-
const
|
|
3201
|
+
const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
|
|
3202
|
+
const text = valueFormatter2 ? valueFormatter2({
|
|
3203
|
+
value,
|
|
3204
|
+
formattedValue: defaultFormatted,
|
|
3205
|
+
...props
|
|
3206
|
+
}) : defaultFormatted;
|
|
3158
3207
|
const paddingX = 8;
|
|
3159
3208
|
const approxCharWidth = 7;
|
|
3160
3209
|
const pillWidth = Math.max(
|
|
@@ -3262,6 +3311,7 @@ var Chart = ({
|
|
|
3262
3311
|
showLabels = false,
|
|
3263
3312
|
xAxis,
|
|
3264
3313
|
labelMap,
|
|
3314
|
+
valueFormatter: valueFormatter2,
|
|
3265
3315
|
enableHighlights = false,
|
|
3266
3316
|
enableShowOnly = false,
|
|
3267
3317
|
enablePeriodsDropdown = false,
|
|
@@ -3279,7 +3329,7 @@ var Chart = ({
|
|
|
3279
3329
|
} : {
|
|
3280
3330
|
dataKey: resolvedXAxisKey,
|
|
3281
3331
|
label: xAxis?.label ?? formatFieldName(resolvedXAxisKey),
|
|
3282
|
-
|
|
3332
|
+
valueFormatter: xAxis?.valueFormatter,
|
|
3283
3333
|
autoLabel: xAxis?.autoLabel ?? true
|
|
3284
3334
|
};
|
|
3285
3335
|
const detectedFields = detectDataFields(data, xAxisConfig2.dataKey);
|
|
@@ -3731,7 +3781,7 @@ var Chart = ({
|
|
|
3731
3781
|
fontSize: 12,
|
|
3732
3782
|
tickLine: false,
|
|
3733
3783
|
axisLine: false,
|
|
3734
|
-
tickFormatter: xAxisConfig.
|
|
3784
|
+
tickFormatter: xAxisConfig.valueFormatter
|
|
3735
3785
|
}
|
|
3736
3786
|
),
|
|
3737
3787
|
/* @__PURE__ */ jsx27(
|
|
@@ -3758,7 +3808,19 @@ var Chart = ({
|
|
|
3758
3808
|
showTooltip && /* @__PURE__ */ jsx27(
|
|
3759
3809
|
Tooltip,
|
|
3760
3810
|
{
|
|
3761
|
-
content: showTooltipTotal ? /* @__PURE__ */ jsx27(
|
|
3811
|
+
content: showTooltipTotal ? /* @__PURE__ */ jsx27(
|
|
3812
|
+
TooltipWithTotal_default,
|
|
3813
|
+
{
|
|
3814
|
+
finalColors,
|
|
3815
|
+
valueFormatter: valueFormatter2
|
|
3816
|
+
}
|
|
3817
|
+
) : /* @__PURE__ */ jsx27(
|
|
3818
|
+
TooltipSimple_default,
|
|
3819
|
+
{
|
|
3820
|
+
finalColors,
|
|
3821
|
+
valueFormatter: valueFormatter2
|
|
3822
|
+
}
|
|
3823
|
+
),
|
|
3762
3824
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
3763
3825
|
}
|
|
3764
3826
|
),
|
|
@@ -3804,7 +3866,11 @@ var Chart = ({
|
|
|
3804
3866
|
{
|
|
3805
3867
|
dataKey: key,
|
|
3806
3868
|
position: "top",
|
|
3807
|
-
content: pillLabelRenderer_default(
|
|
3869
|
+
content: pillLabelRenderer_default(
|
|
3870
|
+
color,
|
|
3871
|
+
"filled",
|
|
3872
|
+
valueFormatter2
|
|
3873
|
+
),
|
|
3808
3874
|
offset: 8
|
|
3809
3875
|
}
|
|
3810
3876
|
) : null
|
|
@@ -3833,7 +3899,11 @@ var Chart = ({
|
|
|
3833
3899
|
{
|
|
3834
3900
|
dataKey: key,
|
|
3835
3901
|
position: "top",
|
|
3836
|
-
content: pillLabelRenderer_default(
|
|
3902
|
+
content: pillLabelRenderer_default(
|
|
3903
|
+
color,
|
|
3904
|
+
"filled",
|
|
3905
|
+
valueFormatter2
|
|
3906
|
+
),
|
|
3837
3907
|
offset: 14
|
|
3838
3908
|
}
|
|
3839
3909
|
) : null
|
|
@@ -3862,7 +3932,11 @@ var Chart = ({
|
|
|
3862
3932
|
{
|
|
3863
3933
|
dataKey: key,
|
|
3864
3934
|
position: "top",
|
|
3865
|
-
content: pillLabelRenderer_default(
|
|
3935
|
+
content: pillLabelRenderer_default(
|
|
3936
|
+
color,
|
|
3937
|
+
"soft",
|
|
3938
|
+
valueFormatter2
|
|
3939
|
+
),
|
|
3866
3940
|
offset: 12
|
|
3867
3941
|
}
|
|
3868
3942
|
) : null
|
|
@@ -3891,6 +3965,7 @@ var Chart = ({
|
|
|
3891
3965
|
onPositionChange: onTooltipPositionChange,
|
|
3892
3966
|
periodLabel: "Per\xEDodo Selecionado",
|
|
3893
3967
|
dataLabel: "Dados do Per\xEDodo",
|
|
3968
|
+
valueFormatter: valueFormatter2,
|
|
3894
3969
|
globalTooltipCount: activeTooltips.length,
|
|
3895
3970
|
onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
|
|
3896
3971
|
closeAllButtonPosition: "top-center",
|
|
@@ -4416,7 +4491,7 @@ var BarChart = ({
|
|
|
4416
4491
|
fontSize: 12,
|
|
4417
4492
|
tickLine: false,
|
|
4418
4493
|
axisLine: false,
|
|
4419
|
-
tickFormatter: xAxisConfig.
|
|
4494
|
+
tickFormatter: xAxisConfig.valueFormatter
|
|
4420
4495
|
}
|
|
4421
4496
|
),
|
|
4422
4497
|
/* @__PURE__ */ jsx28(
|
|
@@ -9879,13 +9954,1155 @@ var UniversalTooltipRenderer = ({
|
|
|
9879
9954
|
] });
|
|
9880
9955
|
};
|
|
9881
9956
|
|
|
9957
|
+
// src/components/picker/DateTimePicker.tsx
|
|
9958
|
+
import { add, format } from "date-fns";
|
|
9959
|
+
|
|
9960
|
+
// src/components/picker/calendar.tsx
|
|
9961
|
+
import * as React39 from "react";
|
|
9962
|
+
import { DayPicker as DayPicker2 } from "react-day-picker";
|
|
9963
|
+
import {
|
|
9964
|
+
CaretLeftIcon as CaretLeftIcon2,
|
|
9965
|
+
CaretRightIcon as CaretRightIcon4,
|
|
9966
|
+
XIcon as XIcon10,
|
|
9967
|
+
CalendarIcon
|
|
9968
|
+
} from "@phosphor-icons/react";
|
|
9969
|
+
import { AnimatePresence as AnimatePresence9 } from "framer-motion";
|
|
9970
|
+
import { jsx as jsx63, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
9971
|
+
function CalendarBase2({
|
|
9972
|
+
className,
|
|
9973
|
+
classNames,
|
|
9974
|
+
showOutsideDays = true,
|
|
9975
|
+
...props
|
|
9976
|
+
}) {
|
|
9977
|
+
const [month, setMonth] = React39.useState(
|
|
9978
|
+
props.month || props.defaultMonth || /* @__PURE__ */ new Date()
|
|
9979
|
+
);
|
|
9980
|
+
const [direction, setDirection] = React39.useState(1);
|
|
9981
|
+
const handleMonthChange = (newMonth) => {
|
|
9982
|
+
const isNext = newMonth > month ? 1 : -1;
|
|
9983
|
+
setDirection(isNext);
|
|
9984
|
+
setMonth(newMonth);
|
|
9985
|
+
props.onMonthChange?.(newMonth);
|
|
9986
|
+
};
|
|
9987
|
+
return /* @__PURE__ */ jsx63(
|
|
9988
|
+
"div",
|
|
9989
|
+
{
|
|
9990
|
+
className: cn(
|
|
9991
|
+
"rounded-md border bg-background p-2 overflow-hidden flex flex-col",
|
|
9992
|
+
className
|
|
9993
|
+
),
|
|
9994
|
+
children: /* @__PURE__ */ jsx63("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsx63(AnimatePresence9, { initial: false, mode: "wait", custom: direction, children: /* @__PURE__ */ jsx63(
|
|
9995
|
+
"div",
|
|
9996
|
+
{
|
|
9997
|
+
className: "w-full h-full flex flex-col",
|
|
9998
|
+
children: /* @__PURE__ */ jsx63(
|
|
9999
|
+
DayPicker2,
|
|
10000
|
+
{
|
|
10001
|
+
showOutsideDays,
|
|
10002
|
+
month,
|
|
10003
|
+
onMonthChange: handleMonthChange,
|
|
10004
|
+
className: "w-full h-full min-w-0 flex flex-col",
|
|
10005
|
+
classNames: {
|
|
10006
|
+
months: "flex items-center flex-col sm:flex-row space-y-2 sm:space-x-2 sm:space-y-0 flex-1",
|
|
10007
|
+
month: "space-y-2 min-w-0 flex-1 flex flex-col",
|
|
10008
|
+
caption: "flex justify-center pt-1 relative items-center h-[10%] min-h-[2rem] mb-2",
|
|
10009
|
+
caption_label: "text-[clamp(0.875rem,2.5vw,1.25rem)] font-semibold truncate px-10 tracking-tight",
|
|
10010
|
+
nav: "space-x-1 flex items-center",
|
|
10011
|
+
nav_button: cn(
|
|
10012
|
+
buttonVariantsBase({ variant: "outline" }),
|
|
10013
|
+
"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",
|
|
10014
|
+
"[@media(min-width:400px)]:h-9 [@media(min-width:400px)]:w-9"
|
|
10015
|
+
),
|
|
10016
|
+
nav_button_previous: "absolute left-0",
|
|
10017
|
+
nav_button_next: "absolute right-0",
|
|
10018
|
+
table: "w-full border-collapse min-w-0 flex-1 flex flex-col",
|
|
10019
|
+
head_row: "flex w-full gap-1 mb-1",
|
|
10020
|
+
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",
|
|
10021
|
+
row: "flex w-full flex-1 gap-1",
|
|
10022
|
+
cell: cn(
|
|
10023
|
+
"flex-1 min-w-0 aspect-square text-center p-0 relative",
|
|
10024
|
+
"[&:has([aria-selected].day-range-end)]:rounded-r-lg",
|
|
10025
|
+
"[&:has([aria-selected].day-range-start)]:rounded-l-lg",
|
|
10026
|
+
"[&:has([aria-selected].day-outside)]:bg-muted/50",
|
|
10027
|
+
"[&:has([aria-selected])]:bg-muted",
|
|
10028
|
+
"first:[&:has([aria-selected])]:rounded-l-lg",
|
|
10029
|
+
"last:[&:has([aria-selected])]:rounded-r-lg",
|
|
10030
|
+
"focus-within:relative focus-within:z-20"
|
|
10031
|
+
),
|
|
10032
|
+
day: cn(
|
|
10033
|
+
buttonVariantsBase({ variant: "ghost" }),
|
|
10034
|
+
"w-full h-full p-0",
|
|
10035
|
+
"aria-selected:opacity-100 hover:bg-muted flex items-center justify-center",
|
|
10036
|
+
" transition-all duration-200 ease-out hover:scale-105 active:scale-95"
|
|
10037
|
+
),
|
|
10038
|
+
day_selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white",
|
|
10039
|
+
day_today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset",
|
|
10040
|
+
day_outside: "day-outside text-muted-foreground/40 opacity-40 aria-selected:bg-muted/50 aria-selected:text-foreground",
|
|
10041
|
+
day_disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
|
|
10042
|
+
day_range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
|
|
10043
|
+
day_hidden: "invisible",
|
|
10044
|
+
...classNames
|
|
10045
|
+
},
|
|
10046
|
+
components: {
|
|
10047
|
+
IconLeft: () => /* @__PURE__ */ jsx63(CaretLeftIcon2, { className: "h-4 w-4" }),
|
|
10048
|
+
IconRight: () => /* @__PURE__ */ jsx63(CaretRightIcon4, { className: "h-4 w-4" })
|
|
10049
|
+
},
|
|
10050
|
+
...props
|
|
10051
|
+
}
|
|
10052
|
+
)
|
|
10053
|
+
},
|
|
10054
|
+
month.toISOString()
|
|
10055
|
+
) }) })
|
|
10056
|
+
}
|
|
10057
|
+
);
|
|
10058
|
+
}
|
|
10059
|
+
CalendarBase2.displayName = "CalendarBase";
|
|
10060
|
+
|
|
10061
|
+
// src/components/picker/DateTimePicker.tsx
|
|
10062
|
+
import { ptBR } from "date-fns/locale";
|
|
10063
|
+
import { useEffect as useEffect16, useState as useState18 } from "react";
|
|
10064
|
+
|
|
10065
|
+
// src/components/picker/TimePicker.tsx
|
|
10066
|
+
import { motion as motion14, AnimatePresence as AnimatePresence10 } from "framer-motion";
|
|
10067
|
+
import * as React41 from "react";
|
|
10068
|
+
|
|
10069
|
+
// src/components/picker/TimePickerInput.tsx
|
|
10070
|
+
import { CaretUpIcon as CaretUpIcon2, CaretDownIcon as CaretDownIcon4 } from "@phosphor-icons/react";
|
|
10071
|
+
import React40 from "react";
|
|
10072
|
+
|
|
10073
|
+
// src/components/picker/utils/time-picker-utils.ts
|
|
10074
|
+
function isValidHour(value) {
|
|
10075
|
+
return /^(0[0-9]|1[0-9]|2[0-3])$/.test(value);
|
|
10076
|
+
}
|
|
10077
|
+
function isValid12Hour(value) {
|
|
10078
|
+
return /^(0[1-9]|1[0-2])$/.test(value);
|
|
10079
|
+
}
|
|
10080
|
+
function isValidMinuteOrSecond(value) {
|
|
10081
|
+
return /^[0-5][0-9]$/.test(value);
|
|
10082
|
+
}
|
|
10083
|
+
function getValidNumber(value, { max, min = 0, loop = false }) {
|
|
10084
|
+
let numericValue = parseInt(value, 10);
|
|
10085
|
+
if (!isNaN(numericValue)) {
|
|
10086
|
+
if (!loop) {
|
|
10087
|
+
if (numericValue > max) numericValue = max;
|
|
10088
|
+
if (numericValue < min) numericValue = min;
|
|
10089
|
+
} else {
|
|
10090
|
+
if (numericValue > max) numericValue = min;
|
|
10091
|
+
if (numericValue < min) numericValue = max;
|
|
10092
|
+
}
|
|
10093
|
+
return numericValue.toString().padStart(2, "0");
|
|
10094
|
+
}
|
|
10095
|
+
return "00";
|
|
10096
|
+
}
|
|
10097
|
+
function getValidHour(value) {
|
|
10098
|
+
if (isValidHour(value)) return value;
|
|
10099
|
+
return getValidNumber(value, { max: 23 });
|
|
10100
|
+
}
|
|
10101
|
+
function getValid12Hour(value) {
|
|
10102
|
+
if (isValid12Hour(value)) return value;
|
|
10103
|
+
return getValidNumber(value, { min: 1, max: 12 });
|
|
10104
|
+
}
|
|
10105
|
+
function getValidMinuteOrSecond(value) {
|
|
10106
|
+
if (isValidMinuteOrSecond(value)) return value;
|
|
10107
|
+
return getValidNumber(value, { max: 59 });
|
|
10108
|
+
}
|
|
10109
|
+
function getValidArrowNumber(value, { min, max, step }) {
|
|
10110
|
+
let numericValue = parseInt(value, 10);
|
|
10111
|
+
if (!isNaN(numericValue)) {
|
|
10112
|
+
numericValue += step;
|
|
10113
|
+
return getValidNumber(String(numericValue), { min, max, loop: true });
|
|
10114
|
+
}
|
|
10115
|
+
return "00";
|
|
10116
|
+
}
|
|
10117
|
+
function getValidArrowHour(value, step) {
|
|
10118
|
+
return getValidArrowNumber(value, { min: 0, max: 23, step });
|
|
10119
|
+
}
|
|
10120
|
+
function getValidArrow12Hour(value, step) {
|
|
10121
|
+
return getValidArrowNumber(value, { min: 1, max: 12, step });
|
|
10122
|
+
}
|
|
10123
|
+
function getValidArrowMinuteOrSecond(value, step) {
|
|
10124
|
+
return getValidArrowNumber(value, { min: 0, max: 59, step });
|
|
10125
|
+
}
|
|
10126
|
+
function setMinutes(date, value) {
|
|
10127
|
+
const minutes = getValidMinuteOrSecond(value);
|
|
10128
|
+
date.setMinutes(parseInt(minutes, 10));
|
|
10129
|
+
return date;
|
|
10130
|
+
}
|
|
10131
|
+
function setSeconds(date, value) {
|
|
10132
|
+
const seconds = getValidMinuteOrSecond(value);
|
|
10133
|
+
date.setSeconds(parseInt(seconds, 10));
|
|
10134
|
+
return date;
|
|
10135
|
+
}
|
|
10136
|
+
function setHours(date, value) {
|
|
10137
|
+
const hours = getValidHour(value);
|
|
10138
|
+
date.setHours(parseInt(hours, 10));
|
|
10139
|
+
return date;
|
|
10140
|
+
}
|
|
10141
|
+
function set12Hours(date, value, period) {
|
|
10142
|
+
const hours = parseInt(getValid12Hour(value), 10);
|
|
10143
|
+
const convertedHours = convert12HourTo24Hour(hours, period);
|
|
10144
|
+
date.setHours(convertedHours);
|
|
10145
|
+
return date;
|
|
10146
|
+
}
|
|
10147
|
+
function setDateByType(date, value, type, period) {
|
|
10148
|
+
switch (type) {
|
|
10149
|
+
case "minutes":
|
|
10150
|
+
return setMinutes(date, value);
|
|
10151
|
+
case "seconds":
|
|
10152
|
+
return setSeconds(date, value);
|
|
10153
|
+
case "hours":
|
|
10154
|
+
return setHours(date, value);
|
|
10155
|
+
case "12hours": {
|
|
10156
|
+
if (!period) return date;
|
|
10157
|
+
return set12Hours(date, value, period);
|
|
10158
|
+
}
|
|
10159
|
+
default:
|
|
10160
|
+
return date;
|
|
10161
|
+
}
|
|
10162
|
+
}
|
|
10163
|
+
function getDateByType(date, type) {
|
|
10164
|
+
switch (type) {
|
|
10165
|
+
case "minutes":
|
|
10166
|
+
return getValidMinuteOrSecond(String(date.getMinutes()));
|
|
10167
|
+
case "seconds":
|
|
10168
|
+
return getValidMinuteOrSecond(String(date.getSeconds()));
|
|
10169
|
+
case "hours":
|
|
10170
|
+
return getValidHour(String(date.getHours()));
|
|
10171
|
+
case "12hours":
|
|
10172
|
+
const hours = display12HourValue(date.getHours());
|
|
10173
|
+
return getValid12Hour(String(hours));
|
|
10174
|
+
default:
|
|
10175
|
+
return "00";
|
|
10176
|
+
}
|
|
10177
|
+
}
|
|
10178
|
+
function getArrowByType(value, step, type) {
|
|
10179
|
+
switch (type) {
|
|
10180
|
+
case "minutes":
|
|
10181
|
+
return getValidArrowMinuteOrSecond(value, step);
|
|
10182
|
+
case "seconds":
|
|
10183
|
+
return getValidArrowMinuteOrSecond(value, step);
|
|
10184
|
+
case "hours":
|
|
10185
|
+
return getValidArrowHour(value, step);
|
|
10186
|
+
case "12hours":
|
|
10187
|
+
return getValidArrow12Hour(value, step);
|
|
10188
|
+
default:
|
|
10189
|
+
return "00";
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10192
|
+
function convert12HourTo24Hour(hour, period) {
|
|
10193
|
+
if (period === "PM") {
|
|
10194
|
+
if (hour <= 11) {
|
|
10195
|
+
return hour + 12;
|
|
10196
|
+
} else {
|
|
10197
|
+
return hour;
|
|
10198
|
+
}
|
|
10199
|
+
} else if (period === "AM") {
|
|
10200
|
+
if (hour === 12) return 0;
|
|
10201
|
+
return hour;
|
|
10202
|
+
}
|
|
10203
|
+
return hour;
|
|
10204
|
+
}
|
|
10205
|
+
function display12HourValue(hours) {
|
|
10206
|
+
if (hours === 0 || hours === 12) return "12";
|
|
10207
|
+
if (hours >= 22) return `${hours - 12}`;
|
|
10208
|
+
if (hours % 12 > 9) return `${hours}`;
|
|
10209
|
+
return `0${hours % 12}`;
|
|
10210
|
+
}
|
|
10211
|
+
|
|
10212
|
+
// src/components/picker/TimePickerInput.tsx
|
|
10213
|
+
import { jsx as jsx64, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10214
|
+
var TimePickerInput = React40.forwardRef(
|
|
10215
|
+
({
|
|
10216
|
+
className,
|
|
10217
|
+
type = "tel",
|
|
10218
|
+
value,
|
|
10219
|
+
id,
|
|
10220
|
+
name,
|
|
10221
|
+
date = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)),
|
|
10222
|
+
setDate,
|
|
10223
|
+
onChange,
|
|
10224
|
+
onKeyDown,
|
|
10225
|
+
picker,
|
|
10226
|
+
period,
|
|
10227
|
+
onLeftFocus,
|
|
10228
|
+
onRightFocus,
|
|
10229
|
+
showArrows = true,
|
|
10230
|
+
label,
|
|
10231
|
+
...props
|
|
10232
|
+
}, ref) => {
|
|
10233
|
+
const [flag, setFlag] = React40.useState(false);
|
|
10234
|
+
const [prevIntKey, setPrevIntKey] = React40.useState("0");
|
|
10235
|
+
const [isFocused, setIsFocused] = React40.useState(false);
|
|
10236
|
+
React40.useEffect(() => {
|
|
10237
|
+
if (flag) {
|
|
10238
|
+
const timer = setTimeout(() => {
|
|
10239
|
+
setFlag(false);
|
|
10240
|
+
}, 2e3);
|
|
10241
|
+
return () => clearTimeout(timer);
|
|
10242
|
+
}
|
|
10243
|
+
}, [flag]);
|
|
10244
|
+
const calculatedValue = React40.useMemo(() => {
|
|
10245
|
+
return getDateByType(date, picker);
|
|
10246
|
+
}, [date, picker]);
|
|
10247
|
+
const calculateNewValue = (key) => {
|
|
10248
|
+
if (picker === "12hours") {
|
|
10249
|
+
if (flag && calculatedValue.slice(1, 2) === "1" && prevIntKey === "0")
|
|
10250
|
+
return "0" + key;
|
|
10251
|
+
}
|
|
10252
|
+
return !flag ? "0" + key : calculatedValue.slice(1, 2) + key;
|
|
10253
|
+
};
|
|
10254
|
+
const handleArrowClick = (direction) => {
|
|
10255
|
+
const step = direction === "up" ? 1 : -1;
|
|
10256
|
+
const newValue = getArrowByType(calculatedValue, step, picker);
|
|
10257
|
+
if (flag) setFlag(false);
|
|
10258
|
+
const tempDate = new Date(date);
|
|
10259
|
+
setDate(setDateByType(tempDate, newValue, picker, period));
|
|
10260
|
+
};
|
|
10261
|
+
const handleKeyDown = (e) => {
|
|
10262
|
+
if (e.key === "Tab") return;
|
|
10263
|
+
e.preventDefault();
|
|
10264
|
+
if (e.key === "ArrowRight") onRightFocus?.();
|
|
10265
|
+
if (e.key === "ArrowLeft") onLeftFocus?.();
|
|
10266
|
+
if (["ArrowUp", "ArrowDown"].includes(e.key)) {
|
|
10267
|
+
const step = e.key === "ArrowUp" ? 1 : -1;
|
|
10268
|
+
const newValue = getArrowByType(calculatedValue, step, picker);
|
|
10269
|
+
if (flag) setFlag(false);
|
|
10270
|
+
const tempDate = new Date(date);
|
|
10271
|
+
setDate(setDateByType(tempDate, newValue, picker, period));
|
|
10272
|
+
}
|
|
10273
|
+
if (e.key >= "0" && e.key <= "9") {
|
|
10274
|
+
if (picker === "12hours") setPrevIntKey(e.key);
|
|
10275
|
+
const newValue = calculateNewValue(e.key);
|
|
10276
|
+
if (flag) onRightFocus?.();
|
|
10277
|
+
setFlag((prev) => !prev);
|
|
10278
|
+
const tempDate = new Date(date);
|
|
10279
|
+
setDate(setDateByType(tempDate, newValue, picker, period));
|
|
10280
|
+
}
|
|
10281
|
+
};
|
|
10282
|
+
const getPickerLabel = () => {
|
|
10283
|
+
if (label) return label;
|
|
10284
|
+
switch (picker) {
|
|
10285
|
+
case "hours":
|
|
10286
|
+
case "12hours":
|
|
10287
|
+
return "Horas";
|
|
10288
|
+
case "minutes":
|
|
10289
|
+
return "Minutos";
|
|
10290
|
+
case "seconds":
|
|
10291
|
+
return "Segundos";
|
|
10292
|
+
default:
|
|
10293
|
+
return "";
|
|
10294
|
+
}
|
|
10295
|
+
};
|
|
10296
|
+
const getAriaLabel = () => {
|
|
10297
|
+
const baseLabel = getPickerLabel();
|
|
10298
|
+
return `${baseLabel}, valor atual: ${calculatedValue}.`;
|
|
10299
|
+
};
|
|
10300
|
+
return /* @__PURE__ */ jsxs43("div", { className: "relative group flex flex-col items-center", children: [
|
|
10301
|
+
getPickerLabel() && /* @__PURE__ */ jsx64(
|
|
10302
|
+
"label",
|
|
10303
|
+
{
|
|
10304
|
+
htmlFor: id || picker,
|
|
10305
|
+
className: "text-xs sm:text-sm font-medium text-muted-foreground mb-1 sm:mb-2 select-none",
|
|
10306
|
+
children: getPickerLabel()
|
|
10307
|
+
}
|
|
10308
|
+
),
|
|
10309
|
+
/* @__PURE__ */ jsxs43(
|
|
10310
|
+
"div",
|
|
10311
|
+
{
|
|
10312
|
+
className: cn(
|
|
10313
|
+
"relative flex flex-col items-center",
|
|
10314
|
+
"transition-all duration-200"
|
|
10315
|
+
),
|
|
10316
|
+
children: [
|
|
10317
|
+
showArrows && /* @__PURE__ */ jsx64(
|
|
10318
|
+
"button",
|
|
10319
|
+
{
|
|
10320
|
+
type: "button",
|
|
10321
|
+
onClick: () => handleArrowClick("up"),
|
|
10322
|
+
className: cn(
|
|
10323
|
+
"flex items-center justify-center w-10 sm:w-12 h-5 sm:h-6 mb-1",
|
|
10324
|
+
"rounded-t",
|
|
10325
|
+
"bg-background hover:bg-accent active:bg-accent/80 transition-colors",
|
|
10326
|
+
"text-muted-foreground hover:text-foreground",
|
|
10327
|
+
"focus:outline-none focus:ring-1 focus:ring-ring",
|
|
10328
|
+
"touch-manipulation",
|
|
10329
|
+
isFocused && "border-ring"
|
|
10330
|
+
),
|
|
10331
|
+
tabIndex: -1,
|
|
10332
|
+
"aria-label": `Incrementar ${getPickerLabel().toLowerCase()}`,
|
|
10333
|
+
children: /* @__PURE__ */ jsx64(CaretUpIcon2, { size: 14, className: "sm:w-4 sm:h-4" })
|
|
10334
|
+
}
|
|
10335
|
+
),
|
|
10336
|
+
/* @__PURE__ */ jsxs43("div", { className: "relative", children: [
|
|
10337
|
+
/* @__PURE__ */ jsx64(
|
|
10338
|
+
"input",
|
|
10339
|
+
{
|
|
10340
|
+
ref,
|
|
10341
|
+
id: id || picker,
|
|
10342
|
+
name: name || picker,
|
|
10343
|
+
className: cn(
|
|
10344
|
+
"w-16 sm:w-20 h-10 sm:h-12 text-center font-mono text-lg sm:text-xl font-semibold",
|
|
10345
|
+
"border-2 rounded-lg",
|
|
10346
|
+
"bg-background text-foreground",
|
|
10347
|
+
"transition-all duration-200",
|
|
10348
|
+
"focus:outline-none focus:ring-2 focus:ring-ring focus:border-ring",
|
|
10349
|
+
"selection:bg-primary selection:text-primary-foreground",
|
|
10350
|
+
"touch-manipulation",
|
|
10351
|
+
showArrows && "rounded-lg",
|
|
10352
|
+
isFocused && "ring-2 ring-ring border-ring shadow-md",
|
|
10353
|
+
className
|
|
10354
|
+
),
|
|
10355
|
+
value: value || calculatedValue,
|
|
10356
|
+
onChange: (e) => {
|
|
10357
|
+
e.preventDefault();
|
|
10358
|
+
onChange?.(e);
|
|
10359
|
+
},
|
|
10360
|
+
onFocus: (e) => {
|
|
10361
|
+
setIsFocused(true);
|
|
10362
|
+
props.onFocus?.(e);
|
|
10363
|
+
e.target.select();
|
|
10364
|
+
},
|
|
10365
|
+
onBlur: (e) => {
|
|
10366
|
+
setIsFocused(false);
|
|
10367
|
+
props.onBlur?.(e);
|
|
10368
|
+
},
|
|
10369
|
+
type,
|
|
10370
|
+
inputMode: "decimal",
|
|
10371
|
+
onKeyDown: (e) => {
|
|
10372
|
+
onKeyDown?.(e);
|
|
10373
|
+
handleKeyDown(e);
|
|
10374
|
+
},
|
|
10375
|
+
"aria-label": getAriaLabel(),
|
|
10376
|
+
"aria-describedby": `${id || picker}-help`,
|
|
10377
|
+
autoComplete: "off",
|
|
10378
|
+
spellCheck: false,
|
|
10379
|
+
...props
|
|
10380
|
+
}
|
|
10381
|
+
),
|
|
10382
|
+
isFocused && /* @__PURE__ */ jsx64("div", { className: "absolute inset-0 rounded-lg ring-2 ring-primary/20 pointer-events-none animate-pulse" })
|
|
10383
|
+
] }),
|
|
10384
|
+
showArrows && /* @__PURE__ */ jsx64(
|
|
10385
|
+
"button",
|
|
10386
|
+
{
|
|
10387
|
+
type: "button",
|
|
10388
|
+
onClick: () => handleArrowClick("down"),
|
|
10389
|
+
className: cn(
|
|
10390
|
+
"flex items-center justify-center w-10 sm:w-12 h-5 sm:h-6 mt-1",
|
|
10391
|
+
"rounded-b",
|
|
10392
|
+
"bg-background hover:bg-accent active:bg-accent/80 transition-colors",
|
|
10393
|
+
"text-muted-foreground hover:text-foreground",
|
|
10394
|
+
"focus:outline-none focus:ring-1 focus:ring-ring",
|
|
10395
|
+
"touch-manipulation",
|
|
10396
|
+
isFocused && "border-ring"
|
|
10397
|
+
),
|
|
10398
|
+
tabIndex: -1,
|
|
10399
|
+
"aria-label": `Decrementar ${getPickerLabel().toLowerCase()}`,
|
|
10400
|
+
children: /* @__PURE__ */ jsx64(CaretDownIcon4, { size: 14, className: "sm:w-4 sm:h-4" })
|
|
10401
|
+
}
|
|
10402
|
+
)
|
|
10403
|
+
]
|
|
10404
|
+
}
|
|
10405
|
+
)
|
|
10406
|
+
] });
|
|
10407
|
+
}
|
|
10408
|
+
);
|
|
10409
|
+
TimePickerInput.displayName = "TimePickerInput";
|
|
10410
|
+
|
|
10411
|
+
// src/components/picker/TimePicker.tsx
|
|
10412
|
+
import { Fragment as Fragment8, jsx as jsx65, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10413
|
+
function TimePicker({
|
|
10414
|
+
date,
|
|
10415
|
+
setDate,
|
|
10416
|
+
hideSeconds,
|
|
10417
|
+
enableButton
|
|
10418
|
+
}) {
|
|
10419
|
+
const minuteRef = React41.useRef(null);
|
|
10420
|
+
const hourRef = React41.useRef(null);
|
|
10421
|
+
const secondRef = React41.useRef(null);
|
|
10422
|
+
const containerVariants = {
|
|
10423
|
+
hidden: { opacity: 0, y: 10 },
|
|
10424
|
+
visible: {
|
|
10425
|
+
opacity: 1,
|
|
10426
|
+
y: 0,
|
|
10427
|
+
transition: {
|
|
10428
|
+
duration: 0.3,
|
|
10429
|
+
staggerChildren: 0.1
|
|
10430
|
+
}
|
|
10431
|
+
}
|
|
10432
|
+
};
|
|
10433
|
+
const itemVariants2 = {
|
|
10434
|
+
hidden: { opacity: 0, y: 10 },
|
|
10435
|
+
visible: { opacity: 1, y: 0 }
|
|
10436
|
+
};
|
|
10437
|
+
return /* @__PURE__ */ jsxs44(
|
|
10438
|
+
motion14.div,
|
|
10439
|
+
{
|
|
10440
|
+
variants: containerVariants,
|
|
10441
|
+
initial: "hidden",
|
|
10442
|
+
animate: "visible",
|
|
10443
|
+
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",
|
|
10444
|
+
children: [
|
|
10445
|
+
/* @__PURE__ */ jsx65(
|
|
10446
|
+
motion14.div,
|
|
10447
|
+
{
|
|
10448
|
+
variants: itemVariants2,
|
|
10449
|
+
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
10450
|
+
children: /* @__PURE__ */ jsx65(
|
|
10451
|
+
TimePickerInput,
|
|
10452
|
+
{
|
|
10453
|
+
picker: "hours",
|
|
10454
|
+
date,
|
|
10455
|
+
setDate,
|
|
10456
|
+
ref: hourRef,
|
|
10457
|
+
onRightFocus: () => minuteRef.current?.focus(),
|
|
10458
|
+
enableButton
|
|
10459
|
+
}
|
|
10460
|
+
)
|
|
10461
|
+
}
|
|
10462
|
+
),
|
|
10463
|
+
/* @__PURE__ */ jsx65(
|
|
10464
|
+
motion14.div,
|
|
10465
|
+
{
|
|
10466
|
+
variants: itemVariants2,
|
|
10467
|
+
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
10468
|
+
children: /* @__PURE__ */ jsx65(
|
|
10469
|
+
TimePickerInput,
|
|
10470
|
+
{
|
|
10471
|
+
picker: "minutes",
|
|
10472
|
+
date,
|
|
10473
|
+
setDate,
|
|
10474
|
+
ref: minuteRef,
|
|
10475
|
+
onLeftFocus: () => hourRef.current?.focus(),
|
|
10476
|
+
onRightFocus: () => secondRef.current?.focus(),
|
|
10477
|
+
enableButton
|
|
10478
|
+
}
|
|
10479
|
+
)
|
|
10480
|
+
}
|
|
10481
|
+
),
|
|
10482
|
+
/* @__PURE__ */ jsx65(AnimatePresence10, { children: !hideSeconds && /* @__PURE__ */ jsx65(Fragment8, { children: /* @__PURE__ */ jsx65(
|
|
10483
|
+
motion14.div,
|
|
10484
|
+
{
|
|
10485
|
+
variants: itemVariants2,
|
|
10486
|
+
initial: "hidden",
|
|
10487
|
+
animate: "visible",
|
|
10488
|
+
exit: "hidden",
|
|
10489
|
+
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
10490
|
+
children: /* @__PURE__ */ jsx65(
|
|
10491
|
+
TimePickerInput,
|
|
10492
|
+
{
|
|
10493
|
+
picker: "seconds",
|
|
10494
|
+
date,
|
|
10495
|
+
setDate,
|
|
10496
|
+
ref: secondRef,
|
|
10497
|
+
onLeftFocus: () => minuteRef.current?.focus(),
|
|
10498
|
+
enableButton
|
|
10499
|
+
}
|
|
10500
|
+
)
|
|
10501
|
+
}
|
|
10502
|
+
) }) })
|
|
10503
|
+
]
|
|
10504
|
+
}
|
|
10505
|
+
);
|
|
10506
|
+
}
|
|
10507
|
+
|
|
10508
|
+
// src/components/picker/DateTimePicker.tsx
|
|
10509
|
+
import { CalendarBlankIcon, ClockIcon } from "@phosphor-icons/react";
|
|
10510
|
+
import { jsx as jsx66, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
10511
|
+
function DateTimePicker({
|
|
10512
|
+
label,
|
|
10513
|
+
date,
|
|
10514
|
+
onChange,
|
|
10515
|
+
display,
|
|
10516
|
+
hideSeconds,
|
|
10517
|
+
hideHour,
|
|
10518
|
+
hideMinute,
|
|
10519
|
+
fromDate,
|
|
10520
|
+
toDate,
|
|
10521
|
+
disabled,
|
|
10522
|
+
className,
|
|
10523
|
+
error
|
|
10524
|
+
}) {
|
|
10525
|
+
const [internalDate, setInternalDate] = useState18(date);
|
|
10526
|
+
const [open, setOpen] = useState18(false);
|
|
10527
|
+
const [timePickerOpen, setTimePickerOpen] = useState18(false);
|
|
10528
|
+
const handleSelect = (newDay) => {
|
|
10529
|
+
if (!newDay) return;
|
|
10530
|
+
if (!internalDate) {
|
|
10531
|
+
setInternalDate(newDay);
|
|
10532
|
+
onChange(newDay);
|
|
10533
|
+
return;
|
|
10534
|
+
}
|
|
10535
|
+
const diff = newDay.getTime() - internalDate.getTime();
|
|
10536
|
+
const diffInDays = diff / (1e3 * 60 * 60 * 24);
|
|
10537
|
+
const newDateFull = add(internalDate, { days: Math.ceil(diffInDays) });
|
|
10538
|
+
setInternalDate(newDateFull);
|
|
10539
|
+
onChange(newDateFull);
|
|
10540
|
+
};
|
|
10541
|
+
const handleTimeChange = (newDate) => {
|
|
10542
|
+
setInternalDate(newDate);
|
|
10543
|
+
onChange(newDate);
|
|
10544
|
+
};
|
|
10545
|
+
const getTimeFormat = () => {
|
|
10546
|
+
if (hideHour && hideMinute) return "";
|
|
10547
|
+
if (hideHour) return hideSeconds ? "mm" : "mm:ss";
|
|
10548
|
+
if (hideMinute) return hideSeconds ? "HH" : "HH':00'";
|
|
10549
|
+
return hideSeconds ? "HH:mm" : "HH:mm:ss";
|
|
10550
|
+
};
|
|
10551
|
+
const getDisplayFormat = () => {
|
|
10552
|
+
const timeFormat = getTimeFormat();
|
|
10553
|
+
if (!timeFormat) return "PPP";
|
|
10554
|
+
return `PPP - ${timeFormat}`;
|
|
10555
|
+
};
|
|
10556
|
+
useEffect16(() => {
|
|
10557
|
+
if (date) {
|
|
10558
|
+
setInternalDate(date);
|
|
10559
|
+
}
|
|
10560
|
+
}, [date, open]);
|
|
10561
|
+
return /* @__PURE__ */ jsxs45("div", { className: cn("space-y-2 w-full sm:w-auto", className), children: [
|
|
10562
|
+
label && /* @__PURE__ */ jsx66(LabelBase_default, { children: label }),
|
|
10563
|
+
/* @__PURE__ */ jsxs45(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
10564
|
+
/* @__PURE__ */ jsx66(PopoverTriggerBase, { disabled, asChild: true, children: /* @__PURE__ */ jsxs45(
|
|
10565
|
+
ButtonBase,
|
|
10566
|
+
{
|
|
10567
|
+
variant: "outline",
|
|
10568
|
+
className: cn(
|
|
10569
|
+
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
10570
|
+
!date && "text-muted-foreground/"
|
|
10571
|
+
),
|
|
10572
|
+
children: [
|
|
10573
|
+
/* @__PURE__ */ jsx66("span", { className: "truncate flex-1", children: date ? display ? format(date, "dd/MM/yyyy") : format(date, getDisplayFormat(), { locale: ptBR }) : "Selecione uma Data" }),
|
|
10574
|
+
/* @__PURE__ */ jsx66(CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
10575
|
+
]
|
|
10576
|
+
}
|
|
10577
|
+
) }),
|
|
10578
|
+
/* @__PURE__ */ jsx66(ErrorMessage_default, { error }),
|
|
10579
|
+
/* @__PURE__ */ jsx66(
|
|
10580
|
+
PopoverContentBase,
|
|
10581
|
+
{
|
|
10582
|
+
className: "w-full p-0",
|
|
10583
|
+
align: "center",
|
|
10584
|
+
sideOffset: 4,
|
|
10585
|
+
side: "bottom",
|
|
10586
|
+
avoidCollisions: true,
|
|
10587
|
+
collisionPadding: 8,
|
|
10588
|
+
children: /* @__PURE__ */ jsxs45("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: [
|
|
10589
|
+
/* @__PURE__ */ jsx66(
|
|
10590
|
+
CalendarBase2,
|
|
10591
|
+
{
|
|
10592
|
+
mode: "single",
|
|
10593
|
+
locale: ptBR,
|
|
10594
|
+
selected: internalDate,
|
|
10595
|
+
onSelect: (d) => handleSelect(d),
|
|
10596
|
+
initialFocus: true,
|
|
10597
|
+
fromDate,
|
|
10598
|
+
toDate,
|
|
10599
|
+
className: cn("w-full", hideHour && hideMinute && "border-0")
|
|
10600
|
+
}
|
|
10601
|
+
),
|
|
10602
|
+
!(hideHour && hideMinute) && /* @__PURE__ */ jsx66("div", { className: "flex justify-center w-full px-2", children: /* @__PURE__ */ jsxs45(
|
|
10603
|
+
PopoverBase,
|
|
10604
|
+
{
|
|
10605
|
+
open: timePickerOpen,
|
|
10606
|
+
onOpenChange: setTimePickerOpen,
|
|
10607
|
+
children: [
|
|
10608
|
+
/* @__PURE__ */ jsx66(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs45(
|
|
10609
|
+
ButtonBase,
|
|
10610
|
+
{
|
|
10611
|
+
variant: "outline",
|
|
10612
|
+
size: "default",
|
|
10613
|
+
className: cn(
|
|
10614
|
+
"flex items-center justify-center gap-1.5 sm:gap-2",
|
|
10615
|
+
"px-2 sm:px-3 py-1.5 sm:py-2",
|
|
10616
|
+
"text-sm sm:text-base font-semibold w-full max-w-xs",
|
|
10617
|
+
"border-2 border-primary/20 rounded-lg",
|
|
10618
|
+
"bg-background hover:bg-primary/10 hover:border-primary/30",
|
|
10619
|
+
"transition-all duration-200",
|
|
10620
|
+
"shadow-sm hover:shadow-md active:scale-[0.98]",
|
|
10621
|
+
"min-h-[36px] sm:min-h-[40px]"
|
|
10622
|
+
),
|
|
10623
|
+
children: [
|
|
10624
|
+
/* @__PURE__ */ jsx66(ClockIcon, { className: "text-primary flex-shrink-0 w-4 h-4 sm:w-5 sm:h-5" }),
|
|
10625
|
+
/* @__PURE__ */ jsx66("span", { className: "text-black truncate", children: internalDate ? format(internalDate, getTimeFormat() || "HH:mm", {
|
|
10626
|
+
locale: ptBR
|
|
10627
|
+
}) : "00:00" })
|
|
10628
|
+
]
|
|
10629
|
+
}
|
|
10630
|
+
) }),
|
|
10631
|
+
/* @__PURE__ */ jsx66(
|
|
10632
|
+
PopoverContentBase,
|
|
10633
|
+
{
|
|
10634
|
+
className: "w-[calc(100vw-2rem)] max-w-sm p-3 sm:p-3 rounded-md",
|
|
10635
|
+
align: "center",
|
|
10636
|
+
side: "top",
|
|
10637
|
+
sideOffset: 8,
|
|
10638
|
+
avoidCollisions: true,
|
|
10639
|
+
collisionPadding: 8,
|
|
10640
|
+
children: /* @__PURE__ */ jsxs45("div", { className: "flex flex-col items-center space-y-2 sm:space-y-3", children: [
|
|
10641
|
+
/* @__PURE__ */ jsx66("h4", { className: "text-sm sm:text-base font-medium text-center", children: "Alterar Hor\xE1rio" }),
|
|
10642
|
+
/* @__PURE__ */ jsx66(
|
|
10643
|
+
TimePicker,
|
|
10644
|
+
{
|
|
10645
|
+
setDate: handleTimeChange,
|
|
10646
|
+
date: internalDate,
|
|
10647
|
+
hideSeconds
|
|
10648
|
+
}
|
|
10649
|
+
),
|
|
10650
|
+
/* @__PURE__ */ jsx66(
|
|
10651
|
+
ButtonBase,
|
|
10652
|
+
{
|
|
10653
|
+
size: "sm",
|
|
10654
|
+
variant: "destructive",
|
|
10655
|
+
onClick: () => setTimePickerOpen(false),
|
|
10656
|
+
className: "w-full text-xs sm:text-sm min-h-[36px] sm:min-h-[40px]",
|
|
10657
|
+
children: "Fechar"
|
|
10658
|
+
}
|
|
10659
|
+
)
|
|
10660
|
+
] })
|
|
10661
|
+
}
|
|
10662
|
+
)
|
|
10663
|
+
]
|
|
10664
|
+
}
|
|
10665
|
+
) })
|
|
10666
|
+
] })
|
|
10667
|
+
}
|
|
10668
|
+
)
|
|
10669
|
+
] })
|
|
10670
|
+
] });
|
|
10671
|
+
}
|
|
10672
|
+
|
|
10673
|
+
// src/components/picker/RangePicker.tsx
|
|
10674
|
+
import * as React42 from "react";
|
|
10675
|
+
import {
|
|
10676
|
+
DayPicker as DayPicker3
|
|
10677
|
+
} from "react-day-picker";
|
|
10678
|
+
import {
|
|
10679
|
+
CaretLeftIcon as CaretLeftIcon3,
|
|
10680
|
+
CaretRightIcon as CaretRightIcon5,
|
|
10681
|
+
CalendarBlankIcon as CalendarBlankIcon2
|
|
10682
|
+
} from "@phosphor-icons/react";
|
|
10683
|
+
import { motion as motion15, AnimatePresence as AnimatePresence11, useAnimation } from "framer-motion";
|
|
10684
|
+
import { CalendarDotIcon } from "@phosphor-icons/react/dist/ssr";
|
|
10685
|
+
import { jsx as jsx67, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
10686
|
+
function RangePicker({
|
|
10687
|
+
value,
|
|
10688
|
+
onChange,
|
|
10689
|
+
label = "Selecionar intervalo",
|
|
10690
|
+
minDate,
|
|
10691
|
+
maxDate,
|
|
10692
|
+
error
|
|
10693
|
+
}) {
|
|
10694
|
+
const [open, setOpen] = React42.useState(false);
|
|
10695
|
+
const [range, setRange] = React42.useState(value);
|
|
10696
|
+
const controls = useAnimation();
|
|
10697
|
+
React42.useEffect(() => {
|
|
10698
|
+
setRange(value);
|
|
10699
|
+
}, [value]);
|
|
10700
|
+
const handleSelect = (selected) => {
|
|
10701
|
+
setRange(selected);
|
|
10702
|
+
onChange?.(selected);
|
|
10703
|
+
};
|
|
10704
|
+
const handleClear = () => {
|
|
10705
|
+
setRange(void 0);
|
|
10706
|
+
onChange?.(void 0);
|
|
10707
|
+
};
|
|
10708
|
+
return /* @__PURE__ */ jsxs46(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
10709
|
+
/* @__PURE__ */ jsx67(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsx67(
|
|
10710
|
+
motion15.div,
|
|
10711
|
+
{
|
|
10712
|
+
whileTap: { scale: 0.97 },
|
|
10713
|
+
whileHover: { scale: open ? 1.03 : 1.01 },
|
|
10714
|
+
transition: { type: "spring", stiffness: 300, damping: 20 },
|
|
10715
|
+
children: /* @__PURE__ */ jsxs46(
|
|
10716
|
+
ButtonBase,
|
|
10717
|
+
{
|
|
10718
|
+
variant: "outline",
|
|
10719
|
+
className: "flex gap-2 transition-all duration-200 min-w-[250px] text-left justify-between items-center",
|
|
10720
|
+
children: [
|
|
10721
|
+
/* @__PURE__ */ jsx67(
|
|
10722
|
+
motion15.span,
|
|
10723
|
+
{
|
|
10724
|
+
className: "text-sm font-medium",
|
|
10725
|
+
transition: { duration: 0.2 },
|
|
10726
|
+
animate: controls,
|
|
10727
|
+
children: range?.from && range?.to ? `${range.from.toLocaleDateString()} - ${range.to.toLocaleDateString()}` : label
|
|
10728
|
+
}
|
|
10729
|
+
),
|
|
10730
|
+
/* @__PURE__ */ jsx67(
|
|
10731
|
+
motion15.span,
|
|
10732
|
+
{
|
|
10733
|
+
animate: open ? { rotate: 8, scale: 1.15 } : { rotate: 0, scale: 1 },
|
|
10734
|
+
transition: { type: "spring", stiffness: 300, damping: 18 },
|
|
10735
|
+
children: /* @__PURE__ */ jsx67(CalendarBlankIcon2, { className: "w-4 h-4 transition-transform group-hover:scale-110" })
|
|
10736
|
+
}
|
|
10737
|
+
)
|
|
10738
|
+
]
|
|
10739
|
+
}
|
|
10740
|
+
)
|
|
10741
|
+
}
|
|
10742
|
+
) }),
|
|
10743
|
+
/* @__PURE__ */ jsx67(ErrorMessage_default, { error }),
|
|
10744
|
+
/* @__PURE__ */ jsx67(AnimatePresence11, { children: open && /* @__PURE__ */ jsx67(
|
|
10745
|
+
PopoverContentBase,
|
|
10746
|
+
{
|
|
10747
|
+
asChild: true,
|
|
10748
|
+
className: "w-auto min-w-[250px] p-0 shadow-xl overflow-y-hidden",
|
|
10749
|
+
children: /* @__PURE__ */ jsxs46(
|
|
10750
|
+
motion15.div,
|
|
10751
|
+
{
|
|
10752
|
+
initial: { opacity: 0, y: 16 },
|
|
10753
|
+
animate: { opacity: 1, y: 0 },
|
|
10754
|
+
exit: { opacity: 0, y: 16 },
|
|
10755
|
+
transition: { duration: 0.18, ease: "easeOut" },
|
|
10756
|
+
children: [
|
|
10757
|
+
/* @__PURE__ */ jsx67("div", { className: "p-4", children: /* @__PURE__ */ jsx67(
|
|
10758
|
+
motion15.div,
|
|
10759
|
+
{
|
|
10760
|
+
initial: { opacity: 0, y: 8 },
|
|
10761
|
+
animate: { opacity: 1, y: 0 },
|
|
10762
|
+
exit: { opacity: 0, y: 8 },
|
|
10763
|
+
transition: { duration: 0.18 },
|
|
10764
|
+
className: "w-full",
|
|
10765
|
+
children: /* @__PURE__ */ jsx67(
|
|
10766
|
+
DayPicker3,
|
|
10767
|
+
{
|
|
10768
|
+
mode: "range",
|
|
10769
|
+
selected: range,
|
|
10770
|
+
onSelect: handleSelect,
|
|
10771
|
+
showOutsideDays: true,
|
|
10772
|
+
fromDate: minDate,
|
|
10773
|
+
toDate: maxDate,
|
|
10774
|
+
className: "min-w-0 flex flex-col",
|
|
10775
|
+
classNames: {
|
|
10776
|
+
months: "flex items-center flex-col sm:flex-row space-y-2 sm:space-x-2 sm:space-y-0 flex-1",
|
|
10777
|
+
month: "space-y-2 min-w-0 flex-1 flex flex-col",
|
|
10778
|
+
caption: "flex justify-center pt-1 relative items-center h-[10%] min-h-[2rem] mb-2",
|
|
10779
|
+
caption_label: "text-[clamp(0.875rem,2.5vw,1.25rem)] font-semibold truncate px-10 tracking-tight",
|
|
10780
|
+
nav: "space-x-1 flex items-center",
|
|
10781
|
+
nav_button: cn(
|
|
10782
|
+
buttonVariantsBase({ variant: "outline" }),
|
|
10783
|
+
"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",
|
|
10784
|
+
"[@media(min-width:400px)]:h-9 [@media(min-width:400px)]:w-9"
|
|
10785
|
+
),
|
|
10786
|
+
nav_button_previous: "absolute left-0",
|
|
10787
|
+
nav_button_next: "absolute right-0",
|
|
10788
|
+
table: "w-full border-collapse min-w-0 flex-1 flex flex-col",
|
|
10789
|
+
head_row: "flex w-full gap-1 mb-1",
|
|
10790
|
+
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",
|
|
10791
|
+
row: "flex w-full flex-1 gap-1",
|
|
10792
|
+
cell: cn(
|
|
10793
|
+
"flex-1 min-w-0 aspect-square text-center relative",
|
|
10794
|
+
"[&:has([aria-selected].day-range-end)]:rounded-r-lg",
|
|
10795
|
+
"[&:has([aria-selected].day-range-start)]:rounded-l-lg",
|
|
10796
|
+
"[&:has([aria-selected].day-outside)]:bg-muted/50",
|
|
10797
|
+
"[&:has([aria-selected])]:bg-muted",
|
|
10798
|
+
"first:[&:has([aria-selected])]:rounded-l-lg",
|
|
10799
|
+
"last:[&:has([aria-selected])]:rounded-r-lg",
|
|
10800
|
+
"focus-within:relative focus-within:z-20"
|
|
10801
|
+
),
|
|
10802
|
+
day: cn(
|
|
10803
|
+
buttonVariantsBase({ variant: "ghost" }),
|
|
10804
|
+
"w-full h-full min-w-9",
|
|
10805
|
+
"aria-selected:opacity-100 hover:bg-muted flex items-center justify-center p-1",
|
|
10806
|
+
"transition-all duration-200 ease-out !scale-100 aria-selected:!scale-100 hover:!scale-100 active:!scale-100"
|
|
10807
|
+
),
|
|
10808
|
+
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",
|
|
10809
|
+
day_today: "bg-muted text-foreground font-bold ring-2 ring-primary/50 ring-inset p-1 !border-0 !outline-none",
|
|
10810
|
+
day_outside: "day-outside text-muted-foreground/40 opacity-40 aria-selected:bg-muted/50 aria-selected:text-foreground",
|
|
10811
|
+
day_disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
|
|
10812
|
+
day_range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
|
|
10813
|
+
day_hidden: "invisible"
|
|
10814
|
+
},
|
|
10815
|
+
components: {
|
|
10816
|
+
IconLeft: () => /* @__PURE__ */ jsx67(CaretLeftIcon3, { className: "h-4 w-4" }),
|
|
10817
|
+
IconRight: () => /* @__PURE__ */ jsx67(CaretRightIcon5, { className: "h-4 w-4" })
|
|
10818
|
+
}
|
|
10819
|
+
}
|
|
10820
|
+
)
|
|
10821
|
+
}
|
|
10822
|
+
) }),
|
|
10823
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex justify-end gap-2 px-4 pb-4", children: [
|
|
10824
|
+
/* @__PURE__ */ jsx67("div", { style: { display: "inline-block" }, children: /* @__PURE__ */ jsx67(
|
|
10825
|
+
motion15.div,
|
|
10826
|
+
{
|
|
10827
|
+
whileHover: { scale: 1.03 },
|
|
10828
|
+
whileTap: { scale: 0.95 },
|
|
10829
|
+
children: /* @__PURE__ */ jsx67(
|
|
10830
|
+
ButtonBase,
|
|
10831
|
+
{
|
|
10832
|
+
variant: "outline",
|
|
10833
|
+
onClick: () => {
|
|
10834
|
+
setRange({
|
|
10835
|
+
from: /* @__PURE__ */ new Date(),
|
|
10836
|
+
to: /* @__PURE__ */ new Date()
|
|
10837
|
+
});
|
|
10838
|
+
},
|
|
10839
|
+
children: /* @__PURE__ */ jsx67(CalendarDotIcon, {})
|
|
10840
|
+
}
|
|
10841
|
+
)
|
|
10842
|
+
}
|
|
10843
|
+
) }),
|
|
10844
|
+
/* @__PURE__ */ jsx67("div", { style: { display: "inline-block" }, children: /* @__PURE__ */ jsx67(
|
|
10845
|
+
motion15.div,
|
|
10846
|
+
{
|
|
10847
|
+
whileHover: { scale: 1.03 },
|
|
10848
|
+
whileTap: { scale: 0.95 },
|
|
10849
|
+
children: /* @__PURE__ */ jsx67(
|
|
10850
|
+
DeleteButton,
|
|
10851
|
+
{
|
|
10852
|
+
variant: "outline",
|
|
10853
|
+
onClick: handleClear,
|
|
10854
|
+
disabled: !range?.from && !range?.to,
|
|
10855
|
+
className: "hover:bg-destructive hover:text-white",
|
|
10856
|
+
children: "Limpar"
|
|
10857
|
+
}
|
|
10858
|
+
)
|
|
10859
|
+
}
|
|
10860
|
+
) }),
|
|
10861
|
+
/* @__PURE__ */ jsx67("div", { style: { display: "inline-block", width: "100%" }, children: /* @__PURE__ */ jsx67(
|
|
10862
|
+
motion15.div,
|
|
10863
|
+
{
|
|
10864
|
+
whileHover: { scale: 1.02 },
|
|
10865
|
+
whileTap: { scale: 0.98 },
|
|
10866
|
+
children: /* @__PURE__ */ jsx67(
|
|
10867
|
+
ButtonBase,
|
|
10868
|
+
{
|
|
10869
|
+
className: "font-semibold w-full text-center",
|
|
10870
|
+
onClick: () => setOpen(false),
|
|
10871
|
+
disabled: !range?.from || !range?.to,
|
|
10872
|
+
children: "Selecionar"
|
|
10873
|
+
}
|
|
10874
|
+
)
|
|
10875
|
+
}
|
|
10876
|
+
) })
|
|
10877
|
+
] })
|
|
10878
|
+
]
|
|
10879
|
+
}
|
|
10880
|
+
)
|
|
10881
|
+
}
|
|
10882
|
+
) })
|
|
10883
|
+
] });
|
|
10884
|
+
}
|
|
10885
|
+
RangePicker.displayName = "RangePicker";
|
|
10886
|
+
|
|
10887
|
+
// src/components/ui/navigation/ContextMenuBase.tsx
|
|
10888
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
10889
|
+
import { CaretRightIcon as CaretRightIcon6, CheckIcon as CheckIcon9, CircleIcon as CircleIcon2 } from "@phosphor-icons/react";
|
|
10890
|
+
import { jsx as jsx68, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
10891
|
+
function ContextMenuBase(props) {
|
|
10892
|
+
return /* @__PURE__ */ jsx68(ContextMenuPrimitive.Root, { "data-slot": "context-menu", ...props });
|
|
10893
|
+
}
|
|
10894
|
+
function ContextMenuTriggerBase(props) {
|
|
10895
|
+
return /* @__PURE__ */ jsx68(ContextMenuPrimitive.Trigger, { "data-slot": "context-menu-trigger", ...props });
|
|
10896
|
+
}
|
|
10897
|
+
function ContextMenuGroupBase(props) {
|
|
10898
|
+
return /* @__PURE__ */ jsx68(ContextMenuPrimitive.Group, { "data-slot": "context-menu-group", ...props });
|
|
10899
|
+
}
|
|
10900
|
+
function ContextMenuPortalBase(props) {
|
|
10901
|
+
return /* @__PURE__ */ jsx68(ContextMenuPrimitive.Portal, { "data-slot": "context-menu-portal", ...props });
|
|
10902
|
+
}
|
|
10903
|
+
function ContextMenuSubBase(props) {
|
|
10904
|
+
return /* @__PURE__ */ jsx68(ContextMenuPrimitive.Sub, { "data-slot": "context-menu-sub", ...props });
|
|
10905
|
+
}
|
|
10906
|
+
function ContextMenuRadioGroupBase(props) {
|
|
10907
|
+
return /* @__PURE__ */ jsx68(ContextMenuPrimitive.RadioGroup, { "data-slot": "context-menu-radio-group", ...props });
|
|
10908
|
+
}
|
|
10909
|
+
function ContextMenuSubTriggerBase({
|
|
10910
|
+
className,
|
|
10911
|
+
inset,
|
|
10912
|
+
children,
|
|
10913
|
+
...props
|
|
10914
|
+
}) {
|
|
10915
|
+
return /* @__PURE__ */ jsxs47(
|
|
10916
|
+
ContextMenuPrimitive.SubTrigger,
|
|
10917
|
+
{
|
|
10918
|
+
"data-slot": "context-menu-sub-trigger",
|
|
10919
|
+
"data-inset": inset,
|
|
10920
|
+
className: cn(
|
|
10921
|
+
"focus:outline-none",
|
|
10922
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
10923
|
+
"flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm select-none",
|
|
10924
|
+
"data-[inset]:pl-8",
|
|
10925
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
10926
|
+
className
|
|
10927
|
+
),
|
|
10928
|
+
...props,
|
|
10929
|
+
children: [
|
|
10930
|
+
children,
|
|
10931
|
+
/* @__PURE__ */ jsx68(CaretRightIcon6, { className: "ml-auto" })
|
|
10932
|
+
]
|
|
10933
|
+
}
|
|
10934
|
+
);
|
|
10935
|
+
}
|
|
10936
|
+
function ContextMenuSubContentBase({
|
|
10937
|
+
className,
|
|
10938
|
+
...props
|
|
10939
|
+
}) {
|
|
10940
|
+
return /* @__PURE__ */ jsx68(
|
|
10941
|
+
ContextMenuPrimitive.SubContent,
|
|
10942
|
+
{
|
|
10943
|
+
"data-slot": "context-menu-sub-content",
|
|
10944
|
+
className: cn(
|
|
10945
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
10946
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
10947
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
10948
|
+
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
10949
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-border p-1 shadow-lg",
|
|
10950
|
+
className
|
|
10951
|
+
),
|
|
10952
|
+
...props
|
|
10953
|
+
}
|
|
10954
|
+
);
|
|
10955
|
+
}
|
|
10956
|
+
function ContextMenuContentBase({
|
|
10957
|
+
className,
|
|
10958
|
+
...props
|
|
10959
|
+
}) {
|
|
10960
|
+
return /* @__PURE__ */ jsx68(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx68(
|
|
10961
|
+
ContextMenuPrimitive.Content,
|
|
10962
|
+
{
|
|
10963
|
+
"data-slot": "context-menu-content",
|
|
10964
|
+
className: cn(
|
|
10965
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
10966
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
10967
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
10968
|
+
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
10969
|
+
"z-50 max-h-[var(--radix-context-menu-content-available-height)] min-w-[8rem]",
|
|
10970
|
+
"overflow-x-hidden overflow-y-auto rounded-md border border-border p-1 shadow-md",
|
|
10971
|
+
className
|
|
10972
|
+
),
|
|
10973
|
+
...props
|
|
10974
|
+
}
|
|
10975
|
+
) });
|
|
10976
|
+
}
|
|
10977
|
+
function ContextMenuItemBase({
|
|
10978
|
+
className,
|
|
10979
|
+
inset,
|
|
10980
|
+
variant = "default",
|
|
10981
|
+
...props
|
|
10982
|
+
}) {
|
|
10983
|
+
return /* @__PURE__ */ jsx68(
|
|
10984
|
+
ContextMenuPrimitive.Item,
|
|
10985
|
+
{
|
|
10986
|
+
"data-slot": "context-menu-item",
|
|
10987
|
+
"data-inset": inset,
|
|
10988
|
+
"data-variant": variant,
|
|
10989
|
+
className: cn(
|
|
10990
|
+
"focus:outline-none",
|
|
10991
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
10992
|
+
"data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20",
|
|
10993
|
+
"data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive",
|
|
10994
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
10995
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm select-none",
|
|
10996
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
10997
|
+
"data-[inset]:pl-8",
|
|
10998
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
10999
|
+
className
|
|
11000
|
+
),
|
|
11001
|
+
...props
|
|
11002
|
+
}
|
|
11003
|
+
);
|
|
11004
|
+
}
|
|
11005
|
+
function ContextMenuCheckboxItemBase({
|
|
11006
|
+
className,
|
|
11007
|
+
children,
|
|
11008
|
+
checked,
|
|
11009
|
+
...props
|
|
11010
|
+
}) {
|
|
11011
|
+
return /* @__PURE__ */ jsxs47(
|
|
11012
|
+
ContextMenuPrimitive.CheckboxItem,
|
|
11013
|
+
{
|
|
11014
|
+
"data-slot": "context-menu-checkbox-item",
|
|
11015
|
+
className: cn(
|
|
11016
|
+
"focus:outline-none",
|
|
11017
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
11018
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm select-none",
|
|
11019
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
11020
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
11021
|
+
className
|
|
11022
|
+
),
|
|
11023
|
+
checked,
|
|
11024
|
+
...props,
|
|
11025
|
+
children: [
|
|
11026
|
+
/* @__PURE__ */ jsx68("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx68(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx68(CheckIcon9, { className: "size-4" }) }) }),
|
|
11027
|
+
children
|
|
11028
|
+
]
|
|
11029
|
+
}
|
|
11030
|
+
);
|
|
11031
|
+
}
|
|
11032
|
+
function ContextMenuRadioItemBase({
|
|
11033
|
+
className,
|
|
11034
|
+
children,
|
|
11035
|
+
...props
|
|
11036
|
+
}) {
|
|
11037
|
+
return /* @__PURE__ */ jsxs47(
|
|
11038
|
+
ContextMenuPrimitive.RadioItem,
|
|
11039
|
+
{
|
|
11040
|
+
"data-slot": "context-menu-radio-item",
|
|
11041
|
+
className: cn(
|
|
11042
|
+
"focus:outline-none",
|
|
11043
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
11044
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm select-none",
|
|
11045
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
11046
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
11047
|
+
className
|
|
11048
|
+
),
|
|
11049
|
+
...props,
|
|
11050
|
+
children: [
|
|
11051
|
+
/* @__PURE__ */ jsx68("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx68(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx68(CircleIcon2, { className: "size-2 fill-current" }) }) }),
|
|
11052
|
+
children
|
|
11053
|
+
]
|
|
11054
|
+
}
|
|
11055
|
+
);
|
|
11056
|
+
}
|
|
11057
|
+
function ContextMenuLabelBase({
|
|
11058
|
+
className,
|
|
11059
|
+
inset,
|
|
11060
|
+
...props
|
|
11061
|
+
}) {
|
|
11062
|
+
return /* @__PURE__ */ jsx68(
|
|
11063
|
+
ContextMenuPrimitive.Label,
|
|
11064
|
+
{
|
|
11065
|
+
"data-slot": "context-menu-label",
|
|
11066
|
+
"data-inset": inset,
|
|
11067
|
+
className: cn("text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
|
|
11068
|
+
...props
|
|
11069
|
+
}
|
|
11070
|
+
);
|
|
11071
|
+
}
|
|
11072
|
+
function ContextMenuSeparatorBase({
|
|
11073
|
+
className,
|
|
11074
|
+
...props
|
|
11075
|
+
}) {
|
|
11076
|
+
return /* @__PURE__ */ jsx68(
|
|
11077
|
+
ContextMenuPrimitive.Separator,
|
|
11078
|
+
{
|
|
11079
|
+
"data-slot": "context-menu-separator",
|
|
11080
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
11081
|
+
...props
|
|
11082
|
+
}
|
|
11083
|
+
);
|
|
11084
|
+
}
|
|
11085
|
+
function ContextMenuShortcutBase({
|
|
11086
|
+
className,
|
|
11087
|
+
...props
|
|
11088
|
+
}) {
|
|
11089
|
+
return /* @__PURE__ */ jsx68(
|
|
11090
|
+
"span",
|
|
11091
|
+
{
|
|
11092
|
+
"data-slot": "context-menu-shortcut",
|
|
11093
|
+
className: cn("text-muted-foreground ml-auto text-xs tracking-widest", className),
|
|
11094
|
+
...props
|
|
11095
|
+
}
|
|
11096
|
+
);
|
|
11097
|
+
}
|
|
11098
|
+
|
|
9882
11099
|
// src/hooks/use-drag.tsx
|
|
9883
|
-
import { useState as
|
|
11100
|
+
import { useState as useState20, useCallback as useCallback12, useRef as useRef8, useEffect as useEffect18 } from "react";
|
|
9884
11101
|
var useDrag = (options = {}) => {
|
|
9885
|
-
const [isDragging, setIsDragging] =
|
|
9886
|
-
const [positions, setPositions] =
|
|
9887
|
-
const dragStartPos =
|
|
9888
|
-
const dragId =
|
|
11102
|
+
const [isDragging, setIsDragging] = useState20(null);
|
|
11103
|
+
const [positions, setPositions] = useState20({});
|
|
11104
|
+
const dragStartPos = useRef8(null);
|
|
11105
|
+
const dragId = useRef8(null);
|
|
9889
11106
|
const handleMouseDown = useCallback12((id, e) => {
|
|
9890
11107
|
e.preventDefault();
|
|
9891
11108
|
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
@@ -9923,7 +11140,7 @@ var useDrag = (options = {}) => {
|
|
|
9923
11140
|
dragStartPos.current = null;
|
|
9924
11141
|
dragId.current = null;
|
|
9925
11142
|
}, [options]);
|
|
9926
|
-
|
|
11143
|
+
useEffect18(() => {
|
|
9927
11144
|
if (isDragging) {
|
|
9928
11145
|
document.addEventListener("mousemove", handleMouseMove);
|
|
9929
11146
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -10014,7 +11231,23 @@ export {
|
|
|
10014
11231
|
CommandListBase,
|
|
10015
11232
|
CommandSeparatorBase,
|
|
10016
11233
|
CommandShortcutBase,
|
|
11234
|
+
ContextMenuBase,
|
|
11235
|
+
ContextMenuCheckboxItemBase,
|
|
11236
|
+
ContextMenuContentBase,
|
|
11237
|
+
ContextMenuGroupBase,
|
|
11238
|
+
ContextMenuItemBase,
|
|
11239
|
+
ContextMenuLabelBase,
|
|
11240
|
+
ContextMenuPortalBase,
|
|
11241
|
+
ContextMenuRadioGroupBase,
|
|
11242
|
+
ContextMenuRadioItemBase,
|
|
11243
|
+
ContextMenuSeparatorBase,
|
|
11244
|
+
ContextMenuShortcutBase,
|
|
11245
|
+
ContextMenuSubBase,
|
|
11246
|
+
ContextMenuSubContentBase,
|
|
11247
|
+
ContextMenuSubTriggerBase,
|
|
11248
|
+
ContextMenuTriggerBase,
|
|
10017
11249
|
CopyButton,
|
|
11250
|
+
DateTimePicker,
|
|
10018
11251
|
DeleteButton,
|
|
10019
11252
|
DestructiveDialog,
|
|
10020
11253
|
DialogBase,
|
|
@@ -10106,6 +11339,7 @@ export {
|
|
|
10106
11339
|
ProgressCirclesBase,
|
|
10107
11340
|
ProgressPanelsBase,
|
|
10108
11341
|
ProgressSegmentsBase,
|
|
11342
|
+
RangePicker,
|
|
10109
11343
|
RefreshButton,
|
|
10110
11344
|
SaveButton,
|
|
10111
11345
|
ScrollAreaBase,
|
|
@@ -10175,6 +11409,8 @@ export {
|
|
|
10175
11409
|
TabsTriggerBase,
|
|
10176
11410
|
TextAreaBase,
|
|
10177
11411
|
ThemeProviderBase,
|
|
11412
|
+
TimePicker,
|
|
11413
|
+
TimePickerInput,
|
|
10178
11414
|
Toaster,
|
|
10179
11415
|
TooltipBase,
|
|
10180
11416
|
TooltipContentBase,
|
|
@@ -10191,14 +11427,34 @@ export {
|
|
|
10191
11427
|
badgeVariants,
|
|
10192
11428
|
buttonVariantsBase,
|
|
10193
11429
|
compactTick,
|
|
11430
|
+
convert12HourTo24Hour,
|
|
10194
11431
|
detectDataFields,
|
|
10195
11432
|
detectXAxis,
|
|
11433
|
+
display12HourValue,
|
|
10196
11434
|
formatFieldName,
|
|
10197
11435
|
generateAdditionalColors,
|
|
11436
|
+
getArrowByType,
|
|
11437
|
+
getDateByType,
|
|
11438
|
+
getValid12Hour,
|
|
11439
|
+
getValidArrow12Hour,
|
|
11440
|
+
getValidArrowHour,
|
|
11441
|
+
getValidArrowMinuteOrSecond,
|
|
11442
|
+
getValidArrowNumber,
|
|
11443
|
+
getValidHour,
|
|
11444
|
+
getValidMinuteOrSecond,
|
|
11445
|
+
getValidNumber,
|
|
11446
|
+
isValid12Hour,
|
|
11447
|
+
isValidHour,
|
|
11448
|
+
isValidMinuteOrSecond,
|
|
10198
11449
|
niceCeil,
|
|
10199
11450
|
pillLabelRenderer_default as renderPillLabel,
|
|
10200
11451
|
resolveChartMargins,
|
|
10201
11452
|
resolveContainerPaddingLeft,
|
|
11453
|
+
set12Hours,
|
|
11454
|
+
setDateByType,
|
|
11455
|
+
setHours,
|
|
11456
|
+
setMinutes,
|
|
11457
|
+
setSeconds,
|
|
10202
11458
|
toast2 as toast,
|
|
10203
11459
|
useChartHighlights,
|
|
10204
11460
|
useDrag,
|