@mlw-packages/react-components 1.10.17 → 1.10.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +230 -3
- package/dist/index.d.mts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +257 -206
- package/dist/index.mjs +257 -206
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2572,6 +2572,7 @@ var badgeVariants = classVarianceAuthority.cva(
|
|
|
2572
2572
|
function Badge({
|
|
2573
2573
|
className,
|
|
2574
2574
|
color,
|
|
2575
|
+
rank,
|
|
2575
2576
|
size = "md",
|
|
2576
2577
|
asChild = false,
|
|
2577
2578
|
children,
|
|
@@ -2588,6 +2589,12 @@ function Badge({
|
|
|
2588
2589
|
blue: "bg-blue-50 text-blue-500 border-blue-200",
|
|
2589
2590
|
purple: "bg-purple-50 text-purple-500 border-purple-200"
|
|
2590
2591
|
};
|
|
2592
|
+
const rankClasses = {
|
|
2593
|
+
diamond: "bg-cyan-100 text-cyan-600 border-cyan-300 dark:text-cyan-800 dark:border-cyan-800",
|
|
2594
|
+
gold: "bg-amber-50 text-amber-500 border-amber-300 dark:text-amber-600 dark:border-amber-600 dark:bg-amber-50",
|
|
2595
|
+
silver: "bg-gray-100 text-gray-500 border-gray-300 dark:text-gray-800 dark:border-gray-800",
|
|
2596
|
+
bronze: "bg-orange-100 text-orange-700 border-orange-300 dark:text-orange-800 dark:border-orange-800"
|
|
2597
|
+
};
|
|
2591
2598
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2592
2599
|
Comp,
|
|
2593
2600
|
{
|
|
@@ -2595,6 +2602,7 @@ function Badge({
|
|
|
2595
2602
|
className: cn(
|
|
2596
2603
|
badgeVariants({ size }),
|
|
2597
2604
|
color ? colorClasses[color] : void 0,
|
|
2605
|
+
rank ? rankClasses[rank] : void 0,
|
|
2598
2606
|
className
|
|
2599
2607
|
),
|
|
2600
2608
|
style: customStyle,
|
|
@@ -7858,7 +7866,8 @@ function DateTimePicker({
|
|
|
7858
7866
|
disabled,
|
|
7859
7867
|
className,
|
|
7860
7868
|
error,
|
|
7861
|
-
hideClear = true
|
|
7869
|
+
hideClear = true,
|
|
7870
|
+
triggerIcon
|
|
7862
7871
|
}) {
|
|
7863
7872
|
const [internalDate, setInternalDate] = React32.useState(date);
|
|
7864
7873
|
const [open, setOpen] = React32.useState(false);
|
|
@@ -7908,193 +7917,222 @@ function DateTimePicker({
|
|
|
7908
7917
|
const { ref: contentRef, center } = use_auto_center_default(open);
|
|
7909
7918
|
const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none";
|
|
7910
7919
|
const centeredPopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-50";
|
|
7911
|
-
const renderTriggerButton = () =>
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
hideClear && (date || internalDate) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7924
|
-
ClearButton,
|
|
7925
|
-
{
|
|
7926
|
-
onClick: (e) => {
|
|
7927
|
-
e?.stopPropagation();
|
|
7928
|
-
setInternalDate(null);
|
|
7929
|
-
onChange?.(null);
|
|
7930
|
-
onConfirm?.(null);
|
|
7931
|
-
}
|
|
7932
|
-
}
|
|
7933
|
-
),
|
|
7934
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7935
|
-
framerMotion.motion.div,
|
|
7936
|
-
{
|
|
7937
|
-
animate: { rotate: open ? 15 : 0 },
|
|
7938
|
-
transition: { duration: 0.03 },
|
|
7939
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(react.CalendarBlankIcon, { className: "h-4 w-4" })
|
|
7940
|
-
}
|
|
7941
|
-
)
|
|
7942
|
-
] }) })
|
|
7943
|
-
]
|
|
7920
|
+
const renderTriggerButton = () => {
|
|
7921
|
+
if (triggerIcon) {
|
|
7922
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7923
|
+
ButtonBase,
|
|
7924
|
+
{
|
|
7925
|
+
variant: "outline",
|
|
7926
|
+
size: "icon",
|
|
7927
|
+
disabled,
|
|
7928
|
+
className: cn("no-active-animation", error && "border-red-500"),
|
|
7929
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CalendarBlankIcon, { className: "h-4 w-4" })
|
|
7930
|
+
}
|
|
7931
|
+
);
|
|
7944
7932
|
}
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
isMobile && !hideTime ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-h-0", children: [
|
|
7948
|
-
internalDate && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3 px-4 py-3 rounded-lg ", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-md font-semibold", children: [
|
|
7949
|
-
dateFns.format(internalDate, "dd 'de' MMMM 'de' yyyy", {
|
|
7950
|
-
locale: locale.ptBR
|
|
7951
|
-
}),
|
|
7952
|
-
" ",
|
|
7953
|
-
"- ",
|
|
7954
|
-
dateFns.format(internalDate, hideSeconds ? "HH:mm" : "HH:mm:ss")
|
|
7955
|
-
] }) }),
|
|
7956
|
-
/* @__PURE__ */ jsxRuntime.jsxs(TabsBase, { value: activeTab, onValueChange: setActiveTab, children: [
|
|
7957
|
-
/* @__PURE__ */ jsxRuntime.jsxs(TabsListBase, { className: "", children: [
|
|
7958
|
-
/* @__PURE__ */ jsxRuntime.jsx(TabsTriggerBase, { value: "calendar", className: "flex-1", children: "Data" }),
|
|
7959
|
-
/* @__PURE__ */ jsxRuntime.jsx(TabsTriggerBase, { value: "time", className: "flex-1", children: "Hor\xE1rio" })
|
|
7960
|
-
] }),
|
|
7961
|
-
/* @__PURE__ */ jsxRuntime.jsx(TabsContentBase, { value: "calendar", className: "mt-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7962
|
-
CalendarBase2,
|
|
7963
|
-
{
|
|
7964
|
-
mode: "single",
|
|
7965
|
-
locale: locale.ptBR,
|
|
7966
|
-
selected: internalDate ?? void 0,
|
|
7967
|
-
onSelect: (d) => handleSelect(d ?? null),
|
|
7968
|
-
autoFocus: true,
|
|
7969
|
-
defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
|
|
7970
|
-
...fromDate && { startMonth: fromDate },
|
|
7971
|
-
...toDate && { endMonth: toDate },
|
|
7972
|
-
...fromDate || toDate ? {
|
|
7973
|
-
disabled: [
|
|
7974
|
-
...fromDate ? [{ before: fromDate }] : [],
|
|
7975
|
-
...toDate ? [{ after: toDate }] : []
|
|
7976
|
-
]
|
|
7977
|
-
} : {},
|
|
7978
|
-
className: cn("w-full rounded-none border-none")
|
|
7979
|
-
}
|
|
7980
|
-
) }),
|
|
7981
|
-
/* @__PURE__ */ jsxRuntime.jsx(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center gap-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7982
|
-
TimeScrollPicker,
|
|
7983
|
-
{
|
|
7984
|
-
setDate: (d) => handleTimeChange(d ?? null),
|
|
7985
|
-
date: internalDate,
|
|
7986
|
-
hideSeconds
|
|
7987
|
-
}
|
|
7988
|
-
) }) })
|
|
7989
|
-
] })
|
|
7990
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7991
|
-
"div",
|
|
7933
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7934
|
+
ButtonBase,
|
|
7992
7935
|
{
|
|
7993
|
-
|
|
7994
|
-
|
|
7936
|
+
variant: "outline",
|
|
7937
|
+
disabled,
|
|
7938
|
+
className: cn(
|
|
7939
|
+
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
7940
|
+
!date && "text-muted-foreground"
|
|
7941
|
+
),
|
|
7995
7942
|
children: [
|
|
7996
7943
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7997
|
-
|
|
7944
|
+
"span",
|
|
7998
7945
|
{
|
|
7999
|
-
|
|
8000
|
-
locale: locale.ptBR
|
|
8001
|
-
selected: internalDate ?? void 0,
|
|
8002
|
-
onSelect: (d) => handleSelect(d ?? null),
|
|
8003
|
-
autoFocus: true,
|
|
8004
|
-
defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
|
|
8005
|
-
...fromDate && { startMonth: fromDate },
|
|
8006
|
-
...toDate && { endMonth: toDate },
|
|
8007
|
-
...fromDate || toDate ? {
|
|
8008
|
-
disabled: [
|
|
8009
|
-
...fromDate ? [{ before: fromDate }] : [],
|
|
8010
|
-
...toDate ? [{ after: toDate }] : []
|
|
8011
|
-
]
|
|
8012
|
-
} : {},
|
|
8013
|
-
className: cn(
|
|
8014
|
-
"w-max rounded-none border-none",
|
|
8015
|
-
!hideTime && "sm:rounded-r-none"
|
|
8016
|
-
)
|
|
7946
|
+
className: cn("truncate flex-1", !date && "text-muted-foreground"),
|
|
7947
|
+
children: date ? dateFns.format(date, getDisplayFormat(), { locale: locale.ptBR }) : "Selecione uma data"
|
|
8017
7948
|
}
|
|
8018
7949
|
),
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
7950
|
+
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.span, { className: "flex items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-0 items-center ", children: [
|
|
7951
|
+
hideClear && (date || internalDate) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7952
|
+
ClearButton,
|
|
7953
|
+
{
|
|
7954
|
+
onClick: (e) => {
|
|
7955
|
+
e?.stopPropagation();
|
|
7956
|
+
setInternalDate(null);
|
|
7957
|
+
onChange?.(null);
|
|
7958
|
+
onConfirm?.(null);
|
|
7959
|
+
}
|
|
7960
|
+
}
|
|
7961
|
+
),
|
|
7962
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7963
|
+
framerMotion.motion.div,
|
|
7964
|
+
{
|
|
7965
|
+
animate: { rotate: open ? 15 : 0 },
|
|
7966
|
+
transition: { duration: 0.03 },
|
|
7967
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CalendarBlankIcon, { className: "h-4 w-4" })
|
|
7968
|
+
}
|
|
7969
|
+
)
|
|
7970
|
+
] }) })
|
|
8039
7971
|
]
|
|
8040
7972
|
}
|
|
8041
|
-
)
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
size: "icon",
|
|
8050
|
-
onClick: () => {
|
|
8051
|
-
const now = /* @__PURE__ */ new Date();
|
|
8052
|
-
const selected = hideTime ? new Date(
|
|
8053
|
-
Date.UTC(
|
|
8054
|
-
now.getUTCFullYear(),
|
|
8055
|
-
now.getUTCMonth(),
|
|
8056
|
-
now.getUTCDate(),
|
|
8057
|
-
0,
|
|
8058
|
-
0,
|
|
8059
|
-
0,
|
|
8060
|
-
0
|
|
8061
|
-
)
|
|
8062
|
-
) : now;
|
|
8063
|
-
setInternalDate(selected);
|
|
8064
|
-
onChange?.(selected);
|
|
8065
|
-
onConfirm?.(selected);
|
|
8066
|
-
},
|
|
8067
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(react.CalendarDotIcon, { className: "h-4 w-4" })
|
|
8068
|
-
}
|
|
7973
|
+
);
|
|
7974
|
+
};
|
|
7975
|
+
const renderPickerContent = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7976
|
+
"div",
|
|
7977
|
+
{
|
|
7978
|
+
className: cn(
|
|
7979
|
+
"p-2 sm:p-3",
|
|
7980
|
+
!isMobile && "border border-border rounded-md"
|
|
8069
7981
|
),
|
|
8070
|
-
|
|
8071
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8072
|
-
|
|
7982
|
+
children: [
|
|
7983
|
+
isMobile && !hideTime ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-h-0", children: [
|
|
7984
|
+
internalDate && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3 px-4 py-3 rounded-lg ", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-md font-semibold", children: [
|
|
7985
|
+
dateFns.format(internalDate, "dd 'de' MMMM 'de' yyyy", {
|
|
7986
|
+
locale: locale.ptBR
|
|
7987
|
+
}),
|
|
7988
|
+
" ",
|
|
7989
|
+
"- ",
|
|
7990
|
+
dateFns.format(internalDate, hideSeconds ? "HH:mm" : "HH:mm:ss")
|
|
7991
|
+
] }) }),
|
|
7992
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TabsBase, { value: activeTab, onValueChange: setActiveTab, children: [
|
|
7993
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TabsListBase, { className: "", children: [
|
|
7994
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTriggerBase, { value: "calendar", className: "flex-1", children: "Data" }),
|
|
7995
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTriggerBase, { value: "time", className: "flex-1", children: "Hor\xE1rio" })
|
|
7996
|
+
] }),
|
|
7997
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsContentBase, { value: "calendar", className: "mt-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7998
|
+
CalendarBase2,
|
|
7999
|
+
{
|
|
8000
|
+
mode: "single",
|
|
8001
|
+
locale: locale.ptBR,
|
|
8002
|
+
selected: internalDate ?? void 0,
|
|
8003
|
+
onSelect: (d) => handleSelect(d ?? null),
|
|
8004
|
+
autoFocus: true,
|
|
8005
|
+
defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
|
|
8006
|
+
...fromDate && { startMonth: fromDate },
|
|
8007
|
+
...toDate && { endMonth: toDate },
|
|
8008
|
+
...fromDate || toDate ? {
|
|
8009
|
+
disabled: [
|
|
8010
|
+
...fromDate ? [{ before: fromDate }] : [],
|
|
8011
|
+
...toDate ? [{ after: toDate }] : []
|
|
8012
|
+
]
|
|
8013
|
+
} : {},
|
|
8014
|
+
className: cn("w-full rounded-none border-none")
|
|
8015
|
+
}
|
|
8016
|
+
) }),
|
|
8017
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center gap-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8018
|
+
TimeScrollPicker,
|
|
8019
|
+
{
|
|
8020
|
+
setDate: (d) => handleTimeChange(d ?? null),
|
|
8021
|
+
date: internalDate,
|
|
8022
|
+
hideSeconds
|
|
8023
|
+
}
|
|
8024
|
+
) }) })
|
|
8025
|
+
] })
|
|
8026
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8027
|
+
"div",
|
|
8073
8028
|
{
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
children:
|
|
8029
|
+
ref: contentRef,
|
|
8030
|
+
className: "flex flex-col sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
|
|
8031
|
+
children: [
|
|
8032
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8033
|
+
CalendarBase2,
|
|
8034
|
+
{
|
|
8035
|
+
mode: "single",
|
|
8036
|
+
locale: locale.ptBR,
|
|
8037
|
+
selected: internalDate ?? void 0,
|
|
8038
|
+
onSelect: (d) => handleSelect(d ?? null),
|
|
8039
|
+
autoFocus: true,
|
|
8040
|
+
defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
|
|
8041
|
+
...fromDate && { startMonth: fromDate },
|
|
8042
|
+
...toDate && { endMonth: toDate },
|
|
8043
|
+
...fromDate || toDate ? {
|
|
8044
|
+
disabled: [
|
|
8045
|
+
...fromDate ? [{ before: fromDate }] : [],
|
|
8046
|
+
...toDate ? [{ after: toDate }] : []
|
|
8047
|
+
]
|
|
8048
|
+
} : {},
|
|
8049
|
+
className: cn(
|
|
8050
|
+
"w-max rounded-none border-none",
|
|
8051
|
+
!hideTime && "sm:rounded-r-none"
|
|
8052
|
+
)
|
|
8053
|
+
}
|
|
8054
|
+
),
|
|
8055
|
+
!hideTime && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8056
|
+
"div",
|
|
8057
|
+
{
|
|
8058
|
+
className: cn(
|
|
8059
|
+
"flex flex-col items-center justify-center",
|
|
8060
|
+
"border-l"
|
|
8061
|
+
),
|
|
8062
|
+
children: [
|
|
8063
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize text-left", children: "Hor\xE1rio" }),
|
|
8064
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8065
|
+
TimeScrollPicker,
|
|
8066
|
+
{
|
|
8067
|
+
setDate: (d) => handleTimeChange(d ?? null),
|
|
8068
|
+
date: internalDate,
|
|
8069
|
+
hideSeconds
|
|
8070
|
+
}
|
|
8071
|
+
)
|
|
8072
|
+
]
|
|
8073
|
+
}
|
|
8074
|
+
)
|
|
8075
|
+
]
|
|
8077
8076
|
}
|
|
8078
8077
|
),
|
|
8079
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8078
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex rounded-md p-1.5 gap-2", children: [
|
|
8079
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8080
|
+
ButtonBase,
|
|
8081
|
+
{
|
|
8082
|
+
variant: "outline",
|
|
8083
|
+
className: "no-active-animation",
|
|
8084
|
+
tooltip: "Hoje",
|
|
8085
|
+
size: "icon",
|
|
8086
|
+
onClick: () => {
|
|
8087
|
+
const now = /* @__PURE__ */ new Date();
|
|
8088
|
+
const selected = hideTime ? new Date(
|
|
8089
|
+
Date.UTC(
|
|
8090
|
+
now.getUTCFullYear(),
|
|
8091
|
+
now.getUTCMonth(),
|
|
8092
|
+
now.getUTCDate(),
|
|
8093
|
+
0,
|
|
8094
|
+
0,
|
|
8095
|
+
0,
|
|
8096
|
+
0
|
|
8097
|
+
)
|
|
8098
|
+
) : now;
|
|
8099
|
+
setInternalDate(selected);
|
|
8100
|
+
onChange?.(selected);
|
|
8101
|
+
onConfirm?.(selected);
|
|
8102
|
+
},
|
|
8103
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CalendarDotIcon, { className: "h-4 w-4" })
|
|
8104
|
+
}
|
|
8105
|
+
),
|
|
8106
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 sm:flex-row w-full gap-2", children: [
|
|
8107
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8108
|
+
ButtonBase,
|
|
8109
|
+
{
|
|
8110
|
+
className: "no-active-animation rounded-md bg-background text-primary border hover:bg-muted/50 overflow-hidden flex-1 min-w-0 border-border",
|
|
8111
|
+
onClick: () => setOpen(false),
|
|
8112
|
+
children: "Cancelar"
|
|
8113
|
+
}
|
|
8085
8114
|
),
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8115
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8116
|
+
ButtonBase,
|
|
8117
|
+
{
|
|
8118
|
+
className: cn(
|
|
8119
|
+
"no-active-animation rounded-md bg-emerald-600",
|
|
8120
|
+
internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed"
|
|
8121
|
+
),
|
|
8122
|
+
disabled: !internalDate,
|
|
8123
|
+
onClick: () => {
|
|
8124
|
+
if (!internalDate) return;
|
|
8125
|
+
setOpen(false);
|
|
8126
|
+
onConfirm?.(internalDate);
|
|
8127
|
+
},
|
|
8128
|
+
children: "Confirmar"
|
|
8129
|
+
}
|
|
8130
|
+
)
|
|
8131
|
+
] })
|
|
8132
|
+
] })
|
|
8133
|
+
]
|
|
8134
|
+
}
|
|
8135
|
+
);
|
|
8098
8136
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
8099
8137
|
label && /* @__PURE__ */ jsxRuntime.jsx(LabelBase_default, { children: label }),
|
|
8100
8138
|
isMobile ? /* @__PURE__ */ jsxRuntime.jsxs(DialogBase, { open, onOpenChange: setOpen, children: [
|
|
@@ -8108,7 +8146,7 @@ function DateTimePicker({
|
|
|
8108
8146
|
}
|
|
8109
8147
|
),
|
|
8110
8148
|
/* @__PURE__ */ jsxRuntime.jsx(ErrorMessage_default, { error }),
|
|
8111
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogContentBase, { className: "p-0 max-h-[95vh] w-
|
|
8149
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContentBase, { className: "p-0 max-h-[95vh] w-[95%] sm:max-w-lg overflow-hidden flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto flex-1", children: renderPickerContent() }) })
|
|
8112
8150
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
8113
8151
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8114
8152
|
PopoverTriggerBase,
|
|
@@ -10138,28 +10176,37 @@ function EventAgenda({
|
|
|
10138
10176
|
initialDate,
|
|
10139
10177
|
onClick,
|
|
10140
10178
|
showYearView = false,
|
|
10141
|
-
noTime = false
|
|
10179
|
+
noTime = false,
|
|
10180
|
+
onlyDay,
|
|
10181
|
+
onlyMonth,
|
|
10182
|
+
onlyWeek,
|
|
10183
|
+
onlyAgenda,
|
|
10184
|
+
onlyYear
|
|
10142
10185
|
}) {
|
|
10186
|
+
const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
|
|
10143
10187
|
const [currentDate, setCurrentDate] = React32.useState(
|
|
10144
10188
|
initialDate && new Date(initialDate) || /* @__PURE__ */ new Date()
|
|
10145
10189
|
);
|
|
10146
|
-
const [view, setView] = React32.useState(
|
|
10190
|
+
const [view, setView] = React32.useState(
|
|
10191
|
+
lockedView || initialView
|
|
10192
|
+
);
|
|
10147
10193
|
const [selectedEvent, setSelectedEvent] = React32.useState(null);
|
|
10194
|
+
const activeView = lockedView || view;
|
|
10148
10195
|
const goPrevious = () => {
|
|
10149
|
-
if (
|
|
10150
|
-
else if (
|
|
10151
|
-
else if (
|
|
10152
|
-
else if (
|
|
10196
|
+
if (activeView === "month") setCurrentDate((d) => dateFns.subMonths(d, 1));
|
|
10197
|
+
else if (activeView === "week") setCurrentDate((d) => dateFns.subWeeks(d, 1));
|
|
10198
|
+
else if (activeView === "day") setCurrentDate((d) => dateFns.addDays(d, -1));
|
|
10199
|
+
else if (activeView === "agenda")
|
|
10153
10200
|
setCurrentDate((d) => dateFns.addDays(d, -AgendaDaysToShowAgenda));
|
|
10154
|
-
else if (
|
|
10201
|
+
else if (activeView === "year") setCurrentDate((d) => dateFns.subYears(d, 1));
|
|
10155
10202
|
};
|
|
10156
10203
|
const goNext = () => {
|
|
10157
|
-
if (
|
|
10158
|
-
else if (
|
|
10159
|
-
else if (
|
|
10160
|
-
else if (
|
|
10204
|
+
if (activeView === "month") setCurrentDate((d) => dateFns.addMonths(d, 1));
|
|
10205
|
+
else if (activeView === "week") setCurrentDate((d) => dateFns.addWeeks(d, 1));
|
|
10206
|
+
else if (activeView === "day") setCurrentDate((d) => dateFns.addDays(d, 1));
|
|
10207
|
+
else if (activeView === "agenda")
|
|
10161
10208
|
setCurrentDate((d) => dateFns.addDays(d, AgendaDaysToShowAgenda));
|
|
10162
|
-
else if (
|
|
10209
|
+
else if (activeView === "year") setCurrentDate((d) => dateFns.addYears(d, 1));
|
|
10163
10210
|
};
|
|
10164
10211
|
const handleEventSelect = (event, e) => {
|
|
10165
10212
|
try {
|
|
@@ -10205,9 +10252,9 @@ function EventAgenda({
|
|
|
10205
10252
|
};
|
|
10206
10253
|
const viewTitle = React32.useMemo(() => {
|
|
10207
10254
|
const capitalize2 = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
10208
|
-
if (
|
|
10255
|
+
if (activeView === "month")
|
|
10209
10256
|
return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
|
|
10210
|
-
if (
|
|
10257
|
+
if (activeView === "week") {
|
|
10211
10258
|
const start = dateFns.startOfWeek(currentDate, { weekStartsOn: 1 });
|
|
10212
10259
|
const end = dateFns.endOfWeek(currentDate, { weekStartsOn: 1 });
|
|
10213
10260
|
if (dateFns.isSameMonth(start, end))
|
|
@@ -10216,17 +10263,19 @@ function EventAgenda({
|
|
|
10216
10263
|
const s2 = capitalize2(dateFns.format(end, "MMM yyyy", { locale: locale.ptBR }));
|
|
10217
10264
|
return `${s1} - ${s2}`;
|
|
10218
10265
|
}
|
|
10219
|
-
if (
|
|
10220
|
-
return
|
|
10221
|
-
|
|
10266
|
+
if (activeView === "day")
|
|
10267
|
+
return capitalize2(
|
|
10268
|
+
dateFns.format(currentDate, "EEEE, d 'de' MMMM", { locale: locale.ptBR })
|
|
10269
|
+
);
|
|
10270
|
+
if (activeView === "agenda") {
|
|
10222
10271
|
const start = currentDate;
|
|
10223
10272
|
return capitalize2(dateFns.format(start, "MMMM yyyy", { locale: locale.ptBR }));
|
|
10224
10273
|
}
|
|
10225
|
-
if (
|
|
10274
|
+
if (activeView === "year") {
|
|
10226
10275
|
return dateFns.format(currentDate, "yyyy");
|
|
10227
10276
|
}
|
|
10228
10277
|
return capitalize2(dateFns.format(currentDate, "MMMM yyyy", { locale: locale.ptBR }));
|
|
10229
|
-
}, [currentDate,
|
|
10278
|
+
}, [currentDate, activeView]);
|
|
10230
10279
|
const availableViews = showYearView ? ["year", "month", "week", "day", "agenda"] : ["month", "week", "day", "agenda"];
|
|
10231
10280
|
const selectItems = availableViews.map(
|
|
10232
10281
|
(v) => ({
|
|
@@ -10274,22 +10323,22 @@ function EventAgenda({
|
|
|
10274
10323
|
] }),
|
|
10275
10324
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold text-sm sm:text-base md:text-lg lg:text-xl xl:text-2xl min-w-0 truncate sm:whitespace-normal", children: viewTitle })
|
|
10276
10325
|
] }),
|
|
10277
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10326
|
+
!lockedView && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10278
10327
|
Select,
|
|
10279
10328
|
{
|
|
10280
|
-
selected:
|
|
10329
|
+
selected: activeView,
|
|
10281
10330
|
onChange: (v) => {
|
|
10282
10331
|
setView(v);
|
|
10283
10332
|
},
|
|
10284
10333
|
items: selectItems,
|
|
10285
|
-
placeholder: viewLabel(
|
|
10334
|
+
placeholder: viewLabel(activeView),
|
|
10286
10335
|
className: "min-w-24",
|
|
10287
10336
|
hideClear: true
|
|
10288
10337
|
}
|
|
10289
10338
|
) })
|
|
10290
10339
|
] }),
|
|
10291
10340
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col transition-all duration-200 ease-in-out", children: [
|
|
10292
|
-
|
|
10341
|
+
activeView === "month" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10293
10342
|
MonthViewAgenda,
|
|
10294
10343
|
{
|
|
10295
10344
|
currentDate,
|
|
@@ -10298,7 +10347,7 @@ function EventAgenda({
|
|
|
10298
10347
|
noTime
|
|
10299
10348
|
}
|
|
10300
10349
|
),
|
|
10301
|
-
|
|
10350
|
+
activeView === "week" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10302
10351
|
WeekViewAgenda,
|
|
10303
10352
|
{
|
|
10304
10353
|
currentDate,
|
|
@@ -10307,7 +10356,7 @@ function EventAgenda({
|
|
|
10307
10356
|
noTime
|
|
10308
10357
|
}
|
|
10309
10358
|
),
|
|
10310
|
-
|
|
10359
|
+
activeView === "day" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10311
10360
|
DayViewAgenda,
|
|
10312
10361
|
{
|
|
10313
10362
|
currentDate,
|
|
@@ -10316,7 +10365,7 @@ function EventAgenda({
|
|
|
10316
10365
|
noTime
|
|
10317
10366
|
}
|
|
10318
10367
|
),
|
|
10319
|
-
|
|
10368
|
+
activeView === "agenda" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10320
10369
|
Agenda,
|
|
10321
10370
|
{
|
|
10322
10371
|
currentDate,
|
|
@@ -10325,14 +10374,16 @@ function EventAgenda({
|
|
|
10325
10374
|
noTime
|
|
10326
10375
|
}
|
|
10327
10376
|
),
|
|
10328
|
-
|
|
10377
|
+
activeView === "year" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10329
10378
|
YearViewAgenda,
|
|
10330
10379
|
{
|
|
10331
10380
|
currentDate,
|
|
10332
10381
|
events,
|
|
10333
10382
|
onMonthSelect: (monthDate) => {
|
|
10334
10383
|
setCurrentDate(monthDate);
|
|
10335
|
-
|
|
10384
|
+
if (!lockedView) {
|
|
10385
|
+
setView("month");
|
|
10386
|
+
}
|
|
10336
10387
|
}
|
|
10337
10388
|
}
|
|
10338
10389
|
)
|
|
@@ -21766,7 +21817,7 @@ function useCommandPalette({
|
|
|
21766
21817
|
React32.useEffect(() => {
|
|
21767
21818
|
setActiveIndex(0);
|
|
21768
21819
|
}, [page]);
|
|
21769
|
-
const displayedGroups =
|
|
21820
|
+
const displayedGroups = React32.useMemo(() => {
|
|
21770
21821
|
const start = page * PAGE_SIZE;
|
|
21771
21822
|
const end = start + PAGE_SIZE;
|
|
21772
21823
|
let count = 0;
|
|
@@ -21785,12 +21836,12 @@ function useCommandPalette({
|
|
|
21785
21836
|
}
|
|
21786
21837
|
return result;
|
|
21787
21838
|
}, [allMatchedGroups, page]);
|
|
21788
|
-
const flatItems =
|
|
21839
|
+
const flatItems = React32.useMemo(
|
|
21789
21840
|
() => displayedGroups.flatMap((g) => g.items),
|
|
21790
21841
|
[displayedGroups]
|
|
21791
21842
|
);
|
|
21792
21843
|
const pageItemCount = flatItems.length;
|
|
21793
|
-
|
|
21844
|
+
React32.useEffect(() => {
|
|
21794
21845
|
setActiveIndex((i) => Math.min(i, Math.max(pageItemCount - 1, 0)));
|
|
21795
21846
|
}, [pageItemCount]);
|
|
21796
21847
|
function handleSelect(item) {
|